Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cortex-m-rtfm-klee
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KLEE
cortex-m-rtfm-klee
Commits
fb454281
Commit
fb454281
authored
Jul 25, 2017
by
Jorge Aparicio
Browse files
Options
Downloads
Patches
Plain Diff
task! is not needed if tasks.$T.path is specified
parent
74daa77f
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
macros/src/check.rs
+2
-0
2 additions, 0 deletions
macros/src/check.rs
macros/src/trans.rs
+114
-54
114 additions, 54 deletions
macros/src/trans.rs
src/lib.rs
+4
-0
4 additions, 0 deletions
src/lib.rs
with
120 additions
and
54 deletions
macros/src/check.rs
+
2
−
0
View file @
fb454281
...
...
@@ -18,6 +18,7 @@ pub type Tasks = HashMap<Ident, Task>;
pub
struct
Task
{
pub
enabled
:
Option
<
bool
>
,
pub
path
:
Option
<
Path
>
,
pub
priority
:
u8
,
pub
resources
:
Idents
,
}
...
...
@@ -71,6 +72,7 @@ fn task(task: syntax::check::Task) -> Result<Task> {
if
let
Some
(
priority
)
=
task
.priority
{
Ok
(
Task
{
enabled
:
task
.enabled
,
path
:
task
.path
,
priority
,
resources
:
task
.resources
,
})
...
...
This diff is collapsed.
Click to expand it.
macros/src/trans.rs
+
114
−
54
View file @
fb454281
use
quote
::{
Ident
,
Tokens
};
use
syn
::{
Lit
,
StrStyle
};
use
analyze
::{
Ownership
,
Ownerships
};
use
check
::
App
;
...
...
@@ -497,9 +498,17 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
let
mut
lifetime
=
None
;
let
mut
needs_reexport
=
false
;
let
mut
needs_threshold
=
false
;
let
has_resources
=
!
task
.resources
.is_empty
();
if
has_resources
{
for
name
in
&
task
.resources
{
match
ownerships
[
name
]
{
Ownership
::
Shared
{
ceiling
}
if
ceiling
>
task
.priority
=>
{
Ownership
::
Shared
{
ceiling
}
if
ceiling
>
task
.priority
=>
{
needs_threshold
=
true
;
fields
.push
(
quote!
{
pub
#
name
:
super
::
_resource
::
#
name
,
});
...
...
@@ -571,15 +580,66 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
}
}
});
}
if
let
Some
(
path
)
=
task
.path
.as_ref
()
{
let
mut
tys
=
vec!
[];
let
mut
exprs
=
vec!
[];
let
priority
=
task
.priority
;
if
needs_threshold
{
tys
.push
(
quote!
(
&
mut
Threshold
));
exprs
.push
(
quote!
(
&
mut
Threshold
::
new
(
#
priority
)));
}
if
has_resources
{
tys
.push
(
quote!
(
#
name
::
Resources
));
exprs
.push
(
quote!
(
#
name
::
Resources
::
new
()));
}
let
_name
=
Ident
::
new
(
format!
(
"_{}"
,
name
));
let
export_name
=
Lit
::
Str
(
name
.as_ref
()
.to_owned
(),
StrStyle
::
Cooked
);
root
.push
(
quote!
{
#[allow(non_snake_case)]
#[allow(unsafe_code)]
mod
#
name
{
#[export_name
=
#
export_name]
pub
unsafe
extern
"C"
fn
#
_name
()
{
let
f
:
fn
(
#
(
#
tys
,)
*
)
=
#
path
;
f
(
#
(
#
exprs
,)
*
)
}
});
}
else
if
!
has_resources
{
items
.push
(
quote!
{
pub
struct
Resources
{
_0
:
(),
}
impl
Resources
{
pub
unsafe
fn
new
()
->
Self
{
Resources
{
_0
:
()
}
}
}
});
// the `task!` macro will be used so the `#NAME::Resources` type
// must exist
}
let
priority
=
task
.priority
;
if
task
.path
.is_none
()
{
// This `const`ant is mainly used to make sure the user doesn't
// forget to set a task handler using the `task!` macro. They'll get
// an error if they do.
items
.push
(
quote!
{
#[deny(dead_code)]
pub
const
#
name
:
u8
=
#
priority
;
});
}
root
.push
(
quote!
{
#[allow(non_snake_case)]
#[allow(unsafe_code)]
mod
#
name
{
#[allow(dead_code)]
#[deny(const_err)]
const
CHECK_PRIORITY
:
(
u8
,
u8
)
=
(
...
...
This diff is collapsed.
Click to expand it.
src/lib.rs
+
4
−
0
View file @
fb454281
...
...
@@ -191,6 +191,10 @@ impl Threshold {
impl
!
Send
for
Threshold
{}
/// Sets an interrupt as pending
///
/// If the interrupt priority is high enough the interrupt will be serviced
/// immediately, otherwise it will be serviced at some point after the current
/// task ends.
pub
fn
set_pending
<
I
>
(
interrupt
:
I
)
where
I
:
Nr
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment