DolphinV4 API
1.6.1.0
|
The scheduler provides the following functionality seamless and parallel to the application execution:
DolphinV4 API implements a unique pre-emptive priority scheduler on the system level. There are two types of tasks:
System tasks run pre-emptive to the application task but concurrent to other system tasks, thus a system task can always interrupt the application task. (exception ASynchTask1, read below). System tasks always run to completion and they can't interrupt each other. Exception is the UART ASynchTask that has high priority. This tasks can also pre-empt other system tasks. There is only one application task; thus no parallel application tasks can be executed. The OS implements no message handling. Some system tasks (i.e. Timer1) can execute application code using static callbacks.
tasks are divided into synchronous and asynchronous tasks. Most of the synchronous system tasks provide the function of the radio protocol stack.
Synchronous system tasks
The synchronous system tasks are handled using the scheduler triggered by the Timer0 HW interrupt. The scheduler runs on a round robin basis and every task has an 1 ms timer slice. Every 1 ms the execution of the application is interrupted and one of the synchronous system tasks takes over the CPU. Synchronous system tasks are executed sequentially according to their priority and demand. The average duration of the synchronous task is around 50 - 150 us. In rare worst case scenarios the execution duration can be up to ~1 ms (considering high radio traffic, long radio telegrams, repeater, SmartACK on).
The execution duration is dependent on:
The following table summarizes all the synchronous system tasks. The list is ordered in descending order of the task priority. Some tasks are executed only if an execution condition is fulfilled.
Task | Description | Execution Condition | Approx. Worst case Duration |
---|---|---|---|
SynchTask1 | System timer increment - increments a 32bit counter representing the system clock counter (used also by the SW Timers) | every 1ms | ~20us |
SynchTask2 | SmartACK postmaster - provides SmartACK mailbox functionality (processes reclaims, etc.) | every 1ms if SmartACK is active | ~250us |
SynchTask3 | Radio buffer update - processes radio buffers, update subtelegram timing. If there is a telegram that has to be transmitted, it is placed to the radio HW buffer and transmission is started. | every 1ms | ~720us |
SynchTask4 | Telegram compressing - processes received subtelegrams. The occupied buffers are proved if the subtelegram already exists. If the subtelegram is new and repeating is enabled the repeater option is proved. | ~500us |
Asynchronous system tasks
Asynchronous system tasks are HW module dependent and are connected to HW interrupts. They are active only when the corresponding module and functionality is activated.
Task | Description | Approx. Worst case Duration |
---|---|---|
Prio High ASynchTask1 | Uart Rx/Tx interrupt - processes uart byte receiving/transmitting and buffer handling | ~50us |
ASynchTask2 | Radio Rx interrupt - processes incoming subtelegram | ~500us |
ASynchTask3 | Radio Tx interrupt - stops running HW state machine | ~930us |
ASynchTask4 | Timer1 - processes timer1 interrupts and timer1 callbacks | application dependent |
ASynchTask5 | IO - processes gpio interrupts and io callbacks | application dependent |