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

📄 os_core.lst

📁 在MC68HC908JB8上移植UCOSII成功
💻 LST
📖 第 1 页 / 共 5 页
字号:
  000e 3f00             CLR   OSRdyGrp
  237:      for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
  0010 95               TSX   
  0011 6f02             CLR   2,X
  0013 6f01             CLR   1,X
  0015          L15:    
  238:          OSRdyTbl[i] = 0;
  0015 9eee03           LDX   3,SP
  0018 8c               CLRH  
  0019 6f00             CLR   @OSRdyTbl,X
  001b 95               TSX   
  001c 6c02             INC   2,X
  001e 2602             BNE   L22 ;abs = 0022
  0020 6c01             INC   1,X
  0022          L22:    
  0022 cd00b6           JSR   LB6 ;abs = 00b6
  0025 650001           CPHX  #1
  0028 25eb             BCS   L15 ;abs = 0015
  239:      }
  240:                  
  241:      OSPrioCur     = 0;
  002a 3f00             CLR   OSPrioCur
  242:      OSPrioHighRdy = 0;                                           
  002c 3f00             CLR   OSPrioHighRdy
  243:      OSTCBHighRdy  = (OS_TCB *)0;                                 /* TCB Initialization                 */
  002e 5f               CLRX  
  002f 8c               CLRH  
  0030 3500             STHX  OSTCBHighRdy
  244:      OSTCBCur      = (OS_TCB *)0;
  0032 5f               CLRX  
  0033 8c               CLRH  
  0034 3500             STHX  OSTCBCur
  245:      OSTCBList     = (OS_TCB *)0;
  0036 5f               CLRX  
  0037 8c               CLRH  
  0038 3500             STHX  OSTCBList
  246:      for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) {                 /* Clear the priority table           */
  003a 95               TSX   
  003b 6f02             CLR   2,X
  003d 6f01             CLR   1,X
  003f          L3F:    
  247:          OSTCBPrioTbl[i] = (OS_TCB *)0;
  003f 9eee03           LDX   3,SP
  0042 58               LSLX  
  0043 8c               CLRH  
  0044 6f01             CLR   @OSTCBPrioTbl:1,X
  0046 6f00             CLR   @OSTCBPrioTbl,X
  0048 95               TSX   
  0049 6c02             INC   2,X
  004b 2602             BNE   L4F ;abs = 004f
  004d 6c01             INC   1,X
  004f          L4F:    
  004f ad65             BSR   LB6 ;abs = 00b6
  0051 650004           CPHX  #4
  0054 25e9             BCS   L3F ;abs = 003f
  248:      }
  249:      for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) {  /* Init. list of free TCBs            */
  0056 95               TSX   
  0057 6f02             CLR   2,X
  0059 6f01             CLR   1,X
  005b          L5B:    
  250:          OSTCBTbl[i].OSTCBNext = &OSTCBTbl[i + 1];
  005b 95               TSX   
  005c e602             LDA   2,X
  005e ee01             LDX   1,X
  0060 87               PSHA  
  0061 4c               INCA  
  0062 2601             BNE   L65 ;abs = 0065
  0064 5c               INCX  
  0065          L65:    
  0065 9eef02           STX   2,SP
  0068 45000e           LDHX  #14
  006b 89               PSHX  
  006c 8b               PSHH  
  006d 9eee04           LDX   4,SP
  0070 cd0000           JSR   _IMUL
  0073 a702             AIS   #2
  0075 ab00             ADD   @OSTCBTbl
  0077 ae0e             LDX   #14
  0079 87               PSHA  
  007a 9ee602           LDA   2,SP
  007d 42               MUL   
  007e 88               PULX  
  007f 8c               CLRH  
  0080 9eef01           STX   1,SP
  0083 97               TAX   
  0084 86               PULA  
  0085 e703             STA   @OSTCBTbl:3,X
  0087 6f02             CLR   @OSTCBTbl:2,X
  0089 95               TSX   
  008a 6c02             INC   2,X
  008c 2602             BNE   L90 ;abs = 0090
  008e 6c01             INC   1,X
  0090          L90:    
  0090 ad24             BSR   LB6 ;abs = 00b6
  0092 650002           CPHX  #2
  0095 25c4             BCS   L5B ;abs = 005b
  251:      }
  252:      OSTCBTbl[OS_MAX_TASKS + OS_N_SYS_TASKS - 1].OSTCBNext = (OS_TCB *)0;    /* Last OS_TCB             */
  0097 5f               CLRX  
  0098 8c               CLRH  
  0099 351e             STHX  OSTCBTbl:30
  253:      OSTCBFreeList                                         = &OSTCBTbl[0];
  009b a600             LDA   @OSTCBTbl
  009d b701             STA   OSTCBFreeList:1
  009f 3f00             CLR   OSTCBFreeList
  254:      OSTaskCreate(OSTaskIdle, (void *)0, (void*)&OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], OS_IDLE_PRIO);
  00a1 450000           LDHX  @OSTaskIdle
  00a4 89               PSHX  
  00a5 8b               PSHH  
  00a6 4f               CLRA  
  00a7 87               PSHA  
  00a8 87               PSHA  
  00a9 45001d           LDHX  @OSTaskIdleStk:29
  00ac 89               PSHX  
  00ad 8b               PSHH  
  00ae a603             LDA   #3
  00b0 cd0000           JSR   OSTaskCreate
  255:  
  256:  }
  00b3 a709             AIS   #9
  00b5 81               RTS   
  00b6          LB6:    
  00b6 95               TSX   
  00b7 e603             LDA   3,X
  00b9 87               PSHA  
  00ba ee04             LDX   4,X
  00bc 8a               PULH  
  00bd 81               RTS   
  257:  /*$PAGE*/
  258:  /*
  259:  *********************************************************************************************************
  260:  *                                              ENTER ISR
  261:  *
  262:  * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
  263:  *              service routine (ISR).  This allows uC/OS-II to keep track of interrupt nesting and thus
  264:  *              only perform rescheduling at the last nested ISR.
  265:  *
  266:  * Arguments  : none
  267:  *
  268:  * Returns    : none
  269:  *
  270:  * Notes      : 1) Your ISR can directly increment OSIntNesting without calling this function because 
  271:  *                 OSIntNesting has been declared 'global'.  You MUST, however, be sure that the increment
  272:  *                 is performed 'indivisibly' by your processor to ensure proper access to this critical
  273:  *                 resource.
  274:  *              2) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
  275:  *              3) You MUST invoke OSIntEnter() and OSIntExit() in pair.  In other words, for every call
  276:  *                 to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
  277:  *                 end of the ISR.
  278:  *********************************************************************************************************
  279:  */
  280:  
  281:  void OSIntEnter (void)
  282:  {

Function: OSIntEnter
Source  : C:\motoctest\ucos1\sources\os_core.c
Options : -Cc -EnvGENPATH=C:\motoctest\ucos1;C:\motoctest\ucos1\bin;C:\motoctest\ucos1\cmd;C:\motoctest\ucos1\prm;C:\motoctest\ucos1\sources;C:\Metrowerks\lib\HC08c\LIB;C:\Metrowerks\lib\HC08c\src;C:\Metrowerks\lib\HC08c\INCLUDE -EnvLIBPATH=C:\Metrowerks\lib\HC08c\INCLUDE -EnvOBJPATH=C:\motoctest\ucos1\bin -EnvTEXTPATH=C:\motoctest\ucos1\bin -La=%f.inc -Lasm=%n.lst -ObjN=C:\motoctest\ucos1\ucos1_Data\MMDS-MMEVS\ObjectCode\os_core.c.o

  283:      OS_ENTER_CRITICAL();
  0000 9b               SEI   
  284:      OSIntNesting++;                              /* Increment ISR nesting level                        */
  0001 3c00             INC   OSIntNesting
  285:      OS_EXIT_CRITICAL();
  0003 9a               CLI   
  286:  }
  0004 81               RTS   
  287:  /*$PAGE*/
  288:  /*
  289:  *********************************************************************************************************
  290:  *                                               EXIT ISR
  291:  *
  292:  * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR.  When 
  293:  *              the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
  294:  *              a new, high-priority task, is ready to run.
  295:  *
  296:  * Arguments  : none
  297:  *
  298:  * Returns    : none
  299:  *
  300:  * Notes      : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair.  In other words, for every call
  301:  *                 to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
  302:  *                 end of the ISR.
  303:  *              2) Rescheduling is prevented when the scheduler is locked (see OSSchedLock())
  304:  *********************************************************************************************************
  305:  */
  306:  
  307:  void OSIntExit (void)
  308:  {

Function: OSIntExit
Source  : C:\motoctest\ucos1\sources\os_core.c
Options : -Cc -EnvGENPATH=C:\motoctest\ucos1;C:\motoctest\ucos1\bin;C:\motoctest\ucos1\cmd;C:\motoctest\ucos1\prm;C:\motoctest\ucos1\sources;C:\Metrowerks\lib\HC08c\LIB;C:\Metrowerks\lib\HC08c\src;C:\Metrowerks\lib\HC08c\INCLUDE -EnvLIBPATH=C:\Metrowerks\lib\HC08c\INCLUDE -EnvOBJPATH=C:\motoctest\ucos1\bin -EnvTEXTPATH=C:\motoctest\ucos1\bin -La=%f.inc -Lasm=%n.lst -ObjN=C:\motoctest\ucos1\ucos1_Data\MMDS-MMEVS\ObjectCode\os_core.c.o

  309:      OS_ENTER_CRITICAL();
  0000 9b               SEI   
  310:      if ((--OSIntNesting | OSLockNesting) == 0) { /* Reschedule only if all ISRs completed & not locked */
  0001 3a00             DEC   OSIntNesting
  0003 b600             LDA   OSIntNesting
  0005 ba00             ORA   OSLockNesting
  0007 2628             BNE   L31 ;abs = 0031
  311:          OSIntExitY    = OSUnMapTbl[OSRdyGrp];
  0009 be00             LDX   OSRdyGrp
  000b 8c               CLRH  
  000c d60000           LDA   @OSUnMapTbl,X
  000f b700             STA   OSIntExitY
  312:          OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
  0011 48               LSLA  
  0012 48               LSLA  
  0013 48               LSLA  
  0014 be00             LDX   OSIntExitY
  0016 ee00             LDX   @OSRdyTbl,X
  0018 db0000           ADD   @OSUnMapTbl,X
  001b b700             STA   OSPrioHighRdy
  313:          if (OSPrioHighRdy != OSPrioCur) {        /* No context switch if current task is highest ready */
  001d b100             CMP   OSPrioCur
  001f 2710             BEQ   L31 ;abs = 0031
  314:              OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy];
  0021 48               LSLA  
  0022 97               TAX   
  0023 ee01             LDX   @OSTCBPrioTbl:1,X
  0025 bf01             STX   OSTCBHighRdy:1
  0027 97               TAX   
  0028 ee00             LDX   @OSTCBPrioTbl,X
  002a bf00             STX   OSTCBHighRdy
  315:              OSCtxSwCtr++;                        /* Keep track of the number of context switches       */
  002c 3c00             INC   OSCtxSwCtr
  316:              OSIntCtxSw();                        /* Perform interrupt level context switch             */
  002e cd0000           JSR   OSIntCtxSw
  0031          L31:    
  317:          }
  318:      }
  319:      OS_EXIT_CRITICAL();
  0031 9a               CLI   
  320:  }
  0032 81               RTS   
  321:  /*$PAGE*/
  322:  /*
  323:  *********************************************************************************************************
  324:  *                                              SCHEDULER
  325:  *
  326:  * Description: This function is called by other uC/OS-II services to determine whether a new, high
  327:  *              priority task has been made ready to run.  This function is invoked by TASK level code
  328:  *              and is not used to reschedule tasks from ISRs (see OSIntExit() for ISR rescheduling).
  329:  *
  330:  * Arguments  : none
  331:  *
  332:  * Returns    : none
  333:  *

⌨️ 快捷键说明

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