#include "mkernel_config.h"
#include "typedefs.h"
#include "proc.h"
#include "timer.h"
#include "event.h"
#include "resource.h"
#include "task.h"
#include "alarm.h"
#include "execution.h"
#include "interrupts.h"
Go to the source code of this file.
Functions | |
| void | _os_yield (void) |
| Initiate a scheduling. | |
| void | ENTER_CRITICAL (void) |
| Enter a critical section in the code. | |
| void | EXIT_CRITICAL (void) |
| Exit an critical section.Since the INTCON is stored on the stack, this function can only be used together with ENTER_CRITICAL. | |
| void | TaskBeginHook (t_task_id id) |
| void | TaskEndHook (t_task_id id) |
| void | panic (int nbr) |
| Panic handler The pnaic handler has to be implemented for a specific hardware but it is used all over the kernel. | |
Variables | |
| t_task_id | _os_my_task_id |
| My own task id. | |
The implementation of a task looks as shown below. The task function may defines some local variables which allocated on the stack of the task. Typically there will be a loop which does something use full until the job is done and the process may terminate.
void TASK(Receiver) { int some_local_data = .... ; while( .. not end ...) { ... do some thing usefull ... } Task_Terminate(); }
The termination of the process is done by means of the Task_Terminate call which terminates the current process.
This section will generate automatically init code which will startup the task Receiver after system startup as a fully preemptive task with a stack of 128 byte.
The application developer has to provide a main function which has to detect the application mode and to startup the operating system with the identified application mode.
#include "myapp_defs.h" int main() { AppModeType mode; .... determine application mode .... mode = Mode_ ..... ; StartOS(mode); }
A task may wait for a single event by means of the WaitEvent service.
Definition in file kernel.h.
|
|
Initiate a scheduling. This function should _not_ be called by applications. Applications should use Task_Switch(ANY_TASK) |
|
|
Enter a critical section in the code. All interrupts are disabled till the EXIT_CRITICAL has been executed. Both functions should be used with exterem care. |
|
|
Panic handler The pnaic handler has to be implemented for a specific hardware but it is used all over the kernel.
|
1.4.6