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

📄 os_task.lst

📁 IAR project for MSP430 and uC/OS. All configured to start filling with tasks.
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   00A2  C2FC0000          AND.B   R12,&OSRdyGrp   
   \   00A6            ?0075:
     85                          }
     86                          OSRdyGrp    |= bity;                            /* Make new priority ready to run      */
   \   00A6  C2DF0000          BIS.B   R15,&OSRdyGrp   
     87                          OSRdyTbl[y] |= bitx;
   \   00AA  4C4D              MOV.B   R13,R12 
   \   00AC  CCDB0000          BIS.B   R11,OSRdyTbl(R12)       
     88          #if OS_EVENT_EN > 0
     89                      } else {
   \   00B0  1A3C              JMP     (?0082) 
   \   00B2            ?0073:
     90                          pevent = ptcb->OSTCBEventPtr;
   \   00B2  1C481200          MOV     18(R8),R12      
     91                          if (pevent != (OS_EVENT *)0) {                  /* Remove from event wait list  */
   \   00B6  0C93              CMP     #0,R12  
   \   00B8  1624              JEQ     (?0082) 
     92                              if ((pevent->OSEventTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0) {
   \   00BA  59481F00          MOV.B   31(R8),R9       
   \   00BE  095C              ADD     R12,R9  
   \   00C0  56482000          MOV.B   32(R8),R6       
   \   00C4  76E3              XOR.B   #-1,R6  
   \   00C6  C9F60600          AND.B   R6,6(R9)        
   \   00CA  C9930600          CMP.B   #0,6(R9)        
   \   00CE  0520              JNE     (?0084) 
     93                                  pevent->OSEventGrp &= ~ptcb->OSTCBBitY;
   \   00D0  59482100          MOV.B   33(R8),R9       
   \   00D4  79E3              XOR.B   #-1,R9  
   \   00D6  CCF90100          AND.B   R9,1(R12)       
   \   00DA            ?0084:
     94                              }
     95                              pevent->OSEventGrp    |= bity;              /* Add new priority to wait list       */
   \   00DA  CCDF0100          BIS.B   R15,1(R12)      
     96                              pevent->OSEventTbl[y] |= bitx;
   \   00DE  494D              MOV.B   R13,R9  
   \   00E0  095C              ADD     R12,R9  
   \   00E2  C9DB0600          BIS.B   R11,6(R9)       
   \   00E6            ?0082:
     97                          }
     98          #endif
     99                      }
    100                      OSTCBPrioTbl[newprio] = ptcb;                       /* Place pointer to TCB @ new priority */
   \   00E6  4C4E              MOV.B   R14,R12 
   \   00E8  0C5C              ADD     R12,R12 
   \   00EA  8C480000          MOV     R8,OSTCBPrioTbl(R12)    
    101                      ptcb->OSTCBPrio       = newprio;                    /* Set new task priority               */
   \   00EE  C84E1D00          MOV.B   R14,29(R8)      
    102                      ptcb->OSTCBY          = y;
   \   00F2  C84D1F00          MOV.B   R13,31(R8)      
    103                      ptcb->OSTCBX          = x;
   \   00F6  C84A1E00          MOV.B   R10,30(R8)      
    104                      ptcb->OSTCBBitY       = bity;
   \   00FA  C84F2100          MOV.B   R15,33(R8)      
    105                      ptcb->OSTCBBitX       = bitx;
   \   00FE  C84B2000          MOV.B   R11,32(R8)      
    106                      OS_EXIT_CRITICAL();
   \   0102  32D2              EINT            
    107                      OS_Sched();                                         /* Run highest priority task ready     */
   \   0104  B0120000          CALL    #OS_Sched       
    108                      return (OS_NO_ERR);
   \   0108  4C43              MOV.B   #0,R12  
    109                  } else {
   \   010A  073C              JMP     (?0085) 
   \   010C            ?0071:
    110                      OSTCBPrioTbl[newprio] = (OS_TCB *)0;                /* Release the reserved prio.          */
   \   010C  7EF3              AND.B   #-1,R14 
   \   010E  0E5E              ADD     R14,R14 
   \   0110  8E430000          MOV     #0,OSTCBPrioTbl(R14)    
    111                      OS_EXIT_CRITICAL();
   \   0114  32D2              EINT            
    112                      return (OS_PRIO_ERR);                               /* Task to change didn't exist         */
   \   0116  7C402900          MOV.B   #41,R12 
    113                  }
   \   011A            ?0085:
   \   011A  3641              POP     R6      
   \   011C  3941              POP     R9      
   \   011E  3841              POP     R8      
   \   0120  3B41              POP     R11     
   \   0122  3A41              POP     R10     
   \   0124  3041              RET             
    114              }
    115          }
   \   0126            OSTaskCreate:
    116          #endif
    117          /*$PAGE*/
    118          /*
    119          *********************************************************************************************************
    120          *                                            CREATE A TASK
    121          *
    122          * Description: This function is used to have uC/OS-II manage the execution of a task.  Tasks can either
    123          *              be created prior to the start of multitasking or by a running task.  A task cannot be
    124          *              created by an ISR.
    125          *
    126          * Arguments  : task     is a pointer to the task's code
    127          *
    128          *              pdata    is a pointer to an optional data area which can be used to pass parameters to
    129          *                       the task when the task first executes.  Where the task is concerned it thinks
    130          *                       it was invoked and passed the argument 'pdata' as follows:
    131          *
    132          *                           void Task (void *pdata)
    133          *                           {
    134          *                               for (;;) {
    135          *                                   Task code;
    136          *                               }
    137          *                           }
    138          *
    139          *              ptos     is a pointer to the task's top of stack.  If the configuration constant
    140          *                       OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
    141          *                       memory to low memory).  'pstk' will thus point to the highest (valid) memory
    142          *                       location of the stack.  If OS_STK_GROWTH is set to 0, 'pstk' will point to the
    143          *                       lowest memory location of the stack and the stack will grow with increasing
    144          *                       memory locations.
    145          *
    146          *              prio     is the task's priority.  A unique priority MUST be assigned to each task and the
    147          *                       lower the number, the higher the priority.
    148          *
    149          * Returns    : OS_NO_ERR        if the function was successful.
    150          *              OS_PRIO_EXIT     if the task priority already exist
    151          *                               (each task MUST have a unique priority).
    152          *              OS_PRIO_INVALID  if the priority you specify is higher that the maximum allowed
    153          *                               (i.e. >= OS_LOWEST_PRIO)
    154          *********************************************************************************************************
    155          */
    156          
    157          #if OS_TASK_CREATE_EN > 0
    158          INT8U  OSTaskCreate (void (*task)(void *pd), void *pdata, OS_STK *ptos, INT8U prio)
    159          {
   \   0126  0A12              PUSH    R10     
   \   0128  0B12              PUSH    R11     
   \   012A  5B410800          MOV.B   8(SP),R11       
    160          #if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
    161              OS_CPU_SR  cpu_sr;
    162          #endif
    163              OS_STK    *psp;
    164              INT8U      err;
    165          
    166          
    167          #if OS_ARG_CHK_EN > 0
    168              if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
   \   012E  7B900D00          CMP.B   #13,R11 
   \   0132  0328              JNC     (?0087) 
    169                  return (OS_PRIO_INVALID);
   \   0134  7C402A00          MOV.B   #42,R12 
    170              }
   \   0138  333C              JMP     (?0095) 
   \   013A            ?0087:
    171          #endif
    172              OS_ENTER_CRITICAL();
   \   013A  32C2              DINT            
    173              if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority  */
   \   013C  4D4B              MOV.B   R11,R13 
   \   013E  0D5D              ADD     R13,R13 
   \   0140  8D930000          CMP     #0,OSTCBPrioTbl(R13)    
   \   0144  2A20              JNE     (?0089) 
    174                  OSTCBPrioTbl[prio] = (OS_TCB *)1;    /* Reserve the priority to prevent others from doing ...  */
   \   0146  4D4B              MOV.B   R11,R13 
   \   0148  0D5D              ADD     R13,R13 
   \   014A  9D430000          MOV     #1,OSTCBPrioTbl(R13)    
    175                                                       /* ... the same thing until task is created.              */
    176                  OS_EXIT_CRITICAL();
   \   014E  32D2              EINT            
    177                  psp = (OS_STK *)OSTaskStkInit(task, pdata, ptos, 0);    /* Initialize the task's stack         */
   \   0150  0312              PUSH    #0      
   \   0152  11120A00          PUSH    10(SP)  
   \   0156  B0120000          CALL    #OSTaskStkInit  
   \   015A  0E4C              MOV     R12,R14 
   \   015C  2152              ADD     #4,SP   
    178                  err = OS_TCBInit(prio, psp, (OS_STK *)0, 0, 0, (void *)0, 0);
   \   015E  0312              PUSH    #0      
   \   0160  0312              PUSH    #0      
   \   0162  0312              PUSH    #0      
   \   0164  0312              PUSH    #0      
   \   0166  0312              PUSH    #0      
   \   0168  0312              PUSH    #0      
   \   016A  4C4B              MOV.B   R11,R12 
   \   016C  B0120000          CALL    #OS_TCBInit     
   \   0170  31500C00          ADD     #12,SP  
   \   0174  4A4C              MOV.B   R12,R10 
    179                  if (err == OS_NO_ERR) {
   \   0176  4A93              CMP.B   #0,R10  
   \   0178  32C2              DINT            
   \   017A  0920              JNE     (?0091) 
    180                      OS_ENTER_CRITICAL();
    181                      OSTaskCtr++;                                        /* Increment the #tasks counter        */
   \   017C  D2530000          ADD.B   #1,&OSTaskCtr   
    182                      OS_EXIT_CRITICAL();
   \   0180  32D2              EINT            
    183                      if (OSRunning == TRUE) {         /* Find highest priority task if multitasking has started */
   \   0182  D2930000          CMP.B   #1,&OSRunning   
   \   0186  0720              JNE     (?0094) 
    184                          OS_Sched();
   \   0188  B0120000          CALL    #OS_Sched       
    185                      }
    186                  } else {
   \   018C  043C              JMP     (?0094) 
   \   018E            ?0091:
    187                      OS_ENTER_CRITICAL();
    188                      OSTCBPrioTbl[prio] = (OS_TCB *)0;/* Make this priority available to others                 */
   \   018E  0B5B              ADD     R11,R11 
   \   0190  8B430000          MOV     #0,OSTCBPrioTbl(R11)    
    189                      OS_EXIT_CRITICAL();
   \   0194  32D2              EINT            
   \   0196            ?0094:
    190                  }
    191                  return (err);
   \   0196  4C4A              MOV.B   R10,R12 
    192              }
   \   0198  033C              JMP     (?0095) 
   \   019A            ?0089:
    193              OS_EXIT_CRITICAL();
   \   019A  32D2              EINT            
    194              return (OS_PRIO_EXIST);
   \   019C  7C402800          MOV.B   #40,R12 
    195          }
   \   01A0            ?0095:
   \   01A0  3B41              POP     R11     
   \   01A2  3A41              POP     R10     
   \   01A4  3041              RET             
   \   01A6            OSTaskCreateExt:
    196          #endif
    197          /*$PAGE*/

⌨️ 快捷键说明

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