OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [ucos-ii/] [2.91/] [include/] [ucos_ii.h] - Blame information for rev 585

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 471 julius
/*
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.91
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
27
extern "C" {
28
#endif
29
 
30
/*
31
*********************************************************************************************************
32
*                                          uC/OS-II VERSION NUMBER
33
*********************************************************************************************************
34
*/
35
 
36
#define  OS_VERSION                 291u                /* 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 > 0u
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 - 1u)       /* Statistic task priority                     */
79
#define  OS_TASK_IDLE_PRIO  (OS_LOWEST_PRIO)            /* IDLE      task priority                     */
80
 
81
#if OS_LOWEST_PRIO <= 63u
82
#define  OS_EVENT_TBL_SIZE ((OS_LOWEST_PRIO) / 8u + 1u) /* Size of event table                         */
83
#define  OS_RDY_TBL_SIZE   ((OS_LOWEST_PRIO) / 8u + 1u) /* Size of ready table                         */
84
#else
85
#define  OS_EVENT_TBL_SIZE ((OS_LOWEST_PRIO) / 16u + 1u)/* Size of event table                         */
86
#define  OS_RDY_TBL_SIZE   ((OS_LOWEST_PRIO) / 16u + 1u)/* 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 > 0u) && (OS_MAX_QS > 0u)) || (OS_MBOX_EN > 0u) || (OS_SEM_EN > 0u) || (OS_MUTEX_EN > 0u))
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 > 0u
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_ID_INVALID               8u
254
#define OS_ERR_PDATA_NULL               9u
255
 
256
#define OS_ERR_TIMEOUT                 10u
257
#define OS_ERR_EVENT_NAME_TOO_LONG     11u
258
#define OS_ERR_PNAME_NULL              12u
259
#define OS_ERR_PEND_LOCKED             13u
260
#define OS_ERR_PEND_ABORT              14u
261
#define OS_ERR_DEL_ISR                 15u
262
#define OS_ERR_CREATE_ISR              16u
263
#define OS_ERR_NAME_GET_ISR            17u
264
#define OS_ERR_NAME_SET_ISR            18u
265
#define OS_ERR_ILLEGAL_CREATE_RUN_TIME 19u
266
 
267
#define OS_ERR_MBOX_FULL               20u
268
 
269
#define OS_ERR_Q_FULL                  30u
270
#define OS_ERR_Q_EMPTY                 31u
271
 
272
#define OS_ERR_PRIO_EXIST              40u
273
#define OS_ERR_PRIO                    41u
274
#define OS_ERR_PRIO_INVALID            42u
275
 
276
#define OS_ERR_SCHED_LOCKED            50u
277
#define OS_ERR_SEM_OVF                 51u
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
/*$PAGE*/
339
/*
340
*********************************************************************************************************
341
*                                          EVENT CONTROL BLOCK
342
*********************************************************************************************************
343
*/
344
 
345
#if OS_LOWEST_PRIO <= 63u
346
typedef  INT8U    OS_PRIO;
347
#else
348
typedef  INT16U   OS_PRIO;
349
#endif
350
 
351
#if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u)
352
typedef struct os_event {
353
    INT8U    OSEventType;                    /* Type of event control block (see OS_EVENT_TYPE_xxxx)    */
354
    void    *OSEventPtr;                     /* Pointer to message or queue structure                   */
355
    INT16U   OSEventCnt;                     /* Semaphore Count (not used if other EVENT type)          */
356
    OS_PRIO  OSEventGrp;                     /* Group corresponding to tasks waiting for event to occur */
357
    OS_PRIO  OSEventTbl[OS_EVENT_TBL_SIZE];  /* List of tasks waiting for event to occur                */
358
 
359
#if OS_EVENT_NAME_EN > 0u
360
    INT8U   *OSEventName;
361
#endif
362
} OS_EVENT;
363
#endif
364
 
365
 
366
/*
367
*********************************************************************************************************
368
*                                       EVENT FLAGS CONTROL BLOCK
369
*********************************************************************************************************
370
*/
371
 
372
#if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
373
 
374
#if OS_FLAGS_NBITS == 8u                    /* Determine the size of OS_FLAGS (8, 16 or 32 bits)       */
375
typedef  INT8U    OS_FLAGS;
376
#endif
377
 
378
#if OS_FLAGS_NBITS == 16u
379
typedef  INT16U   OS_FLAGS;
380
#endif
381
 
382
#if OS_FLAGS_NBITS == 32u
383
typedef  INT32U   OS_FLAGS;
384
#endif
385
 
386
 
387
typedef struct os_flag_grp {                /* Event Flag Group                                        */
388
    INT8U         OSFlagType;               /* Should be set to OS_EVENT_TYPE_FLAG                     */
389
    void         *OSFlagWaitList;           /* Pointer to first NODE of task waiting on event flag     */
390
    OS_FLAGS      OSFlagFlags;              /* 8, 16 or 32 bit flags                                   */
391
#if OS_FLAG_NAME_EN > 0u
392
    INT8U        *OSFlagName;
393
#endif
394
} OS_FLAG_GRP;
395
 
396
 
397
 
398
typedef struct os_flag_node {               /* Event Flag Wait List Node                               */
399
    void         *OSFlagNodeNext;           /* Pointer to next     NODE in wait list                   */
400
    void         *OSFlagNodePrev;           /* Pointer to previous NODE in wait list                   */
401
    void         *OSFlagNodeTCB;            /* Pointer to TCB of waiting task                          */
402
    void         *OSFlagNodeFlagGrp;        /* Pointer to Event Flag Group                             */
403
    OS_FLAGS      OSFlagNodeFlags;          /* Event flag to wait on                                   */
404
    INT8U         OSFlagNodeWaitType;       /* Type of wait:                                           */
405
                                            /*      OS_FLAG_WAIT_AND                                   */
406
                                            /*      OS_FLAG_WAIT_ALL                                   */
407
                                            /*      OS_FLAG_WAIT_OR                                    */
408
                                            /*      OS_FLAG_WAIT_ANY                                   */
409
} OS_FLAG_NODE;
410
#endif
411
 
412
/*$PAGE*/
413
/*
414
*********************************************************************************************************
415
*                                          MESSAGE MAILBOX DATA
416
*********************************************************************************************************
417
*/
418
 
419
#if OS_MBOX_EN > 0u
420
typedef struct os_mbox_data {
421
    void   *OSMsg;                         /* Pointer to message in mailbox                            */
422
    OS_PRIO OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur                 */
423
    OS_PRIO OSEventGrp;                    /* Group corresponding to tasks waiting for event to occur  */
424
} OS_MBOX_DATA;
425
#endif
426
 
427
/*
428
*********************************************************************************************************
429
*                                     MEMORY PARTITION DATA STRUCTURES
430
*********************************************************************************************************
431
*/
432
 
433
#if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
434
typedef struct os_mem {                   /* MEMORY CONTROL BLOCK                                      */
435
    void   *OSMemAddr;                    /* Pointer to beginning of memory partition                  */
436
    void   *OSMemFreeList;                /* Pointer to list of free memory blocks                     */
437
    INT32U  OSMemBlkSize;                 /* Size (in bytes) of each block of memory                   */
438
    INT32U  OSMemNBlks;                   /* Total number of blocks in this partition                  */
439
    INT32U  OSMemNFree;                   /* Number of memory blocks remaining in this partition       */
440
#if OS_MEM_NAME_EN > 0u
441
    INT8U  *OSMemName;                    /* Memory partition name                                     */
442
#endif
443
} OS_MEM;
444
 
445
 
446
typedef struct os_mem_data {
447
    void   *OSAddr;                    /* Pointer to the beginning address of the memory partition     */
448
    void   *OSFreeList;                /* Pointer to the beginning of the free list of memory blocks   */
449
    INT32U  OSBlkSize;                 /* Size (in bytes) of each memory block                         */
450
    INT32U  OSNBlks;                   /* Total number of blocks in the partition                      */
451
    INT32U  OSNFree;                   /* Number of memory blocks free                                 */
452
    INT32U  OSNUsed;                   /* Number of memory blocks used                                 */
453
} OS_MEM_DATA;
454
#endif
455
 
456
/*$PAGE*/
457
/*
458
*********************************************************************************************************
459
*                                    MUTUAL EXCLUSION SEMAPHORE DATA
460
*********************************************************************************************************
461
*/
462
 
463
#if OS_MUTEX_EN > 0u
464
typedef struct os_mutex_data {
465
    OS_PRIO OSEventTbl[OS_EVENT_TBL_SIZE];  /* List of tasks waiting for event to occur                */
466
    OS_PRIO OSEventGrp;                     /* Group corresponding to tasks waiting for event to occur */
467
    BOOLEAN OSValue;                        /* Mutex value (OS_FALSE = used, OS_TRUE = available)      */
468
    INT8U   OSOwnerPrio;                    /* Mutex owner's task priority or 0xFF if no owner         */
469
    INT8U   OSMutexPIP;                     /* Priority Inheritance Priority or 0xFF if no owner       */
470
} OS_MUTEX_DATA;
471
#endif
472
 
473
/*
474
*********************************************************************************************************
475
*                                          MESSAGE QUEUE DATA
476
*********************************************************************************************************
477
*/
478
 
479
#if OS_Q_EN > 0u
480
typedef struct os_q {                   /* QUEUE CONTROL BLOCK                                         */
481
    struct os_q   *OSQPtr;              /* Link to next queue control block in list of free blocks     */
482
    void         **OSQStart;            /* Pointer to start of queue data                              */
483
    void         **OSQEnd;              /* Pointer to end   of queue data                              */
484
    void         **OSQIn;               /* Pointer to where next message will be inserted  in   the Q  */
485
    void         **OSQOut;              /* Pointer to where next message will be extracted from the Q  */
486
    INT16U         OSQSize;             /* Size of queue (maximum number of entries)                   */
487
    INT16U         OSQEntries;          /* Current number of entries in the queue                      */
488
} OS_Q;
489
 
490
 
491
typedef struct os_q_data {
492
    void          *OSMsg;               /* Pointer to next message to be extracted from queue          */
493
    INT16U         OSNMsgs;             /* Number of messages in message queue                         */
494
    INT16U         OSQSize;             /* Size of message queue                                       */
495
    OS_PRIO        OSEventTbl[OS_EVENT_TBL_SIZE];  /* List of tasks waiting for event to occur         */
496
    OS_PRIO        OSEventGrp;          /* Group corresponding to tasks waiting for event to occur     */
497
} OS_Q_DATA;
498
#endif
499
 
500
/*
501
*********************************************************************************************************
502
*                                           SEMAPHORE DATA
503
*********************************************************************************************************
504
*/
505
 
506
#if OS_SEM_EN > 0u
507
typedef struct os_sem_data {
508
    INT16U  OSCnt;                          /* Semaphore count                                         */
509
    OS_PRIO OSEventTbl[OS_EVENT_TBL_SIZE];  /* List of tasks waiting for event to occur                */
510
    OS_PRIO OSEventGrp;                     /* Group corresponding to tasks waiting for event to occur */
511
} OS_SEM_DATA;
512
#endif
513
 
514
/*
515
*********************************************************************************************************
516
*                                            TASK STACK DATA
517
*********************************************************************************************************
518
*/
519
 
520
#if OS_TASK_CREATE_EXT_EN > 0u
521
typedef struct os_stk_data {
522
    INT32U  OSFree;                    /* Number of free bytes on the stack                            */
523
    INT32U  OSUsed;                    /* Number of bytes used on the stack                            */
524
} OS_STK_DATA;
525
#endif
526
 
527
/*$PAGE*/
528
/*
529
*********************************************************************************************************
530
*                                          TASK CONTROL BLOCK
531
*********************************************************************************************************
532
*/
533
 
534
typedef struct os_tcb {
535
    OS_STK          *OSTCBStkPtr;           /* Pointer to current top of stack                         */
536
 
537
#if OS_TASK_CREATE_EXT_EN > 0u
538
    void            *OSTCBExtPtr;           /* Pointer to user definable data for TCB extension        */
539
    OS_STK          *OSTCBStkBottom;        /* Pointer to bottom of stack                              */
540
    INT32U           OSTCBStkSize;          /* Size of task stack (in number of stack elements)        */
541
    INT16U           OSTCBOpt;              /* Task options as passed by OSTaskCreateExt()             */
542
    INT16U           OSTCBId;               /* Task ID (0..65535)                                      */
543
#endif
544
 
545
    struct os_tcb   *OSTCBNext;             /* Pointer to next     TCB in the TCB list                 */
546
    struct os_tcb   *OSTCBPrev;             /* Pointer to previous TCB in the TCB list                 */
547
 
548
#if (OS_EVENT_EN)
549
    OS_EVENT        *OSTCBEventPtr;         /* Pointer to          event control block                 */
550
#endif
551
 
552
#if (OS_EVENT_EN) && (OS_EVENT_MULTI_EN > 0u)
553
    OS_EVENT       **OSTCBEventMultiPtr;    /* Pointer to multiple event control blocks                */
554
#endif
555
 
556
#if ((OS_Q_EN > 0u) && (OS_MAX_QS > 0u)) || (OS_MBOX_EN > 0u)
557
    void            *OSTCBMsg;              /* Message received from OSMboxPost() or OSQPost()         */
558
#endif
559
 
560
#if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
561
#if OS_TASK_DEL_EN > 0u
562
    OS_FLAG_NODE    *OSTCBFlagNode;         /* Pointer to event flag node                              */
563
#endif
564
    OS_FLAGS         OSTCBFlagsRdy;         /* Event flags that made task ready to run                 */
565
#endif
566
 
567
    INT32U           OSTCBDly;              /* Nbr ticks to delay task or, timeout waiting for event   */
568
    INT8U            OSTCBStat;             /* Task      status                                        */
569
    INT8U            OSTCBStatPend;         /* Task PEND status                                        */
570
    INT8U            OSTCBPrio;             /* Task priority (0 == highest)                            */
571
 
572
    INT8U            OSTCBX;                /* Bit position in group  corresponding to task priority   */
573
    INT8U            OSTCBY;                /* Index into ready table corresponding to task priority   */
574
    OS_PRIO          OSTCBBitX;             /* Bit mask to access bit position in ready table          */
575
    OS_PRIO          OSTCBBitY;             /* Bit mask to access bit position in ready group          */
576
 
577
#if OS_TASK_DEL_EN > 0u
578
    INT8U            OSTCBDelReq;           /* Indicates whether a task needs to delete itself         */
579
#endif
580
 
581
#if OS_TASK_PROFILE_EN > 0u
582
    INT32U           OSTCBCtxSwCtr;         /* Number of time the task was switched in                 */
583
    INT32U           OSTCBCyclesTot;        /* Total number of clock cycles the task has been running  */
584
    INT32U           OSTCBCyclesStart;      /* Snapshot of cycle counter at start of task resumption   */
585
    OS_STK          *OSTCBStkBase;          /* Pointer to the beginning of the task stack              */
586
    INT32U           OSTCBStkUsed;          /* Number of bytes used from the stack                     */
587
#endif
588
 
589
#if OS_TASK_NAME_EN > 0u
590
    INT8U           *OSTCBTaskName;
591
#endif
592
 
593
#if OS_TASK_REG_TBL_SIZE > 0u
594
    INT32U           OSTCBRegTbl[OS_TASK_REG_TBL_SIZE];
595
#endif
596
} OS_TCB;
597
 
598
/*$PAGE*/
599
/*
600
************************************************************************************************************************
601
*                                                   TIMER DATA TYPES
602
************************************************************************************************************************
603
*/
604
 
605
#if OS_TMR_EN > 0u
606
typedef  void (*OS_TMR_CALLBACK)(void *ptmr, void *parg);
607
 
608
 
609
 
610
typedef  struct  os_tmr {
611
    INT8U            OSTmrType;                       /* Should be set to OS_TMR_TYPE                                  */
612
    OS_TMR_CALLBACK  OSTmrCallback;                   /* Function to call when timer expires                           */
613
    void            *OSTmrCallbackArg;                /* Argument to pass to function when timer expires               */
614
    void            *OSTmrNext;                       /* Double link list pointers                                     */
615
    void            *OSTmrPrev;
616
    INT32U           OSTmrMatch;                      /* Timer expires when OSTmrTime == OSTmrMatch                    */
617
    INT32U           OSTmrDly;                        /* Delay time before periodic update starts                      */
618
    INT32U           OSTmrPeriod;                     /* Period to repeat timer                                        */
619
#if OS_TMR_CFG_NAME_EN > 0u
620
    INT8U           *OSTmrName;                       /* Name to give the timer                                        */
621
#endif
622
    INT8U            OSTmrOpt;                        /* Options (see OS_TMR_OPT_xxx)                                  */
623
    INT8U            OSTmrState;                      /* Indicates the state of the timer:                             */
624
                                                      /*     OS_TMR_STATE_UNUSED                                       */
625
                                                      /*     OS_TMR_STATE_RUNNING                                      */
626
                                                      /*     OS_TMR_STATE_STOPPED                                      */
627
} OS_TMR;
628
 
629
 
630
 
631
typedef  struct  os_tmr_wheel {
632
    OS_TMR          *OSTmrFirst;                      /* Pointer to first timer in linked list                         */
633
    INT16U           OSTmrEntries;
634
} OS_TMR_WHEEL;
635
#endif
636
 
637
/*$PAGE*/
638
/*
639
*********************************************************************************************************
640
*                                            GLOBAL VARIABLES
641
*********************************************************************************************************
642
*/
643
 
644
OS_EXT  INT32U            OSCtxSwCtr;               /* Counter of number of context switches           */
645
 
646
#if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u)
647
OS_EXT  OS_EVENT         *OSEventFreeList;          /* Pointer to list of free EVENT control blocks    */
648
OS_EXT  OS_EVENT          OSEventTbl[OS_MAX_EVENTS];/* Table of EVENT control blocks                   */
649
#endif
650
 
651
#if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
652
OS_EXT  OS_FLAG_GRP       OSFlagTbl[OS_MAX_FLAGS];  /* Table containing event flag groups              */
653
OS_EXT  OS_FLAG_GRP      *OSFlagFreeList;           /* Pointer to free list of event flag groups       */
654
#endif
655
 
656
#if OS_TASK_STAT_EN > 0u
657
OS_EXT  INT8U             OSCPUUsage;               /* Percentage of CPU used                          */
658
OS_EXT  INT32U            OSIdleCtrMax;             /* Max. value that idle ctr can take in 1 sec.     */
659
OS_EXT  INT32U            OSIdleCtrRun;             /* Val. reached by idle ctr at run time in 1 sec.  */
660
OS_EXT  BOOLEAN           OSStatRdy;                /* Flag indicating that the statistic task is rdy  */
661
OS_EXT  OS_STK            OSTaskStatStk[OS_TASK_STAT_STK_SIZE];      /* Statistics task stack          */
662
#endif
663
 
664
OS_EXT  INT8U             OSIntNesting;             /* Interrupt nesting level                         */
665
 
666
OS_EXT  INT8U             OSLockNesting;            /* Multitasking lock nesting level                 */
667
 
668
OS_EXT  INT8U             OSPrioCur;                /* Priority of current task                        */
669
OS_EXT  INT8U             OSPrioHighRdy;            /* Priority of highest priority task               */
670
 
671
OS_EXT  OS_PRIO           OSRdyGrp;                        /* Ready list group                         */
672
OS_EXT  OS_PRIO           OSRdyTbl[OS_RDY_TBL_SIZE];       /* Table of tasks which are ready to run    */
673
 
674
OS_EXT  BOOLEAN           OSRunning;                       /* Flag indicating that kernel is running   */
675
 
676
OS_EXT  INT8U             OSTaskCtr;                       /* Number of tasks created                  */
677
 
678
OS_EXT  volatile  INT32U  OSIdleCtr;                                 /* Idle counter                   */
679
 
680
#ifdef OS_SAFETY_CRITICAL_IEC61508
681
OS_EXT  BOOLEAN           OSSafetyCriticalStartFlag;
682
#endif
683
 
684
OS_EXT  OS_STK            OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE];      /* Idle task stack                */
685
 
686
 
687
OS_EXT  OS_TCB           *OSTCBCur;                        /* Pointer to currently running TCB         */
688
OS_EXT  OS_TCB           *OSTCBFreeList;                   /* Pointer to list of free TCBs             */
689
OS_EXT  OS_TCB           *OSTCBHighRdy;                    /* Pointer to highest priority TCB R-to-R   */
690
OS_EXT  OS_TCB           *OSTCBList;                       /* Pointer to doubly linked list of TCBs    */
691
OS_EXT  OS_TCB           *OSTCBPrioTbl[OS_LOWEST_PRIO + 1u];    /* Table of pointers to created TCBs   */
692
OS_EXT  OS_TCB            OSTCBTbl[OS_MAX_TASKS + OS_N_SYS_TASKS];   /* Table of TCBs                  */
693
 
694
#if OS_TICK_STEP_EN > 0u
695
OS_EXT  INT8U             OSTickStepState;          /* Indicates the state of the tick step feature    */
696
#endif
697
 
698
#if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
699
OS_EXT  OS_MEM           *OSMemFreeList;            /* Pointer to free list of memory partitions       */
700
OS_EXT  OS_MEM            OSMemTbl[OS_MAX_MEM_PART];/* Storage for memory partition manager            */
701
#endif
702
 
703
#if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u)
704
OS_EXT  OS_Q             *OSQFreeList;              /* Pointer to list of free QUEUE control blocks    */
705
OS_EXT  OS_Q              OSQTbl[OS_MAX_QS];        /* Table of QUEUE control blocks                   */
706
#endif
707
 
708
#if OS_TIME_GET_SET_EN > 0u
709
OS_EXT  volatile  INT32U  OSTime;                   /* Current value of system time (in ticks)         */
710
#endif
711
 
712
#if OS_TMR_EN > 0u
713
OS_EXT  INT16U            OSTmrFree;                /* Number of free entries in the timer pool        */
714
OS_EXT  INT16U            OSTmrUsed;                /* Number of timers used                           */
715
OS_EXT  INT32U            OSTmrTime;                /* Current timer time                              */
716
 
717
OS_EXT  OS_EVENT         *OSTmrSem;                 /* Sem. used to gain exclusive access to timers    */
718
OS_EXT  OS_EVENT         *OSTmrSemSignal;           /* Sem. used to signal the update of timers        */
719
 
720
OS_EXT  OS_TMR            OSTmrTbl[OS_TMR_CFG_MAX]; /* Table containing pool of timers                 */
721
OS_EXT  OS_TMR           *OSTmrFreeList;            /* Pointer to free list of timers                  */
722
OS_EXT  OS_STK            OSTmrTaskStk[OS_TASK_TMR_STK_SIZE];
723
 
724
OS_EXT  OS_TMR_WHEEL      OSTmrWheelTbl[OS_TMR_CFG_WHEEL_SIZE];
725
#endif
726
 
727
extern  INT8U   const     OSUnMapTbl[256];          /* Priority->Index    lookup table                 */
728
 
729
 #if OS_VERSION >= 204
730
 void          OSInitHookBegin(void);
731
 void          OSInitHookEnd(void);
732
 #endif
733
 
734
 void          OSIntCtxSw(void);
735
 
736
 void          OSStartHighRdy(void);
737
 
738
 void          OSTaskCreateHook(OS_TCB *ptcb);
739
 void          OSTaskDelHook(OS_TCB *ptcb);
740
 
741
 #if OS_VERSION >= 251
742
 void          OSTaskIdleHook(void);
743
 #endif
744
 
745
 void          OSTaskStatHook(void);
746
 OS_STK       *OSTaskStkInit(void (*task)(void *pd), void *pdata, OS_STK *ptos, INT16U opt);
747
 void          OSTaskSwHook(void);
748
 
749
 #if OS_VERSION >= 204
750
 void          OSTCBInitHook(OS_TCB *ptcb);
751
 #endif
752
 
753
 void          OSTimeTickHook(void);
754
 
755
 /*
756
 *********************************************************************************************************
757
 *                                          FUNCTION PROTOTYPES
758
 *                                  (Compiler Specific ISR prototypes)
759
 *********************************************************************************************************
760
 */
761
 #ifndef OS_ISR_PROTO_EXT
762
 void          OSCtxSw(void);
763
 void          OSTickISR(void);
764
 #endif
765
 
766
/*
767
*********************************************************************************************************
768
*                                            MISCELLANEOUS
769
*********************************************************************************************************
770
*/
771
 
772
#if (OS_EVENT_EN)
773
 
774
#if (OS_EVENT_NAME_EN > 0u)
775
INT8U         OSEventNameGet          (OS_EVENT        *pevent,
776
                                       INT8U          **pname,
777
                                       INT8U           *perr);
778
 
779
void          OSEventNameSet          (OS_EVENT        *pevent,
780
                                       INT8U           *pname,
781
                                       INT8U           *perr);
782
#endif
783
 
784
#if (OS_EVENT_MULTI_EN > 0u)
785
INT16U        OSEventPendMulti        (OS_EVENT       **pevents_pend,
786
                                       OS_EVENT       **pevents_rdy,
787
                                       void           **pmsgs_rdy,
788
                                       INT32U           timeout,
789
                                       INT8U           *perr);
790
#endif
791
 
792
#endif
793
 
794
/*
795
*********************************************************************************************************
796
*                                         EVENT FLAGS MANAGEMENT
797
*********************************************************************************************************
798
*/
799
 
800
#if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
801
 
802
#if OS_FLAG_ACCEPT_EN > 0u
803
OS_FLAGS      OSFlagAccept            (OS_FLAG_GRP     *pgrp,
804
                                       OS_FLAGS         flags,
805
                                       INT8U            wait_type,
806
                                       INT8U           *perr);
807
#endif
808
 
809
OS_FLAG_GRP  *OSFlagCreate            (OS_FLAGS         flags,
810
                                       INT8U           *perr);
811
 
812
#if OS_FLAG_DEL_EN > 0u
813
OS_FLAG_GRP  *OSFlagDel               (OS_FLAG_GRP     *pgrp,
814
                                       INT8U            opt,
815
                                       INT8U           *perr);
816
#endif
817
 
818
#if (OS_FLAG_EN > 0u) && (OS_FLAG_NAME_EN > 0u)
819
INT8U         OSFlagNameGet           (OS_FLAG_GRP     *pgrp,
820
                                       INT8U          **pname,
821
                                       INT8U           *perr);
822
 
823
void          OSFlagNameSet           (OS_FLAG_GRP     *pgrp,
824
                                       INT8U           *pname,
825
                                       INT8U           *perr);
826
#endif
827
 
828
OS_FLAGS      OSFlagPend              (OS_FLAG_GRP     *pgrp,
829
                                       OS_FLAGS         flags,
830
                                       INT8U            wait_type,
831
                                       INT32U           timeout,
832
                                       INT8U           *perr);
833
 
834
OS_FLAGS      OSFlagPendGetFlagsRdy   (void);
835
OS_FLAGS      OSFlagPost              (OS_FLAG_GRP     *pgrp,
836
                                       OS_FLAGS         flags,
837
                                       INT8U            opt,
838
                                       INT8U           *perr);
839
 
840
#if OS_FLAG_QUERY_EN > 0u
841
OS_FLAGS      OSFlagQuery             (OS_FLAG_GRP     *pgrp,
842
                                       INT8U           *perr);
843
#endif
844
#endif
845
 
846
/*
847
*********************************************************************************************************
848
*                                        MESSAGE MAILBOX MANAGEMENT
849
*********************************************************************************************************
850
*/
851
 
852
#if OS_MBOX_EN > 0u
853
 
854
#if OS_MBOX_ACCEPT_EN > 0u
855
void         *OSMboxAccept            (OS_EVENT        *pevent);
856
#endif
857
 
858
OS_EVENT     *OSMboxCreate            (void            *pmsg);
859
 
860
#if OS_MBOX_DEL_EN > 0u
861
OS_EVENT     *OSMboxDel               (OS_EVENT        *pevent,
862
                                       INT8U            opt,
863
                                       INT8U           *perr);
864
#endif
865
 
866
void         *OSMboxPend              (OS_EVENT        *pevent,
867
                                       INT32U           timeout,
868
                                       INT8U           *perr);
869
 
870
#if OS_MBOX_PEND_ABORT_EN > 0u
871
INT8U         OSMboxPendAbort         (OS_EVENT        *pevent,
872
                                       INT8U            opt,
873
                                       INT8U           *perr);
874
#endif
875
 
876
#if OS_MBOX_POST_EN > 0u
877
INT8U         OSMboxPost              (OS_EVENT        *pevent,
878
                                       void            *pmsg);
879
#endif
880
 
881
#if OS_MBOX_POST_OPT_EN > 0u
882
INT8U         OSMboxPostOpt           (OS_EVENT        *pevent,
883
                                       void            *pmsg,
884
                                       INT8U            opt);
885
#endif
886
 
887
#if OS_MBOX_QUERY_EN > 0u
888
INT8U         OSMboxQuery             (OS_EVENT        *pevent,
889
                                       OS_MBOX_DATA    *p_mbox_data);
890
#endif
891
#endif
892
 
893
/*
894
*********************************************************************************************************
895
*                                           MEMORY MANAGEMENT
896
*********************************************************************************************************
897
*/
898
 
899
#if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
900
 
901
OS_MEM       *OSMemCreate             (void            *addr,
902
                                       INT32U           nblks,
903
                                       INT32U           blksize,
904
                                       INT8U           *perr);
905
 
906
void         *OSMemGet                (OS_MEM          *pmem,
907
                                       INT8U           *perr);
908
#if OS_MEM_NAME_EN > 0u
909
INT8U         OSMemNameGet            (OS_MEM          *pmem,
910
                                       INT8U          **pname,
911
                                       INT8U           *perr);
912
 
913
void          OSMemNameSet            (OS_MEM          *pmem,
914
                                       INT8U           *pname,
915
                                       INT8U           *perr);
916
#endif
917
INT8U         OSMemPut                (OS_MEM          *pmem,
918
                                       void            *pblk);
919
 
920
#if OS_MEM_QUERY_EN > 0u
921
INT8U         OSMemQuery              (OS_MEM          *pmem,
922
                                       OS_MEM_DATA     *p_mem_data);
923
#endif
924
 
925
#endif
926
 
927
/*
928
*********************************************************************************************************
929
*                                MUTUAL EXCLUSION SEMAPHORE MANAGEMENT
930
*********************************************************************************************************
931
*/
932
 
933
#if OS_MUTEX_EN > 0u
934
 
935
#if OS_MUTEX_ACCEPT_EN > 0u
936
BOOLEAN       OSMutexAccept           (OS_EVENT        *pevent,
937
                                       INT8U           *perr);
938
#endif
939
 
940
OS_EVENT     *OSMutexCreate           (INT8U            prio,
941
                                       INT8U           *perr);
942
 
943
#if OS_MUTEX_DEL_EN > 0u
944
OS_EVENT     *OSMutexDel              (OS_EVENT        *pevent,
945
                                       INT8U            opt,
946
                                       INT8U           *perr);
947
#endif
948
 
949
void          OSMutexPend             (OS_EVENT        *pevent,
950
                                       INT32U           timeout,
951
                                       INT8U           *perr);
952
 
953
INT8U         OSMutexPost             (OS_EVENT        *pevent);
954
 
955
#if OS_MUTEX_QUERY_EN > 0u
956
INT8U         OSMutexQuery            (OS_EVENT        *pevent,
957
                                       OS_MUTEX_DATA   *p_mutex_data);
958
#endif
959
 
960
#endif
961
 
962
/*$PAGE*/
963
/*
964
*********************************************************************************************************
965
*                                         MESSAGE QUEUE MANAGEMENT
966
*********************************************************************************************************
967
*/
968
 
969
#if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u)
970
 
971
#if OS_Q_ACCEPT_EN > 0u
972
void         *OSQAccept               (OS_EVENT        *pevent,
973
                                       INT8U           *perr);
974
#endif
975
 
976
OS_EVENT     *OSQCreate               (void           **start,
977
                                       INT16U           size);
978
 
979
#if OS_Q_DEL_EN > 0u
980
OS_EVENT     *OSQDel                  (OS_EVENT        *pevent,
981
                                       INT8U            opt,
982
                                       INT8U           *perr);
983
#endif
984
 
985
#if OS_Q_FLUSH_EN > 0u
986
INT8U         OSQFlush                (OS_EVENT        *pevent);
987
#endif
988
 
989
void         *OSQPend                 (OS_EVENT        *pevent,
990
                                       INT32U           timeout,
991
                                       INT8U           *perr);
992
 
993
#if OS_Q_PEND_ABORT_EN > 0u
994
INT8U         OSQPendAbort            (OS_EVENT        *pevent,
995
                                       INT8U            opt,
996
                                       INT8U           *perr);
997
#endif
998
 
999
#if OS_Q_POST_EN > 0u
1000
INT8U         OSQPost                 (OS_EVENT        *pevent,
1001
                                       void            *pmsg);
1002
#endif
1003
 
1004
#if OS_Q_POST_FRONT_EN > 0u
1005
INT8U         OSQPostFront            (OS_EVENT        *pevent,
1006
                                       void            *pmsg);
1007
#endif
1008
 
1009
#if OS_Q_POST_OPT_EN > 0u
1010
INT8U         OSQPostOpt              (OS_EVENT        *pevent,
1011
                                       void            *pmsg,
1012
                                       INT8U            opt);
1013
#endif
1014
 
1015
#if OS_Q_QUERY_EN > 0u
1016
INT8U         OSQQuery                (OS_EVENT        *pevent,
1017
                                       OS_Q_DATA       *p_q_data);
1018
#endif
1019
 
1020
#endif
1021
 
1022
/*$PAGE*/
1023
/*
1024
*********************************************************************************************************
1025
*                                          SEMAPHORE MANAGEMENT
1026
*********************************************************************************************************
1027
*/
1028
#if OS_SEM_EN > 0u
1029
 
1030
#if OS_SEM_ACCEPT_EN > 0u
1031
INT16U        OSSemAccept             (OS_EVENT        *pevent);
1032
#endif
1033
 
1034
OS_EVENT     *OSSemCreate             (INT16U           cnt);
1035
 
1036
#if OS_SEM_DEL_EN > 0u
1037
OS_EVENT     *OSSemDel                (OS_EVENT        *pevent,
1038
                                       INT8U            opt,
1039
                                       INT8U           *perr);
1040
#endif
1041
 
1042
void          OSSemPend               (OS_EVENT        *pevent,
1043
                                       INT32U           timeout,
1044
                                       INT8U           *perr);
1045
 
1046
#if OS_SEM_PEND_ABORT_EN > 0u
1047
INT8U         OSSemPendAbort          (OS_EVENT        *pevent,
1048
                                       INT8U            opt,
1049
                                       INT8U           *perr);
1050
#endif
1051
 
1052
INT8U         OSSemPost               (OS_EVENT        *pevent);
1053
 
1054
#if OS_SEM_QUERY_EN > 0u
1055
INT8U         OSSemQuery              (OS_EVENT        *pevent,
1056
                                       OS_SEM_DATA     *p_sem_data);
1057
#endif
1058
 
1059
#if OS_SEM_SET_EN > 0u
1060
void          OSSemSet                (OS_EVENT        *pevent,
1061
                                       INT16U           cnt,
1062
                                       INT8U           *perr);
1063
#endif
1064
 
1065
#endif
1066
 
1067
/*$PAGE*/
1068
/*
1069
*********************************************************************************************************
1070
*                                            TASK MANAGEMENT
1071
*********************************************************************************************************
1072
*/
1073
#if OS_TASK_CHANGE_PRIO_EN > 0u
1074
INT8U         OSTaskChangePrio        (INT8U            oldprio,
1075
                                       INT8U            newprio);
1076
#endif
1077
 
1078
#if OS_TASK_CREATE_EN > 0u
1079
INT8U         OSTaskCreate            (void           (*task)(void *p_arg),
1080
                                       void            *p_arg,
1081
                                       OS_STK          *ptos,
1082
                                       INT8U            prio);
1083
#endif
1084
 
1085
#if OS_TASK_CREATE_EXT_EN > 0u
1086
INT8U         OSTaskCreateExt         (void           (*task)(void *p_arg),
1087
                                       void            *p_arg,
1088
                                       OS_STK          *ptos,
1089
                                       INT8U            prio,
1090
                                       INT16U           id,
1091
                                       OS_STK          *pbos,
1092
                                       INT32U           stk_size,
1093
                                       void            *pext,
1094
                                       INT16U           opt);
1095
#endif
1096
 
1097
#if OS_TASK_DEL_EN > 0u
1098
INT8U         OSTaskDel               (INT8U            prio);
1099
INT8U         OSTaskDelReq            (INT8U            prio);
1100
#endif
1101
 
1102
#if OS_TASK_NAME_EN > 0u
1103
INT8U         OSTaskNameGet           (INT8U            prio,
1104
                                       INT8U          **pname,
1105
                                       INT8U           *perr);
1106
 
1107
void          OSTaskNameSet           (INT8U            prio,
1108
                                       INT8U           *pname,
1109
                                       INT8U           *perr);
1110
#endif
1111
 
1112
#if OS_TASK_SUSPEND_EN > 0u
1113
INT8U         OSTaskResume            (INT8U            prio);
1114
INT8U         OSTaskSuspend           (INT8U            prio);
1115
#endif
1116
 
1117
#if (OS_TASK_STAT_STK_CHK_EN > 0u) && (OS_TASK_CREATE_EXT_EN > 0u)
1118
INT8U         OSTaskStkChk            (INT8U            prio,
1119
                                       OS_STK_DATA     *p_stk_data);
1120
#endif
1121
 
1122
#if OS_TASK_QUERY_EN > 0u
1123
INT8U         OSTaskQuery             (INT8U            prio,
1124
                                       OS_TCB          *p_task_data);
1125
#endif
1126
 
1127
 
1128
 
1129
#if OS_TASK_REG_TBL_SIZE > 0u
1130
INT32U        OSTaskRegGet            (INT8U            prio,
1131
                                       INT8U            id,
1132
                                       INT8U           *perr);
1133
 
1134
void          OSTaskRegSet            (INT8U            prio,
1135
                                       INT8U            id,
1136
                                       INT32U           value,
1137
                                       INT8U           *perr);
1138
#endif
1139
 
1140
/*$PAGE*/
1141
/*
1142
*********************************************************************************************************
1143
*                                            TIME MANAGEMENT
1144
*********************************************************************************************************
1145
*/
1146
 
1147
void          OSTimeDly               (INT32U           ticks);
1148
 
1149
#if OS_TIME_DLY_HMSM_EN > 0u
1150
INT8U         OSTimeDlyHMSM           (INT8U            hours,
1151
                                       INT8U            minutes,
1152
                                       INT8U            seconds,
1153
                                       INT16U           ms);
1154
#endif
1155
 
1156
#if OS_TIME_DLY_RESUME_EN > 0u
1157
INT8U         OSTimeDlyResume         (INT8U            prio);
1158
#endif
1159
 
1160
#if OS_TIME_GET_SET_EN > 0u
1161
INT32U        OSTimeGet               (void);
1162
void          OSTimeSet               (INT32U           ticks);
1163
#endif
1164
 
1165
void          OSTimeTick              (void);
1166
 
1167
/*
1168
*********************************************************************************************************
1169
*                                            TIMER MANAGEMENT
1170
*********************************************************************************************************
1171
*/
1172
 
1173
#if OS_TMR_EN > 0u
1174
OS_TMR      *OSTmrCreate              (INT32U           dly,
1175
                                       INT32U           period,
1176
                                       INT8U            opt,
1177
                                       OS_TMR_CALLBACK  callback,
1178
                                       void            *callback_arg,
1179
                                       INT8U           *pname,
1180
                                       INT8U           *perr);
1181
 
1182
BOOLEAN      OSTmrDel                 (OS_TMR          *ptmr,
1183
                                       INT8U           *perr);
1184
 
1185
#if OS_TMR_CFG_NAME_EN > 0u
1186
INT8U        OSTmrNameGet             (OS_TMR          *ptmr,
1187
                                       INT8U          **pdest,
1188
                                       INT8U           *perr);
1189
#endif
1190
INT32U       OSTmrRemainGet           (OS_TMR          *ptmr,
1191
                                       INT8U           *perr);
1192
 
1193
INT8U        OSTmrStateGet            (OS_TMR          *ptmr,
1194
                                       INT8U           *perr);
1195
 
1196
BOOLEAN      OSTmrStart               (OS_TMR          *ptmr,
1197
                                       INT8U           *perr);
1198
 
1199
BOOLEAN      OSTmrStop                (OS_TMR          *ptmr,
1200
                                       INT8U            opt,
1201
                                       void            *callback_arg,
1202
                                       INT8U           *perr);
1203
 
1204
INT8U        OSTmrSignal              (void);
1205
#endif
1206
 
1207
/*
1208
*********************************************************************************************************
1209
*                                             MISCELLANEOUS
1210
*********************************************************************************************************
1211
*/
1212
 
1213
void          OSInit                  (void);
1214
 
1215
void          OSIntEnter              (void);
1216
void          OSIntExit               (void);
1217
 
1218
#ifdef OS_SAFETY_CRITICAL_IEC61508
1219
void          OSSafetyCriticalStart   (void);
1220
#endif
1221
 
1222
#if OS_SCHED_LOCK_EN > 0u
1223
void          OSSchedLock             (void);
1224
void          OSSchedUnlock           (void);
1225
#endif
1226
 
1227
void          OSStart                 (void);
1228
 
1229
void          OSStatInit              (void);
1230
 
1231
INT16U        OSVersion               (void);
1232
 
1233
/*$PAGE*/
1234
/*
1235
*********************************************************************************************************
1236
*                                      INTERNAL FUNCTION PROTOTYPES
1237
*                            (Your application MUST NOT call these functions)
1238
*********************************************************************************************************
1239
*/
1240
 
1241
#if OS_TASK_DEL_EN > 0u
1242
void          OS_Dummy                (void);
1243
#endif
1244
 
1245
#if (OS_EVENT_EN)
1246
INT8U         OS_EventTaskRdy         (OS_EVENT        *pevent,
1247
                                       void            *pmsg,
1248
                                       INT8U            msk,
1249
                                       INT8U            pend_stat);
1250
 
1251
void          OS_EventTaskWait        (OS_EVENT        *pevent);
1252
 
1253
void          OS_EventTaskRemove      (OS_TCB          *ptcb,
1254
                                       OS_EVENT        *pevent);
1255
 
1256
#if (OS_EVENT_MULTI_EN > 0u)
1257
void          OS_EventTaskWaitMulti   (OS_EVENT       **pevents_wait);
1258
 
1259
void          OS_EventTaskRemoveMulti (OS_TCB          *ptcb,
1260
                                       OS_EVENT       **pevents_multi);
1261
#endif
1262
 
1263
void          OS_EventWaitListInit    (OS_EVENT        *pevent);
1264
#endif
1265
 
1266
#if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
1267
void          OS_FlagInit             (void);
1268
void          OS_FlagUnlink           (OS_FLAG_NODE    *pnode);
1269
#endif
1270
 
1271
void          OS_MemClr               (INT8U           *pdest,
1272
                                       INT16U           size);
1273
 
1274
void          OS_MemCopy              (INT8U           *pdest,
1275
                                       INT8U           *psrc,
1276
                                       INT16U           size);
1277
 
1278
#if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
1279
void          OS_MemInit              (void);
1280
#endif
1281
 
1282
#if OS_Q_EN > 0u
1283
void          OS_QInit                (void);
1284
#endif
1285
 
1286
void          OS_Sched                (void);
1287
 
1288
#if (OS_EVENT_NAME_EN > 0u) || (OS_FLAG_NAME_EN > 0u) || (OS_MEM_NAME_EN > 0u) || (OS_TASK_NAME_EN > 0u)
1289
INT8U         OS_StrLen               (INT8U           *psrc);
1290
#endif
1291
 
1292
void          OS_TaskIdle             (void            *p_arg);
1293
 
1294
void          OS_TaskReturn           (void);
1295
 
1296
#if OS_TASK_STAT_EN > 0u
1297
void          OS_TaskStat             (void            *p_arg);
1298
#endif
1299
 
1300
#if (OS_TASK_STAT_STK_CHK_EN > 0u) && (OS_TASK_CREATE_EXT_EN > 0u)
1301
void          OS_TaskStkClr           (OS_STK          *pbos,
1302
                                       INT32U           size,
1303
                                       INT16U           opt);
1304
#endif
1305
 
1306
#if (OS_TASK_STAT_STK_CHK_EN > 0u) && (OS_TASK_CREATE_EXT_EN > 0u)
1307
void          OS_TaskStatStkChk       (void);
1308
#endif
1309
 
1310
INT8U         OS_TCBInit              (INT8U            prio,
1311
                                       OS_STK          *ptos,
1312
                                       OS_STK          *pbos,
1313
                                       INT16U           id,
1314
                                       INT32U           stk_size,
1315
                                       void            *pext,
1316
                                       INT16U           opt);
1317
 
1318
#if OS_TMR_EN > 0u
1319
void          OSTmr_Init              (void);
1320
#endif
1321
 
1322
/*$PAGE*/
1323
/*
1324
*********************************************************************************************************
1325
*                                          FUNCTION PROTOTYPES
1326
*                                      (Target Specific Functions)
1327
*********************************************************************************************************
1328
*/
1329
 
1330
#if OS_DEBUG_EN > 0u
1331
void          OSDebugInit             (void);
1332
#endif
1333
 
1334
void          OSInitHookBegin         (void);
1335
void          OSInitHookEnd           (void);
1336
 
1337
void          OSTaskCreateHook        (OS_TCB          *ptcb);
1338
void          OSTaskDelHook           (OS_TCB          *ptcb);
1339
 
1340
void          OSTaskIdleHook          (void);
1341
 
1342
void          OSTaskReturnHook        (OS_TCB          *ptcb);
1343
 
1344
void          OSTaskStatHook          (void);
1345
OS_STK       *OSTaskStkInit           (void           (*task)(void *p_arg),
1346
                                       void            *p_arg,
1347
                                       OS_STK          *ptos,
1348
                                       INT16U           opt);
1349
 
1350
#if OS_TASK_SW_HOOK_EN > 0u
1351
void          OSTaskSwHook            (void);
1352
#endif
1353
 
1354
void          OSTCBInitHook           (OS_TCB          *ptcb);
1355
 
1356
#if OS_TIME_TICK_HOOK_EN > 0u
1357
void          OSTimeTickHook          (void);
1358
#endif
1359
 
1360
/*$PAGE*/
1361
/*
1362
*********************************************************************************************************
1363
*                                          FUNCTION PROTOTYPES
1364
*                                   (Application Specific Functions)
1365
*********************************************************************************************************
1366
*/
1367
 
1368
#if OS_APP_HOOKS_EN > 0u
1369
void          App_TaskCreateHook      (OS_TCB          *ptcb);
1370
void          App_TaskDelHook         (OS_TCB          *ptcb);
1371
void          App_TaskIdleHook        (void);
1372
 
1373
void          App_TaskReturnHook      (OS_TCB          *ptcb);
1374
 
1375
void          App_TaskStatHook        (void);
1376
 
1377
#if OS_TASK_SW_HOOK_EN > 0u
1378
void          App_TaskSwHook          (void);
1379
#endif
1380
 
1381
void          App_TCBInitHook         (OS_TCB          *ptcb);
1382
 
1383
#if OS_TIME_TICK_HOOK_EN > 0u
1384
void          App_TimeTickHook        (void);
1385
#endif
1386
#endif
1387
 
1388
/*
1389
*********************************************************************************************************
1390
*                                          FUNCTION PROTOTYPES
1391
*
1392
* IMPORTANT: These prototypes MUST be placed in OS_CPU.H
1393
*********************************************************************************************************
1394
*/
1395
 
1396
#if 0
1397
void          OSStartHighRdy          (void);
1398
void          OSIntCtxSw              (void);
1399
void          OSCtxSw                 (void);
1400
#endif
1401
 
1402
/*$PAGE*/
1403
/*
1404
*********************************************************************************************************
1405
*                                   LOOK FOR MISSING #define CONSTANTS
1406
*
1407
* This section is used to generate ERROR messages at compile time if certain #define constants are
1408
* MISSING in OS_CFG.H.  This allows you to quickly determine the source of the error.
1409
*
1410
* You SHOULD NOT change this section UNLESS you would like to add more comments as to the source of the
1411
* compile time error.
1412
*********************************************************************************************************
1413
*/
1414
 
1415
/*
1416
*********************************************************************************************************
1417
*                                            EVENT FLAGS
1418
*********************************************************************************************************
1419
*/
1420
 
1421
#ifndef OS_FLAG_EN
1422
#error  "OS_CFG.H, Missing OS_FLAG_EN: Enable (1) or Disable (0) code generation for Event Flags"
1423
#else
1424
    #ifndef OS_MAX_FLAGS
1425
    #error  "OS_CFG.H, Missing OS_MAX_FLAGS: Max. number of Event Flag Groups in your application"
1426
    #else
1427
        #if     OS_MAX_FLAGS > 65500u
1428
        #error  "OS_CFG.H, OS_MAX_FLAGS must be <= 65500"
1429
        #endif
1430
    #endif
1431
 
1432
    #ifndef OS_FLAGS_NBITS
1433
    #error  "OS_CFG.H, Missing OS_FLAGS_NBITS: Determine #bits used for event flags, MUST be either 8, 16 or 32"
1434
    #endif
1435
 
1436
    #ifndef OS_FLAG_WAIT_CLR_EN
1437
    #error  "OS_CFG.H, Missing OS_FLAG_WAIT_CLR_EN: Include code for Wait on Clear EVENT FLAGS"
1438
    #endif
1439
 
1440
    #ifndef OS_FLAG_ACCEPT_EN
1441
    #error  "OS_CFG.H, Missing OS_FLAG_ACCEPT_EN: Include code for OSFlagAccept()"
1442
    #endif
1443
 
1444
    #ifndef OS_FLAG_DEL_EN
1445
    #error  "OS_CFG.H, Missing OS_FLAG_DEL_EN: Include code for OSFlagDel()"
1446
    #endif
1447
 
1448
    #ifndef OS_FLAG_NAME_EN
1449
    #error  "OS_CFG.H, Missing OS_FLAG_NAME_EN: Enable flag group names"
1450
    #endif
1451
 
1452
    #ifndef OS_FLAG_QUERY_EN
1453
    #error  "OS_CFG.H, Missing OS_FLAG_QUERY_EN: Include code for OSFlagQuery()"
1454
    #endif
1455
#endif
1456
 
1457
/*
1458
*********************************************************************************************************
1459
*                                           MESSAGE MAILBOXES
1460
*********************************************************************************************************
1461
*/
1462
 
1463
#ifndef OS_MBOX_EN
1464
#error  "OS_CFG.H, Missing OS_MBOX_EN: Enable (1) or Disable (0) code generation for MAILBOXES"
1465
#else
1466
    #ifndef OS_MBOX_ACCEPT_EN
1467
    #error  "OS_CFG.H, Missing OS_MBOX_ACCEPT_EN: Include code for OSMboxAccept()"
1468
    #endif
1469
 
1470
    #ifndef OS_MBOX_DEL_EN
1471
    #error  "OS_CFG.H, Missing OS_MBOX_DEL_EN: Include code for OSMboxDel()"
1472
    #endif
1473
 
1474
    #ifndef OS_MBOX_PEND_ABORT_EN
1475
    #error  "OS_CFG.H, Missing OS_MBOX_PEND_ABORT_EN: Include code for OSMboxPendAbort()"
1476
    #endif
1477
 
1478
    #ifndef OS_MBOX_POST_EN
1479
    #error  "OS_CFG.H, Missing OS_MBOX_POST_EN: Include code for OSMboxPost()"
1480
    #endif
1481
 
1482
    #ifndef OS_MBOX_POST_OPT_EN
1483
    #error  "OS_CFG.H, Missing OS_MBOX_POST_OPT_EN: Include code for OSMboxPostOpt()"
1484
    #endif
1485
 
1486
    #ifndef OS_MBOX_QUERY_EN
1487
    #error  "OS_CFG.H, Missing OS_MBOX_QUERY_EN: Include code for OSMboxQuery()"
1488
    #endif
1489
#endif
1490
 
1491
/*
1492
*********************************************************************************************************
1493
*                                           MEMORY MANAGEMENT
1494
*********************************************************************************************************
1495
*/
1496
 
1497
#ifndef OS_MEM_EN
1498
#error  "OS_CFG.H, Missing OS_MEM_EN: Enable (1) or Disable (0) code generation for MEMORY MANAGER"
1499
#else
1500
    #ifndef OS_MAX_MEM_PART
1501
    #error  "OS_CFG.H, Missing OS_MAX_MEM_PART: Max. number of memory partitions"
1502
    #else
1503
        #if     OS_MAX_MEM_PART > 65500u
1504
        #error  "OS_CFG.H, OS_MAX_MEM_PART must be <= 65500"
1505
        #endif
1506
    #endif
1507
 
1508
    #ifndef OS_MEM_NAME_EN
1509
    #error  "OS_CFG.H, Missing OS_MEM_NAME_EN: Enable memory partition names"
1510
    #endif
1511
 
1512
    #ifndef OS_MEM_QUERY_EN
1513
    #error  "OS_CFG.H, Missing OS_MEM_QUERY_EN: Include code for OSMemQuery()"
1514
    #endif
1515
#endif
1516
 
1517
/*
1518
*********************************************************************************************************
1519
*                                       MUTUAL EXCLUSION SEMAPHORES
1520
*********************************************************************************************************
1521
*/
1522
 
1523
#ifndef OS_MUTEX_EN
1524
#error  "OS_CFG.H, Missing OS_MUTEX_EN: Enable (1) or Disable (0) code generation for MUTEX"
1525
#else
1526
    #ifndef OS_MUTEX_ACCEPT_EN
1527
    #error  "OS_CFG.H, Missing OS_MUTEX_ACCEPT_EN: Include code for OSMutexAccept()"
1528
    #endif
1529
 
1530
    #ifndef OS_MUTEX_DEL_EN
1531
    #error  "OS_CFG.H, Missing OS_MUTEX_DEL_EN: Include code for OSMutexDel()"
1532
    #endif
1533
 
1534
    #ifndef OS_MUTEX_QUERY_EN
1535
    #error  "OS_CFG.H, Missing OS_MUTEX_QUERY_EN: Include code for OSMutexQuery()"
1536
    #endif
1537
#endif
1538
 
1539
/*
1540
*********************************************************************************************************
1541
*                                              MESSAGE QUEUES
1542
*********************************************************************************************************
1543
*/
1544
 
1545
#ifndef OS_Q_EN
1546
#error  "OS_CFG.H, Missing OS_Q_EN: Enable (1) or Disable (0) code generation for QUEUES"
1547
#else
1548
    #ifndef OS_MAX_QS
1549
    #error  "OS_CFG.H, Missing OS_MAX_QS: Max. number of queue control blocks"
1550
    #else
1551
        #if     OS_MAX_QS > 65500u
1552
        #error  "OS_CFG.H, OS_MAX_QS must be <= 65500"
1553
        #endif
1554
    #endif
1555
 
1556
    #ifndef OS_Q_ACCEPT_EN
1557
    #error  "OS_CFG.H, Missing OS_Q_ACCEPT_EN: Include code for OSQAccept()"
1558
    #endif
1559
 
1560
    #ifndef OS_Q_DEL_EN
1561
    #error  "OS_CFG.H, Missing OS_Q_DEL_EN: Include code for OSQDel()"
1562
    #endif
1563
 
1564
    #ifndef OS_Q_FLUSH_EN
1565
    #error  "OS_CFG.H, Missing OS_Q_FLUSH_EN: Include code for OSQFlush()"
1566
    #endif
1567
 
1568
    #ifndef OS_Q_PEND_ABORT_EN
1569
    #error  "OS_CFG.H, Missing OS_Q_PEND_ABORT_EN: Include code for OSQPendAbort()"
1570
    #endif
1571
 
1572
    #ifndef OS_Q_POST_EN
1573
    #error  "OS_CFG.H, Missing OS_Q_POST_EN: Include code for OSQPost()"
1574
    #endif
1575
 
1576
    #ifndef OS_Q_POST_FRONT_EN
1577
    #error  "OS_CFG.H, Missing OS_Q_POST_FRONT_EN: Include code for OSQPostFront()"
1578
    #endif
1579
 
1580
    #ifndef OS_Q_POST_OPT_EN
1581
    #error  "OS_CFG.H, Missing OS_Q_POST_OPT_EN: Include code for OSQPostOpt()"
1582
    #endif
1583
 
1584
    #ifndef OS_Q_QUERY_EN
1585
    #error  "OS_CFG.H, Missing OS_Q_QUERY_EN: Include code for OSQQuery()"
1586
    #endif
1587
#endif
1588
 
1589
/*
1590
*********************************************************************************************************
1591
*                                              SEMAPHORES
1592
*********************************************************************************************************
1593
*/
1594
 
1595
#ifndef OS_SEM_EN
1596
#error  "OS_CFG.H, Missing OS_SEM_EN: Enable (1) or Disable (0) code generation for SEMAPHORES"
1597
#else
1598
    #ifndef OS_SEM_ACCEPT_EN
1599
    #error  "OS_CFG.H, Missing OS_SEM_ACCEPT_EN: Include code for OSSemAccept()"
1600
    #endif
1601
 
1602
    #ifndef OS_SEM_DEL_EN
1603
    #error  "OS_CFG.H, Missing OS_SEM_DEL_EN: Include code for OSSemDel()"
1604
    #endif
1605
 
1606
    #ifndef OS_SEM_PEND_ABORT_EN
1607
    #error  "OS_CFG.H, Missing OS_SEM_PEND_ABORT_EN: Include code for OSSemPendAbort()"
1608
    #endif
1609
 
1610
    #ifndef OS_SEM_QUERY_EN
1611
    #error  "OS_CFG.H, Missing OS_SEM_QUERY_EN: Include code for OSSemQuery()"
1612
    #endif
1613
 
1614
    #ifndef OS_SEM_SET_EN
1615
    #error  "OS_CFG.H, Missing OS_SEM_SET_EN: Include code for OSSemSet()"
1616
    #endif
1617
#endif
1618
 
1619
/*
1620
*********************************************************************************************************
1621
*                                             TASK MANAGEMENT
1622
*********************************************************************************************************
1623
*/
1624
 
1625
#ifndef OS_MAX_TASKS
1626
#error  "OS_CFG.H, Missing OS_MAX_TASKS: Max. number of tasks in your application"
1627
#else
1628
    #if     OS_MAX_TASKS < 2u
1629
    #error  "OS_CFG.H,         OS_MAX_TASKS must be >= 2"
1630
    #endif
1631
 
1632
    #if     OS_MAX_TASKS >  ((OS_LOWEST_PRIO - OS_N_SYS_TASKS) + 1u)
1633
    #error  "OS_CFG.H,         OS_MAX_TASKS must be <= OS_LOWEST_PRIO - OS_N_SYS_TASKS + 1"
1634
    #endif
1635
 
1636
#endif
1637
 
1638
#if     OS_LOWEST_PRIO >  254u
1639
#error  "OS_CFG.H,         OS_LOWEST_PRIO must be <= 254 in V2.8x and higher"
1640
#endif
1641
 
1642
#ifndef OS_TASK_IDLE_STK_SIZE
1643
#error  "OS_CFG.H, Missing OS_TASK_IDLE_STK_SIZE: Idle task stack size"
1644
#endif
1645
 
1646
#ifndef OS_TASK_STAT_EN
1647
#error  "OS_CFG.H, Missing OS_TASK_STAT_EN: Enable (1) or Disable(0) the statistics task"
1648
#endif
1649
 
1650
#ifndef OS_TASK_STAT_STK_SIZE
1651
#error  "OS_CFG.H, Missing OS_TASK_STAT_STK_SIZE: Statistics task stack size"
1652
#endif
1653
 
1654
#ifndef OS_TASK_STAT_STK_CHK_EN
1655
#error  "OS_CFG.H, Missing OS_TASK_STAT_STK_CHK_EN: Check task stacks from statistics task"
1656
#endif
1657
 
1658
#ifndef OS_TASK_CHANGE_PRIO_EN
1659
#error  "OS_CFG.H, Missing OS_TASK_CHANGE_PRIO_EN: Include code for OSTaskChangePrio()"
1660
#endif
1661
 
1662
#ifndef OS_TASK_CREATE_EN
1663
#error  "OS_CFG.H, Missing OS_TASK_CREATE_EN: Include code for OSTaskCreate()"
1664
#endif
1665
 
1666
#ifndef OS_TASK_CREATE_EXT_EN
1667
#error  "OS_CFG.H, Missing OS_TASK_CREATE_EXT_EN: Include code for OSTaskCreateExt()"
1668
#endif
1669
 
1670
#ifndef OS_TASK_DEL_EN
1671
#error  "OS_CFG.H, Missing OS_TASK_DEL_EN: Include code for OSTaskDel()"
1672
#endif
1673
 
1674
#ifndef OS_TASK_NAME_EN
1675
#error  "OS_CFG.H, Missing OS_TASK_NAME_EN: Enable task names"
1676
#endif
1677
 
1678
#ifndef OS_TASK_SUSPEND_EN
1679
#error  "OS_CFG.H, Missing OS_TASK_SUSPEND_EN: Include code for OSTaskSuspend() and OSTaskResume()"
1680
#endif
1681
 
1682
#ifndef OS_TASK_QUERY_EN
1683
#error  "OS_CFG.H, Missing OS_TASK_QUERY_EN: Include code for OSTaskQuery()"
1684
#endif
1685
 
1686
#ifndef OS_TASK_REG_TBL_SIZE
1687
#error  "OS_CFG.H, Missing OS_TASK_REG_TBL_SIZE: Include code for task specific registers"
1688
#else
1689
    #if     OS_TASK_REG_TBL_SIZE > 255u
1690
    #error  "OS_CFG.H,         OS_TASK_REG_TBL_SIZE must be <= 255"
1691
    #endif
1692
#endif
1693
 
1694
/*
1695
*********************************************************************************************************
1696
*                                             TIME MANAGEMENT
1697
*********************************************************************************************************
1698
*/
1699
 
1700
#ifndef OS_TICKS_PER_SEC
1701
#error  "OS_CFG.H, Missing OS_TICKS_PER_SEC: Sets the number of ticks in one second"
1702
#endif
1703
 
1704
#ifndef OS_TIME_DLY_HMSM_EN
1705
#error  "OS_CFG.H, Missing OS_TIME_DLY_HMSM_EN: Include code for OSTimeDlyHMSM()"
1706
#endif
1707
 
1708
#ifndef OS_TIME_DLY_RESUME_EN
1709
#error  "OS_CFG.H, Missing OS_TIME_DLY_RESUME_EN: Include code for OSTimeDlyResume()"
1710
#endif
1711
 
1712
#ifndef OS_TIME_GET_SET_EN
1713
#error  "OS_CFG.H, Missing OS_TIME_GET_SET_EN: Include code for OSTimeGet() and OSTimeSet()"
1714
#endif
1715
 
1716
/*
1717
*********************************************************************************************************
1718
*                                             TIMER MANAGEMENT
1719
*********************************************************************************************************
1720
*/
1721
 
1722
#ifndef OS_TMR_EN
1723
#error  "OS_CFG.H, Missing OS_TMR_EN: When (1) enables code generation for Timer Management"
1724
#elif   OS_TMR_EN > 0u
1725
    #if     OS_SEM_EN == 0u
1726
    #error  "OS_CFG.H, Semaphore management is required (set OS_SEM_EN to 1) when enabling Timer Management."
1727
    #error  "          Timer management require TWO semaphores."
1728
    #endif
1729
 
1730
    #ifndef OS_TMR_CFG_MAX
1731
    #error  "OS_CFG.H, Missing OS_TMR_CFG_MAX: Determines the total number of timers in an application (2 .. 65500)"
1732
    #else
1733
        #if OS_TMR_CFG_MAX < 2u
1734
        #error  "OS_CFG.H, OS_TMR_CFG_MAX should be between 2 and 65500"
1735
        #endif
1736
 
1737
        #if OS_TMR_CFG_MAX > 65500u
1738
        #error  "OS_CFG.H, OS_TMR_CFG_MAX should be between 2 and 65500"
1739
        #endif
1740
    #endif
1741
 
1742
    #ifndef OS_TMR_CFG_WHEEL_SIZE
1743
    #error  "OS_CFG.H, Missing OS_TMR_CFG_WHEEL_SIZE: Sets the size of the timer wheel (1 .. 1023)"
1744
    #else
1745
        #if OS_TMR_CFG_WHEEL_SIZE < 2u
1746
        #error  "OS_CFG.H, OS_TMR_CFG_WHEEL_SIZE should be between 2 and 1024"
1747
        #endif
1748
 
1749
        #if OS_TMR_CFG_WHEEL_SIZE > 1024u
1750
        #error  "OS_CFG.H, OS_TMR_CFG_WHEEL_SIZE should be between 2 and 1024"
1751
        #endif
1752
    #endif
1753
 
1754
    #ifndef OS_TMR_CFG_NAME_EN
1755
    #error  "OS_CFG.H, Missing OS_TMR_CFG_NAME_EN: Enable Timer names"
1756
    #endif
1757
 
1758
    #ifndef OS_TMR_CFG_TICKS_PER_SEC
1759
    #error  "OS_CFG.H, Missing OS_TMR_CFG_TICKS_PER_SEC: Determines the rate at which tiem timer management task will run (Hz)"
1760
    #endif
1761
 
1762
    #ifndef OS_TASK_TMR_STK_SIZE
1763
    #error  "OS_CFG.H, Missing OS_TASK_TMR_STK_SIZE: Determines the size of the Timer Task's stack"
1764
    #endif
1765
#endif
1766
 
1767
 
1768
/*
1769
*********************************************************************************************************
1770
*                                            MISCELLANEOUS
1771
*********************************************************************************************************
1772
*/
1773
 
1774
#ifndef OS_ARG_CHK_EN
1775
#error  "OS_CFG.H, Missing OS_ARG_CHK_EN: Enable (1) or Disable (0) argument checking"
1776
#endif
1777
 
1778
 
1779
#ifndef OS_CPU_HOOKS_EN
1780
#error  "OS_CFG.H, Missing OS_CPU_HOOKS_EN: uC/OS-II hooks are found in the processor port files when 1"
1781
#endif
1782
 
1783
 
1784
#ifndef OS_APP_HOOKS_EN
1785
#error  "OS_CFG.H, Missing OS_APP_HOOKS_EN: Application-defined hooks are called from the uC/OS-II hooks"
1786
#endif
1787
 
1788
 
1789
#ifndef OS_DEBUG_EN
1790
#error  "OS_CFG.H, Missing OS_DEBUG_EN: Allows you to include variables for debugging or not"
1791
#endif
1792
 
1793
 
1794
#ifndef OS_LOWEST_PRIO
1795
#error  "OS_CFG.H, Missing OS_LOWEST_PRIO: Defines the lowest priority that can be assigned"
1796
#endif
1797
 
1798
 
1799
#ifndef OS_MAX_EVENTS
1800
#error  "OS_CFG.H, Missing OS_MAX_EVENTS: Max. number of event control blocks in your application"
1801
#else
1802
    #if     OS_MAX_EVENTS > 65500u
1803
    #error  "OS_CFG.H, OS_MAX_EVENTS must be <= 65500"
1804
    #endif
1805
#endif
1806
 
1807
 
1808
#ifndef OS_SCHED_LOCK_EN
1809
#error  "OS_CFG.H, Missing OS_SCHED_LOCK_EN: Include code for OSSchedLock() and OSSchedUnlock()"
1810
#endif
1811
 
1812
 
1813
#ifndef OS_EVENT_MULTI_EN
1814
#error  "OS_CFG.H, Missing OS_EVENT_MULTI_EN: Include code for OSEventPendMulti()"
1815
#endif
1816
 
1817
 
1818
#ifndef OS_TASK_PROFILE_EN
1819
#error  "OS_CFG.H, Missing OS_TASK_PROFILE_EN: Include data structure for run-time task profiling"
1820
#endif
1821
 
1822
 
1823
#ifndef OS_TASK_SW_HOOK_EN
1824
#error  "OS_CFG.H, Missing OS_TASK_SW_HOOK_EN: Allows you to include the code for OSTaskSwHook() or not"
1825
#endif
1826
 
1827
 
1828
#ifndef OS_TICK_STEP_EN
1829
#error  "OS_CFG.H, Missing OS_TICK_STEP_EN: Allows to 'step' one tick at a time with uC/OS-View"
1830
#endif
1831
 
1832
 
1833
#ifndef OS_TIME_TICK_HOOK_EN
1834
#error  "OS_CFG.H, Missing OS_TIME_TICK_HOOK_EN: Allows you to include the code for OSTimeTickHook() or not"
1835
#endif
1836
 
1837
/*
1838
*********************************************************************************************************
1839
*                                         SAFETY CRITICAL USE
1840
*********************************************************************************************************
1841
*/
1842
 
1843
#ifdef SAFETY_CRITICAL_RELEASE
1844
 
1845
#if    OS_ARG_CHK_EN < 1u
1846
#error "OS_CFG.H, OS_ARG_CHK_EN must be enabled for safety-critical release code"
1847
#endif
1848
 
1849
#if    OS_APP_HOOKS_EN > 0u
1850
#error "OS_CFG.H, OS_APP_HOOKS_EN must be disabled for safety-critical release code"
1851
#endif
1852
 
1853
#if    OS_DEBUG_EN > 0u
1854
#error "OS_CFG.H, OS_DEBUG_EN must be disabled for safety-critical release code"
1855
#endif
1856
 
1857
#ifdef CANTATA
1858
#error "OS_CFG.H, CANTATA must be disabled for safety-critical release code"
1859
#endif
1860
 
1861
#ifdef OS_SCHED_LOCK_EN
1862
#error "OS_CFG.H, OS_SCHED_LOCK_EN must be disabled for safety-critical release code"
1863
#endif
1864
 
1865
#ifdef VSC_VALIDATION_MODE
1866
#error "OS_CFG.H, VSC_VALIDATION_MODE must be disabled for safety-critical release code"
1867
#endif
1868
 
1869
#if    OS_TASK_STAT_EN > 0u
1870
#error "OS_CFG.H, OS_TASK_STAT_EN must be disabled for safety-critical release code"
1871
#endif
1872
 
1873
#if    OS_TICK_STEP_EN > 0u
1874
#error "OS_CFG.H, OS_TICK_STEP_EN must be disabled for safety-critical release code"
1875
#endif
1876
 
1877
#if    OS_FLAG_EN > 0u
1878
    #if    OS_FLAG_DEL_EN > 0
1879
    #error "OS_CFG.H, OS_FLAG_DEL_EN must be disabled for safety-critical release code"
1880
    #endif
1881
#endif
1882
 
1883
#if    OS_MBOX_EN > 0u
1884
    #if    OS_MBOX_DEL_EN > 0u
1885
    #error "OS_CFG.H, OS_MBOX_DEL_EN must be disabled for safety-critical release code"
1886
    #endif
1887
#endif
1888
 
1889
#if    OS_MUTEX_EN > 0u
1890
    #if    OS_MUTEX_DEL_EN > 0u
1891
    #error "OS_CFG.H, OS_MUTEX_DEL_EN must be disabled for safety-critical release code"
1892
    #endif
1893
#endif
1894
 
1895
#if    OS_Q_EN > 0u
1896
    #if    OS_Q_DEL_EN > 0u
1897
    #error "OS_CFG.H, OS_Q_DEL_EN must be disabled for safety-critical release code"
1898
    #endif
1899
#endif
1900
 
1901
#if    OS_SEM_EN > 0u
1902
    #if    OS_SEM_DEL_EN > 0u
1903
    #error "OS_CFG.H, OS_SEM_DEL_EN must be disabled for safety-critical release code"
1904
    #endif
1905
#endif
1906
 
1907
#if    OS_TASK_EN > 0u
1908
    #if    OS_TASK_DEL_EN > 0u
1909
    #error "OS_CFG.H, OS_TASK_DEL_EN must be disabled for safety-critical release code"
1910
    #endif
1911
#endif
1912
 
1913
#if    OS_CRITICAL_METHOD != 3u
1914
#error "OS_CPU.H, OS_CRITICAL_METHOD must be type 3 for safety-critical release code"
1915
#endif
1916
 
1917
#endif  /* ------------------------ SAFETY_CRITICAL_RELEASE ------------------------ */
1918
 
1919
#ifdef __cplusplus
1920
}
1921
#endif
1922
 
1923
#endif
1924
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.