PageRenderTime 244ms CodeModel.GetById 97ms app.highlight 19ms RepoModel.GetById 122ms app.codeStats 0ms

/src/compiler/ucos-vs2008/UCOS_SIM/src/ucosii/os_dbg_r.c

http://ftk.googlecode.com/
C | 256 lines | 169 code | 43 blank | 44 comment | 10 complexity | 350e11cde12e71a61270350cd49b6585 MD5 | raw file
  1/*
  2*********************************************************************************************************
  3*                                                uC/OS-II
  4*                                          The Real-Time Kernel
  5*                                           DEBUGGER CONSTANTS
  6*
  7*                           (c) Copyright 2003-2005, Jean J. Labrosse, Weston, FL
  8*                                           All Rights Reserved
  9*
 10* File    : OS_DBG.C
 11* By      : Jean J. Labrosse
 12* Version : V2.80
 13*********************************************************************************************************
 14*/
 15
 16#include <ucos_ii.h>

 17
 18/*
 19*********************************************************************************************************
 20*                                             DEBUG DATA
 21*********************************************************************************************************
 22*/
 23
 24INT16U  const  OSDebugEn          = OS_DEBUG_EN;                /* Debug constants are defined below   */
 25
 26#if OS_DEBUG_EN > 0

 27
 28INT32U  const  OSEndiannessTest   = 0x12345678L;                /* Variable to test CPU endianness     */
 29
 30INT16U  const  OSEventEn          = OS_EVENT_EN;
 31INT16U  const  OSEventMax         = OS_MAX_EVENTS;              /* Number of event control blocks      */
 32INT16U  const  OSEventNameSize    = OS_EVENT_NAME_SIZE;         /* Size (in bytes) of event names      */
 33#if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0)

 34INT16U  const  OSEventSize        = sizeof(OS_EVENT);           /* Size in Bytes of OS_EVENT           */
 35INT16U  const  OSEventTblSize     = sizeof(OSEventTbl);         /* Size of OSEventTbl[] in bytes       */
 36#else

 37INT16U  const  OSEventSize        = 0;
 38INT16U  const  OSEventTblSize     = 0;
 39#endif

 40
 41INT16U  const  OSFlagEn           = OS_FLAG_EN;
 42#if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)

 43INT16U  const  OSFlagGrpSize      = sizeof(OS_FLAG_GRP);        /* Size in Bytes of OS_FLAG_GRP        */
 44INT16U  const  OSFlagNodeSize     = sizeof(OS_FLAG_NODE);       /* Size in Bytes of OS_FLAG_NODE       */
 45INT16U  const  OSFlagWidth        = sizeof(OS_FLAGS);           /* Width (in bytes) of OS_FLAGS        */
 46#else

 47INT16U  const  OSFlagGrpSize      = 0;
 48INT16U  const  OSFlagNodeSize     = 0;
 49INT16U  const  OSFlagWidth        = 0;
 50#endif

 51INT16U  const  OSFlagMax          = OS_MAX_FLAGS;
 52INT16U  const  OSFlagNameSize     = OS_FLAG_NAME_SIZE;          /* Size (in bytes) of flag names       */
 53
 54INT16U  const  OSLowestPrio       = OS_LOWEST_PRIO;
 55
 56INT16U  const  OSMboxEn           = OS_MBOX_EN;
 57
 58INT16U  const  OSMemEn            = OS_MEM_EN;
 59INT16U  const  OSMemMax           = OS_MAX_MEM_PART;            /* Number of memory partitions         */
 60INT16U  const  OSMemNameSize      = OS_MEM_NAME_SIZE;           /* Size (in bytes) of partition names  */
 61#if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)

 62INT16U  const  OSMemSize          = sizeof(OS_MEM);             /* Mem. Partition header sine (bytes)  */
 63INT16U  const  OSMemTblSize       = sizeof(OSMemTbl);
 64#else

 65INT16U  const  OSMemSize          = 0;
 66INT16U  const  OSMemTblSize       = 0;
 67#endif

 68INT16U  const  OSMutexEn          = OS_MUTEX_EN;
 69
 70INT16U  const  OSPtrSize          = sizeof(void *);             /* Size in Bytes of a pointer          */
 71
 72INT16U  const  OSQEn              = OS_Q_EN;
 73INT16U  const  OSQMax             = OS_MAX_QS;                  /* Number of queues                    */
 74#if (OS_Q_EN > 0) && (OS_MAX_QS > 0)

 75INT16U  const  OSQSize            = sizeof(OS_Q);               /* Size in bytes of OS_Q structure     */
 76#else

 77INT16U  const  OSQSize            = 0;
 78#endif

 79
 80INT16U  const  OSRdyTblSize       = OS_RDY_TBL_SIZE;            /* Number of bytes in the ready table  */
 81
 82INT16U  const  OSSemEn            = OS_SEM_EN;
 83
 84INT16U  const  OSStkWidth         = sizeof(OS_STK);             /* Size in Bytes of a stack entry      */
 85
 86INT16U  const  OSTaskCreateEn     = OS_TASK_CREATE_EN;
 87INT16U  const  OSTaskCreateExtEn  = OS_TASK_CREATE_EXT_EN;
 88INT16U  const  OSTaskDelEn        = OS_TASK_DEL_EN;
 89INT16U  const  OSTaskIdleStkSize  = OS_TASK_IDLE_STK_SIZE;
 90INT16U  const  OSTaskProfileEn    = OS_TASK_PROFILE_EN;
 91INT16U  const  OSTaskMax          = OS_MAX_TASKS + OS_N_SYS_TASKS;  /* Total max. number of tasks      */
 92INT16U  const  OSTaskNameSize     = OS_TASK_NAME_SIZE;              /* Size (in bytes) of task names   */
 93INT16U  const  OSTaskStatEn       = OS_TASK_STAT_EN;
 94INT16U  const  OSTaskStatStkSize  = OS_TASK_STAT_STK_SIZE;
 95INT16U  const  OSTaskStatStkChkEn = OS_TASK_STAT_STK_CHK_EN;
 96INT16U  const  OSTaskSwHookEn     = OS_TASK_SW_HOOK_EN;
 97
 98INT16U  const  OSTCBPrioTblMax    = OS_LOWEST_PRIO + 1;         /* Number of entries in OSTCBPrioTbl[] */
 99INT16U  const  OSTCBSize          = sizeof(OS_TCB);             /* Size in Bytes of OS_TCB             */
100INT16U  const  OSTicksPerSec      = OS_TICKS_PER_SEC;
101INT16U  const  OSTimeTickHookEn   = OS_TIME_TICK_HOOK_EN;
102INT16U  const  OSVersionNbr       = OS_VERSION;
103
104#endif

105
106/*$PAGE*/
107/*
108*********************************************************************************************************
109*                                             DEBUG DATA
110*                            TOTAL DATA SPACE (i.e. RAM) USED BY uC/OS-II
111*********************************************************************************************************
112*/
113#if OS_DEBUG_EN > 0

114
115INT16U  const  OSDataSize = sizeof(OSCtxSwCtr)
116#if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0)

117                          + sizeof(OSEventFreeList)
118                          + sizeof(OSEventTbl)
119#endif

120#if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)

121                          + sizeof(OSFlagTbl)
122                          + sizeof(OSFlagFreeList)
123#endif

124#if OS_TASK_STAT_EN > 0

125                          + sizeof(OSCPUUsage)
126                          + sizeof(OSIdleCtrMax)
127                          + sizeof(OSIdleCtrRun)
128                          + sizeof(OSStatRdy)
129                          + sizeof(OSTaskStatStk)
130#endif

131#if OS_TICK_STEP_EN > 0

132                          + sizeof(OSTickStepState)
133#endif

134#if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)

135                          + sizeof(OSMemFreeList)
136                          + sizeof(OSMemTbl)
137#endif

138#if (OS_Q_EN > 0) && (OS_MAX_QS > 0)

139                          + sizeof(OSQFreeList)
140                          + sizeof(OSQTbl)
141#endif

142#if OS_TIME_GET_SET_EN > 0   

143                          + sizeof(OSTime)
144#endif

145                          + sizeof(OSIntNesting)
146                          + sizeof(OSLockNesting)
147                          + sizeof(OSPrioCur)
148                          + sizeof(OSPrioHighRdy)
149                          + sizeof(OSRdyGrp)
150                          + sizeof(OSRdyTbl)
151                          + sizeof(OSRunning)
152                          + sizeof(OSTaskCtr)
153                          + sizeof(OSIdleCtr)
154                          + sizeof(OSTaskIdleStk)
155                          + sizeof(OSTCBCur)
156                          + sizeof(OSTCBFreeList)
157                          + sizeof(OSTCBHighRdy)
158                          + sizeof(OSTCBList)
159                          + sizeof(OSTCBPrioTbl)
160                          + sizeof(OSTCBTbl);
161
162#endif

163
164/*$PAGE*/
165/*
166*********************************************************************************************************
167*                                        OS DEBUG INITIALIZATION
168*
169* Description: This function is used to make sure that debug variables that are unused in the application
170*              are not optimized away.  This function might not be necessary for all compilers.  In this
171*              case, you should simply DELETE the code in this function while still leaving the declaration
172*              of the function itself.
173*
174* Arguments  : none
175*
176* Returns    : none
177*
178* Note(s)    : (1) This code doesn't do anything, it simply prevents the compiler from optimizing out
179*                  the 'const' variables which are declared in this file.
180*              (2) You may decide to 'compile out' the code (by using #ff 0/#endif) INSIDE the function 
181*                  if your compiler DOES NOT optimize out the 'const' variables above.
182*********************************************************************************************************
183*/
184
185#if OS_VERSION >= 270 && OS_DEBUG_EN > 0

186void  OSDebugInit (void)
187{
188    void  *ptemp;
189
190    
191    ptemp = (void *)&OSDebugEn;
192
193    ptemp = (void *)&OSEndiannessTest;
194
195    ptemp = (void *)&OSEventMax;
196    ptemp = (void *)&OSEventNameSize;
197    ptemp = (void *)&OSEventEn;
198    ptemp = (void *)&OSEventSize;
199    ptemp = (void *)&OSEventTblSize;
200
201    ptemp = (void *)&OSFlagEn;
202    ptemp = (void *)&OSFlagGrpSize;
203    ptemp = (void *)&OSFlagNodeSize;
204    ptemp = (void *)&OSFlagWidth;
205    ptemp = (void *)&OSFlagMax;
206    ptemp = (void *)&OSFlagNameSize;
207
208    ptemp = (void *)&OSLowestPrio;
209
210    ptemp = (void *)&OSMboxEn;
211
212    ptemp = (void *)&OSMemEn;
213    ptemp = (void *)&OSMemMax;
214    ptemp = (void *)&OSMemNameSize;
215    ptemp = (void *)&OSMemSize;
216    ptemp = (void *)&OSMemTblSize;
217
218    ptemp = (void *)&OSMutexEn;
219
220    ptemp = (void *)&OSPtrSize;
221
222    ptemp = (void *)&OSQEn;
223    ptemp = (void *)&OSQMax;
224    ptemp = (void *)&OSQSize;
225
226    ptemp = (void *)&OSRdyTblSize;
227
228    ptemp = (void *)&OSSemEn;
229
230    ptemp = (void *)&OSStkWidth;
231
232    ptemp = (void *)&OSTaskCreateEn;
233    ptemp = (void *)&OSTaskCreateExtEn;
234    ptemp = (void *)&OSTaskDelEn;
235    ptemp = (void *)&OSTaskIdleStkSize;
236    ptemp = (void *)&OSTaskProfileEn;
237    ptemp = (void *)&OSTaskMax;
238    ptemp = (void *)&OSTaskNameSize;
239    ptemp = (void *)&OSTaskStatEn;
240    ptemp = (void *)&OSTaskStatStkSize;
241    ptemp = (void *)&OSTaskStatStkChkEn;
242    ptemp = (void *)&OSTaskSwHookEn;
243
244    ptemp = (void *)&OSTCBPrioTblMax;
245    ptemp = (void *)&OSTCBSize;
246
247    ptemp = (void *)&OSTicksPerSec;
248    ptemp = (void *)&OSTimeTickHookEn;
249
250    ptemp = (void *)&OSVersionNbr;
251
252    ptemp = (void *)&OSDataSize;
253
254    ptemp = ptemp;                             /* Prevent compiler warning for 'ptemp' not being used! */
255}
256#endif