diff options
author | 2023-03-29 18:56:07 +0000 | |
---|---|---|
committer | 2023-03-29 18:56:07 +0000 | |
commit | 31055fa64a6e178caa45f8a8e862ded6a68d3e55 (patch) | |
tree | 72c051f4d908ae6c4baf9b1a48678e64abfb39c2 /rtic-macros/src/codegen/bindings/cortex.rs | |
parent | 2a17a056d0a69f988393e12bf50a42658e291682 (diff) | |
parent | 323b847bf692a0054647536a6495f20373f6d9c7 (diff) | |
download | rtic-31055fa64a6e178caa45f8a8e862ded6a68d3e55.tar.gz rtic-31055fa64a6e178caa45f8a8e862ded6a68d3e55.tar.zst rtic-31055fa64a6e178caa45f8a8e862ded6a68d3e55.zip |
Merge #719
719: Adding a limit that async HALs can read and have as max prio r=AfoHT a=korken89
Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
Diffstat (limited to 'rtic-macros/src/codegen/bindings/cortex.rs')
-rw-r--r-- | rtic-macros/src/codegen/bindings/cortex.rs | 16 |
1 files changed, 16 insertions, 0 deletions
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<TokenStre pub fn interrupt_exit(_app: &App, _analysis: &CodegenAnalysis) -> Vec<TokenStream2> { vec![] } + +pub fn async_prio_limit(app: &App, analysis: &CodegenAnalysis) -> Vec<TokenStream2> { + 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; + )] +} |