os_dbg_r.c
12.4 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
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
* DEBUGGER CONSTANTS
*
* (c) Copyright 1992-2009, Micrium, Weston, FL
* All Rights Reserved
*
* File : OS_DBG.C
* 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µm 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.
*********************************************************************************************************
*/
#include <ucos_ii.h>
/*
*********************************************************************************************************
* DEBUG DATA
*********************************************************************************************************
*/
INT16U const OSDebugEn = OS_DEBUG_EN; /* Debug constants are defined below */
#if OS_DEBUG_EN > 0u
INT32U const OSEndiannessTest = 0x12345678uL; /* Variable to test CPU endianness */
INT16U const OSEventEn = OS_EVENT_EN;
INT16U const OSEventMax = OS_MAX_EVENTS; /* Number of event control blocks */
INT16U const OSEventNameEn = OS_EVENT_NAME_EN;
#if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u)
INT16U const OSEventSize = sizeof(OS_EVENT); /* Size in Bytes of OS_EVENT */
INT16U const OSEventTblSize = sizeof(OSEventTbl); /* Size of OSEventTbl[] in bytes */
#else
INT16U const OSEventSize = 0u;
INT16U const OSEventTblSize = 0u;
#endif
INT16U const OSEventMultiEn = OS_EVENT_MULTI_EN;
INT16U const OSFlagEn = OS_FLAG_EN;
#if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
INT16U const OSFlagGrpSize = sizeof(OS_FLAG_GRP); /* Size in Bytes of OS_FLAG_GRP */
INT16U const OSFlagNodeSize = sizeof(OS_FLAG_NODE); /* Size in Bytes of OS_FLAG_NODE */
INT16U const OSFlagWidth = sizeof(OS_FLAGS); /* Width (in bytes) of OS_FLAGS */
#else
INT16U const OSFlagGrpSize = 0u;
INT16U const OSFlagNodeSize = 0u;
INT16U const OSFlagWidth = 0u;
#endif
INT16U const OSFlagMax = OS_MAX_FLAGS;
INT16U const OSFlagNameEn = OS_FLAG_NAME_EN;
INT16U const OSLowestPrio = OS_LOWEST_PRIO;
INT16U const OSMboxEn = OS_MBOX_EN;
INT16U const OSMemEn = OS_MEM_EN;
INT16U const OSMemMax = OS_MAX_MEM_PART; /* Number of memory partitions */
INT16U const OSMemNameEn = OS_MEM_NAME_EN;
#if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
INT16U const OSMemSize = sizeof(OS_MEM); /* Mem. Partition header sine (bytes) */
INT16U const OSMemTblSize = sizeof(OSMemTbl);
#else
INT16U const OSMemSize = 0u;
INT16U const OSMemTblSize = 0u;
#endif
INT16U const OSMutexEn = OS_MUTEX_EN;
INT16U const OSPtrSize = sizeof(void *); /* Size in Bytes of a pointer */
INT16U const OSQEn = OS_Q_EN;
INT16U const OSQMax = OS_MAX_QS; /* Number of queues */
#if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u)
INT16U const OSQSize = sizeof(OS_Q); /* Size in bytes of OS_Q structure */
#else
INT16U const OSQSize = 0u;
#endif
INT16U const OSRdyTblSize = OS_RDY_TBL_SIZE; /* Number of bytes in the ready table */
INT16U const OSSemEn = OS_SEM_EN;
INT16U const OSStkWidth = sizeof(OS_STK); /* Size in Bytes of a stack entry */
INT16U const OSTaskCreateEn = OS_TASK_CREATE_EN;
INT16U const OSTaskCreateExtEn = OS_TASK_CREATE_EXT_EN;
INT16U const OSTaskDelEn = OS_TASK_DEL_EN;
INT16U const OSTaskIdleStkSize = OS_TASK_IDLE_STK_SIZE;
INT16U const OSTaskProfileEn = OS_TASK_PROFILE_EN;
INT16U const OSTaskMax = OS_MAX_TASKS + OS_N_SYS_TASKS; /* Total max. number of tasks */
INT16U const OSTaskNameEn = OS_TASK_NAME_EN;
INT16U const OSTaskStatEn = OS_TASK_STAT_EN;
INT16U const OSTaskStatStkSize = OS_TASK_STAT_STK_SIZE;
INT16U const OSTaskStatStkChkEn = OS_TASK_STAT_STK_CHK_EN;
INT16U const OSTaskSwHookEn = OS_TASK_SW_HOOK_EN;
INT16U const OSTaskRegTblSize = OS_TASK_REG_TBL_SIZE;
INT16U const OSTCBPrioTblMax = OS_LOWEST_PRIO + 1u; /* Number of entries in OSTCBPrioTbl[] */
INT16U const OSTCBSize = sizeof(OS_TCB); /* Size in Bytes of OS_TCB */
INT16U const OSTicksPerSec = OS_TICKS_PER_SEC;
INT16U const OSTimeTickHookEn = OS_TIME_TICK_HOOK_EN;
INT16U const OSVersionNbr = OS_VERSION;
INT16U const OSTmrEn = OS_TMR_EN;
INT16U const OSTmrCfgMax = OS_TMR_CFG_MAX;
INT16U const OSTmrCfgNameEn = OS_TMR_CFG_NAME_EN;
INT16U const OSTmrCfgWheelSize = OS_TMR_CFG_WHEEL_SIZE;
INT16U const OSTmrCfgTicksPerSec = OS_TMR_CFG_TICKS_PER_SEC;
#if (OS_TMR_EN > 0u) && (OS_TMR_CFG_MAX > 0u)
INT16U const OSTmrSize = sizeof(OS_TMR);
INT16U const OSTmrTblSize = sizeof(OSTmrTbl);
INT16U const OSTmrWheelSize = sizeof(OS_TMR_WHEEL);
INT16U const OSTmrWheelTblSize = sizeof(OSTmrWheelTbl);
#else
INT16U const OSTmrSize = 0u;
INT16U const OSTmrTblSize = 0u;
INT16U const OSTmrWheelSize = 0u;
INT16U const OSTmrWheelTblSize = 0u;
#endif
#endif
/*$PAGE*/
/*
*********************************************************************************************************
* DEBUG DATA
* TOTAL DATA SPACE (i.e. RAM) USED BY uC/OS-II
*********************************************************************************************************
*/
#if OS_DEBUG_EN > 0u
INT16U const OSDataSize = sizeof(OSCtxSwCtr)
#if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u)
+ sizeof(OSEventFreeList)
+ sizeof(OSEventTbl)
#endif
#if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
+ sizeof(OSFlagTbl)
+ sizeof(OSFlagFreeList)
#endif
#if OS_TASK_STAT_EN > 0u
+ sizeof(OSCPUUsage)
+ sizeof(OSIdleCtrMax)
+ sizeof(OSIdleCtrRun)
+ sizeof(OSStatRdy)
+ sizeof(OSTaskStatStk)
#endif
#if OS_TICK_STEP_EN > 0u
+ sizeof(OSTickStepState)
#endif
#if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
+ sizeof(OSMemFreeList)
+ sizeof(OSMemTbl)
#endif
#if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u)
+ sizeof(OSQFreeList)
+ sizeof(OSQTbl)
#endif
#if OS_TIME_GET_SET_EN > 0u
+ sizeof(OSTime)
#endif
#if (OS_TMR_EN > 0u) && (OS_TMR_CFG_MAX > 0u)
+ sizeof(OSTmrFree)
+ sizeof(OSTmrUsed)
+ sizeof(OSTmrTime)
+ sizeof(OSTmrSem)
+ sizeof(OSTmrSemSignal)
+ sizeof(OSTmrTbl)
+ sizeof(OSTmrFreeList)
+ sizeof(OSTmrTaskStk)
+ sizeof(OSTmrWheelTbl)
#endif
+ sizeof(OSIntNesting)
+ sizeof(OSLockNesting)
+ sizeof(OSPrioCur)
+ sizeof(OSPrioHighRdy)
+ sizeof(OSRdyGrp)
+ sizeof(OSRdyTbl)
+ sizeof(OSRunning)
+ sizeof(OSTaskCtr)
+ sizeof(OSIdleCtr)
+ sizeof(OSTaskIdleStk)
+ sizeof(OSTCBCur)
+ sizeof(OSTCBFreeList)
+ sizeof(OSTCBHighRdy)
+ sizeof(OSTCBList)
+ sizeof(OSTCBPrioTbl)
+ sizeof(OSTCBTbl);
#endif
/*$PAGE*/
/*
*********************************************************************************************************
* OS DEBUG INITIALIZATION
*
* Description: This function is used to make sure that debug variables that are unused in the application
* are not optimized away. This function might not be necessary for all compilers. In this
* case, you should simply DELETE the code in this function while still leaving the declaration
* of the function itself.
*
* Arguments : none
*
* Returns : none
*
* Note(s) : (1) This code doesn't do anything, it simply prevents the compiler from optimizing out
* the 'const' variables which are declared in this file.
* (2) You may decide to 'compile out' the code (by using #if 0/#endif) INSIDE the function
* if your compiler DOES NOT optimize out the 'const' variables above.
*********************************************************************************************************
*/
#if OS_DEBUG_EN > 0u
void OSDebugInit (void)
{
void const *ptemp;
ptemp = (void const *)&OSDebugEn;
ptemp = (void const *)&OSEndiannessTest;
ptemp = (void const *)&OSEventMax;
ptemp = (void const *)&OSEventNameEn;
ptemp = (void const *)&OSEventEn;
ptemp = (void const *)&OSEventSize;
ptemp = (void const *)&OSEventTblSize;
ptemp = (void const *)&OSEventMultiEn;
ptemp = (void const *)&OSFlagEn;
ptemp = (void const *)&OSFlagGrpSize;
ptemp = (void const *)&OSFlagNodeSize;
ptemp = (void const *)&OSFlagWidth;
ptemp = (void const *)&OSFlagMax;
ptemp = (void const *)&OSFlagNameEn;
ptemp = (void const *)&OSLowestPrio;
ptemp = (void const *)&OSMboxEn;
ptemp = (void const *)&OSMemEn;
ptemp = (void const *)&OSMemMax;
ptemp = (void const *)&OSMemNameEn;
ptemp = (void const *)&OSMemSize;
ptemp = (void const *)&OSMemTblSize;
ptemp = (void const *)&OSMutexEn;
ptemp = (void const *)&OSPtrSize;
ptemp = (void const *)&OSQEn;
ptemp = (void const *)&OSQMax;
ptemp = (void const *)&OSQSize;
ptemp = (void const *)&OSRdyTblSize;
ptemp = (void const *)&OSSemEn;
ptemp = (void const *)&OSStkWidth;
ptemp = (void const *)&OSTaskCreateEn;
ptemp = (void const *)&OSTaskCreateExtEn;
ptemp = (void const *)&OSTaskDelEn;
ptemp = (void const *)&OSTaskIdleStkSize;
ptemp = (void const *)&OSTaskProfileEn;
ptemp = (void const *)&OSTaskMax;
ptemp = (void const *)&OSTaskNameEn;
ptemp = (void const *)&OSTaskStatEn;
ptemp = (void const *)&OSTaskStatStkSize;
ptemp = (void const *)&OSTaskStatStkChkEn;
ptemp = (void const *)&OSTaskSwHookEn;
ptemp = (void const *)&OSTCBPrioTblMax;
ptemp = (void const *)&OSTCBSize;
ptemp = (void const *)&OSTicksPerSec;
ptemp = (void const *)&OSTimeTickHookEn;
#if OS_TMR_EN > 0u
ptemp = (void const *)&OSTmrTbl[0];
ptemp = (void const *)&OSTmrWheelTbl[0];
ptemp = (void const *)&OSTmrEn;
ptemp = (void const *)&OSTmrCfgMax;
ptemp = (void const *)&OSTmrCfgNameEn;
ptemp = (void const *)&OSTmrCfgWheelSize;
ptemp = (void const *)&OSTmrCfgTicksPerSec;
ptemp = (void const *)&OSTmrSize;
ptemp = (void const *)&OSTmrTblSize;
ptemp = (void const *)&OSTmrWheelSize;
ptemp = (void const *)&OSTmrWheelTblSize;
#endif
ptemp = (void const *)&OSVersionNbr;
ptemp = (void const *)&OSDataSize;
ptemp = ptemp; /* Prevent compiler warning for 'ptemp' not being used! */
}
#endif