1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17:
18:
19: #ifndef _SYS_KNLDEF_H_
20: #define _SYS_KNLDEF_H_
21:
22: #include <sys/sysdef.h>
23:
24: #include <config.h>
25:
26: 27:
28: #if ( CNF_TIMER_PERIOD < MIN_TIMER_PERIOD || CNF_TIMER_PERIOD > MAX_TIMER_PERIOD )
29: # error "CNF_TIMER_PERIOD is out of range."
30: #endif
31:
32: #if CNF_MAX_TSKPRI < 16
33: # error "The maximum task priority must be 16 or higher."
34: #endif
35:
36: #if USE_PTMR && !CPU_HAS_PTMR
37: # error "USE_PTMR cannot be specified."
38: #endif
39:
40: #if USE_FPU && !CPU_HAS_FPU
41: # error "USE_FPU cannot be specified."
42: #endif
43:
44: #if USE_DPS && !CPU_HAS_DSP
45: # error "USE_DSP cannot be specified."
46: #endif
47:
48:
49: 50:
51: #define SYSTEMAREA_TOP CNF_SYSTEMAREA_TOP
52: #define SYSTEMAREA_END CNF_SYSTEMAREA_END
53:
54:
55:
56: 57:
58: #define MIN_TSKPRI (1)
59: #define MAX_TSKPRI (CNF_MAX_TSKPRI)
60: #define NUM_TSKPRI (CNF_MAX_TSKPRI)
61: #define CHK_PRI(pri) ((MIN_TSKPRI) <= (pri) && (pri) <= (MAX_TSKPRI))
62:
63:
64:
65: 66:
67: #define TIMER_PERIOD CNF_TIMER_PERIOD
68:
69:
70:
71: 72:
73:
74:
75: #define MIN_TSKID (1)
76: #define MAX_TSKID (CNF_MAX_TSKID)
77: #define NUM_TSKID (MAX_TSKID)
78: #define CHK_TSKID(id) ((MIN_TSKID) <= (id) && (id) <= (MAX_TSKID))
79: #define INDEX_TSK(id) ((id)-(MIN_TSKID))
80: #define ID_TSK(index) ((index)+(MIN_TSKID))
81:
82:
83: #if USE_SEMAPHORE
84: #define MAX_SEMID (CNF_MAX_SEMID)
85: #define MIN_SEMID (1)
86: #define NUM_SEMID (MAX_SEMID)
87: #define CHK_SEMID(id) ((MIN_SEMID) <= (id) && (id) <= (MAX_SEMID))
88: #define INDEX_SEM(id) ((id)-(MIN_SEMID))
89: #define ID_SEM(index) ((index)+(MIN_SEMID))
90: #else
91: #define MAX_SEMID (0)
92: #endif
93:
94:
95: #if USE_EVENTFLAG
96: #define MIN_FLGID (1)
97: #define MAX_FLGID (CNF_MAX_FLGID)
98: #define NUM_FLGID (MAX_FLGID)
99: #define CHK_FLGID(id) ((MIN_FLGID) <= (id) && (id) <= (MAX_FLGID))
100: #define INDEX_FLG(id) ((id)-(MIN_FLGID))
101: #define ID_FLG(index) ((index)+(MIN_FLGID))
102: #else
103: #define MAX_FLGID (0)
104: #endif
105:
106:
107: #if USE_MAILBOX
108: #define MIN_MBXID (1)
109: #define MAX_MBXID (CNF_MAX_MBXID)
110: #define NUM_MBXID (MAX_MBXID)
111: #define CHK_MBXID(id) ((MIN_MBXID) <= (id) && (id) <= (MAX_MBXID))
112: #define INDEX_MBX(id) ((id)-(MIN_MBXID))
113: #define ID_MBX(index) ((index)+(MIN_MBXID))
114: #else
115: #define MAX_MBXID (0)
116: #endif
117:
118:
119: #if USE_MUTEX
120: #define MIN_MTXID (1)
121: #define MAX_MTXID (CNF_MAX_MTXID)
122: #define NUM_MTXID (MAX_MTXID)
123: #define CHK_MTXID(id) ((MIN_MTXID) <= (id) && (id) <= (MAX_MTXID))
124: #define INDEX_MTX(id) ((id)-(MIN_MTXID))
125: #define ID_MTX(index) ((index)+(MIN_MTXID))
126: #else
127: #define NUM_MTXID (0)
128: #endif
129:
130:
131: #if USE_MESSAGEBUFFER
132: #define MIN_MBFID (1)
133: #define MAX_MBFID (CNF_MAX_MBFID)
134: #define NUM_MBFID (MAX_MBFID)
135: #define CHK_MBFID(id) ((MIN_MBFID) <= (id) && (id) <= (MAX_MBFID))
136: #define INDEX_MBF(id) ((id)-(MIN_MBFID))
137: #define ID_MBF(index) ((index)+(MIN_MBFID))
138: #else
139: #define MAX_MBFID (0)
140: #endif
141:
142:
143: #if USE_MEMORYPOOL
144: #define MIN_MPLID (1)
145: #define MAX_MPLID (CNF_MAX_MPLID)
146: #define NUM_MPLID (MAX_MPLID)
147: #define CHK_MPLID(id) ((MIN_MPLID) <= (id) && (id) <= (MAX_MPLID))
148: #define INDEX_MPL(id) ((id)-(MIN_MPLID))
149: #define ID_MPL(index) ((index)+(MIN_MPLID))
150: #else
151: #define MAX_MPLID (0)
152: #endif
153:
154:
155: #if USE_FIX_MEMORYPOOL
156: #define MIN_MPFID (1)
157: #define MAX_MPFID (CNF_MAX_MPFID)
158: #define NUM_MPFID (MAX_MPFID)
159: #define CHK_MPFID(id) ((MIN_MPFID) <= (id) && (id) <= (MAX_MPFID))
160: #define INDEX_MPF(id) ((id)-(MIN_MPFID))
161: #define ID_MPF(index) ((index)+(MIN_MPFID))
162: #else
163: #define MAX_MPFID (0)
164: #endif
165:
166:
167: #if USE_CYCLICHANDLER
168: #define MIN_CYCID (1)
169: #define MAX_CYCID (CNF_MAX_CYCID)
170: #define NUM_CYCID (MAX_CYCID)
171: #define CHK_CYCID(id) ((MIN_CYCID) <= (id) && (id) <= (MAX_CYCID))
172: #define INDEX_CYC(id) ((id)-(MIN_CYCID))
173: #define ID_CYC(index) ((index)+(MIN_CYCID))
174: #else
175: #define MAX_CYCID (0)
176: #endif
177:
178:
179:
180: #if USE_ALARMHANDLER
181: #define MIN_ALMID (1)
182: #define MAX_ALMID (CNF_MAX_ALMID)
183: #define NUM_ALMID (MAX_ALMID)
184: #define CHK_ALMID(id) ((MIN_ALMID) <= (id) && (id) <= (MAX_ALMID))
185: #define INDEX_ALM(id) ((id)-(MIN_ALMID))
186: #define ID_ALM(index) ((index)+(MIN_ALMID))
187: #else
188: #define MAX_ALMID (0)
189: #endif
190:
191:
192: #if USE_LEGACY_API && USE_RENDEZVOUS
193: #define MIN_PORID (1)
194: #define MAX_PORID (CNF_MAX_PORID)
195: #define NUM_PORID (MAX_PORID)
196: #define CHK_PORID(id) ((MIN_PORID) <= (id) && (id) <= (MAX_PORID))
197: #define INDEX_POR(id) ((id)-(MIN_PORID))
198: #define ID_POR(index) ((index)+(MIN_PORID))
199: #else
200: #define MAX_PORID (0)
201: #endif
202:
203:
204: 205:
206: #if USE_DEVICE
207: #define MAX_REGDEV (CNF_MAX_REGDEV)
208: #define MAX_OPNDEV (CNF_MAX_OPNDEV)
209: #define MAX_REQDEV (CNF_MAX_REQDEV)
210: #define DEVT_MBFSZ0 (CNF_DEVT_MBFSZ0)
211: #define DEVT_MBFSZ1 (CNF_DEVT_MBFSZ1)
212: #else
213: #define MAX_REGDEV (0)
214: #endif
215:
216:
217:
218: 219:
220: #define EXC_STACK_SIZE CNF_EXC_STACK_SIZE
221: #define TMP_STACK_SIZE CNF_TMP_STACK_SIZE
222:
223:
224: 225:
226: #define VER_MAKER CNF_VER_MAKER
227: #define VER_PRID CNF_VER_PRID
228: #define VER_MAJOR 3
229: #define VER_MINOR 0
230: #define VER_SPVER (0x6000 | (VER_MAJOR << 8) | VER_MINOR)
231: #define VER_PRVER CNF_VER_PRVER
232: #define VER_PRNO1 CNF_VER_PRNO1
233: #define VER_PRNO2 CNF_VER_PRNO2
234: #define VER_PRNO3 CNF_VER_PRNO3
235: #define VER_PRNO4 CNF_VER_PRNO4
236:
237:
238: #endif