📄 diskmain.cod
字号:
0003c e280c00c add r12, r0, #0xC
00040 e88c4006 stmia r12, {r1, r2, lr}
00044 e280c018 add r12, r0, #0x18
00048 e88c0060 stmia r12, {r5, r6}
; 250 : }
0004c e8bd40f0 ldmia sp!, {r4 - r7, lr}
00050 e12fff1e bx lr
00054 |$M33311|
ENDP ; |?ConfigureRegisterBlock@CDisk@@UAAXK@Z|, CDisk::ConfigureRegisterBlock
EXPORT |?ResetController@CDisk@@QAAHH@Z| ; CDisk::ResetController
; File d:\wince500\platform\smdk2440\drivers\atapi\diskmain.h
00000 AREA |.text| { |?ResetController@CDisk@@QAAHH@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$?ResetController@CDisk@@QAAHH@Z|, PDATA, SELECTION=5, ASSOC=|.text| { |?ResetController@CDisk@@QAAHH@Z| } ; comdat associative
|$T33347| DCD |$L33346|
DCD 0x40003201
; Function compile flags: /Ogsy
; File d:\wince500\platform\smdk2440\drivers\atapi\diskmain.cpp
00000 AREA |.text| { |?ResetController@CDisk@@QAAHH@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |?ResetController@CDisk@@QAAHH@Z| PROC ; CDisk::ResetController
; 401 : {
00000 |$L33346|
00000 e92d4070 stmdb sp!, {r4 - r6, lr}
00004 |$M33344|
00004 e1a04000 mov r4, r0
; 402 : DWORD dwAttempts = 0;
; 403 : BYTE bStatus = 0;
; 404 : BOOL fRet = FALSE;
; 405 :
; 406 : // we have to negate the RESET signal for 5 microseconds before we assert it
; 407 :
; 408 : WriteAltDriveController(0x00);
00008 e5942034 ldr r2, [r4, #0x34]
0000c e594302c ldr r3, [r4, #0x2C]
00010 e3a01000 mov r1, #0
00014 e3a05000 mov r5, #0
00018 e0820003 add r0, r2, r3
0001c e3a06000 mov r6, #0
00020 eb000000 bl WRITE_PORT_UCHAR
; 409 : ::StallExecution(25);
00024 e3a00019 mov r0, #0x19
00028 eb000000 bl StallExecution
; 410 :
; 411 : // Set_SRST
; 412 : // --------
; 413 : // to enter Set_SRST state, set SRST in the Device Control register to one;
; 414 : // this will assert the RESET signal and reset both devices on the current
; 415 : // channel
; 416 :
; 417 : WriteAltDriveController(0x04); // 0x04 == SRST
0002c e5942034 ldr r2, [r4, #0x34]
00030 e594302c ldr r3, [r4, #0x2C]
00034 e3a01004 mov r1, #4
00038 e0820003 add r0, r2, r3
0003c eb000000 bl WRITE_PORT_UCHAR
; 418 :
; 419 : // remain in this state for at least 5 microseconds; i.e., assert RESET signal
; 420 : // for at least 5 microseconds
; 421 : // if this is a hardware reset, then assert RESET signal for at least 25
; 422 : // microseconds
; 423 :
; 424 : ::StallExecution(25); // this should be CEDDK implementation
00040 e3a00019 mov r0, #0x19
00044 eb000000 bl StallExecution
; 425 :
; 426 : // Clear_wait
; 427 : // ----------
; 428 : // clear SRST in the Device Control register, i.e., negate RESET signal
; 429 :
; 430 : WriteAltDriveController(0x00);
00048 e5942034 ldr r2, [r4, #0x34]
0004c e594302c ldr r3, [r4, #0x2C]
00050 e3a01000 mov r1, #0
00054 e0820003 add r0, r2, r3
00058 eb000000 bl WRITE_PORT_UCHAR
; 431 :
; 432 : // remain in this state for at least 2 milliseconds
; 433 :
; 434 : Sleep(5);
0005c e3a00005 mov r0, #5
00060 eb000000 bl Sleep
; 435 :
; 436 : HSR2_Check_status:;
; 437 :
; 438 : // Check_status
; 439 : // ------------
; 440 : // read the Status or Alternate Status register
; 441 : // if BSY is set to one, then re-enter this state
; 442 : // if BSY is cleared to zero, check the ending status in the Error register
; 443 : // and the signature (9.12) and transition to Host_Idle
; 444 :
; 445 : bStatus = GetAltStatus(); // read Status register
00064 ea000008 b |$L33343|
00068 |$HSR2_Check_status$32091|
; 446 : if (bStatus & 0x80) {
; 447 : // BSY is set to one, re-enter this state
; 448 : DEBUGMSG(ZONE_INIT, (TEXT(
; 449 : "Atapi!CDisk::ResetController> Device is busy; %u seconds remaining\r\n"
; 450 : ), (m_pPort->m_pController->m_pIdeReg->dwSoftResetTimeout - dwAttempts)));
; 451 : Sleep(1000);
00068 e3a00ffa mov r0, #0xFA, 30
0006c eb000000 bl Sleep
; 452 : dwAttempts += 1;
; 453 : // a device has at most 31 seconds to complete a software reset; we'll use 3 seconds
; 454 : if (dwAttempts == m_pPort->m_pController->m_pIdeReg->dwSoftResetTimeout) {
00070 e594303c ldr r3, [r4, #0x3C]
00074 e2855001 add r5, r5, #1
00078 e5933000 ldr r3, [r3]
0007c e5933094 ldr r3, [r3, #0x94]
00080 e5933014 ldr r3, [r3, #0x14]
00084 e1550003 cmp r5, r3
00088 0a00000b beq |$exit$32096|
0008c |$L33343|
0008c e5943028 ldr r3, [r4, #0x28]
00090 e5942034 ldr r2, [r4, #0x34]
00094 e0820003 add r0, r2, r3
00098 eb000000 bl READ_PORT_UCHAR
0009c e3100080 tst r0, #0x80
000a0 1afffff0 bne |$HSR2_Check_status$32091|
; 455 : DEBUGMSG(ZONE_INIT, (TEXT("Atapi!CDisk::ResetController> Timeout\r\n")));
; 456 : goto exit;
; 457 : }
; 458 : goto HSR2_Check_status;
; 459 : }
; 460 : DEBUGMSG(ZONE_INIT, (TEXT(
; 461 : "Atapi!CDisk::ResetController> Device is ready\r\n"
; 462 : )));
; 463 :
; 464 : // BSY is cleared to zero, check the ending status in the Error register
; 465 : // and the signature
; 466 : // TODO: Check the signature (9.12)
; 467 :
; 468 : // if ERR bit set to one, then the reset failed
; 469 : bStatus = GetAltStatus(); // read Status register
000a4 e5942034 ldr r2, [r4, #0x34]
000a8 e5943028 ldr r3, [r4, #0x28]
000ac e0820003 add r0, r2, r3
000b0 eb000000 bl READ_PORT_UCHAR
; 470 : if (bStatus & 0x01) {
000b4 e3100001 tst r0, #1
; 471 : // ERR is set to one
; 472 : // the bits in the Error register are valid, but the Error register
; 473 : // doesn't provide any useful information in the case of SRST failing
; 474 : DEBUGMSG(ZONE_INIT, (TEXT(
; 475 : "Atapi!CDisk::ResetController> SRST failed\r\n"
; 476 : )));
; 477 : // TODO: Recover from error
; 478 : goto exit;
; 479 : }
; 480 :
; 481 : fRet = TRUE;
000b8 03a06001 moveq r6, #1
000bc |$exit$32096|
; 482 :
; 483 : exit:;
; 484 : return fRet;
000bc e1a00006 mov r0, r6
; 485 : }
000c0 e8bd4070 ldmia sp!, {r4 - r6, lr}
000c4 e12fff1e bx lr
000c8 |$M33345|
ENDP ; |?ResetController@CDisk@@QAAHH@Z|, CDisk::ResetController
EXPORT |?AtapiSoftReset@CDisk@@QAAXXZ| ; CDisk::AtapiSoftReset
; File d:\wince500\platform\smdk2440\drivers\atapi\diskmain.h
00000 AREA |.text| { |?AtapiSoftReset@CDisk@@QAAXXZ| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$?AtapiSoftReset@CDisk@@QAAXXZ|, PDATA, SELECTION=5, ASSOC=|.text| { |?AtapiSoftReset@CDisk@@QAAXXZ| } ; comdat associative
|$T33358| DCD |$L33357|
DCD 0x40001901
; Function compile flags: /Ogsy
; File d:\wince500\platform\smdk2440\drivers\atapi\diskmain.cpp
00000 AREA |.text| { |?AtapiSoftReset@CDisk@@QAAXXZ| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |?AtapiSoftReset@CDisk@@QAAXXZ| PROC ; CDisk::AtapiSoftReset
; 498 : {
00000 |$L33357|
00000 e92d4030 stmdb sp!, {r4, r5, lr}
00004 |$M33355|
00004 e1a05000 mov r5, r0
; 499 : WriteCommand(ATAPI_CMD_SOFT_RESET);
00008 e5952030 ldr r2, [r5, #0x30]
0000c e5953024 ldr r3, [r5, #0x24]
00010 e3a01008 mov r1, #8
00014 e0820003 add r0, r2, r3
00018 eb000000 bl WRITE_PORT_UCHAR
; 500 : WaitForDisc(WAIT_TYPE_NOT_BUSY, 400);
0001c e5951000 ldr r1, [r5]
00020 e3a03000 mov r3, #0
00024 e3a02e19 mov r2, #0x19, 28
00028 e591401c ldr r4, [r1, #0x1C]
0002c e3a01002 mov r1, #2
00030 e1a00005 mov r0, r5
00034 e1a0e00f mov lr, pc
00038 e12fff14 bx r4
; 501 : WaitForDisc(WAIT_TYPE_READY, 500);
0003c e5951000 ldr r1, [r5]
00040 e3a03000 mov r3, #0
00044 e3a02f7d mov r2, #0x7D, 30
00048 e591401c ldr r4, [r1, #0x1C]
0004c e3a01003 mov r1, #3
00050 e1a00005 mov r0, r5
00054 e1a0e00f mov lr, pc
00058 e12fff14 bx r4
; 502 : }
0005c e8bd4030 ldmia sp!, {r4, r5, lr}
00060 e12fff1e bx lr
00064 |$M33356|
ENDP ; |?AtapiSoftReset@CDisk@@QAAXXZ|, CDisk::AtapiSoftReset
EXPORT |?IsDevicePresent@CDisk@@QAAHXZ| ; CDisk::IsDevicePresent
; File d:\wince500\platform\smdk2440\drivers\atapi\diskmain.h
00000 AREA |.text| { |?IsDevicePresent@CDisk@@QAAHXZ| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$?IsDevicePresent@CDisk@@QAAHXZ|, PDATA, SELECTION=5, ASSOC=|.text| { |?IsDevicePresent@CDisk@@QAAHXZ| } ; comdat associative
|$T33376| DCD |$L33375|
DCD 0x40001901
; Function compile flags: /Ogsy
; File d:\wince500\platform\smdk2440\drivers\atapi\diskmain.cpp
00000 AREA |.text| { |?IsDevicePresent@CDisk@@QAAHXZ| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |?IsDevicePresent@CDisk@@QAAHXZ| PROC ; CDisk::IsDevicePresent
; 521 : {
00000 |$L33375|
00000 e92d4010 stmdb sp!, {r4, lr}
00004 |$M33373|
00004 e1a04000 mov r4, r0
; 522 : BYTE bError;
; 523 : BYTE bStatus;
; 524 :
; 525 : DEBUGMSG(ZONE_INIT, (_T("Atapi!CDisk::IsDevicePresent %x\r\n"), m_pATAReg));
; 526 : // determine which device to select (i.e., which device this device is)
; 527 : if ((m_dwDevice == 0) || (m_dwDevice == 2)) {
00008 e5943484 ldr r3, [r4, #0x484]
; 528 : // select device 0
; 529 : ATA_WRITE_BYTE(m_pATAReg + m_dwDrvHeadOffset, ATA_HEAD_DRIVE_1);
0000c e5942030 ldr r2, [r4, #0x30]
00010 e3530000 cmp r3, #0
00014 13530002 cmpne r3, #2
00018 e5943020 ldr r3, [r4, #0x20]
; 530 : }
; 531 : else {
; 532 : // select device 1
; 533 : ATA_WRITE_BYTE(m_pATAReg + m_dwDrvHeadOffset, ATA_HEAD_DRIVE_2);
0001c 13a010b0 movne r1, #0xB0
00020 03a010a0 moveq r1, #0xA0
00024 e0820003 add r0, r2, r3
00028 eb000000 bl WRITE_PORT_UCHAR
; 534 : }
; 535 :
; 536 : // read Status register
; 537 : bStatus = GetAltStatus();
0002c e5942034 ldr r2, [r4, #0x34]
00030 e5943028 ldr r3, [r4, #0x28]
00034 e0820003 add r0, r2, r3
00038 eb000000 bl READ_PORT_UCHAR
; 538 :
; 539 : // read Error register
; 540 : bError = GetError();
0003c e5942030 ldr r2, [r4, #0x30]
00040 e594300c ldr r3, [r4, #0xC]
00044 e0820003 add r0, r2, r3
00048 eb000000 bl READ_PORT_UCHAR
; 541 : // test Error register
; 542 : if (bError == 0x1) {
0004c e3500001 cmp r0, #1
; 543 : DEBUGMSG(ZONE_INIT, (_T(//don't remove this msg,or CF will not be identified,LQM,2006-8-21
; 544 : "Atapi!CDisk::IsDevicePresent>Found IDE Device %d \r\n"
; 545 : ), m_dwDevice));
; 546 : return TRUE;
00050 03a00001 moveq r0, #1
; 553 : }
00054 08bd4010 ldmeqia sp!, {r4, lr}
; 547 : }
; 548 : DEBUGMSG(ZONE_INIT, (_T(
; 549 : "Atapi!CDisk::IsDevicePresent> Device %d is not present; Error register(0x%x)\r\n"
; 550 : ), m_dwDevice, bError));
; 551 : //LQM 2006-8-14 return true always
; 552 : return FALSE;
00058 13a00000 movne r0, #0
; 553 : }
0005c 18bd4010 ldmneia sp!, {r4, lr}
00060 e12fff1e bx lr
00064 |$M33374|
ENDP ; |?IsDevicePresent@CDisk@@QAAHXZ|, CDisk::IsDevicePresent
EXPORT |?SendExecuteDeviceDiagnostic@CDisk@@QAAHPAEPAH@Z| ; CDisk::SendExecuteDeviceDiagnostic
IMPORT |?WaitOnBusy@CDisk
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -