📄 cdio.cod
字号:
0000c e1a07001 mov r7, r1
00010 e1a05000 mov r5, r0
; 353 : // Set the Drive/Head registers
; 354 : SelectDevice();
00014 e595e484 ldr lr, [r5, #0x484]
00018 e5952030 ldr r2, [r5, #0x30]
0001c e5953020 ldr r3, [r5, #0x20]
00020 e35e0000 cmp lr, #0
00024 03a000a0 moveq r0, #0xA0
00028 13a000b0 movne r0, #0xB0
0002c e20010ff and r1, r0, #0xFF
00030 e0820003 add r0, r2, r3
00034 eb000000 bl WRITE_PORT_UCHAR
; 355 : GetBaseStatus();
00038 e1a00005 mov r0, r5
0003c eb000000 bl |?GetBaseStatus@CDisk@@QAAEXZ|
; 356 :
; 357 : SelectDevice();
00040 e5953484 ldr r3, [r5, #0x484]
00044 e5952030 ldr r2, [r5, #0x30]
00048 e3530000 cmp r3, #0
0004c e5953020 ldr r3, [r5, #0x20]
00050 03a010a0 moveq r1, #0xA0
00054 13a010b0 movne r1, #0xB0
00058 e20110ff and r1, r1, #0xFF
0005c e0820003 add r0, r2, r3
00060 eb000000 bl WRITE_PORT_UCHAR
; 358 : if (WaitOnBusy(FALSE))
00064 e3a01000 mov r1, #0
00068 e1a00005 mov r0, r5
0006c eb000000 bl |?WaitOnBusy@CDisk@@QAAEH@Z|
00070 e3500000 cmp r0, #0
00074 0a000005 beq |$L32264|
; 359 : {
; 360 : if (GetError() & ATA_STATUS_ERROR)
00078 e5952030 ldr r2, [r5, #0x30]
0007c e595300c ldr r3, [r5, #0xC]
00080 e0820003 add r0, r2, r3
00084 eb000000 bl READ_PORT_UCHAR
00088 e3100001 tst r0, #1
; 361 : {
; 362 : return FALSE;
0008c 1a000059 bne |$L32919|
00090 |$L32264|
; 363 : }
; 364 : }
; 365 : #if 1
; 366 : // for( DWORD dwCount = 0; dwCount < 10; dwCount++) {
; 367 : // if( WaitForInterrupt(0)) {
; 368 : // break;
; 369 : // }
; 370 : // }
; 371 : #endif
; 372 :
; 373 : WriteSectorCount(0);
00090 e5952030 ldr r2, [r5, #0x30]
00094 e5953010 ldr r3, [r5, #0x10]
00098 e3a01000 mov r1, #0
0009c e0820003 add r0, r2, r3
000a0 eb000000 bl WRITE_PORT_UCHAR
; 374 :
; 375 : WriteSectorNumber(0);
000a4 e5952030 ldr r2, [r5, #0x30]
000a8 e5953014 ldr r3, [r5, #0x14]
000ac e3a01000 mov r1, #0
000b0 e0820003 add r0, r2, r3
000b4 eb000000 bl WRITE_PORT_UCHAR
; 376 :
; 377 :
; 378 : // Set the byte tranfer count
; 379 : if (wCount) {
; 380 : WriteLowCount((BYTE)(0xff & wCount));
000b8 e5952030 ldr r2, [r5, #0x30]
000bc e5953018 ldr r3, [r5, #0x18]
000c0 e3540000 cmp r4, #0
000c4 e0820003 add r0, r2, r3
000c8 0a000007 beq |$L32265|
000cc e20410ff and r1, r4, #0xFF
000d0 eb000000 bl WRITE_PORT_UCHAR
; 381 : WriteHighCount((BYTE)(0xff & (wCount >> 8)));
000d4 e5950030 ldr r0, [r5, #0x30]
000d8 e595201c ldr r2, [r5, #0x1C]
000dc e1a03424 mov r3, r4, lsr #8
000e0 e20310ff and r1, r3, #0xFF
000e4 e0800002 add r0, r0, r2
; 382 : } else {
000e8 ea000005 b |$L32918|
000ec |$L32265|
; 383 : WriteLowCount(0xFE);
000ec e3a010fe mov r1, #0xFE
000f0 eb000000 bl WRITE_PORT_UCHAR
; 384 : WriteHighCount(0xFF);
000f4 e5952030 ldr r2, [r5, #0x30]
000f8 e595301c ldr r3, [r5, #0x1C]
000fc e3a010ff mov r1, #0xFF
00100 e0820003 add r0, r2, r3
00104 |$L32918|
00104 eb000000 bl WRITE_PORT_UCHAR
; 385 : }
; 386 :
; 387 :
; 388 : //
; 389 : // Set PIO or DMA Mode as specified in bFlags. 0 = PIO, 1 = DMA
; 390 : //
; 391 : WriteFeature(fDMA ? 0x1 : 0x0);
00108 e5952030 ldr r2, [r5, #0x30]
0010c e595300c ldr r3, [r5, #0xC]
00110 e3560000 cmp r6, #0
00114 13a01001 movne r1, #1
00118 03a01000 moveq r1, #0
0011c e20110ff and r1, r1, #0xFF
00120 e0820003 add r0, r2, r3
00124 eb000000 bl WRITE_PORT_UCHAR
; 392 :
; 393 : WaitForDisc( WAIT_TYPE_NOT_BUSY, 20);
00128 e5951000 ldr r1, [r5]
0012c e3a03000 mov r3, #0
00130 e3a02014 mov r2, #0x14
00134 e591401c ldr r4, [r1, #0x1C]
00138 e3a01002 mov r1, #2
0013c e1a00005 mov r0, r5
00140 e1a0e00f mov lr, pc
00144 e12fff14 bx r4
; 394 :
; 395 : // Write ATAPI into command register
; 396 :
; 397 : SelectDevice();
00148 e5953484 ldr r3, [r5, #0x484]
0014c e5952030 ldr r2, [r5, #0x30]
00150 e3530000 cmp r3, #0
00154 e5953020 ldr r3, [r5, #0x20]
00158 03a010a0 moveq r1, #0xA0
0015c 13a010b0 movne r1, #0xB0
00160 e20110ff and r1, r1, #0xFF
00164 e0820003 add r0, r2, r3
00168 eb000000 bl WRITE_PORT_UCHAR
; 398 :
; 399 : WriteCommand(ATAPI_CMD_COMMAND);
0016c e5952030 ldr r2, [r5, #0x30]
00170 e5953024 ldr r3, [r5, #0x24]
00174 e3a010a0 mov r1, #0xA0
00178 e0820003 add r0, r2, r3
0017c eb000000 bl WRITE_PORT_UCHAR
; 400 :
; 401 : WaitForDisc( WAIT_TYPE_NOT_BUSY, 20);
00180 e5951000 ldr r1, [r5]
00184 e3a03000 mov r3, #0
00188 e3a02014 mov r2, #0x14
0018c e591401c ldr r4, [r1, #0x1C]
00190 e3a01002 mov r1, #2
00194 e1a00005 mov r0, r5
00198 e1a0e00f mov lr, pc
0019c e12fff14 bx r4
; 402 : //
; 403 : // Check how device is reporting CPU attention: DRQ or INTRQ?
; 404 : // INTRQ within 10 ms!!!
; 405 : //
; 406 : if (m_fInterruptSupported && IsDRQTypeIRQ())
001a0 e5953040 ldr r3, [r5, #0x40]
001a4 e3530000 cmp r3, #0
001a8 0a00000b beq |$L32270|
001ac e1a00005 mov r0, r5
001b0 eb000000 bl |?IsDRQTypeIRQ@CDisk@@QAAHXZ|
001b4 e3500000 cmp r0, #0
001b8 0a000007 beq |$L32270|
; 407 : {
; 408 : // ATA_INTR_CMD is expected
; 409 : //
; 410 : if (!WaitForInterrupt(m_dwDiskIoTimeOut))
001bc e5953000 ldr r3, [r5]
001c0 e59516c8 ldr r1, [r5, #0x6C8]
001c4 e1a00005 mov r0, r5
001c8 e5933038 ldr r3, [r3, #0x38]
001cc e1a0e00f mov lr, pc
001d0 e12fff13 bx r3
001d4 e3500000 cmp r0, #0
; 411 : {
; 412 : DEBUGMSG( ZONE_IO | ZONE_CDROM, (TEXT("ATAPI:AtapiSendCommand - Wait for ATA_INTR_CMD Interrupt (DevId %x) \r\n"), m_dwDeviceId));
; 413 : return FALSE;
001d8 0a000006 beq |$L32919|
001dc |$L32270|
; 414 : }
; 415 : }
; 416 : //
; 417 : // Device will assert DRQ within (50us or 3ms) if no interrupt id used
; 418 : // Wait for not BSY and DRQ
; 419 :
; 420 :
; 421 : if (!WaitForDRQ())
001dc e5953000 ldr r3, [r5]
001e0 e1a00005 mov r0, r5
001e4 e5933018 ldr r3, [r3, #0x18]
001e8 e1a0e00f mov lr, pc
001ec e12fff13 bx r3
001f0 e3500000 cmp r0, #0
001f4 1a000002 bne |$L32272|
001f8 |$L32919|
; 422 : {
; 423 : DEBUGMSG( ZONE_IO | ZONE_CDROM, (TEXT("ATAPIPCI:AtapiSendCommand 1 - ATAWaitForDisc failed with: %x (DevId %x)\r\n"), GetError(), m_dwDeviceId));
; 424 : return FALSE;
001f8 e3a00000 mov r0, #0
; 433 : }
001fc e8bd40f0 ldmia sp!, {r4 - r7, lr}
00200 e12fff1e bx lr
00204 |$L32272|
; 425 :
; 426 : }
; 427 :
; 428 : // Write the ATAPI Command Packet.
; 429 :
; 430 : WriteWordBuffer( (LPWORD)pCmdPkt,GetPacketSize()/sizeof(WORD));
00204 e1a00005 mov r0, r5
00208 eb000000 bl |?GetPacketSize@CDisk@@QAAGXZ|
0020c e5951030 ldr r1, [r5, #0x30]
00210 e5953008 ldr r3, [r5, #8]
00214 e1a02800 mov r2, r0, lsl #16
00218 e1a02822 mov r2, r2, lsr #16
0021c e0810003 add r0, r1, r3
00220 e1a020a2 mov r2, r2, lsr #1
00224 e1a01007 mov r1, r7
00228 eb000000 bl WRITE_PORT_BUFFER_USHORT
; 431 :
; 432 : return TRUE;
0022c e3a00001 mov r0, #1
; 433 : }
00230 e8bd40f0 ldmia sp!, {r4 - r7, lr}
00234 e12fff1e bx lr
00238 |$M32921|
ENDP ; |?AtapiSendCommand@CPCIDiskAndCD@@QAAHPAU_ATAPI_COMMAND_PACKET@@GH@Z|, CPCIDiskAndCD::AtapiSendCommand
EXPORT |?AtapiReceiveData@CPCIDiskAndCD@@QAAHPAU_SGX_BUF@@KPAK@Z| ; CPCIDiskAndCD::AtapiReceiveData
IMPORT |MapCallerPtr|
IMPORT |?ReadBuffer@CDisk@@QAAXPAEK@Z| ; CDisk::ReadBuffer
IMPORT |?CheckIntrState@CDisk@@QAAGXZ| ; CDisk::CheckIntrState
; File c:\wince500\platform\smdk2410\drivers\atapi\diskmain.h
00000 AREA |.text| { |?AtapiReceiveData@CPCIDiskAndCD@@QAAHPAU_SGX_BUF@@KPAK@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$?AtapiReceiveData@CPCIDiskAndCD@@QAAHPAU_SGX_BUF@@KPAK@Z|, PDATA, SELECTION=5, ASSOC=|.text| { |?AtapiReceiveData@CPCIDiskAndCD@@QAAHPAU_SGX_BUF@@KPAK@Z| } ; comdat associative
|$T32967| DCD |$L32966|
DCD 0x4000ad02
; Function compile flags: /Ogsy
; File c:\wince500\platform\smdk2410\drivers\atapi\cdio.cpp
00000 AREA |.text| { |?AtapiReceiveData@CPCIDiskAndCD@@QAAHPAU_SGX_BUF@@KPAK@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |?AtapiReceiveData@CPCIDiskAndCD@@QAAHPAU_SGX_BUF@@KPAK@Z| PROC ; CPCIDiskAndCD::AtapiReceiveData
; 439 : {
00000 |$L32966|
00000 e92d4ff0 stmdb sp!, {r4 - r11, lr}
00004 e24dd004 sub sp, sp, #4
00008 |$M32964|
00008 e1a08003 mov r8, r3
0000c e58d8000 str r8, [sp]
00010 e1a09002 mov r9, r2
00014 e1a07001 mov r7, r1
00018 e1a06000 mov r6, r0
; 440 : DWORD dwSgLeft = dwSgCount;
; 441 : DWORD dwTransferCount = 0;
; 442 : PSGX_BUF pCurrentSegment = NULL;
; 443 : DWORD dwReadCount = 0;
; 444 : DWORD dwThisCount = 0;
; 445 : BYTE *pCurrentBuffer = NULL;
; 446 : DWORD dwLen = 0;
; 447 :
; 448 : DEBUGMSG( ZONE_IO | ZONE_CDROM, (TEXT("ATAPI:AtapiReceiveData - Entered SgCount=%ld.\r\n"), dwSgCount));
; 449 :
; 450 : if (ERROR_SUCCESS != WaitForDisc( WAIT_TYPE_READY, 5000, 100))
0001c e596e000 ldr lr, [r6]
00020 e3a02d4e mov r2, #0x4E, 26
00024 e3822008 orr r2, r2, #8
00028 e59e401c ldr r4, [lr, #0x1C]
0002c e3a03064 mov r3, #0x64
00030 e3a01003 mov r1, #3
00034 e3a0b000 mov r11, #0
00038 e3a05000 mov r5, #0
0003c e3a0a000 mov r10, #0
00040 e1a0e00f mov lr, pc
00044 e12fff14 bx r4
00048 e3500000 cmp r0, #0
; 451 : return FALSE;
0004c 1a000094 bne |$L32940|
; 452 :
; 453 : pCurrentSegment = pSgBuf;
; 454 :
; 455 : // Illegal arguments
; 456 : if (!pCurrentSegment && dwSgCount > 0) {
00050 e3570000 cmp r7, #0
00054 1a000003 bne |$L32946|
00058 e3590000 cmp r9, #0
0005c 0a000025 beq |$L32293|
; 470 : // security violation
; 471 : DEBUGMSG(ZONE_ERROR, (TEXT(
; 472 : "Atapi!CPCIDiskAndCD::AtapiReceiveData> Failed to map pointer to caller\r\n"
; 473 : )));
; 474 : return ERROR_INVALID_PARAMETER;
00060 e3a00057 mov r0, #0x57
00064 ea00008b b |$L32281|
00068 |$L32946|
; 457 : DEBUGMSG(ZONE_ERROR, (TEXT(
; 458 : "Atapi!CPCIDiskAndCD::AtapiReceiveData> pSgBuf null\r\n"
; 459 : )));
; 460 : return ERROR_INVALID_PARAMETER;
; 461 : }
; 462 :
; 463 : // The TEST UNIT READY command processor will call this with a null scatter/gather
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -