⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_probe.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 4 页
字号:
    126          *
    127          * Argument(s) : call_back   Pointer to the callback function.
    128          *
    129          * Return(s)   : none.
    130          *
    131          * Caller(s)   : Application.
    132          *
    133          * Note(s)     : none.
    134          *********************************************************************************************************
    135          */
    136          
    137          #if (OS_PROBE_TASK > 0)

   \                                 In segment CODE, align 4, keep-with-next
    138          void  OSProbe_SetCallback (void (*call_back)(void))
    139          {
    140              OSProbe_CallbackFnct = call_back;
   \                     OSProbe_SetCallback:
   \   00000000   0149               LDR.N    R1,??OSProbe_SetCallback_0  ;; OSProbe_Delay + 4
   \   00000002   0860               STR      R0,[R1, #+0]
    141          }
   \   00000004   7047               BX       LR               ;; return
   \   00000006   00BF               Nop      
   \                     ??OSProbe_SetCallback_0:
   \   00000008   ........           DC32     OSProbe_Delay + 4
    142          #endif
    143          
    144          
    145          /*
    146          *********************************************************************************************************
    147          *                                           OSProbe_SetDelay()
    148          *
    149          * Description : Set the delay used in OSProbe_Task().
    150          *
    151          * Argument(s) : delay       Delay, in milliseconds.
    152          *
    153          * Return(s)   : none.
    154          *
    155          * Caller(s)   : Application.
    156          *
    157          * Note(s)     : none.
    158          *********************************************************************************************************
    159          */
    160          
    161          #if (OS_PROBE_TASK > 0)

   \                                 In segment CODE, align 4, keep-with-next
    162          void  OSProbe_SetDelay (INT16U  delay)
    163          {
    164              OSProbe_Delay = delay;
   \                     OSProbe_SetDelay:
   \   00000000   ....               LDR.N    R1,??DataTable3  ;; OSProbe_Delay
   \   00000002   0880               STRH     R0,[R1, #+0]
    165          }
   \   00000004   7047               BX       LR               ;; return
    166          #endif
    167          
    168          
    169          /*
    170          *********************************************************************************************************
    171          *                                         OSProbe_TimeGetCycles()
    172          *
    173          * Description : Get time as accurately as possible, stored in a 32-bit variable.
    174          *
    175          * Argument(s) : none.
    176          *
    177          * Return(s)   : A 32-bit representation of time.
    178          *
    179          * Caller(s)   : OSProbe_TaskSwHook(),
    180          *               OSProbe_TaskCreateHook().
    181          *
    182          * Note(s)     : (1) Since the cycles count returned by this function will eventually overflow a 32-bit
    183          *                   integer, it should only be used for comparative time lapse measurements (e.g., to
    184          *                   determine a time lapse between two events which can be compared to similarly
    185          *                   calculated time lapses).  In such a measurement, the difference between two cycle
    186          *                   counts will be computed.  The application MUST guarantee that this difference does
    187          *                   not overflow a 32-bit integer.  For example, if the underlying timer increments at a
    188          *                   rate of 100MHz, then the maximum time lapse that can be measured is
    189          *
    190          *                                2^32 - 1
    191          *                       tmax = ------------ s = 42.9497 s
    192          *                               100 * 10^6
    193          *
    194          *               (2) When using a 16-bit timer, this function MUST be called with sufficient frequency
    195          *                   that timer overflows do not occur.  If necessary, the timer should be configured with
    196          *                   a sufficient prescaler in order to decrease the probability of timer overflows.
    197          *
    198          *                   For example, a 16-bit timer incrementing at 48-MHz with a prescaler of 128 will
    199          *                   require that this function be called at
    200          *
    201          *                                   48 * 10^6
    202          *                       freqmin = ------------- Hz = 5.72 Hz
    203          *                                  128 * 65536
    204          *
    205          *                   A possible solution is that this would be called from the tick handler of the
    206          *                   application's OS (assuming the tick rate is greater than 5.72 Hz).
    207          *********************************************************************************************************
    208          */
    209          
    210          #if (OS_PROBE_HOOKS_EN > 0)

   \                                 In segment CODE, align 4, keep-with-next
    211          INT32U  OSProbe_TimeGetCycles (void)
    212          {
   \                     OSProbe_TimeGetCycles:
   \   00000000   30B5               PUSH     {R4,R5,LR}
    213              INT32U     cycles;
    214          #if (OS_PROBE_TMR_32_BITS > 0)
    215              INT32U     cnts32;
    216              INT32U     cnts32_delta;
    217          #else
    218              INT16U     cnts16;
    219              INT16U     cnts16_delta;
    220          #endif
    221          #if (OS_CRITICAL_METHOD == 3)                                   /* Allocate storage for CPU status register.            */
    222              OS_CPU_SR  cpu_sr = 0;
    223          #endif
    224          
    225          
    226              OS_ENTER_CRITICAL();
   \   00000002   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   00000006   0400               MOVS     R4,R0
    227          #if (OS_PROBE_TMR_32_BITS > 0)
    228              cnts32               = OSProbe_TmrRd();                     /* Read current counts of the free running counter.     */
    229              cnts32_delta         = cnts32 - OSProbe_TmrCntsPrev;
    230              OSProbe_TmrCntsPrev  = cnts32;                              /* Save current counts for next time.                   */
    231              OSProbe_CyclesCtr   += cnts32_delta;
    232          #else
    233              cnts16               = (INT16U)OSProbe_TmrRd();             /* Read current counts of the free running counter.     */
   \   00000008   ........           _BLF     OSProbe_TmrRd,??OSProbe_TmrRd??rT
   \   0000000C   80B2               UXTH     R0,R0
    234              cnts16_delta         = cnts16 - OSProbe_TmrCntsPrev;
   \   0000000E   ....               LDR.N    R1,??DataTable2  ;; OSProbe_TmrCntsPrev
   \   00000010   0200               MOVS     R2,R0
   \   00000012   0B88               LDRH     R3,[R1, #+0]
   \   00000014   D21A               SUBS     R2,R2,R3
   \   00000016   92B2               UXTH     R2,R2
    235              OSProbe_TmrCntsPrev  = cnts16;                              /* Save current counts for next time.                   */
   \   00000018   0880               STRH     R0,[R1, #+0]
    236              OSProbe_CyclesCtr   += (INT32U)cnts16_delta;
   \   0000001A   4868               LDR      R0,[R1, #+4]
   \   0000001C   8518               ADDS     R5,R0,R2
   \   0000001E   4D60               STR      R5,[R1, #+4]
    237          #endif
    238              cycles               = OSProbe_CyclesCtr;
    239              OS_EXIT_CRITICAL();
   \   00000020   2000               MOVS     R0,R4
   \   00000022   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    240          
    241              return (cycles);
   \   00000026   2800               MOVS     R0,R5
   \   00000028   30BD               POP      {R4,R5,PC}       ;; return
    242          }
    243          #endif
    244          
    245          
    246          /*
    247          *********************************************************************************************************
    248          *********************************************************************************************************
    249          *                                               TASK HOOKS
    250          *********************************************************************************************************
    251          *********************************************************************************************************
    252          */
    253          
    254          /*
    255          *********************************************************************************************************
    256          *                                        OSProbe_TaskCreateHook()
    257          *
    258          * Description : This function is called when a task is created.
    259          *
    260          * Argument(s) : ptcb        Pointer to the task control block of the task being created.
    261          *
    262          * Return(s)   : none.
    263          *
    264          * Caller(s)   : App_TaskCreateHook().
    265          *
    266          * Note(s)     : (1) Interrupts are disabled during this call.
    267          *
    268          *               (2) This MUST be called from applications's task create hook function App_TaskCreateHook().
    269          *********************************************************************************************************
    270          */
    271          
    272          #if (OS_PROBE_HOOKS_EN > 0)

   \                                 In segment CODE, align 4, keep-with-next
    273          void  OSProbe_TaskCreateHook (OS_TCB *ptcb)
    274          {
   \                     OSProbe_TaskCreateHook:
   \   00000000   10B5               PUSH     {R4,LR}
   \   00000002   0400               MOVS     R4,R0
    275              ptcb->OSTCBCyclesStart = OSProbe_TimeGetCycles();           /* Get the current start time for this task.            */
   \   00000004   ........           BL       OSProbe_TimeGetCycles
   \   00000008   2064               STR      R0,[R4, #+64]
    276              ptcb->OSTCBCyclesTot   = 0;                                 /* Update the task's total execution time.              */
   \   0000000A   0020               MOVS     R0,#+0
   \   0000000C   E063               STR      R0,[R4, #+60]
    277          }
   \   0000000E   10BD               POP      {R4,PC}          ;; return
    278          #endif
    279          
    280          
    281          /*
    282          *********************************************************************************************************
    283          *                                          OSProbe_TaskSwHook()
    284          *
    285          * Description : This function is called when a task switch is performed.
    286          *
    287          * Argument(s) : none.
    288          *
    289          * Return(s)   : none.
    290          *
    291          * Caller(s)   : App_TaskSwHook().
    292          *
    293          * Note(s)     : (1) Interrupts are disabled during this call.
    294          *
    295          *               (2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
    296          *                   will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
    297          *                   task being switched out (i.e. the preempted task).
    298          *
    299          *               (3) This MUST be called from application's task switch hook function App_TaskSwHook().
    300          *********************************************************************************************************
    301          */
    302          
    303          #if (OS_PROBE_HOOKS_EN > 0)

   \                                 In segment CODE, align 4, keep-with-next
    304          void  OSProbe_TaskSwHook (void)
    305          {
   \                     OSProbe_TaskSwHook:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -