aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/pre_init.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <26634292+bors[bot]@users.noreply.github.com> 2021-04-07 12:01:18 +0000
committerGravatar GitHub <noreply@github.com> 2021-04-07 12:01:18 +0000
commit6c8257bb73de0f68072467447692a1f7dff555f9 (patch)
tree815ee7267e0661532f9c3ad13021b5293efd994f /macros/src/codegen/pre_init.rs
parent3c86d713a6f8fdb052de80380a17468090e42624 (diff)
parentae691952c328757113047bf696e934316789b844 (diff)
downloadrtic-6c8257bb73de0f68072467447692a1f7dff555f9.tar.gz
rtic-6c8257bb73de0f68072467447692a1f7dff555f9.tar.zst
rtic-6c8257bb73de0f68072467447692a1f7dff555f9.zip
Merge #456
456: Cancel/reschedule support for monotonics r=AfoHT a=korken89 Design document: https://hackmd.io/lhUCzrKBS-66aadO4KsSzw?view Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
Diffstat (limited to 'macros/src/codegen/pre_init.rs')
-rw-r--r--macros/src/codegen/pre_init.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/macros/src/codegen/pre_init.rs b/macros/src/codegen/pre_init.rs
index d5105445..287f41a4 100644
--- a/macros/src/codegen/pre_init.rs
+++ b/macros/src/codegen/pre_init.rs
@@ -77,12 +77,16 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream
);));
}
- // Initialize monotonic's interrupts
- for (_, monotonic) in app.monotonics.iter()
- //.map(|(ident, monotonic)| (ident, &monotonic.args.priority, &monotonic.args.binds))
- {
+ // Initialize monotonic's interrupts and timer queues
+ for (_, monotonic) in &app.monotonics {
let priority = &monotonic.args.priority;
let binds = &monotonic.args.binds;
+ let monotonic_name = monotonic.ident.to_string();
+ let tq = util::tq_ident(&monotonic_name);
+ let tq = util::mark_internal_ident(&tq);
+
+ // Initialize timer queues
+ stmts.push(quote!(#tq.as_mut_ptr().write(rtic::export::TimerQueue::new());));
// Compile time assert that this priority is supported by the device
stmts.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];));