OS  v7.3.3
Documentation
Loading...
Searching...
No Matches
qkernel.h
1
9#ifndef QKERNEL_H
10 #define QKERNEL_H
11
12 #include "qtypes.h"
13 #include "qcritical.h"
14 #include "qtasks.h"
15
16 #if ( Q_ATCLI == 1 )
17 #include "qatcli.h"
18 #endif
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 #ifndef Q_PRIORITY_LEVELS
25 #define Q_PRIORITY_LEVELS ( 3 )
26 #endif
27
28 #ifndef Q_SETUP_TIME_CANONICAL
29 #define Q_SETUP_TIME_CANONICAL ( 0 )
30 #endif
31
32 #ifndef Q_SETUP_TICK_IN_HERTZ
33 #define Q_SETUP_TICK_IN_HERTZ ( 0 )
34 #endif
35
36 #ifndef Q_PRIO_QUEUE_SIZE
37 #define Q_PRIO_QUEUE_SIZE ( 3 )
38 #endif
39
40 #ifndef Q_PRESERVE_TASK_ENTRY_ORDER
41 #define Q_PRESERVE_TASK_ENTRY_ORDER ( 0 )
42 #endif
43
44 #ifndef Q_NOTIFICATION_SPREADER
45 #define Q_NOTIFICATION_SPREADER ( 1 )
46 #endif
47
48 #ifndef Q_ALLOW_SCHEDULER_RELEASE
49 #define Q_ALLOW_SCHEDULER_RELEASE ( 1 )
50 #endif
51
52 #ifndef Q_QUEUES
53 #define Q_QUEUES ( 1 )
54 #endif
55
56 #if ( Q_PRIORITY_LEVELS < 1 )
57 #error Q_PRIORITY_LEVELS must be defined to be greater than or equal to 1.
58 #endif
59
68 /*Default priority levels*/
69
71 #define qLowest_Priority ( (qPriority_t)0U )
72
74 #define qMedium_Priority ( (qPriority_t)( Q_PRIORITY_LEVELS >> 1 ) )
75
77 #define qHigh_Priority ( (qPriority_t)( Q_PRIORITY_LEVELS - 1U ) )
78
80 #define qPeriodic ( (qIteration_t)INT32_MIN )
81
83 #define qIndefinite ( qPeriodic )
84
86 #define qSingleShot ( (qIteration_t)1 )
87
88 #if (Q_SETUP_TIME_CANONICAL == 1)
89 qBool_t qOS_Setup( const qGetTickFcn_t tFcn, qTaskFcn_t idleCallback );
90 #else
138 qBool_t qOS_Setup( const qGetTickFcn_t tFcn,
139 const qTimingBase_t t,
140 qTaskFcn_t idleCallback );
141 #endif
142
149 qBool_t qOS_Set_IdleTask( qTaskFcn_t callbackFcn );
150
151 #if ( Q_ALLOW_SCHEDULER_RELEASE == 1 )
157 qBool_t qOS_Scheduler_Release( void );
158
165 qBool_t qOS_Set_SchedulerReleaseCallback( qTaskFcn_t rCallback );
166 #endif
167
185 qBool_t qOS_Notification_Spread( void *eventData,
186 const qTask_NotifyMode_t mode );
222 qBool_t qOS_Add_Task( qTask_t * const Task,
223 qTaskFcn_t callbackFcn,
224 const qPriority_t p,
225 const qTime_t t,
226 const qIteration_t n,
227 const qState_t init,
228 void* arg );
229
245 qBool_t qOS_Add_EventTask( qTask_t * const Task,
246 qTaskFcn_t callbackFcn,
247 const qPriority_t p,
248 void* arg );
249 #if ( Q_FSM == 1)
272 qSM_t *m,
273 const qPriority_t p,
274 const qTime_t t,
275 const qState_t init,
276 void *arg );
277 #endif
278
279 #if ( Q_ATCLI == 1)
295 qBool_t qOS_Add_ATCLITask( qTask_t * const Task,
296 qATCLI_t *cli,
297 const qPriority_t p,
298 void *arg );
299 #endif
300
306 qBool_t qOS_Remove_Task( qTask_t * const Task );
307
315 qBool_t qOS_Run( void );
316
317 #if ( Q_ALLOW_YIELD_TO_TASK == 1 )
327 qBool_t qOS_YieldToTask( qTask_t * const Task );
328 #endif
329
332 #ifdef __cplusplus
333 }
334 #endif
335
336#endif /*QKERNEL_H*/
qClock_t(* qGetTickFcn_t)(void)
Pointer to Function type qGetTickFcn_t : A function to get the hardware tick value.
Definition qclock.h:81
qFloat32_t qTime_t
The typedef that specified an time quantity, usually expressed in seconds.
Definition qclock.h:33
#define qTimingBase_t
A macro to specify a qTime_t type for time-base APIs.
Definition qclock.h:62
qBool_t qOS_Notification_Spread(void *eventData, const qTask_NotifyMode_t mode)
Try to spread a notification among all the tasks in the scheduling scheme.
Definition qkernel.c:217
qTask_NotifyMode_t
An enum that defines the modes in which a notification can be spread.
Definition qtasks.h:327
qBool_t qOS_Add_Task(qTask_t *const Task, qTaskFcn_t callbackFcn, const qPriority_t p, const qTime_t t, const qIteration_t n, const qState_t init, void *arg)
Add a task to the scheduling scheme. The task is scheduled to run every t seconds,...
Definition qkernel.c:416
qBool_t qOS_Remove_Task(qTask_t *const Task)
Remove the task from the scheduling scheme.
Definition qkernel.c:597
qBool_t qOS_Set_IdleTask(qTaskFcn_t callbackFcn)
Set/Change the callback for the Idle-task.
Definition qkernel.c:180
qBool_t qOS_Run(void)
Executes the scheduling scheme. It must be called once after the task pool has been defined.
Definition qkernel.c:686
qBool_t qOS_Setup(const qGetTickFcn_t tFcn, const qTimingBase_t t, qTaskFcn_t idleCallback)
Task Scheduler Setup. This function is required and must be called once in the application main threa...
Definition qkernel.c:126
qBool_t qOS_YieldToTask(qTask_t *const Task)
Yield the control of the current running task to another task.
Definition qkernel.c:1133
qBool_t qOS_Add_EventTask(qTask_t *const Task, qTaskFcn_t callbackFcn, const qPriority_t p, void *arg)
Add a task to the scheduling scheme. This API creates a task with a qDisabled state by default,...
Definition qkernel.c:475
qBool_t qOS_Add_StateMachineTask(qTask_t *const Task, qSM_t *m, const qPriority_t p, const qTime_t t, const qState_t init, void *arg)
Add a task to the scheduling scheme running a dedicated state-machine. The task is scheduled to run e...
Definition qkernel.c:490
qBool_t qOS_Add_ATCLITask(qTask_t *const Task, qATCLI_t *cli, const qPriority_t p, void *arg)
Add a task to the scheduling scheme running an AT Command Line Interface. Task will be scheduled as e...
Definition qkernel.c:546
void(* qTaskFcn_t)(qEvent_t arg)
Pointer to a task callback.
Definition qtasks.h:223
qUINT8_t qBool_t
A type to instantiate an OS boolean variable.
Definition qtypes.h:139
qINT32_t qIteration_t
A type to instantiate a variable that hold the number of task iterations.
Definition qtypes.h:129
qUINT8_t qState_t
A type to instantiate an OS state value.
Definition qtypes.h:134
qUINT8_t qPriority_t
A type to instantiate a variable to hold the priority value of a task.
Definition qtypes.h:123
An AT Command Line Interface (CLI) object.
Definition qatcli.h:202
A FSM(Finite State Machine) object.
Definition qfsm.h:387
A task node object.
Definition qtasks.h:268