os_dbg_r.c
上传用户:tkwrx3909
上传日期:2015-10-06
资源大小:3310k
文件大小:11k
源码类别:

uCOS

开发平台:

Visual C++

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