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

📄 os_task.lst

📁 针对STM32F103的UCOS移植
💻 LST
📖 第 1 页 / 共 5 页
字号:
    200                  return (OS_ERR_PRIO_INVALID);
   \   00000010   2A20               MOVS     R0,#+42
   \   00000012   38E0               B.N      ??OSTaskCreate_1
    201              }
    202          #endif
    203              OS_ENTER_CRITICAL();
   \                     ??OSTaskCreate_0:
   \   00000014   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    204              if (OSIntNesting > 0) {                  /* Make sure we don't create the task from within an ISR  */
   \   00000018   ....               LDR.N    R1,??DataTable20  ;; OSIntNesting
   \   0000001A   0978               LDRB     R1,[R1, #+0]
   \   0000001C   0029               CMP      R1,#+0
   \   0000001E   03D0               BEQ.N    ??OSTaskCreate_2
    205                  OS_EXIT_CRITICAL();
   \   00000020   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    206                  return (OS_ERR_TASK_CREATE_ISR);
   \   00000024   3C20               MOVS     R0,#+60
   \   00000026   2EE0               B.N      ??OSTaskCreate_1
    207              }
   \                     ??OSTaskCreate_2:
   \   00000028   ....               LDR.N    R1,??DataTable10  ;; OSTCBPrioTbl
   \   0000002A   11EB8504           ADDS     R4,R1,R5, LSL #+2
   \   0000002E   2168               LDR      R1,[R4, #+0]
   \   00000030   0029               CMP      R1,#+0
   \   00000032   25D1               BNE.N    ??OSTaskCreate_3
    208              if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority  */
    209                  OSTCBPrioTbl[prio] = OS_TCB_RESERVED;/* Reserve the priority to prevent others from doing ...  */
   \   00000034   0121               MOVS     R1,#+1
   \   00000036   2160               STR      R1,[R4, #+0]
    210                                                       /* ... the same thing until task is created.              */
    211                  OS_EXIT_CRITICAL();
   \   00000038   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    212                  psp = OSTaskStkInit(task, p_arg, ptos, 0);              /* Initialize the task's stack         */
   \   0000003C   0023               MOVS     R3,#+0
   \   0000003E   3A00               MOVS     R2,R7
   \   00000040   3100               MOVS     R1,R6
   \   00000042   4046               MOV      R0,R8
   \   00000044   ........           _BLF     OSTaskStkInit,??OSTaskStkInit??rT
   \   00000048   0600               MOVS     R6,R0
    213                  err = OS_TCBInit(prio, psp, (OS_STK *)0, 0, 0, (void *)0, 0);
   \   0000004A   0022               MOVS     R2,#+0
   \   0000004C   1146               MOV      R1,R2
   \   0000004E   0846               MOV      R0,R1
   \   00000050   07B4               PUSH     {R0-R2}
   \   00000052   0346               MOV      R3,R0
   \   00000054   3100               MOVS     R1,R6
   \   00000056   2800               MOVS     R0,R5
   \   00000058   ........           _BLF     OS_TCBInit,??OS_TCBInit??rT
   \   0000005C   0500               MOVS     R5,R0
    214                  if (err == OS_ERR_NONE) {
   \   0000005E   03B0               ADD      SP,SP,#+12
   \   00000060   06D1               BNE.N    ??OSTaskCreate_4
    215                      if (OSRunning == OS_TRUE) {      /* Find highest priority task if multitasking has started */
   \   00000062   ....               LDR.N    R0,??DataTable17  ;; OSRunning
   \   00000064   0078               LDRB     R0,[R0, #+0]
   \   00000066   0128               CMP      R0,#+1
   \   00000068   08D1               BNE.N    ??OSTaskCreate_5
    216                          OS_Sched();
   \   0000006A   ........           _BLF     OS_Sched,??OS_Sched??rT
   \   0000006E   05E0               B.N      ??OSTaskCreate_5
    217                      }
    218                  } else {
    219                      OS_ENTER_CRITICAL();
   \                     ??OSTaskCreate_4:
   \   00000070   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    220                      OSTCBPrioTbl[prio] = (OS_TCB *)0;/* Make this priority available to others                 */
   \   00000074   0021               MOVS     R1,#+0
   \   00000076   2160               STR      R1,[R4, #+0]
    221                      OS_EXIT_CRITICAL();
   \   00000078   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    222                  }
    223                  return (err);
   \                     ??OSTaskCreate_5:
   \   0000007C   2800               MOVS     R0,R5
   \   0000007E   02E0               B.N      ??OSTaskCreate_1
    224              }
    225              OS_EXIT_CRITICAL();
   \                     ??OSTaskCreate_3:
   \   00000080   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    226              return (OS_ERR_PRIO_EXIST);
   \   00000084   2820               MOVS     R0,#+40
   \                     ??OSTaskCreate_1:
   \   00000086   BDE8F081           POP      {R4-R8,PC}       ;; return
    227          }
    228          #endif
    229          /*$PAGE*/
    230          /*
    231          *********************************************************************************************************
    232          *                                     CREATE A TASK (Extended Version)
    233          *
    234          * Description: This function is used to have uC/OS-II manage the execution of a task.  Tasks can either
    235          *              be created prior to the start of multitasking or by a running task.  A task cannot be
    236          *              created by an ISR.  This function is similar to OSTaskCreate() except that it allows
    237          *              additional information about a task to be specified.
    238          *
    239          * Arguments  : task      is a pointer to the task's code
    240          *
    241          *              p_arg     is a pointer to an optional data area which can be used to pass parameters to
    242          *                        the task when the task first executes.  Where the task is concerned it thinks
    243          *                        it was invoked and passed the argument 'p_arg' as follows:
    244          *
    245          *                            void Task (void *p_arg)
    246          *                            {
    247          *                                for (;;) {
    248          *                                    Task code;
    249          *                                }
    250          *                            }
    251          *
    252          *              ptos      is a pointer to the task's top of stack.  If the configuration constant
    253          *                        OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
    254          *                        memory to low memory).  'ptos' will thus point to the highest (valid) memory
    255          *                        location of the stack.  If OS_STK_GROWTH is set to 0, 'ptos' will point to the
    256          *                        lowest memory location of the stack and the stack will grow with increasing
    257          *                        memory locations.  'ptos' MUST point to a valid 'free' data item.
    258          *
    259          *              prio      is the task's priority.  A unique priority MUST be assigned to each task and the
    260          *                        lower the number, the higher the priority.
    261          *
    262          *              id        is the task's ID (0..65535)
    263          *
    264          *              pbos      is a pointer to the task's bottom of stack.  If the configuration constant
    265          *                        OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
    266          *                        memory to low memory).  'pbos' will thus point to the LOWEST (valid) memory
    267          *                        location of the stack.  If OS_STK_GROWTH is set to 0, 'pbos' will point to the
    268          *                        HIGHEST memory location of the stack and the stack will grow with increasing
    269          *                        memory locations.  'pbos' MUST point to a valid 'free' data item.
    270          *
    271          *              stk_size  is the size of the stack in number of elements.  If OS_STK is set to INT8U,
    272          *                        'stk_size' corresponds to the number of bytes available.  If OS_STK is set to
    273          *                        INT16U, 'stk_size' contains the number of 16-bit entries available.  Finally, if
    274          *                        OS_STK is set to INT32U, 'stk_size' contains the number of 32-bit entries
    275          *                        available on the stack.
    276          *
    277          *              pext      is a pointer to a user supplied memory location which is used as a TCB extension.
    278          *                        For example, this user memory can hold the contents of floating-point registers
    279          *                        during a context switch, the time each task takes to execute, the number of times
    280          *                        the task has been switched-in, etc.
    281          *
    282          *              opt       contains additional information (or options) about the behavior of the task.  The
    283          *                        LOWER 8-bits are reserved by uC/OS-II while the upper 8 bits can be application
    284          *                        specific.  See OS_TASK_OPT_??? in uCOS-II.H.  Current choices are:
    285          *
    286          *                        OS_TASK_OPT_STK_CHK      Stack checking to be allowed for the task
    287          *                        OS_TASK_OPT_STK_CLR      Clear the stack when the task is created
    288          *                        OS_TASK_OPT_SAVE_FP      If the CPU has floating-point registers, save them
    289          *                                                 during a context switch.
    290          *
    291          * Returns    : OS_ERR_NONE             if the function was successful.
    292          *              OS_PRIO_EXIT            if the task priority already exist
    293          *                                      (each task MUST have a unique priority).
    294          *              OS_ERR_PRIO_INVALID     if the priority you specify is higher that the maximum allowed
    295          *                                      (i.e. > OS_LOWEST_PRIO)
    296          *              OS_ERR_TASK_CREATE_ISR  if you tried to create a task from an ISR.
    297          *********************************************************************************************************
    298          */
    299          /*$PAGE*/
    300          #if OS_TASK_CREATE_EXT_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    301          INT8U  OSTaskCreateExt (void   (*task)(void *p_arg),
    302                                  void    *p_arg,
    303                                  OS_STK  *ptos,
    304                                  INT8U    prio,
    305                                  INT16U   id,
    306                                  OS_STK  *pbos,
    307                                  INT32U   stk_size,
    308                                  void    *pext,
    309                                  INT16U   opt)
    310          {
   \                     OSTaskCreateExt:
   \   00000000   2DE9F043           PUSH     {R4-R9,LR}
   \   00000004   8046               MOV      R8,R0
   \   00000006   8946               MOV      R9,R1
   \   00000008   1700               MOVS     R7,R2
   \   0000000A   1D00               MOVS     R5,R3
   \   0000000C   BDF82C60           LDRH     R6,[SP, #+44]
    311              OS_STK    *psp;
    312              INT8U      err;
    313          #if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
    314              OS_CPU_SR  cpu_sr = 0;
    315          #endif
    316          
    317          
    318          
    319          #if OS_ARG_CHK_EN > 0
    320              if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
   \   00000010   202D               CMP      R5,#+32
   \   00000012   01D3               BCC.N    ??OSTaskCreateExt_0
    321                  return (OS_ERR_PRIO_INVALID);
   \   00000014   2A20               MOVS     R0,#+42
   \   00000016   3FE0               B.N      ??OSTaskCreateExt_1
    322              }
    323          #endif
    324              OS_ENTER_CRITICAL();
   \                     ??OSTaskCreateExt_0:
   \   00000018   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    325              if (OSIntNesting > 0) {                  /* Make sure we don't create the task from within an ISR  */
   \   0000001C   ....               LDR.N    R1,??DataTable20  ;; OSIntNesting
   \   0000001E   0978               LDRB     R1,[R1, #+0]
   \   00000020   0029               CMP      R1,#+0
   \   00000022   03D0               BEQ.N    ??OSTaskCreateExt_2
    326                  OS_EXIT_CRITICAL();
   \   00000024   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    327                  return (OS_ERR_TASK_CREATE_ISR);

⌨️ 快捷键说明

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