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

📄 os_task.lst

📁 针对STM32F103的UCOS移植
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   00000028   3C20               MOVS     R0,#+60
   \   0000002A   35E0               B.N      ??OSTaskCreateExt_1
    328              }
   \                     ??OSTaskCreateExt_2:
   \   0000002C   ....               LDR.N    R1,??DataTable10  ;; OSTCBPrioTbl
   \   0000002E   11EB8504           ADDS     R4,R1,R5, LSL #+2
   \   00000032   2168               LDR      R1,[R4, #+0]
   \   00000034   0029               CMP      R1,#+0
   \   00000036   2CD1               BNE.N    ??OSTaskCreateExt_3
    329              if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority  */
    330                  OSTCBPrioTbl[prio] = OS_TCB_RESERVED;/* Reserve the priority to prevent others from doing ...  */
   \   00000038   0121               MOVS     R1,#+1
   \   0000003A   2160               STR      R1,[R4, #+0]
    331                                                       /* ... the same thing until task is created.              */
    332                  OS_EXIT_CRITICAL();
   \   0000003C   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    333          
    334          #if OS_TASK_STAT_STK_CHK_EN > 0
    335                  OS_TaskStkClr(pbos, stk_size, opt);                    /* Clear the task stack (if needed)     */
   \   00000040   3200               MOVS     R2,R6
   \   00000042   0999               LDR      R1,[SP, #+36]
   \   00000044   0898               LDR      R0,[SP, #+32]
   \   00000046   ........           BL       OS_TaskStkClr
    336          #endif        
    337          
    338                  psp = OSTaskStkInit(task, p_arg, ptos, opt);           /* Initialize the task's stack          */
   \   0000004A   3300               MOVS     R3,R6
   \   0000004C   3A00               MOVS     R2,R7
   \   0000004E   4946               MOV      R1,R9
   \   00000050   4046               MOV      R0,R8
   \   00000052   ........           _BLF     OSTaskStkInit,??OSTaskStkInit??rT
   \   00000056   0700               MOVS     R7,R0
    339                  err = OS_TCBInit(prio, psp, pbos, id, stk_size, pext, opt);
   \   00000058   3200               MOVS     R2,R6
   \   0000005A   0A99               LDR      R1,[SP, #+40]
   \   0000005C   0998               LDR      R0,[SP, #+36]
   \   0000005E   07B4               PUSH     {R0-R2}
   \   00000060   BDF82830           LDRH     R3,[SP, #+40]
   \   00000064   0B9A               LDR      R2,[SP, #+44]
   \   00000066   3900               MOVS     R1,R7
   \   00000068   2800               MOVS     R0,R5
   \   0000006A   ........           _BLF     OS_TCBInit,??OS_TCBInit??rT
   \   0000006E   0500               MOVS     R5,R0
    340                  if (err == OS_ERR_NONE) {
   \   00000070   03B0               ADD      SP,SP,#+12
   \   00000072   06D1               BNE.N    ??OSTaskCreateExt_4
    341                      if (OSRunning == OS_TRUE) {                        /* Find HPT if multitasking has started */
   \   00000074   ....               LDR.N    R0,??DataTable17  ;; OSRunning
   \   00000076   0078               LDRB     R0,[R0, #+0]
   \   00000078   0128               CMP      R0,#+1
   \   0000007A   08D1               BNE.N    ??OSTaskCreateExt_5
    342                          OS_Sched();
   \   0000007C   ........           _BLF     OS_Sched,??OS_Sched??rT
   \   00000080   05E0               B.N      ??OSTaskCreateExt_5
    343                      }
    344                  } else {
    345                      OS_ENTER_CRITICAL();
   \                     ??OSTaskCreateExt_4:
   \   00000082   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    346                      OSTCBPrioTbl[prio] = (OS_TCB *)0;                  /* Make this priority avail. to others  */
   \   00000086   0021               MOVS     R1,#+0
   \   00000088   2160               STR      R1,[R4, #+0]
    347                      OS_EXIT_CRITICAL();
   \   0000008A   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    348                  }
    349                  return (err);
   \                     ??OSTaskCreateExt_5:
   \   0000008E   2800               MOVS     R0,R5
   \   00000090   02E0               B.N      ??OSTaskCreateExt_1
    350              }
    351              OS_EXIT_CRITICAL();
   \                     ??OSTaskCreateExt_3:
   \   00000092   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    352              return (OS_ERR_PRIO_EXIST);
   \   00000096   2820               MOVS     R0,#+40
   \                     ??OSTaskCreateExt_1:
   \   00000098   BDE8F083           POP      {R4-R9,PC}       ;; return
    353          }
    354          #endif
    355          /*$PAGE*/
    356          /*
    357          *********************************************************************************************************
    358          *                                            DELETE A TASK
    359          *
    360          * Description: This function allows you to delete a task.  The calling task can delete itself by
    361          *              its own priority number.  The deleted task is returned to the dormant state and can be
    362          *              re-activated by creating the deleted task again.
    363          *
    364          * Arguments  : prio    is the priority of the task to delete.  Note that you can explicitely delete
    365          *                      the current task without knowing its priority level by setting 'prio' to
    366          *                      OS_PRIO_SELF.
    367          *
    368          * Returns    : OS_ERR_NONE             if the call is successful
    369          *              OS_ERR_TASK_DEL_IDLE    if you attempted to delete uC/OS-II's idle task
    370          *              OS_ERR_PRIO_INVALID     if the priority you specify is higher that the maximum allowed
    371          *                                      (i.e. >= OS_LOWEST_PRIO) or, you have not specified OS_PRIO_SELF.
    372          *              OS_ERR_TASK_DEL         if the task is assigned to a Mutex PIP.   
    373          *              OS_ERR_TASK_NOT_EXIST   if the task you want to delete does not exist.
    374          *              OS_ERR_TASK_DEL_ISR     if you tried to delete a task from an ISR
    375          *
    376          * Notes      : 1) To reduce interrupt latency, OSTaskDel() 'disables' the task:
    377          *                    a) by making it not ready
    378          *                    b) by removing it from any wait lists
    379          *                    c) by preventing OSTimeTick() from making the task ready to run.
    380          *                 The task can then be 'unlinked' from the miscellaneous structures in uC/OS-II.
    381          *              2) The function OS_Dummy() is called after OS_EXIT_CRITICAL() because, on most processors,
    382          *                 the next instruction following the enable interrupt instruction is ignored.
    383          *              3) An ISR cannot delete a task.
    384          *              4) The lock nesting counter is incremented because, for a brief instant, if the current
    385          *                 task is being deleted, the current task would not be able to be rescheduled because it
    386          *                 is removed from the ready list.  Incrementing the nesting counter prevents another task
    387          *                 from being schedule.  This means that an ISR would return to the current task which is
    388          *                 being deleted.  The rest of the deletion would thus be able to be completed.
    389          *********************************************************************************************************
    390          */
    391          /*$PAGE*/
    392          #if OS_TASK_DEL_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    393          INT8U  OSTaskDel (INT8U prio)
    394          {
   \                     OSTaskDel:
   \   00000000   2DE9F043           PUSH     {R4-R9,LR}
   \   00000004   0500               MOVS     R5,R0
    395          #if OS_EVENT_EN
    396              OS_EVENT     *pevent;
    397          #endif
    398          #if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
    399              OS_FLAG_NODE *pnode;
    400          #endif
    401              OS_TCB       *ptcb;
    402              INT8U         y;
    403          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    404              OS_CPU_SR     cpu_sr = 0;
    405          #endif
    406          
    407          
    408          
    409              if (OSIntNesting > 0) {                                     /* See if trying to delete from ISR    */
   \   00000006   ....               LDR.N    R0,??DataTable20  ;; OSIntNesting
   \   00000008   0078               LDRB     R0,[R0, #+0]
   \   0000000A   0028               CMP      R0,#+0
   \   0000000C   01D0               BEQ.N    ??OSTaskDel_0
    410                  return (OS_ERR_TASK_DEL_ISR);
   \   0000000E   4020               MOVS     R0,#+64
   \   00000010   89E0               B.N      ??OSTaskDel_1
    411              }
    412              if (prio == OS_TASK_IDLE_PRIO) {                            /* Not allowed to delete idle task     */
   \                     ??OSTaskDel_0:
   \   00000012   1F2D               CMP      R5,#+31
   \   00000014   01D1               BNE.N    ??OSTaskDel_2
    413                  return (OS_ERR_TASK_DEL_IDLE);
   \   00000016   3E20               MOVS     R0,#+62
   \   00000018   85E0               B.N      ??OSTaskDel_1
    414              }
    415          #if OS_ARG_CHK_EN > 0
    416              if (prio >= OS_LOWEST_PRIO) {                               /* Task priority valid ?               */
   \                     ??OSTaskDel_2:
   \   0000001A   03D3               BCC.N    ??OSTaskDel_3
    417                  if (prio != OS_PRIO_SELF) {
   \   0000001C   FF2D               CMP      R5,#+255
   \   0000001E   01D0               BEQ.N    ??OSTaskDel_3
    418                      return (OS_ERR_PRIO_INVALID);
   \   00000020   2A20               MOVS     R0,#+42
   \   00000022   80E0               B.N      ??OSTaskDel_1
    419                  }
    420              }
    421          #endif
    422          
    423              OS_ENTER_CRITICAL();
   \                     ??OSTaskDel_3:
   \   00000024   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   00000028   0400               MOVS     R4,R0
    424              if (prio == OS_PRIO_SELF) {                                 /* See if requesting to delete self    */
   \   0000002A   FF2D               CMP      R5,#+255
   \   0000002C   03D1               BNE.N    ??OSTaskDel_4
    425                  prio = OSTCBCur->OSTCBPrio;                             /* Set priority to delete to current   */
   \   0000002E   ....               LDR.N    R0,??DataTable13  ;; OSTCBCur
   \   00000030   0068               LDR      R0,[R0, #+0]
   \   00000032   2E30               ADDS     R0,R0,#+46
   \   00000034   0578               LDRB     R5,[R0, #+0]
   \                     ??OSTaskDel_4:
   \   00000036   ....               LDR.N    R0,??DataTable26  ;; OSTCBPrioTbl
   \   00000038   10EB8508           ADDS     R8,R0,R5, LSL #+2
   \   0000003C   D8F80050           LDR      R5,[R8, #+0]
    426              }
    427              ptcb = OSTCBPrioTbl[prio];
    428              if (ptcb == (OS_TCB *)0) {                                  /* Task to delete must exist           */
   \   00000040   002D               CMP      R5,#+0
   \   00000042   04D1               BNE.N    ??OSTaskDel_5
    429                  OS_EXIT_CRITICAL();
   \   00000044   2000               MOVS     R0,R4
   \   00000046   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    430                  return (OS_ERR_TASK_NOT_EXIST);
   \   0000004A   4320               MOVS     R0,#+67
   \   0000004C   6BE0               B.N      ??OSTaskDel_1
    431              }
    432              if (ptcb == OS_TCB_RESERVED) {                              /* Must not be assigned to Mutex       */
   \                     ??OSTaskDel_5:
   \   0000004E   012D               CMP      R5,#+1
   \   00000050   04D1               BNE.N    ??OSTaskDel_6
    433                  OS_EXIT_CRITICAL();
   \   00000052   2000               MOVS     R0,R4
   \   00000054   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT

⌨️ 快捷键说明

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