📄 atapiio.cod
字号:
; 368 : }
; 369 :
; 370 : // write one word even if we only need one byte; save the unused byte and
; 371 : // use it as the first byte of the next read (scatter/gather buffer)
; 372 :
; 373 : if (dwCount == 1) {
000e0 e35e0001 cmp lr, #1
; 374 : DEBUGMSG( ZONE_WARNING, (TEXT("Atapi!CDisk::WriteBuffer> Writing one word for one byte\r\n")));
; 375 : m_wNextByte = (WORD) *pBuffer; // save the second byte
000e4 05d53000 ldreqb r3, [r5]
; 376 : }
; 377 :
; 378 : BYTE bStatus = GetAltStatus();
000e8 e5942034 ldr r2, [r4, #0x34]
000ec 01c435b0 streqh r3, [r4, #0x50]
000f0 e5943028 ldr r3, [r4, #0x28]
000f4 e0820003 add r0, r2, r3
000f8 eb000000 bl READ_PORT_UCHAR
; 379 :
; 380 : if (ZONE_CELOG) CeLogData(TRUE, CELID_ATAPI_COMPLETEWRITEBUFFER, &bStatus, sizeof(bStatus), 0, CELZONE_ALWAYSON, 0, FALSE);
000fc e5963440 ldr r3, [r6, #0x440]
00100 e5cd0010 strb r0, [sp, #0x10]
00104 e3130902 tst r3, #2, 18
00108 0a000009 beq |$L32110|
0010c e3a01d86 mov r1, #0x86, 26
00110 e381100c orr r1, r1, #0xC
00114 e3a03001 mov r3, #1
00118 e28d2010 add r2, sp, #0x10
0011c e3a00001 mov r0, #1
00120 e58d700c str r7, [sp, #0xC]
00124 e58d7008 str r7, [sp, #8]
00128 e58d8004 str r8, [sp, #4]
0012c e58d7000 str r7, [sp]
00130 eb000000 bl CeLogData
00134 |$L32110|
; 381 : }
00134 e28dd014 add sp, sp, #0x14
00138 e89d61f0 ldmia sp, {r4 - r8, sp, lr}
0013c e12fff1e bx lr
00140 |$L32100|
; 354 : DEBUGMSG(ZONE_WARNING, (TEXT("Atapi!CDisk::WriteBuffer> Unaligned buffer\r\n")));
; 355 : while (dwCount> 1) {
; 356 : unisc.uc[0] = *pBuffer++;
00140 e4d51001 ldrb r1, [r5], #1
; 357 : unisc.uc[1] = *pBuffer++;
; 358 : WriteWord(unisc.us);
00144 e5940030 ldr r0, [r4, #0x30]
00148 e5943008 ldr r3, [r4, #8]
0014c e4d52001 ldrb r2, [r5], #1
00150 e5cd1012 strb r1, [sp, #0x12]
00154 e0800003 add r0, r0, r3
00158 e5cd2013 strb r2, [sp, #0x13]
0015c e1dd11b2 ldrh r1, [sp, #0x12]
00160 eb000000 bl WRITE_PORT_USHORT
; 359 : dwCount-=2;
00164 e59d3038 ldr r3, [sp, #0x38]
00168 e243e002 sub lr, r3, #2
0016c e58de038 str lr, [sp, #0x38]
00170 |$L32530|
00170 e35e0001 cmp lr, #1
00174 8afffff1 bhi |$L32100|
; 360 : }
; 361 : }
; 362 : else {
00178 eaffffd8 b |$L32102|
0017c |$L32536|
0017c 00000000 DCD |?dpCurSettings@@3U_DBGPARAM@@A|
00180 |$M32532|
ENDP ; |?WriteBuffer@CDisk@@QAAXPAEK@Z|, CDisk::WriteBuffer
EXPORT |?SetTransferMode@CDisk@@QAAHE@Z| ; CDisk::SetTransferMode
IMPORT |Sleep|
; File d:\wince500\platform\smdk2440\drivers\atapi\diskmain.h
00000 AREA |.text| { |?SetTransferMode@CDisk@@QAAHE@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$?SetTransferMode@CDisk@@QAAHE@Z|, PDATA, SELECTION=5, ASSOC=|.text| { |?SetTransferMode@CDisk@@QAAHE@Z| } ; comdat associative
|$T32603| DCD |$L32602|
DCD 0x40004902
; Function compile flags: /Ogsy
; File d:\wince500\platform\smdk2440\drivers\atapi\atapiio.cpp
00000 AREA |.text| { |?SetTransferMode@CDisk@@QAAHE@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |?SetTransferMode@CDisk@@QAAHE@Z| PROC ; CDisk::SetTransferMode
; 401 : {
00000 |$L32602|
00000 e92d4030 stmdb sp!, {r4, r5, lr}
00004 e24dd004 sub sp, sp, #4
00008 |$M32600|
00008 e1a05001 mov r5, r1
0000c e1a04000 mov r4, r0
; 402 : BYTE bStatus; // Status register
; 403 : BYTE bError; // Error register
; 404 : BOOL fOk; // result
; 405 :
; 406 : // HI:Check_Status (Host Idle); wait until BSY=0 and DRQ=0
; 407 : // read Status register
; 408 : while (1) {
; 409 : bStatus = GetAltStatus();
00010 ea000001 b |$L32595|
00014 |$L32119|
; 410 : if (!(bStatus & (0x80|0x08))) break; // BSY := Bit 7, DRQ := Bit 3
; 411 : Sleep(5);
00014 e3a00005 mov r0, #5
00018 eb000000 bl Sleep
0001c |$L32595|
0001c e5943028 ldr r3, [r4, #0x28]
00020 e5942034 ldr r2, [r4, #0x34]
00024 e0820003 add r0, r2, r3
00028 eb000000 bl READ_PORT_UCHAR
0002c e3100088 tst r0, #0x88
00030 1afffff7 bne |$L32119|
; 412 : }
; 413 :
; 414 : // HI:Device_Select; select device
; 415 : SelectDevice();
00034 e5943484 ldr r3, [r4, #0x484]
00038 e5942030 ldr r2, [r4, #0x30]
0003c e3530000 cmp r3, #0
00040 e5943020 ldr r3, [r4, #0x20]
00044 03a010a0 moveq r1, #0xA0
00048 13a010b0 movne r1, #0xB0
0004c e20110ff and r1, r1, #0xFF
00050 e0820003 add r0, r2, r3
00054 eb000000 bl WRITE_PORT_UCHAR
; 416 :
; 417 : // HI:Check_Status (Host Idle); wait until BSY=0 and DRQ=0
; 418 : // read Status register
; 419 : while (1) {
; 420 : bStatus = GetAltStatus();
00058 ea000001 b |$L32597|
0005c |$L32123|
; 421 : if (!(bStatus & (0x80|0x08))) break; // BSY := Bit 7, DRQ := Bit 3
; 422 : Sleep(5);
0005c e3a00005 mov r0, #5
00060 eb000000 bl Sleep
00064 |$L32597|
00064 e5943028 ldr r3, [r4, #0x28]
00068 e5942034 ldr r2, [r4, #0x34]
0006c e0820003 add r0, r2, r3
00070 eb000000 bl READ_PORT_UCHAR
00074 e3100088 tst r0, #0x88
00078 1afffff7 bne |$L32123|
; 423 : }
; 424 :
; 425 : // HI:Write_Parameters
; 426 : WriteFeature(0x03); // set transfer mode based on value in Sector Count register (Table 44)
0007c e5942030 ldr r2, [r4, #0x30]
00080 e594300c ldr r3, [r4, #0xC]
00084 e3a01003 mov r1, #3
00088 e0820003 add r0, r2, r3
0008c eb000000 bl WRITE_PORT_UCHAR
; 427 : WriteSectorCount(bMode); // (Table 45)
00090 e5942030 ldr r2, [r4, #0x30]
00094 e5943010 ldr r3, [r4, #0x10]
00098 e1a01005 mov r1, r5
0009c e0820003 add r0, r2, r3
000a0 eb000000 bl WRITE_PORT_UCHAR
; 428 : WriteAltDriveController(0x00); // disable interrupt (nIEN := Bit 1 of Device Control register)
000a4 e5942034 ldr r2, [r4, #0x34]
000a8 e594302c ldr r3, [r4, #0x2C]
000ac e3a01000 mov r1, #0
000b0 e0820003 add r0, r2, r3
000b4 eb000000 bl WRITE_PORT_UCHAR
; 429 :
; 430 : // HI:Write_Command
; 431 : WriteCommand(0xEF); // SET FEATURES command code := EFh
000b8 e5942030 ldr r2, [r4, #0x30]
000bc e5943024 ldr r3, [r4, #0x24]
000c0 e3a010ef mov r1, #0xEF
000c4 e0820003 add r0, r2, r3
000c8 eb000000 bl WRITE_PORT_UCHAR
; 432 :
; 433 : // transition to non-data command protocol
; 434 :
; 435 : // HND:INTRQ_Wait
; 436 : // transition to HND:Check_Status
; 437 : // read Status register
; 438 : while (1) { // BSY := Bit 7
; 439 : bStatus = GetAltStatus();
; 440 : bError = GetError();
000cc ea000003 b |$L32599|
000d0 |$L32127|
; 447 : break;
; 448 : }
; 449 : if (!(bStatus & 0x80)) break; // BSY := Bit 7
000d0 e3150080 tst r5, #0x80
000d4 0a00000e beq |$L32582|
; 450 : Sleep(5);
000d8 e3a00005 mov r0, #5
000dc eb000000 bl Sleep
000e0 |$L32599|
000e0 e5943028 ldr r3, [r4, #0x28]
000e4 e5942034 ldr r2, [r4, #0x34]
000e8 e0820003 add r0, r2, r3
000ec eb000000 bl READ_PORT_UCHAR
000f0 e594300c ldr r3, [r4, #0xC]
000f4 e5942030 ldr r2, [r4, #0x30]
000f8 e1a05000 mov r5, r0
000fc e0820003 add r0, r2, r3
00100 eb000000 bl READ_PORT_UCHAR
00104 e3100004 tst r0, #4
00108 0afffff0 beq |$L32127|
; 441 : if (bError & 0x04) { // ABRT := Bit 2
; 442 : // command was aborted
; 443 : DEBUGMSG(ZONE_ERROR, (_T(
; 444 : "Atapi!CDisk::SetTransferMode> Failed to send SET FEATURES command, parameter 0x%x\r\n"
; 445 : ), bMode));
; 446 : fOk = FALSE;
0010c e3a00000 mov r0, #0
00110 ea000000 b |$L32577|
00114 |$L32582|
00114 e59d0000 ldr r0, [sp]
00118 |$L32577|
; 451 : }
; 452 :
; 453 : // transition to host idle protocol
; 454 :
; 455 : return fOk;
; 456 : }
00118 e28dd004 add sp, sp, #4
0011c e8bd4030 ldmia sp!, {r4, r5, lr}
00120 e12fff1e bx lr
00124 |$M32601|
ENDP ; |?SetTransferMode@CDisk@@QAAHE@Z|, CDisk::SetTransferMode
EXPORT |?SendIOCommand@CDisk@@QAAHKKE@Z| ; CDisk::SendIOCommand
IMPORT |__rt_udiv|
; File d:\wince500\platform\smdk2440\drivers\atapi\diskmain.h
00000 AREA |.text| { |?SendIOCommand@CDisk@@QAAHKKE@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$?SendIOCommand@CDisk@@QAAHKKE@Z|, PDATA, SELECTION=5, ASSOC=|.text| { |?SendIOCommand@CDisk@@QAAHKKE@Z| } ; comdat associative
|$T32661| DCD |$L32660|
DCD 0x40007f04
; Function compile flags: /Ogsy
; File d:\wince500\platform\smdk2440\drivers\atapi\atapiio.cpp
00000 AREA |.text| { |?SendIOCommand@CDisk@@QAAHKKE@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |?SendIOCommand@CDisk@@QAAHKKE@Z| PROC ; CDisk::SendIOCommand
; 30 : {
00000 |$L32660|
00000 e1a0c00d mov r12, sp
00004 e92d000f stmdb sp!, {r0 - r3}
00008 e92d51f0 stmdb sp!, {r4 - r8, r12, lr}
0000c e24dd010 sub sp, sp, #0x10
00010 |$M32658|
00010 e1a04002 mov r4, r2
00014 e1a06001 mov r6, r1
00018 e1a05000 mov r5, r0
; 31 : DEBUGMSG(ZONE_IO, (TEXT(
; 32 : "Atapi!CDisk::SendIOCommand> sector(%d), sectors left(%x), command(%x)\r\n"
; 33 : ), dwStartSector,dwNumberOfSectors,bCmd));
; 34 :
; 35 : if (ZONE_CELOG) CeLogData(TRUE, CELID_ATAPI_IOCOMMAND, &bCmd, sizeof(bCmd), 0, CELZONE_ALWAYSON, 0, FALSE);
0001c e59f31d4 ldr r3, [pc, #0x1D4]
00020 e5933440 ldr r3, [r3, #0x440]
00024 e3130902 tst r3, #2, 18
00028 0a00000b beq |$L31939|
0002c e3a01d86 mov r1, #0x86, 26
00030 e3a0e101 mov lr, #1, 2
00034 e3a07000 mov r7, #0
00038 e3811003 orr r1, r1, #3
0003c e3a03001 mov r3, #1
00040 e28d2038 add r2, sp, #0x38
00044 e3a00001 mov r0, #1
00048 e58d700c str r7, [sp, #0xC]
0004c e58d7008 str r7, [sp, #8]
00050 e58de004 str lr, [sp, #4]
00054 e58d7000 str r7, [sp]
00058 eb000000 bl CeLogData
0005c |$L31939|
; 36 :
; 37 : SelectDevice();
0005c e5953484 ldr r3, [r5, #0x484]
00060 e5952030 ldr r2, [r5, #0x30]
00064 e3530000 cmp r3, #0
00068 e5953020 ldr r3, [r5, #0x20]
0006c 03a010a0 moveq r1, #0xA0
00070 13a010b0 movne r1, #0xB0
00074 e20110ff and r1, r1, #0xFF
00078 e0820003 add r0, r2, r3
0007c eb000000 bl WRITE_PORT_UCHAR
; 38 :
; 39 : if (WaitOnBusy(FALSE)) {
00080 e3a01000 mov r1, #0
00084 e1a00005 mov r0, r5
00088 eb000000 bl |?WaitOnBusy@CDisk@@QAAEH@Z|
0008c e3500000 cmp r0, #0
; 40 : DEBUGMSG(ZONE_IO, (TEXT(
; 41 : "Atapi!CDisk::SendIOCommand> Failed to send command; status(%x), error(%x)\r\n"
; 42 : ), GetAltStatus(),GetError()));
; 43 : return FALSE;
00090 13a00000 movne r0, #0
00094 1a000054 bne |$L31937|
; 44 : }
; 45 :
; 46 : // to transfer 256 sectors, set number of sectors to 0
; 47 : if (dwNumberOfSectors == MAX_SECT_PER_COMMAND) {
; 48 : dwNumberOfSectors = 0;
; 49 : }
; 50 :
; 51 : WriteSectorCount((BYTE)dwNumberOfSectors);
00098 e5952030 ldr r2, [r5, #0x30]
0009c e5953010 ldr r3, [r5, #0x10]
000a0 e3540c01 cmp r4, #1, 24
000a4 03a04000 moveq r4, #0
000a8 e20410ff and r1, r4, #0xFF
000ac e0820003 add r0, r2, r3
000b0 eb000000 bl WRITE_PORT_UCHAR
; 52 : if (m_fLBAMode == TRUE) {
000b4 e5953694 ldr r3, [
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -