-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
115 lines (72 loc) · 2.99 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
AltOS - 8051 operating system for Altus-Metrum projects
Copyright and License
Copyright © 2009 Keith Packard <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
Tasking API:
* Multi-tasking
* Non-preemptive
* Unix-style sleep/wakeup scheduling
* Strict round-robin, no priorities
uint8_t ao_sleep(void *wchan)
Puts current task to sleep. Will wake up when wchan is
signalled (returning 0), or when an alarm has expired
(returning 1).
void ao_wakeup(void *wchan)
Wakeup all tasks sleeping on wchan
void ao_add_task(struct ao_task *task, void (*start)(void))
Adds a task to the queue of available tasks
void ao_start_scheduler(void)
Invokes the scheduler, starting the operating system
void ao_yield(void)
Switches to another task which is ready to run. Allows
tasks which want to run for a while to give up the CPU
without needing to sleep
void ao_panic(uint8_t reason)
Any fatal error should call this function, which can
display the error code in some cryptic fashion.
void ao_wake_task(struct ao_task *task)
Wake the task as if the wchan it is waiting on had
been signalled.
void ao_alarm(uint16_t delay)
Queue an alarm to expire 'delay' ticks in the future.
The alarm will cause the task to wake from ao_sleep
and return 1. Alarms are cancelled if the task is
awoken by ao_wakeup or ao_wake_task.
void ao_exit(void)
Stop the current task and remove it from the list of
available tasks.
Timer API
* Regular timer ticks (at 100Hz, by default)
* All time values are in ticks
uint16_t ao_time(void)
Returns the curent tick count
void ao_delay(uint16_t delay)
Suspend task execution for 'delay' ticks.
DMA API
* Static DMA entry allocation
uint8_t ao_dma_alloc(uint8_t *done)
Allocates one of the 5 DMA units on the cc1111
processor. When this DMA unit is finished, it will
set *done to 1 and wakeup anyone waiting on that.
void ao_dma_set_transfer(uint8_t id, void *src, void *dst,
uint16_t count, uint8_t cfg0, uint8_t cfg1)
Prepares the specified DMA unit for operation.
void ao_dma_start(uint8_t id)
Start DMA on the specified channel.
void ao_dma_trigger(uint8_t id)
Manually trigger a DMA channel
void ao_dma_abort(uint8_t id)
Abort a pending DMA transfer, signalling
that by setting the associated 'done' to
AO_DMA_ABORTED and waking any task
sleeping on that.