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