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

📄 os_task.lst

📁 ARM仿真案例
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   0000004E   03B0               ADD      SP,SP,#+12
   \   00000050   0FD1               BNE      ??OSTaskCreate_3
    181                      OS_ENTER_CRITICAL();
   \   00000052   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    182                      OSTaskCtr++;                                        /* Increment the #tasks counter        */
   \   00000056   ....               LDR      R1,??DataTable32  ;; OSTaskCtr
   \   00000058   ....               LDR      R2,??DataTable32  ;; OSTaskCtr
   \   0000005A   1278               LDRB     R2,[R2, #+0]
   \   0000005C   521C               ADDS     R2,R2,#+1
   \   0000005E   0A70               STRB     R2,[R1, #+0]
    183                      OS_EXIT_CRITICAL();
   \   00000060   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    184                      if (OSRunning == TRUE) {         /* Find highest priority task if multitasking has started */
   \   00000064   ....               LDR      R0,??DataTable22  ;; OSRunning
   \   00000066   0078               LDRB     R0,[R0, #+0]
   \   00000068   0128               CMP      R0,#+1
   \   0000006A   0AD1               BNE      ??OSTaskCreate_4
    185                          OS_Sched();
   \   0000006C   ........           _BLF     OS_Sched,??OS_Sched??rT
   \   00000070   07E0               B        ??OSTaskCreate_4
    186                      }
    187                  } else {
    188                      OS_ENTER_CRITICAL();
   \                     ??OSTaskCreate_3:
   \   00000072   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    189                      OSTCBPrioTbl[prio] = (OS_TCB *)0;/* Make this priority available to others                 */
   \   00000076   B900               LSLS     R1,R7,#+2
   \   00000078   ....               LDR      R2,??DataTable23  ;; OSTCBPrioTbl
   \   0000007A   0023               MOVS     R3,#+0
   \   0000007C   5350               STR      R3,[R2, R1]
    190                      OS_EXIT_CRITICAL();
   \   0000007E   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    191                  }
    192                  return (err);
   \                     ??OSTaskCreate_4:
   \   00000082   2000               MOVS     R0,R4
   \   00000084   02E0               B        ??OSTaskCreate_1
    193              }
    194              OS_EXIT_CRITICAL();
   \                     ??OSTaskCreate_2:
   \   00000086   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    195              return (OS_PRIO_EXIST);
   \   0000008A   2820               MOVS     R0,#+40
   \                     ??OSTaskCreate_1:
   \   0000008C   F0BC               POP      {R4-R7}
   \   0000008E   02BC               POP      {R1}
   \   00000090   0847               BX       R1               ;; return
    196          }
    197          #endif
    198          
    199          /*
    200          *********************************************************************************************************
    201          *                                     CREATE A TASK (Extended Version)
    202          *
    203          * Description: This function is used to have uC/OS-II manage the execution of a task.  Tasks can either
    204          *              be created prior to the start of multitasking or by a running task.  A task cannot be
    205          *              created by an ISR.  This function is similar to OSTaskCreate() except that it allows
    206          *              additional information about a task to be specified.
    207          *
    208          * Arguments  : task     is a pointer to the task's code
    209          *
    210          *              p_arg    is a pointer to an optional data area which can be used to pass parameters to
    211          *                       the task when the task first executes.  Where the task is concerned it thinks
    212          *                       it was invoked and passed the argument 'p_arg' as follows:
    213          *
    214          *                           void Task (void *p_arg)
    215          *                           {
    216          *                               for (;;) {
    217          *                                   Task code;
    218          *                               }
    219          *                           }
    220          *
    221          *              ptos     is a pointer to the task's top of stack.  If the configuration constant
    222          *                       OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
    223          *                       memory to low memory).  'ptos' will thus point to the highest (valid) memory
    224          *                       location of the stack.  If OS_STK_GROWTH is set to 0, 'ptos' will point to the
    225          *                       lowest memory location of the stack and the stack will grow with increasing
    226          *                       memory locations.  'ptos' MUST point to a valid 'free' data item.
    227          *
    228          *              prio     is the task's priority.  A unique priority MUST be assigned to each task and the
    229          *                       lower the number, the higher the priority.
    230          *
    231          *              id       is the task's ID (0..65535)
    232          *
    233          *              pbos     is a pointer to the task's bottom of stack.  If the configuration constant
    234          *                       OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
    235          *                       memory to low memory).  'pbos' will thus point to the LOWEST (valid) memory
    236          *                       location of the stack.  If OS_STK_GROWTH is set to 0, 'pbos' will point to the
    237          *                       HIGHEST memory location of the stack and the stack will grow with increasing
    238          *                       memory locations.  'pbos' MUST point to a valid 'free' data item.
    239          *
    240          *              stk_size is the size of the stack in number of elements.  If OS_STK is set to INT8U,
    241          *                       'stk_size' corresponds to the number of bytes available.  If OS_STK is set to
    242          *                       INT16U, 'stk_size' contains the number of 16-bit entries available.  Finally, if
    243          *                       OS_STK is set to INT32U, 'stk_size' contains the number of 32-bit entries
    244          *                       available on the stack.
    245          *
    246          *              pext     is a pointer to a user supplied memory location which is used as a TCB extension.
    247          *                       For example, this user memory can hold the contents of floating-point registers
    248          *                       during a context switch, the time each task takes to execute, the number of times
    249          *                       the task has been switched-in, etc.
    250          *
    251          *              opt      contains additional information (or options) about the behavior of the task.  The
    252          *                       LOWER 8-bits are reserved by uC/OS-II while the upper 8 bits can be application
    253          *                       specific.  See OS_TASK_OPT_??? in uCOS-II.H.
    254          *
    255          * Returns    : OS_NO_ERR        if the function was successful.
    256          *              OS_PRIO_EXIT     if the task priority already exist
    257          *                               (each task MUST have a unique priority).
    258          *              OS_PRIO_INVALID  if the priority you specify is higher that the maximum allowed
    259          *                               (i.e. > OS_LOWEST_PRIO)
    260          *********************************************************************************************************
    261          */
    262          
    263          #if OS_TASK_CREATE_EXT_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    264          INT8U  OSTaskCreateExt (void   (*task)(void *pd),
    265                                  void    *p_arg,
    266                                  OS_STK  *ptos,
    267                                  INT8U    prio,
    268                                  INT16U   id,
    269                                  OS_STK  *pbos,
    270                                  INT32U   stk_size,
    271                                  void    *pext,
    272                                  INT16U   opt)
    273          {
   \                     OSTaskCreateExt:
   \   00000000   F3B5               PUSH     {R0,R1,R4-R7,LR}
   \   00000002   1400               MOVS     R4,R2
   \   00000004   1D00               MOVS     R5,R3
   \   00000006   099E               LDR      R6,[SP, #+36]
   \   00000008   6846               MOV      R0,SP
   \   0000000A   878D               LDRH     R7,[R0, #+44]
    274          #if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
    275              OS_CPU_SR  cpu_sr;
    276          #endif
    277              OS_STK    *psp;
    278              INT8U      err;
    279          
    280          
    281          #if OS_ARG_CHK_EN > 0
    282              if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
   \   0000000C   402D               CMP      R5,#+64
   \   0000000E   01D3               BCC      ??OSTaskCreateExt_0
    283                  return (OS_PRIO_INVALID);
   \   00000010   2A20               MOVS     R0,#+42
   \   00000012   43E0               B        ??OSTaskCreateExt_1
    284              }
    285          #endif
    286              OS_ENTER_CRITICAL();
   \                     ??OSTaskCreateExt_0:
   \   00000014   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    287              if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority  */
   \   00000018   A900               LSLS     R1,R5,#+2
   \   0000001A   ....               LDR      R2,??DataTable23  ;; OSTCBPrioTbl
   \   0000001C   5158               LDR      R1,[R2, R1]
   \   0000001E   0029               CMP      R1,#+0
   \   00000020   39D1               BNE      ??OSTaskCreateExt_2
    288                  OSTCBPrioTbl[prio] = (OS_TCB *)1;    /* Reserve the priority to prevent others from doing ...  */
   \   00000022   AB00               LSLS     R3,R5,#+2
   \   00000024   ....               LDR      R1,??DataTable23  ;; OSTCBPrioTbl
   \   00000026   0122               MOVS     R2,#+1
   \   00000028   CA50               STR      R2,[R1, R3]
    289                                                       /* ... the same thing until task is created.              */
    290                  OS_EXIT_CRITICAL();
   \   0000002A   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    291          
    292                  OS_TaskStkClr(pbos, stk_size, opt);                    /* Clear the task stack (if needed)     */
   \   0000002E   3A00               MOVS     R2,R7
   \   00000030   3100               MOVS     R1,R6
   \   00000032   0898               LDR      R0,[SP, #+32]
   \   00000034   ........           BL       OS_TaskStkClr
    293          
    294                  psp = (OS_STK *)OSTaskStkInit(task, p_arg, ptos, opt); /* Initialize the task's stack          */
   \   00000038   3B00               MOVS     R3,R7
   \   0000003A   2200               MOVS     R2,R4
   \   0000003C   0199               LDR      R1,[SP, #+4]
   \   0000003E   0098               LDR      R0,[SP, #+0]
   \   00000040   ........           _BLF     OSTaskStkInit,??OSTaskStkInit??rT
   \   00000044   0400               MOVS     R4,R0
    295                  err = OS_TCBInit(prio, psp, pbos, id, stk_size, pext, opt);
   \   00000046   3A00               MOVS     R2,R7
   \   00000048   0A99               LDR      R1,[SP, #+40]
   \   0000004A   3000               MOVS     R0,R6
   \   0000004C   07B4               PUSH     {R0-R2}
   \   0000004E   03A8               ADD      R0,SP,#+12
   \   00000050   838B               LDRH     R3,[R0, #+28]
   \   00000052   0B9A               LDR      R2,[SP, #+44]
   \   00000054   2100               MOVS     R1,R4
   \   00000056   2800               MOVS     R0,R5
   \   00000058   ........           _BLF     OS_TCBInit,??OS_TCBInit??rT
   \   0000005C   0400               MOVS     R4,R0
    296                  if (err == OS_NO_ERR) {
   \   0000005E   03B0               ADD      SP,SP,#+12
   \   00000060   0FD1               BNE      ??OSTaskCreateExt_3
    297                      OS_ENTER_CRITICAL();
   \   00000062   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    298                      OSTaskCtr++;                                       /* Increment the #tasks counter         */
   \   00000066   ....               LDR      R1,??DataTable32  ;; OSTaskCtr
   \   00000068   ....               LDR      R2,??DataTable32  ;; OSTaskCtr
   \   0000006A   1278               LDRB     R2,[R2, #+0]
   \   0000006C   521C               ADDS     R2,R2,#+1
   \   0000006E   0A70               STRB     R2,[R1, #+0]

⌨️ 快捷键说明

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