Go to the source code of this file.
Data Structures | |
struct | t_TASK |
struct | t_TASK_BLOCK |
struct | t_op_BUFFER |
struct | t_SEMAPHORE |
struct | t_MAILBOX |
struct | t_QUEUE |
Defines | |
#define | Opale_version "00.02.00b" |
#define | _N_ 3 |
#define | _Y_ 8 |
#define | _X_ (1<<_N_) |
#define | NUM_TASKS (_X_*_Y_) |
#define | TO_LOWEST_SETTED_BIT_TABLE_SIZE ((_X_>_Y_)?(1<<_X_):(1<<_Y_)) |
#define | IDLE_TASK_STACK_SIZE 70 |
#define | LOWEST_PRIORITY (NUM_TASKS-1) |
#define | op_EnterCriticalSection() asm(" trap #7") |
#define | op_ExitCriticalSection() asm(" trap #8") |
Typedefs | |
typedef t_TASK | t_TASK |
typedef t_TASK_BLOCK | t_TASK_BLOCK |
typedef t_op_BUFFER | t_op_BUFFER |
typedef t_SEMAPHORE | t_SEMAPHORE |
typedef t_MAILBOX | t_MAILBOX |
Functions | |
void | op_KernelInit (register t_op_BUFFER *buffer asm("%a0"), register unsigned char rotationMask asm("%d0")) |
void | op_KernelStart (void) |
void | op_KernelStop (void) __attribute__((noreturn)) |
short | op_TaskStart (register t_TASK *task asm("%a3"), register void(*taskEntryFunction)(register void *asm("%a0")) asm("%a2"), register char *stackPointer asm("%a1"), register unsigned char ident asm("%d0"), register void *taskFunctionArgs asm("%a0")) |
void | op_TaskStop (void) |
void | op_TaskWaitForTicks (register unsigned short ticks asm("%d0")) |
void | op_SemaphoreInit (register t_SEMAPHORE *semaphore asm("%a0"), register unsigned long initValue asm("%d0")) |
void | op_SemaphorePost (register t_SEMAPHORE *semaphore asm("%a0")) |
void | op_SemaphorePend (register t_SEMAPHORE *semaphore asm("%a0")) |
void | op_MailBoxInit (register t_MAILBOX *mailbox asm("%a0"), register void *initMessage asm("%d0")) |
unsigned short | op_MailBoxPost (register t_MAILBOX *mailBox asm("%a0"), register void *message asm("%d0")) |
void * | op_MailBoxPend (register t_MAILBOX *mailBox asm("%a0")) |
void | op_QueueInit (register t_QUEUE *queue asm("%a0"), register void *buffer asm("%d0"), register unsigned short size asm("%d1")) |
unsigned short | op_QueuePost (register t_QUEUE *queue asm("%a0"), register void *message asm("%d0")) |
unsigned short | op_QueuePostFront (register t_QUEUE *queue asm("%a0"), register void *message asm("%d0")) |
void * | op_QueuePend (register t_QUEUE *queue asm("%a0")) |
Variables | |
unsigned long | op_idleCounter |
|
First primary constant to fix the highest number of tasks the kernel will handle. This is an internal constant, so you don't have to change it if you're not rebuilding the kernel itself. If you are, fix N so that X will be 2^N. Because of the size of some tables, N can't be more than 3. |
|
X is the number of rows for all tasks tables |
|
Second constant to fix the highest number of tasks the kernel will handle. This is an internal constant, so you don't have to change it if you're not rebuilding the kernel itself. It is the number of lines for all tasks tables. Y can take any value from 2 to 8. |
|
Size of the stack needed by the idle task (lowest priority task allocated by the kernel itself). This is the stack size needed to handle a single context switch. |
|
Lowest priority. Used by the idle task. |
|
Total number of tasks the kernel will be able to handle. Because of the size of some table, it could be wise to take some standardize values for Y and N (such as 8/3 for 64 tasks, 4/2 for 16 tasks and not try bigger than 8/3 (64 tasks). |
|
That macro enables to enter a critical section. While in a critical section, a task can't be interrupted by any other task or an interrupt since SR is set to 0x2700. It uses a custom trap 7. Never use this macro if you are already in a critical section ! |
|
Exits a critical section, and restores SR to the value it has before the call to op_EnterCriticalSection(). Uses a custom trap 8. |
|
Current version |
|
Size of a table used to get the highest priority task in any task table. |
|
Structure to describe a mailBox event handler. Mailboxes are objects that helps synchronyzation and data sharing between tasks |
|
Structure that will contain some tables used by the kernel. Once again, it doesn't need to be initialized/modified by the user. |
|
Structure describing a semaphore event handler. Semaphores are objects that helps synchronyzation between tasks |
|
Structure describing a task. It is not useful to know exactly what's in since you don't have to initialize or read/modify the fields yourself if you are making a program using the kernel. |
|
Structure to handle waiting tasks (on an event, a tick, etc) |
|
Inits the kernel. It is the first function you have to call before using any other function of Opale.
|
|
Starts the kernel by launching the highest priority task ready to run. If there's been no call to op_TaskStart before entering op_KernelStart, the idle task will be made ready to run and the system will be freezed waiting for an interrupt or anything. So don't forget to create at least one task before calling op_KernelStart. op_KernelStart never returns except if op_KernelStop is called. |
|
Stops all running tasks, and exits the kernel multithreading. The effect is just that op_KernelStart seemes to return, and so the code after the call to op_KernelStart will be executed. Remember that it won't free ressources allocated by the tasks. |
|
Inits a MailBox with an initial message. It is done so you just don't have to fill manually the fields of the t_MAILBOX object.
|
|
Wait for a message to be posted in the mailbox. If a message already is in the mailbox when the function is called, it will just return it. If there's no message, the task will be removed from the ready list and make ready again only when a message has been posted and the task is the highest priority one waiting for it.
|
|
Post to the mailbox. It will fill the message field if it isn't already not NULL. If so, the function will return an error. If tasks were waiting on the mailbox, the highest priority one is made ready to run and the scheduler is called.
|
|
Inits a message queue with an initial message. It is done so you just don't have to fill manually the fields of the t_MAILBOX object.
|
|
Wait for a message to be posted in the message queue. If one or more message already is in the queue when the function is called, it will just return the one on the front of the queue. If there's no message, the task will be removed from the ready list and make ready again only when a message has been posted and the task is the highest priority one waiting for it.
|
|
Post a message on the back of the message queue. It will add the message to the back of the queue if the queue isn't already full. If so, the function will return an error. If tasks were waiting on the message queue, the highest priority one is made ready to run and the scheduler is called.
|
|
Post a message on the front of the message queue. It will add the message to the front of the queue if the queue isn't already full. If so, the function will return an error. This is different from QueuePost since the messages are taken from the front of the queue on a QueuePend. So a message posted with QueuePostFronT will be read before one posted with QueuePost. If tasks were waiting on the message queue, the highest priority one is made ready to run and the scheduler is called.
|
|
Inits a Semaphore with an initial count. It is done so you just don't have to fill manually the fields of the t_SEMAPHORE object.
|
|
Pend on a semaphore. If the count is not 0, the function will just return. If the semaphore has already been taken (its count isn't 0), the task will be removed from the ready list and wait until some other task post to the semaphore, and no other task of higher priority is pending on it.
|
|
Post to the semaphore. It will increment the semaphore's count, and made ready to run the highest priority task pending on it. The scheduler is then called.
|
|
Loads a task in the kernel. After the call to op_TaskStart, if the scheduler is activated, the highest priority task will be made ready to run.
|
|
Stops the current task. Use it at the end of a task function when you want to end it. Remember task functions shall not return, so if you want to quit one of those, use op_TaskStop |
|
Make a task wait for a number of ticks. A tick occurs each time the int 5 is called. The task will be made ready to run when the given time has expired and it is the highest priority task ready to run.
|
|
counter incremented by the idle task. Useful to compute CPU load. |