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

📄 os_cpu_c.s79

📁 ARM仿真案例
💻 S79
📖 第 1 页 / 共 2 页
字号:
//  129 *
//  130 * Note(s)    : 1) Interrupts are enabled during this call.
//  131 *********************************************************************************************************
//  132 */
//  133 #if OS_CPU_HOOKS_EN > 0 && OS_VERSION >= 251

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock9 Using cfiCommon1
        CFI Function OSTaskIdleHook
        THUMB
//  134 void  OSTaskIdleHook (void)
//  135 {
//  136 }
OSTaskIdleHook:
        BX       LR               ;; return
        CFI EndBlock cfiBlock9

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock10 Using cfiCommon0
        CFI NoFunction
        ARM
??OSTaskStatHook??rA:
        ADD      R12,PC,#+1
        BX       R12
        CFI EndBlock cfiBlock10
        REQUIRE OSTaskStatHook
//  137 #endif
//  138 
//  139 /*
//  140 *********************************************************************************************************
//  141 *                                           STATISTIC TASK HOOK
//  142 *
//  143 * Description: This function is called every second by uC/OS-II's statistics task.  This allows your 
//  144 *              application to add functionality to the statistics task.
//  145 *
//  146 * Arguments  : none
//  147 *********************************************************************************************************
//  148 */
//  149 
//  150 #if OS_CPU_HOOKS_EN > 0 

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock11 Using cfiCommon1
        CFI Function OSTaskStatHook
        THUMB
//  151 void  OSTaskStatHook (void)
//  152 {
//  153 }
OSTaskStatHook:
        BX       LR               ;; return
        CFI EndBlock cfiBlock11

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock12 Using cfiCommon0
        CFI NoFunction
        ARM
??OSTaskStkInit??rA:
        ADD      R12,PC,#+1
        BX       R12
        CFI EndBlock cfiBlock12
        REQUIRE OSTaskStkInit
//  154 #endif
//  155 
//  156 /*
//  157 *********************************************************************************************************
//  158 *                                        INITIALIZE A TASK'S STACK
//  159 *
//  160 * Description: This function is called by either OSTaskCreate() or OSTaskCreateExt() to initialize the
//  161 *              stack frame of the task being created.  This function is highly processor specific.
//  162 *
//  163 * Arguments  : task          is a pointer to the task code
//  164 *
//  165 *              p_arg         is a pointer to a user supplied data area that will be passed to the task
//  166 *                            when the task first executes.
//  167 *
//  168 *              ptos          is a pointer to the top of stack.  It is assumed that 'ptos' points to
//  169 *                            a 'free' entry on the task stack.  If OS_STK_GROWTH is set to 1 then 
//  170 *                            'ptos' will contain the HIGHEST valid address of the stack.  Similarly, if
//  171 *                            OS_STK_GROWTH is set to 0, the 'ptos' will contains the LOWEST valid address
//  172 *                            of the stack.
//  173 *
//  174 *              opt           specifies options that can be used to alter the behavior of OSTaskStkInit().
//  175 *                            (see uCOS_II.H for OS_TASK_OPT_???).
//  176 *
//  177 * Returns    : Always returns the location of the new top-of-stack' once the processor registers have
//  178 *              been placed on the stack in the proper order.
//  179 *
//  180 * Note(s)    : 1) Interrupts are enabled when your task starts executing. 
//  181 *              2) All tasks run in SYS mode.
//  182 *********************************************************************************************************
//  183 */
//  184 

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock13 Using cfiCommon1
        CFI Function OSTaskStkInit
        THUMB
//  185 OS_STK *OSTaskStkInit (void (*task)(void *pd), void *p_arg, OS_STK *ptos, INT16U opt)
//  186 {
//  187     OS_STK *stk;
//  188 
//  189 
//  190     opt      = opt;                         /* 'opt' is not used, prevent warning                      */
//  191     stk      = ptos;                        /* Load stack pointer                                      */
//  192     *(stk)   = (OS_STK)task;                /* Entry Point                                             */
OSTaskStkInit:
        STR      R0,[R2, #+0]
//  193     *(--stk) = (INT32U)0x14141414L;         /* R14 (LR)                                                */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0  ;; 0x14141414
        STR      R0,[R2, #+0]
//  194     *(--stk) = (INT32U)0x12121212L;         /* R12                                                     */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0+0x4  ;; 0x12121212
        STR      R0,[R2, #+0]
//  195     *(--stk) = (INT32U)0x11111111L;         /* R11                                                     */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0+0x8  ;; 0x11111111
        STR      R0,[R2, #+0]
//  196     *(--stk) = (INT32U)0x10101010L;         /* R10                                                     */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0+0xC  ;; 0x10101010
        STR      R0,[R2, #+0]
//  197     *(--stk) = (INT32U)0x09090909L;         /* R9                                                      */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0+0x10  ;; 0x9090909
        STR      R0,[R2, #+0]
//  198     *(--stk) = (INT32U)0x08080808L;         /* R8                                                      */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0+0x14  ;; 0x8080808
        STR      R0,[R2, #+0]
//  199     *(--stk) = (INT32U)0x07070707L;         /* R7                                                      */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0+0x18  ;; 0x7070707
        STR      R0,[R2, #+0]
//  200     *(--stk) = (INT32U)0x06060606L;         /* R6                                                      */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0+0x1C  ;; 0x6060606
        STR      R0,[R2, #+0]
//  201     *(--stk) = (INT32U)0x05050505L;         /* R5                                                      */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0+0x20  ;; 0x5050505
        STR      R0,[R2, #+0]
//  202     *(--stk) = (INT32U)0x04040404L;         /* R4                                                      */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0+0x24  ;; 0x4040404
        STR      R0,[R2, #+0]
//  203     *(--stk) = (INT32U)0x03030303L;         /* R3                                                      */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0+0x28  ;; 0x3030303
        STR      R0,[R2, #+0]
//  204     *(--stk) = (INT32U)0x02020202L;         /* R2                                                      */
        SUBS     R2,R2,#+4
        LDR      R0,??OSTaskStkInit_0+0x2C  ;; 0x2020202
        STR      R0,[R2, #+0]
//  205     *(--stk) = (INT32U)0x01010101L;         /* R1                                                      */
        SUBS     R2,R2,#+4
        LSRS     R0,R0,#+1
        STR      R0,[R2, #+0]
//  206     *(--stk) = (INT32U)p_arg;               /* R0 : argument                                           */
        SUBS     R2,R2,#+4
        STR      R1,[R2, #+0]
//  207     *(--stk) = (INT32U)ARM_SVC_MODE;        /* CPSR  (Enable both IRQ and FIQ interrupts)              */
        SUBS     R2,R2,#+4
        MOVS     R0,#+51
        STR      R0,[R2, #+0]
//  208 
//  209     return (stk);
        MOVS     R0,R2
        BX       LR               ;; return
        Nop      
        DATA
??OSTaskStkInit_0:
        DC32     0x14141414
        DC32     0x12121212
        DC32     0x11111111
        DC32     0x10101010
        DC32     0x9090909
        DC32     0x8080808
        DC32     0x7070707
        DC32     0x6060606
        DC32     0x5050505
        DC32     0x4040404
        DC32     0x3030303
        DC32     0x2020202
        CFI EndBlock cfiBlock13
//  210 }

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock14 Using cfiCommon0
        CFI NoFunction
        ARM
??OSTaskSwHook??rA:
        ADD      R12,PC,#+1
        BX       R12
        CFI EndBlock cfiBlock14
        REQUIRE OSTaskSwHook
//  211 
//  212 /*
//  213 *********************************************************************************************************
//  214 *                                           TASK SWITCH HOOK
//  215 *
//  216 * Description: This function is called when a task switch is performed.  This allows you to perform other
//  217 *              operations during a context switch.
//  218 *
//  219 * Arguments  : none
//  220 *
//  221 * Note(s)    : 1) Interrupts are disabled during this call.
//  222 *              2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
//  223 *                 will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the 
//  224 *                 task being switched out (i.e. the preempted task).
//  225 *********************************************************************************************************
//  226 */
//  227 #if (OS_CPU_HOOKS_EN > 0) && (OS_TASK_SW_HOOK_EN > 0)

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock15 Using cfiCommon1
        CFI Function OSTaskSwHook
        THUMB
//  228 void  OSTaskSwHook (void)
//  229 {
//  230 #if OS_VIEW_MODULE > 0
//  231     OSView_TaskSwHook();
//  232 #endif
//  233 }
OSTaskSwHook:
        BX       LR               ;; return
        CFI EndBlock cfiBlock15

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock16 Using cfiCommon0
        CFI NoFunction
        ARM
??OSTCBInitHook??rA:
        ADD      R12,PC,#+1
        BX       R12
        CFI EndBlock cfiBlock16
        REQUIRE OSTCBInitHook
//  234 #endif
//  235 
//  236 /*
//  237 *********************************************************************************************************
//  238 *                                           OS_TCBInit() HOOK
//  239 *
//  240 * Description: This function is called by OS_TCBInit() after setting up most of the TCB.
//  241 *
//  242 * Arguments  : ptcb    is a pointer to the TCB of the task being created.
//  243 *
//  244 * Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
//  245 *********************************************************************************************************
//  246 */
//  247 #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock17 Using cfiCommon1
        CFI Function OSTCBInitHook
        THUMB
//  248 void  OSTCBInitHook (OS_TCB *ptcb)
//  249 {
//  250     (void)ptcb;                                            /* Prevent Compiler warning                 */
//  251 }
OSTCBInitHook:
        BX       LR               ;; return
        CFI EndBlock cfiBlock17

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock18 Using cfiCommon0
        CFI NoFunction
        ARM
??OSTimeTickHook??rA:
        ADD      R12,PC,#+1
        BX       R12
        CFI EndBlock cfiBlock18
        REQUIRE OSTimeTickHook
//  252 #endif
//  253 
//  254 
//  255 /*
//  256 *********************************************************************************************************
//  257 *                                               TICK HOOK
//  258 *
//  259 * Description: This function is called every tick.
//  260 *
//  261 * Arguments  : none
//  262 *
//  263 * Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
//  264 *********************************************************************************************************
//  265 */
//  266 #if (OS_CPU_HOOKS_EN > 0) && (OS_TIME_TICK_HOOK_EN > 0)

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock19 Using cfiCommon1
        CFI Function OSTimeTickHook
        THUMB
//  267 void  OSTimeTickHook (void)
//  268 {
//  269 #if OS_VIEW_MODULE > 0
//  270     OSView_TickHook();
//  271 #endif
//  272 }
OSTimeTickHook:
        BX       LR               ;; return
        CFI EndBlock cfiBlock19

        END
//  273 #endif
//  274 
//  275 
//  276 /*
//  277 *********************************************************************************************************
//  278 *                             INTERRUPT DISABLE TIME MEASUREMENT, START
//  279 *********************************************************************************************************
//  280 */
//  281 
//  282 #if OS_CPU_INT_DIS_MEAS_EN > 0
//  283 void  OS_CPU_IntDisMeasInit (void)
//  284 {
//  285     OS_CPU_IntDisMeasNestingCtr = 0;
//  286     OS_CPU_IntDisMeasCntsEnter  = 0;
//  287     OS_CPU_IntDisMeasCntsExit   = 0;
//  288     OS_CPU_IntDisMeasCntsMax    = 0;
//  289     OS_CPU_IntDisMeasCntsDelta  = 0;
//  290     OS_CPU_IntDisMeasCntsOvrhd  = 0;
//  291     OS_CPU_IntDisMeasStart();                              /* Measure the overhead of the functions    */
//  292     OS_CPU_IntDisMeasStop();
//  293     OS_CPU_IntDisMeasCntsOvrhd  = OS_CPU_IntDisMeasCntsDelta;
//  294 }
//  295 
//  296 
//  297 void  OS_CPU_IntDisMeasStart (void)
//  298 {
//  299     OS_CPU_IntDisMeasNestingCtr++;
//  300     if (OS_CPU_IntDisMeasNestingCtr == 1) {                /* Only measure at the first nested level   */
//  301         OS_CPU_IntDisMeasCntsEnter = OS_CPU_IntDisMeasTmrRd();
//  302     }
//  303 }
//  304 
//  305 
//  306 void  OS_CPU_IntDisMeasStop (void)
//  307 {
//  308     OS_CPU_IntDisMeasNestingCtr--;                                         /* Decrement nesting ctr    */
//  309     if (OS_CPU_IntDisMeasNestingCtr == 0) {
//  310         OS_CPU_IntDisMeasCntsExit  = OS_CPU_IntDisMeasTmrRd();
//  311         OS_CPU_IntDisMeasCntsDelta = OS_CPU_IntDisMeasCntsExit - OS_CPU_IntDisMeasCntsEnter;
//  312         if (OS_CPU_IntDisMeasCntsDelta > OS_CPU_IntDisMeasCntsOvrhd) {     /* Ensure overhead < delta  */
//  313             OS_CPU_IntDisMeasCntsDelta -= OS_CPU_IntDisMeasCntsOvrhd;
//  314         } else {
//  315             OS_CPU_IntDisMeasCntsDelta  = OS_CPU_IntDisMeasCntsOvrhd;
//  316         }
//  317         if (OS_CPU_IntDisMeasCntsDelta > OS_CPU_IntDisMeasCntsMax) {       /* Track MAXIMUM            */
//  318             OS_CPU_IntDisMeasCntsMax = OS_CPU_IntDisMeasCntsDelta;
//  319         }
//  320     }
//  321 }
//  322 #endif
// 
// 242 bytes in segment CODE
// 
// 162 bytes of CODE memory (+ 80 bytes shared)
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

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