aboutsummaryrefslogtreecommitdiff
path: root/macros/src
diff options
context:
space:
mode:
Diffstat (limited to 'macros/src')
-rw-r--r--macros/src/codegen/module.rs6
-rw-r--r--macros/src/codegen/software_tasks.rs9
-rw-r--r--macros/src/codegen/timer_queue.rs14
3 files changed, 17 insertions, 12 deletions
diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs
index c3801332..afda26cf 100644
--- a/macros/src/codegen/module.rs
+++ b/macros/src/codegen/module.rs
@@ -266,6 +266,9 @@ pub fn codegen(
let user_imports = &app.user_imports;
+ let doc = format!(" RTIC internal: {}:{}", file!(), line!());
+ items.push(quote!(#[doc = #doc]));
+
items.push(quote!(
/// Holds methods related to this monotonic
pub mod #m {
@@ -312,6 +315,7 @@ pub fn codegen(
.write(input);
#app_path::#instants
+ .get_mut_unchecked()
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(instant);
@@ -324,7 +328,7 @@ pub fn codegen(
rtic::export::interrupt::free(|_|
if let Some(mono) = #app_path::#m_ident.as_mut() {
- #app_path::#tq.enqueue_unchecked(
+ #app_path::#tq.get_mut_unchecked().enqueue_unchecked(
nr,
|| #enable_interrupt,
|| #pend,
diff --git a/macros/src/codegen/software_tasks.rs b/macros/src/codegen/software_tasks.rs
index b114f79d..d4ff274d 100644
--- a/macros/src/codegen/software_tasks.rs
+++ b/macros/src/codegen/software_tasks.rs
@@ -65,13 +65,14 @@ pub fn codegen(
let mono_type = &monotonic.ty;
let uninit = mk_uninit();
+ let doc = format!(" RTIC internal: {}:{}", file!(), line!());
mod_app.push(quote!(
#uninit
// /// Buffer that holds the instants associated to the inputs of a task
- #[doc(hidden)]
- static mut #instants:
- [core::mem::MaybeUninit<rtic::time::Instant<#mono_type>>; #cap_lit] =
- [#(#elems,)*];
+ #[doc = #doc]
+ static #instants:
+ rtic::RacyCell<[core::mem::MaybeUninit<rtic::time::Instant<#mono_type>>; #cap_lit]> =
+ rtic::RacyCell::new([#(#elems,)*]);
));
}
diff --git a/macros/src/codegen/timer_queue.rs b/macros/src/codegen/timer_queue.rs
index f3fb5804..47f45350 100644
--- a/macros/src/codegen/timer_queue.rs
+++ b/macros/src/codegen/timer_queue.rs
@@ -61,13 +61,13 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea
let n = util::capacity_typenum(cap, false);
let tq_ty = quote!(rtic::export::TimerQueue<#mono_type, #t, #n>);
+ let doc = format!(" RTIC internal: {}:{}", file!(), line!());
items.push(quote!(
- #[doc(hidden)]
- static mut #tq: #tq_ty = rtic::export::TimerQueue(
- rtic::export::BinaryHeap(
- rtic::export::iBinaryHeap::new()
- )
- );
+ #[doc = #doc]
+ static #tq: rtic::RacyCell<#tq_ty> =
+ rtic::RacyCell::new(rtic::export::TimerQueue(
+ rtic::export::BinaryHeap(rtic::export::iBinaryHeap::new())
+ ));
));
let mono = util::monotonic_ident(&monotonic_name);
@@ -129,7 +129,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea
while let Some((task, index)) = rtic::export::interrupt::free(|_|
if let Some(mono) = #app_path::#m_ident.as_mut() {
- #tq.dequeue(|| #disable_isr, mono)
+ #tq.get_mut_unchecked().dequeue(|| #disable_isr, mono)
} else {
// We can only use the timer queue if `init` has returned, and it
// writes the `Some(monotonic)` we are accessing here.