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

📄 os_task.lst

📁 针对STM32F103的UCOS移植
💻 LST
📖 第 1 页 / 共 5 页
字号:
     99              }
    100          #if OS_LOWEST_PRIO <= 63
    101              y                     = (INT8U)(newprio >> 3);              /* Yes, compute new TCB fields         */
   \                     ??OSTaskChangePrio_6:
   \   00000060   4246               MOV      R2,R8
   \   00000062   D208               LSRS     R2,R2,#+3
   \   00000064   9246               MOV      R10,R2
    102              x                     = (INT8U)(newprio & 0x07);
   \   00000066   4246               MOV      R2,R8
   \   00000068   5207               LSLS     R2,R2,#+29
   \   0000006A   520F               LSRS     R2,R2,#+29
   \   0000006C   9346               MOV      R11,R2
    103              bity                  = (INT8U)(1 << y);
   \   0000006E   0122               MOVS     R2,#+1
   \   00000070   5346               MOV      R3,R10
   \   00000072   9A40               LSLS     R2,R2,R3
   \   00000074   D2B2               UXTB     R2,R2
    104              bitx                  = (INT8U)(1 << x);
   \   00000076   0123               MOVS     R3,#+1
   \   00000078   5D46               MOV      R5,R11
   \   0000007A   AB40               LSLS     R3,R3,R5
   \   0000007C   DBB2               UXTB     R3,R3
    105          #else
    106              y                     = (INT8U)((newprio >> 4) & 0x0F);
    107              x                     = (INT8U)( newprio & 0x0F);
    108              bity                  = (INT16U)(1 << y);
    109              bitx                  = (INT16U)(1 << x);
    110          #endif
    111          
    112              OSTCBPrioTbl[oldprio] = (OS_TCB *)0;                        /* Remove TCB from old priority        */
   \   0000007E   0025               MOVS     R5,#+0
   \   00000080   2560               STR      R5,[R4, #+0]
    113              OSTCBPrioTbl[newprio] = ptcb;                               /* Place pointer to TCB @ new priority */
   \   00000082   C1F80090           STR      R9,[R1, #+0]
    114              y_old                 = ptcb->OSTCBY;
   \   00000086   4C46               MOV      R4,R9
   \   00000088   2E34               ADDS     R4,R4,#+46
   \   0000008A   A178               LDRB     R1,[R4, #+2]
    115              if ((OSRdyTbl[y_old] & ptcb->OSTCBBitX) != 0) {             /* If task is ready make it not        */
   \   0000008C   ....               LDR.N    R5,??DataTable15  ;; OSRdyTbl
   \   0000008E   6E18               ADDS     R6,R5,R1
   \   00000090   3578               LDRB     R5,[R6, #+0]
   \   00000092   E778               LDRB     R7,[R4, #+3]
   \   00000094   3D42               TST      R5,R7
   \   00000096   12D0               BEQ.N    ??OSTaskChangePrio_7
    116                  OSRdyTbl[y_old] &= ~ptcb->OSTCBBitX;
   \   00000098   BD43               BICS     R5,R5,R7
   \   0000009A   3570               STRB     R5,[R6, #+0]
    117                  if (OSRdyTbl[y_old] == 0) {
   \   0000009C   ....               LDR.N    R6,??DataTable16  ;; OSRdyGrp
   \   0000009E   03D1               BNE.N    ??OSTaskChangePrio_8
    118                      OSRdyGrp &= ~ptcb->OSTCBBitY;
   \   000000A0   3578               LDRB     R5,[R6, #+0]
   \   000000A2   2779               LDRB     R7,[R4, #+4]
   \   000000A4   BD43               BICS     R5,R5,R7
   \   000000A6   3570               STRB     R5,[R6, #+0]
    119                  }
    120                  OSRdyGrp    |= bity;                                    /* Make new priority ready to run      */
   \                     ??OSTaskChangePrio_8:
   \   000000A8   3578               LDRB     R5,[R6, #+0]
   \   000000AA   1700               MOVS     R7,R2
   \   000000AC   2F43               ORRS     R7,R7,R5
   \   000000AE   3770               STRB     R7,[R6, #+0]
    121                  OSRdyTbl[y] |= bitx;
   \   000000B0   5646               MOV      R6,R10
   \   000000B2   ....               LDR.N    R5,??DataTable15  ;; OSRdyTbl
   \   000000B4   AD19               ADDS     R5,R5,R6
   \   000000B6   2E78               LDRB     R6,[R5, #+0]
   \   000000B8   1F00               MOVS     R7,R3
   \   000000BA   3743               ORRS     R7,R7,R6
   \   000000BC   2F70               STRB     R7,[R5, #+0]
    122              }
    123          #if OS_EVENT_EN
    124              pevent = ptcb->OSTCBEventPtr;
   \                     ??OSTaskChangePrio_7:
   \   000000BE   D9F81C50           LDR      R5,[R9, #+28]
    125              if (pevent != (OS_EVENT *)0) {                              /* ... remove from event wait list     */
   \   000000C2   002D               CMP      R5,#+0
   \   000000C4   15D0               BEQ.N    ??OSTaskChangePrio_9
    126                  pevent->OSEventTbl[y_old] &= ~ptcb->OSTCBBitX;
   \   000000C6   6918               ADDS     R1,R5,R1
   \   000000C8   CE7A               LDRB     R6,[R1, #+11]
   \   000000CA   E778               LDRB     R7,[R4, #+3]
   \   000000CC   BE43               BICS     R6,R6,R7
   \   000000CE   CE72               STRB     R6,[R1, #+11]
    127                  if (pevent->OSEventTbl[y_old] == 0) {
   \   000000D0   C97A               LDRB     R1,[R1, #+11]
   \   000000D2   0029               CMP      R1,#+0
   \   000000D4   03D1               BNE.N    ??OSTaskChangePrio_10
    128                      pevent->OSEventGrp &= ~ptcb->OSTCBBitY;
   \   000000D6   A97A               LDRB     R1,[R5, #+10]
   \   000000D8   2679               LDRB     R6,[R4, #+4]
   \   000000DA   B143               BICS     R1,R1,R6
   \   000000DC   A972               STRB     R1,[R5, #+10]
    129                  }
    130                  pevent->OSEventGrp    |= bity;                          /* Add new priority to wait list       */
   \                     ??OSTaskChangePrio_10:
   \   000000DE   A97A               LDRB     R1,[R5, #+10]
   \   000000E0   1600               MOVS     R6,R2
   \   000000E2   0E43               ORRS     R6,R6,R1
   \   000000E4   AE72               STRB     R6,[R5, #+10]
    131                  pevent->OSEventTbl[y] |= bitx;
   \   000000E6   5646               MOV      R6,R10
   \   000000E8   A919               ADDS     R1,R5,R6
   \   000000EA   CD7A               LDRB     R5,[R1, #+11]
   \   000000EC   1E00               MOVS     R6,R3
   \   000000EE   2E43               ORRS     R6,R6,R5
   \   000000F0   CE72               STRB     R6,[R1, #+11]
    132              }
    133          #endif
    134              ptcb->OSTCBPrio = newprio;                                  /* Set new task priority               */
   \                     ??OSTaskChangePrio_9:
   \   000000F2   84F80080           STRB     R8,[R4, #+0]
    135              ptcb->OSTCBY    = y;
   \   000000F6   5146               MOV      R1,R10
   \   000000F8   A170               STRB     R1,[R4, #+2]
    136              ptcb->OSTCBX    = x;
   \   000000FA   5946               MOV      R1,R11
   \   000000FC   6170               STRB     R1,[R4, #+1]
    137              ptcb->OSTCBBitY = bity;
   \   000000FE   2271               STRB     R2,[R4, #+4]
    138              ptcb->OSTCBBitX = bitx;
   \   00000100   E370               STRB     R3,[R4, #+3]
    139              OS_EXIT_CRITICAL();
   \   00000102   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    140              if (OSRunning == OS_TRUE) {
   \   00000106   ....               LDR.N    R0,??DataTable17  ;; OSRunning
   \   00000108   0078               LDRB     R0,[R0, #+0]
   \   0000010A   0128               CMP      R0,#+1
   \   0000010C   01D1               BNE.N    ??OSTaskChangePrio_11
    141                  OS_Sched();                                             /* Find new highest priority task      */
   \   0000010E   ........           _BLF     OS_Sched,??OS_Sched??rT
    142              }
    143              return (OS_ERR_NONE);
   \                     ??OSTaskChangePrio_11:
   \   00000112   0020               MOVS     R0,#+0
   \                     ??OSTaskChangePrio_2:
   \   00000114   BDE8F08F           POP      {R4-R11,PC}      ;; return
    144          }
    145          #endif
    146          /*$PAGE*/
    147          /*
    148          *********************************************************************************************************
    149          *                                            CREATE A TASK
    150          *
    151          * Description: This function is used to have uC/OS-II manage the execution of a task.  Tasks can either
    152          *              be created prior to the start of multitasking or by a running task.  A task cannot be
    153          *              created by an ISR.
    154          *
    155          * Arguments  : task     is a pointer to the task's code
    156          *
    157          *              p_arg    is a pointer to an optional data area which can be used to pass parameters to
    158          *                       the task when the task first executes.  Where the task is concerned it thinks
    159          *                       it was invoked and passed the argument 'p_arg' as follows:
    160          *
    161          *                           void Task (void *p_arg)
    162          *                           {
    163          *                               for (;;) {
    164          *                                   Task code;
    165          *                               }
    166          *                           }
    167          *
    168          *              ptos     is a pointer to the task's top of stack.  If the configuration constant
    169          *                       OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
    170          *                       memory to low memory).  'pstk' will thus point to the highest (valid) memory
    171          *                       location of the stack.  If OS_STK_GROWTH is set to 0, 'pstk' will point to the
    172          *                       lowest memory location of the stack and the stack will grow with increasing
    173          *                       memory locations.
    174          *
    175          *              prio     is the task's priority.  A unique priority MUST be assigned to each task and the
    176          *                       lower the number, the higher the priority.
    177          *
    178          * Returns    : OS_ERR_NONE             if the function was successful.
    179          *              OS_PRIO_EXIT            if the task priority already exist
    180          *                                      (each task MUST have a unique priority).
    181          *              OS_ERR_PRIO_INVALID     if the priority you specify is higher that the maximum allowed
    182          *                                      (i.e. >= OS_LOWEST_PRIO)
    183          *              OS_ERR_TASK_CREATE_ISR  if you tried to create a task from an ISR.
    184          *********************************************************************************************************
    185          */
    186          
    187          #if OS_TASK_CREATE_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    188          INT8U  OSTaskCreate (void (*task)(void *p_arg), void *p_arg, OS_STK *ptos, INT8U prio)
    189          {
   \                     OSTaskCreate:
   \   00000000   2DE9F041           PUSH     {R4-R8,LR}
   \   00000004   8046               MOV      R8,R0
   \   00000006   0E00               MOVS     R6,R1
   \   00000008   1700               MOVS     R7,R2
   \   0000000A   1D00               MOVS     R5,R3
    190              OS_STK    *psp;
    191              INT8U      err;
    192          #if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
    193              OS_CPU_SR  cpu_sr = 0;
    194          #endif
    195          
    196          
    197          
    198          #if OS_ARG_CHK_EN > 0
    199              if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
   \   0000000C   202D               CMP      R5,#+32
   \   0000000E   01D3               BCC.N    ??OSTaskCreate_0

⌨️ 快捷键说明

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