diff options
author | 2022-09-21 21:33:31 +0200 | |
---|---|---|
committer | 2022-09-24 14:07:33 +0200 | |
commit | 1341cc5bbe912d3cafcdd87f30ff75627829f0f5 (patch) | |
tree | d0a9569a2cf34cb59c0932709d219ecfac56cfad /macros/src/codegen/util.rs | |
parent | b1d499a74416ce03bde2d88b6944f64a5cd55f26 (diff) | |
download | rtic-1341cc5bbe912d3cafcdd87f30ff75627829f0f5.tar.gz rtic-1341cc5bbe912d3cafcdd87f30ff75627829f0f5.tar.zst rtic-1341cc5bbe912d3cafcdd87f30ff75627829f0f5.zip |
Broke out async dispatchers into their own place
Diffstat (limited to 'macros/src/codegen/util.rs')
-rw-r--r-- | macros/src/codegen/util.rs | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/macros/src/codegen/util.rs b/macros/src/codegen/util.rs index a0a59090..8d9d1ca9 100644 --- a/macros/src/codegen/util.rs +++ b/macros/src/codegen/util.rs @@ -184,7 +184,12 @@ pub fn regroup_inputs( pub fn get_task_name(ctxt: Context, app: &App) -> Ident { let s = match ctxt { Context::Init => app.init.name.to_string(), - Context::Idle => app.idle.as_ref().unwrap().name.to_string(), + Context::Idle => app + .idle + .as_ref() + .expect("RTIC-ICE: unable to find idle name") + .name + .to_string(), Context::HardwareTask(ident) | Context::SoftwareTask(ident) => ident.to_string(), }; @@ -195,7 +200,12 @@ pub fn get_task_name(ctxt: Context, app: &App) -> Ident { pub fn shared_resources_ident(ctxt: Context, app: &App) -> Ident { let mut s = match ctxt { Context::Init => app.init.name.to_string(), - Context::Idle => app.idle.as_ref().unwrap().name.to_string(), + Context::Idle => app + .idle + .as_ref() + .expect("RTIC-ICE: unable to find idle name") + .name + .to_string(), Context::HardwareTask(ident) | Context::SoftwareTask(ident) => ident.to_string(), }; @@ -208,7 +218,12 @@ pub fn shared_resources_ident(ctxt: Context, app: &App) -> Ident { pub fn local_resources_ident(ctxt: Context, app: &App) -> Ident { let mut s = match ctxt { Context::Init => app.init.name.to_string(), - Context::Idle => app.idle.as_ref().unwrap().name.to_string(), + Context::Idle => app + .idle + .as_ref() + .expect("RTIC-ICE: unable to find idle name") + .name + .to_string(), Context::HardwareTask(ident) | Context::SoftwareTask(ident) => ident.to_string(), }; @@ -225,6 +240,11 @@ pub fn rq_ident(priority: u8) -> Ident { mark_internal_name(&format!("P{}_RQ", priority)) } +/// Generates an identifier for a ready queue, async task version +pub fn rq_async_ident(async_task_name: &Ident) -> Ident { + mark_internal_name(&format!("ASYNC_TACK_{}_RQ", async_task_name)) +} + /// Generates an identifier for the `enum` of `schedule`-able tasks pub fn schedule_t_ident() -> Ident { mark_internal_name("SCHED_T") |