⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atapiio.cod

📁 windows CE 的BSP开发包.包含众多的驱动程序和OAL层的开发代码
💻 COD
📖 第 1 页 / 共 5 页
字号:
  00028	e2004003	 and         r4, r0, #3
  0002c	e0820003	 add         r0, r2, r3
  00030	eb000000	 bl          READ_PORT_UCHAR

; 233  : 
; 234  :     if (bDRQ) {

  00034	e3100008	 tst         r0, #8

; 235  :         bReason |= 4;

  00038	13844004	 orrne       r4, r4, #4

; 236  :     }
; 237  :     if (bReason < 3) {

  0003c	e3540003	 cmp         r4, #3

; 238  :         return((WORD) ATA_INTR_READY);

  00040	33a04003	 movcc       r4, #3
  00044	e1a00004	 mov         r0, r4

; 239  :     }
; 240  : 
; 241  :     return ((WORD)bReason);
; 242  : }

  00048	e8bd4010	 ldmia       sp!, {r4, lr}
  0004c	e12fff1e	 bx          lr
  00050		 |$M32471|

			 ENDP  ; |?CheckIntrState@CDisk@@QAAGXZ|, CDisk::CheckIntrState

	EXPORT	|?ReadBuffer@CDisk@@QAAXPAEK@Z|		; CDisk::ReadBuffer
; File d:\wince500\platform\smdk2440\drivers\atapi\diskmain.h

  00000			 AREA	 |.text| { |?ReadBuffer@CDisk@@QAAXPAEK@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000			 AREA	 |.pdata$$?ReadBuffer@CDisk@@QAAXPAEK@Z|, PDATA, SELECTION=5, ASSOC=|.text| { |?ReadBuffer@CDisk@@QAAXPAEK@Z| } ; comdat associative
|$T32503| DCD	|$L32502|
	DCD	0x40005f04
; Function compile flags: /Ogsy
; File d:\wince500\platform\smdk2440\drivers\atapi\atapiio.cpp

  00000			 AREA	 |.text| { |?ReadBuffer@CDisk@@QAAXPAEK@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000		 |?ReadBuffer@CDisk@@QAAXPAEK@Z| PROC	; CDisk::ReadBuffer

; 258  : {

  00000		 |$L32502|
  00000	e1a0c00d	 mov         r12, sp
  00004	e92d000f	 stmdb       sp!, {r0 - r3}
  00008	e92d51f0	 stmdb       sp!, {r4 - r8, r12, lr}
  0000c	e24dd014	 sub         sp, sp, #0x14
  00010		 |$M32500|
  00010	e1a0e002	 mov         lr, r2
  00014	e58de038	 str         lr, [sp, #0x38]
  00018	e1a04001	 mov         r4, r1
  0001c	e1a05000	 mov         r5, r0

; 259  :     union {
; 260  :         WORD us;
; 261  :         BYTE  uc[2];
; 262  :     } unisc;
; 263  : 
; 264  :     if (ZONE_CELOG) CeLogData(TRUE, CELID_ATAPI_STARTREADBUFFER, &dwCount, sizeof(dwCount), 0, CELZONE_ALWAYSON, 0, FALSE);

  00020	e59f6150	 ldr         r6, [pc, #0x150]
  00024	e3a07000	 mov         r7, #0
  00028	e3a08101	 mov         r8, #1, 2
  0002c	e5963440	 ldr         r3, [r6, #0x440]
  00030	e3130902	 tst         r3, #2, 18
  00034	0a00000a	 beq         |$L32056|
  00038	e3a01d86	 mov         r1, #0x86, 26
  0003c	e3811009	 orr         r1, r1, #9
  00040	e3a03004	 mov         r3, #4
  00044	e28d2038	 add         r2, sp, #0x38
  00048	e3a00001	 mov         r0, #1
  0004c	e58d700c	 str         r7, [sp, #0xC]
  00050	e58d7008	 str         r7, [sp, #8]
  00054	e58d8004	 str         r8, [sp, #4]
  00058	e58d7000	 str         r7, [sp]
  0005c	eb000000	 bl          CeLogData
  00060	e59de038	 ldr         lr, [sp, #0x38]
  00064		 |$L32056|

; 265  : 
; 266  :     if (dwCount == 0) {

  00064	e35e0000	 cmp         lr, #0
  00068	0a000030	 beq         |$L32075|

; 267  :         return;
; 268  :     }
; 269  : 
; 270  :     // determine whether required byte was read in previous read;
; 271  :     // m_wNextByte=(-1) implies byte not read in previous read
; 272  : 
; 273  :     if (m_wNextByte != 0xFFFF) {

  0006c	e1d525b0	 ldrh        r2, [r5, #0x50]
  00070	e3a03cff	 mov         r3, #0xFF, 24
  00074	e38330ff	 orr         r3, r3, #0xFF
  00078	e1520003	 cmp         r2, r3

; 274  :         DEBUGMSG(ZONE_WARNING, (TEXT("Atapi!CDisk::ReadBuffer> Unaligned buffer on prevous read\r\n")));
; 275  :         // update first byte
; 276  :         *pBuffer++ = (BYTE)m_wNextByte;
; 277  :         dwCount--;

  0007c	14c42001	 strneb      r2, [r4], #1
  00080	124ee001	 subne       lr, lr, #1
  00084	158de038	 strne       lr, [sp, #0x38]

; 278  :     }
; 279  : 
; 280  :     // check alignment of pBuffer
; 281  : 
; 282  :     if ((DWORD)pBuffer & 1) {

  00088	e3140001	 tst         r4, #1
  0008c	1a000036	 bne         |$L32499|

; 292  :         ReadWordBuffer((PWORD)pBuffer,(DWORD)(dwCount)/sizeof(SHORT));

  00090	e5950030	 ldr         r0, [r5, #0x30]
  00094	e5953008	 ldr         r3, [r5, #8]
  00098	e1a020ae	 mov         r2, lr, lsr #1
  0009c	e1a01004	 mov         r1, r4
  000a0	e0800003	 add         r0, r0, r3
  000a4	eb000000	 bl          READ_PORT_BUFFER_USHORT

; 293  :         pBuffer += dwCount;

  000a8	e59d3038	 ldr         r3, [sp, #0x38]
  000ac	e0842003	 add         r2, r4, r3

; 294  :         dwCount &= 1;       // if 1, we need to read the next byte still

  000b0	e203e001	 and         lr, r3, #1
  000b4	e58de038	 str         lr, [sp, #0x38]

; 295  :         pBuffer -= dwCount; // adjust pBuffer if its address is odd

  000b8	e042400e	 sub         r4, r2, lr
  000bc		 |$L32067|

; 296  :     }
; 297  : 
; 298  :     // read one word even if we only need one byte; save the unused byte and
; 299  :     // use it as the first byte of the next read (scatter/gather buffer)
; 300  : 
; 301  :     if (dwCount == 1) {

  000bc	e35e0001	 cmp         lr, #1
  000c0	1a000008	 bne         |$L32071|

; 302  :         DEBUGMSG(ZONE_WARNING, (TEXT("Atapi!CDisk::ReadBuffer> Reading word for one byte\r\n")));
; 303  :         unisc.us = ReadWord();

  000c4	e5952030	 ldr         r2, [r5, #0x30]
  000c8	e5953008	 ldr         r3, [r5, #8]
  000cc	e0820003	 add         r0, r2, r3
  000d0	eb000000	 bl          READ_PORT_USHORT
  000d4	e1cd01b2	 strh        r0, [sp, #0x12]

; 304  :         *pBuffer=   unisc.uc[0];

  000d8	e5dd3012	 ldrb        r3, [sp, #0x12]

; 305  :         m_wNextByte = (WORD)unisc.uc[1]; // save the second byte

  000dc	e5dd2013	 ldrb        r2, [sp, #0x13]
  000e0	e5c43000	 strb        r3, [r4]
  000e4	e1c525b0	 strh        r2, [r5, #0x50]
  000e8		 |$L32071|

; 306  :     }
; 307  : 
; 308  :     BYTE bStatus = GetAltStatus();

  000e8	e5952034	 ldr         r2, [r5, #0x34]
  000ec	e5953028	 ldr         r3, [r5, #0x28]
  000f0	e0820003	 add         r0, r2, r3
  000f4	eb000000	 bl          READ_PORT_UCHAR

; 309  : 
; 310  :     if (ZONE_CELOG) CeLogData(TRUE, CELID_ATAPI_COMPLETEREADBUFFER, &bStatus, sizeof(bStatus), 0, CELZONE_ALWAYSON, 0, FALSE);

  000f8	e5963440	 ldr         r3, [r6, #0x440]
  000fc	e5cd0010	 strb        r0, [sp, #0x10]
  00100	e3130902	 tst         r3, #2, 18
  00104	0a000009	 beq         |$L32075|
  00108	e3a01d86	 mov         r1, #0x86, 26
  0010c	e381100a	 orr         r1, r1, #0xA
  00110	e3a03001	 mov         r3, #1
  00114	e28d2010	 add         r2, sp, #0x10
  00118	e3a00001	 mov         r0, #1
  0011c	e58d700c	 str         r7, [sp, #0xC]
  00120	e58d7008	 str         r7, [sp, #8]
  00124	e58d8004	 str         r8, [sp, #4]
  00128	e58d7000	 str         r7, [sp]
  0012c	eb000000	 bl          CeLogData
  00130		 |$L32075|

; 311  : }

  00130	e28dd014	 add         sp, sp, #0x14
  00134	e89d61f0	 ldmia       sp, {r4 - r8, sp, lr}
  00138	e12fff1e	 bx          lr
  0013c		 |$L32065|

; 283  :         DEBUGMSG(ZONE_WARNING, (TEXT("Atapi!CDisk::ReadBuffer> Unaligned buffer\r\n")));
; 284  :         while (dwCount> 1) {
; 285  :             unisc.us = ReadWord();

  0013c	e5952030	 ldr         r2, [r5, #0x30]
  00140	e5953008	 ldr         r3, [r5, #8]
  00144	e0820003	 add         r0, r2, r3
  00148	eb000000	 bl          READ_PORT_USHORT
  0014c	e1cd01b2	 strh        r0, [sp, #0x12]

; 286  :             *pBuffer++= unisc.uc[0];
; 287  :             *pBuffer++= unisc.uc[1];
; 288  :             dwCount-=2;

  00150	e59d3038	 ldr         r3, [sp, #0x38]
  00154	e5dd2012	 ldrb        r2, [sp, #0x12]
  00158	e5dd1013	 ldrb        r1, [sp, #0x13]
  0015c	e243e002	 sub         lr, r3, #2
  00160	e4c42001	 strb        r2, [r4], #1
  00164	e58de038	 str         lr, [sp, #0x38]
  00168	e4c41001	 strb        r1, [r4], #1
  0016c		 |$L32499|
  0016c	e35e0001	 cmp         lr, #1
  00170	8afffff1	 bhi         |$L32065|

; 289  :         }
; 290  :     }
; 291  :     else {

  00174	eaffffd0	 b           |$L32067|
  00178		 |$L32505|
  00178	00000000	 DCD         |?dpCurSettings@@3U_DBGPARAM@@A|
  0017c		 |$M32501|

			 ENDP  ; |?ReadBuffer@CDisk@@QAAXPAEK@Z|, CDisk::ReadBuffer

	EXPORT	|?WriteBuffer@CDisk@@QAAXPAEK@Z|	; CDisk::WriteBuffer
; File d:\wince500\platform\smdk2440\drivers\atapi\diskmain.h

  00000			 AREA	 |.text| { |?WriteBuffer@CDisk@@QAAXPAEK@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000			 AREA	 |.pdata$$?WriteBuffer@CDisk@@QAAXPAEK@Z|, PDATA, SELECTION=5, ASSOC=|.text| { |?WriteBuffer@CDisk@@QAAXPAEK@Z| } ; comdat associative
|$T32534| DCD	|$L32533|
	DCD	0x40006004
; Function compile flags: /Ogsy
; File d:\wince500\platform\smdk2440\drivers\atapi\atapiio.cpp

  00000			 AREA	 |.text| { |?WriteBuffer@CDisk@@QAAXPAEK@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000		 |?WriteBuffer@CDisk@@QAAXPAEK@Z| PROC	; CDisk::WriteBuffer

; 327  : {

  00000		 |$L32533|
  00000	e1a0c00d	 mov         r12, sp
  00004	e92d000f	 stmdb       sp!, {r0 - r3}
  00008	e92d51f0	 stmdb       sp!, {r4 - r8, r12, lr}
  0000c	e24dd014	 sub         sp, sp, #0x14
  00010		 |$M32531|
  00010	e1a0e002	 mov         lr, r2
  00014	e58de038	 str         lr, [sp, #0x38]
  00018	e1a05001	 mov         r5, r1
  0001c	e1a04000	 mov         r4, r0

; 328  :     union {
; 329  :         WORD us;
; 330  :         BYTE  uc[2];
; 331  :     } unisc;
; 332  : 
; 333  :     if (ZONE_CELOG) CeLogData(TRUE, CELID_ATAPI_STARTWRITEBUFFER, &dwCount, sizeof(dwCount), 0, CELZONE_ALWAYSON, 0, FALSE);

  00020	e59f6154	 ldr         r6, [pc, #0x154]
  00024	e3a07000	 mov         r7, #0
  00028	e3a08101	 mov         r8, #1, 2
  0002c	e5963440	 ldr         r3, [r6, #0x440]
  00030	e3130902	 tst         r3, #2, 18
  00034	0a00000a	 beq         |$L32091|
  00038	e3a01d86	 mov         r1, #0x86, 26
  0003c	e381100b	 orr         r1, r1, #0xB
  00040	e3a03004	 mov         r3, #4
  00044	e28d2038	 add         r2, sp, #0x38
  00048	e3a00001	 mov         r0, #1
  0004c	e58d700c	 str         r7, [sp, #0xC]
  00050	e58d7008	 str         r7, [sp, #8]
  00054	e58d8004	 str         r8, [sp, #4]
  00058	e58d7000	 str         r7, [sp]
  0005c	eb000000	 bl          CeLogData
  00060	e59de038	 ldr         lr, [sp, #0x38]
  00064		 |$L32091|

; 334  : 
; 335  :     if (dwCount == 0) {

  00064	e35e0000	 cmp         lr, #0
  00068	0a000031	 beq         |$L32110|

; 336  :         return;
; 337  :     }
; 338  : 
; 339  :     // determine whether required byte was written in previous write;
; 340  :     // m_wNextByte=(-1) implies byte not written in previous write
; 341  : 
; 342  :     if (m_wNextByte != 0xFFFF) {

  0006c	e1d425b0	 ldrh        r2, [r4, #0x50]
  00070	e3a03cff	 mov         r3, #0xFF, 24
  00074	e38330ff	 orr         r3, r3, #0xFF
  00078	e1520003	 cmp         r2, r3
  0007c	0a00000a	 beq         |$L32510|

; 343  :         // update first byte
; 344  :         DEBUGMSG(ZONE_WARNING, (TEXT("Atapi!CDisk::WriteBuffer> Unaligned buffer on previous write\r\n")));
; 345  :         unisc.uc[0] = (BYTE) m_wNextByte;
; 346  :         unisc.uc[1] = *pBuffer++;

  00080	e4d53001	 ldrb        r3, [r5], #1

; 347  :         dwCount--; 
; 348  :         WriteWord(unisc.us);

  00084	e5940030	 ldr         r0, [r4, #0x30]
  00088	e5cd2012	 strb        r2, [sp, #0x12]
  0008c	e5942008	 ldr         r2, [r4, #8]
  00090	e5cd3013	 strb        r3, [sp, #0x13]
  00094	e24e3001	 sub         r3, lr, #1
  00098	e1dd11b2	 ldrh        r1, [sp, #0x12]
  0009c	e0800002	 add         r0, r0, r2
  000a0	e58d3038	 str         r3, [sp, #0x38]
  000a4	eb000000	 bl          WRITE_PORT_USHORT
  000a8	e59de038	 ldr         lr, [sp, #0x38]
  000ac		 |$L32510|

; 349  :     }
; 350  : 
; 351  :     // check alignment of pBuffer
; 352  : 
; 353  :     if ((DWORD) pBuffer & 1) {

  000ac	e3150001	 tst         r5, #1
  000b0	1a00002e	 bne         |$L32530|

; 363  :         WriteWordBuffer((PWORD)pBuffer,(DWORD)(dwCount)/sizeof(SHORT));

  000b4	e5940030	 ldr         r0, [r4, #0x30]
  000b8	e5943008	 ldr         r3, [r4, #8]
  000bc	e1a020ae	 mov         r2, lr, lsr #1
  000c0	e1a01005	 mov         r1, r5
  000c4	e0800003	 add         r0, r0, r3
  000c8	eb000000	 bl          WRITE_PORT_BUFFER_USHORT

; 364  :         pBuffer += dwCount;

  000cc	e59d3038	 ldr         r3, [sp, #0x38]
  000d0	e0852003	 add         r2, r5, r3

; 365  :         dwCount &= 1;       // if 1, we need to write the next byte still

  000d4	e203e001	 and         lr, r3, #1
  000d8	e58de038	 str         lr, [sp, #0x38]

; 366  :         pBuffer -= dwCount; // adjust pBuffer if its address is odd

  000dc	e042500e	 sub         r5, r2, lr
  000e0		 |$L32102|

; 367  : 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -