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

📄 atapipci.cod

📁 windows CE 的BSP开发包.包含众多的驱动程序和OAL层的开发代码
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 366  : 
; 367  :     return TRUE;

  00080	e3a00001	 mov         r0, #1

; 368  : }

  00084	e8bd4010	 ldmia       sp!, {r4, lr}
  00088	e12fff1e	 bx          lr
  0008c		 |$M32574|

			 ENDP  ; |?ConfigPort@CPCIDisk@@UAAHXZ|, CPCIDisk::ConfigPort

	EXPORT	|?TranslateAddress@CPCIDisk@@QAAHPAK@Z|	; CPCIDisk::TranslateAddress
	IMPORT	|HalTranslateSystemAddress|

  00000			 AREA	 |.text| { |?TranslateAddress@CPCIDisk@@QAAHPAK@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000			 AREA	 |.pdata$$?TranslateAddress@CPCIDisk@@QAAHPAK@Z|, PDATA, SELECTION=5, ASSOC=|.text| { |?TranslateAddress@CPCIDisk@@QAAHPAK@Z| } ; comdat associative
|$T32590| DCD	|$L32589|
	DCD	0x40001402
; Function compile flags: /Ogsy

  00000			 AREA	 |.text| { |?TranslateAddress@CPCIDisk@@QAAHPAK@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000		 |?TranslateAddress@CPCIDisk@@QAAHPAK@Z| PROC ; CPCIDisk::TranslateAddress

; 382  : {

  00000		 |$L32589|
  00000	e92d4030	 stmdb       sp!, {r4, r5, lr}
  00004	e24dd00c	 sub         sp, sp, #0xC
  00008		 |$M32587|
  00008	e1a05001	 mov         r5, r1

; 383  :     // translate a system address to a bus address for the DMA bus controller
; 384  : 
; 385  :     PHYSICAL_ADDRESS SystemLogicalAddress, TransLogicalAddress;
; 386  :     DWORD dwBus;
; 387  : 
; 388  :     // fetch bus number/type
; 389  :     // if (m_pPort->m_pCNTRL != NULL) {
; 390  :     //     dwBus = m_pPort->m_pCNTRL->m_dwBus;
; 391  :     // }
; 392  :     // else {
; 393  :     //     dwBus = 0;
; 394  :     // }
; 395  : 
; 396  :     dwBus = m_pPort->m_pController->m_dwi.dwBusNumber;

  0000c	e590303c	 ldr         r3, [r0, #0x3C]

; 397  : 
; 398  :     // translate address
; 399  :     SystemLogicalAddress.HighPart = 0;
; 400  :     SystemLogicalAddress.LowPart = *pdwAddr;

  00010	e5952000	 ldr         r2, [r5]

; 401  :     if (!HalTranslateSystemAddress(PCIBus, dwBus, SystemLogicalAddress, &TransLogicalAddress)) {

  00014	e28d4004	 add         r4, sp, #4
  00018	e593e000	 ldr         lr, [r3]
  0001c	e3a03000	 mov         r3, #0
  00020	e3a00005	 mov         r0, #5
  00024	e59e1024	 ldr         r1, [lr, #0x24]
  00028	e58d4000	 str         r4, [sp]
  0002c	eb000000	 bl          HalTranslateSystemAddress
  00030	e3500000	 cmp         r0, #0

; 402  :         return FALSE;
; 403  :     }
; 404  : 
; 405  :     *pdwAddr = TransLogicalAddress.LowPart;

  00034	159d3004	 ldrne       r3, [sp, #4]
  00038	03a00000	 moveq       r0, #0

; 406  : 
; 407  :     return TRUE;

  0003c	13a00001	 movne       r0, #1
  00040	15853000	 strne       r3, [r5]

; 408  : }

  00044	e28dd00c	 add         sp, sp, #0xC
  00048	e8bd4030	 ldmia       sp!, {r4, r5, lr}
  0004c	e12fff1e	 bx          lr
  00050		 |$M32588|

			 ENDP  ; |?TranslateAddress@CPCIDisk@@QAAHPAK@Z|, CPCIDisk::TranslateAddress

	IMPORT	|HalAllocateCommonBuffer|
	IMPORT	|MapCallerPtr|
	IMPORT	|LockPages|
	IMPORT	|memcpy|
; File d:\wince500\platform\smdk2440\drivers\atapi\atapipci.h

  00000			 AREA	 |.text| { |?SetupDMA@CPCIDisk@@UAAHPAU_SG_BUF@@KH@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000			 AREA	 |.pdata$$?SetupDMA@CPCIDisk@@UAAHPAU_SG_BUF@@KH@Z|, PDATA, SELECTION=5, ASSOC=|.text| { |?SetupDMA@CPCIDisk@@UAAHPAU_SG_BUF@@KH@Z| } ; comdat associative
|$T32647| DCD	|$L32646|
	DCD	0x40015c02
; Function compile flags: /Ogsy
; File d:\wince500\platform\smdk2440\drivers\atapi\atapipci.cpp

  00000			 AREA	 |.text| { |?SetupDMA@CPCIDisk@@UAAHPAU_SG_BUF@@KH@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000		 |?SetupDMA@CPCIDisk@@UAAHPAU_SG_BUF@@KH@Z| PROC ; CPCIDisk::SetupDMA

; 426  : {

  00000		 |$L32646|
  00000	e92d4ff0	 stmdb       sp!, {r4 - r11, lr}
  00004	e24dd02c	 sub         sp, sp, #0x2C
  00008		 |$M32644|
  00008	e1a0a002	 mov         r10, r2
  0000c	e58da004	 str         r10, [sp, #4]
  00010	e58d3008	 str         r3, [sp, #8]
  00014	e1a08001	 mov         r8, r1
  00018	e1a07000	 mov         r7, r0

; 427  :     DWORD dwAlignMask = m_dwDMAAlign - 1;
; 428  :     DWORD dwPageMask = UserKInfo[KINX_PAGESIZE] - 1;
; 429  : 
; 430  :     DWORD iPage = 0, iPFN, iBuffer;
; 431  :     BOOL fUnalign = FALSE;
; 432  : 
; 433  :     DMA_ADAPTER_OBJECT Adapter;
; 434  : 
; 435  :     Adapter.ObjectSize = sizeof(DMA_ADAPTER_OBJECT);
; 436  :     Adapter.InterfaceType = (INTERFACE_TYPE)m_pPort->m_pController->m_dwi.dwInterfaceType;

  0001c	e3a09004	 mov         r9, #4
  00020	e597603c	 ldr         r6, [r7, #0x3C]
  00024	e2499c35	 sub         r9, r9, #0x35, 24
  00028	e5995000	 ldr         r5, [r9]
  0002c	e3a0300c	 mov         r3, #0xC
  00030	e1cd32b0	 strh        r3, [sp, #0x20]
  00034	e596e000	 ldr         lr, [r6]
  00038	e5974048	 ldr         r4, [r7, #0x48]

; 437  :     Adapter.BusNumber = m_pPort->m_pController->m_dwi.dwBusNumber;
; 438  : 
; 439  :     DEBUGMSG(ZONE_DMA, (_T(
; 440  :         "Atapi!CPCIDisk::SetupDMA> Request(%s), SgCount(%d)\r\n"
; 441  :         ), fRead ? (_T("Read")) : (_T("Write")), dwSgCount));
; 442  : 
; 443  :     // disable bus master
; 444  :     WriteBMCommand(0);

  0003c	e597076c	 ldr         r0, [r7, #0x76C]
  00040	e59ee028	 ldr         lr, [lr, #0x28]
  00044	e2453001	 sub         r3, r5, #1
  00048	e58d3018	 str         r3, [sp, #0x18]
  0004c	e58de024	 str         lr, [sp, #0x24]
  00050	e596e000	 ldr         lr, [r6]
  00054	e3a03000	 mov         r3, #0
  00058	e3a01000	 mov         r1, #0
  0005c	e59ee024	 ldr         lr, [lr, #0x24]
  00060	e244b001	 sub         r11, r4, #1
  00064	e58d3000	 str         r3, [sp]
  00068	e58de028	 str         lr, [sp, #0x28]
  0006c	eb000000	 bl          WRITE_PORT_UCHAR

; 445  : 
; 446  :     if (!m_pPRD) {

  00070	e597e74c	 ldr         lr, [r7, #0x74C]
  00074	e35e0000	 cmp         lr, #0
  00078	1a000007	 bne         |$L32137|

; 447  :         m_pPRD = (PDMATable)HalAllocateCommonBuffer(&Adapter,
; 448  :             UserKInfo[KINX_PAGESIZE], (PPHYSICAL_ADDRESS)&m_pPRDPhys, FALSE);

  0007c	e5991000	 ldr         r1, [r9]
  00080	e3a03000	 mov         r3, #0
  00084	e2872e76	 add         r2, r7, #0x76, 28
  00088	e28d0020	 add         r0, sp, #0x20
  0008c	eb000000	 bl          HalAllocateCommonBuffer
  00090	e3500000	 cmp         r0, #0
  00094	e587074c	 str         r0, [r7, #0x74C]

; 449  :         if (!m_pPRD) {

  00098	0a000132	 beq         |$ExitFailure$32138|
  0009c		 |$L32137|

; 450  :             goto ExitFailure;
; 451  :         }
; 452  :     }
; 453  : 
; 454  :     // m_pPhysList tracks pages used for DMA buffers when the scatter/gather
; 455  :     // buffer is unaligned
; 456  :     if (!m_pPhysList) {

  0009c	e5973750	 ldr         r3, [r7, #0x750]
  000a0	e3530000	 cmp         r3, #0
  000a4	1a00001e	 bne         |$L32149|

; 457  :         m_pPhysList = (PPhysTable)VirtualAlloc(m_pStartMemory, UserKInfo[KINX_PAGESIZE], MEM_COMMIT, PAGE_READWRITE);

  000a8	e5991000	 ldr         r1, [r9]
  000ac	e5970748	 ldr         r0, [r7, #0x748]
  000b0	e3a03004	 mov         r3, #4
  000b4	e3a02a01	 mov         r2, #1, 20
  000b8	eb000000	 bl          VirtualAlloc
  000bc	e3500000	 cmp         r0, #0
  000c0	e5870750	 str         r0, [r7, #0x750]

; 458  :         if (!m_pPhysList) {

  000c4	0a000127	 beq         |$ExitFailure$32138|

; 459  :             goto ExitFailure;
; 460  :         }
; 461  :         // allocate the minimum number of fixed pages
; 462  :         for (DWORD i = 0; i < MIN_PHYS_PAGES; i++) {

  000c8	e3a04000	 mov         r4, #0
  000cc	e3a05000	 mov         r5, #0
  000d0	e3a06000	 mov         r6, #0
  000d4		 |$L32147|

; 463  :             PHYSICAL_ADDRESS PhysicalAddress = {0};

  000d4	e58d5010	 str         r5, [sp, #0x10]
  000d8	e58d6014	 str         r6, [sp, #0x14]

; 464  :             m_pPhysList[i].pVirtualAddress = (LPBYTE)HalAllocateCommonBuffer(&Adapter,
; 465  :                 UserKInfo[KINX_PAGESIZE], &PhysicalAddress, FALSE);

  000dc	e5991000	 ldr         r1, [r9]
  000e0	e3a03000	 mov         r3, #0
  000e4	e28d2010	 add         r2, sp, #0x10
  000e8	e28d0020	 add         r0, sp, #0x20
  000ec	eb000000	 bl          HalAllocateCommonBuffer
  000f0	e5973750	 ldr         r3, [r7, #0x750]
  000f4	e7840003	 str         r0, [r4, +r3]

; 466  :             m_pPhysList[i].pPhysicalAddress = (LPBYTE)PhysicalAddress.QuadPart;

  000f8	e5973750	 ldr         r3, [r7, #0x750]
  000fc	e59d2010	 ldr         r2, [sp, #0x10]
  00100	e0843003	 add         r3, r4, r3
  00104	e5832004	 str         r2, [r3, #4]

; 467  :             if (!m_pPhysList[i].pVirtualAddress) {

  00108	e5973750	 ldr         r3, [r7, #0x750]
  0010c	e7943003	 ldr         r3, [r4, +r3]
  00110	e3530000	 cmp         r3, #0
  00114	0a000113	 beq         |$ExitFailure$32138|
  00118	e2844008	 add         r4, r4, #8
  0011c	e3540020	 cmp         r4, #0x20
  00120	3affffeb	 bcc         |$L32147|
  00124		 |$L32149|

; 468  :                 goto ExitFailure;
; 469  :             }
; 470  :         }
; 471  :     }
; 472  :     m_dwPhysCount = 0;
; 473  : 
; 474  :     // m_pSGCopy tracks the mapping between scatter/gather buffers and DMA
; 475  :     // buffers when the scatter/gather buffer is unaligned and we are reading,
; 476  :     // so we can copy the read data back to the scatter/gather buffer; when the
; 477  :     // scatter/gather buffer is aligned, m_pSGCopy tracks the scatter/gather
; 478  :     // buffers of a particular DMA transfer, so we can unlock the buffers at
; 479  :     // completion
; 480  : 
; 481  :     if (!m_pSGCopy) {

  00124	e5973754	 ldr         r3, [r7, #0x754]
  00128	e3a04000	 mov         r4, #0
  0012c	e5874764	 str         r4, [r7, #0x764]
  00130	e3530000	 cmp         r3, #0
  00134	1a000009	 bne         |$L32163|

; 482  :         m_pSGCopy = (PSGCopyTable)VirtualAlloc(
; 483  :             m_pStartMemory + UserKInfo[KINX_PAGESIZE],
; 484  :             UserKInfo[KINX_PAGESIZE],
; 485  :             MEM_COMMIT,
; 486  :             PAGE_READWRITE);

  00138	e5990000	 ldr         r0, [r9]
  0013c	e5972748	 ldr         r2, [r7, #0x748]
  00140	e3a03004	 mov         r3, #4
  00144	e1a01000	 mov         r1, r0
  00148	e0800002	 add         r0, r0, r2
  0014c	e3a02a01	 mov         r2, #1, 20
  00150	eb000000	 bl          VirtualAlloc
  00154	e3500000	 cmp         r0, #0
  00158	e5870754	 str         r0, [r7, #0x754]

; 487  :         if (!m_pSGCopy) {

  0015c	0a000101	 beq         |$ExitFailure$32138|
  00160		 |$L32163|

; 488  :             goto ExitFailure;
; 489  :         }
; 490  :     }
; 491  :     m_dwSGCount = 0;
; 492  : 
; 493  :     if (!m_pPFNs) {

  00160	e5973758	 ldr         r3, [r7, #0x758]
  00164	e587475c	 str         r4, [r7, #0x75C]
  00168	e3530000	 cmp         r3, #0
  0016c	1a000009	 bne         |$L32171|

; 494  :         m_pPFNs = (PDWORD)VirtualAlloc(
; 495  :             m_pStartMemory + 2*UserKInfo[KINX_PAGESIZE],
; 496  :             UserKInfo[KINX_PAGESIZE],
; 497  :             MEM_COMMIT,
; 498  :             PAGE_READWRITE);

  00170	e5990000	 ldr         r0, [r9]
  00174	e5972748	 ldr         r2, [r7, #0x748]
  00178	e3a03004	 mov         r3, #4
  0017c	e1a01000	 mov         r1, r0
  00180	e0820080	 add         r0, r2, r0, lsl #1
  00184	e3a02a01	 mov         r2, #1, 20
  00188	eb000000	 bl          VirtualAlloc
  0018c	e3500000	 cmp         r0, #0
  00190	e5870758	 str         r0, [r7, #0x758]

; 499  :         if (!m_pPFNs) {

  00194	0a0000f3	 beq         |$ExitFailure$32138|
  00198		 |$L32171|

; 500  :             goto ExitFailure;
; 501  :         }
; 502  :     }
; 503  : 
; 504  :     // determine whether the a buffer or the buffer length is unaligned
; 505  :     for (iBuffer = 0; iBuffer < dwSgCount; iBuffer++) {

  00198	e3a01000	 mov         r1, #0
  0019c	e35a0000	 cmp         r10, #0
  001a0	0a00000a	 beq         |$L32180|
  001a4	e1a02008	 mov         r2, r8
  001a8		 |$L32173|

; 506  :         if (
; 507  :             ((DWORD)pSgBuf[iBuffer].sb_buf & dwAlignMask) ||
; 508  :             ((DWORD)pSgBuf[iBuffer].sb_len & dwAlignMask)
; 509  :         ) {

  001a8	e5923000	 ldr         r3, [r2]
  001ac	e113000b	 tst         r3, r11
  001b0	1a00001b	 bne         |$L32610|
  001b4	e5923004	 ldr         r3, [r2, #4]
  001b8	e113000b	 tst         r3, r11
  001bc	1a000018	 bne         |$L32610|
  001c0	e2811001	 add         r1, r1, #1
  001c4	e151000a	 cmp         r1, r10
  001c8	e2822008	 add         r2, r2, #8
  001cc	3afffff5	 bcc         |$L32173|
  001d0		 |$L32180|

; 593  : 
; 594  :         DWORD dwTotalBytes = 0;
; 595  : 
; 596  :         for (iBuffer = 0; iBuffer < dwSgCount; iBuffer++) {

  001d0	e59d3004	 ldr         r3, [sp, #4]
  001d4	e3a0a000	 mov         r10, #0
  001d8	e3530000	 cmp         r3, #0

⌨️ 快捷键说明

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