UCOS_TI_LM3S_Keil
 全部 结构体 文件 函数 变量 类型定义 宏定义 
ucos_ii.h
浏览该文件的文档.
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 *
6 * (c) Copyright 1992-2009, Micrium, Weston, FL
7 * All Rights Reserved
8 *
9 * File : uCOS_II.H
10 * By : Jean J. Labrosse
11 * Version : V2.89
12 *
13 * LICENSING TERMS:
14 * ---------------
15 * uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.
16 * If you plan on using uC/OS-II in a commercial product you need to contact Micrim to properly license
17 * its use in your product. We provide ALL the source code for your convenience and to help you experience
18 * uC/OS-II. The fact that the source is provided does NOT mean that you can use it without paying a
19 * licensing fee.
20 *********************************************************************************************************
21 */
22 
23 #ifndef OS_uCOS_II_H
24 #define OS_uCOS_II_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /*
31 *********************************************************************************************************
32 * uC/OS-II VERSION NUMBER
33 *********************************************************************************************************
34 */
35 
36 #define OS_VERSION 289u /* Version of uC/OS-II (Vx.yy mult. by 100) */
37 
38 /*
39 *********************************************************************************************************
40 * INCLUDE HEADER FILES
41 *********************************************************************************************************
42 */
43 //comment by jim 2013_06_13,
44 // i think the os shouldn't be conf in app_cfg. but the os cfg instead.
45 //#include <app_cfg.h>
46 
47 #include <os_cfg.h>
48 #include <os_cpu.h>
49 
50 /*
51 *********************************************************************************************************
52 * MISCELLANEOUS
53 *********************************************************************************************************
54 */
55 
56 #ifdef OS_GLOBALS
57 #define OS_EXT
58 #else
59 #define OS_EXT extern
60 #endif
61 
62 #ifndef OS_FALSE
63 #define OS_FALSE 0u
64 #endif
65 
66 #ifndef OS_TRUE
67 #define OS_TRUE 1u
68 #endif
69 
70 #define OS_ASCII_NUL (INT8U)0
71 
72 #define OS_PRIO_SELF 0xFFu /* Indicate SELF priority */
73 
74 #if OS_TASK_STAT_EN > 0u
75 #define OS_N_SYS_TASKS 2u /* Number of system tasks */
76 #else
77 #define OS_N_SYS_TASKS 1u
78 #endif
79 
80 #define OS_TASK_STAT_PRIO (OS_LOWEST_PRIO - 1u) /* Statistic task priority */
81 #define OS_TASK_IDLE_PRIO (OS_LOWEST_PRIO) /* IDLE task priority */
82 
83 #if OS_LOWEST_PRIO <= 63u
84 #define OS_EVENT_TBL_SIZE ((OS_LOWEST_PRIO) / 8u + 1u) /* Size of event table */
85 #define OS_RDY_TBL_SIZE ((OS_LOWEST_PRIO) / 8u + 1u) /* Size of ready table */
86 #else
87 #define OS_EVENT_TBL_SIZE ((OS_LOWEST_PRIO) / 16u + 1u)/* Size of event table */
88 #define OS_RDY_TBL_SIZE ((OS_LOWEST_PRIO) / 16u + 1u)/* Size of ready table */
89 #endif
90 
91 #define OS_TASK_IDLE_ID 65535u /* ID numbers for Idle, Stat and Timer tasks */
92 #define OS_TASK_STAT_ID 65534u
93 #define OS_TASK_TMR_ID 65533u
94 
95 #define OS_EVENT_EN (((OS_Q_EN > 0u) && (OS_MAX_QS > 0u)) || (OS_MBOX_EN > 0u) || (OS_SEM_EN > 0u) || (OS_MUTEX_EN > 0u))
96 
97 #define OS_TCB_RESERVED ((OS_TCB *)1)
98 
99 /*$PAGE*/
100 /*
101 *********************************************************************************************************
102 * TASK STATUS (Bit definition for OSTCBStat)
103 *********************************************************************************************************
104 */
105 #define OS_STAT_RDY 0x00u /* Ready to run */
106 #define OS_STAT_SEM 0x01u /* Pending on semaphore */
107 #define OS_STAT_MBOX 0x02u /* Pending on mailbox */
108 #define OS_STAT_Q 0x04u /* Pending on queue */
109 #define OS_STAT_SUSPEND 0x08u /* Task is suspended */
110 #define OS_STAT_MUTEX 0x10u /* Pending on mutual exclusion semaphore */
111 #define OS_STAT_FLAG 0x20u /* Pending on event flag group */
112 #define OS_STAT_MULTI 0x80u /* Pending on multiple events */
113 
114 #define OS_STAT_PEND_ANY (OS_STAT_SEM | OS_STAT_MBOX | OS_STAT_Q | OS_STAT_MUTEX | OS_STAT_FLAG)
115 
116 /*
117 *********************************************************************************************************
118 * TASK PEND STATUS (Status codes for OSTCBStatPend)
119 *********************************************************************************************************
120 */
121 #define OS_STAT_PEND_OK 0u /* Pending status OK, not pending, or pending complete */
122 #define OS_STAT_PEND_TO 1u /* Pending timed out */
123 #define OS_STAT_PEND_ABORT 2u /* Pending aborted */
124 
125 /*
126 *********************************************************************************************************
127 * OS_EVENT types
128 *********************************************************************************************************
129 */
130 #define OS_EVENT_TYPE_UNUSED 0u
131 #define OS_EVENT_TYPE_MBOX 1u
132 #define OS_EVENT_TYPE_Q 2u
133 #define OS_EVENT_TYPE_SEM 3u
134 #define OS_EVENT_TYPE_MUTEX 4u
135 #define OS_EVENT_TYPE_FLAG 5u
136 
137 #define OS_TMR_TYPE 100u /* Used to identify Timers ... */
138  /* ... (Must be different value than OS_EVENT_TYPE_xxx) */
139 
140 /*
141 *********************************************************************************************************
142 * EVENT FLAGS
143 *********************************************************************************************************
144 */
145 #define OS_FLAG_WAIT_CLR_ALL 0u /* Wait for ALL the bits specified to be CLR (i.e. 0) */
146 #define OS_FLAG_WAIT_CLR_AND 0u
147 
148 #define OS_FLAG_WAIT_CLR_ANY 1u /* Wait for ANY of the bits specified to be CLR (i.e. 0) */
149 #define OS_FLAG_WAIT_CLR_OR 1u
150 
151 #define OS_FLAG_WAIT_SET_ALL 2u /* Wait for ALL the bits specified to be SET (i.e. 1) */
152 #define OS_FLAG_WAIT_SET_AND 2u
153 
154 #define OS_FLAG_WAIT_SET_ANY 3u /* Wait for ANY of the bits specified to be SET (i.e. 1) */
155 #define OS_FLAG_WAIT_SET_OR 3u
156 
157 
158 #define OS_FLAG_CONSUME 0x80u /* Consume the flags if condition(s) satisfied */
159 
160 
161 #define OS_FLAG_CLR 0u
162 #define OS_FLAG_SET 1u
163 
164 /*
165 *********************************************************************************************************
166 * Values for OSTickStepState
167 *
168 * Note(s): This feature is used by uC/OS-View.
169 *********************************************************************************************************
170 */
171 
172 #if OS_TICK_STEP_EN > 0u
173 #define OS_TICK_STEP_DIS 0u /* Stepping is disabled, tick runs as mormal */
174 #define OS_TICK_STEP_WAIT 1u /* Waiting for uC/OS-View to set OSTickStepState to _ONCE */
175 #define OS_TICK_STEP_ONCE 2u /* Process tick once and wait for next cmd from uC/OS-View */
176 #endif
177 
178 /*
179 *********************************************************************************************************
180 * Possible values for 'opt' argument of OSSemDel(), OSMboxDel(), OSQDel() and OSMutexDel()
181 *********************************************************************************************************
182 */
183 #define OS_DEL_NO_PEND 0u
184 #define OS_DEL_ALWAYS 1u
185 
186 /*
187 *********************************************************************************************************
188 * OS???Pend() OPTIONS
189 *
190 * These #defines are used to establish the options for OS???PendAbort().
191 *********************************************************************************************************
192 */
193 #define OS_PEND_OPT_NONE 0u /* NO option selected */
194 #define OS_PEND_OPT_BROADCAST 1u /* Broadcast action to ALL tasks waiting */
195 
196 /*
197 *********************************************************************************************************
198 * OS???PostOpt() OPTIONS
199 *
200 * These #defines are used to establish the options for OSMboxPostOpt() and OSQPostOpt().
201 *********************************************************************************************************
202 */
203 #define OS_POST_OPT_NONE 0x00u /* NO option selected */
204 #define OS_POST_OPT_BROADCAST 0x01u /* Broadcast message to ALL tasks waiting */
205 #define OS_POST_OPT_FRONT 0x02u /* Post to highest priority task waiting */
206 #define OS_POST_OPT_NO_SCHED 0x04u /* Do not call the scheduler if this option is selected */
207 
208 /*
209 *********************************************************************************************************
210 * TASK OPTIONS (see OSTaskCreateExt())
211 *********************************************************************************************************
212 */
213 #define OS_TASK_OPT_NONE 0x0000u /* NO option selected */
214 #define OS_TASK_OPT_STK_CHK 0x0001u /* Enable stack checking for the task */
215 #define OS_TASK_OPT_STK_CLR 0x0002u /* Clear the stack when the task is create */
216 #define OS_TASK_OPT_SAVE_FP 0x0004u /* Save the contents of any floating-point registers */
217 
218 /*
219 *********************************************************************************************************
220 * TIMER OPTIONS (see OSTmrStart() and OSTmrStop())
221 *********************************************************************************************************
222 */
223 #define OS_TMR_OPT_NONE 0u /* No option selected */
224 
225 #define OS_TMR_OPT_ONE_SHOT 1u /* Timer will not automatically restart when it expires */
226 #define OS_TMR_OPT_PERIODIC 2u /* Timer will automatically restart when it expires */
227 
228 #define OS_TMR_OPT_CALLBACK 3u /* OSTmrStop() option to call 'callback' w/ timer arg. */
229 #define OS_TMR_OPT_CALLBACK_ARG 4u /* OSTmrStop() option to call 'callback' w/ new arg. */
230 
231 /*
232 *********************************************************************************************************
233 * TIMER STATES
234 *********************************************************************************************************
235 */
236 #define OS_TMR_STATE_UNUSED 0u
237 #define OS_TMR_STATE_STOPPED 1u
238 #define OS_TMR_STATE_COMPLETED 2u
239 #define OS_TMR_STATE_RUNNING 3u
240 
241 /*
242 *********************************************************************************************************
243 * ERROR CODES
244 *********************************************************************************************************
245 */
246 #define OS_ERR_NONE 0u
247 
248 #define OS_ERR_EVENT_TYPE 1u
249 #define OS_ERR_PEND_ISR 2u
250 #define OS_ERR_POST_NULL_PTR 3u
251 #define OS_ERR_PEVENT_NULL 4u
252 #define OS_ERR_POST_ISR 5u
253 #define OS_ERR_QUERY_ISR 6u
254 #define OS_ERR_INVALID_OPT 7u
255 #define OS_ERR_ID_INVALID 8u
256 #define OS_ERR_PDATA_NULL 9u
257 
258 #define OS_ERR_TIMEOUT 10u
259 #define OS_ERR_EVENT_NAME_TOO_LONG 11u
260 #define OS_ERR_PNAME_NULL 12u
261 #define OS_ERR_PEND_LOCKED 13u
262 #define OS_ERR_PEND_ABORT 14u
263 #define OS_ERR_DEL_ISR 15u
264 #define OS_ERR_CREATE_ISR 16u
265 #define OS_ERR_NAME_GET_ISR 17u
266 #define OS_ERR_NAME_SET_ISR 18u
267 
268 #define OS_ERR_MBOX_FULL 20u
269 
270 #define OS_ERR_Q_FULL 30u
271 #define OS_ERR_Q_EMPTY 31u
272 
273 #define OS_ERR_PRIO_EXIST 40u
274 #define OS_ERR_PRIO 41u
275 #define OS_ERR_PRIO_INVALID 42u
276 
277 #define OS_ERR_SEM_OVF 50u
278 
279 #define OS_ERR_TASK_CREATE_ISR 60u
280 #define OS_ERR_TASK_DEL 61u
281 #define OS_ERR_TASK_DEL_IDLE 62u
282 #define OS_ERR_TASK_DEL_REQ 63u
283 #define OS_ERR_TASK_DEL_ISR 64u
284 #define OS_ERR_TASK_NAME_TOO_LONG 65u
285 #define OS_ERR_TASK_NO_MORE_TCB 66u
286 #define OS_ERR_TASK_NOT_EXIST 67u
287 #define OS_ERR_TASK_NOT_SUSPENDED 68u
288 #define OS_ERR_TASK_OPT 69u
289 #define OS_ERR_TASK_RESUME_PRIO 70u
290 #define OS_ERR_TASK_SUSPEND_IDLE 71u
291 #define OS_ERR_TASK_SUSPEND_PRIO 72u
292 #define OS_ERR_TASK_WAITING 73u
293 
294 #define OS_ERR_TIME_NOT_DLY 80u
295 #define OS_ERR_TIME_INVALID_MINUTES 81u
296 #define OS_ERR_TIME_INVALID_SECONDS 82u
297 #define OS_ERR_TIME_INVALID_MS 83u
298 #define OS_ERR_TIME_ZERO_DLY 84u
299 #define OS_ERR_TIME_DLY_ISR 85u
300 
301 #define OS_ERR_MEM_INVALID_PART 90u
302 #define OS_ERR_MEM_INVALID_BLKS 91u
303 #define OS_ERR_MEM_INVALID_SIZE 92u
304 #define OS_ERR_MEM_NO_FREE_BLKS 93u
305 #define OS_ERR_MEM_FULL 94u
306 #define OS_ERR_MEM_INVALID_PBLK 95u
307 #define OS_ERR_MEM_INVALID_PMEM 96u
308 #define OS_ERR_MEM_INVALID_PDATA 97u
309 #define OS_ERR_MEM_INVALID_ADDR 98u
310 #define OS_ERR_MEM_NAME_TOO_LONG 99u
311 
312 #define OS_ERR_NOT_MUTEX_OWNER 100u
313 
314 #define OS_ERR_FLAG_INVALID_PGRP 110u
315 #define OS_ERR_FLAG_WAIT_TYPE 111u
316 #define OS_ERR_FLAG_NOT_RDY 112u
317 #define OS_ERR_FLAG_INVALID_OPT 113u
318 #define OS_ERR_FLAG_GRP_DEPLETED 114u
319 #define OS_ERR_FLAG_NAME_TOO_LONG 115u
320 
321 #define OS_ERR_PIP_LOWER 120u
322 
323 #define OS_ERR_TMR_INVALID_DLY 130u
324 #define OS_ERR_TMR_INVALID_PERIOD 131u
325 #define OS_ERR_TMR_INVALID_OPT 132u
326 #define OS_ERR_TMR_INVALID_NAME 133u
327 #define OS_ERR_TMR_NON_AVAIL 134u
328 #define OS_ERR_TMR_INACTIVE 135u
329 #define OS_ERR_TMR_INVALID_DEST 136u
330 #define OS_ERR_TMR_INVALID_TYPE 137u
331 #define OS_ERR_TMR_INVALID 138u
332 #define OS_ERR_TMR_ISR 139u
333 #define OS_ERR_TMR_NAME_TOO_LONG 140u
334 #define OS_ERR_TMR_INVALID_STATE 141u
335 #define OS_ERR_TMR_STOPPED 142u
336 #define OS_ERR_TMR_NO_CALLBACK 143u
337 
338 /*
339 *********************************************************************************************************
340 * OLD ERROR CODE NAMES (< V2.84)
341 *********************************************************************************************************
342 */
343 #define OS_NO_ERR OS_ERR_NONE
344 #define OS_TIMEOUT OS_ERR_TIMEOUT
345 #define OS_TASK_NOT_EXIST OS_ERR_TASK_NOT_EXIST
346 #define OS_MBOX_FULL OS_ERR_MBOX_FULL
347 #define OS_Q_FULL OS_ERR_Q_FULL
348 #define OS_Q_EMPTY OS_ERR_Q_EMPTY
349 #define OS_PRIO_EXIST OS_ERR_PRIO_EXIST
350 #define OS_PRIO_ERR OS_ERR_PRIO
351 #define OS_PRIO_INVALID OS_ERR_PRIO_INVALID
352 #define OS_SEM_OVF OS_ERR_SEM_OVF
353 #define OS_TASK_DEL_ERR OS_ERR_TASK_DEL
354 #define OS_TASK_DEL_IDLE OS_ERR_TASK_DEL_IDLE
355 #define OS_TASK_DEL_REQ OS_ERR_TASK_DEL_REQ
356 #define OS_TASK_DEL_ISR OS_ERR_TASK_DEL_ISR
357 #define OS_NO_MORE_TCB OS_ERR_TASK_NO_MORE_TCB
358 #define OS_TIME_NOT_DLY OS_ERR_TIME_NOT_DLY
359 #define OS_TIME_INVALID_MINUTES OS_ERR_TIME_INVALID_MINUTES
360 #define OS_TIME_INVALID_SECONDS OS_ERR_TIME_INVALID_SECONDS
361 #define OS_TIME_INVALID_MS OS_ERR_TIME_INVALID_MS
362 #define OS_TIME_ZERO_DLY OS_ERR_TIME_ZERO_DLY
363 #define OS_TASK_SUSPEND_PRIO OS_ERR_TASK_SUSPEND_PRIO
364 #define OS_TASK_SUSPEND_IDLE OS_ERR_TASK_SUSPEND_IDLE
365 #define OS_TASK_RESUME_PRIO OS_ERR_TASK_RESUME_PRIO
366 #define OS_TASK_NOT_SUSPENDED OS_ERR_TASK_NOT_SUSPENDED
367 #define OS_MEM_INVALID_PART OS_ERR_MEM_INVALID_PART
368 #define OS_MEM_INVALID_BLKS OS_ERR_MEM_INVALID_BLKS
369 #define OS_MEM_INVALID_SIZE OS_ERR_MEM_INVALID_SIZE
370 #define OS_MEM_NO_FREE_BLKS OS_ERR_MEM_NO_FREE_BLKS
371 #define OS_MEM_FULL OS_ERR_MEM_FULL
372 #define OS_MEM_INVALID_PBLK OS_ERR_MEM_INVALID_PBLK
373 #define OS_MEM_INVALID_PMEM OS_ERR_MEM_INVALID_PMEM
374 #define OS_MEM_INVALID_PDATA OS_ERR_MEM_INVALID_PDATA
375 #define OS_MEM_INVALID_ADDR OS_ERR_MEM_INVALID_ADDR
376 #define OS_MEM_NAME_TOO_LONG OS_ERR_MEM_NAME_TOO_LONG
377 #define OS_TASK_OPT_ERR OS_ERR_TASK_OPT
378 #define OS_FLAG_INVALID_PGRP OS_ERR_FLAG_INVALID_PGRP
379 #define OS_FLAG_ERR_WAIT_TYPE OS_ERR_FLAG_WAIT_TYPE
380 #define OS_FLAG_ERR_NOT_RDY OS_ERR_FLAG_NOT_RDY
381 #define OS_FLAG_INVALID_OPT OS_ERR_FLAG_INVALID_OPT
382 #define OS_FLAG_GRP_DEPLETED OS_ERR_FLAG_GRP_DEPLETED
383 
384 /*$PAGE*/
385 /*
386 *********************************************************************************************************
387 * EVENT CONTROL BLOCK
388 *********************************************************************************************************
389 */
390 
391 #if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u)
392 typedef struct os_event {
393  INT8U OSEventType; /* Type of event control block (see OS_EVENT_TYPE_xxxx) */
394  void *OSEventPtr; /* Pointer to message or queue structure */
395  INT16U OSEventCnt; /* Semaphore Count (not used if other EVENT type) */
396 #if OS_LOWEST_PRIO <= 63u
397  INT8U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
398  INT8U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
399 #else
400  INT16U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
401  INT16U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
402 #endif
403 
404 #if OS_EVENT_NAME_EN > 0u
406 #endif
407 } OS_EVENT;
408 #endif
409 
410 
411 /*
412 *********************************************************************************************************
413 * EVENT FLAGS CONTROL BLOCK
414 *********************************************************************************************************
415 */
416 
417 #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
418 
419 #if OS_FLAGS_NBITS == 8u /* Determine the size of OS_FLAGS (8, 16 or 32 bits) */
420 typedef INT8U OS_FLAGS;
421 #endif
422 
423 #if OS_FLAGS_NBITS == 16u
424 typedef INT16U OS_FLAGS;
425 #endif
426 
427 #if OS_FLAGS_NBITS == 32u
428 typedef INT32U OS_FLAGS;
429 #endif
430 
431 
432 typedef struct os_flag_grp { /* Event Flag Group */
433  INT8U OSFlagType; /* Should be set to OS_EVENT_TYPE_FLAG */
434  void *OSFlagWaitList; /* Pointer to first NODE of task waiting on event flag */
435  OS_FLAGS OSFlagFlags; /* 8, 16 or 32 bit flags */
436 #if OS_FLAG_NAME_EN > 0u
438 #endif
439 } OS_FLAG_GRP;
440 
441 
442 
443 typedef struct os_flag_node { /* Event Flag Wait List Node */
444  void *OSFlagNodeNext; /* Pointer to next NODE in wait list */
445  void *OSFlagNodePrev; /* Pointer to previous NODE in wait list */
446  void *OSFlagNodeTCB; /* Pointer to TCB of waiting task */
447  void *OSFlagNodeFlagGrp; /* Pointer to Event Flag Group */
448  OS_FLAGS OSFlagNodeFlags; /* Event flag to wait on */
449  INT8U OSFlagNodeWaitType; /* Type of wait: */
450  /* OS_FLAG_WAIT_AND */
451  /* OS_FLAG_WAIT_ALL */
452  /* OS_FLAG_WAIT_OR */
453  /* OS_FLAG_WAIT_ANY */
454 } OS_FLAG_NODE;
455 #endif
456 
457 /*$PAGE*/
458 /*
459 *********************************************************************************************************
460 * MESSAGE MAILBOX DATA
461 *********************************************************************************************************
462 */
463 
464 #if OS_MBOX_EN > 0u
465 typedef struct os_mbox_data {
466  void *OSMsg; /* Pointer to message in mailbox */
467 #if OS_LOWEST_PRIO <= 63u
468  INT8U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
469  INT8U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
470 #else
471  INT16U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
472  INT16U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
473 #endif
474 } OS_MBOX_DATA;
475 #endif
476 
477 /*
478 *********************************************************************************************************
479 * MEMORY PARTITION DATA STRUCTURES
480 *********************************************************************************************************
481 */
482 
483 #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
484 typedef struct os_mem { /* MEMORY CONTROL BLOCK */
485  void *OSMemAddr; /* Pointer to beginning of memory partition */
486  void *OSMemFreeList; /* Pointer to list of free memory blocks */
487  INT32U OSMemBlkSize; /* Size (in bytes) of each block of memory */
488  INT32U OSMemNBlks; /* Total number of blocks in this partition */
489  INT32U OSMemNFree; /* Number of memory blocks remaining in this partition */
490 #if OS_MEM_NAME_EN > 0u
491  INT8U *OSMemName; /* Memory partition name */
492 #endif
493 } OS_MEM;
494 
495 
496 typedef struct os_mem_data {
497  void *OSAddr; /* Pointer to the beginning address of the memory partition */
498  void *OSFreeList; /* Pointer to the beginning of the free list of memory blocks */
499  INT32U OSBlkSize; /* Size (in bytes) of each memory block */
500  INT32U OSNBlks; /* Total number of blocks in the partition */
501  INT32U OSNFree; /* Number of memory blocks free */
502  INT32U OSNUsed; /* Number of memory blocks used */
503 } OS_MEM_DATA;
504 #endif
505 
506 /*$PAGE*/
507 /*
508 *********************************************************************************************************
509 * MUTUAL EXCLUSION SEMAPHORE DATA
510 *********************************************************************************************************
511 */
512 
513 #if OS_MUTEX_EN > 0u
514 typedef struct os_mutex_data {
515 #if OS_LOWEST_PRIO <= 63u
516  INT8U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
517  INT8U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
518 #else
519  INT16U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
520  INT16U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
521 #endif
522  BOOLEAN OSValue; /* Mutex value (OS_FALSE = used, OS_TRUE = available) */
523  INT8U OSOwnerPrio; /* Mutex owner's task priority or 0xFF if no owner */
524  INT8U OSMutexPIP; /* Priority Inheritance Priority or 0xFF if no owner */
525 } OS_MUTEX_DATA;
526 #endif
527 
528 /*
529 *********************************************************************************************************
530 * MESSAGE QUEUE DATA
531 *********************************************************************************************************
532 */
533 
534 #if OS_Q_EN > 0u
535 typedef struct os_q { /* QUEUE CONTROL BLOCK */
536  struct os_q *OSQPtr; /* Link to next queue control block in list of free blocks */
537  void **OSQStart; /* Pointer to start of queue data */
538  void **OSQEnd; /* Pointer to end of queue data */
539  void **OSQIn; /* Pointer to where next message will be inserted in the Q */
540  void **OSQOut; /* Pointer to where next message will be extracted from the Q */
541  INT16U OSQSize; /* Size of queue (maximum number of entries) */
542  INT16U OSQEntries; /* Current number of entries in the queue */
543 } OS_Q;
544 
545 
546 typedef struct os_q_data {
547  void *OSMsg; /* Pointer to next message to be extracted from queue */
548  INT16U OSNMsgs; /* Number of messages in message queue */
549  INT16U OSQSize; /* Size of message queue */
550 #if OS_LOWEST_PRIO <= 63u
551  INT8U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
552  INT8U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
553 #else
554  INT16U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
555  INT16U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
556 #endif
557 } OS_Q_DATA;
558 #endif
559 
560 /*
561 *********************************************************************************************************
562 * SEMAPHORE DATA
563 *********************************************************************************************************
564 */
565 
566 #if OS_SEM_EN > 0u
567 typedef struct os_sem_data {
568  INT16U OSCnt; /* Semaphore count */
569 #if OS_LOWEST_PRIO <= 63u
570  INT8U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
571  INT8U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
572 #else
573  INT16U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
574  INT16U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
575 #endif
576 } OS_SEM_DATA;
577 #endif
578 
579 /*
580 *********************************************************************************************************
581 * TASK STACK DATA
582 *********************************************************************************************************
583 */
584 
585 #if OS_TASK_CREATE_EXT_EN > 0u
586 typedef struct os_stk_data {
587  INT32U OSFree; /* Number of free bytes on the stack */
588  INT32U OSUsed; /* Number of bytes used on the stack */
589 } OS_STK_DATA;
590 #endif
591 
592 /*$PAGE*/
593 /*
594 *********************************************************************************************************
595 * TASK CONTROL BLOCK
596 *********************************************************************************************************
597 */
598 
599 typedef struct os_tcb {
600  OS_STK *OSTCBStkPtr; /* Pointer to current top of stack */
601 
602 #if OS_TASK_CREATE_EXT_EN > 0u
603  void *OSTCBExtPtr; /* Pointer to user definable data for TCB extension */
604  OS_STK *OSTCBStkBottom; /* Pointer to bottom of stack */
605  INT32U OSTCBStkSize; /* Size of task stack (in number of stack elements) */
606  INT16U OSTCBOpt; /* Task options as passed by OSTaskCreateExt() */
607  INT16U OSTCBId; /* Task ID (0..65535) */
608 #endif
609 
610  struct os_tcb *OSTCBNext; /* Pointer to next TCB in the TCB list */
611  struct os_tcb *OSTCBPrev; /* Pointer to previous TCB in the TCB list */
612 
613 #if (OS_EVENT_EN) || (OS_FLAG_EN > 0u)
614  OS_EVENT *OSTCBEventPtr; /* Pointer to event control block */
615 #endif
616 
617 #if (OS_EVENT_EN) && (OS_EVENT_MULTI_EN > 0u)
618  OS_EVENT **OSTCBEventMultiPtr; /* Pointer to multiple event control blocks */
619 #endif
620 
621 #if ((OS_Q_EN > 0u) && (OS_MAX_QS > 0u)) || (OS_MBOX_EN > 0u)
622  void *OSTCBMsg; /* Message received from OSMboxPost() or OSQPost() */
623 #endif
624 
625 #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
626 #if OS_TASK_DEL_EN > 0u
627  OS_FLAG_NODE *OSTCBFlagNode; /* Pointer to event flag node */
628 #endif
629  OS_FLAGS OSTCBFlagsRdy; /* Event flags that made task ready to run */
630 #endif
631 
632  INT32U OSTCBDly; /* Nbr ticks to delay task or, timeout waiting for event */
633  INT8U OSTCBStat; /* Task status */
634  INT8U OSTCBStatPend; /* Task PEND status */
635  INT8U OSTCBPrio; /* Task priority (0 == highest) */
636 
637  INT8U OSTCBX; /* Bit position in group corresponding to task priority */
638  INT8U OSTCBY; /* Index into ready table corresponding to task priority */
639 #if OS_LOWEST_PRIO <= 63u
640  INT8U OSTCBBitX; /* Bit mask to access bit position in ready table */
641  INT8U OSTCBBitY; /* Bit mask to access bit position in ready group */
642 #else
643  INT16U OSTCBBitX; /* Bit mask to access bit position in ready table */
644  INT16U OSTCBBitY; /* Bit mask to access bit position in ready group */
645 #endif
646 
647 #if OS_TASK_DEL_EN > 0u
648  INT8U OSTCBDelReq; /* Indicates whether a task needs to delete itself */
649 #endif
650 
651 #if OS_TASK_PROFILE_EN > 0u
652  INT32U OSTCBCtxSwCtr; /* Number of time the task was switched in */
653  INT32U OSTCBCyclesTot; /* Total number of clock cycles the task has been running */
654  INT32U OSTCBCyclesStart; /* Snapshot of cycle counter at start of task resumption */
655  OS_STK *OSTCBStkBase; /* Pointer to the beginning of the task stack */
656  INT32U OSTCBStkUsed; /* Number of bytes used from the stack */
657 #endif
658 
659 #if OS_TASK_NAME_EN > 0u
661 #endif
662 
663 #if OS_TASK_REG_TBL_SIZE > 0u
665 #endif
666 } OS_TCB;
667 
668 /*$PAGE*/
669 /*
670 ************************************************************************************************************************
671 * TIMER DATA TYPES
672 ************************************************************************************************************************
673 */
674 
675 #if OS_TMR_EN > 0u
676 typedef void (*OS_TMR_CALLBACK)(void *ptmr, void *parg);
677 
678 
679 
680 typedef struct os_tmr {
681  INT8U OSTmrType; /* Should be set to OS_TMR_TYPE */
682  OS_TMR_CALLBACK OSTmrCallback; /* Function to call when timer expires */
683  void *OSTmrCallbackArg; /* Argument to pass to function when timer expires */
684  void *OSTmrNext; /* Double link list pointers */
685  void *OSTmrPrev;
686  INT32U OSTmrMatch; /* Timer expires when OSTmrTime == OSTmrMatch */
687  INT32U OSTmrDly; /* Delay time before periodic update starts */
688  INT32U OSTmrPeriod; /* Period to repeat timer */
689 #if OS_TMR_CFG_NAME_EN > 0u
690  INT8U *OSTmrName; /* Name to give the timer */
691 #endif
692  INT8U OSTmrOpt; /* Options (see OS_TMR_OPT_xxx) */
693  INT8U OSTmrState; /* Indicates the state of the timer: */
694  /* OS_TMR_STATE_UNUSED */
695  /* OS_TMR_STATE_RUNNING */
696  /* OS_TMR_STATE_STOPPED */
697 } OS_TMR;
698 
699 
700 
701 typedef struct os_tmr_wheel {
702  OS_TMR *OSTmrFirst; /* Pointer to first timer in linked list */
704 } OS_TMR_WHEEL;
705 #endif
706 
707 /*$PAGE*/
708 /*
709 *********************************************************************************************************
710 * GLOBAL VARIABLES
711 *********************************************************************************************************
712 */
713 
714 OS_EXT INT32U OSCtxSwCtr; /* Counter of number of context switches */
715 
716 #if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u)
717 OS_EXT OS_EVENT *OSEventFreeList; /* Pointer to list of free EVENT control blocks */
718 OS_EXT OS_EVENT OSEventTbl[OS_MAX_EVENTS];/* Table of EVENT control blocks */
719 #endif
720 
721 #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
722 OS_EXT OS_FLAG_GRP OSFlagTbl[OS_MAX_FLAGS]; /* Table containing event flag groups */
723 OS_EXT OS_FLAG_GRP *OSFlagFreeList; /* Pointer to free list of event flag groups */
724 #endif
725 
726 #if OS_TASK_STAT_EN > 0u
727 OS_EXT INT8U OSCPUUsage; /* Percentage of CPU used */
728 OS_EXT INT32U OSIdleCtrMax; /* Max. value that idle ctr can take in 1 sec. */
729 OS_EXT INT32U OSIdleCtrRun; /* Val. reached by idle ctr at run time in 1 sec. */
730 OS_EXT BOOLEAN OSStatRdy; /* Flag indicating that the statistic task is rdy */
731 OS_EXT OS_STK OSTaskStatStk[OS_TASK_STAT_STK_SIZE]; /* Statistics task stack */
732 #endif
733 
734 OS_EXT INT8U OSIntNesting; /* Interrupt nesting level */
735 
736 OS_EXT INT8U OSLockNesting; /* Multitasking lock nesting level */
737 
738 OS_EXT INT8U OSPrioCur; /* Priority of current task */
739 OS_EXT INT8U OSPrioHighRdy; /* Priority of highest priority task */
740 
741 #if OS_LOWEST_PRIO <= 63u
742 OS_EXT INT8U OSRdyGrp; /* Ready list group */
743 OS_EXT INT8U OSRdyTbl[OS_RDY_TBL_SIZE]; /* Table of tasks which are ready to run */
744 #else
745 OS_EXT INT16U OSRdyGrp; /* Ready list group */
746 OS_EXT INT16U OSRdyTbl[OS_RDY_TBL_SIZE]; /* Table of tasks which are ready to run */
747 #endif
748 
749 OS_EXT BOOLEAN OSRunning; /* Flag indicating that kernel is running */
750 
751 OS_EXT INT8U OSTaskCtr; /* Number of tasks created */
752 
753 OS_EXT volatile INT32U OSIdleCtr; /* Idle counter */
754 
756 
757 
758 OS_EXT OS_TCB *OSTCBCur; /* Pointer to currently running TCB */
759 OS_EXT OS_TCB *OSTCBFreeList; /* Pointer to list of free TCBs */
760 OS_EXT OS_TCB *OSTCBHighRdy; /* Pointer to highest priority TCB R-to-R */
761 OS_EXT OS_TCB *OSTCBList; /* Pointer to doubly linked list of TCBs */
762 OS_EXT OS_TCB *OSTCBPrioTbl[OS_LOWEST_PRIO + 1];/* Table of pointers to created TCBs */
764 
765 #if OS_TICK_STEP_EN > 0u
766 OS_EXT INT8U OSTickStepState; /* Indicates the state of the tick step feature */
767 #endif
768 
769 #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
770 OS_EXT OS_MEM *OSMemFreeList; /* Pointer to free list of memory partitions */
771 OS_EXT OS_MEM OSMemTbl[OS_MAX_MEM_PART];/* Storage for memory partition manager */
772 #endif
773 
774 #if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u)
775 OS_EXT OS_Q *OSQFreeList; /* Pointer to list of free QUEUE control blocks */
776 OS_EXT OS_Q OSQTbl[OS_MAX_QS]; /* Table of QUEUE control blocks */
777 #endif
778 
779 #if OS_TIME_GET_SET_EN > 0u
780 OS_EXT volatile INT32U OSTime; /* Current value of system time (in ticks) */
781 #endif
782 
783 #if OS_TMR_EN > 0u
784 OS_EXT INT16U OSTmrFree; /* Number of free entries in the timer pool */
785 OS_EXT INT16U OSTmrUsed; /* Number of timers used */
786 OS_EXT INT32U OSTmrTime; /* Current timer time */
787 
788 OS_EXT OS_EVENT *OSTmrSem; /* Sem. used to gain exclusive access to timers */
789 OS_EXT OS_EVENT *OSTmrSemSignal; /* Sem. used to signal the update of timers */
790 
791 OS_EXT OS_TMR OSTmrTbl[OS_TMR_CFG_MAX]; /* Table containing pool of timers */
792 OS_EXT OS_TMR *OSTmrFreeList; /* Pointer to free list of timers */
794 
796 #endif
797 
798 extern INT8U const OSUnMapTbl[256]; /* Priority->Index lookup table */
799 
800 /*$PAGE*/
801 /*
802 *********************************************************************************************************
803 * FUNCTION PROTOTYPES
804 * (Target Independent Functions)
805 *********************************************************************************************************
806 */
807 
808 /*
809 *********************************************************************************************************
810 * MISCELLANEOUS
811 *********************************************************************************************************
812 */
813 
814 #if (OS_EVENT_EN)
815 
816 #if (OS_EVENT_NAME_EN > 0u)
817 INT8U OSEventNameGet (OS_EVENT *pevent,
818  INT8U **pname,
819  INT8U *perr);
820 
821 void OSEventNameSet (OS_EVENT *pevent,
822  INT8U *pname,
823  INT8U *perr);
824 #endif
825 
826 #if (OS_EVENT_MULTI_EN > 0u)
827 INT16U OSEventPendMulti (OS_EVENT **pevents_pend,
828  OS_EVENT **pevents_rdy,
829  void **pmsgs_rdy,
830  INT32U timeout,
831  INT8U *perr);
832 #endif
833 
834 #endif
835 
836 /*
837 *********************************************************************************************************
838 * EVENT FLAGS MANAGEMENT
839 *********************************************************************************************************
840 */
841 
842 #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
843 
844 #if OS_FLAG_ACCEPT_EN > 0u
845 OS_FLAGS OSFlagAccept (OS_FLAG_GRP *pgrp,
846  OS_FLAGS flags,
847  INT8U wait_type,
848  INT8U *perr);
849 #endif
850 
851 OS_FLAG_GRP *OSFlagCreate (OS_FLAGS flags,
852  INT8U *perr);
853 
854 #if OS_FLAG_DEL_EN > 0u
856  INT8U opt,
857  INT8U *perr);
858 #endif
859 
860 #if (OS_FLAG_EN > 0u) && (OS_FLAG_NAME_EN > 0u)
862  INT8U **pname,
863  INT8U *perr);
864 
865 void OSFlagNameSet (OS_FLAG_GRP *pgrp,
866  INT8U *pname,
867  INT8U *perr);
868 #endif
869 
870 OS_FLAGS OSFlagPend (OS_FLAG_GRP *pgrp,
871  OS_FLAGS flags,
872  INT8U wait_type,
873  INT32U timeout,
874  INT8U *perr);
875 
876 OS_FLAGS OSFlagPendGetFlagsRdy (void);
877 OS_FLAGS OSFlagPost (OS_FLAG_GRP *pgrp,
878  OS_FLAGS flags,
879  INT8U opt,
880  INT8U *perr);
881 
882 #if OS_FLAG_QUERY_EN > 0u
883 OS_FLAGS OSFlagQuery (OS_FLAG_GRP *pgrp,
884  INT8U *perr);
885 #endif
886 #endif
887 
888 /*
889 *********************************************************************************************************
890 * MESSAGE MAILBOX MANAGEMENT
891 *********************************************************************************************************
892 */
893 
894 #if OS_MBOX_EN > 0u
895 
896 #if OS_MBOX_ACCEPT_EN > 0u
897 void *OSMboxAccept (OS_EVENT *pevent);
898 #endif
899 
900 OS_EVENT *OSMboxCreate (void *pmsg);
901 
902 #if OS_MBOX_DEL_EN > 0u
903 OS_EVENT *OSMboxDel (OS_EVENT *pevent,
904  INT8U opt,
905  INT8U *perr);
906 #endif
907 
908 void *OSMboxPend (OS_EVENT *pevent,
909  INT32U timeout,
910  INT8U *perr);
911 
912 #if OS_MBOX_PEND_ABORT_EN > 0u
914  INT8U opt,
915  INT8U *perr);
916 #endif
917 
918 #if OS_MBOX_POST_EN > 0u
919 INT8U OSMboxPost (OS_EVENT *pevent,
920  void *pmsg);
921 #endif
922 
923 #if OS_MBOX_POST_OPT_EN > 0u
924 INT8U OSMboxPostOpt (OS_EVENT *pevent,
925  void *pmsg,
926  INT8U opt);
927 #endif
928 
929 #if OS_MBOX_QUERY_EN > 0u
930 INT8U OSMboxQuery (OS_EVENT *pevent,
931  OS_MBOX_DATA *p_mbox_data);
932 #endif
933 #endif
934 
935 /*
936 *********************************************************************************************************
937 * MEMORY MANAGEMENT
938 *********************************************************************************************************
939 */
940 
941 #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
942 
943 OS_MEM *OSMemCreate (void *addr,
944  INT32U nblks,
945  INT32U blksize,
946  INT8U *perr);
947 
948 void *OSMemGet (OS_MEM *pmem,
949  INT8U *perr);
950 #if OS_MEM_NAME_EN > 0u
951 INT8U OSMemNameGet (OS_MEM *pmem,
952  INT8U **pname,
953  INT8U *perr);
954 
955 void OSMemNameSet (OS_MEM *pmem,
956  INT8U *pname,
957  INT8U *perr);
958 #endif
959 INT8U OSMemPut (OS_MEM *pmem,
960  void *pblk);
961 
962 #if OS_MEM_QUERY_EN > 0u
963 INT8U OSMemQuery (OS_MEM *pmem,
964  OS_MEM_DATA *p_mem_data);
965 #endif
966 
967 #endif
968 
969 /*
970 *********************************************************************************************************
971 * MUTUAL EXCLUSION SEMAPHORE MANAGEMENT
972 *********************************************************************************************************
973 */
974 
975 #if OS_MUTEX_EN > 0u
976 
977 #if OS_MUTEX_ACCEPT_EN > 0u
979  INT8U *perr);
980 #endif
981 
983  INT8U *perr);
984 
985 #if OS_MUTEX_DEL_EN > 0u
986 OS_EVENT *OSMutexDel (OS_EVENT *pevent,
987  INT8U opt,
988  INT8U *perr);
989 #endif
990 
991 void OSMutexPend (OS_EVENT *pevent,
992  INT32U timeout,
993  INT8U *perr);
994 
995 INT8U OSMutexPost (OS_EVENT *pevent);
996 
997 #if OS_MUTEX_QUERY_EN > 0u
998 INT8U OSMutexQuery (OS_EVENT *pevent,
999  OS_MUTEX_DATA *p_mutex_data);
1000 #endif
1001 
1002 #endif
1003 
1004 /*$PAGE*/
1005 /*
1006 *********************************************************************************************************
1007 * MESSAGE QUEUE MANAGEMENT
1008 *********************************************************************************************************
1009 */
1010 
1011 #if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u)
1012 
1013 #if OS_Q_ACCEPT_EN > 0u
1014 void *OSQAccept (OS_EVENT *pevent,
1015  INT8U *perr);
1016 #endif
1017 
1018 OS_EVENT *OSQCreate (void **start,
1019  INT16U size);
1020 
1021 #if OS_Q_DEL_EN > 0u
1022 OS_EVENT *OSQDel (OS_EVENT *pevent,
1023  INT8U opt,
1024  INT8U *perr);
1025 #endif
1026 
1027 #if OS_Q_FLUSH_EN > 0u
1028 INT8U OSQFlush (OS_EVENT *pevent);
1029 #endif
1030 
1031 void *OSQPend (OS_EVENT *pevent,
1032  INT32U timeout,
1033  INT8U *perr);
1034 
1035 #if OS_Q_PEND_ABORT_EN > 0u
1036 INT8U OSQPendAbort (OS_EVENT *pevent,
1037  INT8U opt,
1038  INT8U *perr);
1039 #endif
1040 
1041 #if OS_Q_POST_EN > 0u
1042 INT8U OSQPost (OS_EVENT *pevent,
1043  void *pmsg);
1044 #endif
1045 
1046 #if OS_Q_POST_FRONT_EN > 0u
1047 INT8U OSQPostFront (OS_EVENT *pevent,
1048  void *pmsg);
1049 #endif
1050 
1051 #if OS_Q_POST_OPT_EN > 0u
1052 INT8U OSQPostOpt (OS_EVENT *pevent,
1053  void *pmsg,
1054  INT8U opt);
1055 #endif
1056 
1057 #if OS_Q_QUERY_EN > 0u
1058 INT8U OSQQuery (OS_EVENT *pevent,
1059  OS_Q_DATA *p_q_data);
1060 #endif
1061 
1062 #endif
1063 
1064 /*$PAGE*/
1065 /*
1066 *********************************************************************************************************
1067 * SEMAPHORE MANAGEMENT
1068 *********************************************************************************************************
1069 */
1070 #if OS_SEM_EN > 0u
1071 
1072 #if OS_SEM_ACCEPT_EN > 0u
1073 INT16U OSSemAccept (OS_EVENT *pevent);
1074 #endif
1075 
1076 OS_EVENT *OSSemCreate (INT16U cnt);
1077 
1078 #if OS_SEM_DEL_EN > 0u
1079 OS_EVENT *OSSemDel (OS_EVENT *pevent,
1080  INT8U opt,
1081  INT8U *perr);
1082 #endif
1083 
1084 void OSSemPend (OS_EVENT *pevent,
1085  INT32U timeout,
1086  INT8U *perr);
1087 
1088 #if OS_SEM_PEND_ABORT_EN > 0u
1089 INT8U OSSemPendAbort (OS_EVENT *pevent,
1090  INT8U opt,
1091  INT8U *perr);
1092 #endif
1093 
1094 INT8U OSSemPost (OS_EVENT *pevent);
1095 
1096 #if OS_SEM_QUERY_EN > 0u
1097 INT8U OSSemQuery (OS_EVENT *pevent,
1098  OS_SEM_DATA *p_sem_data);
1099 #endif
1100 
1101 #if OS_SEM_SET_EN > 0u
1102 void OSSemSet (OS_EVENT *pevent,
1103  INT16U cnt,
1104  INT8U *perr);
1105 #endif
1106 
1107 #endif
1108 
1109 /*$PAGE*/
1110 /*
1111 *********************************************************************************************************
1112 * TASK MANAGEMENT
1113 *********************************************************************************************************
1114 */
1115 #if OS_TASK_CHANGE_PRIO_EN > 0u
1116 INT8U OSTaskChangePrio (INT8U oldprio,
1117  INT8U newprio);
1118 #endif
1119 
1120 #if OS_TASK_CREATE_EN > 0u
1121 INT8U OSTaskCreate (void (*task)(void *p_arg),
1122  void *p_arg,
1123  OS_STK *ptos,
1124  INT8U prio);
1125 #endif
1126 
1127 #if OS_TASK_CREATE_EXT_EN > 0u
1128 INT8U OSTaskCreateExt (void (*task)(void *p_arg),
1129  void *p_arg,
1130  OS_STK *ptos,
1131  INT8U prio,
1132  INT16U id,
1133  OS_STK *pbos,
1134  INT32U stk_size,
1135  void *pext,
1136  INT16U opt);
1137 #endif
1138 
1139 #if OS_TASK_DEL_EN > 0u
1140 INT8U OSTaskDel (INT8U prio);
1141 INT8U OSTaskDelReq (INT8U prio);
1142 #endif
1143 
1144 #if OS_TASK_NAME_EN > 0u
1145 INT8U OSTaskNameGet (INT8U prio,
1146  INT8U **pname,
1147  INT8U *perr);
1148 
1149 void OSTaskNameSet (INT8U prio,
1150  INT8U *pname,
1151  INT8U *perr);
1152 #endif
1153 
1154 #if OS_TASK_SUSPEND_EN > 0u
1155 INT8U OSTaskResume (INT8U prio);
1156 INT8U OSTaskSuspend (INT8U prio);
1157 #endif
1158 
1159 #if (OS_TASK_STAT_STK_CHK_EN > 0u) && (OS_TASK_CREATE_EXT_EN > 0u)
1160 INT8U OSTaskStkChk (INT8U prio,
1161  OS_STK_DATA *p_stk_data);
1162 #endif
1163 
1164 #if OS_TASK_QUERY_EN > 0u
1165 INT8U OSTaskQuery (INT8U prio,
1166  OS_TCB *p_task_data);
1167 #endif
1168 
1169 
1170 
1171 #if OS_TASK_REG_TBL_SIZE > 0u
1172 INT32U OSTaskRegGet (INT8U prio,
1173  INT8U id,
1174  INT8U *perr);
1175 
1176 void OSTaskRegSet (INT8U prio,
1177  INT8U id,
1178  INT32U value,
1179  INT8U *perr);
1180 #endif
1181 
1182 /*$PAGE*/
1183 /*
1184 *********************************************************************************************************
1185 * TIME MANAGEMENT
1186 *********************************************************************************************************
1187 */
1188 
1189 void OSTimeDly (INT32U ticks);
1190 
1191 #if OS_TIME_DLY_HMSM_EN > 0u
1192 INT8U OSTimeDlyHMSM (INT8U hours,
1193  INT8U minutes,
1194  INT8U seconds,
1195  INT16U ms);
1196 #endif
1197 
1198 #if OS_TIME_DLY_RESUME_EN > 0u
1199 INT8U OSTimeDlyResume (INT8U prio);
1200 #endif
1201 
1202 #if OS_TIME_GET_SET_EN > 0u
1203 INT32U OSTimeGet (void);
1204 void OSTimeSet (INT32U ticks);
1205 #endif
1206 
1207 void OSTimeTick (void);
1208 
1209 /*
1210 *********************************************************************************************************
1211 * TIMER MANAGEMENT
1212 *********************************************************************************************************
1213 */
1214 
1215 #if OS_TMR_EN > 0u
1216 OS_TMR *OSTmrCreate (INT32U dly,
1217  INT32U period,
1218  INT8U opt,
1219  OS_TMR_CALLBACK callback,
1220  void *callback_arg,
1221  INT8U *pname,
1222  INT8U *perr);
1223 
1224 BOOLEAN OSTmrDel (OS_TMR *ptmr,
1225  INT8U *perr);
1226 
1227 #if OS_TMR_CFG_NAME_EN > 0u
1228 INT8U OSTmrNameGet (OS_TMR *ptmr,
1229  INT8U **pdest,
1230  INT8U *perr);
1231 #endif
1233  INT8U *perr);
1234 
1235 INT8U OSTmrStateGet (OS_TMR *ptmr,
1236  INT8U *perr);
1237 
1238 BOOLEAN OSTmrStart (OS_TMR *ptmr,
1239  INT8U *perr);
1240 
1241 BOOLEAN OSTmrStop (OS_TMR *ptmr,
1242  INT8U opt,
1243  void *callback_arg,
1244  INT8U *perr);
1245 
1246 INT8U OSTmrSignal (void);
1247 #endif
1248 
1249 /*
1250 *********************************************************************************************************
1251 * MISCELLANEOUS
1252 *********************************************************************************************************
1253 */
1254 
1255 void OSInit (void);
1256 
1257 void OSIntEnter (void);
1258 void OSIntExit (void);
1259 
1260 #if OS_SCHED_LOCK_EN > 0u
1261 void OSSchedLock (void);
1262 void OSSchedUnlock (void);
1263 #endif
1264 
1265 void OSStart (void);
1266 
1267 void OSStatInit (void);
1268 
1269 INT16U OSVersion (void);
1270 
1271 /*$PAGE*/
1272 /*
1273 *********************************************************************************************************
1274 * INTERNAL FUNCTION PROTOTYPES
1275 * (Your application MUST NOT call these functions)
1276 *********************************************************************************************************
1277 */
1278 
1279 #if OS_TASK_DEL_EN > 0u
1280 void OS_Dummy (void);
1281 #endif
1282 
1283 #if (OS_EVENT_EN)
1284 INT8U OS_EventTaskRdy (OS_EVENT *pevent,
1285  void *pmsg,
1286  INT8U msk,
1287  INT8U pend_stat);
1288 
1289 void OS_EventTaskWait (OS_EVENT *pevent);
1290 
1291 void OS_EventTaskRemove (OS_TCB *ptcb,
1292  OS_EVENT *pevent);
1293 
1294 #if (OS_EVENT_MULTI_EN > 0u)
1295 void OS_EventTaskWaitMulti (OS_EVENT **pevents_wait);
1296 
1297 void OS_EventTaskRemoveMulti (OS_TCB *ptcb,
1298  OS_EVENT **pevents_multi);
1299 #endif
1300 
1301 void OS_EventWaitListInit (OS_EVENT *pevent);
1302 #endif
1303 
1304 #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
1305 void OS_FlagInit (void);
1306 void OS_FlagUnlink (OS_FLAG_NODE *pnode);
1307 #endif
1308 
1309 void OS_MemClr (INT8U *pdest,
1310  INT16U size);
1311 
1312 void OS_MemCopy (INT8U *pdest,
1313  INT8U *psrc,
1314  INT16U size);
1315 
1316 #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
1317 void OS_MemInit (void);
1318 #endif
1319 
1320 #if OS_Q_EN > 0u
1321 void OS_QInit (void);
1322 #endif
1323 
1324 void OS_Sched (void);
1325 
1326 #if (OS_EVENT_NAME_EN > 0u) || (OS_FLAG_NAME_EN > 0u) || (OS_MEM_NAME_EN > 0u) || (OS_TASK_NAME_EN > 0u)
1327 INT8U OS_StrLen (INT8U *psrc);
1328 #endif
1329 
1330 void OS_TaskIdle (void *p_arg);
1331 
1332 void OS_TaskReturn (void);
1333 
1334 #if OS_TASK_STAT_EN > 0u
1335 void OS_TaskStat (void *p_arg);
1336 #endif
1337 
1338 #if (OS_TASK_STAT_STK_CHK_EN > 0u) && (OS_TASK_CREATE_EXT_EN > 0u)
1339 void OS_TaskStkClr (OS_STK *pbos,
1340  INT32U size,
1341  INT16U opt);
1342 #endif
1343 
1344 #if (OS_TASK_STAT_STK_CHK_EN > 0u) && (OS_TASK_CREATE_EXT_EN > 0u)
1345 void OS_TaskStatStkChk (void);
1346 #endif
1347 
1348 INT8U OS_TCBInit (INT8U prio,
1349  OS_STK *ptos,
1350  OS_STK *pbos,
1351  INT16U id,
1352  INT32U stk_size,
1353  void *pext,
1354  INT16U opt);
1355 
1356 #if OS_TMR_EN > 0u
1357 void OSTmr_Init (void);
1358 #endif
1359 
1360 /*$PAGE*/
1361 /*
1362 *********************************************************************************************************
1363 * FUNCTION PROTOTYPES
1364 * (Target Specific Functions)
1365 *********************************************************************************************************
1366 */
1367 
1368 #if OS_DEBUG_EN > 0u
1369 void OSDebugInit (void);
1370 #endif
1371 
1372 void OSInitHookBegin (void);
1373 void OSInitHookEnd (void);
1374 
1375 void OSTaskCreateHook (OS_TCB *ptcb);
1376 void OSTaskDelHook (OS_TCB *ptcb);
1377 
1378 void OSTaskIdleHook (void);
1379 
1380 void OSTaskReturnHook (OS_TCB *ptcb);
1381 
1382 void OSTaskStatHook (void);
1383 OS_STK *OSTaskStkInit (void (*task)(void *p_arg),
1384  void *p_arg,
1385  OS_STK *ptos,
1386  INT16U opt);
1387 
1388 #if OS_TASK_SW_HOOK_EN > 0u
1389 void OSTaskSwHook (void);
1390 #endif
1391 
1392 void OSTCBInitHook (OS_TCB *ptcb);
1393 
1394 #if OS_TIME_TICK_HOOK_EN > 0u
1395 void OSTimeTickHook (void);
1396 #endif
1397 
1398 /*$PAGE*/
1399 /*
1400 *********************************************************************************************************
1401 * FUNCTION PROTOTYPES
1402 * (Application Specific Functions)
1403 *********************************************************************************************************
1404 */
1405 
1406 #if OS_APP_HOOKS_EN > 0u
1407 void App_TaskCreateHook (OS_TCB *ptcb);
1408 void App_TaskDelHook (OS_TCB *ptcb);
1409 void App_TaskIdleHook (void);
1410 
1411 void App_TaskReturnHook (OS_TCB *ptcb);
1412 
1413 void App_TaskStatHook (void);
1414 
1415 #if OS_TASK_SW_HOOK_EN > 0u
1416 void App_TaskSwHook (void);
1417 #endif
1418 
1419 void App_TCBInitHook (OS_TCB *ptcb);
1420 
1421 #if OS_TIME_TICK_HOOK_EN > 0u
1422 void App_TimeTickHook (void);
1423 #endif
1424 #endif
1425 
1426 /*
1427 *********************************************************************************************************
1428 * FUNCTION PROTOTYPES
1429 *
1430 * IMPORTANT: These prototypes MUST be placed in OS_CPU.H
1431 *********************************************************************************************************
1432 */
1433 
1434 #if 0
1435 void OSStartHighRdy (void);
1436 void OSIntCtxSw (void);
1437 void OSCtxSw (void);
1438 #endif
1439 
1440 /*$PAGE*/
1441 /*
1442 *********************************************************************************************************
1443 * LOOK FOR MISSING #define CONSTANTS
1444 *
1445 * This section is used to generate ERROR messages at compile time if certain #define constants are
1446 * MISSING in OS_CFG.H. This allows you to quickly determine the source of the error.
1447 *
1448 * You SHOULD NOT change this section UNLESS you would like to add more comments as to the source of the
1449 * compile time error.
1450 *********************************************************************************************************
1451 */
1452 
1453 /*
1454 *********************************************************************************************************
1455 * EVENT FLAGS
1456 *********************************************************************************************************
1457 */
1458 
1459 #ifndef OS_FLAG_EN
1460 #error "OS_CFG.H, Missing OS_FLAG_EN: Enable (1) or Disable (0) code generation for Event Flags"
1461 #else
1462  #ifndef OS_MAX_FLAGS
1463  #error "OS_CFG.H, Missing OS_MAX_FLAGS: Max. number of Event Flag Groups in your application"
1464  #else
1465  #if OS_MAX_FLAGS > 65500u
1466  #error "OS_CFG.H, OS_MAX_FLAGS must be <= 65500"
1467  #endif
1468  #endif
1469 
1470  #ifndef OS_FLAGS_NBITS
1471  #error "OS_CFG.H, Missing OS_FLAGS_NBITS: Determine #bits used for event flags, MUST be either 8, 16 or 32"
1472  #endif
1473 
1474  #ifndef OS_FLAG_WAIT_CLR_EN
1475  #error "OS_CFG.H, Missing OS_FLAG_WAIT_CLR_EN: Include code for Wait on Clear EVENT FLAGS"
1476  #endif
1477 
1478  #ifndef OS_FLAG_ACCEPT_EN
1479  #error "OS_CFG.H, Missing OS_FLAG_ACCEPT_EN: Include code for OSFlagAccept()"
1480  #endif
1481 
1482  #ifndef OS_FLAG_DEL_EN
1483  #error "OS_CFG.H, Missing OS_FLAG_DEL_EN: Include code for OSFlagDel()"
1484  #endif
1485 
1486  #ifndef OS_FLAG_NAME_EN
1487  #error "OS_CFG.H, Missing OS_FLAG_NAME_EN: Enable flag group names"
1488  #endif
1489 
1490  #ifndef OS_FLAG_QUERY_EN
1491  #error "OS_CFG.H, Missing OS_FLAG_QUERY_EN: Include code for OSFlagQuery()"
1492  #endif
1493 #endif
1494 
1495 /*
1496 *********************************************************************************************************
1497 * MESSAGE MAILBOXES
1498 *********************************************************************************************************
1499 */
1500 
1501 #ifndef OS_MBOX_EN
1502 #error "OS_CFG.H, Missing OS_MBOX_EN: Enable (1) or Disable (0) code generation for MAILBOXES"
1503 #else
1504  #ifndef OS_MBOX_ACCEPT_EN
1505  #error "OS_CFG.H, Missing OS_MBOX_ACCEPT_EN: Include code for OSMboxAccept()"
1506  #endif
1507 
1508  #ifndef OS_MBOX_DEL_EN
1509  #error "OS_CFG.H, Missing OS_MBOX_DEL_EN: Include code for OSMboxDel()"
1510  #endif
1511 
1512  #ifndef OS_MBOX_PEND_ABORT_EN
1513  #error "OS_CFG.H, Missing OS_MBOX_PEND_ABORT_EN: Include code for OSMboxPendAbort()"
1514  #endif
1515 
1516  #ifndef OS_MBOX_POST_EN
1517  #error "OS_CFG.H, Missing OS_MBOX_POST_EN: Include code for OSMboxPost()"
1518  #endif
1519 
1520  #ifndef OS_MBOX_POST_OPT_EN
1521  #error "OS_CFG.H, Missing OS_MBOX_POST_OPT_EN: Include code for OSMboxPostOpt()"
1522  #endif
1523 
1524  #ifndef OS_MBOX_QUERY_EN
1525  #error "OS_CFG.H, Missing OS_MBOX_QUERY_EN: Include code for OSMboxQuery()"
1526  #endif
1527 #endif
1528 
1529 /*
1530 *********************************************************************************************************
1531 * MEMORY MANAGEMENT
1532 *********************************************************************************************************
1533 */
1534 
1535 #ifndef OS_MEM_EN
1536 #error "OS_CFG.H, Missing OS_MEM_EN: Enable (1) or Disable (0) code generation for MEMORY MANAGER"
1537 #else
1538  #ifndef OS_MAX_MEM_PART
1539  #error "OS_CFG.H, Missing OS_MAX_MEM_PART: Max. number of memory partitions"
1540  #else
1541  #if OS_MAX_MEM_PART > 65500u
1542  #error "OS_CFG.H, OS_MAX_MEM_PART must be <= 65500"
1543  #endif
1544  #endif
1545 
1546  #ifndef OS_MEM_NAME_EN
1547  #error "OS_CFG.H, Missing OS_MEM_NAME_EN: Enable memory partition names"
1548  #endif
1549 
1550  #ifndef OS_MEM_QUERY_EN
1551  #error "OS_CFG.H, Missing OS_MEM_QUERY_EN: Include code for OSMemQuery()"
1552  #endif
1553 #endif
1554 
1555 /*
1556 *********************************************************************************************************
1557 * MUTUAL EXCLUSION SEMAPHORES
1558 *********************************************************************************************************
1559 */
1560 
1561 #ifndef OS_MUTEX_EN
1562 #error "OS_CFG.H, Missing OS_MUTEX_EN: Enable (1) or Disable (0) code generation for MUTEX"
1563 #else
1564  #ifndef OS_MUTEX_ACCEPT_EN
1565  #error "OS_CFG.H, Missing OS_MUTEX_ACCEPT_EN: Include code for OSMutexAccept()"
1566  #endif
1567 
1568  #ifndef OS_MUTEX_DEL_EN
1569  #error "OS_CFG.H, Missing OS_MUTEX_DEL_EN: Include code for OSMutexDel()"
1570  #endif
1571 
1572  #ifndef OS_MUTEX_QUERY_EN
1573  #error "OS_CFG.H, Missing OS_MUTEX_QUERY_EN: Include code for OSMutexQuery()"
1574  #endif
1575 #endif
1576 
1577 /*
1578 *********************************************************************************************************
1579 * MESSAGE QUEUES
1580 *********************************************************************************************************
1581 */
1582 
1583 #ifndef OS_Q_EN
1584 #error "OS_CFG.H, Missing OS_Q_EN: Enable (1) or Disable (0) code generation for QUEUES"
1585 #else
1586  #ifndef OS_MAX_QS
1587  #error "OS_CFG.H, Missing OS_MAX_QS: Max. number of queue control blocks"
1588  #else
1589  #if OS_MAX_QS > 65500u
1590  #error "OS_CFG.H, OS_MAX_QS must be <= 65500"
1591  #endif
1592  #endif
1593 
1594  #ifndef OS_Q_ACCEPT_EN
1595  #error "OS_CFG.H, Missing OS_Q_ACCEPT_EN: Include code for OSQAccept()"
1596  #endif
1597 
1598  #ifndef OS_Q_DEL_EN
1599  #error "OS_CFG.H, Missing OS_Q_DEL_EN: Include code for OSQDel()"
1600  #endif
1601 
1602  #ifndef OS_Q_FLUSH_EN
1603  #error "OS_CFG.H, Missing OS_Q_FLUSH_EN: Include code for OSQFlush()"
1604  #endif
1605 
1606  #ifndef OS_Q_PEND_ABORT_EN
1607  #error "OS_CFG.H, Missing OS_Q_PEND_ABORT_EN: Include code for OSQPendAbort()"
1608  #endif
1609 
1610  #ifndef OS_Q_POST_EN
1611  #error "OS_CFG.H, Missing OS_Q_POST_EN: Include code for OSQPost()"
1612  #endif
1613 
1614  #ifndef OS_Q_POST_FRONT_EN
1615  #error "OS_CFG.H, Missing OS_Q_POST_FRONT_EN: Include code for OSQPostFront()"
1616  #endif
1617 
1618  #ifndef OS_Q_POST_OPT_EN
1619  #error "OS_CFG.H, Missing OS_Q_POST_OPT_EN: Include code for OSQPostOpt()"
1620  #endif
1621 
1622  #ifndef OS_Q_QUERY_EN
1623  #error "OS_CFG.H, Missing OS_Q_QUERY_EN: Include code for OSQQuery()"
1624  #endif
1625 #endif
1626 
1627 /*
1628 *********************************************************************************************************
1629 * SEMAPHORES
1630 *********************************************************************************************************
1631 */
1632 
1633 #ifndef OS_SEM_EN
1634 #error "OS_CFG.H, Missing OS_SEM_EN: Enable (1) or Disable (0) code generation for SEMAPHORES"
1635 #else
1636  #ifndef OS_SEM_ACCEPT_EN
1637  #error "OS_CFG.H, Missing OS_SEM_ACCEPT_EN: Include code for OSSemAccept()"
1638  #endif
1639 
1640  #ifndef OS_SEM_DEL_EN
1641  #error "OS_CFG.H, Missing OS_SEM_DEL_EN: Include code for OSSemDel()"
1642  #endif
1643 
1644  #ifndef OS_SEM_PEND_ABORT_EN
1645  #error "OS_CFG.H, Missing OS_SEM_PEND_ABORT_EN: Include code for OSSemPendAbort()"
1646  #endif
1647 
1648  #ifndef OS_SEM_QUERY_EN
1649  #error "OS_CFG.H, Missing OS_SEM_QUERY_EN: Include code for OSSemQuery()"
1650  #endif
1651 
1652  #ifndef OS_SEM_SET_EN
1653  #error "OS_CFG.H, Missing OS_SEM_SET_EN: Include code for OSSemSet()"
1654  #endif
1655 #endif
1656 
1657 /*
1658 *********************************************************************************************************
1659 * TASK MANAGEMENT
1660 *********************************************************************************************************
1661 */
1662 
1663 #ifndef OS_MAX_TASKS
1664 #error "OS_CFG.H, Missing OS_MAX_TASKS: Max. number of tasks in your application"
1665 #else
1666  #if OS_MAX_TASKS < 2u
1667  #error "OS_CFG.H, OS_MAX_TASKS must be >= 2"
1668  #endif
1669 
1670  #if OS_MAX_TASKS > ((OS_LOWEST_PRIO - OS_N_SYS_TASKS) + 1)
1671  #error "OS_CFG.H, OS_MAX_TASKS must be <= OS_LOWEST_PRIO - OS_N_SYS_TASKS + 1"
1672  #endif
1673 
1674 #endif
1675 
1676 #if OS_LOWEST_PRIO > 254u
1677 #error "OS_CFG.H, OS_LOWEST_PRIO must be <= 254 in V2.8x and higher"
1678 #endif
1679 
1680 #ifndef OS_TASK_IDLE_STK_SIZE
1681 #error "OS_CFG.H, Missing OS_TASK_IDLE_STK_SIZE: Idle task stack size"
1682 #endif
1683 
1684 #ifndef OS_TASK_STAT_EN
1685 #error "OS_CFG.H, Missing OS_TASK_STAT_EN: Enable (1) or Disable(0) the statistics task"
1686 #endif
1687 
1688 #ifndef OS_TASK_STAT_STK_SIZE
1689 #error "OS_CFG.H, Missing OS_TASK_STAT_STK_SIZE: Statistics task stack size"
1690 #endif
1691 
1692 #ifndef OS_TASK_STAT_STK_CHK_EN
1693 #error "OS_CFG.H, Missing OS_TASK_STAT_STK_CHK_EN: Check task stacks from statistics task"
1694 #endif
1695 
1696 #ifndef OS_TASK_CHANGE_PRIO_EN
1697 #error "OS_CFG.H, Missing OS_TASK_CHANGE_PRIO_EN: Include code for OSTaskChangePrio()"
1698 #endif
1699 
1700 #ifndef OS_TASK_CREATE_EN
1701 #error "OS_CFG.H, Missing OS_TASK_CREATE_EN: Include code for OSTaskCreate()"
1702 #endif
1703 
1704 #ifndef OS_TASK_CREATE_EXT_EN
1705 #error "OS_CFG.H, Missing OS_TASK_CREATE_EXT_EN: Include code for OSTaskCreateExt()"
1706 #endif
1707 
1708 #ifndef OS_TASK_DEL_EN
1709 #error "OS_CFG.H, Missing OS_TASK_DEL_EN: Include code for OSTaskDel()"
1710 #endif
1711 
1712 #ifndef OS_TASK_NAME_EN
1713 #error "OS_CFG.H, Missing OS_TASK_NAME_EN: Enable task names"
1714 #endif
1715 
1716 #ifndef OS_TASK_SUSPEND_EN
1717 #error "OS_CFG.H, Missing OS_TASK_SUSPEND_EN: Include code for OSTaskSuspend() and OSTaskResume()"
1718 #endif
1719 
1720 #ifndef OS_TASK_QUERY_EN
1721 #error "OS_CFG.H, Missing OS_TASK_QUERY_EN: Include code for OSTaskQuery()"
1722 #endif
1723 
1724 #ifndef OS_TASK_REG_TBL_SIZE
1725 #error "OS_CFG.H, Missing OS_TASK_REG_TBL_SIZE: Include code for task specific registers"
1726 #else
1727  #if OS_TASK_REG_TBL_SIZE > 255u
1728  #error "OS_CFG.H, OS_TASK_REG_TBL_SIZE must be <= 255"
1729  #endif
1730 #endif
1731 
1732 /*
1733 *********************************************************************************************************
1734 * TIME MANAGEMENT
1735 *********************************************************************************************************
1736 */
1737 
1738 #ifndef OS_TICKS_PER_SEC
1739 #error "OS_CFG.H, Missing OS_TICKS_PER_SEC: Sets the number of ticks in one second"
1740 #endif
1741 
1742 #ifndef OS_TIME_DLY_HMSM_EN
1743 #error "OS_CFG.H, Missing OS_TIME_DLY_HMSM_EN: Include code for OSTimeDlyHMSM()"
1744 #endif
1745 
1746 #ifndef OS_TIME_DLY_RESUME_EN
1747 #error "OS_CFG.H, Missing OS_TIME_DLY_RESUME_EN: Include code for OSTimeDlyResume()"
1748 #endif
1749 
1750 #ifndef OS_TIME_GET_SET_EN
1751 #error "OS_CFG.H, Missing OS_TIME_GET_SET_EN: Include code for OSTimeGet() and OSTimeSet()"
1752 #endif
1753 
1754 /*
1755 *********************************************************************************************************
1756 * TIMER MANAGEMENT
1757 *********************************************************************************************************
1758 */
1759 
1760 #ifndef OS_TMR_EN
1761 #error "OS_CFG.H, Missing OS_TMR_EN: When (1) enables code generation for Timer Management"
1762 #elif OS_TMR_EN > 0u
1763  #if OS_SEM_EN == 0u
1764  #error "OS_CFG.H, Semaphore management is required (set OS_SEM_EN to 1) when enabling Timer Management."
1765  #error " Timer management require TWO semaphores."
1766  #endif
1767 
1768  #ifndef OS_TMR_CFG_MAX
1769  #error "OS_CFG.H, Missing OS_TMR_CFG_MAX: Determines the total number of timers in an application (2 .. 65500)"
1770  #else
1771  #if OS_TMR_CFG_MAX < 2u
1772  #error "OS_CFG.H, OS_TMR_CFG_MAX should be between 2 and 65500"
1773  #endif
1774 
1775  #if OS_TMR_CFG_MAX > 65500u
1776  #error "OS_CFG.H, OS_TMR_CFG_MAX should be between 2 and 65500"
1777  #endif
1778  #endif
1779 
1780  #ifndef OS_TMR_CFG_WHEEL_SIZE
1781  #error "OS_CFG.H, Missing OS_TMR_CFG_WHEEL_SIZE: Sets the size of the timer wheel (1 .. 1023)"
1782  #else
1783  #if OS_TMR_CFG_WHEEL_SIZE < 2u
1784  #error "OS_CFG.H, OS_TMR_CFG_WHEEL_SIZE should be between 2 and 1024"
1785  #endif
1786 
1787  #if OS_TMR_CFG_WHEEL_SIZE > 1024u
1788  #error "OS_CFG.H, OS_TMR_CFG_WHEEL_SIZE should be between 2 and 1024"
1789  #endif
1790  #endif
1791 
1792  #ifndef OS_TMR_CFG_NAME_EN
1793  #error "OS_CFG.H, Missing OS_TMR_CFG_NAME_EN: Enable Timer names"
1794  #endif
1795 
1796  #ifndef OS_TMR_CFG_TICKS_PER_SEC
1797  #error "OS_CFG.H, Missing OS_TMR_CFG_TICKS_PER_SEC: Determines the rate at which tiem timer management task will run (Hz)"
1798  #endif
1799 
1800  #ifndef OS_TASK_TMR_STK_SIZE
1801  #error "OS_CFG.H, Missing OS_TASK_TMR_STK_SIZE: Determines the size of the Timer Task's stack"
1802  #endif
1803 #endif
1804 
1805 
1806 /*
1807 *********************************************************************************************************
1808 * MISCELLANEOUS
1809 *********************************************************************************************************
1810 */
1811 
1812 #ifndef OS_ARG_CHK_EN
1813 #error "OS_CFG.H, Missing OS_ARG_CHK_EN: Enable (1) or Disable (0) argument checking"
1814 #endif
1815 
1816 
1817 #ifndef OS_CPU_HOOKS_EN
1818 #error "OS_CFG.H, Missing OS_CPU_HOOKS_EN: uC/OS-II hooks are found in the processor port files when 1"
1819 #endif
1820 
1821 
1822 #ifndef OS_APP_HOOKS_EN
1823 #error "OS_CFG.H, Missing OS_APP_HOOKS_EN: Application-defined hooks are called from the uC/OS-II hooks"
1824 #endif
1825 
1826 
1827 #ifndef OS_DEBUG_EN
1828 #error "OS_CFG.H, Missing OS_DEBUG_EN: Allows you to include variables for debugging or not"
1829 #endif
1830 
1831 
1832 #ifndef OS_LOWEST_PRIO
1833 #error "OS_CFG.H, Missing OS_LOWEST_PRIO: Defines the lowest priority that can be assigned"
1834 #endif
1835 
1836 
1837 #ifndef OS_MAX_EVENTS
1838 #error "OS_CFG.H, Missing OS_MAX_EVENTS: Max. number of event control blocks in your application"
1839 #else
1840  #if OS_MAX_EVENTS > 65500u
1841  #error "OS_CFG.H, OS_MAX_EVENTS must be <= 65500"
1842  #endif
1843 #endif
1844 
1845 
1846 #ifndef OS_SCHED_LOCK_EN
1847 #error "OS_CFG.H, Missing OS_SCHED_LOCK_EN: Include code for OSSchedLock() and OSSchedUnlock()"
1848 #endif
1849 
1850 
1851 #ifndef OS_EVENT_MULTI_EN
1852 #error "OS_CFG.H, Missing OS_EVENT_MULTI_EN: Include code for OSEventPendMulti()"
1853 #endif
1854 
1855 
1856 #ifndef OS_TASK_PROFILE_EN
1857 #error "OS_CFG.H, Missing OS_TASK_PROFILE_EN: Include data structure for run-time task profiling"
1858 #endif
1859 
1860 
1861 #ifndef OS_TASK_SW_HOOK_EN
1862 #error "OS_CFG.H, Missing OS_TASK_SW_HOOK_EN: Allows you to include the code for OSTaskSwHook() or not"
1863 #endif
1864 
1865 
1866 #ifndef OS_TICK_STEP_EN
1867 #error "OS_CFG.H, Missing OS_TICK_STEP_EN: Allows to 'step' one tick at a time with uC/OS-View"
1868 #endif
1869 
1870 
1871 #ifndef OS_TIME_TICK_HOOK_EN
1872 #error "OS_CFG.H, Missing OS_TIME_TICK_HOOK_EN: Allows you to include the code for OSTimeTickHook() or not"
1873 #endif
1874 
1875 /*
1876 *********************************************************************************************************
1877 * SAFETY CRITICAL USE
1878 *********************************************************************************************************
1879 */
1880 
1881 #ifdef SAFETY_CRITICAL_RELEASE
1882 
1883 #if OS_ARG_CHK_EN < 1u
1884 #error "OS_CFG.H, OS_ARG_CHK_EN must be enabled for safety-critical release code"
1885 #endif
1886 
1887 #if OS_APP_HOOKS_EN > 0u
1888 #error "OS_CFG.H, OS_APP_HOOKS_EN must be disabled for safety-critical release code"
1889 #endif
1890 
1891 #if OS_DEBUG_EN > 0u
1892 #error "OS_CFG.H, OS_DEBUG_EN must be disabled for safety-critical release code"
1893 #endif
1894 
1895 #ifdef CANTATA
1896 #error "OS_CFG.H, CANTATA must be disabled for safety-critical release code"
1897 #endif
1898 
1899 #ifdef OS_SCHED_LOCK_EN
1900 #error "OS_CFG.H, OS_SCHED_LOCK_EN must be disabled for safety-critical release code"
1901 #endif
1902 
1903 #ifdef VSC_VALIDATION_MODE
1904 #error "OS_CFG.H, VSC_VALIDATION_MODE must be disabled for safety-critical release code"
1905 #endif
1906 
1907 #if OS_TASK_STAT_EN > 0u
1908 #error "OS_CFG.H, OS_TASK_STAT_EN must be disabled for safety-critical release code"
1909 #endif
1910 
1911 #if OS_TICK_STEP_EN > 0u
1912 #error "OS_CFG.H, OS_TICK_STEP_EN must be disabled for safety-critical release code"
1913 #endif
1914 
1915 #if OS_FLAG_EN > 0u
1916  #if OS_FLAG_DEL_EN > 0
1917  #error "OS_CFG.H, OS_FLAG_DEL_EN must be disabled for safety-critical release code"
1918  #endif
1919 #endif
1920 
1921 #if OS_MBOX_EN > 0u
1922  #if OS_MBOX_DEL_EN > 0u
1923  #error "OS_CFG.H, OS_MBOX_DEL_EN must be disabled for safety-critical release code"
1924  #endif
1925 #endif
1926 
1927 #if OS_MUTEX_EN > 0u
1928  #if OS_MUTEX_DEL_EN > 0u
1929  #error "OS_CFG.H, OS_MUTEX_DEL_EN must be disabled for safety-critical release code"
1930  #endif
1931 #endif
1932 
1933 #if OS_Q_EN > 0u
1934  #if OS_Q_DEL_EN > 0u
1935  #error "OS_CFG.H, OS_Q_DEL_EN must be disabled for safety-critical release code"
1936  #endif
1937 #endif
1938 
1939 #if OS_SEM_EN > 0u
1940  #if OS_SEM_DEL_EN > 0u
1941  #error "OS_CFG.H, OS_SEM_DEL_EN must be disabled for safety-critical release code"
1942  #endif
1943 #endif
1944 
1945 #if OS_TASK_EN > 0u
1946  #if OS_TASK_DEL_EN > 0u
1947  #error "OS_CFG.H, OS_TASK_DEL_EN must be disabled for safety-critical release code"
1948  #endif
1949 #endif
1950 
1951 #if OS_CRITICAL_METHOD != 3u
1952 #error "OS_CPU.H, OS_CRITICAL_METHOD must be type 3 for safety-critical release code"
1953 #endif
1954 
1955 #endif /* ------------------------ SAFETY_CRITICAL_RELEASE ------------------------ */
1956 
1957 #ifdef __cplusplus
1958 }
1959 #endif
1960 
1961 #endif