diff options
author | 2021-03-04 19:12:35 +0000 | |
---|---|---|
committer | 2021-03-04 19:12:35 +0000 | |
commit | 89a5c8004efaa8f42c86a1aedb609f49ec511333 (patch) | |
tree | 6db5b553e24a540284edc3f3fbf87043c638defc /macros/src/codegen/dispatchers.rs | |
parent | 81a8a591353b1ea0208c68b28ee81286629039cc (diff) | |
parent | 2e4a4ffd87c8a031f27635c060042019511523dc (diff) | |
download | rtic-89a5c8004efaa8f42c86a1aedb609f49ec511333.tar.gz rtic-89a5c8004efaa8f42c86a1aedb609f49ec511333.tar.zst rtic-89a5c8004efaa8f42c86a1aedb609f49ec511333.zip |
Merge #436v0.6.0-alpha.1
436: New monotonic r=AfoHT a=korken89
Design document: https://hackmd.io/vWa9GvssR8qBfUYgMZm0CQ
Closes #433
Closes #432
Closes #427
Closes #426
Closes #403
Closes #332
Closes #312
Closes #309
Closes #299
Closes #292
Closes #247
Closes #219
Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
Diffstat (limited to 'macros/src/codegen/dispatchers.rs')
-rw-r--r-- | macros/src/codegen/dispatchers.rs | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/macros/src/codegen/dispatchers.rs b/macros/src/codegen/dispatchers.rs index a6c695f1..dc33b1af 100644 --- a/macros/src/codegen/dispatchers.rs +++ b/macros/src/codegen/dispatchers.rs @@ -5,7 +5,7 @@ use rtic_syntax::ast::App; use crate::{analyze::Analysis, check::Extra, codegen::util}; /// Generates task dispatchers -pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream2> { +pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStream2> { let mut items = vec![]; let interrupts = &analysis.interrupts; @@ -26,15 +26,16 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream }) .collect::<Vec<_>>(); - let doc = format!( - "Software tasks to be dispatched at priority level {}", - level, - ); + // let doc = format!( + // "Software tasks to be dispatched at priority level {}", + // level, + // ); let t = util::spawn_t_ident(level); items.push(quote!( #[allow(non_camel_case_types)] #[derive(Clone, Copy)] - #[doc = #doc] + // #[doc = #doc] + #[doc(hidden)] pub enum #t { #(#variants,)* } @@ -42,6 +43,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream let n = util::capacity_typenum(channel.capacity, true); let rq = util::rq_ident(level); + let rq = util::mark_internal_ident(&rq); let (rq_ty, rq_expr) = { ( quote!(rtic::export::SCRQ<#t, #n>), @@ -51,12 +53,12 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream ) }; - let doc = format!( - "Queue of tasks ready to be dispatched at priority level {}", - level - ); + // let doc = format!( + // "Queue of tasks ready to be dispatched at priority level {}", + // level + // ); items.push(quote!( - #[doc = #doc] + #[doc(hidden)] static mut #rq: #rq_ty = #rq_expr; )); @@ -67,23 +69,11 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream let task = &app.software_tasks[name]; let cfgs = &task.cfgs; let fq = util::fq_ident(name); + let fq = util::mark_internal_ident(&fq); let inputs = util::inputs_ident(name); + let inputs = util::mark_internal_ident(&inputs); let (_, tupled, pats, _) = util::regroup_inputs(&task.inputs); - let (let_instant, instant) = if extra.monotonic.is_some() { - let instants = util::instants_ident(name); - - ( - quote!( - let instant = - #instants.get_unchecked(usize::from(index)).as_ptr().read(); - ), - quote!(, instant), - ) - } else { - (quote!(), quote!()) - }; - let locals_new = if task.locals.is_empty() { quote!() } else { @@ -97,12 +87,11 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream #t::#name => { let #tupled = #inputs.get_unchecked(usize::from(index)).as_ptr().read(); - #let_instant #fq.split().0.enqueue_unchecked(index); let priority = &rtic::export::Priority::new(PRIORITY); #app_path::#name( #locals_new - #name::Context::new(priority #instant) + #name::Context::new(priority) #(,#pats)* ) } |