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

📄 os_task.lst

📁 针对STM32F103的UCOS移植
💻 LST
📖 第 1 页 / 共 5 页
字号:
    434                  return (OS_ERR_TASK_DEL);
   \   00000058   3D20               MOVS     R0,#+61
   \   0000005A   64E0               B.N      ??OSTaskDel_1
    435              }
    436              y            =  ptcb->OSTCBY;
   \                     ??OSTaskDel_6:
   \   0000005C   2E00               MOVS     R6,R5
   \   0000005E   2C36               ADDS     R6,R6,#+44
   \   00000060   3079               LDRB     R0,[R6, #+4]
    437              OSRdyTbl[y] &= ~ptcb->OSTCBBitX;
   \   00000062   ....               LDR.N    R1,??DataTable15  ;; OSRdyTbl
   \   00000064   0918               ADDS     R1,R1,R0
   \   00000066   0A78               LDRB     R2,[R1, #+0]
   \   00000068   7379               LDRB     R3,[R6, #+5]
   \   0000006A   9A43               BICS     R2,R2,R3
   \   0000006C   0A70               STRB     R2,[R1, #+0]
    438              if (OSRdyTbl[y] == 0) {                                     /* Make task not ready                 */
   \   0000006E   04D1               BNE.N    ??OSTaskDel_7
    439                  OSRdyGrp &= ~ptcb->OSTCBBitY;
   \   00000070   ....               LDR.N    R1,??DataTable16  ;; OSRdyGrp
   \   00000072   0A78               LDRB     R2,[R1, #+0]
   \   00000074   B379               LDRB     R3,[R6, #+6]
   \   00000076   9A43               BICS     R2,R2,R3
   \   00000078   0A70               STRB     R2,[R1, #+0]
    440              }
    441              
    442          #if OS_EVENT_EN
    443              pevent = ptcb->OSTCBEventPtr;
   \                     ??OSTaskDel_7:
   \   0000007A   E969               LDR      R1,[R5, #+28]
    444              if (pevent != (OS_EVENT *)0) {                              /* If task is waiting on event         */
   \   0000007C   0029               CMP      R1,#+0
   \   0000007E   0BD0               BEQ.N    ??OSTaskDel_8
    445                  pevent->OSEventTbl[y] &= ~ptcb->OSTCBBitX;
   \   00000080   0818               ADDS     R0,R1,R0
   \   00000082   C27A               LDRB     R2,[R0, #+11]
   \   00000084   7379               LDRB     R3,[R6, #+5]
   \   00000086   9A43               BICS     R2,R2,R3
   \   00000088   C272               STRB     R2,[R0, #+11]
    446                  if (pevent->OSEventTbl[y] == 0) {                       /* ... remove task from ...            */
   \   0000008A   C07A               LDRB     R0,[R0, #+11]
   \   0000008C   0028               CMP      R0,#+0
   \   0000008E   03D1               BNE.N    ??OSTaskDel_8
    447                      pevent->OSEventGrp &= ~ptcb->OSTCBBitY;             /* ... event ctrl block                */
   \   00000090   887A               LDRB     R0,[R1, #+10]
   \   00000092   B279               LDRB     R2,[R6, #+6]
   \   00000094   9043               BICS     R0,R0,R2
   \   00000096   8872               STRB     R0,[R1, #+10]
    448                  }
    449              }
    450          #endif
    451          
    452          #if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
    453              pnode = ptcb->OSTCBFlagNode;
   \                     ??OSTaskDel_8:
   \   00000098   686A               LDR      R0,[R5, #+36]
    454              if (pnode != (OS_FLAG_NODE *)0) {                           /* If task is waiting on event flag    */
   \   0000009A   0028               CMP      R0,#+0
   \   0000009C   01D0               BEQ.N    ??OSTaskDel_9
    455                  OS_FlagUnlink(pnode);                                   /* Remove from wait list               */
   \   0000009E   ........           _BLF     OS_FlagUnlink,??OS_FlagUnlink??rT
    456              }
    457          #endif
    458          
    459              ptcb->OSTCBDly      = 0;                                    /* Prevent OSTimeTick() from updating  */
   \                     ??OSTaskDel_9:
   \   000000A2   0020               MOVS     R0,#+0
   \   000000A4   8146               MOV      R9,R0
   \   000000A6   6885               STRH     R0,[R5, #+42]
    460              ptcb->OSTCBStat     = OS_STAT_RDY;                          /* Prevent task from being resumed     */
   \   000000A8   3070               STRB     R0,[R6, #+0]
    461              ptcb->OSTCBStatPend = OS_STAT_PEND_OK;
   \   000000AA   7070               STRB     R0,[R6, #+1]
    462              if (OSLockNesting < 255u) {                                 /* Make sure we don't context switch   */
   \   000000AC   1F4F               LDR.N    R7,??OSTaskDel_10  ;; OSLockNesting
   \   000000AE   3878               LDRB     R0,[R7, #+0]
   \   000000B0   FF28               CMP      R0,#+255
   \   000000B2   01D0               BEQ.N    ??OSTaskDel_11
    463                  OSLockNesting++;
   \   000000B4   401C               ADDS     R0,R0,#+1
   \   000000B6   3870               STRB     R0,[R7, #+0]
    464              }
    465              OS_EXIT_CRITICAL();                                         /* Enabling INT. ignores next instruc. */
   \                     ??OSTaskDel_11:
   \   000000B8   2000               MOVS     R0,R4
   \   000000BA   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    466              OS_Dummy();                                                 /* ... Dummy ensures that INTs will be */
   \   000000BE   ........           _BLF     OS_Dummy,??OS_Dummy??rT
    467              OS_ENTER_CRITICAL();                                        /* ... disabled HERE!                  */
   \   000000C2   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   000000C6   0400               MOVS     R4,R0
    468              if (OSLockNesting > 0) {                                    /* Remove context switch lock          */
   \   000000C8   3878               LDRB     R0,[R7, #+0]
   \   000000CA   0028               CMP      R0,#+0
   \   000000CC   01D0               BEQ.N    ??OSTaskDel_12
    469                  OSLockNesting--;
   \   000000CE   401E               SUBS     R0,R0,#+1
   \   000000D0   3870               STRB     R0,[R7, #+0]
    470              }
    471              OSTaskDelHook(ptcb);                                        /* Call user defined hook              */
   \                     ??OSTaskDel_12:
   \   000000D2   2800               MOVS     R0,R5
   \   000000D4   ........           _BLF     OSTaskDelHook,??OSTaskDelHook??rT
    472              OSTaskCtr--;                                                /* One less task being managed         */
   \   000000D8   1548               LDR.N    R0,??OSTaskDel_10+0x4  ;; OSTaskCtr
   \   000000DA   0178               LDRB     R1,[R0, #+0]
   \   000000DC   491E               SUBS     R1,R1,#+1
   \   000000DE   0170               STRB     R1,[R0, #+0]
    473              OSTCBPrioTbl[prio] = (OS_TCB *)0;                           /* Clear old priority entry            */
   \   000000E0   C8F80090           STR      R9,[R8, #+0]
    474              if (ptcb->OSTCBPrev == (OS_TCB *)0) {                       /* Remove from TCB chain               */
   \   000000E4   A869               LDR      R0,[R5, #+24]
   \   000000E6   0028               CMP      R0,#+0
   \   000000E8   06D1               BNE.N    ??OSTaskDel_13
    475                  ptcb->OSTCBNext->OSTCBPrev = (OS_TCB *)0;
   \   000000EA   6869               LDR      R0,[R5, #+20]
   \   000000EC   C0F81890           STR      R9,[R0, #+24]
    476                  OSTCBList                  = ptcb->OSTCBNext;
   \   000000F0   1048               LDR.N    R0,??OSTaskDel_10+0x8  ;; OSTCBList
   \   000000F2   6969               LDR      R1,[R5, #+20]
   \   000000F4   0160               STR      R1,[R0, #+0]
   \   000000F6   04E0               B.N      ??OSTaskDel_14
    477              } else {
    478                  ptcb->OSTCBPrev->OSTCBNext = ptcb->OSTCBNext;
   \                     ??OSTaskDel_13:
   \   000000F8   6969               LDR      R1,[R5, #+20]
   \   000000FA   4161               STR      R1,[R0, #+20]
    479                  ptcb->OSTCBNext->OSTCBPrev = ptcb->OSTCBPrev;
   \   000000FC   6869               LDR      R0,[R5, #+20]
   \   000000FE   A969               LDR      R1,[R5, #+24]
   \   00000100   8161               STR      R1,[R0, #+24]
    480              }
    481              ptcb->OSTCBNext   = OSTCBFreeList;                          /* Return TCB to free TCB list         */
   \                     ??OSTaskDel_14:
   \   00000102   0D48               LDR.N    R0,??OSTaskDel_10+0xC  ;; OSTCBFreeList
   \   00000104   0168               LDR      R1,[R0, #+0]
   \   00000106   6961               STR      R1,[R5, #+20]
    482              OSTCBFreeList     = ptcb;
   \   00000108   0560               STR      R5,[R0, #+0]
    483          #if OS_TASK_NAME_SIZE > 1
    484              ptcb->OSTCBTaskName[0] = '?';                               /* Unknown name                        */
   \   0000010A   3F20               MOVS     R0,#+63
   \   0000010C   3077               STRB     R0,[R6, #+28]
    485              ptcb->OSTCBTaskName[1] = OS_ASCII_NUL;
   \   0000010E   4846               MOV      R0,R9
   \   00000110   7077               STRB     R0,[R6, #+29]
    486          #endif
    487              OS_EXIT_CRITICAL();
   \   00000112   2000               MOVS     R0,R4
   \   00000114   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    488              if (OSRunning == OS_TRUE) {
   \   00000118   ....               LDR.N    R0,??DataTable17  ;; OSRunning
   \   0000011A   0078               LDRB     R0,[R0, #+0]
   \   0000011C   0128               CMP      R0,#+1
   \   0000011E   01D1               BNE.N    ??OSTaskDel_15
    489                  OS_Sched();                                             /* Find new highest priority task      */
   \   00000120   ........           _BLF     OS_Sched,??OS_Sched??rT
    490              }
    491              return (OS_ERR_NONE);
   \                     ??OSTaskDel_15:
   \   00000124   4846               MOV      R0,R9
   \                     ??OSTaskDel_1:
   \   00000126   BDE8F083           POP      {R4-R9,PC}       ;; return
   \   0000012A   00BF               Nop      
   \                     ??OSTaskDel_10:
   \   0000012C   ........           DC32     OSLockNesting
   \   00000130   ........           DC32     OSTaskCtr
   \   00000134   ........           DC32     OSTCBList
   \   00000138   ........           DC32     OSTCBFreeList
    492          }
    493          #endif
    494          /*$PAGE*/
    495          /*
    496          *********************************************************************************************************
    497          *                                    REQUEST THAT A TASK DELETE ITSELF
    498          *
    499          * Description: This function is used to:
    500          *                   a) notify a task to delete itself.
    501          *                   b) to see if a task requested that the current task delete itself.
    502          *              This function is a little tricky to understand.  Basically, you have a task that needs
    503          *              to be deleted however, this task has resources that it has allocated (memory buffers,
    504          *              semaphores, mailboxes, queues etc.).  The task cannot be deleted otherwise these
    505          *              resources would not be freed.  The requesting task calls OSTaskDelReq() to indicate that
    506          *              the task needs to be deleted.  Deleting of the task is however, deferred to the task to
    507          *              be deleted.  For example, suppose that task #10 needs to be deleted.  The requesting task
    508          *              example, task #5, would call OSTaskDelReq(10).  When task #10 gets to execute, it calls
    509          *              this function by specifying OS_PRIO_SELF and monitors the returned value.  If the return
    510          *              value is OS_ERR_TASK_DEL_REQ, another task requested a task delete.  Task #10 would look like
    511          *              this:
    512          *
    513          *                   void Task(void *p_arg)
    514          *                   {
    515          *                       .
    516          *                       .
    517          *                       while (1) {
    518          *                           OSTimeDly(1);
    519          *                           if (OSTaskDelReq(OS_PRIO_SELF) == OS_ERR_TASK_DEL_REQ) {
    520          *                               Release any owned resources;
    521          *                               De-allocate any dynamic memory;
    522          *                               OSTaskDel(OS_PRIO

⌨️ 快捷键说明

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