aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2017-07-23 20:03:59 -0500
committerGravatar Jorge Aparicio <jorge@japaric.io> 2017-07-23 20:03:59 -0500
commit03f373fb24ce40e7142a2ed35999ccc666941a20 (patch)
tree55bc18cca94ec9fbc4b4eedff7dd3f8e26a4f26e
parente56ab1334e4a992309a6ff274622e70d8cc65504 (diff)
downloadrtic-03f373fb24ce40e7142a2ed35999ccc666941a20.tar.gz
rtic-03f373fb24ce40e7142a2ed35999ccc666941a20.tar.zst
rtic-03f373fb24ce40e7142a2ed35999ccc666941a20.zip
drop idle.locals
-rw-r--r--macros/src/trans.rs49
1 files changed, 6 insertions, 43 deletions
diff --git a/macros/src/trans.rs b/macros/src/trans.rs
index c0ce7c03..27929930 100644
--- a/macros/src/trans.rs
+++ b/macros/src/trans.rs
@@ -11,7 +11,6 @@ pub fn app(app: &App, ownerships: &Ownerships) -> Tokens {
let mut root = vec![];
let mut main = vec![];
- // ::trans::check(app, &mut main);
::trans::init(app, &mut main, &mut root);
::trans::idle(app, ownerships, &mut main, &mut root);
::trans::resources(app, ownerships, &mut root);
@@ -27,12 +26,6 @@ pub fn app(app: &App, ownerships: &Ownerships) -> Tokens {
quote!(#(#root)*)
}
-// Check that the exceptions / interrupts are valid
-// Sadly we can't do this test at expansion time. Instead we'll generate some
-// code that won't compile if the interrupt name is invalid.
-// fn check(app: &App, main: &mut Vec<Tokens>) {
-// }
-
fn idle(
app: &App,
ownerships: &Ownerships,
@@ -55,40 +48,6 @@ fn idle(
exprs.push(quote!(unsafe { &mut #krate::Threshold::new(0) }));
}
- if !app.idle.locals.is_empty() {
- let mut lexprs = vec![];
- let mut lfields = vec![];
-
- for (name, resource) in &app.idle.locals {
- let expr = &resource.expr;
- let ty = &resource.ty;
-
- lfields.push(quote! {
- pub #name: #krate::Static<#ty>,
- });
-
- lexprs.push(quote! {
- #name: unsafe { #krate::Static::new(#expr) },
- });
- }
-
- mod_items.push(quote! {
- #[allow(non_snake_case)]
- pub struct Locals {
- #(#lfields)*
- }
- });
-
- tys.push(quote!(&'static mut idle::Locals));
- exprs.push(quote!(unsafe { &mut LOCALS }));
-
- main.push(quote! {
- static mut LOCALS: idle::Locals = idle::Locals {
- #(#lexprs)*
- };
- });
- }
-
if !app.idle.resources.is_empty() {
let device = &app.device;
@@ -424,7 +383,9 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
&'cs self,
_cs: &'cs #krate::CriticalSection,
) -> &'cs #krate::Static<#device::#name> {
- unsafe { #krate::Static::ref_(&*#device::#name.get()) }
+ unsafe {
+ #krate::Static::ref_(&*#device::#name.get())
+ }
}
fn borrow_mut<'cs>(
@@ -432,7 +393,9 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
_cs: &'cs #krate::CriticalSection,
) -> &'cs mut #krate::Static<#device::#name> {
unsafe {
- #krate::Static::ref_mut(&mut *#device::#name.get())
+ #krate::Static::ref_mut(
+ &mut *#device::#name.get(),
+ )
}
}