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

📄 mmcoem.cod

📁 ARM读写SD卡程序
💻 COD
📖 第 1 页 / 共 4 页
字号:
; Listing generated by Microsoft (R) Optimizing Compiler Version 12.20.9615 

	TTL	c:\wince420\platform\sdklh7a404\drivers\sdmmc\driver\.\mmcoem.c
	CODE32

  00000			 AREA	 |.drectve|, DRECTVE
	DCB	"-defaultlib:coredll.lib "
	DCB	"-defaultlib:corelibc.lib "

	EXPORT	|portAddress| [ DATA ]
	EXPORT	|driveSave| [ DATA ]
	EXPORT	|gSDMMCGpioRegPtr| [ DATA ]
	EXPORT	|gSDMMCRegPtr| [ DATA ]

  00000			 AREA	 |.bss|, NOINIT
|portAddress| %	0x4
|driveSave| %	0x2
|gSDMMCGpioRegPtr| % 0x4
|gSDMMCRegPtr| % 0x4
|noController| % 0x2

  00000			 AREA	 |.data|, DATA
	 COMMON	|multipleRdWr|, 0x2

|IntrEOI| DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700c0c
	DCD	0x1
	DCD	0x88700c2c
	DCD	0x1
	DCD	0x88700098
	DCD	0x2
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700e54
	DCD	0x1
	DCD	0x88700e54
	DCD	0x2
	DCD	0x88700e54
	DCD	0x4
	DCD	0x88700e54
	DCD	0x8
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700410
	DCD	0x1
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700414
	DCD	0x1
	DCD	0x88700418
	DCD	0x1
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700d10
	DCD	0x1
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700e54
	DCD	0x10
	DCD	0x88700e54
	DCD	0x20
	DCD	0x88700e54
	DCD	0x40
	DCD	0x88700e54
	DCD	0x80
	DCD	0x88700c8c
	DCD	0x1
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700b08
	DCD	0x1
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff
	DCD	0x88700000
	DCD	0xffffffff

  00000			 AREA	 |.rdata|, DATA, READONLY
|EdbgVendorIds| DCW 0x0
	DCW	0x0
	DCD	0x4033
	DCB	0x1
	DCB	"AD", 0x0
	DCW	0x1050
	DCW	0x940
	DCD	0x4005
	DCB	0x1
	DCB	"LS", 0x0
	DCW	0x1050
	DCW	0x940
	DCD	0x2078
	DCB	0x1
	DCB	"LS", 0x0
	DCW	0x10ec
	DCW	0x8029
	DCD	0xc0f0
	DCB	0x1
	DCB	"KS", 0x0
	DCW	0x10ec
	DCW	0x8129
	DCD	0x0
	DCB	0x4
	DCB	"RT", 0x0
	DCW	0x10ec
	DCW	0x8139
	DCD	0x900b
	DCB	0x4
	DCB	"RT", 0x0
	DCW	0x10ec
	DCW	0x8139
	DCD	0xd0c9
	DCB	0x4
	DCB	"RT", 0x0
	DCW	0x10ec
	DCW	0x8139
	DCD	0xe04c
	DCB	0x4
	DCB	"RT", 0x0
	DCW	0x1186
	DCW	0x1300
	DCD	0x50ba
	DCB	0x4
	DCB	"DL", 0x0
	DCW	0x100b
	DCW	0x20
	DCD	0xa0cc
	DCB	0x5
	DCB	"NG", 0x0
	DCW	0x10b7
	DCW	0x9050
	DCD	0x6008
	DCB	0x6
	DCB	"3C", 0x0
	DCW	0x10b7
	DCW	0x9200
	DCD	0x476
	DCB	0x6
	DCB	"3C", 0x0
	EXPORT	|MMCSelectController|
; File c:\wince420\platform\sdklh7a404\drivers\sdmmc\driver\mmcoem.c

  00000			 AREA	 |.text| { |MMCSelectController| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000			 AREA	 |.pdata$$MMCSelectController|, PDATA, SELECTION=5, ASSOC=|.text| { |MMCSelectController| } ; comdat associative
|$T41445| DCD	|MMCSelectController|
	DCD	0x40000100
; Function compile flags: /Ogsy

  00000			 AREA	 |.text| { |MMCSelectController| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000		 |MMCSelectController| PROC

; 95   : {

  00000		 |$M41443|

; 96   :   
; 108  : 	return;
; 109  : }

  00000	e12fff1e	 bx        lr
  00004		 |$M41444|

			 ENDP  ; |MMCSelectController|

	EXPORT	|mmc_hw_init|
	EXPORT	|??_C@_1DC@GNNN@?$AAm?$AAm?$AAc?$AA_?$AAh?$AAw?$AA_?$AAi?$AAn?$AAi?$AAt?$AA?5?$AAi?$AAs?$AA?5?$AAe?$AAn?$AAt?$AAe?$AAr@| [ DATA ] ; `string'
	EXPORT	|??_C@_1CO@GFCE@?$AAF?$AAi?$AAn?$AAi?$AAs?$AAh?$AAe?$AAd?$AA?5?$AAm?$AAm?$AAc?$AA_?$AAh?$AAw?$AA_?$AAi?$AAn?$AAi?$AAt@| [ DATA ] ; `string'
	IMPORT	|CreateEventW|
	IMPORT	|NKDbgPrintfW|
	IMPORT	|MmMapIoSpace|

  00000			 AREA	 |.text| { |mmc_hw_init| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000			 AREA	 |.pdata$$mmc_hw_init|, PDATA, SELECTION=5, ASSOC=|.text| { |mmc_hw_init| } ; comdat associative
|$T41456| DCD	|mmc_hw_init|
	DCD	0x40003501

  00000			 AREA	 |.rdata| { |??_C@_1DC@GNNN@?$AAm?$AAm?$AAc?$AA_?$AAh?$AAw?$AA_?$AAi?$AAn?$AAi?$AAt?$AA?5?$AAi?$AAs?$AA?5?$AAe?$AAn?$AAt?$AAe?$AAr@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_1DC@GNNN@?$AAm?$AAm?$AAc?$AA_?$AAh?$AAw?$AA_?$AAi?$AAn?$AAi?$AAt?$AA?5?$AAi?$AAs?$AA?5?$AAe?$AAn?$AAt?$AAe?$AAr@| DCB "m"
	DCB	0x0, "m", 0x0, "c", 0x0, "_", 0x0, "h", 0x0, "w", 0x0, "_"
	DCB	0x0, "i", 0x0, "n", 0x0, "i", 0x0, "t", 0x0, " ", 0x0, "i"
	DCB	0x0, "s", 0x0, " ", 0x0, "e", 0x0, "n", 0x0, "t", 0x0, "e"
	DCB	0x0, "r", 0x0, "e", 0x0, "d", 0x0, 0xd, 0x0, 0xa, 0x0, 0x0
	DCB	0x0					; `string'

  00000			 AREA	 |.rdata| { |??_C@_1CO@GFCE@?$AAF?$AAi?$AAn?$AAi?$AAs?$AAh?$AAe?$AAd?$AA?5?$AAm?$AAm?$AAc?$AA_?$AAh?$AAw?$AA_?$AAi?$AAn?$AAi?$AAt@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_1CO@GFCE@?$AAF?$AAi?$AAn?$AAi?$AAs?$AAh?$AAe?$AAd?$AA?5?$AAm?$AAm?$AAc?$AA_?$AAh?$AAw?$AA_?$AAi?$AAn?$AAi?$AAt@| DCB "F"
	DCB	0x0, "i", 0x0, "n", 0x0, "i", 0x0, "s", 0x0, "h", 0x0, "e"
	DCB	0x0, "d", 0x0, " ", 0x0, "m", 0x0, "m", 0x0, "c", 0x0, "_"
	DCB	0x0, "h", 0x0, "w", 0x0, "_", 0x0, "i", 0x0, "n", 0x0, "i"
	DCB	0x0, "t", 0x0, 0xd, 0x0, 0xa, 0x0, 0x0, 0x0 ; `string'
; Function compile flags: /Ogsy

  00000			 AREA	 |.text| { |mmc_hw_init| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000		 |mmc_hw_init| PROC

; 129  : {

  00000	e92d4030	 stmdb     sp!, {r4, r5, lr}
  00004		 |$M41454|

; 130  :     PHYSICAL_ADDRESS PhysAddr;
; 131  : 
; 132  : 	VOID	*SDMMCIntrEvent;    
; 133  : 
; 134  :     RETAILMSG(1, (TEXT("mmc_hw_init is entered\r\n")));													


  00004	e59f00c4	 ldr       r0, [pc, #0xC4]
  00008	eb000000	 bl        NKDbgPrintfW

; 135  : 	SDMMCIntrEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

  0000c	e3a03000	 mov       r3, #0
  00010	e3a02000	 mov       r2, #0
  00014	e3a01000	 mov       r1, #0
  00018	e3a00000	 mov       r0, #0
  0001c	eb000000	 bl        CreateEventW

; 136  : 
; 137  :     

; 138  :     

; 139  :     

; 140  : 	if (gSDMMCGpioRegPtr==NULL) {

  00020	e59f40a4	 ldr       r4, [pc, #0xA4]
  00024	e3a05000	 mov       r5, #0
  00028	e5940000	 ldr       r0, [r4]
  0002c	e3500000	 cmp       r0, #0
  00030	1a000008	 bne       |$L41110|

; 141  : 		PhysAddr.QuadPart = APB_GPIO_REGS_BASE;

  00034	e3a00102	 mov       r0, #2, 2
  00038	e3800c0e	 orr       r0, r0, #0xE, 24

; 142  : 
; 143  : 		gSDMMCGpioRegPtr = MmMapIoSpace(PhysAddr,
; 144  : 								  sizeof(*gSDMMCGpioRegPtr),
; 145  : 								  FALSE);

  0003c	e3a03000	 mov       r3, #0
  00040	e3a02088	 mov       r2, #0x88
  00044	e1a01005	 mov       r1, r5
  00048	eb000000	 bl        MmMapIoSpace
  0004c	e3500000	 cmp       r0, #0
  00050	e5840000	 str       r0, [r4]

; 146  : 		if (gSDMMCGpioRegPtr == NULL) {

  00054	0a000018	 beq       |$L41101|
  00058		 |$L41110|

; 147  : 			DEBUGMSG(1, (
; 148  : 					 TEXT("SDMMC: Failed to map GPIO registers.\r\n")));
; 149  : 			return;
; 150  : 		}
; 151  : 	}
; 152  : 
; 153  :     

; 154  :     

; 155  :     

; 156  : 	if (gSDMMCRegPtr==NULL) {

  00058	e59f4068	 ldr       r4, [pc, #0x68]
  0005c	e5940000	 ldr       r0, [r4]
  00060	e3500000	 cmp       r0, #0
  00064	1a000008	 bne       |$L41449|

; 157  : 		PhysAddr.QuadPart = APB_MMC_REGS_BASE;

  00068	e3a00102	 mov       r0, #2, 2
  0006c	e3800c01	 orr       r0, r0, #1, 24

; 158  : 
; 159  : 		gSDMMCRegPtr = MmMapIoSpace(PhysAddr,
; 160  : 								  sizeof(*gSDMMCRegPtr),
; 161  : 								  FALSE);

  00070	e3a03000	 mov       r3, #0
  00074	e3a02050	 mov       r2, #0x50
  00078	e1a01005	 mov       r1, r5
  0007c	eb000000	 bl        MmMapIoSpace
  00080	e3500000	 cmp       r0, #0
  00084	e5840000	 str       r0, [r4]

; 162  : 		if (gSDMMCRegPtr == NULL) {

  00088	0a00000b	 beq       |$L41101|
  0008c		 |$L41449|

; 163  : 			DEBUGMSG(1, (
; 164  : 					 TEXT("SDMMC: Failed to map MMC registers.\r\n")));
; 165  : 			return;
; 166  : 		}
; 167  : 	}	
; 168  : 	
; 169  : 	if (!gSDMMCRegPtr) return;
; 170  : 
; 171  : 	
; 172  : 	

; 173  :     WRITE_REGISTER_ULONG(&gSDMMCRegPtr->MMC_PREDIV, 0x00);

  0008c	e280000c	 add       r0, r0, #0xC
  00090	e5805000	 str       r5, [r0]

; 174  : 
; 175  :     

; 176  :     

; 177  :     

; 178  : 
; 179  :     

; 180  :     

; 181  :     WRITE_REGISTER_ULONG(&gSDMMCRegPtr->INT_MASK, 0x3F);

  00094	e3a0203f	 mov       r2, #0x3F
  00098	e5941000	 ldr       r1, [r4]
  0009c	e2810034	 add       r0, r1, #0x34
  000a0	e5802000	 str       r2, [r0]

; 182  : 
; 183  :     

; 184  :     

; 185  :     

; 186  :     WRITE_REGISTER_ULONG(&gSDMMCRegPtr->MMC_PREDIV, MMCI_PCLK_EN | MMCI_APB_RD_EN | MMCI_SIXTH_HCLK );

  000a4	e3a02036	 mov       r2, #0x36
  000a8	e5940000	 ldr       r0, [r4]
  000ac	e280100c	 add       r1, r0, #0xC

; 187  : 

; 188  : 	
; 194  : 
; 195  : 	RETAILMSG(1, (TEXT("Finished mmc_hw_init\r\n")));

  000b0	e59f000c	 ldr       r0, [pc, #0xC]
  000b4	e5812000	 str       r2, [r1]
  000b8	eb000000	 bl        NKDbgPrintfW
  000bc		 |$L41101|

; 196  :     return;
; 197  : 
; 198  : }

  000bc	e8bd4030	 ldmia     sp!, {r4, r5, lr}
  000c0	e12fff1e	 bx        lr
  000c4		 |$L41458|
  000c4	00000000	 DCD       |??_C@_1CO@GFCE@?$AAF?$AAi?$AAn?$AAi?$AAs?$AAh?$AAe?$AAd?$AA?5?$AAm?$AAm?$AAc?$AA_?$AAh?$AAw?$AA_?$AAi?$AAn?$AAi?$AAt@|
  000c8	00000000	 DCD       |gSDMMCRegPtr|
  000cc	00000000	 DCD       |gSDMMCGpioRegPtr|
  000d0	00000000	 DCD       |??_C@_1DC@GNNN@?$AAm?$AAm?$AAc?$AA_?$AAh?$AAw?$AA_?$AAi?$AAn?$AAi?$AAt?$AA?5?$AAi?$AAs?$AA?5?$AAe?$AAn?$AAt?$AAe?$AAr@|
  000d4		 |$M41455|

			 ENDP  ; |mmc_hw_init|

	EXPORT	|stopMMCClock|

  00000			 AREA	 |.text| { |stopMMCClock| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000			 AREA	 |.pdata$$stopMMCClock|, PDATA, SELECTION=5, ASSOC=|.text| { |stopMMCClock| } ; comdat associative
|$T41468| DCD	|stopMMCClock|
	DCD	0x40001701
; Function compile flags: /Ogsy

  00000			 AREA	 |.text| { |stopMMCClock| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000		 |stopMMCClock| PROC

; 218  : {

  00000	e92d4030	 stmdb     sp!, {r4, r5, lr}
  00004		 |$M41466|

; 219  : 	
; 220  : 	#define MMC_STATUS_CLOCK_ENABLED         0x00000100
; 221  : 
; 222  :     UINT16  dTime;
; 223  :     UINT32  dStatus;
; 224  : 
; 225  :     
; 226  : 	

; 227  : 	

; 228  :     WRITE_REGISTER_ULONG(&gSDMMCRegPtr->STR_STP_CLK, MMCI_STOP_CLK);
; 229  : 
; 230  :     dTime = 0x200;

  00004	e59f004c	 ldr       r0, [pc, #0x4C]
  00008	e3a05001	 mov       r5, #1
  0000c	e5903000	 ldr       r3, [r0]
  00010	e3a02c02	 mov       r2, #2, 24
  00014	e4835004	 str       r5, [r3], #4
  00018		 |$L41128|

; 231  :     dStatus = 0;
; 232  : 
; 233  :     
; 234  :     while ( dTime )
; 235  :     {
; 236  : 		

; 237  : 		

; 238  : 		dStatus = READ_REGISTER_ULONG(&gSDMMCRegPtr->STATUS);
; 239  :         dTime--;

  00018	e1a00802	 mov       r0, r2, lsl #16
  0001c	e5934000	 ldr       r4, [r3]
  00020	e1a01820	 mov       r1, r0, lsr #16
  00024	e2812cff	 add       r2, r1, #0xFF, 24
  00028	e28200ff	 add       r0, r2, #0xFF
  0002c	e1a01800	 mov       r1, r0, lsl #16
  00030	e1a02821	 mov       r2, r1, lsr #16

; 240  :         if ( (dStatus & MMC_STATUS_CLOCK_ENABLED) )

  00034	e3140c01	 tst       r4, #1, 24
  00038	1a000003	 bne       |$L41123|
  0003c	e1a00802	 mov       r0, r2, lsl #16
  00040	e1b01820	 movs      r1, r0, lsr #16
  00044	1afffff3	 bne       |$L41128|

; 242  :     }
; 243  : 
; 244  :     return NO;

  00048	e3a05000	 mov       r5, #0
  0004c		 |$L41123|

; 241  :             return YES;

  0004c	e1a00005	 mov       r0, r5

; 245  : }

  00050	e8bd4030	 ldmia     sp!, {r4, r5, lr}
  00054	e12fff1e	 bx        lr
  00058		 |$L41470|
  00058	00000000	 DCD       |gSDMMCRegPtr|
  0005c		 |$M41467|

			 ENDP  ; |stopMMCClock|

	EXPORT	|startMMCClock|

  00000			 AREA	 |.text| { |startMMCClock| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000			 AREA	 |.pdata$$startMMCClock|, PDATA, SELECTION=5, ASSOC=|.text| { |startMMCClock| } ; comdat associative
|$T41475| DCD	|startMMCClock|
	DCD	0x40000600
; Function compile flags: /Ogsy

  00000			 AREA	 |.text| { |startMMCClock| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000		 |startMMCClock| PROC

; 265  : {

  00000		 |$M41473|

; 266  :     
; 267  : 	

; 268  :     WRITE_REGISTER_ULONG(&gSDMMCRegPtr->STR_STP_CLK, MMCI_START_CLK);

  00000	e59f000c	 ldr       r0, [pc, #0xC]
  00004	e3a02002	 mov       r2, #2
  00008	e5901000	 ldr       r1, [r0]
  0000c	e5812000	 str       r2, [r1]

; 269  : }

  00010	e12fff1e	 bx        lr

⌨️ 快捷键说明

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