This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | t_MAILBOX |
struct | t_op_BUFFER |
struct | t_QUEUE |
struct | t_SEMAPHORE |
struct | t_TASK |
struct | t_TASK_BLOCK |
Defines | |
#define | _N_ 3 |
#define | _X_ (1<<_N_) |
#define | _Y_ 8 |
#define | IDLE_TASK_STACK_SIZE 70 |
#define | LOWEST_PRIORITY (NUM_TASKS-1) |
#define | NUM_TASKS (_X_*_Y_) |
#define | op_EnterCriticalSection() asm(" trap #7") |
#define | op_ExitCriticalSection() asm(" trap #8") |
#define | Opale_version "00.03.000" |
#define | TO_LOWEST_SETTED_BIT_TABLE_SIZE ((_X_>_Y_)?(1<<_X_):(1<<_Y_)) |
Typedefs | |
typedef t_MAILBOX | t_MAILBOX |
typedef t_op_BUFFER | t_op_BUFFER |
typedef t_SEMAPHORE | t_SEMAPHORE |
typedef t_TASK | t_TASK |
typedef t_TASK_BLOCK | t_TASK_BLOCK |
Functions | |
void | op_KernelInit (register t_op_BUFFER *buffer asm(" "), register unsigned char rotationMask asm("Ð")) |
void | op_KernelStart (void) |
void | op_KernelStop (void) __attribute__((noreturn)) |
void | op_MailBoxInit (register t_MAILBOX *mailbox asm(" "), register void *initMessage asm("Ð")) |
void * | op_MailBoxPend (register t_MAILBOX *mailBox asm(" ")) |
unsigned short | op_MailBoxPost (register t_MAILBOX *mailBox asm(" "), register void *message asm("Ð")) |
void | op_QueueInit (register t_QUEUE *queue asm(" "), register void *buffer asm("Ð"), register unsigned short size asm("Ñ")) |
void * | op_QueuePend (register t_QUEUE *queue asm(" ")) |
unsigned short | op_QueuePost (register t_QUEUE *queue asm(" "), register void *message asm("Ð")) |
unsigned short | op_QueuePostFront (register t_QUEUE *queue asm(" "), register void *message asm("Ð")) |
void | op_SemaphoreInit (register t_SEMAPHORE *semaphore asm(" "), register unsigned long initValue asm("Ð")) |
void | op_SemaphorePend (register t_SEMAPHORE *semaphore asm(" ")) |
void | op_SemaphorePost (register t_SEMAPHORE *semaphore asm(" ")) |
short | op_TaskStart (register t_TASK *task asm("£"), register void(*taskEntryFunction)(register void *asm(" ")) asm("¢"), register char *stackPointer asm("¡"), register unsigned char ident asm("Ð"), register void *taskFunctionArgs asm(" ")) |
void | op_TaskStop (void) |
void | op_TaskWaitForTicks (register unsigned short ticks asm("Ð")) |
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. Definition at line 14 of file opale.h. |
|
X is the number of rows for all tasks tables Definition at line 23 of file opale.h. Referenced by rotate(). |
|
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. Definition at line 20 of file opale.h. Referenced by EventInit(), and op_KernelInit(). |
|
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. Definition at line 43 of file opale.h. Referenced by op_KernelInit(). |
|
Lowest priority. Used by the idle task. Definition at line 46 of file opale.h. |
|
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). Definition at line 36 of file opale.h. Referenced by op_KernelInit(). |
|
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 ! Definition at line 51 of file opale.h. Referenced by op_MailBoxPend(), op_MailBoxPost(), op_QueuePend(), op_QueuePost(), op_QueuePostFront(), op_SemaphorePend(), op_SemaphorePost(), op_TaskStart(), op_TaskStop(), and op_TaskWaitForTicks(). |
|
Exits a critical section, and restores SR to the value it has before the call to op_EnterCriticalSection(). Uses a custom trap 8. Definition at line 55 of file opale.h. Referenced by op_MailBoxPend(), op_MailBoxPost(), op_QueuePend(), op_QueuePost(), op_QueuePostFront(), op_SemaphorePend(), op_SemaphorePost(), op_TaskStart(), op_TaskStop(), and op_TaskWaitForTicks(). |
|
|
Size of a table used to get the highest priority task in any task table. Definition at line 39 of file opale.h. |
|
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.
References _Y_, IDLE_TASK_IDENT, IDLE_TASK_STACK_SIZE, idleTask, IdleTaskFunction(), idleTaskStack, indexToLowestSettedBit, InitIntVectors(), kernelStarted, NUM_TASKS, numberOfNestedISRs, numberOfNestedShedulerHalts, op_TaskStart(), readyTasks, roundRobin, t_TASK_BLOCK::rowIndex, runningTasks, and t_TASK_BLOCK::tasksTable. Here is the call graph for this function: ![]() |
|
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.
section op_KernelStart op_KernelStart: movem.l d0-a6,-(a7) lea.l idleTask(pc),a0 move.l a0,currentTask ;currentTask = &idleTask; move.l a7,exitSP ; saves SP move.l (a0),a7 addq.l #6,a7 movem.l (a7) ,d0-a6 lea.l op_idleCounter(pc),a0 clr.l (a0) move.l (a0),op_tickCounter move.l (a0),numberOfNestedShedulerHalts ; numberOfNestedShedulerHalts = 0; trap #6 ; calls scheduler IdleTaskFunction: addq.l #1,op_idleCounter |
|
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.
section op_KernelStop op_KernelStop: trap #7 ;op_EnterCriticalSection(); move.l exitSP(pc),a7 ; restores sp movem.l (a7) ,d0-a6 ; restores regs bra RestoreIntVectors(pc) ; never returns |
|
Inits a MailBox with an initial message. It is done so you just don't have to fill manually the fields of the | ||
mailBox | (a0.l) MailBox to post to. | |
message | (d0.l) Message to post. |
References MakeTaskReady(), op_EnterCriticalSection, and op_ExitCriticalSection.
Here is the call graph for this function:
|
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.
References EventInit(). Here is the call graph for this function: ![]() |
|
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.
References op_EnterCriticalSection, op_ExitCriticalSection, and WaitForEvent(). Here is the call graph for this function: ![]() |
|
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.
References MakeTaskReady(), op_EnterCriticalSection, and op_ExitCriticalSection. Here is the call graph for this function: ![]() |
|
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.
References MakeTaskReady(), op_EnterCriticalSection, and op_ExitCriticalSection. Here is the call graph for this function: ![]() |
|
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.
References EventInit(). Here is the call graph for this function: ![]() |
|
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.
References op_EnterCriticalSection, op_ExitCriticalSection, and WaitForEvent(). Here is the call graph for this function: ![]() |
|
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.
References MakeTaskReady(), op_EnterCriticalSection, and op_ExitCriticalSection. Here is the call graph for this function: ![]() |
|
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.
References addTaskToTable(), InitStack(), op_EnterCriticalSection, op_ExitCriticalSection, op_Scheduler, readyTasks, and runningTasks. Referenced by op_KernelInit(). Here is the call graph for this function: ![]() |
|
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_TaskStopDefinition at line 46 of file opale_task.c. References currentTask, t_TASK::ident, op_EnterCriticalSection, op_ExitCriticalSection, op_Scheduler, readyTasks, removeTaskFromTable(), and runningTasks. Here is the call graph for this function: ![]() |
|
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.
References currentTask, t_TASK::ident, idleTask, t_TASK::nextSleeping, op_EnterCriticalSection, op_ExitCriticalSection, op_Scheduler, t_TASK::prevSleeping, readyTasks, removeTaskFromTable(), and t_TASK::tickDelay. Here is the call graph for this function: ![]() |
|
counter incremented by the idle task. Useful to compute CPU load. section op_idleCounter: op_idleCounter: ds.l 1 |