📄 os_time.lst
字号:
00ba ee33 LDX 51,X
00bc 9eef34 STX 52,SP
00bf 9e6f33 CLR 51,SP
00c2 9e6f32 CLR 50,SP
96: OSTimeDly(ticks);
00c5 9ee635 LDA 53,SP
00c8 cd0000 JSR OSTimeDly
97: while (loops > 0) {
00cb a731 AIS #49
00cd 2016 BRA LE5 ;abs = 00e5
00cf LCF:
98: OSTimeDly(32768);
00cf 4f CLRA
00d0 ae80 LDX #-128
00d2 cd0000 JSR OSTimeDly
99: OSTimeDly(32768);
00d5 4f CLRA
00d6 ae80 LDX #-128
00d8 cd0000 JSR OSTimeDly
100: loops--;
00db 95 TSX
00dc af04 AIX #4
00de 6d01 TST 1,X
00e0 2601 BNE LE3 ;abs = 00e3
00e2 7a DEC ,X
00e3 LE3:
00e3 6a01 DEC 1,X
00e5 LE5:
00e5 95 TSX
00e6 e605 LDA 5,X
00e8 ea04 ORA 4,X
00ea 26e3 BNE LCF ;abs = 00cf
101: }
102: return (OS_NO_ERR);
00ec 4f CLRA
00ed LED:
00ed 65 SKIP2 LF0 ;abs = 00f0
00ee LEE:
103: } else {
104: return (OS_TIME_ZERO_DLY);
00ee a654 LDA #84
00f0 LF0:
105: }
106: }
00f0 a708 AIS #8
00f2 81 RTS
107: /*$PAGE*/
108: /*
109: *********************************************************************************************************
110: * RESUME A DELAYED TASK
111: *
112: * Description: This function is used resume a task that has been delayed through a call to either
113: * OSTimeDly() or OSTimeDlyHMSM(). Note that you MUST NOT call this function to resume a
114: * task that is waiting for an event with timeout. This situation would make the task look
115: * like a timeout occurred (unless you desire this effect). Also, you cannot resume a task
116: * that has called OSTimeDlyHMSM() with a combined time that exceeds 65535 clock ticks. In
117: * other words, if the clock tick runs at 100 Hz then, you will not be able to resume a
118: * delayed task that called OSTimeDlyHMSM(0, 10, 55, 350) or higher.
119: *
120: * (10 Minutes * 60 + 55 Seconds + 0.35) * 100 ticks/second.
121: *
122: * Arguments : prio specifies the priority of the task to resume
123: *
124: * Returns : OS_NO_ERR Task has been resumed
125: * OS_PRIO_INVALID if the priority you specify is higher that the maximum allowed
126: * (i.e. >= OS_LOWEST_PRIO)
127: * OS_TIME_NOT_DLY Task is not waiting for time to expire
128: * OS_TASK_NOT_EXIST The desired task has not been created
129: *********************************************************************************************************
130: */
131:
132: INT8U OSTimeDlyResume (INT8U prio)
133: {
Function: OSTimeDlyResume
Source : C:\motoctest\ucos1\sources\Os_time.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_time.c.o
0000 87 PSHA
0001 a7fe AIS #-2
134: OS_TCB *ptcb;
135:
136:
137: if (prio >= OS_LOWEST_PRIO) {
0003 a103 CMP #3
0005 2504 BCS LB ;abs = 000b
138: return (OS_PRIO_INVALID);
0007 a62a LDA #42
0009 2051 BRA L5C ;abs = 005c
000b LB:
139: }
140: OS_ENTER_CRITICAL();
000b 9b SEI
141: ptcb = (OS_TCB *)OSTCBPrioTbl[prio]; /* Make sure that task exist */
000c 9eee03 LDX 3,SP
000f 58 LSLX
0010 8c CLRH
0011 e601 LDA @OSTCBPrioTbl:1,X
0013 9ee702 STA 2,SP
0016 e600 LDA @OSTCBPrioTbl,X
0018 95 TSX
0019 f7 STA ,X
142: if (ptcb != (OS_TCB *)0) {
001a 2604 BNE L20 ;abs = 0020
001c 6d01 TST 1,X
001e 2739 BEQ L59 ;abs = 0059
0020 L20:
143: if (ptcb->OSTCBDly != 0) { /* See if task is delayed */
0020 ee01 LDX 1,X
0022 87 PSHA
0023 8a PULH
0024 e607 LDA 7,X
0026 ea06 ORA 6,X
0028 272a BEQ L54 ;abs = 0054
144: ptcb->OSTCBDly = 0; /* Clear the time delay */
002a 6f07 CLR 7,X
002c 6f06 CLR 6,X
145: if (!(ptcb->OSTCBStat & OS_STAT_SUSPEND)) { /* See if task is ready to run */
002e e608 LDA 8,X
0030 a508 BIT #8
0032 261c BNE L50 ;abs = 0050
146: OSRdyGrp |= ptcb->OSTCBBitY; /* Make task ready to run */
0034 b600 LDA OSRdyGrp
0036 ea0d ORA 13,X
0038 b700 STA OSRdyGrp
147: OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
003a 89 PSHX
003b ee0b LDX 11,X
003d 89 PSHX
003e 9eee02 LDX 2,SP
0041 e60c LDA 12,X
0043 8c CLRH
0044 88 PULX
0045 ea00 ORA @OSRdyTbl,X
0047 e700 STA @OSRdyTbl,X
0049 a701 AIS #1
148: OS_EXIT_CRITICAL();
004b 9a CLI
149: OSSched(); /* See if this is new highest priority */
004c cd0000 JSR OSSched
150: } else {
004f 21 SKIP1 L51 ;abs = 0051
0050 L50:
151: OS_EXIT_CRITICAL(); /* Task may be suspended */
0050 9a CLI
0051 L51:
152: }
153: return (OS_NO_ERR);
0051 4f CLRA
0052 2008 BRA L5C ;abs = 005c
0054 L54:
154: } else {
155: OS_EXIT_CRITICAL();
0054 9a CLI
156: return (OS_TIME_NOT_DLY); /* Indicate that task was not delayed */
0055 a650 LDA #80
0057 2003 BRA L5C ;abs = 005c
0059 L59:
157: }
158: } else {
159: OS_EXIT_CRITICAL();
0059 9a CLI
160: return (OS_TASK_NOT_EXIST); /* The task does not exist */
005a a60b LDA #11
005c L5C:
161: }
162: }
005c a703 AIS #3
005e 81 RTS
163: /*$PAGE*/
164: /*
165: *********************************************************************************************************
166: * GET CURRENT SYSTEM TIME
167: *
168: * Description: This function is used by your application to obtain the current value of the 32-bit
169: * counter which keeps track of the number of clock ticks.
170: *
171: * Arguments : none
172: *
173: * Returns : The current value of OSTime
174: *********************************************************************************************************
175: */
176:
177: INT32U OSTimeGet (void)
178: {
Function: OSTimeGet
Source : C:\motoctest\ucos1\sources\Os_time.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_time.c.o
0000 87 PSHA
0001 89 PSHX
0002 a7fc AIS #-4
179: INT32U ticks;
180:
181:
182: OS_ENTER_CRITICAL();
0004 9b SEI
183: ticks = OSTime;
0005 b600 LDA OSTime
0007 95 TSX
0008 e703 STA 3,X
000a 4f CLRA
000b 6f02 CLR 2,X
000d 6f01 CLR 1,X
000f f7 STA ,X
184: OS_EXIT_CRITICAL();
0010 9a CLI
185: return (ticks);
0011 e605 LDA 5,X
0013 87 PSHA
0014 e604 LDA 4,X
0016 87 PSHA
0017 a604 LDA #4
0019 cd0000 JSR _COPY
186: }
001c a706 AIS #6
001e 81 RTS
187:
188: /*
189: *********************************************************************************************************
190: * SET SYSTEM CLOCK
191: *
192: * Description: This function sets the 32-bit counter which keeps track of the number of clock ticks.
193: *
194: * Arguments : ticks specifies the new value that OSTime needs to take.
195: *
196: * Returns : none
197: *********************************************************************************************************
198: */
199:
200: void OSTimeSet (INT32U ticks)
201: {
Function: OSTimeSet
Source : C:\motoctest\ucos1\sources\Os_time.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_time.c.o
202: OS_ENTER_CRITICAL();
0000 9b SEI
203: OSTime = ticks;
0001 9ee606 LDA 6,SP
0004 b700 STA OSTime
204: OS_EXIT_CRITICAL();
0006 9a CLI
205: }
0007 81 RTS
206:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -