📄 timer.cod
字号:
0000c e1a07002 mov r7, r2
00010 e1a06003 mov r6, r3
; 235 :
; 236 : DWORD dwTick = dwTimerCountdownMSec * RESCHED_INCREMENT;
00014 e0640384 rsb r0, r4, r4, lsl #7
00018 e1a05100 mov r5, r0, lsl #2
; 237 : DWORD dwCount;
; 238 :
; 239 : //
; 240 : // If timer IRQ pending, a full resched period elapsed
; 241 : //
; 242 : if (CPUClearSysTimerIRQ( ))
0001c eb000000 bl CPUClearSysTimerIRQ
00020 e3500000 cmp r0, #0
00024 0a000009 beq |$L13033|
; 243 : {
; 244 : *pCurMSec += dwTimerCountdownMSec;
00028 e5980000 ldr r0, [r8]
0002c e0801004 add r1, r0, r4
00030 e5881000 str r1, [r8]
; 245 : pCurTicks->QuadPart += dwTick;
00034 e5960000 ldr r0, [r6]
00038 e5961004 ldr r1, [r6, #4]
0003c e0902005 adds r2, r0, r5
00040 e2a13000 adc r3, r1, #0
00044 e5862000 str r2, [r6]
00048 e5863004 str r3, [r6, #4]
; 246 : return dwTimerCountdownMSec;
0004c ea000018 b |$L13030|
00050 |$L13033|
; 247 : }
; 248 :
; 249 : //
; 250 : // No timer IRQ pending, calculate how much time has elapsed
; 251 : //
; 252 : dwCount = *TIM_TIMER1VALUE;
00050 e59f006c ldr r0, [pc, #0x6C]
; 253 : if (dwCount > dwTick)
; 254 : {
; 255 : //
; 256 : // This is an error case. Recover gracefully.
; 257 : //
; 258 : DEBUGMSG
; 259 : (
; 260 : 1,
; 261 : (
; 262 : L"ERROR: CPUGetSysTimerCountElapsed "
; 263 : L"Count = 0x%x, Tick =0x%x Load =0x%x, Value = 0x%x, control=0x%x\r\n",
; 264 : dwCount,
; 265 : dwTick,
; 266 : *TIM_TIMER1LOAD,
; 267 : *TIM_TIMER1VALUE,
; 268 : *TIM_TIMER1CONTROL
; 269 : )
; 270 : );
; 271 : dwCount = dwTick;
00054 e1a04005 mov r4, r5
00058 e5900000 ldr r0, [r0]
0005c e1500005 cmp r0, r5
; 272 : }
; 273 : else
; 274 : {
; 275 : dwCount = dwTick - dwCount;
00060 90454000 subls r4, r5, r0
; 276 : }
; 277 :
; 278 : pCurTicks->QuadPart += dwCount;
00064 e5960000 ldr r0, [r6]
00068 e5961004 ldr r1, [r6, #4]
0006c e0902004 adds r2, r0, r4
00070 e2a13000 adc r3, r1, #0
00074 e5862000 str r2, [r6]
00078 e5863004 str r3, [r6, #4]
; 279 :
; 280 : dwCount += *pPartialCurMSec;
0007c e5970000 ldr r0, [r7]
00080 e0843000 add r3, r4, r0
; 281 : *pPartialCurMSec = dwCount % RESCHED_INCREMENT;
00084 e59f0034 ldr r0, [pc, #0x34]
00088 e0810093 umull r0, r1, r3, r0
0008c e0430001 sub r0, r3, r1
00090 e08110a0 add r1, r1, r0, lsr #1
00094 e1a02421 mov r2, r1, lsr #8
00098 e0620382 rsb r0, r2, r2, lsl #7
0009c e0431100 sub r1, r3, r0, lsl #2
000a0 e5871000 str r1, [r7]
; 282 : *pCurMSec += (dwCount /= RESCHED_INCREMENT);
; 283 :
; 284 : return dwCount;
000a4 e1a04002 mov r4, r2
000a8 e5980000 ldr r0, [r8]
000ac e0801002 add r1, r0, r2
000b0 e5881000 str r1, [r8]
000b4 |$L13030|
; 246 : return dwTimerCountdownMSec;
000b4 e1a00004 mov r0, r4
; 285 : }
000b8 e8bd41f0 ldmia sp!, {r4 - r8, lr}
000bc e12fff1e bx lr
000c0 |$L13140|
000c0 02040811 DCD 0x2040811
000c4 b0810004 DCD 0xb0810004
000c8 |$M13137|
ENDP ; |CPUGetSysTimerCountElapsed|
EXPORT |PerfCountFreq|
00000 AREA |.text| { |PerfCountFreq| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$PerfCountFreq|, PDATA, SELECTION=5, ASSOC=|.text| { |PerfCountFreq| } ; comdat associative
|$T13146| DCD |PerfCountFreq|
DCD 0x40000300
; Function compile flags: /Ogsy
00000 AREA |.text| { |PerfCountFreq| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |PerfCountFreq| PROC
; 296 : {
00000 |$M13144|
; 297 : //
; 298 : // Need to change this to the 1 us debug timer.
; 299 : //
; 300 : return OEM_CLOCK_FREQ;
00000 e3a0091f mov r0, #0x1F, 18
00004 e3800f8d orr r0, r0, #0x8D, 30
; 301 : }
00008 e12fff1e bx lr
0000c |$M13145|
ENDP ; |PerfCountFreq|
EXPORT |PerfCountSinceTick|
IMPORT |dwReschedIncrement|
00000 AREA |.text| { |PerfCountSinceTick| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$PerfCountSinceTick|, PDATA, SELECTION=5, ASSOC=|.text| { |PerfCountSinceTick| } ; comdat associative
|$T13155| DCD |PerfCountSinceTick|
DCD 0x40000e00
; Function compile flags: /Ogsy
00000 AREA |.text| { |PerfCountSinceTick| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |PerfCountSinceTick| PROC
; 310 : {
00000 |$M13153|
; 311 : DWORD intstatus = (*VIC1_RAWINTR | INT1_TIMER1);
00000 e59f002c ldr r0, [pc, #0x2C]
00004 e5900000 ldr r0, [r0]
00008 e3901010 orrs r1, r0, #0x10
; 312 : DWORD dwCount;
; 313 :
; 314 : // if an interrupt is pending we have gone past the count limit
; 315 : if(intstatus )
; 316 : {
; 317 : //
; 318 : // We don't really know how long we are overdue, so just return one
; 319 : // tick's worth of counts
; 320 : //
; 321 : dwCount = dwReschedIncrement;
0000c 159f0018 ldrne r0, [pc, #0x18]
00010 15900000 ldrne r0, [r0]
; 322 : }
; 323 : else
; 324 : {
; 325 : //
; 326 : // Timer counts down, so calculate the number of ticks elapsed.
; 327 : //
; 328 : dwCount = dwReschedIncrement - *TIM_TIMER1VALUE;
00014 059f0014 ldreq r0, [pc, #0x14]
00018 05902000 ldreq r2, [r0]
0001c 059f0008 ldreq r0, [pc, #8]
00020 05901000 ldreq r1, [r0]
00024 00410002 subeq r0, r1, r2
; 329 : }
; 330 :
; 331 : return dwCount;
; 332 : }
00028 e12fff1e bx lr
0002c |$L13157|
0002c 00000000 DCD |dwReschedIncrement|
00030 b0810004 DCD 0xb0810004
00034 b00b0008 DCD 0xb00b0008
00038 |$M13154|
ENDP ; |PerfCountSinceTick|
EXPORT |InitClock|
00000 AREA |.text| { |InitClock| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$InitClock|, PDATA, SELECTION=5, ASSOC=|.text| { |InitClock| } ; comdat associative
|$T13162| DCD |InitClock|
DCD 0x40000c00
; Function compile flags: /Ogsy
00000 AREA |.text| { |InitClock| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |InitClock| PROC
; 341 : {
00000 |$M13160|
; 342 : //
; 343 : // Initialize and start scheduler timer. Initialize the clock to
; 344 : // 508Khz, Perodic mode.
; 345 : //
; 346 : dwReschedIncrement = RESCHED_INCREMENT;
00000 e59f0024 ldr r0, [pc, #0x24]
; 347 : *TIM_TIMER1LOAD = dwReschedIncrement;
00004 e3a0120b mov r1, #0xB, 4
00008 e3a02f7f mov r2, #0x7F, 30
0000c e3811881 orr r1, r1, #0x81, 16
00010 e5802000 str r2, [r0]
00014 e5812000 str r2, [r1]
; 348 : *TIM_TIMER1CONTROL = TIMERCONTROL_CLKSEL | TIMERCONTROL_MODE |
; 349 : TIMERCONTROL_ENABLE;
00018 e3a000c8 mov r0, #0xC8
0001c e59f2004 ldr r2, [pc, #4]
00020 e5820000 str r0, [r2]
; 350 : }
00024 e12fff1e bx lr
00028 |$L13164|
00028 b0810008 DCD 0xb0810008
0002c 00000000 DCD |dwReschedIncrement|
00030 |$M13161|
ENDP ; |InitClock|
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -