os_dbg_r.c 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. /*
  2. *********************************************************************************************************
  3. * uC/OS-II
  4. * The Real-Time Kernel
  5. * DEBUGGER CONSTANTS
  6. *
  7. * (c) Copyright 1992-2009, Micrium, Weston, FL
  8. * All Rights Reserved
  9. *
  10. * File : OS_DBG.C
  11. * By : Jean J. Labrosse
  12. * Version : V2.91
  13. *
  14. * LICENSING TERMS:
  15. * ---------------
  16. * uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.
  17. * If you plan on using uC/OS-II in a commercial product you need to contact Micriµm to properly license
  18. * its use in your product. We provide ALL the source code for your convenience and to help you experience
  19. * uC/OS-II. The fact that the source is provided does NOT mean that you can use it without paying a
  20. * licensing fee.
  21. *********************************************************************************************************
  22. */
  23. #include <ucos_ii.h>
  24. /*
  25. *********************************************************************************************************
  26. * DEBUG DATA
  27. *********************************************************************************************************
  28. */
  29. INT16U const OSDebugEn = OS_DEBUG_EN; /* Debug constants are defined below */
  30. #if OS_DEBUG_EN > 0u
  31. INT32U const OSEndiannessTest = 0x12345678uL; /* Variable to test CPU endianness */
  32. INT16U const OSEventEn = OS_EVENT_EN;
  33. INT16U const OSEventMax = OS_MAX_EVENTS; /* Number of event control blocks */
  34. INT16U const OSEventNameEn = OS_EVENT_NAME_EN;
  35. #if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u)
  36. INT16U const OSEventSize = sizeof(OS_EVENT); /* Size in Bytes of OS_EVENT */
  37. INT16U const OSEventTblSize = sizeof(OSEventTbl); /* Size of OSEventTbl[] in bytes */
  38. #else
  39. INT16U const OSEventSize = 0u;
  40. INT16U const OSEventTblSize = 0u;
  41. #endif
  42. INT16U const OSEventMultiEn = OS_EVENT_MULTI_EN;
  43. INT16U const OSFlagEn = OS_FLAG_EN;
  44. #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
  45. INT16U const OSFlagGrpSize = sizeof(OS_FLAG_GRP); /* Size in Bytes of OS_FLAG_GRP */
  46. INT16U const OSFlagNodeSize = sizeof(OS_FLAG_NODE); /* Size in Bytes of OS_FLAG_NODE */
  47. INT16U const OSFlagWidth = sizeof(OS_FLAGS); /* Width (in bytes) of OS_FLAGS */
  48. #else
  49. INT16U const OSFlagGrpSize = 0u;
  50. INT16U const OSFlagNodeSize = 0u;
  51. INT16U const OSFlagWidth = 0u;
  52. #endif
  53. INT16U const OSFlagMax = OS_MAX_FLAGS;
  54. INT16U const OSFlagNameEn = OS_FLAG_NAME_EN;
  55. INT16U const OSLowestPrio = OS_LOWEST_PRIO;
  56. INT16U const OSMboxEn = OS_MBOX_EN;
  57. INT16U const OSMemEn = OS_MEM_EN;
  58. INT16U const OSMemMax = OS_MAX_MEM_PART; /* Number of memory partitions */
  59. INT16U const OSMemNameEn = OS_MEM_NAME_EN;
  60. #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
  61. INT16U const OSMemSize = sizeof(OS_MEM); /* Mem. Partition header sine (bytes) */
  62. INT16U const OSMemTblSize = sizeof(OSMemTbl);
  63. #else
  64. INT16U const OSMemSize = 0u;
  65. INT16U const OSMemTblSize = 0u;
  66. #endif
  67. INT16U const OSMutexEn = OS_MUTEX_EN;
  68. INT16U const OSPtrSize = sizeof(void *); /* Size in Bytes of a pointer */
  69. INT16U const OSQEn = OS_Q_EN;
  70. INT16U const OSQMax = OS_MAX_QS; /* Number of queues */
  71. #if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u)
  72. INT16U const OSQSize = sizeof(OS_Q); /* Size in bytes of OS_Q structure */
  73. #else
  74. INT16U const OSQSize = 0u;
  75. #endif
  76. INT16U const OSRdyTblSize = OS_RDY_TBL_SIZE; /* Number of bytes in the ready table */
  77. INT16U const OSSemEn = OS_SEM_EN;
  78. INT16U const OSStkWidth = sizeof(OS_STK); /* Size in Bytes of a stack entry */
  79. INT16U const OSTaskCreateEn = OS_TASK_CREATE_EN;
  80. INT16U const OSTaskCreateExtEn = OS_TASK_CREATE_EXT_EN;
  81. INT16U const OSTaskDelEn = OS_TASK_DEL_EN;
  82. INT16U const OSTaskIdleStkSize = OS_TASK_IDLE_STK_SIZE;
  83. INT16U const OSTaskProfileEn = OS_TASK_PROFILE_EN;
  84. INT16U const OSTaskMax = OS_MAX_TASKS + OS_N_SYS_TASKS; /* Total max. number of tasks */
  85. INT16U const OSTaskNameEn = OS_TASK_NAME_EN;
  86. INT16U const OSTaskStatEn = OS_TASK_STAT_EN;
  87. INT16U const OSTaskStatStkSize = OS_TASK_STAT_STK_SIZE;
  88. INT16U const OSTaskStatStkChkEn = OS_TASK_STAT_STK_CHK_EN;
  89. INT16U const OSTaskSwHookEn = OS_TASK_SW_HOOK_EN;
  90. INT16U const OSTaskRegTblSize = OS_TASK_REG_TBL_SIZE;
  91. INT16U const OSTCBPrioTblMax = OS_LOWEST_PRIO + 1u; /* Number of entries in OSTCBPrioTbl[] */
  92. INT16U const OSTCBSize = sizeof(OS_TCB); /* Size in Bytes of OS_TCB */
  93. INT16U const OSTicksPerSec = OS_TICKS_PER_SEC;
  94. INT16U const OSTimeTickHookEn = OS_TIME_TICK_HOOK_EN;
  95. INT16U const OSVersionNbr = OS_VERSION;
  96. INT16U const OSTmrEn = OS_TMR_EN;
  97. INT16U const OSTmrCfgMax = OS_TMR_CFG_MAX;
  98. INT16U const OSTmrCfgNameEn = OS_TMR_CFG_NAME_EN;
  99. INT16U const OSTmrCfgWheelSize = OS_TMR_CFG_WHEEL_SIZE;
  100. INT16U const OSTmrCfgTicksPerSec = OS_TMR_CFG_TICKS_PER_SEC;
  101. #if (OS_TMR_EN > 0u) && (OS_TMR_CFG_MAX > 0u)
  102. INT16U const OSTmrSize = sizeof(OS_TMR);
  103. INT16U const OSTmrTblSize = sizeof(OSTmrTbl);
  104. INT16U const OSTmrWheelSize = sizeof(OS_TMR_WHEEL);
  105. INT16U const OSTmrWheelTblSize = sizeof(OSTmrWheelTbl);
  106. #else
  107. INT16U const OSTmrSize = 0u;
  108. INT16U const OSTmrTblSize = 0u;
  109. INT16U const OSTmrWheelSize = 0u;
  110. INT16U const OSTmrWheelTblSize = 0u;
  111. #endif
  112. #endif
  113. /*$PAGE*/
  114. /*
  115. *********************************************************************************************************
  116. * DEBUG DATA
  117. * TOTAL DATA SPACE (i.e. RAM) USED BY uC/OS-II
  118. *********************************************************************************************************
  119. */
  120. #if OS_DEBUG_EN > 0u
  121. INT16U const OSDataSize = sizeof(OSCtxSwCtr)
  122. #if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u)
  123. + sizeof(OSEventFreeList)
  124. + sizeof(OSEventTbl)
  125. #endif
  126. #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
  127. + sizeof(OSFlagTbl)
  128. + sizeof(OSFlagFreeList)
  129. #endif
  130. #if OS_TASK_STAT_EN > 0u
  131. + sizeof(OSCPUUsage)
  132. + sizeof(OSIdleCtrMax)
  133. + sizeof(OSIdleCtrRun)
  134. + sizeof(OSStatRdy)
  135. + sizeof(OSTaskStatStk)
  136. #endif
  137. #if OS_TICK_STEP_EN > 0u
  138. + sizeof(OSTickStepState)
  139. #endif
  140. #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
  141. + sizeof(OSMemFreeList)
  142. + sizeof(OSMemTbl)
  143. #endif
  144. #if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u)
  145. + sizeof(OSQFreeList)
  146. + sizeof(OSQTbl)
  147. #endif
  148. #if OS_TIME_GET_SET_EN > 0u
  149. + sizeof(OSTime)
  150. #endif
  151. #if (OS_TMR_EN > 0u) && (OS_TMR_CFG_MAX > 0u)
  152. + sizeof(OSTmrFree)
  153. + sizeof(OSTmrUsed)
  154. + sizeof(OSTmrTime)
  155. + sizeof(OSTmrSem)
  156. + sizeof(OSTmrSemSignal)
  157. + sizeof(OSTmrTbl)
  158. + sizeof(OSTmrFreeList)
  159. + sizeof(OSTmrTaskStk)
  160. + sizeof(OSTmrWheelTbl)
  161. #endif
  162. + sizeof(OSIntNesting)
  163. + sizeof(OSLockNesting)
  164. + sizeof(OSPrioCur)
  165. + sizeof(OSPrioHighRdy)
  166. + sizeof(OSRdyGrp)
  167. + sizeof(OSRdyTbl)
  168. + sizeof(OSRunning)
  169. + sizeof(OSTaskCtr)
  170. + sizeof(OSIdleCtr)
  171. + sizeof(OSTaskIdleStk)
  172. + sizeof(OSTCBCur)
  173. + sizeof(OSTCBFreeList)
  174. + sizeof(OSTCBHighRdy)
  175. + sizeof(OSTCBList)
  176. + sizeof(OSTCBPrioTbl)
  177. + sizeof(OSTCBTbl);
  178. #endif
  179. /*$PAGE*/
  180. /*
  181. *********************************************************************************************************
  182. * OS DEBUG INITIALIZATION
  183. *
  184. * Description: This function is used to make sure that debug variables that are unused in the application
  185. * are not optimized away. This function might not be necessary for all compilers. In this
  186. * case, you should simply DELETE the code in this function while still leaving the declaration
  187. * of the function itself.
  188. *
  189. * Arguments : none
  190. *
  191. * Returns : none
  192. *
  193. * Note(s) : (1) This code doesn't do anything, it simply prevents the compiler from optimizing out
  194. * the 'const' variables which are declared in this file.
  195. * (2) You may decide to 'compile out' the code (by using #if 0/#endif) INSIDE the function
  196. * if your compiler DOES NOT optimize out the 'const' variables above.
  197. *********************************************************************************************************
  198. */
  199. #if OS_DEBUG_EN > 0u
  200. void OSDebugInit (void)
  201. {
  202. void const *ptemp;
  203. ptemp = (void const *)&OSDebugEn;
  204. ptemp = (void const *)&OSEndiannessTest;
  205. ptemp = (void const *)&OSEventMax;
  206. ptemp = (void const *)&OSEventNameEn;
  207. ptemp = (void const *)&OSEventEn;
  208. ptemp = (void const *)&OSEventSize;
  209. ptemp = (void const *)&OSEventTblSize;
  210. ptemp = (void const *)&OSEventMultiEn;
  211. ptemp = (void const *)&OSFlagEn;
  212. ptemp = (void const *)&OSFlagGrpSize;
  213. ptemp = (void const *)&OSFlagNodeSize;
  214. ptemp = (void const *)&OSFlagWidth;
  215. ptemp = (void const *)&OSFlagMax;
  216. ptemp = (void const *)&OSFlagNameEn;
  217. ptemp = (void const *)&OSLowestPrio;
  218. ptemp = (void const *)&OSMboxEn;
  219. ptemp = (void const *)&OSMemEn;
  220. ptemp = (void const *)&OSMemMax;
  221. ptemp = (void const *)&OSMemNameEn;
  222. ptemp = (void const *)&OSMemSize;
  223. ptemp = (void const *)&OSMemTblSize;
  224. ptemp = (void const *)&OSMutexEn;
  225. ptemp = (void const *)&OSPtrSize;
  226. ptemp = (void const *)&OSQEn;
  227. ptemp = (void const *)&OSQMax;
  228. ptemp = (void const *)&OSQSize;
  229. ptemp = (void const *)&OSRdyTblSize;
  230. ptemp = (void const *)&OSSemEn;
  231. ptemp = (void const *)&OSStkWidth;
  232. ptemp = (void const *)&OSTaskCreateEn;
  233. ptemp = (void const *)&OSTaskCreateExtEn;
  234. ptemp = (void const *)&OSTaskDelEn;
  235. ptemp = (void const *)&OSTaskIdleStkSize;
  236. ptemp = (void const *)&OSTaskProfileEn;
  237. ptemp = (void const *)&OSTaskMax;
  238. ptemp = (void const *)&OSTaskNameEn;
  239. ptemp = (void const *)&OSTaskStatEn;
  240. ptemp = (void const *)&OSTaskStatStkSize;
  241. ptemp = (void const *)&OSTaskStatStkChkEn;
  242. ptemp = (void const *)&OSTaskSwHookEn;
  243. ptemp = (void const *)&OSTCBPrioTblMax;
  244. ptemp = (void const *)&OSTCBSize;
  245. ptemp = (void const *)&OSTicksPerSec;
  246. ptemp = (void const *)&OSTimeTickHookEn;
  247. #if OS_TMR_EN > 0u
  248. ptemp = (void const *)&OSTmrTbl[0];
  249. ptemp = (void const *)&OSTmrWheelTbl[0];
  250. ptemp = (void const *)&OSTmrEn;
  251. ptemp = (void const *)&OSTmrCfgMax;
  252. ptemp = (void const *)&OSTmrCfgNameEn;
  253. ptemp = (void const *)&OSTmrCfgWheelSize;
  254. ptemp = (void const *)&OSTmrCfgTicksPerSec;
  255. ptemp = (void const *)&OSTmrSize;
  256. ptemp = (void const *)&OSTmrTblSize;
  257. ptemp = (void const *)&OSTmrWheelSize;
  258. ptemp = (void const *)&OSTmrWheelTblSize;
  259. #endif
  260. ptemp = (void const *)&OSVersionNbr;
  261. ptemp = (void const *)&OSDataSize;
  262. ptemp = ptemp; /* Prevent compiler warning for 'ptemp' not being used! */
  263. }
  264. #endif