os_dbg_r.c
上传用户:dongxin
上传日期:2022-06-22
资源大小:370k
文件大小:12k
源码类别:

uCOS

开发平台:

Others

  1. /*
  2. *********************************************************************************************************
  3. *                                                uC/OS-II
  4. *                                          The Real-Time Kernel
  5. *                                           DEBUGGER CONSTANTS
  6. *
  7. *                              (c) Copyright 1992-2007, Micrium, Weston, FL
  8. *                                           All Rights Reserved
  9. *
  10. * File    : OS_DBG.C
  11. * By      : Jean J. Labrosse
  12. * Version : V2.86
  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. /*
  25. *********************************************************************************************************
  26. *                                             DEBUG DATA
  27. *********************************************************************************************************
  28. */
  29. INT16U  const  OSDebugEn           = OS_DEBUG_EN;               /* Debug constants are defined below   */
  30. #if OS_DEBUG_EN > 0
  31. INT32U  const  OSEndiannessTest    = 0x12345678L;               /* 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  OSEventNameSize     = OS_EVENT_NAME_SIZE;        /* Size (in bytes) of event names      */
  35. #if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0)
  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         = 0;
  40. INT16U  const  OSEventTblSize      = 0;
  41. #endif
  42. INT16U  const  OSEventMultiEn      = OS_EVENT_MULTI_EN;
  43. INT16U  const  OSFlagEn            = OS_FLAG_EN;
  44. #if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
  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       = 0;
  50. INT16U  const  OSFlagNodeSize      = 0;
  51. INT16U  const  OSFlagWidth         = 0;
  52. #endif
  53. INT16U  const  OSFlagMax           = OS_MAX_FLAGS;
  54. INT16U  const  OSFlagNameSize      = OS_FLAG_NAME_SIZE;         /* Size (in bytes) of flag names       */
  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  OSMemNameSize       = OS_MEM_NAME_SIZE;          /* Size (in bytes) of partition names  */
  60. #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
  61. INT16U  const  OSMemSize           = sizeof(OS_MEM);            /* Mem. Partition header sine (bytes)  */
  62. INT16U  const  OSMemTblSize        = sizeof(OSMemTbl);
  63. #else
  64. INT16U  const  OSMemSize           = 0;
  65. INT16U  const  OSMemTblSize        = 0;
  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 > 0) && (OS_MAX_QS > 0)
  72. INT16U  const  OSQSize             = sizeof(OS_Q);              /* Size in bytes of OS_Q structure     */
  73. #else
  74. INT16U  const  OSQSize             = 0;
  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  OSTaskNameSize      = OS_TASK_NAME_SIZE;             /* Size (in bytes) of task names   */
  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  OSTCBPrioTblMax     = OS_LOWEST_PRIO + 1;        /* Number of entries in OSTCBPrioTbl[] */
  91. INT16U  const  OSTCBSize           = sizeof(OS_TCB);            /* Size in Bytes of OS_TCB             */
  92. INT16U  const  OSTicksPerSec       = OS_TICKS_PER_SEC;
  93. INT16U  const  OSTimeTickHookEn    = OS_TIME_TICK_HOOK_EN;
  94. INT16U  const  OSVersionNbr        = OS_VERSION;
  95. INT16U  const  OSTmrEn             = OS_TMR_EN;
  96. INT16U  const  OSTmrCfgMax         = OS_TMR_CFG_MAX;
  97. INT16U  const  OSTmrCfgNameSize    = OS_TMR_CFG_NAME_SIZE;
  98. INT16U  const  OSTmrCfgWheelSize   = OS_TMR_CFG_WHEEL_SIZE;
  99. INT16U  const  OSTmrCfgTicksPerSec = OS_TMR_CFG_TICKS_PER_SEC;
  100. #if (OS_TMR_EN > 0) && (OS_TMR_CFG_MAX > 0)
  101. INT16U  const  OSTmrSize           = sizeof(OS_TMR);
  102. INT16U  const  OSTmrTblSize        = sizeof(OSTmrTbl);
  103. INT16U  const  OSTmrWheelSize      = sizeof(OS_TMR_WHEEL);
  104. INT16U  const  OSTmrWheelTblSize   = sizeof(OSTmrWheelTbl);
  105. #else
  106. INT16U  const  OSTmrSize           = 0;
  107. INT16U  const  OSTmrTblSize        = 0;
  108. INT16U  const  OSTmrWheelSize      = 0;
  109. INT16U  const  OSTmrWheelTblSize   = 0;
  110. #endif
  111. #endif
  112. /*$PAGE*/
  113. /*
  114. *********************************************************************************************************
  115. *                                             DEBUG DATA
  116. *                            TOTAL DATA SPACE (i.e. RAM) USED BY uC/OS-II
  117. *********************************************************************************************************
  118. */
  119. #if OS_DEBUG_EN > 0
  120. INT16U  const  OSDataSize = sizeof(OSCtxSwCtr)
  121. #if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0)
  122.                           + sizeof(OSEventFreeList)
  123.                           + sizeof(OSEventTbl)
  124. #endif
  125. #if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
  126.                           + sizeof(OSFlagTbl)
  127.                           + sizeof(OSFlagFreeList)
  128. #endif
  129. #if OS_TASK_STAT_EN > 0
  130.                           + sizeof(OSCPUUsage)
  131.                           + sizeof(OSIdleCtrMax)
  132.                           + sizeof(OSIdleCtrRun)
  133.                           + sizeof(OSStatRdy)
  134.                           + sizeof(OSTaskStatStk)
  135. #endif
  136. #if OS_TICK_STEP_EN > 0
  137.                           + sizeof(OSTickStepState)
  138. #endif
  139. #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
  140.                           + sizeof(OSMemFreeList)
  141.                           + sizeof(OSMemTbl)
  142. #endif
  143. #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
  144.                           + sizeof(OSQFreeList)
  145.                           + sizeof(OSQTbl)
  146. #endif
  147. #if OS_TIME_GET_SET_EN > 0   
  148.                           + sizeof(OSTime)
  149. #endif
  150. #if (OS_TMR_EN > 0) && (OS_TMR_CFG_MAX > 0)
  151.                           + sizeof(OSTmrFree)
  152.                           + sizeof(OSTmrUsed)
  153.                           + sizeof(OSTmrTime)
  154.                           + sizeof(OSTmrSem)
  155.                           + sizeof(OSTmrSemSignal)
  156.                           + sizeof(OSTmrTbl)
  157.                           + sizeof(OSTmrFreeList)
  158.                           + sizeof(OSTmrTaskStk)
  159.                           + sizeof(OSTmrWheelTbl)
  160. #endif
  161.                           + sizeof(OSIntNesting)
  162.                           + sizeof(OSLockNesting)
  163.                           + sizeof(OSPrioCur)
  164.                           + sizeof(OSPrioHighRdy)
  165.                           + sizeof(OSRdyGrp)
  166.                           + sizeof(OSRdyTbl)
  167.                           + sizeof(OSRunning)
  168.                           + sizeof(OSTaskCtr)
  169.                           + sizeof(OSIdleCtr)
  170.                           + sizeof(OSTaskIdleStk)
  171.                           + sizeof(OSTCBCur)
  172.                           + sizeof(OSTCBFreeList)
  173.                           + sizeof(OSTCBHighRdy)
  174.                           + sizeof(OSTCBList)
  175.                           + sizeof(OSTCBPrioTbl)
  176.                           + sizeof(OSTCBTbl);
  177. #endif
  178. /*$PAGE*/
  179. /*
  180. *********************************************************************************************************
  181. *                                        OS DEBUG INITIALIZATION
  182. *
  183. * Description: This function is used to make sure that debug variables that are unused in the application
  184. *              are not optimized away.  This function might not be necessary for all compilers.  In this
  185. *              case, you should simply DELETE the code in this function while still leaving the declaration
  186. *              of the function itself.
  187. *
  188. * Arguments  : none
  189. *
  190. * Returns    : none
  191. *
  192. * Note(s)    : (1) This code doesn't do anything, it simply prevents the compiler from optimizing out
  193. *                  the 'const' variables which are declared in this file.
  194. *              (2) You may decide to 'compile out' the code (by using #if 0/#endif) INSIDE the function 
  195. *                  if your compiler DOES NOT optimize out the 'const' variables above.
  196. *********************************************************************************************************
  197. */
  198. #if OS_DEBUG_EN > 0
  199. void  OSDebugInit (void)
  200. {
  201.     void  *ptemp;
  202.     
  203.     ptemp = (void *)&OSDebugEn;
  204.     ptemp = (void *)&OSEndiannessTest;
  205.     ptemp = (void *)&OSEventMax;
  206.     ptemp = (void *)&OSEventNameSize;
  207.     ptemp = (void *)&OSEventEn;
  208.     ptemp = (void *)&OSEventSize;
  209.     ptemp = (void *)&OSEventTblSize;
  210.     ptemp = (void *)&OSEventMultiEn;
  211.     ptemp = (void *)&OSFlagEn;
  212.     ptemp = (void *)&OSFlagGrpSize;
  213.     ptemp = (void *)&OSFlagNodeSize;
  214.     ptemp = (void *)&OSFlagWidth;
  215.     ptemp = (void *)&OSFlagMax;
  216.     ptemp = (void *)&OSFlagNameSize;
  217.     ptemp = (void *)&OSLowestPrio;
  218.     ptemp = (void *)&OSMboxEn;
  219.     ptemp = (void *)&OSMemEn;
  220.     ptemp = (void *)&OSMemMax;
  221.     ptemp = (void *)&OSMemNameSize;
  222.     ptemp = (void *)&OSMemSize;
  223.     ptemp = (void *)&OSMemTblSize;
  224.     ptemp = (void *)&OSMutexEn;
  225.     ptemp = (void *)&OSPtrSize;
  226.     ptemp = (void *)&OSQEn;
  227.     ptemp = (void *)&OSQMax;
  228.     ptemp = (void *)&OSQSize;
  229.     ptemp = (void *)&OSRdyTblSize;
  230.     ptemp = (void *)&OSSemEn;
  231.     ptemp = (void *)&OSStkWidth;
  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.     ptemp = (void *)&OSTCBPrioTblMax;
  244.     ptemp = (void *)&OSTCBSize;
  245.     ptemp = (void *)&OSTicksPerSec;
  246.     ptemp = (void *)&OSTimeTickHookEn;
  247. #if OS_TMR_EN > 0
  248.     ptemp = (void *)&OSTmrTbl[0];
  249.     ptemp = (void *)&OSTmrWheelTbl[0];
  250.     
  251.     ptemp = (void *)&OSTmrEn;
  252.     ptemp = (void *)&OSTmrCfgMax;
  253.     ptemp = (void *)&OSTmrCfgNameSize;
  254.     ptemp = (void *)&OSTmrCfgWheelSize;
  255.     ptemp = (void *)&OSTmrCfgTicksPerSec;
  256.     ptemp = (void *)&OSTmrSize;
  257.     ptemp = (void *)&OSTmrTblSize;
  258.     ptemp = (void *)&OSTmrWheelSize;
  259.     ptemp = (void *)&OSTmrWheelTblSize;
  260. #endif
  261.     ptemp = (void *)&OSVersionNbr;
  262.     ptemp = (void *)&OSDataSize;
  263.     ptemp = ptemp;                             /* Prevent compiler warning for 'ptemp' not being used! */
  264. }
  265. #endif