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

uCOS

开发平台:

C/C++

  1. /*
  2. ***********************************************************************************************
  3. *                                           uC/OS-View
  4. *
  5. *                            (c) Copyright 2005, Micrium, Weston, FL
  6. *                                       All Rights Reserved
  7. *
  8. *
  9. * Filename   : OS_VIEW.H
  10. * Version    : V1.33
  11. * Programmer : JJL
  12. ***********************************************************************************************
  13. */
  14. #ifdef   OS_VIEW_GLOBALS
  15. #define  OS_VIEW_EXT
  16. #else
  17. #define  OS_VIEW_EXT  extern
  18. #endif
  19. #ifndef  OS_VIEW_H
  20. #define  OS_VIEW_H
  21. /*
  22. ***********************************************************************************************
  23. *                                         VARIABLES
  24. ***********************************************************************************************
  25. */
  26. OS_VIEW_EXT  INT32U             OSView_CyclesCtr;
  27. #if OS_VIEW_TMR_32_BITS > 0
  28. OS_VIEW_EXT  INT32U             OSView_TmrCntsPrev;
  29. #else
  30. OS_VIEW_EXT  INT16U             OSView_TmrCntsPrev;
  31. #endif
  32. OS_VIEW_EXT  INT8U              OSView_RxState;
  33. OS_VIEW_EXT  INT8U              OSView_RxRemainLen;
  34. OS_VIEW_EXT  INT8U              OSView_RxChkSum;
  35. OS_VIEW_EXT  INT8U              OSView_RxBuf[OS_VIEW_RX_BUF_SIZE];
  36. OS_VIEW_EXT  INT8U              OSView_RxBufCnt;
  37. OS_VIEW_EXT  INT8U              OSView_RxRdIx;
  38. OS_VIEW_EXT  INT32U             OSView_RxCtr;
  39. OS_VIEW_EXT  INT16U             OSView_RxPktCtr;
  40. OS_VIEW_EXT  INT16U             OSView_TxLen;
  41. OS_VIEW_EXT  INT16U             OSView_TxIx;
  42. OS_VIEW_EXT  INT8U              OSView_TxChkSum;
  43. OS_VIEW_EXT  INT8U              OSView_TxState;
  44. OS_VIEW_EXT  BOOLEAN            OSView_TxActiveFlag;
  45. OS_VIEW_EXT  INT8U              OSView_TxBuf[OS_VIEW_TX_BUF_SIZE];
  46. OS_VIEW_EXT  INT16U             OSView_TxBufCnt;
  47. OS_VIEW_EXT  INT8U             *OSView_TxBufPtr;
  48. OS_VIEW_EXT  INT32U             OSView_TxCtr;
  49. OS_VIEW_EXT  INT16U             OSView_TxPktCtr;
  50. OS_VIEW_EXT  INT16U             OSView_TxStrLen;
  51. OS_VIEW_EXT  INT8U              OSView_TxStrBuf[OS_VIEW_TX_STR_SIZE];
  52. OS_VIEW_EXT  INT16U             OSView_TxStrDlyCtr;
  53. OS_VIEW_EXT  void             (*OSView_TerminalRxCallbackFnct)(INT8U data);
  54. /*
  55. ***********************************************************************************************
  56. *                                        PROTOTYPES
  57. *                                    (PORT INDEPENDENT)
  58. ***********************************************************************************************
  59. */
  60. void    OSView_Init(INT32U baud_rate);              /* Initialize uC/OS-View                          */
  61. void    OSView_RxHandler(INT8U data);               /* Processor independent Rx handler               */
  62. void    OSView_TxHandler(void);                     /* Processor independent Tx handler               */
  63. void    OSView_TxStr(INT8U *s, INT16U dly);         /* Send an ASCII string to terminal window        */
  64. void    OSView_TaskSwHook(void);                    /* MUST be called by OSTaskSwHook()               */
  65. void    OSView_TaskCreateHook(OS_TCB *ptcb);        /* MUST be called by OSTaskCreateHook()           */
  66. void    OSView_TickHook(void);                      /* MUST be called by OSTimeTickHook()             */
  67. void    OSView_Exit(void);                          /* Exit uC/OS-View                                */
  68. void    OSView_InitTarget(INT32U baud_rate);        /* Initialize the target specifics                */
  69. void    OSView_TerminalRxSetCallback(void (*call_back)(INT8U data));
  70. void    OSView_TerminalTx(INT8U data);              /* Write data to output window                    */
  71. INT32U  OSView_TimeGetCycles(void);                 /* Function to read fine resolution time base     */
  72. void    OSView_RxTxISR(void);                       /* Assembly Language Rx/Tx ISR                    */
  73. void    OSView_RxTxISRHandler(void);                /* C code to process Rx or Tx character           */
  74. void    OSView_RxISR(void);                         /* Assembly Language Rx ISR                       */
  75. void    OSView_RxISRHandler(void);                  /* C code to process character received           */
  76. void    OSView_RxIntEn(void);                       /* Enable  Rx interrupts                          */
  77. void    OSView_RxIntDis(void);                      /* Disable Rx interrupts                          */
  78. void    OSView_TxISR(void);                         /* Assembly Language Tx ISR                       */
  79. void    OSView_TxISRHandler(void);                  /* C code to process next character to send       */
  80. void    OSView_TxIntEn(void);                       /* Enable  Tx interrupts                          */
  81. void    OSView_TxIntDis(void);                      /* Disable Tx interrupts                          */
  82. void    OSView_Tx1(INT8U c);                        /* Function to send a single character            */
  83. void    OSView_GetCPUName(INT8U *s);                /* Returns the name of the CPU used               */
  84. INT32U  OSView_GetIntStkBase(void);                 /* Get the address of the interrupt stack base    */
  85. INT32U  OSView_GetIntStkSize(void);                 /* Get the address of the interrupt stack size    */
  86. /*
  87. *********************************************************************************************************
  88. *                                      BSP FUNCTION PROTOTYPES
  89. *********************************************************************************************************
  90. */
  91. void     OSView_TmrInit(void);                      /* Initialize the free running timer               */
  92. INT32U   OSView_TmrRd(void);                        /* Read       the free running timer               */
  93. /*
  94. ***********************************************************************************************
  95. *                                         #error DIRECTIVES
  96. ***********************************************************************************************
  97. */
  98. #if     OS_VIEW_PARSE_TASK > 0 && (OS_SEM_EN == 0 && OS_MBOX_EN == 0)
  99. #error  "Semaphore or Mailbox management must be enabled.  In other words, OS_SEM_EN or OS_MBOX_EN must be set to 1."
  100. #endif
  101. #if     OS_TIME_GET_SET_EN == 0
  102. #error  "OS_CFG.H, OS_TIME_GET_SET_EN needs to be set to 1 to include code for OSTimeGet()"
  103. #endif
  104. #if     OS_TASK_CREATE_EXT_EN == 0
  105. #error  "OS_CFG.H, OS_TASK_CREATE_EXT_EN needs to be set to 1 to include code for OSTaskCreateExt()"
  106. #endif
  107. #if     OS_TASK_STAT_EN == 0
  108. #error  "OS_CFG.H, OS_TASK_STAT_EN needs to be set to 1 to include code for the statistics task"
  109. #endif
  110. #if     OS_TASK_STAT_STK_CHK_EN == 0
  111. #error  "OS_CFG.H, OS_TASK_STAT_STK_CHK_EN needs to be set to 1 to include code for task stack checking"
  112. #endif
  113. #if     OS_TASK_PROFILE_EN == 0
  114. #error  "OS_CFG.H, OS_TASK_PROFILE_EN needs to be set to 1 to enable task profiling"
  115. #endif
  116. #if     OS_MAX_TASKS > 61
  117. #error  "OS_CFG.H, OS_MAX_TASKS cannot be higher than 61 when using uC/OS-View"
  118. #endif
  119. #if     OS_SEM_EN == 0
  120. #error  "OS_CFG.H, uC/OS-View requires to you enable semaphores, set OS_SEM_EN to 1"
  121. #endif
  122. #if     OS_VIEW_TMR_32_BITS > 1
  123. #error  "OS_VIEW_TMR_32_BITS 'must' be defined to either 0 (for 16 bit timer) or 1 (for 32 bit timer)"
  124. #endif
  125. #endif