OS
v7.3.3
Documentation
|
API interface to manage tasks. More...
Data Structures | |
struct | qEvent_t |
The task argument with all the regarding information of the task execution. More... | |
struct | qTask_t |
A task node object. More... | |
Macros | |
#define | QMAX_NOTIFICATION_VALUE |
Max allowed notification value. | |
#define | QEVENTFLAG_CLEAR |
A macro directive to indicate that the eventFlags should be cleared. | |
#define | QEVENTFLAG_SET |
A macro directive to indicate that the eventFlags should be set. | |
#define | qTask_Suspend(Task) |
Put the task into a disabled state. | |
#define | qTask_Disable(Task) |
Put the task into a disabled state. | |
#define | qTask_Resume(Task) |
Put the task into an enabled state. | |
#define | qTask_Enable(Task) |
Put the task into an enabled state. | |
#define | qTask_ASleep(Task) |
Put the task into a sleep state. The task can't be triggered by the lower precedence events. | |
#define | qTask_Awake(Task) |
Put the task into a normal operation state. Here the task will be able to catch any kind of events. | |
#define | qTask_IsEnabled(Task) |
Retrieve the enabled/disabled state. | |
Typedefs | |
typedef qUINT32_t | qNotifier_t |
A 32-bit unsigned integer type to hold a notification value. | |
typedef qUINT32_t | qTask_Flag_t |
A 32-bit unsigned integer type to hold the task flags. | |
typedef void(* | qTaskFcn_t) (qEvent_t arg) |
Pointer to a task callback. | |
Enumerations | |
enum | qTrigger_t { qTriggerNULL , byTimeElapsed , byNotificationQueued , byNotificationSimple , byQueueReceiver , byQueueFull , byQueueCount , byQueueEmpty , byEventFlags , bySchedulingRelease , byNoReadyTasks } |
An enum with all the possible values for the qEvent_t::Trigger member. More... | |
enum | qTask_GlobalState_t { qUndefinedGlobalState , qReady , qWaiting , qSuspended , qRunning } |
An enum to describe the task global states. More... | |
enum | qQueueLinkMode_t { qQueueMode_Receiver , qQueueMode_Full , qQueueMode_Count , qQueueMode_Empty } |
An enum that defines the modes in which a queue can be linked to a task. More... | |
Functions | |
qState_t | qTask_Get_State (const qTask_t *const Task) |
Retrieve the task operational state. | |
qCycles_t | qTask_Get_Cycles (const qTask_t *const Task) |
Retrieve the number of task activations. | |
qTask_GlobalState_t | qTask_Get_GlobalState (const qTask_t *const Task) |
Retrieve the task global-state. | |
qBool_t | qTask_Set_Time (qTask_t *const Task, const qTime_t tValue) |
Set/Change the Task execution interval. | |
qBool_t | qTask_Set_Iterations (qTask_t *const Task, const qIteration_t iValue) |
Set/Change the number of task iterations. | |
qBool_t | qTask_Set_Priority (qTask_t *const Task, const qPriority_t pValue) |
Set/Change the task priority value. | |
qBool_t | qTask_Set_Callback (qTask_t *const Task, const qTaskFcn_t cFcn) |
Set/Change the task callback function. | |
qBool_t | qTask_Set_State (qTask_t *const Task, const qState_t s) |
Set the task operational state. | |
qBool_t | qTask_Set_Data (qTask_t *const Task, void *arg) |
Set the task data. | |
qBool_t | qTask_Clear (qTask_t *const Task, const qTask_ClrParam_t param) |
Clear the specified parameter for the task. | |
qTask_t * | qTask_Self (void) |
Get the current running-task handle. | |
qBool_t | qTask_Set_Name (qTask_t *const Task, const char *name) |
Set the task name. | |
const char * | qTask_Get_Name (const qTask_t *const Task) |
Retrieves the task name. | |
qTask_t * | qTask_Find_ByName (const char *name) |
Tries to find the first task that matches the name provided. | |
API interface to manage tasks.
#define qTask_ASleep | ( | Task | ) |
Put the task into a sleep state. The task can't be triggered by the lower precedence events.
[in] | Task | Pointer to the task node. |
#define qTask_Awake | ( | Task | ) |
Put the task into a normal operation state. Here the task will be able to catch any kind of events.
[in] | Task | Pointer to the task node. |
#define qTask_Disable | ( | Task | ) |
Put the task into a disabled state.
[in] | Task | Pointer to the task node. |
#define qTask_Enable | ( | Task | ) |
Put the task into an enabled state.
[in] | Task | Pointer to the task node. |
#define qTask_IsEnabled | ( | Task | ) |
Retrieve the enabled/disabled state.
[in] | Task | Pointer to the task node. |
#define qTask_Resume | ( | Task | ) |
Put the task into an enabled state.
[in] | Task | Pointer to the task node. |
#define qTask_Suspend | ( | Task | ) |
Put the task into a disabled state.
[in] | Task | Pointer to the task node. |
enum qQueueLinkMode_t |
An enum that defines the modes in which a queue can be linked to a task.
Enumerator | |
---|---|
qQueueMode_Receiver | This mode will trigger the task if there are elements in the queue. Data will be extracted automatically in every trigger and will be available in the qEvent_t::EventData field. |
qQueueMode_Full | This mode will trigger the task if the queue is full. A pointer to the queue will be available in the qEvent_t::EventData field. |
qQueueMode_Count | This mode will trigger the task if the count of elements in the queue reach the specified value. A pointer to the queue will be available in the qEvent_t::EventData field. |
qQueueMode_Empty | This mode will trigger the task if the queue is empty. A pointer to the queue will be available in the qEvent_t::EventData field. |
enum qTask_GlobalState_t |
An enum to describe the task global states.
Enumerator | |
---|---|
qUndefinedGlobalState | A task should never reach this state(Reserved for internal use) |
qReady | The task has completed preparations for running, but cannot run because a task with a higher precedence is running. |
qWaiting | The task cannot run because the conditions for running are not in place. |
qSuspended | The task doesn't take part in what is going on. Normally this state is taken after the qRunning state or when the task doesn't reach the qReady state |
qRunning | The task is currently being executed. |
enum qTrigger_t |
An enum with all the possible values for the qEvent_t::Trigger member.
Enumerator | |
---|---|
qTriggerNULL | To indicate the absence of trigger. Reserved for internal use. |
byTimeElapsed | When the time specified for the task elapsed. |
byNotificationQueued | When there is a queued notification in the FIFO priority queue. For this trigger, the dispatcher performs a dequeue operation automatically. A pointer to the extracted event data will be available in the qEvent_t::EventData field. |
byNotificationSimple | When the execution chain does, according to a requirement of asynchronous notification event prompted by qTask_Notification_Send(). A pointer to the notified data will be available in the qEvent_t::EventData field. |
byQueueReceiver | When there are elements available in the attached qQueue, the scheduler make a data dequeue (auto-receive) from the front. A pointer to the received data will be available in the qEvent_t::EventData field. |
byQueueFull | When the attached queue is full. A pointer to the queue will be available in the qEvent_t::EventData field. |
byQueueCount | When the element-count of the attached queue reaches the specified value. A pointer to the queue will be available in the qEvent_t::EventData field. |
byQueueEmpty | When the attached queue is empty. A pointer to the queue will be available in the qEvent_t::EventData field. |
byEventFlags | When any event-flag is set. |
bySchedulingRelease | When the scheduler is released. |
byNoReadyTasks | Only available when the Idle Task is triggered. |
qBool_t qTask_Clear | ( | qTask_t *const | Task, |
const qTask_ClrParam_t | param ) |
Clear the specified parameter for the task.
[in] | Task | Pointer to the task node. |
[in] | param | Use one of the following values: |
qTask_ClearIterations : Clear the number of iterations.
qTask_ClearTimeElapsed : Clear the time elapsed.
qTask_ClearCycles : Clear the number of task activations.
qTask_ClearSimpleNotifications : Clear the notification value.
qTask_ClearQueuedNotifications : Clear all the queued notifications.
qTask_ClearNotifications : Clear all notifications (simple and queued).
qTask_t * qTask_Find_ByName | ( | const char * | name | ) |
Tries to find the first task that matches the name provided.
[in] | name | The string with the name to find. |
NULL
. Retrieve the number of task activations.
[in] | Task | Pointer to the task node. |
qTask_GlobalState_t qTask_Get_GlobalState | ( | const qTask_t *const | Task | ) |
Retrieve the task global-state.
[in] | Task | Pointer to the task node. |
const char * qTask_Get_Name | ( | const qTask_t *const | Task | ) |
Retrieves the task name.
[in] | Task | Pointer to the task node. |
qTask_t * qTask_Self | ( | void | ) |
Get the current running-task handle.
NULL
when the OS scheduler it's in a busy state or when IDLE Task is running. qBool_t qTask_Set_Callback | ( | qTask_t *const | Task, |
const qTaskFcn_t | cFcn ) |
qBool_t qTask_Set_Iterations | ( | qTask_t *const | Task, |
const qIteration_t | iValue ) |
Set/Change the number of task iterations.
[in] | Task | Pointer to the task node. |
[in] | iValue | Number of task executions (Integer value). For indefinite execution (iValue = qPeriodic or qIndefinite). Tasks do not remember the number of iteration set initially. After the iterations are done, internal iteration counter is 0. If you need to perform another set of iterations, you need to set the number of iterations again and resume. |
qBool_t qTask_Set_Priority | ( | qTask_t *const | Task, |
const qPriority_t | pValue ) |
Set the task operational state.
[in] | Task | Pointer to the task node. |
[in] | s | Use one of the following values: |
qEnabled : Task will be able to catch all the events. ( ENABLE_Bit=1
)
qDisabled : Time events will be discarded. The task catch asynchronous events. ( ENABLE_Bit=0
)
qAsleep : Put the task into a sleep operability state. The task can't be triggered by the lower precedence events. ( SHUTDOWN_Bit=0
)
qAwake : Put the task into the previous state before it was put in the sleep state.( SHUTDOWN_Bit=1
)
Set/Change the Task execution interval.
[in] | Task | Pointer to the task node. |
[in] | tValue | Execution interval defined in seconds (floating-point format). For immediate execution (tValue = qTimeImmediate). |