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

📄 os_core.lst

📁 Motorola MCU HC08下的uCOSII移植源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
  127:      #if OS_MAX_EVENTS == 1                                       
  128:      OSEventFreeList              = &OSEventTbl[0];               /* Only have ONE event control block        */
  129:      OSEventFreeList->OSEventType = OS_EVENT_TYPE_UNUSED;
  130:      OSEventFreeList->OSEventPtr  = (OS_EVENT *)0;
  131:      #else
  132:      pevent1 = &OSEventTbl[0];
  133:      pevent2 = &OSEventTbl[1];
  134:      for (i = 0; i < (OS_MAX_EVENTS - 1); i++) {                  /* Init. list of free EVENT control blocks  */
  135:          pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
  136:          pevent1->OSEventPtr  = pevent2;
  137:          pevent1++;
  138:          pevent2++;
  139:      }
  140:      pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
  141:      pevent1->OSEventPtr  = (OS_EVENT *)0;
  142:      OSEventFreeList      = &OSEventTbl[0];
  143:      #endif
  144:  #endif
  145:  
  146:  #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
  147:      OS_FlagInit();                                               /* Initialize the event flag structures     */
  148:  #endif
  149:  
  150:  #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
  151:      OS_QInit();                                                  /* Initialize the message queue structures  */
  152:  #endif
  153:  
  154:  #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
  155:      OS_MemInit();                                                /* Initialize the memory manager            */
  156:  #endif
  157:  
  158:      /* ------------------------------------- CREATION OF 'IDLE' TASK --------------------------------------- */
  159:  #if OS_TASK_CREATE_EXT_EN > 0
  160:      #if OS_STK_GROWTH == 1
  161:      (void)OSTaskCreateExt(OS_TaskIdle,
  162:                            (void *)0,                                 /* No arguments passed to OS_TaskIdle() */
  163:                            &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Top-Of-Stack                     */
  164:                            OS_IDLE_PRIO,                              /* Lowest priority level                */
  165:                            OS_TASK_IDLE_ID,
  166:                            &OSTaskIdleStk[0],                         /* Set Bottom-Of-Stack                  */
  167:                            OS_TASK_IDLE_STK_SIZE,
  168:                            (void *)0,                                 /* No TCB extension                     */
  169:                            OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stack  */
  170:      #else
  171:      (void)OSTaskCreateExt(OS_TaskIdle,
  172:                            (void *)0,                                 /* No arguments passed to OS_TaskIdle() */
  173:                            &OSTaskIdleStk[0],                         /* Set Top-Of-Stack                     */
  174:                            OS_IDLE_PRIO,                              /* Lowest priority level                */
  175:                            OS_TASK_IDLE_ID,
  176:                            &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Bottom-Of-Stack                  */
  177:                            OS_TASK_IDLE_STK_SIZE,
  178:                            (void *)0,                                 /* No TCB extension                     */
  179:                            OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stack  */
  180:      #endif
  181:  #else
  182:      #if OS_STK_GROWTH == 1
  183:      (void)OSTaskCreate(OS_TaskIdle,
  00fc 450000           LDHX  @OS_TaskIdle
  00ff 89               PSHX  
  0100 8b               PSHH  
  0101 4f               CLRA  
  0102 87               PSHA  
  0103 87               PSHA  
  0104 450063           LDHX  @OSTaskIdleStk:99
  0107 89               PSHX  
  0108 8b               PSHH  
  0109 a60c             LDA   #12
  010b cd0000           JSR   OSTaskCreate
  010e a706             AIS   #6
  184:                         (void *)0,
  185:                         &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1],
  186:                         OS_IDLE_PRIO);
  187:      #else
  188:      (void)OSTaskCreate(OS_TaskIdle,
  189:                         (void *)0,
  190:                         &OSTaskIdleStk[0],
  191:                         OS_IDLE_PRIO);
  192:      #endif
  193:  #endif
  194:  
  195:      /* ------------------------------- CREATION OF 'STATISTIC' TASK ---------------------------------- */
  196:  #if OS_TASK_STAT_EN > 0
  197:      #if OS_TASK_CREATE_EXT_EN > 0
  198:          #if OS_STK_GROWTH == 1
  199:          (void)OSTaskCreateExt(OS_TaskStat,
  200:                                (void *)0,                                   /* No args passed to OS_TaskStat()*/
  201:                                &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],   /* Set Top-Of-Stack               */
  202:                                OS_STAT_PRIO,                                /* One higher than the idle task  */
  203:                                OS_TASK_STAT_ID,
  204:                                &OSTaskStatStk[0],                           /* Set Bottom-Of-Stack            */
  205:                                OS_TASK_STAT_STK_SIZE,
  206:                                (void *)0,                                   /* No TCB extension               */
  207:                                OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);  /* Enable stack checking + clear  */
  208:          #else
  209:          (void)OSTaskCreateExt(OS_TaskStat,
  210:                                (void *)0,                                   /* No args passed to OS_TaskStat()*/
  211:                                &OSTaskStatStk[0],                           /* Set Top-Of-Stack               */
  212:                                OS_STAT_PRIO,                                /* One higher than the idle task  */
  213:                                OS_TASK_STAT_ID,
  214:                                &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],   /* Set Bottom-Of-Stack            */
  215:                                OS_TASK_STAT_STK_SIZE,
  216:                                (void *)0,                                   /* No TCB extension               */
  217:                                OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);  /* Enable stack checking + clear  */
  218:          #endif
  219:      #else
  220:          #if OS_STK_GROWTH == 1
  221:          (void)OSTaskCreate(OS_TaskStat,
  222:                             (void *)0,                                      /* No args passed to OS_TaskStat()*/
  223:                             &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],      /* Set Top-Of-Stack               */
  224:                             OS_STAT_PRIO);                                  /* One higher than the idle task  */
  225:          #else
  226:          (void)OSTaskCreate(OS_TaskStat,
  227:                             (void *)0,                                      /* No args passed to OS_TaskStat()*/
  228:                             &OSTaskStatStk[0],                              /* Set Top-Of-Stack               */
  229:                             OS_STAT_PRIO);                                  /* One higher than the idle task  */
  230:          #endif
  231:      #endif
  232:  #endif
  233:  
  234:  #if OS_VERSION >= 204
  235:      OSInitHookEnd();                                                       /* Call port specific init. code  */
  0110 cd0000           JSR   OSInitHookEnd
  236:  #endif
  237:  }
  0113 a708             AIS   #8
  0115 81               RTS   
  238:  /*$PAGE*/
  239:  /*
  240:  *********************************************************************************************************
  241:  *                                              ENTER ISR
  242:  *
  243:  * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
  244:  *              service routine (ISR).  This allows uC/OS-II to keep track of interrupt nesting and thus
  245:  *              only perform rescheduling at the last nested ISR.
  246:  *
  247:  * Arguments  : none
  248:  *
  249:  * Returns    : none
  250:  *
  251:  * Notes      : 1) Your ISR can directly increment OSIntNesting without calling this function because
  252:  *                 OSIntNesting has been declared 'global'.  You MUST, however, be sure that the increment
  253:  *                 is performed 'indivisibly' by your processor to ensure proper access to this critical
  254:  *                 resource.
  255:  *              2) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
  256:  *              3) You MUST invoke OSIntEnter() and OSIntExit() in pair.  In other words, for every call
  257:  *                 to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
  258:  *                 end of the ISR.
  259:  *********************************************************************************************************
  260:  */
  261:  
  262:  void  OSIntEnter (void)
  263:  {

Function: OSIntEnter
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

  264:  #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
  265:      OS_CPU_SR  cpu_sr;
  266:  #endif    
  267:      
  268:      
  269:      OS_ENTER_CRITICAL();
  0000 9a               CLI   
  270:      if (OSIntNesting < 255) {
  0001 c60000           LDA   OSIntNesting
  0004 a1ff             CMP   #-1
  0006 2404             BCC   LC ;abs = 000c
  271:          OSIntNesting++;                          /* Increment ISR nesting level                        */
  0008 450000           LDHX  @OSIntNesting
  000b 7c               INC   ,X
  000c          LC:     
  272:      }
  273:      OS_EXIT_CRITICAL();
  000c 9b               SEI   
  274:  }
  000d 81               RTS   
  275:  /*$PAGE*/
  276:  /*
  277:  *********************************************************************************************************
  278:  *                                               EXIT ISR
  279:  *
  280:  * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR.  When
  281:  *              the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
  282:  *              a new, high-priority task, is ready to run.
  283:  *
  284:  * Arguments  : none
  285:  *
  286:  * Returns    : none
  287:  *
  288:  * Notes      : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair.  In other words, for every call
  289:  *                 to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
  290:  *                 end of the ISR.
  291:  *              2) Rescheduling is prevented when the scheduler is locked (see OSSchedLock())
  292:  *********************************************************************************************************
  293:  */
  294:  
  295:  void  OSIntExit (void)
  296:  {

Function: OSIntExit
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

  297:  #if OS_CRITICAL_METHOD == 3                            /* Allocate storage for CPU status register     */
  298:      OS_CPU_SR  cpu_sr;
  299:  #endif
  300:      
  301:      
  302:      OS_ENTER_CRITICAL();
  0000 9a               CLI   
  303:      if (OSIntNesting > 0) {                            /* Prevent OSIntNesting from wrapping           */
  0001 c60000           LDA   OSIntNesting
  0004 2704             BEQ   LA ;abs = 000a
  304:          OSIntNesting--;
  0006 450000           LDHX  @OSIntNesting
  0009 7a               DEC   ,X
  000a          LA:     
  305:      }
  306:      if ((OSIntNesting == 0) && (OSLockNesting == 0)) { /* Reschedule only if all ISRs complete ...     */
  000a c60000           LDA   OSIntNesting
  000d ca0000           ORA   OSLockNesting
  0010 2639             BNE   L4B ;abs = 004b
  307:          OSIntExitY    = OSUnMapTbl[OSRdyGrp];          /* ... and not locked.                          */
  0012 ce0000           LDX   OSRdyGrp
  0015 8c               CLRH  
  0016 d60000           LDA   @OSUnMapTbl,X
  0019 c70000           STA   OSIntExitY
  308:          OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
  001c 48               LSLA  
  001d 48               LSLA  
  001e 48               LSLA  
  001f ce0000           LDX   OSIntExitY
  0022 de0000           LDX   @OSRdyTbl,X
  0025 db0000           ADD   @OSUnMapTbl,X
  0028 c70000           STA   OSPrioHighRdy
  309:          if (OSPrioHighRdy != OSPrioCur) {              /* No Ctx Sw if current task is highest rdy     */
  002b c10000           CMP   OSPrioCur
  002e 271b             BEQ   L4B ;abs = 004b
  310:              OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy];
  0030 48               LSLA  
  0031 97               TAX   
  0032 de0001           LDX   @OSTCBPrioTbl:1,X
  0035 cf0001           STX   OSTCBHighRdy:1
  0038 97               TAX   
  0039 de0000           LDX   @OSTCBPrioTbl,X
  003c cf0000           STX   OSTCBHighRdy
  311:              OSCtxSwCtr++;                              /* Keep track of the number of context switches */
  003f 450000           LDHX  @OSCtxSwCtr
  0042 cd0000           JSR   _LINC
  0045 cd0000           JSR   _POP32
  312:              OSIntCtxSw();                              /* Perform interrupt level context switch       */
  0048 cd0000           JSR   OSIntCtxSw
  004b          L4B:    
  313:          }
  314:      }
  315:      OS_EXIT_CRITICAL();
  004b 9b               SEI   
  316:  }
  004c 81               RTS   
  317:  /*$PAGE*/
  318:  /*
  319:  *********************************************************************************************************
  320:  *                                          PREVENT SCHEDULING
  321:  *
  322:  * Description: This function is used to prevent rescheduling to take place.  This allows your application
  323:  *              to prevent context switches until you are ready to permit context switching.
  324:  *
  325:  * Arguments  : none
  326:  *
  327:  * Returns    : none
  328:  *
  329:  * Notes      : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair.  In other words, for every

⌨️ 快捷键说明

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