📄 os_time.s79
字号:
MOVS R4,#+225
LSLS R4,R4,#+4 ;; #+3600
MULS R0,R4,R0
MOVS R4,#+60
MULS R1,R4,R1
ADDS R0,R0,R1
ADDS R2,R0,R2
MOVS R0,#+100
MULS R2,R0,R2
ADDS R3,R3,#+5
MULS R3,R0,R3
MOVS R0,R3
MOVS R1,#+250
LSLS R1,R1,#+2 ;; #+1000
_BLF ??divu32_t,??rT??divu32_t
ADDS R0,R2,R1
// 110 loops = (INT16U)(ticks / 65536L); /* Compute the integral number of 65536 tick delays */
LSRS R4,R0,#+16
// 111 ticks = ticks % 65536L; /* Obtain the fractional number of ticks */
// 112 OSTimeDly((INT16U)ticks);
LSLS R0,R0,#+16
LSRS R0,R0,#+16
BL OSTimeDly
MOVS R0,R4
BNE ??OSTimeDlyHMSM_5
B ??OSTimeDlyHMSM_6
// 113 while (loops > 0) {
// 114 OSTimeDly((INT16U)32768u);
??OSTimeDlyHMSM_7:
MOVS R0,#+128
LSLS R0,R0,#+8 ;; #+32768
BL OSTimeDly
// 115 OSTimeDly((INT16U)32768u);
MOVS R0,#+128
LSLS R0,R0,#+8 ;; #+32768
BL OSTimeDly
// 116 loops--;
SUBS R4,R4,#+1
LSLS R4,R4,#+16
LSRS R4,R4,#+16
// 117 }
??OSTimeDlyHMSM_5:
MOVS R0,R4
BNE ??OSTimeDlyHMSM_7
// 118 return (OS_NO_ERR);
??OSTimeDlyHMSM_6:
MOVS R0,#+0
??OSTimeDlyHMSM_3:
POP {R4}
POP {R1}
BX R1 ;; return
CFI EndBlock cfiBlock3
// 119 }
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock4 Using cfiCommon0
CFI NoFunction
ARM
??OSTimeDlyResume??rA:
ADD R12,PC,#+1
BX R12
CFI EndBlock cfiBlock4
REQUIRE OSTimeDlyResume
// 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
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock5 Using cfiCommon1
CFI Function OSTimeDlyResume
THUMB
// 147 INT8U OSTimeDlyResume (INT8U prio)
// 148 {
OSTimeDlyResume:
PUSH {R4,R5,LR}
CFI ?RET Frame(CFA, -4)
CFI R5 Frame(CFA, -8)
CFI R4 Frame(CFA, -12)
CFI CFA R13+12
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) {
CMP R4,#+63
BCC ??OSTimeDlyResume_0
// 156 return (OS_PRIO_INVALID);
MOVS R0,#+42
B ??OSTimeDlyResume_1
// 157 }
// 158 OS_ENTER_CRITICAL();
??OSTimeDlyResume_0:
_BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
// 159 ptcb = (OS_TCB *)OSTCBPrioTbl[prio]; /* Make sure that task exist */
LSLS R1,R4,#+2
LDR R2,??OSTimeDlyResume_2 ;; OSTCBPrioTbl
LDR R1,[R2, R1]
// 160 if (ptcb != (OS_TCB *)0) {
CMP R1,#+0
BEQ ??OSTimeDlyResume_3
// 161 if (ptcb->OSTCBDly != 0) { /* See if task is delayed */
LDRH R2,[R1, #+42]
CMP R2,#+0
BEQ ??OSTimeDlyResume_4
// 162 ptcb->OSTCBDly = 0; /* Clear the time delay */
MOVS R2,#+0
STRH R2,[R1, #+42]
// 163 if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) { /* See if task is ready to run */
MOVS R2,#+44
LDRB R2,[R1, R2]
LSLS R2,R2,#+28
BMI ??OSTimeDlyResume_5
// 164 OSRdyGrp |= ptcb->OSTCBBitY; /* Make task ready to run */
LDR R2,??DataTable6 ;; OSRdyGrp
LDR R3,??DataTable6 ;; OSRdyGrp
LDRB R3,[R3, #+0]
MOVS R4,#+49
LDRB R4,[R1, R4]
ORRS R4,R4,R3
STRB R4,[R2, #+0]
// 165 OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
MOVS R2,#+47
LDRB R2,[R1, R2]
LDR R3,??DataTable8 ;; OSRdyTbl
LDR R5,??DataTable8 ;; OSRdyTbl
LDRB R4,[R5, R2]
ADDS R1,R1,#+48
LDRB R1,[R1, #+0]
ORRS R1,R1,R4
STRB R1,[R3, R2]
// 166 OS_EXIT_CRITICAL();
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 167 OS_Sched(); /* See if this is new highest priority */
_BLF OS_Sched,??OS_Sched??rT
B ??OSTimeDlyResume_6
// 168 } else {
// 169 OS_EXIT_CRITICAL(); /* Task may be suspended */
??OSTimeDlyResume_5:
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 170 }
// 171 return (OS_NO_ERR);
??OSTimeDlyResume_6:
MOVS R0,#+0
B ??OSTimeDlyResume_1
// 172 } else {
// 173 OS_EXIT_CRITICAL();
??OSTimeDlyResume_4:
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 174 return (OS_TIME_NOT_DLY); /* Indicate that task was not delayed */
MOVS R0,#+80
B ??OSTimeDlyResume_1
// 175 }
// 176 }
// 177 OS_EXIT_CRITICAL();
??OSTimeDlyResume_3:
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 178 return (OS_TASK_NOT_EXIST); /* The task does not exist */
MOVS R0,#+11
??OSTimeDlyResume_1:
POP {R4,R5}
POP {R1}
BX R1 ;; return
Nop
DATA
??OSTimeDlyResume_2:
DC32 OSTCBPrioTbl
CFI EndBlock cfiBlock5
// 179 }
RSEG CODE:CODE:NOROOT(2)
DATA
??DataTable6:
DC32 OSRdyGrp
RSEG CODE:CODE:NOROOT(2)
DATA
??DataTable8:
DC32 OSRdyTbl
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock6 Using cfiCommon0
CFI NoFunction
ARM
??OSTimeGet??rA:
ADD R12,PC,#+1
BX R12
CFI EndBlock cfiBlock6
REQUIRE OSTimeGet
// 180 #endif
// 181 /*$PAGE*/
// 182 /*
// 183 *********************************************************************************************************
// 184 * GET CURRENT SYSTEM TIME
// 185 *
// 186 * Description: This function is used by your application to obtain the current value of the 32-bit
// 187 * counter which keeps track of the number of clock ticks.
// 188 *
// 189 * Arguments : none
// 190 *
// 191 * Returns : The current value of OSTime
// 192 *********************************************************************************************************
// 193 */
// 194
// 195 #if OS_TIME_GET_SET_EN > 0
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock7 Using cfiCommon1
CFI Function OSTimeGet
THUMB
// 196 INT32U OSTimeGet (void)
// 197 {
OSTimeGet:
PUSH {R4,LR}
CFI ?RET Frame(CFA, -4)
CFI R4 Frame(CFA, -8)
CFI CFA R13+8
// 198 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
// 199 OS_CPU_SR cpu_sr;
// 200 #endif
// 201 INT32U ticks;
// 202
// 203
// 204 OS_ENTER_CRITICAL();
_BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
// 205 ticks = OSTime;
LDR R1,??DataTable10 ;; OSTime
LDR R4,[R1, #+0]
// 206 OS_EXIT_CRITICAL();
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 207 return (ticks);
MOVS R0,R4
POP {R4}
POP {R1}
BX R1 ;; return
CFI EndBlock cfiBlock7
// 208 }
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock8 Using cfiCommon0
CFI NoFunction
ARM
??OSTimeSet??rA:
ADD R12,PC,#+1
BX R12
CFI EndBlock cfiBlock8
REQUIRE OSTimeSet
// 209 #endif
// 210
// 211 /*
// 212 *********************************************************************************************************
// 213 * SET SYSTEM CLOCK
// 214 *
// 215 * Description: This function sets the 32-bit counter which keeps track of the number of clock ticks.
// 216 *
// 217 * Arguments : ticks specifies the new value that OSTime needs to take.
// 218 *
// 219 * Returns : none
// 220 *********************************************************************************************************
// 221 */
// 222
// 223 #if OS_TIME_GET_SET_EN > 0
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock9 Using cfiCommon1
CFI Function OSTimeSet
THUMB
// 224 void OSTimeSet (INT32U ticks)
// 225 {
OSTimeSet:
PUSH {R4,LR}
CFI ?RET Frame(CFA, -4)
CFI R4 Frame(CFA, -8)
CFI CFA R13+8
MOVS R4,R0
// 226 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
// 227 OS_CPU_SR cpu_sr;
// 228 #endif
// 229
// 230
// 231 OS_ENTER_CRITICAL();
_BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
// 232 OSTime = ticks;
LDR R1,??DataTable10 ;; OSTime
STR R4,[R1, #+0]
// 233 OS_EXIT_CRITICAL();
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 234 }
POP {R4}
POP {R0}
BX R0 ;; return
CFI EndBlock cfiBlock9
RSEG CODE:CODE:NOROOT(2)
DATA
??DataTable10:
DC32 OSTime
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock10 Using cfiCommon1
CFI NoFunction
THUMB
??OS_CPU_SR_Save??rT:
LDR R3,??Subroutine5_0 ;; OS_CPU_SR_Save
BX R3
DATA
??Subroutine5_0:
DC32 OS_CPU_SR_Save
CFI EndBlock cfiBlock10
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock11 Using cfiCommon1
CFI NoFunction
THUMB
??OS_CPU_SR_Restore??rT:
LDR R3,??Subroutine6_0 ;; OS_CPU_SR_Restore
BX R3
DATA
??Subroutine6_0:
DC32 OS_CPU_SR_Restore
CFI EndBlock cfiBlock11
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock12 Using cfiCommon1
CFI NoFunction
THUMB
??OS_Sched??rT:
LDR R3,??Subroutine7_0 ;; OS_Sched
BX R3
DATA
??Subroutine7_0:
DC32 OS_Sched
CFI EndBlock cfiBlock12
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock13 Using cfiCommon1
CFI NoFunction
THUMB
??rT??divu32_t:
PUSH {R3}
CFI CFA R13+4
LDR R3,??Subroutine8_0 ;; ??divu32_t
MOV R12,R3
POP {R3}
CFI CFA R13+0
BX R12
Nop
DATA
??Subroutine8_0:
DC32 ??divu32_t
CFI EndBlock cfiBlock13
END
// 235 #endif
//
// 478 bytes in segment CODE
//
// 398 bytes of CODE memory (+ 80 bytes shared)
//
//Errors: none
//Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -