Data Structures | |
struct | RTaskNode |
struct | RTaskList |
Typedefs | |
typedef unsigned long | RTIME |
typedef long | taskdata |
typedef void(* | ptask )(taskdata) |
Functions | |
RTaskNode * | RTaddtask (ptask task, taskdata arg, RTIME time) |
void | RTremove_task (RTaskNode *taskptr) |
void | RTdisable (void) |
void | RTenable (void) |
void | RTsaveflags (void) |
void | RTrestoreflags (void) |
|
all real time tasks are of type ptask, no return value with a taskdata variable passed to them IMPORTANT: A task passed to the scheduler must have __attribute__((far)) or it will fly off into space when the task is run! Definition at line 34 of file realtime.h. |
|
type RTIME is used for all time references. It's units are in us Definition at line 23 of file realtime.h. |
|
type taskdata is passed to each real time task, it is commonly used to pass a pointer value Definition at line 28 of file realtime.h. |
|
adds a task to the scheduler RTaddtask adds a task to the scheduler. The task is a function of type ptask and will be passed a taskdata arguement when it is called. The taskdata arguement is commonly used to cast a pointer, this will cause the GNU compiler to issue a warning but will work fine. The final arguement, time, is the absolute time the task is scheduled to run in micro-seconds(us), this will therefore need to be the sum of the current system time and the offset when the task is supposed to run. The current system time is stored in the global variable systime which will need to be externally referenced (extern RTIME systime). This variable holds the current system time in us and is updated every 1.024 ms. see the heartbeat function for a simple example of how a task can run and reschedule itself.
|
|
Disable Real Time interrupts |
|
Enable Real Time interrupts |
|
remove a task from the task list remember that a task is reassigned a node every time it's scheduled, so if a task is rescheduling itself and you want to be able to stop it you'll need to keep track of the pointers coming back from the RTaddtask call..
|
|
Restore the interrupt state saved by RTsaveflags
|
|
Disable Real Time interrupts and save their current state |