📄 os_time.lst
字号:
\ 00000002 0028 CMP R0,#+0
\ 00000004 07D1 BNE ??OSTimeDlyHMSM_0
89 if (minutes == 0) {
\ 00000006 0029 CMP R1,#+0
\ 00000008 05D1 BNE ??OSTimeDlyHMSM_0
90 if (seconds == 0) {
\ 0000000A 002A CMP R2,#+0
\ 0000000C 03D1 BNE ??OSTimeDlyHMSM_0
91 if (milli == 0) {
\ 0000000E 002B CMP R3,#+0
\ 00000010 01D1 BNE ??OSTimeDlyHMSM_0
92 return (OS_TIME_ZERO_DLY);
\ 00000012 5420 MOVS R0,#+84
\ 00000014 38E0 B ??OSTimeDlyHMSM_1
93 }
94 }
95 }
96 }
97 if (minutes > 59) {
\ ??OSTimeDlyHMSM_0:
\ 00000016 3C29 CMP R1,#+60
\ 00000018 01D3 BCC ??OSTimeDlyHMSM_2
98 return (OS_TIME_INVALID_MINUTES); /* Validate arguments to be within range */
\ 0000001A 5120 MOVS R0,#+81
\ 0000001C 34E0 B ??OSTimeDlyHMSM_1
99 }
100 if (seconds > 59) {
\ ??OSTimeDlyHMSM_2:
\ 0000001E 3C2A CMP R2,#+60
\ 00000020 01D3 BCC ??OSTimeDlyHMSM_3
101 return (OS_TIME_INVALID_SECONDS);
\ 00000022 5220 MOVS R0,#+82
\ 00000024 30E0 B ??OSTimeDlyHMSM_1
102 }
103 if (milli > 999) {
\ ??OSTimeDlyHMSM_3:
\ 00000026 FA24 MOVS R4,#+250
\ 00000028 A400 LSLS R4,R4,#+2 ;; #+1000
\ 0000002A A342 CMP R3,R4
\ 0000002C 01D3 BCC ??OSTimeDlyHMSM_4
104 return (OS_TIME_INVALID_MILLI);
\ 0000002E 5320 MOVS R0,#+83
\ 00000030 2AE0 B ??OSTimeDlyHMSM_1
105 }
106 /* Compute the total number of clock ticks required.. */
107 /* .. (rounded to the nearest tick) */
108 ticks = ((INT32U)hours * 3600L + (INT32U)minutes * 60L + (INT32U)seconds) * OS_TICKS_PER_SEC
109 + OS_TICKS_PER_SEC * ((INT32U)milli + 500L / OS_TICKS_PER_SEC) / 1000L;
\ ??OSTimeDlyHMSM_4:
\ 00000032 E124 MOVS R4,#+225
\ 00000034 2401 LSLS R4,R4,#+4 ;; #+3600
\ 00000036 6043 MULS R0,R4,R0
\ 00000038 3C24 MOVS R4,#+60
\ 0000003A 6143 MULS R1,R4,R1
\ 0000003C 4018 ADDS R0,R0,R1
\ 0000003E 8218 ADDS R2,R0,R2
\ 00000040 6420 MOVS R0,#+100
\ 00000042 4243 MULS R2,R0,R2
\ 00000044 5B1D ADDS R3,R3,#+5
\ 00000046 6420 MOVS R0,#+100
\ 00000048 4343 MULS R3,R0,R3
\ 0000004A 1800 MOVS R0,R3
\ 0000004C FA21 MOVS R1,#+250
\ 0000004E 8900 LSLS R1,R1,#+2 ;; #+1000
\ 00000050 ........ _BLF ??divu32_t,??rT??divu32_t
\ 00000054 5018 ADDS R0,R2,R1
110 loops = (INT16U)(ticks / 65536L); /* Compute the integral number of 65536 tick delays */
\ 00000056 0400 MOVS R4,R0
\ 00000058 240C LSRS R4,R4,#+16
111 ticks = ticks % 65536L; /* Obtain the fractional number of ticks */
\ 0000005A 8021 MOVS R1,#+128
\ 0000005C 4902 LSLS R1,R1,#+9 ;; #+65536
\ 0000005E ........ _BLF ??divu32_t,??rT??divu32_t
112 OSTimeDly((INT16U)ticks);
\ 00000062 0004 LSLS R0,R0,#+16 ;; ZeroExtS R0,R0,#+16,#+16
\ 00000064 000C LSRS R0,R0,#+16
\ 00000066 ........ BL OSTimeDly
\ 0000006A 08E0 B ??OSTimeDlyHMSM_5
113 while (loops > 0) {
114 OSTimeDly((INT16U)32768u);
\ ??OSTimeDlyHMSM_6:
\ 0000006C 8020 MOVS R0,#+128
\ 0000006E 0002 LSLS R0,R0,#+8 ;; #+32768
\ 00000070 ........ BL OSTimeDly
115 OSTimeDly((INT16U)32768u);
\ 00000074 8020 MOVS R0,#+128
\ 00000076 0002 LSLS R0,R0,#+8 ;; #+32768
\ 00000078 ........ BL OSTimeDly
116 loops--;
\ 0000007C 641E SUBS R4,R4,#+1
117 }
\ ??OSTimeDlyHMSM_5:
\ 0000007E 2404 LSLS R4,R4,#+16 ;; ZeroExtS R4,R4,#+16,#+16
\ 00000080 240C LSRS R4,R4,#+16
\ 00000082 012C CMP R4,#+1
\ 00000084 F2D2 BCS ??OSTimeDlyHMSM_6
118 return (OS_NO_ERR);
\ 00000086 0020 MOVS R0,#+0
\ ??OSTimeDlyHMSM_1:
\ 00000088 10BC POP {R4}
\ 0000008A 02BC POP {R1}
\ 0000008C 0847 BX R1 ;; return
119 }
120 #endif
121 /*$PAGE*/
122 /*
123 *********************************************************************************************************
124 * RESUME A DELAYED TASK
125 *
126 * Description: This function is used resume a task that has been delayed through a call to either
127 * OSTimeDly() or OSTimeDlyHMSM(). Note that you MUST NOT call this function to resume a
128 * task that is waiting for an event with timeout. This situation would make the task look
129 * like a timeout occurred (unless you desire this effect). Also, you cannot resume a task
130 * that has called OSTimeDlyHMSM() with a combined time that exceeds 65535 clock ticks. In
131 * other words, if the clock tick runs at 100 Hz then, you will not be able to resume a
132 * delayed task that called OSTimeDlyHMSM(0, 10, 55, 350) or higher.
133 *
134 * (10 Minutes * 60 + 55 Seconds + 0.35) * 100 ticks/second.
135 *
136 * Arguments : prio specifies the priority of the task to resume
137 *
138 * Returns : OS_NO_ERR Task has been resumed
139 * OS_PRIO_INVALID if the priority you specify is higher that the maximum allowed
140 * (i.e. >= OS_LOWEST_PRIO)
141 * OS_TIME_NOT_DLY Task is not waiting for time to expire
142 * OS_TASK_NOT_EXIST The desired task has not been created
143 *********************************************************************************************************
144 */
145
146 #if OS_TIME_DLY_RESUME_EN > 0
\ In segment CODE, align 4, keep-with-next
147 INT8U OSTimeDlyResume (INT8U prio)
148 {
\ OSTimeDlyResume:
\ 00000000 30B5 PUSH {R4,R5,LR}
\ 00000002 0400 MOVS R4,R0
149 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
150 OS_CPU_SR cpu_sr;
151 #endif
152 OS_TCB *ptcb;
153
154
155 if (prio >= OS_LOWEST_PRIO) {
\ 00000004 3F2C CMP R4,#+63
\ 00000006 01D3 BCC ??OSTimeDlyResume_0
156 return (OS_PRIO_INVALID);
\ 00000008 2A20 MOVS R0,#+42
\ 0000000A 32E0 B ??OSTimeDlyResume_1
157 }
158 OS_ENTER_CRITICAL();
\ ??OSTimeDlyResume_0:
\ 0000000C ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
159 ptcb = (OS_TCB *)OSTCBPrioTbl[prio]; /* Make sure that task exist */
\ 00000010 0421 MOVS R1,#+4
\ 00000012 4C43 MULS R4,R1,R4
\ 00000014 1849 LDR R1,??OSTimeDlyResume_2 ;; OSTCBPrioTbl
\ 00000016 0959 LDR R1,[R1, R4]
160 if (ptcb != (OS_TCB *)0) {
\ 00000018 0029 CMP R1,#+0
\ 0000001A 27D0 BEQ ??OSTimeDlyResume_3
161 if (ptcb->OSTCBDly != 0) { /* See if task is delayed */
\ 0000001C 4A8D LDRH R2,[R1, #+42]
\ 0000001E 002A CMP R2,#+0
\ 00000020 20D0 BEQ ??OSTimeDlyResume_4
162 ptcb->OSTCBDly = 0; /* Clear the time delay */
\ 00000022 0022 MOVS R2,#+0
\ 00000024 4A85 STRH R2,[R1, #+42]
163 if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) { /* See if task is ready to run */
\ 00000026 2C22 MOVS R2,#+44
\ 00000028 8A5C LDRB R2,[R1, R2]
\ 0000002A 1207 LSLS R2,R2,#+28
\ 0000002C 16D4 BMI ??OSTimeDlyResume_5
164 OSRdyGrp |= ptcb->OSTCBBitY; /* Make task ready to run */
\ 0000002E .... LDR R2,??DataTable6 ;; OSRdyGrp
\ 00000030 .... LDR R3,??DataTable6 ;; OSRdyGrp
\ 00000032 1B78 LDRB R3,[R3, #+0]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -