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

📄 os_core.lst

📁 这是UCOS在HCO8上的移植源码,我想得到MC9S08系列上的源码,很着急,希望能得到.
💻 LST
📖 第 1 页 / 共 5 页
字号:
  330:  *                 call to OSSchedLock() you MUST have a call to OSSchedUnlock().
  331:  *********************************************************************************************************
  332:  */
  333:  
  334:  #if OS_SCHED_LOCK_EN > 0
  335:  void  OSSchedLock (void)
  336:  {
  337:  #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
  338:      OS_CPU_SR  cpu_sr;
  339:  #endif    
  340:      
  341:      
  342:      if (OSRunning == TRUE) {                     /* Make sure multitasking is running                  */
  343:          OS_ENTER_CRITICAL();
  344:          if (OSLockNesting < 255) {               /* Prevent OSLockNesting from wrapping back to 0      */
  345:              OSLockNesting++;                     /* Increment lock nesting level                       */
  346:          }
  347:          OS_EXIT_CRITICAL();
  348:      }
  349:  }
  350:  #endif    
  351:  
  352:  /*$PAGE*/
  353:  /*
  354:  *********************************************************************************************************
  355:  *                                          ENABLE SCHEDULING
  356:  *
  357:  * Description: This function is used to re-allow rescheduling.
  358:  *
  359:  * Arguments  : none
  360:  *
  361:  * Returns    : none
  362:  *
  363:  * Notes      : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair.  In other words, for every
  364:  *                 call to OSSchedLock() you MUST have a call to OSSchedUnlock().
  365:  *********************************************************************************************************
  366:  */
  367:  
  368:  #if OS_SCHED_LOCK_EN > 0
  369:  void  OSSchedUnlock (void)
  370:  {
  371:  #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
  372:      OS_CPU_SR  cpu_sr;
  373:  #endif    
  374:      
  375:      
  376:      if (OSRunning == TRUE) {                                   /* Make sure multitasking is running    */
  377:          OS_ENTER_CRITICAL();
  378:          if (OSLockNesting > 0) {                               /* Do not decrement if already 0        */
  379:              OSLockNesting--;                                   /* Decrement lock nesting level         */
  380:              if ((OSLockNesting == 0) && (OSIntNesting == 0)) { /* See if sched. enabled and not an ISR */
  381:                  OS_EXIT_CRITICAL();
  382:                  OS_Sched();                                    /* See if a HPT is ready                */
  383:              } else {
  384:                  OS_EXIT_CRITICAL();
  385:              }
  386:          } else {
  387:              OS_EXIT_CRITICAL();
  388:          }
  389:      }
  390:  }
  391:  #endif    
  392:  
  393:  /*$PAGE*/
  394:  /*
  395:  *********************************************************************************************************
  396:  *                                          START MULTITASKING
  397:  *
  398:  * Description: This function is used to start the multitasking process which lets uC/OS-II manages the
  399:  *              task that you have created.  Before you can call OSStart(), you MUST have called OSInit()
  400:  *              and you MUST have created at least one task.
  401:  *
  402:  * Arguments  : none
  403:  *
  404:  * Returns    : none
  405:  *
  406:  * Note       : OSStartHighRdy() MUST:
  407:  *                 a) Call OSTaskSwHook() then,
  408:  *                 b) Set OSRunning to TRUE.
  409:  *********************************************************************************************************
  410:  */
  411:  
  412:  void  OSStart (void)
  413:  {

Function: OSStart
Source  : F:\Workspace\MyProj\ucos-mc64\OS_CORE.C
Options : -Cni -La=%f.inc -Lasm=%n.lst -N -Os -Ou -Obfv -Oc -OiLib -Ol1 -Or

  414:      INT8U y;
  415:      INT8U x;
  416:  
  417:  
  418:      if (OSRunning == FALSE) {
  0000 c60000           LDA   OSRunning
  0003 2639             BNE   L3E ;abs = 003e
  419:          y             = OSUnMapTbl[OSRdyGrp];        /* Find highest priority's task priority number   */
  0005 ce0000           LDX   OSRdyGrp
  0008 8c               CLRH  
  0009 de0000           LDX   @OSUnMapTbl,X
  420:          x             = OSUnMapTbl[OSRdyTbl[y]];
  000c 89               PSHX  
  000d de0000           LDX   @OSRdyTbl,X
  0010 d60000           LDA   @OSUnMapTbl,X
  421:          OSPrioHighRdy = (INT8U)((y << 3) + x);
  0013 88               PULX  
  0014 58               LSLX  
  0015 58               LSLX  
  0016 58               LSLX  
  0017 87               PSHA  
  0018 9f               TXA   
  0019 9eeb01           ADD   1,SP
  001c c70000           STA   OSPrioHighRdy
  422:          OSPrioCur     = OSPrioHighRdy;
  001f c70000           STA   OSPrioCur
  423:          OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy]; /* Point to highest priority task ready to run    */
  0022 48               LSLA  
  0023 97               TAX   
  0024 de0001           LDX   @OSTCBPrioTbl:1,X
  0027 cf0001           STX   OSTCBHighRdy:1
  002a 97               TAX   
  002b d60000           LDA   @OSTCBPrioTbl,X
  002e c70000           STA   OSTCBHighRdy
  424:          OSTCBCur      = OSTCBHighRdy;
  0031 c70000           STA   OSTCBCur
  0034 c60001           LDA   OSTCBHighRdy:1
  0037 c70001           STA   OSTCBCur:1
  425:          OSStartHighRdy();                            /* Execute target specific code to start task     */
  003a cd0000           JSR   OSStartHighRdy
  003d 8a               PULH  
  003e          L3E:    
  426:      }
  427:  }
  003e 81               RTS   
  428:  /*$PAGE*/
  429:  /*
  430:  *********************************************************************************************************
  431:  *                                        STATISTICS INITIALIZATION
  432:  *
  433:  * Description: This function is called by your application to establish CPU usage by first determining
  434:  *              how high a 32-bit counter would count to in 1 second if no other tasks were to execute
  435:  *              during that time.  CPU usage is then determined by a low priority task which keeps track
  436:  *              of this 32-bit counter every second but this time, with other tasks running.  CPU usage is
  437:  *              determined by:
  438:  *
  439:  *                                             OSIdleCtr
  440:  *                 CPU Usage (%) = 100 * (1 - ------------)
  441:  *                                            OSIdleCtrMax
  442:  *
  443:  * Arguments  : none
  444:  *
  445:  * Returns    : none
  446:  *********************************************************************************************************
  447:  */
  448:  
  449:  #if OS_TASK_STAT_EN > 0
  450:  void  OSStatInit (void)
  451:  {
  452:  #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
  453:      OS_CPU_SR  cpu_sr;
  454:  #endif    
  455:      
  456:      
  457:      OSTimeDly(2);                                /* Synchronize with clock tick                        */
  458:      OS_ENTER_CRITICAL();
  459:      OSIdleCtr    = 0L;                           /* Clear idle counter                                 */
  460:      OS_EXIT_CRITICAL();
  461:      OSTimeDly(OS_TICKS_PER_SEC);                 /* Determine MAX. idle counter value for 1 second     */
  462:      OS_ENTER_CRITICAL();
  463:      OSIdleCtrMax = OSIdleCtr;                    /* Store maximum idle counter count in 1 second       */
  464:      OSStatRdy    = TRUE;
  465:      OS_EXIT_CRITICAL();
  466:  }
  467:  #endif
  468:  /*$PAGE*/
  469:  /*
  470:  *********************************************************************************************************
  471:  *                                         PROCESS SYSTEM TICK
  472:  *
  473:  * Description: This function is used to signal to uC/OS-II the occurrence of a 'system tick' (also known
  474:  *              as a 'clock tick').  This function should be called by the ticker ISR but, can also be
  475:  *              called by a high priority task.
  476:  *
  477:  * Arguments  : none
  478:  *
  479:  * Returns    : none
  480:  *********************************************************************************************************
  481:  */
  482:  
  483:  void  OSTimeTick (void)
  484:  {

Function: OSTimeTick
Source  : F:\Workspace\MyProj\ucos-mc64\OS_CORE.C
Options : -Cni -La=%f.inc -Lasm=%n.lst -N -Os -Ou -Obfv -Oc -OiLib -Ol1 -Or

  0000 a7fc             AIS   #-4
  485:  #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
  486:      OS_CPU_SR  cpu_sr;
  487:  #endif    
  488:      OS_TCB    *ptcb;
  489:  
  490:  
  491:      OSTimeTickHook();                                      /* Call user definable hook                 */
  0002 cd0000           JSR   OSTimeTickHook
  492:  #if OS_TIME_GET_SET_EN > 0   
  493:      OS_ENTER_CRITICAL();                                   /* Update the 32-bit tick counter           */
  0005 9a               CLI   
  494:      OSTime++;
  0006 450000           LDHX  @OSTime
  0009 cd0000           JSR   _LINC
  000c cd0000           JSR   _POP32
  495:      OS_EXIT_CRITICAL();
  000f 9b               SEI   
  496:  #endif    
  497:      ptcb = OSTCBList;                                      /* Point at first TCB in TCB list           */
  0010 c60001           LDA   OSTCBList:1
  0013 95               TSX   
  0014 e703             STA   3,X
  0016 c60000           LDA   OSTCBList
  0019 e702             STA   2,X
  498:      while (ptcb->OSTCBPrio != OS_IDLE_PRIO) {              /* Go through all TCBs in TCB list          */
  001b 2070             BRA   L8D ;abs = 008d
  001d          L1D:    
  499:          OS_ENTER_CRITICAL();
  001d 9a               CLI   
  500:          if (ptcb->OSTCBDly != 0) {                         /* Delayed or waiting for event with TO     */
  001e 9eee04           LDX   4,SP
  0021 9ee603           LDA   3,SP
  0024 87               PSHA  
  0025 8a               PULH  
  0026 e607             LDA   7,X
  0028 ea06             ORA   6,X
  002a 274e             BEQ   L7A ;abs = 007a
  501:              if (--ptcb->OSTCBDly == 0) {                   /* Decrement nbr of ticks to end of delay   */
  002c 9f               TXA   
  002d ab06             ADD   #6
  002f 87               PSHA  
  0030 8b               PSHH  
  0031 86               PULA  
  0032 a900             ADC   #0
  0034 87               PSHA  
  0035 8b               PSHH  
  0036 86               PULA  
  0037 9ee703           STA   3,SP
  003a 86               PULA  
  003b 87               PSHA  
  003c 9eef04           STX   4,SP
  003f 8a               PULH  
  0040 88               PULX  
  0041 6d01             TST   1,X
  0043 2601             BNE   L46 ;abs = 0046
  0045 7a               DEC   ,X
  0046          L46:    
  0046 6a01             DEC   1,X
  0048 95               TSX   
  0049 f6               LDA   ,X
  004a 87               PSHA  
  004b ee01             LDX   1,X
  004d 8a               PULH  
  004e e607             LDA   7,X
  0050 ea06             ORA   6,X
  0052 2626             BNE   L7A ;abs = 007a
  502:                  if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == 0x00) {   /* Is task suspended?             */
  0054 e608             LDA   8,X
  0056 a508             BIT   #8
  0058 261a             BNE   L74 ;abs = 0074
  503:                      OSRdyGrp               |= ptcb->OSTCBBitY; /* No,  Make task Rdy to Run (timed out)*/
  005a c60000           LDA   OSRdyGrp
  005d ea0d             ORA   13,X
  005f c70000           STA   OSRdyGrp
  504:                      OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
  0062 ee0b             LDX   11,X

⌨️ 快捷键说明

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