📄 ucos_ii.lst
字号:
236: OSRdyGrp = 0; /* Clear the ready list */
0020 3f00 CLR OSRdyGrp
237: for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
0022 95 TSX
0023 6f02 CLR 2,X
0025 6f01 CLR 1,X
0027 L27:
238: OSRdyTbl[i] = 0;
0027 9eee03 LDX 3,SP
002a 8c CLRH
002b 6f00 CLR @OSRdyTbl,X
002d 95 TSX
002e 6c02 INC 2,X
0030 2602 BNE L34 ;abs = 0034
0032 6c01 INC 1,X
0034 L34:
0034 cd00c8 JSR LC8 ;abs = 00c8
0037 650001 CPHX #1
003a 25eb BCS L27 ;abs = 0027
239: }
240:
241: OSPrioCur = 0;
003c 3f00 CLR OSPrioCur
242: OSPrioHighRdy = 0;
003e 3f00 CLR OSPrioHighRdy
243: OSTCBHighRdy = (OS_TCB *)0; /* TCB Initialization */
0040 5f CLRX
0041 8c CLRH
0042 3500 STHX OSTCBHighRdy
244: OSTCBCur = (OS_TCB *)0;
0044 5f CLRX
0045 8c CLRH
0046 3500 STHX OSTCBCur
245: OSTCBList = (OS_TCB *)0;
0048 5f CLRX
0049 8c CLRH
004a 3500 STHX OSTCBList
246: for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) { /* Clear the priority table */
004c 95 TSX
004d 6f02 CLR 2,X
004f 6f01 CLR 1,X
0051 L51:
247: OSTCBPrioTbl[i] = (OS_TCB *)0;
0051 9eee03 LDX 3,SP
0054 58 LSLX
0055 8c CLRH
0056 6f01 CLR @OSTCBPrioTbl:1,X
0058 6f00 CLR @OSTCBPrioTbl,X
005a 95 TSX
005b 6c02 INC 2,X
005d 2602 BNE L61 ;abs = 0061
005f 6c01 INC 1,X
0061 L61:
0061 ad65 BSR LC8 ;abs = 00c8
0063 650004 CPHX #4
0066 25e9 BCS L51 ;abs = 0051
248: }
249: for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) { /* Init. list of free TCBs */
0068 95 TSX
0069 6f02 CLR 2,X
006b 6f01 CLR 1,X
006d L6D:
250: OSTCBTbl[i].OSTCBNext = &OSTCBTbl[i + 1];
006d 95 TSX
006e e602 LDA 2,X
0070 ee01 LDX 1,X
0072 87 PSHA
0073 4c INCA
0074 2601 BNE L77 ;abs = 0077
0076 5c INCX
0077 L77:
0077 9eef02 STX 2,SP
007a 45000e LDHX #14
007d 89 PSHX
007e 8b PSHH
007f 9eee04 LDX 4,SP
0082 cd0000 JSR _IMUL
0085 a702 AIS #2
0087 ab00 ADD @OSTCBTbl
0089 ae0e LDX #14
008b 87 PSHA
008c 9ee602 LDA 2,SP
008f 42 MUL
0090 88 PULX
0091 8c CLRH
0092 9eef01 STX 1,SP
0095 97 TAX
0096 86 PULA
0097 e703 STA @OSTCBTbl:3,X
0099 6f02 CLR @OSTCBTbl:2,X
009b 95 TSX
009c 6c02 INC 2,X
009e 2602 BNE LA2 ;abs = 00a2
00a0 6c01 INC 1,X
00a2 LA2:
00a2 ad24 BSR LC8 ;abs = 00c8
00a4 650002 CPHX #2
00a7 25c4 BCS L6D ;abs = 006d
251: }
252: OSTCBTbl[OS_MAX_TASKS + OS_N_SYS_TASKS - 1].OSTCBNext = (OS_TCB *)0; /* Last OS_TCB */
00a9 5f CLRX
00aa 8c CLRH
00ab 351e STHX OSTCBTbl:30
253: OSTCBFreeList = &OSTCBTbl[0];
00ad a600 LDA @OSTCBTbl
00af b701 STA OSTCBFreeList:1
00b1 3f00 CLR OSTCBFreeList
254: OSTaskCreate(OSTaskIdle, (void *)0, &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], OS_IDLE_PRIO);
00b3 450000 LDHX @OSTaskIdle
00b6 89 PSHX
00b7 8b PSHH
00b8 4f CLRA
00b9 87 PSHA
00ba 87 PSHA
00bb 450016 LDHX @OSTaskIdleStk:22
00be 89 PSHX
00bf 8b PSHH
00c0 a603 LDA #3
00c2 cd0000 JSR OSTaskCreate
255:
256: }
00c5 a709 AIS #9
00c7 81 RTS
00c8 LC8:
00c8 95 TSX
00c9 e603 LDA 3,X
00cb 87 PSHA
00cc ee04 LDX 4,X
00ce 8a PULH
00cf 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\Ucos_ii.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\Ucos_ii.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 262e BNE L37 ;abs = 0037
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 2716 BEQ L37 ;abs = 0037
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 ae00 LDX @OSCtxSwCtr
002e cd0000 JSR _LINC
0031 cd0000 JSR _POP32
316: OSIntCtxSw(); /* Perform interrupt level context switch */
0034 cd0000 JSR OSIntCtxSw
0037 L37:
317: }
318: }
319: OS_EXIT_CRITICAL();
0037 9a CLI
320: }
0038 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: *
334: * Notes : 1) This function is INTERNAL to uC/OS-II and your application should not call it.
335: * 2) Rescheduling is prevented when the scheduler is locked (see OSSchedLock())
336: *********************************************************************************************************
337: */
338:
339: void OSSched (void)
340: {
Function: OSSched
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\Ucos_ii.c.o
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -