os_dbg_r.c
上传用户:jingkewang
上传日期:2013-04-11
资源大小:917k
文件大小:10k
源码类别:

uCOS

开发平台:

Visual C++

  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. #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. #endif
  87. /*$PAGE*/
  88. /*
  89. *********************************************************************************************************
  90. *                                             DEBUG DATA
  91. *                            TOTAL DATA SPACE (i.e. RAM) USED BY uC/OS-II
  92. *********************************************************************************************************
  93. */
  94. #if OS_DEBUG_EN > 0
  95. INT16U  const  OSDataSize = sizeof(OSCtxSwCtr)
  96. #if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0)
  97.                           + sizeof(OSEventFreeList)
  98.                           + sizeof(OSEventTbl)
  99. #endif
  100. #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
  101.                           + sizeof(OSFlagTbl)
  102.                           + sizeof(OSFlagFreeList)
  103. #endif
  104. #if OS_TASK_STAT_EN > 0
  105.                           + sizeof(OSCPUUsage)
  106.                           + sizeof(OSIdleCtrMax)
  107.                           + sizeof(OSIdleCtrRun)
  108.                           + sizeof(OSStatRdy)
  109.                           + sizeof(OSTaskStatStk)
  110. #endif
  111. #if OS_TICK_STEP_EN > 0
  112.                           + sizeof(OSTickStepState)
  113. #endif
  114. #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
  115.                           + sizeof(OSMemFreeList)
  116.                           + sizeof(OSMemTbl)
  117. #endif
  118. #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
  119.                           + sizeof(OSQFreeList)
  120.                           + sizeof(OSQTbl)
  121. #endif
  122. #if OS_TIME_GET_SET_EN > 0   
  123.                           + sizeof(OSTime)
  124. #endif
  125.                           + sizeof(OSIntNesting)
  126.                           + sizeof(OSLockNesting)
  127.                           + sizeof(OSPrioCur)
  128.                           + sizeof(OSPrioHighRdy)
  129.                           + sizeof(OSRdyGrp)
  130.                           + sizeof(OSRdyTbl)
  131.                           + sizeof(OSRunning)
  132.                           + sizeof(OSTaskCtr)
  133.                           + sizeof(OSIdleCtr)
  134.                           + sizeof(OSTaskIdleStk)
  135.                           + sizeof(OSTCBCur)
  136.                           + sizeof(OSTCBFreeList)
  137.                           + sizeof(OSTCBHighRdy)
  138.                           + sizeof(OSTCBList)
  139.                           + sizeof(OSTCBPrioTbl)
  140.                           + sizeof(OSTCBTbl);
  141. #endif
  142. /*$PAGE*/
  143. /*
  144. *********************************************************************************************************
  145. *                                        OS DEBUG INITIALIZATION
  146. *
  147. * Description: This function is used to make sure that debug variables that are unused in the application
  148. *              are not optimized away.  This function might not be necessary for all compilers.  In this
  149. *              case, you should simply DELETE the code in this function while still leaving the declaration
  150. *              of the function itself.
  151. *
  152. * Arguments  : none
  153. *
  154. * Returns    : none
  155. *
  156. * Note(s)    : (1) This code doesn't do anything, it simply prevents the compiler from optimizing out
  157. *                  the 'const' variables which are declared in this file.
  158. *              (2) You may decide to 'compile out' the code (by using #ff 0/#endif) INSIDE the function 
  159. *                  if your compiler DOES NOT optimize out the 'const' variables above.
  160. *********************************************************************************************************
  161. */
  162. #if OS_VERSION >= 270 && OS_DEBUG_EN > 0
  163. void  OSDebugInit (void)
  164. {
  165.     void  *ptemp;
  166.     
  167.     ptemp = (void *)&OSDebugEn;
  168.     ptemp = (void *)&OSEndiannessTest;
  169.     ptemp = (void *)&OSEventMax;
  170.     ptemp = (void *)&OSEventNameSize;
  171.     ptemp = (void *)&OSEventEn;
  172.     ptemp = (void *)&OSEventSize;
  173.     ptemp = (void *)&OSEventTblSize;
  174.     ptemp = (void *)&OSFlagEn;
  175.     ptemp = (void *)&OSFlagGrpSize;
  176.     ptemp = (void *)&OSFlagNodeSize;
  177.     ptemp = (void *)&OSFlagWidth;
  178.     ptemp = (void *)&OSFlagMax;
  179.     ptemp = (void *)&OSFlagNameSize;
  180.     ptemp = (void *)&OSLowestPrio;
  181.     ptemp = (void *)&OSMboxEn;
  182.     ptemp = (void *)&OSMemEn;
  183.     ptemp = (void *)&OSMemMax;
  184.     ptemp = (void *)&OSMemNameSize;
  185.     ptemp = (void *)&OSMemSize;
  186.     ptemp = (void *)&OSMemTblSize;
  187.     ptemp = (void *)&OSMutexEn;
  188.     ptemp = (void *)&OSPtrSize;
  189.     ptemp = (void *)&OSQEn;
  190.     ptemp = (void *)&OSQMax;
  191.     ptemp = (void *)&OSQSize;
  192.     ptemp = (void *)&OSRdyTblSize;
  193.     ptemp = (void *)&OSSemEn;
  194.     ptemp = (void *)&OSStkWidth;
  195.     ptemp = (void *)&OSTaskCreateEn;
  196.     ptemp = (void *)&OSTaskCreateExtEn;
  197.     ptemp = (void *)&OSTaskDelEn;
  198.     ptemp = (void *)&OSTaskIdleStkSize;
  199.     ptemp = (void *)&OSTaskProfileEn;
  200.     ptemp = (void *)&OSTaskMax;
  201.     ptemp = (void *)&OSTaskNameSize;
  202.     ptemp = (void *)&OSTaskStatEn;
  203.     ptemp = (void *)&OSTaskStatStkSize;
  204.     ptemp = (void *)&OSTaskStatStkChkEn;
  205.     ptemp = (void *)&OSTaskSwHookEn;
  206.     ptemp = (void *)&OSTCBPrioTblMax;
  207.     ptemp = (void *)&OSTCBSize;
  208.     ptemp = (void *)&OSTicksPerSec;
  209.     ptemp = (void *)&OSTimeTickHookEn;
  210.     ptemp = (void *)&OSVersionNbr;
  211.     ptemp = (void *)&OSDataSize;
  212.     ptemp = ptemp;                             /* Prevent compiler warning for 'ptemp' not being used! */
  213. }
  214. #endif