📄 os_time.lst
字号:
96 INT8U OSTimeDlyHMSM (INT8U hours, INT8U minutes, INT8U seconds, INT16U ms)
97 {
\ OSTimeDlyHMSM:
\ 00000000 30B5 PUSH {R4,R5,LR}
98 INT32U ticks;
99 INT16U loops;
100
101
102 if (OSIntNesting > 0) { /* See if trying to call from an ISR */
\ 00000002 .... LDR.N R4,??DataTable3 ;; OSIntNesting
\ 00000004 2478 LDRB R4,[R4, #+0]
\ 00000006 002C CMP R4,#+0
\ 00000008 01D0 BEQ.N ??OSTimeDlyHMSM_0
103 return (OS_ERR_TIME_DLY_ISR);
\ 0000000A 5520 MOVS R0,#+85
\ 0000000C 30BD POP {R4,R5,PC}
104 }
105 #if OS_ARG_CHK_EN > 0
106 if (hours == 0) {
\ ??OSTimeDlyHMSM_0:
\ 0000000E 0028 CMP R0,#+0
\ 00000010 07D1 BNE.N ??OSTimeDlyHMSM_1
107 if (minutes == 0) {
\ 00000012 0029 CMP R1,#+0
\ 00000014 05D1 BNE.N ??OSTimeDlyHMSM_1
108 if (seconds == 0) {
\ 00000016 002A CMP R2,#+0
\ 00000018 03D1 BNE.N ??OSTimeDlyHMSM_1
109 if (ms == 0) {
\ 0000001A 002B CMP R3,#+0
\ 0000001C 01D1 BNE.N ??OSTimeDlyHMSM_1
110 return (OS_ERR_TIME_ZERO_DLY);
\ 0000001E 5420 MOVS R0,#+84
\ 00000020 30BD POP {R4,R5,PC}
111 }
112 }
113 }
114 }
115 if (minutes > 59) {
\ ??OSTimeDlyHMSM_1:
\ 00000022 3C29 CMP R1,#+60
\ 00000024 01D3 BCC.N ??OSTimeDlyHMSM_2
116 return (OS_ERR_TIME_INVALID_MINUTES); /* Validate arguments to be within range */
\ 00000026 5120 MOVS R0,#+81
\ 00000028 30BD POP {R4,R5,PC}
117 }
118 if (seconds > 59) {
\ ??OSTimeDlyHMSM_2:
\ 0000002A 3C2A CMP R2,#+60
\ 0000002C 01D3 BCC.N ??OSTimeDlyHMSM_3
119 return (OS_ERR_TIME_INVALID_SECONDS);
\ 0000002E 5220 MOVS R0,#+82
\ 00000030 30BD POP {R4,R5,PC}
120 }
121 if (ms > 999) {
\ ??OSTimeDlyHMSM_3:
\ 00000032 5FF47A74 MOVS R4,#+1000
\ 00000036 A342 CMP R3,R4
\ 00000038 01D3 BCC.N ??OSTimeDlyHMSM_4
122 return (OS_ERR_TIME_INVALID_MS);
\ 0000003A 5320 MOVS R0,#+83
\ 0000003C 30BD POP {R4,R5,PC}
123 }
124 #endif
125 /* Compute the total number of clock ticks required.. */
126 /* .. (rounded to the nearest tick) */
127 ticks = ((INT32U)hours * 3600L + (INT32U)minutes * 60L + (INT32U)seconds) * OS_TICKS_PER_SEC
128 + OS_TICKS_PER_SEC * ((INT32U)ms + 500L / OS_TICKS_PER_SEC) / 1000L;
\ ??OSTimeDlyHMSM_4:
\ 0000003E 5FF46164 MOVS R4,#+3600
\ 00000042 3C25 MOVS R5,#+60
\ 00000044 6943 MULS R1,R5,R1
\ 00000046 00FB0410 MLA R0,R0,R4,R1
\ 0000004A 8018 ADDS R0,R0,R2
\ 0000004C 6421 MOVS R1,#+100
\ 0000004E 5B1D ADDS R3,R3,#+5
\ 00000050 0A46 MOV R2,R1
\ 00000052 5343 MULS R3,R2,R3
\ 00000054 5FF47A72 MOVS R2,#+1000
\ 00000058 B3FBF2F2 UDIV R2,R3,R2
\ 0000005C 00FB0120 MLA R0,R0,R1,R2
129 loops = (INT16U)(ticks >> 16); /* Compute the integral number of 65536 tick delays */
\ 00000060 0400 MOVS R4,R0
\ 00000062 240C LSRS R4,R4,#+16
130 ticks = ticks & 0xFFFFL; /* Obtain the fractional number of ticks */
131 OSTimeDly((INT16U)ticks);
\ 00000064 80B2 UXTH R0,R0
\ 00000066 ........ BL OSTimeDly
\ 0000006A 09E0 B.N ??OSTimeDlyHMSM_5
132 while (loops > 0) {
133 OSTimeDly((INT16U)32768u);
\ ??OSTimeDlyHMSM_6:
\ 0000006C 5FF40040 MOVS R0,#+32768
\ 00000070 ........ BL OSTimeDly
134 OSTimeDly((INT16U)32768u);
\ 00000074 5FF40040 MOVS R0,#+32768
\ 00000078 ........ BL OSTimeDly
135 loops--;
\ 0000007C 641E SUBS R4,R4,#+1
\ 0000007E A4B2 UXTH R4,R4
136 }
\ ??OSTimeDlyHMSM_5:
\ 00000080 2000 MOVS R0,R4
\ 00000082 F3D1 BNE.N ??OSTimeDlyHMSM_6
137 return (OS_ERR_NONE);
\ 00000084 0020 MOVS R0,#+0
\ 00000086 30BD POP {R4,R5,PC} ;; return
138 }
139 #endif
140 /*$PAGE*/
141 /*
142 *********************************************************************************************************
143 * RESUME A DELAYED TASK
144 *
145 * Description: This function is used resume a task that has been delayed through a call to either
146 * OSTimeDly() or OSTimeDlyHMSM(). Note that you can call this function to resume a
147 * task that is waiting for an event with timeout. This would make the task look
148 * like a timeout occurred.
149 *
150 * Also, you cannot resume a task that has called OSTimeDlyHMSM() with a combined time that
151 * exceeds 65535 clock ticks. In other words, if the clock tick runs at 100 Hz then, you will
152 * not be able to resume a delayed task that called OSTimeDlyHMSM(0, 10, 55, 350) or higher:
153 *
154 * (10 Minutes * 60 + 55 Seconds + 0.35) * 100 ticks/second.
155 *
156 * Arguments : prio specifies the priority of the task to resume
157 *
158 * Returns : OS_ERR_NONE Task has been resumed
159 * OS_ERR_PRIO_INVALID if the priority you specify is higher that the maximum allowed
160 * (i.e. >= OS_LOWEST_PRIO)
161 * OS_ERR_TIME_NOT_DLY Task is not waiting for time to expire
162 * OS_ERR_TASK_NOT_EXIST The desired task has not been created or has been assigned to a Mutex.
163 *********************************************************************************************************
164 */
165
166 #if OS_TIME_DLY_RESUME_EN > 0
\ In segment CODE, align 4, keep-with-next
167 INT8U OSTimeDlyResume (INT8U prio)
168 {
\ OSTimeDlyResume:
\ 00000000 10B5 PUSH {R4,LR}
\ 00000002 0400 MOVS R4,R0
169 OS_TCB *ptcb;
170 #if OS_CRITICAL_METHOD == 3 /* Storage for CPU status register */
171 OS_CPU_SR cpu_sr = 0;
172 #endif
173
174
175
176 if (prio >= OS_LOWEST_PRIO) {
\ 00000004 1F2C CMP R4,#+31
\ 00000006 01D3 BCC.N ??OSTimeDlyResume_0
177 return (OS_ERR_PRIO_INVALID);
\ 00000008 2A20 MOVS R0,#+42
\ 0000000A 10BD POP {R4,PC}
178 }
179 OS_ENTER_CRITICAL();
\ ??OSTimeDlyResume_0:
\ 0000000C ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
180 ptcb = OSTCBPrioTbl[prio]; /* Make sure that task exist */
\ 00000010 1C49 LDR.N R1,??OSTimeDlyResume_1 ;; OSTCBPrioTbl
\ 00000012 51F82410 LDR R1,[R1, R4, LSL #+2]
181 if (ptcb == (OS_TCB *)0) {
\ 00000016 0029 CMP R1,#+0
\ 00000018 03D1 BNE.N ??OSTimeDlyResume_2
182 OS_EXIT_CRITICAL();
\ ??OSTimeDlyResume_3:
\ 0000001A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
183 return (OS_ERR_TASK_NOT_EXIST); /* The task does not exist */
\ 0000001E 4320 MOVS R0,#+67
\ 00000020 10BD POP {R4,PC}
184 }
185 if (ptcb == OS_TCB_RESERVED) {
\ ??OSTimeDlyResume_2:
\ 00000022 0129 CMP R1,#+1
\ 00000024 F9D0 BEQ.N ??OSTimeDlyResume_3
186 OS_EXIT_CRITICAL();
187 return (OS_ERR_TASK_NOT_EXIST); /* The task does not exist */
188 }
189 if (ptcb->OSTCBDly == 0) { /* See if task is delayed */
\ 00000026 2A31 ADDS R1,R1,#+42
\ 00000028 0A88 LDRH R2,[R1, #+0]
\ 0000002A 002A CMP R2,#+0
\ 0000002C 03D1 BNE.N ??OSTimeDlyResume_4
190 OS_EXIT_CRITICAL();
\ 0000002E ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
191 return (OS_ERR_TIME_NOT_DLY); /* Indicate that task was not delayed */
\ 00000032 5020 MOVS R0,#+80
\ 00000034 10BD POP {R4,PC}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -