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