aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'macros/src/codegen/util.rs')
-rw-r--r--macros/src/codegen/util.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/macros/src/codegen/util.rs b/macros/src/codegen/util.rs
index 203fcee8..8c43b350 100644
--- a/macros/src/codegen/util.rs
+++ b/macros/src/codegen/util.rs
@@ -27,9 +27,11 @@ pub fn capacity_typenum(capacity: u8, round_up_to_power_of_two: bool) -> TokenSt
pub fn cfg_core(core: Core, cores: u8) -> Option<TokenStream2> {
if cores == 1 {
None
- } else {
+ } else if cfg!(feature = "heterogeneous") {
let core = core.to_string();
Some(quote!(#[cfg(core = #core)]))
+ } else {
+ None
}
}
@@ -102,6 +104,15 @@ pub fn instants_ident(task: &Ident, sender: Core) -> Ident {
Ident::new(&format!("{}_S{}_INSTANTS", task, sender), Span::call_site())
}
+pub fn interrupt_ident(core: Core, cores: u8) -> Ident {
+ let span = Span::call_site();
+ if cores == 1 {
+ Ident::new("Interrupt", span)
+ } else {
+ Ident::new(&format!("Interrupt_{}", core), span)
+ }
+}
+
/// Generates a pre-reexport identifier for the "late resources" struct
pub fn late_resources_ident(init: &Ident) -> Ident {
Ident::new(
@@ -245,6 +256,16 @@ pub fn spawn_t_ident(receiver: Core, priority: u8, sender: Core) -> Ident {
)
}
+pub fn suffixed(name: &str, core: u8) -> Ident {
+ let span = Span::call_site();
+
+ if cfg!(feature = "homogeneous") {
+ Ident::new(&format!("{}_{}", name, core), span)
+ } else {
+ Ident::new(name, span)
+ }
+}
+
/// Generates an identifier for a timer queue
///
/// At most there's one timer queue per core