This repository has been archived by the owner on Sep 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathosa.h
1710 lines (1197 loc) · 54.9 KB
/
osa.h
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
/*
************************************************************************************************
*
* OSA cooperative RTOS for microcontrollers PIC, AVR and STM8
*
* OSA is distributed under BSD license (see license.txt)
*
* URL: http://wiki.pic24.ru/doku.php/en/osa/ref/intro
*
*----------------------------------------------------------------------------------------------
*
* File: osa.h
*
* Compilers: HT-PICC STD
* HT-PICC PRO
* HT-PICC18 STD
* Mplab C18
* Mplab C30
* MikroC PRO
* CCS
* WinAVR
* IAR
* Cosmic
* Raisonance
*
* Programmer: Timofeev Victor
*
* Description: This file contains all prototypes of functions and variables,
* data types definitions, system constants.
* This file must be included in all modules that use OSA services.
*
* History: 10.00.2010 - Removed all modification marks
* History: 10.07.2010 - Added ports for STM8: IAR and Raisonance
*
* 25.10.2010 - Bug fixed: OS_Qtimer_Break did not deleted timer from the list
* - Bug fixed: interrupt became disables after calling OS_Qtimer_Run for timer already
* presented in queue
* - (osa_qtimer.c)
* - (osa_pic16_htpicc.c)
* - Definition of OS_Ttimer_Delay fixed (osa_ttimer.h)
*
* 30.10.2010 - Another bug in qtimers fixed (osa_qtimer.c, osa_pic16_htpicc.c)
*
* 22.11.2010 - IAR for AVR port bugs fixed (osa_avr_iar.h)
*
* 08.12.2010 - osa_pic18_htpicc.h
*
* 26.12.2010 - Bug fixed for PIC18: _OS_RETURN_NO_SAVE
*
* 06.03.2011 - osa_avr_winavr.c
* osa_avr_winavr.h
* osa_pic18_mikroc.c
*
*
************************************************************************************************
*/
#ifndef __OSA__
#define __OSA__
#define __OSA_VERSION__ 110306 /* 6 mar, 2011 */
#define __OSAVERSION__ __OSA_VERSION__ /*old*/
/*
************************************************************************************************
* *
* Setting compiler constant. This constant used in "osa.c" to make most *
* efficient code for used compiler. *
* *
* *
************************************************************************************************
*/
//------------------------------------------------------------------------------
#if defined(__PICC18__) /* HT-PICC18 */
#define __OSA_PIC18_HTPICC__
#define __OSA_PIC18__
#define __OSA_HTPICC__
#define __OSAPICC18__ /*old*/
#define __OSAPICC__ /*old*/
#define __OSA18__ /*old*/
#define __OSAPIC__ /*old*/
//------------------------------------------------------------------------------
#elif defined(__18CXX) /* Microchip C18 */
#if __EXTENDED18__ == 1
#define __OSA_PIC18_MPLABC_EXT__
#define __OSAMCC18EXT__ /*old*/
#else
#define __OSA_PIC18_MPLABC__
#define __OSAMCC18__ /*old*/
#endif
#define __OSA_PIC18__
#define __OSA_MPLABC__
#define __OSA18__ /*old*/
#define __OSAPIC__ /*old*/
//------------------------------------------------------------------------------
#elif defined(__C30__) /* Microchip C30 */
#define __OSA_PIC24_MPLABC__
#define __OSA_DSPIC_MPLABC__
#define __OSA_MPLABC__
// See osa_pic24_mplabc.h for processor definition
#define __OSAMCC30__ /*old*/
#define __OSA30__ /*old*/
#define __OSAPIC__ /*old*/
//------------------------------------------------------------------------------
#elif defined(__PCH__) /* CCS for PIC18 */
#define __OSA_PIC18_CCS__
#define __OSA_PIC18__
#define __OSA_CCS__
#define __OSACCS18__ /*old*/
#define __OSACCS__ /*old*/
#define __OSA18__ /*old*/
#define __OSAPIC__ /*old*/
//------------------------------------------------------------------------------
#elif defined(__PCM__) /* CCS for PIC16 */
#define __OSA_PIC16_CCS__
#define __OSA_PIC16__
#define __OSA_CCS__
#define __OSACCS16__ /*old*/
#define __OSACCS__ /*old*/
#define __OSA16__ /*old*/
#define __OSAPIC__ /*old*/
//------------------------------------------------------------------------------
#elif defined(_PIC12) /* HT-PICC with baserange family */
#define __OSA_PIC12_HTPICC__
#define __OSA_PIC12__
#define __OSA_HTPICC__
#define __OSAPICC12__ /*old*/
#define __OSAPICC__ /*old*/
#define __OSA12__ /*old*/
#define __OSAPIC__ /*old*/
//------------------------------------------------------------------------------
#elif defined(__MIKROC_PRO_FOR_PIC__)
#if defined(P16) /* mikroC for PIC16 */
#define __OSA_PIC16_MIKROC__
#define __OSA_PIC16__
#define __OSA_MIKROC__
#define __OSAMIKROC16__ /*old*/
#define __OSAMIKROC__ /*old*/
#define __OSA16__ /*old*/
#elif defined(P18) /* mikroC for PIC18 */
#define __OSA_PIC18_MIKROC__
#define __OSA_PIC18__
#define __OSA_MIKROC__
#define __OSAMIKROC18__ /*old*/
#define __OSAMIKROC__ /*old*/
#define __OSA18__ /*old*/
#endif
#define __OSAPIC__ /*old*/
//------------------------------------------------------------------------------
#elif defined(__AVR__)
#define __OSA_AVR_WINAVR__
#define __OSA_WINAVR__
#define __OSA_AVR__
#define __OSAWINAVR__ /*old*/
#define __OSAAVR__ /*old*/
#define OS_PROTECT_MEMORY_ACCESS // for atomic access protection
//------------------------------------------------------------------------------
#elif defined(__ICCAVR__)
#define __OSA_AVR_IAR__
#define __OSA_IAR__
#define __OSA_AVR__
#define __OSAIARAVR__ /*old*/
#define __OSAAVR__ /*old*/
#define __OSAICCAVR__ /*old*/
#define OS_PROTECT_MEMORY_ACCESS // for atomic access protection
//------------------------------------------------------------------------------
#elif defined(__CODEVISIONAVR__)
#define __OSA_AVR__
#define __OSA_AVR_CODEVISION__
#define __OSA_CODEVISION__
#define OS_PROTECT_MEMORY_ACCESS // for atomic access protection
//------------------------------------------------------------------------------
#elif defined(__ICCSTM8__)
#define __OSA_STM8_IAR__
#define __OSA_STM8__
#define __OSA_IAR__
#define __OSAIARSTM8__ /*old*/
#define __OSASTM8__ /*old*/
#define __OSAICCSTM8__ /*old*/
#define OS_PROTECT_MEMORY_ACCESS // for atomic access protection
//------------------------------------------------------------------------------
#elif defined(__CSMC__)
#define __OSA_STM8_COSMIC__
#define __OSA_STM8__
#define __OSA_COSMIC__
#define __OSACOSMICSTM8__ /*old*/
#define __OSASTM8__ /*old*/
#define OS_PROTECT_MEMORY_ACCESS // for atomic access protection
//------------------------------------------------------------------------------
#elif defined(__RCST7__) /* Raisonance*/
#define __OSA_STM8_RAISONANCE__
#define __OSA_STM8__
#define __OSA_RAISONANCE__
#define __OSA_RCST7__
//------------------------------------------------------------------------------
#else /* HT-PICC with midrange family */
#if _HTC_VER_MAJOR_ >= 9 && _HTC_VER_MINOR_ > 60
#ifdef _PIC14E
#define __OSA_PIC16E_HTPICC_PRO__
#define __OSA_PIC16E__
#define __OSA_HTPICC_PRO__
#define __OSAPICC16E__ /*old*/
#define __OSA16E__ /*old*/
#else
#define __OSA_PIC16_HTPICC__
#define __OSA_PIC16__
#define __OSA_HTPICC__
#define __OSAPICC16__ /*old*/
#define __OSA16__ /*old*/
#endif
#define __OSAPICC__ /*old*/
#define __OSAPICCPRO__ /*old*/
#define __OSAPIC__ /*old*/
#else
#define __OSA_PIC16_HTPICC__
#define __OSA_PIC16__
#define __OSA_HTPICC__
#define __OSAPICC16__ /*old*/
#define __OSAPICC__ /*old*/
#define __OSA16__ /*old*/
#define __OSAPIC__ /*old*/
#endif
#endif
//------------------------------------------------------------------------------
#include "OSAcfg.h" /* This file contains project configuration */
#if defined(__OSACCS__) || defined(__OSAMIKROC__) || defined(__OSA_AVR_WINAVR__)
#define OSM_BEGIN
#define OSM_END
#else
#define OSM_BEGIN do
#define OSM_END while (0)
#endif
/*
************************************************************************************************
* *
* OSA CONFIGURATION *
* *
************************************************************************************************
*/
//******************************************************************************
// PRIORITY MODE
//******************************************************************************
#define OS_PRIORITY_NORMAL 0
#define OS_PRIORITY_DISABLED 1
#define OS_PRIORITY_EXTENDED 2
//------------------------------------------------------------------------------
#ifndef OS_PRIORITY_LEVEL
//------------------------------------------------------------------------------
#if defined(OS_DISABLE_PRIORITY)
#define OS_PRIORITY_LEVEL OS_PRIORITY_DISABLED
#elif defined(OS_EXTENDED_PRIORITY)
#define OS_PRIORITY_LEVEL OS_PRIORITY_EXTENDED
#else
#define OS_PRIORITY_LEVEL OS_PRIORITY_NORMAL
#endif
//------------------------------------------------------------------------------
#endif
//------------------------------------------------------------------------------
//******************************************************************************
//
// CHECK FOR SET OF SERVICES
//
//******************************************************************************
#if defined(OS_ENABLE_ALL)
//------------------------------------------------------------------------------
// undef all config constants
#ifdef OS_ENABLE_TIMER
#undef OS_ENABLE_TIMER
#endif
#ifdef OS_ENABLE_CSEM
#undef OS_ENABLE_CSEM
#endif
#ifdef OS_ENABLE_QUEUE
#undef OS_ENABLE_QUEUE
#endif
#ifdef OS_ENABLE_SQUEUE
#undef OS_ENABLE_SQUEUE
#endif
#ifdef OS_ENABLE_CRITICAL_SECTION
#undef OS_ENABLE_CRITICAL_SECTION
#endif
//------------------------------------------------------------------------------
// undef all old style config constants
#ifdef OS_TIMER_ENABLE
#undef OS_TIMER_ENABLE
#endif
#ifdef OS_CSEM_ENABLE
#undef OS_CSEM_ENABLE
#endif
#ifdef OS_QMSG_ENABLE
#undef OS_QMSG_ENABLE
#endif
#ifdef OS_QSMSG_ENABLE
#undef OS_QSMSG_ENABLE
#endif
#ifdef OS_DTIMERS_ENABLE
#undef OS_DTIMERS_ENABLE
#endif
#ifdef OS_ENABLE_QMSG
#undef OS_ENABLE_QMSG
#endif
#ifdef OS_ENABLE_QSMSG
#undef OS_ENABLE_QSMSG
#endif
//------------------------------------------------------------------------------
// define all config constants
#define OS_ENABLE_CSEM
#define OS_ENABLE_QUEUE
#define OS_ENABLE_SQUEUE
#define OS_ENABLE_TTIMERS
#define OS_ENABLE_CRITICAL_SECTION
#endif
#if defined(OS_ENABLE_QTIMER) && defined(__OSA_PIC12_HTPICC__)
#error "OSA error #22: Qtimers are not supported under 12-bit controllers (PIC10 and PIC12)"
#endif
/*------------------------------------------*/
/* */
/* (OSA configuration) */
/* Redefining old style constants */
/* */
/*------------------------------------------*/
#ifdef OS_TIMER_ENABLE
#define OS_ENABLE_TIMER /* Defined when using timers in tasks (OS_Delay */
/* and wait events with timeout) */
#endif
#ifdef OS_CSEM_ENABLE
#define OS_ENABLE_CSEM /* Defined when using counting semaphores */
#endif
#ifdef OS_QMSG_ENABLE //^
#define OS_ENABLE_QUEUE /* Defined when using queue of pointer to messages */
#endif
#ifdef OS_ENABLE_QMSG //^
#define OS_ENABLE_QUEUE /* Defined when using queue of pointer to messages */
#endif
#ifdef OS_QSMSG_ENABLE //^
#define OS_ENABLE_SQUEUE /* Defined when using queue of simple messages */
#endif
#ifdef OS_ENABLE_QSMSG //^
#define OS_ENABLE_SQUEUE /* Defined when using queue of simple messages */
#endif
#ifdef OS_DTIMERS_ENABLE
#define OS_ENABLE_DTIMERS /* Defined when using dynamic timers */
#endif
#ifdef OS_QUEUES_IDENTICAL //^
#define OS_QUEUE_SQUEUE_IDENTICAL // Defined to reduce code size when both types
// of queues are used
#endif
//------------------------------------------------------------------------------
// (OSA configuration)
// Set constants for interrupt usage
#ifdef OS_ENABLE_INT_SERVICE // Redefining old style constant
#define OS_ENABLE_INT_ALL
#endif
#ifdef OS_ENABLE_INT_ALL
#define OS_ENABLE_INT_BSEM /* Enables interrupt services for binary */
/* semaphores */
#define OS_ENABLE_INT_CSEM /* Enables interrupt services for counting */
/* semaphores */
#define OS_ENABLE_INT_MSG /* Enables interrupt services for pointers */
/* to messages */
#define OS_ENABLE_INT_SMSG /* Enables interrupt services for simple */
/* messages */
#define OS_ENABLE_INT_QUEUE /* Enables interrupt services for queues of */
/* pointers to messages and simple messages */
#define OS_ENABLE_INT_FLAG /* Enables interrupt services for flags */
#endif
#if defined(OS_ENABLE_INT_CSEM) || \
defined(OS_ENABLE_INT_BSEM) || \
defined(OS_ENABLE_INT_MSG) || \
defined(OS_ENABLE_INT_SMSG) || \
defined(OS_ENABLE_INT_QUEUE) || \
defined(OS_ENABLE_INT_FLAG) || \
defined(OS_PROTECT_MEMORY_ACCESS)
#define OS_ENABLE_INT
#endif
/*
*------------------------------------------------------------------------------*
* *
* (OSA configuration) *
* Set system constants for timers *
* *
*------------------------------------------------------------------------------*
*/
#if defined(OS_ENABLE_TIMER)
#define OS_ENABLE_TTIMERS /* Enables task timers */
#endif
#ifdef OS_ENABLE_PTIMERS /* Redefining old name (ptimer) to new (dtimer) */
#define OS_ENABLE_DTIMERS
#endif
#if !defined(OS_STIMERS)
#define OS_STIMERS 0 /* Number of STimers */
#endif
/*--------------------------------------------------*/
/* */
/* Counting number of old style static timers */
/* */
/* note: it is not recommended to use this */
/* type of timers. Use STimers instead. */
/* */
/*--------------------------------------------------*/
#ifndef OS_TIMERS8 /* not recommended to use */
#define OS_TIMERS8 0
#endif
#ifndef OS_TIMERS16 /* not recommended to use */
#define OS_TIMERS16 0
#endif
#ifndef OS_TIMERS24 /* not recommended to use */
#define OS_TIMERS24 0
#endif
#ifndef OS_TIMERS32 /* not recommended to use */
#define OS_TIMERS32 0
#endif
#define _OS_TIMER8_POS (0)
#define _OS_TIMER16_POS (_OS_TIMER8_POS + OS_TIMERS8)
#define _OS_TIMER24_POS (_OS_TIMER16_POS + OS_TIMERS16)
#define _OS_TIMER32_POS (_OS_TIMER24_POS + OS_TIMERS24)
#define OS_TIMERS (OS_TIMERS8 + OS_TIMERS16 + OS_TIMERS24 + OS_TIMERS32)
#if OS_STIMERS > 0
#define OS_ENABLE_STIMERS 1
#endif
/*--------------------------------------------------*/
/* Enable system timer if any type of timers used */
/*--------------------------------------------------*/
#if defined(OS_ENABLE_DTIMERS) || \
defined(OS_ENABLE_TTIMERS) || \
defined(OS_ENABLE_STIMERS) || \
defined(OS_ENABLE_QTIMERS) || \
(OS_TIMERS > 0)
#define OS_ENABLE_OS_TIMER
#endif
//------------------------------------------------------------------------------
/*
************************************************************************************************
* *
* DEFINE BANKS TO ALLOCATE DATA *
* *
************************************************************************************************
*/
/*------------------------------------------*/
/* Check for old style defitions */
/*------------------------------------------*/
#if defined(OS_BANK) || \
defined(OS_TASKS_BANK) || \
defined(OS_TIMERS_BANK) || \
defined(OS_TIMERS8_BANK) || \
defined(OS_TIMERS16_BANK) || \
defined(OS_TIMERS24_BANK) || \
defined(OS_TIMERS32_BANK) || \
defined(OS_TIMEOUTS_BANK) || \
defined(OS_BSEM_BANK)
#error "OSA error #2: Constants OS_xxx_BANK are not allowed now (use OS_BANK_xxx instead)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
/*------------------------------------------*/
/* */
/* Set RAM bank constants */
/* */
/*------------------------------------------*/
#ifndef OS_BANK_OS
#define OS_BANK_OS 0 /* RAM bank for OSA internal variables */
#endif
#if defined(OS_BANK_TASK) && !defined(OS_BANK_TASKS)
#define OS_BANK_TASKS OS_BANK_TASK
#endif
//------------------------------------------------------------------------------
#if defined(OS_ADDRESS_TASKS) && defined(__OSA_PIC16_MIKROC__) // For direct allocation of
#define OS_ALLOCATION_TASKS absolute OS_ADDRESS_TASKS // task descriptors in
// mikroC PRO for PIC16
#else
#define OS_ALLOCATION_TASKS // Empty for others
#endif
//------------------------------------------------------------------------------
#ifndef OS_BANK_TASKS
#define OS_BANK_TASKS OS_BANK_OS /* RAM bank for task descriptors */
#endif
#ifndef OS_BANK_TIMERS
#define OS_BANK_TIMERS OS_BANK_OS /* RAM bank for old style static timers */
#endif
#ifndef OS_BANK_TIMERS8
#define OS_BANK_TIMERS8 OS_BANK_TIMERS
#endif
#ifndef OS_BANK_TIMERS16
#define OS_BANK_TIMERS16 OS_BANK_TIMERS
#endif
#ifndef OS_BANK_TIMERS24
#define OS_BANK_TIMERS24 OS_BANK_TIMERS
#endif
#ifndef OS_BANK_TIMERS32
#define OS_BANK_TIMERS32 OS_BANK_TIMERS
#endif
#ifndef OS_BANK_TIMEOUTS
#define OS_BANK_TIMEOUTS OS_BANK_TIMERS
#endif
#ifndef OS_BANK_STIMERS
#define OS_BANK_STIMERS OS_BANK_TIMERS /* RAM bank for static timers */
#endif
#if defined(OS_BANK_BSEMS) && !defined(OS_BANK_BSEM)
#define OS_BANK_BSEM OS_BANK_BSEMS
#endif
#ifndef OS_BANK_BSEM
#define OS_BANK_BSEM OS_BANK_OS /* RAM bank for array of binary semaphores */
#endif
//******************************************************************************
//
// Checking validness of bank settings for each type of OSA data
//
//******************************************************************************
#if OS_BANK_OS == 0
#define OS_BANK OS_RAM_BANK0
#elif OS_BANK_OS == 1
#define OS_BANK OS_RAM_BANK1
#elif OS_BANK_OS == 2
#define OS_BANK OS_RAM_BANK2
#elif OS_BANK_OS == 3
#define OS_BANK OS_RAM_BANK3
#else
#error "OSA error #3: Incorrect OS_BANK_OS value (should be 0, 1, 2 or 3)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
#if OS_BANK_TASKS == 0
#define OS_TASKS_BANK OS_RAM_BANK0
#elif OS_BANK_TASKS == 1
#define OS_TASKS_BANK OS_RAM_BANK1
#elif OS_BANK_TASKS == 2
#define OS_TASKS_BANK OS_RAM_BANK2
#elif OS_BANK_TASKS == 3
#define OS_TASKS_BANK OS_RAM_BANK3
#else
#error "OSA error #4: Incorrect OS_BANK_TASKS value (should be 0, 1, 2 or 3)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
#if OS_BANK_TIMERS == 0
#define OS_TIMERS_BANK OS_RAM_BANK0
#elif OS_BANK_TIMERS == 1
#define OS_TIMERS_BANK OS_RAM_BANK1
#elif OS_BANK_TIMERS == 2
#define OS_TIMERS_BANK OS_RAM_BANK2
#elif OS_BANK_TIMERS == 3
#define OS_TIMERS_BANK OS_RAM_BANK3
#else
#error "OSA error #5: Incorrect OS_BANK_TIMERS value (should be 0, 1, 2 or 3)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
#if OS_BANK_STIMERS == 0
#define OS_STIMERS_BANK OS_RAM_BANK0
#elif OS_BANK_STIMERS == 1
#define OS_STIMERS_BANK OS_RAM_BANK1
#elif OS_BANK_STIMERS == 2
#define OS_STIMERS_BANK OS_RAM_BANK2
#elif OS_BANK_STIMERS == 3
#define OS_STIMERS_BANK OS_RAM_BANK3
#else
#error "OSA error #6: Incorrect OS_BANK_STIMERS value (should be 0, 1, 2 or 3)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
#if OS_BANK_TIMERS8 == 0
#define OS_TIMERS8_BANK OS_RAM_BANK0
#elif OS_BANK_TIMERS8 == 1
#define OS_TIMERS8_BANK OS_RAM_BANK1
#elif OS_BANK_TIMERS8 == 2
#define OS_TIMERS8_BANK OS_RAM_BANK2
#elif OS_BANK_TIMERS8 == 3
#define OS_TIMERS8_BANK OS_RAM_BANK3
#else
#error "OSA error #7: Incorrect OS_BANK_TIMERS8 value (should be 0, 1, 2 or 3)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
#if OS_BANK_TIMERS16 == 0
#define OS_TIMERS16_BANK OS_RAM_BANK0
#elif OS_BANK_TIMERS16 == 1
#define OS_TIMERS16_BANK OS_RAM_BANK1
#elif OS_BANK_TIMERS16 == 2
#define OS_TIMERS16_BANK OS_RAM_BANK2
#elif OS_BANK_TIMERS16 == 3
#define OS_TIMERS16_BANK OS_RAM_BANK3
#else
#error "OSA error #8: Incorrect OS_BANK_TIMERS16 value (should be 0, 1, 2 or 3)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
#if OS_BANK_TIMERS24 == 0
#define OS_TIMERS24_BANK OS_RAM_BANK0
#elif OS_BANK_TIMERS24 == 1
#define OS_TIMERS24_BANK OS_RAM_BANK1
#elif OS_BANK_TIMERS24 == 2
#define OS_TIMERS24_BANK OS_RAM_BANK2
#elif OS_BANK_TIMERS24 == 3
#define OS_TIMERS24_BANK OS_RAM_BANK3
#else
#error "OSA error #9: Incorrect OS_BANK_TIMERS24 value (should be 0, 1, 2 or 3)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
#if OS_BANK_TIMERS32 == 0
#define OS_TIMERS32_BANK OS_RAM_BANK0
#elif OS_BANK_TIMERS32 == 1
#define OS_TIMERS32_BANK OS_RAM_BANK1
#elif OS_BANK_TIMERS32 == 2
#define OS_TIMERS32_BANK OS_RAM_BANK2
#elif OS_BANK_TIMERS32 == 3
#define OS_TIMERS32_BANK OS_RAM_BANK3
#else
#error "OSA error #10: Incorrect OS_BANK_TIMERS32 value (should be 0, 1, 2 or 3)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
#if OS_BANK_TIMEOUTS == 0
#define OS_TIMEOUTS_BANK OS_RAM_BANK0
#elif OS_BANK_TIMEOUTS == 1
#define OS_TIMEOUTS_BANK OS_RAM_BANK1
#elif OS_BANK_TIMEOUTS == 2
#define OS_TIMEOUTS_BANK OS_RAM_BANK2
#elif OS_BANK_TIMEOUTS == 3
#define OS_TIMEOUTS_BANK OS_RAM_BANK3
#else
#error "OSA error #11: Incorrect OS_BANK_TIMEOUTS value (should be 0, 1, 2 or 3)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
#if OS_BANK_BSEM == 0
#define OS_BSEM_BANK OS_RAM_BANK0
#elif OS_BANK_BSEM == 1
#define OS_BSEM_BANK OS_RAM_BANK1
#elif OS_BANK_BSEM == 2
#define OS_BSEM_BANK OS_RAM_BANK2
#elif OS_BANK_BSEM == 3
#define OS_BSEM_BANK OS_RAM_BANK3
#else
#error "OSA error #12: Incorrect OS_BANK_BSEM value (should be 0, 1, 2 or 3)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
/*
************************************************************************************************
* *
* Definition of data sizes for each type of OSA data *
* *
************************************************************************************************
*/
//******************************************************************************
// Number of task descriptors (maximum active tasks at one time
//******************************************************************************
#if defined (OS_TASKS) && (OS_TASKS == 0)
#undef OS_TASKS
#endif
#ifndef OS_TASKS
#define OS_TASKS 1 // We need at least 1 task
#endif
//******************************************************************************
// Types of timers
//******************************************************************************
#if defined(OST_TIMER)
#error "OSA error #13: OST_TlMER is not supported! Use OS_TIMER_SIZE instead (see manual)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
#if !defined(OS_TIMER_SIZE)
#define OS_TIMER_SIZE 2 /* Default timer size */
#endif
#if OS_TIMER_SIZE == 1
#define OS_TIMER_TYPE OST_UINT8
#elif OS_TIMER_SIZE == 2
#define OS_TIMER_TYPE OST_UINT16
#elif OS_TIMER_SIZE == 4
#define OS_TIMER_TYPE OST_UINT32
#else
#error "OSA error #17: Bad TIMER size (must be 1, 2 or 4)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
// Size of static timer's counter
//******************************************************************************
#if !defined(OS_STIMER_SIZE)
#define OS_STIMER_SIZE OS_TIMER_SIZE
#endif
#if OS_STIMER_SIZE == 1
#define OS_STIMER_TYPE OST_UINT8
#elif OS_STIMER_SIZE == 2
#define OS_STIMER_TYPE OST_UINT16
#elif OS_STIMER_SIZE == 4
#define OS_STIMER_TYPE OST_UINT32
#else
#error "OSA error #18: Bad STIMER size (must be 1, 2 or 4)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
// Size of dynamic timer's counter
//******************************************************************************
#ifdef OS_PTIMER_SIZE // Redefine old name (ptimer) to new (dtimer)
#define OS_DTIMER_SIZE OS_PTIMER_SIZE
#endif
#if !defined(OS_DTIMER_SIZE)
#define OS_DTIMER_SIZE OS_TIMER_SIZE
#endif
#if OS_DTIMER_SIZE == 1
#define OS_DTIMER_TYPE OST_UINT8
#elif OS_DTIMER_SIZE == 2
#define OS_DTIMER_TYPE OST_UINT16
#elif OS_DTIMER_SIZE == 4
#define OS_DTIMER_TYPE OST_UINT32
#else
#error "OSA error #19: Bad DTIMER size (must be 1, 2 or 4)"
/* See manual section "Appendix/Error codes" for more information*/
#endif
//******************************************************************************
// Size of fast timer's counter
//******************************************************************************
#if !defined(OS_QTIMER_SIZE)
#define OS_QTIMER_SIZE OS_TIMER_SIZE
#endif
#if OS_QTIMER_SIZE == 1