!!! This page is still under construction !!!
This page provides you some informations to get the AvRtos real time kernel running very quickly.
The kernel is preemptive and priority based.
To start the scheduler you have to call kernelStartScheduler()
This function will initialize the kernel tick timer and creates the idle task. The function checks for the highest priority task in the system and perform a context switch to execute this task. You have to create all needed tasks before calling this function.
A task is simply a function with a endless loop. Each task has it's own stack, where the current processor context will be saved to.
To create a task you have to call the function taskCreate() and provide a buffer for the tasks stack.
You have to be carefull by defining the stack size, because to small stack's can result in unpredictable system behaviour and maybe cause a system fault.
A task can have the following states.
Currently this state is not supported, because the termination of a task is not implemented.
Ready tasks are those that are able to execute. The running task, that is currently utilising the processor, will be save in the global variable kernelRunningTask
Maybe there are more than one tasks in the READY state. All tasks that are ready will be stored in the linked list kernelTaskReadyQ.
A task is in the WAIT state if it is currently waiting for either a temporal or external event. For example, if a task calls taskSleep() it will block until the delay period has expired.
Tasks can also block waiting for synchronization objects like queues, semaphores and so on.
Tasks in the Suspended state are not available for scheduling. Tasks will only enter or exit the suspended state when explicitly calling the functions taskSuspend() and taskResume().
Semaphores can be used as synchronization object. You can inform a task about a occurred interrupt with semaphores or you can use it to synchronize different tasks.
To create a semaphore simply call the API function semaphoreCreate().
With the functions semaphoreGet() and semaphoreSet() you can change the semaphore value.
If the value reached 0 and you try to get the semaphore, the calling task will be blocked for the time specified by timeoutTicks.
A mutex can be used for "MUtual EXclusion" and provide a priority inheritance mechanism. This means that a lower priority task that owns the mutex, can block a higher priority task.
You should take care about this behaviour. Normally, this situation should never occur.
The API functions for the mutexes can NOT be called from an interrupt service routine, because this may not make sense.
To create a mutex simply call the API function mutexCreate()
Getting the owner of a mutex and release the mutex again can be done by calling the API function mutexGet() and mutexGive().
Queues are other task synchronization objects. With queues you can send some data from one task to an other or from an interrupt to a task.
To create a queue simply call the API function queueCreate()
Sending a message or some data to a queue can be done by calling the API function queuePut(). If the queue is already full this function may block the calling task.
Receiving a message or some data from a queue can be done by calling the API function queueGet(). If there are no data in the queue available this function will block calling task.