OS  v7.3.4
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
67
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)
90 qTaskFcn_t idleCallback,
91 void(*coreIdleFcn)(void) );
92 #else
142 qBool_t qOS_Setup( const qGetTickFcn_t tFcn,
143 const qTimingBase_t t,
144 qTaskFcn_t idleCallback,
145 void(*coreIdleFcn)(void) );
146 #endif
147
154 qBool_t qOS_Set_IdleTask( qTaskFcn_t callbackFcn );
155
156 #if ( Q_ALLOW_SCHEDULER_RELEASE == 1 )
162 qBool_t qOS_Scheduler_Release( void );
163
170 qBool_t qOS_Set_SchedulerReleaseCallback( qTaskFcn_t rCallback );
171 #endif
172
180 qBool_t qOS_Set_CoreIdleFcn( void(*pFcn)(void) );
181
183
187
199 qBool_t qOS_Notification_Spread( void *eventData,
200 const qTask_NotifyMode_t mode );
202
208
236 qBool_t qOS_Add_Task( qTask_t * const Task,
237 qTaskFcn_t callbackFcn,
238 const qPriority_t p,
239 const qTime_t t,
240 const qIteration_t n,
241 const qState_t init,
242 void* arg );
243
259 qBool_t qOS_Add_EventTask( qTask_t * const Task,
260 qTaskFcn_t callbackFcn,
261 const qPriority_t p,
262 void* arg );
263 #if ( Q_FSM == 1)
286 qSM_t *m,
287 const qPriority_t p,
288 const qTime_t t,
289 const qState_t init,
290 void *arg );
291 #endif
292
293 #if ( Q_ATCLI == 1)
309 qBool_t qOS_Add_ATCLITask( qTask_t * const Task,
310 qATCLI_t *cli,
311 const qPriority_t p,
312 void *arg );
313 #endif
314
320 qBool_t qOS_Remove_Task( qTask_t * const Task );
321
329 qBool_t qOS_Run( void );
330
331 #if ( Q_ALLOW_YIELD_TO_TASK == 1 )
341 qBool_t qOS_YieldToTask( qTask_t * const Task );
342 #endif
343
345
346 #ifdef __cplusplus
347 }
348 #endif
349
350#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:234
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:433
qBool_t qOS_Remove_Task(qTask_t *const Task)
Remove the task from the scheduling scheme.
Definition qkernel.c:614
qBool_t qOS_Setup(const qGetTickFcn_t tFcn, const qTimingBase_t t, qTaskFcn_t idleCallback, void(*coreIdleFcn)(void))
Task Scheduler Setup. This function is required and must be called once in the application main threa...
Definition qkernel.c:128
qBool_t qOS_Set_CoreIdleFcn(void(*pFcn)(void))
Set the function that puts the CPU into a low-power or idle state until an interrupt occurs.
Definition qkernel.c:220
qBool_t qOS_Set_IdleTask(qTaskFcn_t callbackFcn)
Set/Change the callback for the Idle-task.
Definition qkernel.c:184
qBool_t qOS_Run(void)
Executes the scheduling scheme. It must be called once after the task pool has been defined.
Definition qkernel.c:703
qBool_t qOS_YieldToTask(qTask_t *const Task)
Yield the control of the current running task to another task.
Definition qkernel.c:1155
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:492
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:507
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:563
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