os_dbg.c
上传用户:yj_qqy
上传日期:2017-01-28
资源大小:2911k
文件大小:13k
源码类别:

uCOS

开发平台:

C/C++

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