From 323b847bf692a0054647536a6495f20373f6d9c7 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Wed, 29 Mar 2023 20:43:27 +0200 Subject: Adding a limit that async HALs can read and have as max prio --- rtic-macros/src/codegen/bindings/cortex.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'rtic-macros/src/codegen/bindings/cortex.rs') diff --git a/rtic-macros/src/codegen/bindings/cortex.rs b/rtic-macros/src/codegen/bindings/cortex.rs index 767befa9..eba2afca 100644 --- a/rtic-macros/src/codegen/bindings/cortex.rs +++ b/rtic-macros/src/codegen/bindings/cortex.rs @@ -322,3 +322,19 @@ pub fn interrupt_entry(_app: &App, _analysis: &CodegenAnalysis) -> Vec Vec { vec![] } + +pub fn async_prio_limit(app: &App, analysis: &CodegenAnalysis) -> Vec { + let max = if let Some(max) = analysis.max_async_prio { + quote!(#max) + } else { + // No limit + let device = &app.args.device; + quote!(1 << #device::NVIC_PRIO_BITS) + }; + + vec![quote!( + /// Holds the maximum priority level for use by async HAL drivers. + #[no_mangle] + static RTIC_ASYNC_MAX_LOGICAL_PRIO: u8 = #max; + )] +} -- cgit v1.2.3