The third column of the table shows the service's properties:
Service | Arguments | Description | Properties |
---|---|---|---|
System | |||
OS_Sched | | Scan all tasks, select ready task with the highest priority and run it | |
OS_Run | | Run operating system's kernel. Calls OS_Sched() in infinite loop | |
OS_Init | | Initialize system variables | |
OS_Timer | | Increase all active timers | |
Waiting | |||
OS_Yield | | Return to the scheduler | |
OS_Delay | (delaytime) | Delay current task for delaytime system ticks | |
OS_Wait | (condition) | Wait for condition to become true | |
OS_Wait_TO | (condition, timeout) | Wait for condition to become true. Exit if timeout expired | |
Checking | |||
bool OS_IsTimeout | | Return true if timeout occurred in previous wait service | |
bool OS_IsError | | Check for error after task creation | |
bool OS_IsEventError | | Check for error after using events | |
bool OS_IsInCriticalSection | | Return true if any task is in critical section | |
Interrupts | |||
OS_EnterInt | | For PICC16 and PICC18: save FSR at the beginning of ISR function | |
OS_LeaveInt | | For PICC16 and PICC18: restore saved FSR at the end of ISR function | |
char OS_DI | | Disable all interrupts and save previous state of GIEx flags | |
OS_EI | | Enable all interrupts | |
OS_RI | (char) | Restore GIEx flags previously saved by OS_DI service | |
OS_EnterCriticalSection | | Enter critical section | |
OS_LeaveCriticalSection | | Leave critical section |
Service | Arguments | Description | Properties |
---|---|---|---|
Creating/Deleting | |||
OS_Task_Define | (TaskName) | For CCS: Tell compiler that function TaskName is a task and it will be called indirectly. This service is called from main() only | main |
OS_Task_Create | (priority, TaskName) | Create task from function TaskName and add it to the list of active tasks | |
OS_Task_Replace | (priority, TaskName) | Stop and delete current task and create a new task from function TaskName | |
OS_Task_Delete | (tp) | Delete task | |
Management | |||
OST_TASK_POINTER OS_Task_GetCur | | Get pointer to current task's descriptor | |
OST_TASK_POINTER OS_Task_GetCreated | | Get pointer to just-created task's descriptor | |
OS_Task_Pause | (tp) | Pause task | |
OS_Task_Continue | (tp) | Continue paused task | |
char OS_Task_GetPriority | (tp) | Get priority of task | |
OS_Task_SetPriority | (tp, priority) | Change task's priority | |
Checking | |||
OS_Task_IsPaused | (tp) | Check if task is paused |
Service | Arguments | Description | Properties |
---|---|---|---|
Management | |||
OS_Bsem_Set | (bsem) | Signal binary semaphore | |
OS_Bsem_Reset | (bsem) | Reset binary semaphore | |
OS_Bsem_Switch | (bsem) | Change binary semaphore's state | |
Checking | |||
OST_WORD OS_Bsem_Check | (bsem) | Check if binary semaphore is set | |
Waiting | |||
OS_Bsem_Wait | (bsem) | Wait for binary semaphore to be set | |
OS_Bsem_Wait_TO | (bsem, timeout) | Wait for binary semaphore to be set. Exit if timeout expired |
Service | Arguments | Description | Properties |
---|---|---|---|
Creating | |||
OS_Csem_Create | (csem) | Create and zero counting semaphore | |
Management | |||
OS_Csem_Signal | (csem) | Increase counting semaphore's value by 1 (wait if overflow) | |
OS_Csem_Signal_Now | (csem) | Increase counting semaphore's value by 1 (don't wait if overflow) | |
OS_Csem_Set | (csem) | Set counting semaphore's value to 1 | |
OS_Csem_SetValue | (csem, value) | Set counting semaphore's value to a given value | |
OS_Csem_Reset | (csem) | Zero counting semaphore | |
Checking | |||
bool OS_Csem_Check | (csem) | Check if counting semaphore is set (non-zero) | |
OS_Csem_Accept | (csem) | Accept counting semaphore. Decrease its value by 1 | |
Waiting | |||
OS_Csem_Wait | (csem) | Wait for counting semaphore. Then decrease its value by 1 | |
OS_Csem_Wait_TO | (csem, timeout) | Wait for counting semaphore. Then decrease its value by 1. Exit if timeout expired |
Service | Arguments | Description | Properties |
---|---|---|---|
Creating | |||
OS_Msg_Create | (msg_cb) | Create a message control block and zero it | |
Sending | |||
OS_Msg_Send | (msg_cb, message) | Send message. If message already exists then wait until it becomes free | |
OS_Msg_Send_TO | (msg_cb, message, timeout) | Send message. If message already exists then wait until it becomes free. Exit if timeout expired | |
OS_Msg_Send_Now | (msg_cb, message) | Send message. If message already exists then it will be overwritten | |
Checking | |||
bool OS_Msg_Check | (msg_cb) | Check if message exists | |
OS_Msg_Accept | (msg_cb, os_msg_type_var) | Accept existing message. After accepting, message is freed | |
Waiting | |||
OS_Msg_Wait | (msg_cb, os_msg_type_var) | Wait for message. After waiting, message is freed | |
OS_Msg_Wait_TO | (msg_cb, os_msg_type_var, timeout) | Wait for message. Exit if timeout expired |
Service | Arguments | Description | Properties |
---|---|---|---|
Creating | |||
OS_Smsg_Create | (smsg) | Create and zero a simple message | |
Sending | |||
OS_Smsg_Send | (smsg, smessage) | Send a simple message. If message already exists then wait until it becomes free | |
OS_Smsg_Send_TO | (smsg, smessage, timeout) | Send a simple message. If message already exists then wait until it becomes free. Exit if timeout expired | |
OS_Smsg_Send_Now | (smsg, smessage) | Send a simple message. If message already exists then it will be overwritten | |
Checking | |||
bool OS_Smsg_Check | (smsg) | Check if simple message exists | |
OS_Smsg_Accept | (smsg, os_smsg_type_var) | Accept existing simple message. After accepting, message is cleared | |
Waiting | |||
OS_Smsg_Wait | (smsg, os_smsg_type_var) | Wait for simple message. After accepting, simple message is cleared | |
OS_Smsg_Wait_TO | (smsg, os_smsg_type_var, timeout) | Wait for simple message. After accepting, simple message is cleared. Exit if timeout expired |
Service | Arguments | Description | Properties |
---|---|---|---|
Creating | |||
OS_Queue_Create | (queue, buffer, size) | Create and clear queue | |
Sending | |||
OS_Queue_Send | (queue, message) | Send message via queue. If queue full then wait for free slot | |
OS_Queue_Send_TO | (queue, message, timeout) | Send message via queue. If queue full then wait for free slot. Exit if timeout expired | |
OS_Queue_Send_Now | (queue, message) | Send message via queue. If queue is full then oldest message will be dropped | |
Checking | |||
bool OS_Queue_Check | (queue) | Check if there is any message in queue | |
bool OS_Queue_IsFull | (queue) | Check if queue of messages is full | |
bool OS_Queue_IsEmpty | (queue) | Check if queue of messages is empty | |
Waiting | |||
OS_Queue_Wait | (queue, os_msg_type_var) | Wait for message from queue. After accepting message, it will be deleted from queue | |
OS_Queue_Wait_TO | (queue, os_msg_type_var, timeout) | Wait for message from queue. After accepting message, it will be deleted from queue. Exit if timeout expired |
Service | Arguments | Description | Properties |
---|---|---|---|
Creating | |||
OS_Squeue_Create | (squeue, buffer, size) | Create and clear queue | |
Sending | |||
OS_Squeue_Send | (squeue, smessage) | Send simple message via queue. If queue full then wait for free slot | |
OS_Squeue_Send_TO | (squeue, smessage, timeout) | Send message via queue. If queue full then wait for free slot. Exit if timeout expired | |
OS_Squeue_Send_Now | (squeue, smessage) | Send message via queue. If queue is full then oldest message will be dropped | |
Checking | |||
bool OS_Squeue_Check | (squeue) | Check if there is any simple message in queue | |
bool OS_Squeue_IsFull | (squeue) | Check if queue of simple messages is full. | |
bool OS_Squeue_IsEmpty | (squeue) | Check if queue of simple messages is empty | |
Waiting | |||
OS_Squeue_Wait | (squeue, os_smsg_type_var) | Wait for a message from the queue. After accepting message, it will be deleted from queue | |
OS_Squeue_Wait_TO | (squeue, os_smsg_type_var, timeout) | Wait a message from the queue. After accepting message, it will be deleted from queue. Exit if timeout expired |
Service | Arguments | Description | Properties |
---|---|---|---|
Creating | |||
OS_Flag_Create | (flag) | (flag = 0) Create flag and clear all its bits | |
Management | |||
OS_Flag_Init | (flag, value) | (flag = value) Set flag to given value | |
OS_Flag_Set | (flag, mask) | (flag = flag | mask) Set bits in flag according to mask | |
OS_Flag_Clear | (flag, mask) | (flag &= ~mask) Clear bits in flag according to mask | |
Checking | |||
bool OS_Flag_Check_AllOn | (flag, mask) | ( if ((flag & mask)==mask) ) Check if all bits in flag specified by mask are set | |
bool OS_Flag_Check_On | (flag, mask) | ( if ((flag & mask)!=0) ) Check if any bit in flag specified by mask is set | |
bool OS_Flag_Check_AllOff | (flag, mask) | ( if ((flag & mask)==0) ) Check if all bits in flag specified by mask are cleared | |
bool OS_Flag_Check_Off | (flag, mask) | ( if ((flag & mask)!=mask) ) Check if any bit in flag specified by mask is cleared | |
Waiting | |||
OS_Flag_Wait_AllOn | (flag, mask) | ( if ((flag & mask)==mask) ) Wait until all bits in flag specified by mask are set | |
OS_Flag_Wait_On | (flag, mask) | ( wait ((flag & mask)!=0) ) Wait until any bit in flag specified by mask is set | |
OS_Flag_Wait_AllOff | (flag, mask) | ( wait ((flag & mask)==0) ) Wait until all bit in flag specified by mask are cleared | |
OS_Flag_Wait_Off | (flag, mask) | ( wait ((flag & mask)!=mask) ) Wait until any bit in flag specified by mask is cleared | |
OS_Flag_Wait_AllOn_TO | (flag, mask, timeout) | ( wait ((flag & mask)==mask) ) Wait until all bits in flag specified by mask are set. Exit if timeout expired | |
OS_Flag_Wait_On_TO | (flag, mask, timeout) | ( wait ((flag & mask)!=0) ) Wait until any bit in flag specified by mask is set. Exit if timeout expired | |
OS_Flag_Wait_AllOff_TO | (flag, mask, timeout) | ( wait ((flag & mask)==0) ) Wait until all bits in flag specified by mask are cleared. Exit if timeout expired | |
OS_Flag_Wait_Off_TO | (flag, mask, timeout) | ( wait ((flag & mask)!=mask) ) Wait until any bit in flag specified by mask is cleared. Exit if timeout expired |
Service | Arguments | Description | Properties |
---|---|---|---|
Control | |||
OS_Ttimer_Run | (time) | Start counting current task timer | |
OS_Ttimer_Break | () | Stop and reset current task timer. Timeout flag is set | |
OS_Ttimer_Wait | () | Wait until current task timer overflows | |
OS_Ttimer_Delay | (delay) | Delay, using current task timer (same as OS_Delay) | |
Checking | |||
_OST_TTIMER OS_Ttimer_Get | () | Get current task timer's remaining time | |
bool OS_Ttimer_Check | () | Check if current task timer has overflowed | |
bool OS_Ttimer_IsRun | () | Check if current task timer is counting | |
Additional | |||
OS_Ttimer_Pause | () | Pause current task's timer. Overflow bit will be set | |
OS_Ttimer_Continue | () | Continue counting after pause |
Service | Arguments | Description | Properties |
---|---|---|---|
Create/Delete | |||
OS_Stimer_Alloc | (var_stimer_id) | Allocate static timer | |
OS_Stimer_Free | (stimer_id) | Free static timer | |
bool OS_Stimer_Found | () | Check if free static timer is available | |
Control | |||
OS_Stimer_Run | (stimer_id, time) | Start counting static timer | |
OS_Stimer_Break | (stimer_id) | Stop and reset static timer. Timeout flag is set | |
OS_Stimer_Wait | (stimer_id) | Wait until static timer overflows | |
OS_Stimer_Delay | (stimer_id, delay) | Delay current task using static timer | |
Checking | |||
_OST_STIMER OS_Stimer_Get | (stimer_id) | Get static timer's remaining time | |
bool OS_Stimer_Check | (stimer_id) | Check if static timer has overflowed | |
bool OS_Stimer_IsRun | (stimer_id) | Check if static timer is counting | |
Additional | |||
OS_Stimer_Pause | (stimer_id) | Pause timer. Overflow bit will be set | |
OS_Stimer_Continue | (stimer_id) | Continue counting after pause |
Service | Arguments | Description | Properties |
---|---|---|---|
Creating/Deleting | |||
OS_Qtimer_Create | (qtimer) | Add timer to queue of active timers | |
OS_Qtimer_Delete | (qtimer) | Delete timer from queue of active timers | |
Control | |||
OS_Qtimer_Run | (qtimer, newtime) | Start counting with given newtime. Timeout flag is cleared | |
OS_Qtimer_Break | (qtimer) | Stop timer and delete it from queue. Timeout flag is set | |
OS_Qtimer_Wait | (qtimer) | Wait for timer to overflow | |
OS_Qtimer_Delay | (qtimer, delay) | Delay current task using timer | |
Checking | |||
_OST_QTIMER OS_Qtimer_Get | (qtimer) | Get queued timer's remaining time | |
bool OS_Qtimer_Check | (qtimer) | Check if timer has overflowed | |
bool OS_Qtimer_IsRun | (qtimer) | Check if timer is counting |
Service | Arguments | Description | Properties |
---|---|---|---|
Creating/Deleting | |||
OS_Dtimer_Create | (dtimer) | Add dynamic timer to the list of active timers | |
OS_Dtimer_Delete | (dtimer) | Delete dynamic timer from the list of active timers | |
Control | |||
OS_Dtimer_Run | (dtimer, newtime) | Start counting with given newtime. Timeout flag is cleared | |
OS_Dtimer_Break | (dtimer) | Stop dynamic timer. Timeout flag is set | |
OS_Dtimer_Wait | (dtimer) | Wait for dynamic timer overflow | |
OS_Dtimer_Delay | (dtimer, delay) | Delay current task using dynamic timer | |
Checking | |||
_OST_DTIMER OS_Dtimer_Get | (dtimer) | Get dynamic timer's remaining time | |
bool OS_Dtimer_Check | (dtimer) | Check if dynamic timer has overflowed | |
bool OS_Dtimer_IsRun | (dtimer) | Check if dynamic timer is counting | |
Additional | |||
OS_Dtimer_Pause | (dtimer) | Stop/pause dynamic timer. Timeout flag remains unchanged | |
OS_Dtimer_Continue | (dtimer) | Continue dynamic timer's counting after pause. Timeout flag remains unchanged | |
OS_Dtimer_Update | (dtimer, time) | Re-run static timer for time time since last overflow. Timeout flag is cleared | |
OS_Dtimer_Add | (dtimer, addtime) | Increase time of dynamic timer counter. Timeout flag remains unchanged | |
bool OS_Dtimer_IsActive | (dtimer) | Check if dynamic timer is present in the list of active timers | |
bool OS_Dtimer_IsStopped | (dtimer) | Check if dynamic timer is stopped |
Service | Arguments | Description | Properties |
---|---|---|---|
Control | |||
OS_Oldtimer_Run8 | (timer8_id, time) | Start counting 8-bit timer | |
OS_Oldtimer_Run16 | (timer16_id, time) | Start counting 16-bit timer | |
OS_Oldtimer_Run24 | (timer24_id, time) | Start counting 24-bit timer | |
OS_Oldtimer_Run32 | (timer32_id, time) | Start counting 32-bit timer | |
OS_Oldtimer_Stop | (timer_id) | Stop/pause static timer. Timeout flag is set | |
Checking | |||
bool OS_Oldtimer_Check | (timer_id) | Check for static timer overflow | |
Waiting | |||
OS_Oldtimer_Wait | (timer_id) | Wait for static timer overflow |