📄 idle.cod
字号:
; Listing generated by Microsoft (R) Optimizing Compiler Version 12.20.9615
TTL d:\wince420\platform\ep931x\kernel\hal\.\idle.c
CODE32
00000 AREA |.drectve|, DRECTVE
DCB "-defaultlib:coredll.lib "
DCB "-defaultlib:corelibc.lib "
EXPORT |CurTicks| [ DATA ]
EXPORT |pCurTicks| [ DATA ]
EXPORT |fResumeFlag| [ DATA ]
IMPORT |CurMSec|
00000 AREA |.bss|, NOINIT
|CurTicks| % 0x8
00000 AREA |.data|, DATA
COMMON |g_dwWakeIntMask|, 0x4
00008 AREA |.bss|, NOINIT
|dwPartialCurMSec| % 0x4
|fResumeFlag| % 0x1
00000 AREA |.data|, DATA
|pCurMSec| DCD |CurMSec|
|pCurTicks| DCD |CurTicks|
EXPORT |OEMIdle|
IMPORT |INTERRUPTS_OFF|
IMPORT |curridlehigh|
IMPORT |curridlelow|
IMPORT |dwReschedTime|
IMPORT |fIntrTime|
IMPORT |bProfileTimerRunning|
IMPORT |dwReschedIncrement|
IMPORT |CPUEnterIdle|
IMPORT |CPUGetSysTimerCountMax|
IMPORT |CPUSetSysTimerCount|
IMPORT |CPUClearSysTimerIRQ|
IMPORT |CPUGetSysTimerCountElapsed|
; File d:\wince420\platform\ep931x\kernel\hal\idle.c
00000 AREA |.text| { |OEMIdle| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$OEMIdle|, PDATA, SELECTION=5, ASSOC=|.text| { |OEMIdle| } ; comdat associative
|$T13074| DCD |OEMIdle|
DCD 0x40006402
; Function compile flags: /Ogsy
00000 AREA |.text| { |OEMIdle| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |OEMIdle| PROC
; 282 : {
00000 e92d4ff0 stmdb sp!, {r4 - r11, lr}
00004 e24dd004 sub sp, sp, #4
00008 |$M13072|
00008 e58d0000 str r0, [sp]
; 283 : DWORD dwIdleMSec;
; 284 : DWORD dwPrevMSec = *pCurMSec;
; 285 :
; 286 : // Use for 64-bit math
; 287 : ULARGE_INTEGER currIdle =
; 288 : {
; 289 : curridlelow,
0000c e59f0158 ldr r0, [pc, #0x158]
00010 e59f8174 ldr r8, [pc, #0x174]
00014 e590b000 ldr r11, [r0]
; 290 : curridlehigh
; 291 : };
00018 e59f0148 ldr r0, [pc, #0x148]
0001c e5985000 ldr r5, [r8]
00020 e590a000 ldr r10, [r0]
; 292 :
; 293 : if ((int) (dwIdleMSec = dwReschedTime - dwPrevMSec) <= 0) {
00024 e59f015c ldr r0, [pc, #0x15C]
00028 e5956000 ldr r6, [r5]
0002c e5901000 ldr r1, [r0]
00030 e0414006 sub r4, r1, r6
00034 e3540000 cmp r4, #0
00038 da000047 ble |$L13023|
; 294 : // already time to wakeup
; 295 : return;
; 296 : }
; 297 :
; 298 : // just idle till tick if profiling or running iltiming
; 299 : if (bProfileTimerRunning || fIntrTime) {
0003c e59f0140 ldr r0, [pc, #0x140]
00040 e5901000 ldr r1, [r0]
00044 e3510000 cmp r1, #0
00048 1a00003b bne |$L13030|
0004c e59f012c ldr r0, [pc, #0x12C]
00050 e5901000 ldr r1, [r0]
00054 e3510000 cmp r1, #0
00058 1a000037 bne |$L13030|
; 307 :
; 308 : return;
; 309 : }
; 310 :
; 311 : //
; 312 : // Since OEMIdle( ) is being called in the middle of a normal reschedule
; 313 : // period, CurMSec, dwPartialCurMSec, and CurTicks need
; 314 : // to be updated accordingly.
; 315 : // Once we reach this point, we must re-program the timer (if we ever did)
; 316 : // because dwPartialCurMSec will be modified in the next function call.
; 317 : //
; 318 : CPUGetSysTimerCountElapsed(RESCHED_PERIOD, pCurMSec, &dwPartialCurMSec, pCurTicks);
0005c e59f9118 ldr r9, [pc, #0x118]
00060 e1a01005 mov r1, r5
00064 e59f710c ldr r7, [pc, #0x10C]
00068 e3a00001 mov r0, #1
0006c e5993000 ldr r3, [r9]
00070 e1a02007 mov r2, r7
00074 eb000000 bl CPUGetSysTimerCountElapsed
; 319 :
; 320 : if ((int) (dwIdleMSec -= *pCurMSec - dwPrevMSec) > 0) {
00078 e5981000 ldr r1, [r8]
0007c e0843006 add r3, r4, r6
00080 e5910000 ldr r0, [r1]
00084 e0430000 sub r0, r3, r0
00088 e3500000 cmp r0, #0
0008c da000022 ble |$L13034|
; 321 :
; 322 : dwPrevMSec = *pCurMSec;
00090 e5914000 ldr r4, [r1]
; 323 :
; 324 : //
; 325 : // The system timer may not be capable of arbitrary timeouts. Get the
; 326 : // CPU-specific highest possible timeout available.
; 327 : //
; 328 : dwIdleMSec = CPUGetSysTimerCountMax(dwIdleMSec);
00094 eb000000 bl CPUGetSysTimerCountMax
00098 e1a06000 mov r6, r0
; 329 :
; 330 : //
; 331 : // Set the timer to wake up much later than usual, if needed.
; 332 : //
; 333 : CPUSetSysTimerCount(dwIdleMSec);
0009c eb000000 bl CPUSetSysTimerCount
; 334 : CPUClearSysTimerIRQ( );
000a0 eb000000 bl CPUClearSysTimerIRQ
; 335 :
; 336 : //
; 337 : // Enable wakeup on any interrupt, then go to sleep.
; 338 : //
; 339 : CPUEnterIdle(dwIdleParam);
000a4 e59d0000 ldr r0, [sp]
000a8 eb000000 bl CPUEnterIdle
; 340 : INTERRUPTS_OFF( );
000ac eb000000 bl INTERRUPTS_OFF
; 341 :
; 342 : //
; 343 : // We're awake! The wake-up ISR (or any other ISR) has already run.
; 344 : //
; 345 : if (dwPrevMSec != *pCurMSec) {
000b0 e5985000 ldr r5, [r8]
000b4 e5950000 ldr r0, [r5]
000b8 e1540000 cmp r4, r0
000bc 0a00000f beq |$L13033|
; 346 : //
; 347 : // We completed the full period we asked to sleep. Update the counters.
; 348 : //
; 349 : *pCurMSec += (dwIdleMSec - RESCHED_PERIOD); // Subtract resched period, because ISR also incremented.
000c0 e5950000 ldr r0, [r5]
000c4 e2463001 sub r3, r6, #1
; 350 : CurTicks.QuadPart += (dwIdleMSec - RESCHED_PERIOD) * dwReschedIncrement;
000c8 e59f40a4 ldr r4, [pc, #0xA4]
000cc e0801003 add r1, r0, r3
000d0 e59f0098 ldr r0, [pc, #0x98]
000d4 e5851000 str r1, [r5]
000d8 e5901000 ldr r1, [r0]
000dc e5940000 ldr r0, [r4]
000e0 e0020193 mul r2, r3, r1
000e4 e5941004 ldr r1, [r4, #4]
000e8 e0922000 adds r2, r2, r0
000ec e2a13000 adc r3, r1, #0
000f0 e5842000 str r2, [r4]
000f4 e5843004 str r3, [r4, #4]
; 351 :
; 352 : currIdle.QuadPart += dwIdleMSec;
000f8 e09bb006 adds r11, r11, r6
; 353 : } else {
000fc ea000005 b |$L13071|
00100 |$L13033|
; 354 : //
; 355 : // Some other interrupt woke us up before the full idle period was
; 356 : // complete. Determine how much time has elapsed.
; 357 : //
; 358 : currIdle.QuadPart += CPUGetSysTimerCountElapsed(dwIdleMSec, pCurMSec, &dwPartialCurMSec, pCurTicks);
00100 e5993000 ldr r3, [r9]
00104 e1a02007 mov r2, r7
00108 e1a01005 mov r1, r5
0010c e1a00006 mov r0, r6
00110 eb000000 bl CPUGetSysTimerCountElapsed
00114 e09bb000 adds r11, r11, r0
00118 |$L13071|
00118 e2aaa000 adc r10, r10, #0
0011c |$L13034|
; 359 : }
; 360 : }
; 361 :
; 362 : // Re-arm counters
; 363 : CPUSetSysTimerCount(RESCHED_PERIOD);
0011c e3a00001 mov r0, #1
00120 eb000000 bl CPUSetSysTimerCount
; 364 : CPUClearSysTimerIRQ( );
00124 eb000000 bl CPUClearSysTimerIRQ
; 365 :
; 366 : // Update global idle time
; 367 : curridlelow = currIdle.LowPart;
00128 e59f103c ldr r1, [pc, #0x3C]
0012c e581b000 str r11, [r1]
; 368 : curridlehigh = currIdle.HighPart;
00130 e59f1030 ldr r1, [pc, #0x30]
00134 e581a000 str r10, [r1]
; 369 :
; 370 : return;
00138 ea000007 b |$L13023|
0013c |$L13030|
; 300 : // idle till end of 'tick'
; 301 : CPUEnterIdle(dwIdleParam);
0013c e59d0000 ldr r0, [sp]
00140 eb000000 bl CPUEnterIdle
; 302 :
; 303 : // Update global idle time and return
; 304 : currIdle.QuadPart += RESCHED_PERIOD;
; 305 : curridlelow = currIdle.LowPart;
00144 e59f1020 ldr r1, [pc, #0x20]
00148 e29b3001 adds r3, r11, #1
0014c e5813000 str r3, [r1]
00150 e2aa0000 adc r0, r10, #0
; 306 : curridlehigh = currIdle.HighPart;
00154 e59f100c ldr r1, [pc, #0xC]
00158 e5810000 str r0, [r1]
0015c |$L13023|
; 371 : }
0015c e28dd004 add sp, sp, #4
00160 e8bd4ff0 ldmia sp!, {r4 - r11, lr}
00164 e12fff1e bx lr
00168 |$L13076|
00168 00000000 DCD |curridlehigh|
0016c 00000000 DCD |curridlelow|
00170 00000000 DCD |dwReschedIncrement|
00174 00000000 DCD |CurTicks|
00178 00000000 DCD |dwPartialCurMSec|
0017c 00000000 DCD |pCurTicks|
00180 00000000 DCD |fIntrTime|
00184 00000000 DCD |bProfileTimerRunning|
00188 00000000 DCD |dwReschedTime|
0018c 00000000 DCD |pCurMSec|
00190 |$M13073|
ENDP ; |OEMIdle|
EXPORT |SC_GetTickCount|
00000 AREA |.text| { |SC_GetTickCount| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$SC_GetTickCount|, PDATA, SELECTION=5, ASSOC=|.text| { |SC_GetTickCount| } ; comdat associative
|$T13085| DCD |SC_GetTickCount|
DCD 0x40001c02
; Function compile flags: /Ogsy
00000 AREA |.text| { |SC_GetTickCount| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |SC_GetTickCount| PROC
; 381 : {
00000 e92d4030 stmdb sp!, {r4, r5, lr}
00004 e24dd010 sub sp, sp, #0x10
00008 |$M13083|
; 382 : #if (CE_MAJOR_VER == 0x0003)
; 383 : return *pCurMSec;
; 384 : #else
; 385 : DWORD dwInc = 0, dwPartial = dwPartialCurMSec, dwPrev = *pCurMSec;
00008 e59f005c ldr r0, [pc, #0x5C]
0000c e59f4054 ldr r4, [pc, #0x54]
00010 e3a02000 mov r2, #0
00014 e5901000 ldr r1, [r0]
; 386 : ULARGE_INTEGER cdummy = {0, 0};
; 387 : CPUGetSysTimerCountElapsed(RESCHED_PERIOD, &dwInc, &dwPartial, &cdummy);
00018 e28d3008 add r3, sp, #8
0001c e5940000 ldr r0, [r4]
00020 e58d2000 str r2, [sp]
00024 e58d1004 str r1, [sp, #4]
00028 e28d1000 add r1, sp, #0
0002c e5905000 ldr r5, [r0]
00030 e3a00001 mov r0, #1
00034 e58d2008 str r2, [sp, #8]
00038 e58d200c str r2, [sp, #0xC]
0003c e28d2004 add r2, sp, #4
00040 eb000000 bl CPUGetSysTimerCountElapsed
; 388 : return (dwPrev == *pCurMSec)? dwPrev + dwInc : *pCurMSec;
00044 e5943000 ldr r3, [r4]
00048 e5930000 ldr r0, [r3]
0004c e1550000 cmp r5, r0
00050 059d0000 ldreq r0, [sp]
00054 00850000 addeq r0, r5, r0
00058 15930000 ldrne r0, [r3]
; 389 : #endif
; 390 : }
0005c e28dd010 add sp, sp, #0x10
00060 e8bd4030 ldmia sp!, {r4, r5, lr}
00064 e12fff1e bx lr
00068 |$L13087|
00068 00000000 DCD |pCurMSec|
0006c 00000000 DCD |dwPartialCurMSec|
00070 |$M13084|
ENDP ; |SC_GetTickCount|
EXPORT |OEMPowerOff|
EXPORT |??_C@_1BM@KPJL@?$AAO?$AAE?$AAM?$AAP?$AAo?$AAw?$AAe?$AAr?$AAO?$AAf?$AAf?$AA?$AN?$AA?6?$AA?$AA@| [ DATA ] ; `string'
IMPORT |NKDbgPrintfW|
00000 AREA |.text| { |OEMPowerOff| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$OEMPowerOff|, PDATA, SELECTION=5, ASSOC=|.text| { |OEMPowerOff| } ; comdat associative
|$T13092| DCD |OEMPowerOff|
DCD 0x40000601
00000 AREA |.rdata| { |??_C@_1BM@KPJL@?$AAO?$AAE?$AAM?$AAP?$AAo?$AAw?$AAe?$AAr?$AAO?$AAf?$AAf?$AA?$AN?$AA?6?$AA?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_1BM@KPJL@?$AAO?$AAE?$AAM?$AAP?$AAo?$AAw?$AAe?$AAr?$AAO?$AAf?$AAf?$AA?$AN?$AA?6?$AA?$AA@| DCB "O"
DCB 0x0, "E", 0x0, "M", 0x0, "P", 0x0, "o", 0x0, "w", 0x0, "e"
DCB 0x0, "r", 0x0, "O", 0x0, "f", 0x0, "f", 0x0, 0xd, 0x0, 0xa
DCB 0x0, 0x0, 0x0 ; `string'
; Function compile flags: /Ogsy
00000 AREA |.text| { |OEMPowerOff| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |OEMPowerOff| PROC
; 400 : {
00000 e52de004 str lr, [sp, #-4]!
00004 |$M13090|
; 401 : //
; 402 : // Print out the current clock rates to the debug port.
; 403 : //
; 404 : NKDbgPrintfW( L"OEMPowerOff\r\n" );
00004 e59f0008 ldr r0, [pc, #8]
00008 eb000000 bl NKDbgPrintfW
; 405 :
; 406 : #if 0
; 407 : volatile ULONG ulOldIntMask = 0;
; 408 : LONG header_number = 0;
; 409 : volatile LONG *IRQBase = NULL;
; 410 : volatile LONG *pHDRnum =
; 411 : (volatile LONG *)(VA_HDR_BASE + INTEGRATOR_HDR_STAT_OFFSET);
; 412 :
; 413 : header_number = *pHDRnum & 3;
; 414 : IRQBase = (LONG *)(VA_IC_BASE + (header_number << 8));
; 415 :
; 416 :
; 417 : INTERRUPTS_OFF();
; 418 :
; 419 : // Save current interrupt mask.
; 420 : //
; 421 : ulOldIntMask = IRQBase[(IRQ_ENABLE_SET >> 2)];
; 422 :
; 423 : // Replace the interrupt mask with the wake event interrupt mask. These
; 424 : // will be the only interrupts that can wake us from suspend.
; 425 : //
; 426 : IRQBase[(IRQ_ENABLE_CLEAR >> 2)] = 0xFFFFFFFF;
; 427 : // Note - we're keeping the RTC and TimerINT1 enabled.
; 428 : IRQBase[(IRQ_ENABLE_SET >> 2)] = (g_dwWakeIntMask | (1 << IRQ_TIMERINT1) | (1 << IRQ_RTCINT));
; 429 :
; 430 : fResumeFlag = FALSE;
; 431 :
; 432 : INTERRUPTS_ON();
; 433 : while(!fResumeFlag)
; 434 : {
; 435 : CPUEnterIdle(0/*Dummy Argument*/);
; 436 : }
; 437 :
; 438 : INTERRUPTS_OFF();
; 439 :
; 440 : // Restore the original interupt mask.
; 441 : //
; 442 : IRQBase[(IRQ_ENABLE_CLEAR >> 2)] = 0xFFFFFFFF;
; 443 : IRQBase[(IRQ_ENABLE_SET >> 2)] = ulOldIntMask;
; 444 :
; 445 : INTERRUPTS_ON();
; 446 :
; 447 : #endif // 0
; 448 : }
0000c e8bd4000 ldmia sp!, {lr}
00010 e12fff1e bx lr
00014 |$L13094|
00014 00000000 DCD |??_C@_1BM@KPJL@?$AAO?$AAE?$AAM?$AAP?$AAo?$AAw?$AAe?$AAr?$AAO?$AAf?$AAf?$AA?$AN?$AA?6?$AA?$AA@|
00018 |$M13091|
ENDP ; |OEMPowerOff|
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -