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

📄 os_core.lst

📁 IAR project for MSP430 and uC/OS. All configured to start filling with tasks.
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   0024  B012A603          CALL    #OS_InitTaskStat        
    112          #endif
    113          
    114          #if OS_VERSION >= 204
    115              OSInitHookEnd();                                             /* Call port specific init. code            */
   \   0028  B0120000          CALL    #OSInitHookEnd  
    116          #endif
    117          }
   \   002C  3041              RET             
   \   002E            OSIntEnter:
    118          /*$PAGE*/
    119          /*
    120          *********************************************************************************************************
    121          *                                              ENTER ISR
    122          *
    123          * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
    124          *              service routine (ISR).  This allows uC/OS-II to keep track of interrupt nesting and thus
    125          *              only perform rescheduling at the last nested ISR.
    126          *
    127          * Arguments  : none
    128          *
    129          * Returns    : none
    130          *
    131          * Notes      : 1) This function should be called ith interrupts already disabled
    132          *              2) Your ISR can directly increment OSIntNesting without calling this function because
    133          *                 OSIntNesting has been declared 'global'.  
    134          *              3) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
    135          *              4) You MUST invoke OSIntEnter() and OSIntExit() in pair.  In other words, for every call
    136          *                 to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
    137          *                 end of the ISR.
    138          *              5) You are allowed to nest interrupts up to 255 levels deep.
    139          *              6) I removed the OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL() around the increment because
    140          *                 OSIntEnter() is always called with interrupts disabled.
    141          *********************************************************************************************************
    142          */
    143          
    144          void  OSIntEnter (void)
    145          {
    146              if (OSRunning == TRUE) {
   \   002E  D2934A04          CMP.B   #1,&OSRunning   
   \   0032  0520              JNE     (?0065) 
    147                  if (OSIntNesting < 255) {
   \   0034  F2934204          CMP.B   #255,&OSIntNesting      
   \   0038  022C              JC      (?0065) 
    148                      OSIntNesting++;                      /* Increment ISR nesting level                        */
   \   003A  D2534204          ADD.B   #1,&OSIntNesting        
   \   003E            ?0065:
    149                  }
    150              }
    151          }
   \   003E  3041              RET             
   \   0040            OSIntExit:
    152          /*$PAGE*/
    153          /*
    154          *********************************************************************************************************
    155          *                                               EXIT ISR
    156          *
    157          * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR.  When
    158          *              the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
    159          *              a new, high-priority task, is ready to run.
    160          *
    161          * Arguments  : none
    162          *
    163          * Returns    : none
    164          *
    165          * Notes      : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair.  In other words, for every call
    166          *                 to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
    167          *                 end of the ISR.
    168          *              2) Rescheduling is prevented when the scheduler is locked (see OS_SchedLock())
    169          *********************************************************************************************************
    170          */
    171          
    172          void  OSIntExit (void)
    173          {
    174          #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    175              OS_CPU_SR  cpu_sr;
    176          #endif
    177              
    178              
    179              if (OSRunning == TRUE) {
   \   0040  D2934A04          CMP.B   #1,&OSRunning   
   \   0044  2F20              JNE     (?0067) 
    180                  OS_ENTER_CRITICAL();
   \   0046  32C2              DINT            
    181                  if (OSIntNesting > 0) {                            /* Prevent OSIntNesting from wrapping       */
   \   0048  C2934204          CMP.B   #0,&OSIntNesting        
   \   004C  0224              JEQ     (?0069) 
    182                      OSIntNesting--;
   \   004E  F2534204          ADD.B   #-1,&OSIntNesting       
   \   0052            ?0069:
    183                  }
    184                  if ((OSIntNesting == 0) && (OSLockNesting == 0)) { /* Reschedule only if all ISRs complete ... */
   \   0052  C2934204          CMP.B   #0,&OSIntNesting        
   \   0056  2520              JNE     (?0075) 
   \   0058  C2934404          CMP.B   #0,&OSLockNesting       
   \   005C  2220              JNE     (?0075) 
    185                      OSIntExitY    = OSUnMapTbl[OSRdyGrp];          /* ... and not locked.                      */
   \   005E  5C424704          MOV.B   &OSRdyGrp,R12   
   \   0062  D24C0800          MOV.B   OSUnMapTbl(R12),&OSIntExitY     
   \   0066  4304
    186                      OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
   \   0068  5C424304          MOV.B   &OSIntExitY,R12 
   \   006C  5C4C4804          MOV.B   OSRdyTbl(R12),R12       
   \   0070  5D424304          MOV.B   &OSIntExitY,R13 
   \   0074  4D5D              ADD.B   R13,R13 
   \   0076  4D5D              ADD.B   R13,R13 
   \   0078  4D5D              ADD.B   R13,R13 
   \   007A  5D5C0800          ADD.B   OSUnMapTbl(R12),R13     
   \   007E  C24D4604          MOV.B   R13,&OSPrioHighRdy      
    187                      if (OSPrioHighRdy != OSPrioCur) {              /* No Ctx Sw if current task is highest rdy */
   \   0082  D2924604          CMP.B   &OSPrioHighRdy,&OSPrioCur       
   \   0086  4504
   \   0088  0C24              JEQ     (?0075) 
    188                          OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy];
   \   008A  5C424604          MOV.B   &OSPrioHighRdy,R12      
   \   008E  0C5C              ADD     R12,R12 
   \   0090  924C5808          MOV     OSTCBPrioTbl(R12),&OSTCBHighRdy 
   \   0094  5408
    189                          OSCtxSwCtr++;                              /* Keep track of the number of ctx switches */
   \   0096  92530000          ADD     #1,&OSCtxSwCtr  
   \   009A  82630200          ADDC    #0,&(OSCtxSwCtr+2)      
    190                          OSIntCtxSw();                              /* Perform interrupt level ctx switch       */
   \   009E  B0120000          CALL    #OSIntCtxSw     
   \   00A2            ?0075:
    191                      }
    192                  }
    193                  OS_EXIT_CRITICAL();
   \   00A2  32D2              EINT            
   \   00A4            ?0067:
    194              }
    195          }
   \   00A4  3041              RET             
   \   00A6            OSSchedLock:
    196          /*$PAGE*/
    197          /*
    198          *********************************************************************************************************
    199          *                                          PREVENT SCHEDULING
    200          *
    201          * Description: This function is used to prevent rescheduling to take place.  This allows your application
    202          *              to prevent context switches until you are ready to permit context switching.
    203          *
    204          * Arguments  : none
    205          *
    206          * Returns    : none
    207          *
    208          * Notes      : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair.  In other words, for every
    209          *                 call to OSSchedLock() you MUST have a call to OSSchedUnlock().
    210          *********************************************************************************************************
    211          */
    212          
    213          #if OS_SCHED_LOCK_EN > 0
    214          void  OSSchedLock (void)
    215          {
    216          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    217              OS_CPU_SR  cpu_sr;
    218          #endif    
    219              
    220              
    221              if (OSRunning == TRUE) {                     /* Make sure multitasking is running                  */
   \   00A6  D2934A04          CMP.B   #1,&OSRunning   
   \   00AA  0720              JNE     (?0077) 
    222                  OS_ENTER_CRITICAL();
   \   00AC  32C2              DINT            
    223                  if (OSLockNesting < 255) {               /* Prevent OSLockNesting from wrapping back to 0      */
   \   00AE  F2934404          CMP.B   #255,&OSLockNesting     
   \   00B2  022C              JC      (?0079) 
    224                      OSLockNesting++;                     /* Increment lock nesting level                       */
   \   00B4  D2534404          ADD.B   #1,&OSLockNesting       
   \   00B8            ?0079:
    225                  }
    226                  OS_EXIT_CRITICAL();
   \   00B8  32D2              EINT            
   \   00BA            ?0077:
    227              }
    228          }
   \   00BA  3041              RET             
   \   00BC            OSSchedUnlock:
    229          #endif    
    230          
    231          /*$PAGE*/
    232          /*
    233          *********************************************************************************************************
    234          *                                          ENABLE SCHEDULING
    235          *
    236          * Description: This function is used to re-allow rescheduling.
    237          *
    238          * Arguments  : none
    239          *
    240          * Returns    : none
    241          *
    242          * Notes      : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair.  In other words, for every
    243          *                 call to OSSchedLock() you MUST have a call to OSSchedUnlock().
    244          *********************************************************************************************************
    245          */
    246          
    247          #if OS_SCHED_LOCK_EN > 0
    248          void  OSSchedUnlock (void)
    249          {
    250          #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    251              OS_CPU_SR  cpu_sr;
    252          #endif    
    253              
    254              
    255              if (OSRunning == TRUE) {                                   /* Make sure multitasking is running    */
   \   00BC  D2934A04          CMP.B   #1,&OSRunning   
   \   00C0  1320              JNE     (?0089) 
    256                  OS_ENTER_CRITICAL();
   \   00C2  32C2              DINT            
    257                  if (OSLockNesting > 0) {                               /* Do not decrement if already 0        */
   \   00C4  C2934404          CMP.B   #0,&OSLockNesting       
   \   00C8  0E24              JEQ     (?0083) 
    258                      OSLockNesting--;                                   /* Decrement lock nesting level         */
   \   00CA  F2534404          ADD.B   #-1,&OSLockNesting      
    259                      if ((OSLockNesting == 0) && (OSIntNesting == 0)) { /* See if sched. enabled and not an ISR */
   \   00CE  C2934404          CMP.B   #0,&OSLockNesting       
   \   00D2  0720              JNE     (?0085) 
   \   00D4  C2934204          CMP.B   #0,&OSIntNesting        
   \   00D8  0420              JNE     (?0085) 
    260                          OS_EXIT_CRITICAL();
   \   00DA  32D2              EINT            
    261                          OS_Sched();                                    /* See if a HPT is ready                */
   \   00DC  B0121604          CALL    #OS_Sched       
    262                      } else {
   \   00E0  3041              RET             
   \   00E2            ?0085:
    263                          OS_EXIT_CRITICAL();
   \   00E2  32D2              EINT            
    264                      }
    265                  } else {

⌨️ 快捷键说明

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