📄 os_time.lst
字号:
\ 0080 ?0067:
92 if (milli > 999) {
\ 0080 3C90E803 CMP #1000,R12
\ 0084 0328 JNC (?0069)
93 return (OS_TIME_INVALID_MILLI);
\ 0086 7C405300 MOV.B #83,R12
94 }
\ 008A 403C JMP (?0073)
\ 008C ?0069:
95 /* Compute the total number of clock ticks required.. */
96 /* .. (rounded to the nearest tick) */
97 ticks = ((INT32U)hours * 3600L + (INT32U)minutes * 60L + (INT32U)seconds) * OS_TICKS_PER_SEC
98 + OS_TICKS_PER_SEC * ((INT32U)milli + 500L / OS_TICKS_PER_SEC) / 1000L;
\ 008C 0D43 MOV #0,R13
\ 008E 2C53 ADD #2,R12
\ 0090 0D63 ADDC #0,R13
\ 0092 3E40C800 MOV #200,R14
\ 0096 0F43 MOV #0,R15
\ 0098 B0120000 CALL #?L_MUL_L03
\ 009C 3E40E803 MOV #1000,R14
\ 00A0 0F43 MOV #0,R15
\ 00A2 B0120000 CALL #?UL_DIVMOD_L03
\ 00A6 084C MOV R12,R8
\ 00A8 094D MOV R13,R9
\ 00AA 0743 MOV #0,R7
\ 00AC 0C4A MOV R10,R12
\ 00AE 0D43 MOV #0,R13
\ 00B0 3E403C00 MOV #60,R14
\ 00B4 0F43 MOV #0,R15
\ 00B6 B0120000 CALL #?L_MUL_L03
\ 00BA 065C ADD R12,R6
\ 00BC 076D ADDC R13,R7
\ 00BE 0C4B MOV R11,R12
\ 00C0 0D43 MOV #0,R13
\ 00C2 3E40100E MOV #3600,R14
\ 00C6 0F43 MOV #0,R15
\ 00C8 B0120000 CALL #?L_MUL_L03
\ 00CC 065C ADD R12,R6
\ 00CE 076D ADDC R13,R7
\ 00D0 0C46 MOV R6,R12
\ 00D2 0D47 MOV R7,R13
\ 00D4 3E40C800 MOV #200,R14
\ 00D8 0F43 MOV #0,R15
\ 00DA B0120000 CALL #?L_MUL_L03
\ 00DE 085C ADD R12,R8
\ 00E0 096D ADDC R13,R9
99 loops = (INT16U)(ticks / 65536L); /* Compute the integral number of 65536 tick delays */
\ 00E2 0A49 MOV R9,R10
100 ticks = ticks % 65536L; /* Obtain the fractional number of ticks */
\ 00E4 38F3 AND #65535,R8
101 OSTimeDly((INT16U)ticks);
\ 00E6 0C48 MOV R8,R12
\ 00E8 B0120000 CALL #OSTimeDly
\ 00EC ?0071:
102 while (loops > 0) {
\ 00EC 0A93 CMP #0,R10
\ 00EE 0A24 JEQ (?0070)
103 OSTimeDly(32768);
\ 00F0 3C400080 MOV #32768,R12
\ 00F4 B0120000 CALL #OSTimeDly
104 OSTimeDly(32768);
\ 00F8 3C400080 MOV #32768,R12
\ 00FC B0120000 CALL #OSTimeDly
105 loops--;
\ 0100 3A53 ADD #-1,R10
\ 0102 F43F JMP (?0071)
\ 0104 ?0070:
106 }
107 return (OS_NO_ERR);
\ 0104 4C43 MOV.B #0,R12
108 }
\ 0106 023C JMP (?0073)
\ 0108 ?0061:
109 return (OS_TIME_ZERO_DLY);
\ 0108 7C405400 MOV.B #84,R12
110 }
\ 010C ?0073:
\ 010C 3741 POP R7
\ 010E 3641 POP R6
\ 0110 3941 POP R9
\ 0112 3841 POP R8
\ 0114 3B41 POP R11
\ 0116 3A41 POP R10
\ 0118 3041 RET
\ 011A OSTimeDlyResume:
111 #endif
112 /*$PAGE*/
113 /*
114 *********************************************************************************************************
115 * RESUME A DELAYED TASK
116 *
117 * Description: This function is used resume a task that has been delayed through a call to either
118 * OSTimeDly() or OSTimeDlyHMSM(). Note that you MUST NOT call this function to resume a
119 * task that is waiting for an event with timeout. This situation would make the task look
120 * like a timeout occurred (unless you desire this effect). Also, you cannot resume a task
121 * that has called OSTimeDlyHMSM() with a combined time that exceeds 65535 clock ticks. In
122 * other words, if the clock tick runs at 100 Hz then, you will not be able to resume a
123 * delayed task that called OSTimeDlyHMSM(0, 10, 55, 350) or higher.
124 *
125 * (10 Minutes * 60 + 55 Seconds + 0.35) * 100 ticks/second.
126 *
127 * Arguments : prio specifies the priority of the task to resume
128 *
129 * Returns : OS_NO_ERR Task has been resumed
130 * OS_PRIO_INVALID if the priority you specify is higher that the maximum allowed
131 * (i.e. >= OS_LOWEST_PRIO)
132 * OS_TIME_NOT_DLY Task is not waiting for time to expire
133 * OS_TASK_NOT_EXIST The desired task has not been created
134 *********************************************************************************************************
135 */
136
137 #if OS_TIME_DLY_RESUME_EN > 0
138 INT8U OSTimeDlyResume (INT8U prio)
139 {
140 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
141 OS_CPU_SR cpu_sr;
142 #endif
143 OS_TCB *ptcb;
144
145
146 if (prio >= OS_LOWEST_PRIO) {
\ 011A 7C900C00 CMP.B #12,R12
\ 011E 0328 JNC (?0075)
147 return (OS_PRIO_INVALID);
\ 0120 7C402A00 MOV.B #42,R12
148 }
\ 0124 3041 RET
\ 0126 ?0075:
149 OS_ENTER_CRITICAL();
\ 0126 32C2 DINT
150 ptcb = (OS_TCB *)OSTCBPrioTbl[prio]; /* Make sure that task exist */
\ 0128 7CF3 AND.B #-1,R12
\ 012A 0C5C ADD R12,R12
\ 012C 1D4C0000 MOV OSTCBPrioTbl(R12),R13
151 if (ptcb != (OS_TCB *)0) {
\ 0130 0D93 CMP #0,R13
\ 0132 1B24 JEQ (?0077)
152 if (ptcb->OSTCBDly != 0) { /* See if task is delayed */
\ 0134 8D931A00 CMP #0,26(R13)
\ 0138 1424 JEQ (?0079)
153 ptcb->OSTCBDly = 0; /* Clear the time delay */
\ 013A 8D431A00 MOV #0,26(R13)
154 if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) { /* See if task is ready to run */
\ 013E FDB21C00 BIT.B #8,28(R13)
\ 0142 0C20 JNE (?0081)
155 OSRdyGrp |= ptcb->OSTCBBitY; /* Make task ready to run */
\ 0144 D2DD2100 BIS.B 33(R13),&OSRdyGrp
\ 0148 0000
156 OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
\ 014A 5C4D1F00 MOV.B 31(R13),R12
\ 014E DCDD2000 BIS.B 32(R13),OSRdyTbl(R12)
\ 0152 0000
157 OS_EXIT_CRITICAL();
\ 0154 32D2 EINT
158 OS_Sched(); /* See if this is new highest priority */
\ 0156 B0120000 CALL #OS_Sched
159 } else {
\ 015A 013C JMP (?0082)
\ 015C ?0081:
160 OS_EXIT_CRITICAL(); /* Task may be suspended */
\ 015C 32D2 EINT
\ 015E ?0082:
161 }
162 return (OS_NO_ERR);
\ 015E 4C43 MOV.B #0,R12
163 } else {
\ 0160 3041 RET
\ 0162 ?0079:
164 OS_EXIT_CRITICAL();
\ 0162 32D2 EINT
165 return (OS_TIME_NOT_DLY); /* Indicate that task was not delayed */
\ 0164 7C405000 MOV.B #80,R12
166 }
\ 0168 3041 RET
\ 016A ?0077:
167 }
168 OS_EXIT_CRITICAL();
\ 016A 32D2 EINT
169 return (OS_TASK_NOT_EXIST); /* The task does not exist */
\ 016C 7C400B00 MOV.B #11,R12
170 }
\ 0170 3041 RET
\ 0172 OSTimeGet:
171 #endif
172 /*$PAGE*/
173 /*
174 *********************************************************************************************************
175 * GET CURRENT SYSTEM TIME
176 *
177 * Description: This function is used by your application to obtain the current value of the 32-bit
178 * counter which keeps track of the number of clock ticks.
179 *
180 * Arguments : none
181 *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -