source: svn/trunk/newcon3bcm2_21bu/dta/src/ucos_ii/ucos_ii.h

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

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