Commit graph

28 commits

Author SHA1 Message Date
Jorge Aparicio
5ae7d5f6e0 simplify the tasks! macro, make the request function more straightforward
in its meaning
2017-04-09 23:18:00 -05:00
Jorge Aparicio
595404c5ff compile time verified ceilings 2017-04-09 22:42:17 -05:00
Jorge Aparicio
6ac2625a75 drop global critical sections in checked::Resource 2017-04-07 19:33:08 -05:00
Jorge Aparicio
185f368d63 use volatile read/writes for checked::Resource.locked 2017-04-07 18:57:13 -05:00
Jorge Aparicio
22bb0d8eae removed global critical section from checked::release 2017-04-07 18:48:33 -05:00
Jorge Aparicio
f875cfcb5c use hw ceilings in checked::Resource.lock{,mut} 2017-04-07 18:18:37 -05:00
Jorge Aparicio
f2bab47aa4 allow returns from checked::Resource.lock{,mut}
also add compiler barriers
2017-04-07 18:14:48 -05:00
Jorge Aparicio
8e1c72057c impl Sync for checked::Resource 2017-04-07 17:54:36 -05:00
Jorge Aparicio
2ae638995c initial version of checked resources 2017-04-07 17:34:06 -05:00
Jorge Aparicio
759ac160db remove the borrow_mut method from resources
it can be used to break references rules within nested locks

``` rust
static R1: Resource<bool, C1> = unsafe { Resource::new(false) };
static R2: Resource<bool, C2> = unsafe { Resource::new(false) };
static R3: Resource<bool, C3> = unsafe { Resource::new(false) };

// Priority = 1
extern "C" fn j1(task: interrupt::Exti0Irq) {
    R1.lock(&task, |r1, c1| {
        R2.lock(&task, |r2, c2| {
            R3.lock(&task, |r3, mut c3| {
                // BAD &- and &mut - that point to the same data
                let r1_ref: &bool = R1.borrow(&c2);
                let r1_ref_mut: &mut bool = R1.borrow_mut(&mut c3);
            });
        });
    });
}
```
2017-04-07 16:38:39 -05:00
Jorge Aparicio
e631d8513a partial thumbv6m-none-eabi support 2017-04-06 14:06:33 -05:00
Jorge Aparicio
01c8c3312d split get in get / get_mut 2017-04-04 16:37:01 -05:00
Jorge Aparicio
00ef129f87 add a queue function 2017-04-04 15:36:23 -05:00
Jorge Aparicio
4c1b6c8293 add debug assertions to lock and get 2017-04-03 16:18:26 -05:00
Jorge Aparicio
f3b73bcc12 add a get method to get a raw pointer to the resource data 2017-04-02 20:42:38 -05:00
Jorge Aparicio
0ef71d29a8 rustfmt 2017-04-02 20:38:45 -05:00
Jorge Aparicio
85c628c2af add methods to borrow resources within interrupt::free 2017-03-22 14:33:52 -05:00
Jorge Aparicio
441a822780 use stable release of the cortex-m crate 2017-03-12 11:19:43 -05:00
Jorge Aparicio
2d6af9b5df make logical non-const, check input using assertions 2017-03-11 18:02:11 -05:00
Jorge Aparicio
fd858a1994 make borrows of non-cooperative resources safe 2017-03-11 16:12:58 -05:00
Jorge Aparicio
4cfbf57799 add mutable variants of borrow and claim 2017-03-10 23:58:17 -05:00
Jorge Aparicio
7604400fd0 Token was renamed to Context 2017-03-10 20:11:36 -05:00
Jorge Aparicio
4da1963c8b rename priority to logical 2017-03-10 10:56:08 -05:00
Jorge Aparicio
288b01ea07 turn ceilings into types 2017-03-09 23:59:50 -05:00
Jorge Aparicio
388c34cc9f Resource::new is also unsafe 2017-03-08 08:22:31 -05:00
Jorge Aparicio
d88a15fb25 adapt to changes in cortex-m, verify the input of the priority function 2017-03-08 08:10:58 -05:00
Jorge Aparicio
e56f8156bc make priority a const fn 2017-03-05 11:36:05 -05:00
Jorge Aparicio
aba9333799 initial commit 2017-03-05 00:29:08 -05:00