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

📄 mmcdrv.cod

📁 ARM对MMC卡的编程文档
💻 COD
📖 第 1 页 / 共 4 页
字号:
; Function compile flags: /Ogsy

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

  00000		 |send_data| PROC

; 226  : {

  00000	e52de004	 str       lr, [sp, #-4]!
  00004		 |$M36796|

; 227  :     
; 228  :         return (MMCTransmit((UCHAR *)pc->user_address, dLength, noBlocks, xferMode));

  00004	e5900004	 ldr       r0, [r0, #4]
  00008	eb000000	 bl        MMCTransmit

; 229  : }

  0000c	e8bd4000	 ldmia     sp!, {lr}
  00010	e12fff1e	 bx        lr
  00014		 |$M36797|

			 ENDP  ; |send_data|

	EXPORT	|MMCReceivedResponse|
	IMPORT	|getMMCResponseInfo|

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

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

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

  00000		 |MMCReceivedResponse| PROC

; 248  : {

  00000	e52de004	 str       lr, [sp, #-4]!
  00004		 |$M36806|
  00004	e1a03000	 mov       r3, r0
  00008	e1a02001	 mov       r2, r1

; 249  :     UINT08  *respBuff;
; 250  :     UINT16  respLength;
; 251  : 
; 252  : 
; 253  :     if ( Resp == R0 )

  0000c	e3520000	 cmp       r2, #0

; 254  :         return (MMC_NO_ERROR);

  00010	03a00000	 moveq     r0, #0

; 266  : }

  00014	08bd4000	 ldmeqia   sp!, {lr}
  00018	012fff1e	 bxeq      lr

; 255  : 
; 256  :     respLength = BYTE_LENGTH;               

  0001c	e3a01006	 mov       r1, #6

; 257  : 	if ( Resp == R2 ) {

  00020	e3520002	 cmp       r2, #2

; 258  : 		respLength = CID_BYTE_LENGTH -1;

  00024	03a01010	 moveq     r1, #0x10

; 263  : 
; 264  :     
; 265  :     return (getMMCResponseInfo(respBuff, respLength, (UINT16)Resp));

  00028	e1a00802	 mov       r0, r2, lsl #16
  0002c	e1a02820	 mov       r2, r0, lsr #16

; 259  : 		

; 260  : 	}
; 261  : 
; 262  :     respBuff = (UINT08 *)pc->LastResponse;

  00030	e2830028	 add       r0, r3, #0x28

; 263  : 
; 264  :     
; 265  :     return (getMMCResponseInfo(respBuff, respLength, (UINT16)Resp));

  00034	eb000000	 bl        getMMCResponseInfo

; 266  : }

  00038	e8bd4000	 ldmia     sp!, {lr}
  0003c	e12fff1e	 bx        lr
  00040		 |$M36807|

			 ENDP  ; |MMCReceivedResponse|

	EXPORT	|MMCAnalysisResponse|

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

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

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

  00000		 |MMCAnalysisResponse| PROC

; 287  : {

  00000	e92d40f0	 stmdb     sp!, {r4 - r7, lr}
  00004		 |$M36817|
  00004	e1a07000	 mov       r7, r0

; 288  :     UINT32  statusInfo;
; 289  :         UINT08  *respBuff;
; 290  :         UINT16  ij, tt;
; 291  : 
; 292  :     respBuff = (UINT08 *)pc->LastResponse;

  00008	e2876028	 add       r6, r7, #0x28

; 293  :         if (respType == R6)

  0000c	e3510006	 cmp       r1, #6
  00010	1a00001e	 bne       |$L36596|

; 294  :         {
; 295  :                 ij = (UINT16)respBuff[1];
; 296  :                 ij <<= 8;
; 297  :                 ij |= (UINT16)respBuff[2];
; 298  :                 pc->LastResponse[4] = ij;

  00014	e5d60002	 ldrb      r0, [r6, #2]
  00018	e5d61001	 ldrb      r1, [r6, #1]

; 299  : #if (LITTLE_ENDIAN)
; 300  :                 
; 301  :                 pc->LastResponse[0] &= 0x00FF;
; 302  : 
; 303  :                  
; 304  :                 ij = (pc->LastResponse[1] & 0xC000);
; 305  :                  
; 306  :                 tt = (pc->LastResponse[1] & 0x0800) << 2;
; 307  :                 ij |= tt;
; 308  :                 
; 309  :                 pc->LastResponse[1] = ij;
; 310  : 
; 311  :                 ij = pc->LastResponse[2] & 0x001F;

  0001c	e1d752bc	 ldrh      r5, [r7, #0x2C]
  00020	e1801401	 orr       r1, r0, r1, lsl #8
  00024	e1d742ba	 ldrh      r4, [r7, #0x2A]
  00028	e1a02801	 mov       r2, r1, lsl #16
  0002c	e1d712b8	 ldrh      r1, [r7, #0x28]
  00030	e1a00822	 mov       r0, r2, lsr #16
  00034	e1c703b0	 strh      r0, [r7, #0x30]
  00038	e1a00801	 mov       r0, r1, lsl #16
  0003c	e1a02820	 mov       r2, r0, lsr #16
  00040	e20210ff	 and       r1, r2, #0xFF

; 312  :                  
; 313  :                 pc->LastResponse[1] |= (ij << 8);

  00044	e1a00805	 mov       r0, r5, lsl #16
  00048	e1c712b8	 strh      r1, [r7, #0x28]
  0004c	e1a01820	 mov       r1, r0, lsr #16
  00050	e1a00804	 mov       r0, r4, lsl #16
  00054	e201301f	 and       r3, r1, #0x1F
  00058	e1a01820	 mov       r1, r0, lsr #16
  0005c	e1a00804	 mov       r0, r4, lsl #16
  00060	e2012b02	 and       r2, r1, #2, 22
  00064	e1a01820	 mov       r1, r0, lsr #16
  00068	e1823303	 orr       r3, r2, r3, lsl #6
  0006c	e2012903	 and       r2, r1, #3, 18
  00070	e1820103	 orr       r0, r2, r3, lsl #2
  00074	e1a01800	 mov       r1, r0, lsl #16
  00078	e1a00805	 mov       r0, r5, lsl #16
  0007c	e1a02821	 mov       r2, r1, lsr #16
  00080	e1a01820	 mov       r1, r0, lsr #16
  00084	e1c722ba	 strh      r2, [r7, #0x2A]

; 314  : 
; 315  :                 ij = pc->LastResponse[2] >> 8;

  00088	e1a02421	 mov       r2, r1, lsr #8

; 316  :                  
; 317  :                 pc->LastResponse[2] = ij;

  0008c	e1c722bc	 strh      r2, [r7, #0x2C]
  00090		 |$L36596|

; 318  : #else
; 319  :                 
; 320  :                 pc->LastResponse[0] &= 0xFF00;
; 321  : 
; 322  :                  
; 323  :                 ij = pc->LastResponse[1] & 0x00C0;
; 324  :                  
; 325  :                 tt = (pc->LastResponse[1] & 0x0008) << 2;
; 326  :                 ij |= tt;
; 327  :                 
; 328  :                 pc->LastResponse[1] = ij;
; 329  : 
; 330  :                  
; 331  :                 ij = (pc->LastResponse[2] >> 8) & 0x1F;
; 332  :                  
; 333  :                 pc->LastResponse[1] |= ij;
; 334  : 
; 335  :                 ij = pc->LastResponse[2] & 0x00FF;
; 336  :                  
; 337  :                 pc->LastResponse[2] = (ij << 8);
; 338  : #endif
; 339  :         }
; 340  : 
; 341  :     
; 342  :     statusInfo = (UINT32)(respBuff[1] & 0xFF);
; 343  :     statusInfo <<= 8;
; 344  :     statusInfo |= (UINT32)(respBuff[2] & 0xFF);
; 345  :     statusInfo <<= 8;
; 346  :     statusInfo |= (UINT32)(respBuff[3] & 0xE0);
; 347  :     statusInfo <<= 8;

  00090	e5d61001	 ldrb      r1, [r6, #1]
  00094	e5d60002	 ldrb      r0, [r6, #2]

; 416  : #endif
; 417  : 
; 418  :     return MMC_CARD_IS_NOT_RESPONDING;

  00098	e5d63003	 ldrb      r3, [r6, #3]
  0009c	e1802401	 orr       r2, r0, r1, lsl #8
  000a0	e20310e0	 and       r1, r3, #0xE0
  000a4	e1810402	 orr       r0, r1, r2, lsl #8
  000a8	e203101f	 and       r1, r3, #0x1F
  000ac	e1c712b2	 strh      r1, [r7, #0x22]
  000b0	e1b04400	 movs      r4, r0, lsl #8
  000b4	e1d732b2	 ldrh      r3, [r7, #0x22]
  000b8	e5874038	 str       r4, [r7, #0x38]
  000bc	e1a00803	 mov       r0, r3, lsl #16
  000c0	e1a01820	 mov       r1, r0, lsr #16
  000c4	e1a00803	 mov       r0, r3, lsl #16
  000c8	e2012001	 and       r2, r1, #1
  000cc	e1a01820	 mov       r1, r0, lsr #16
  000d0	e1c722b4	 strh      r2, [r7, #0x24]
  000d4	e1a020a1	 mov       r2, r1, lsr #1
  000d8	e1c722b2	 strh      r2, [r7, #0x22]
  000dc	03a00000	 moveq     r0, #0

; 419  : }

  000e0	08bd40f0	 ldmeqia   sp!, {r4 - r7, lr}
  000e4	012fff1e	 bxeq      lr

; 348  : 
; 349  :     
; 350  :     pc->currentState = (UINT16)(respBuff[3] & 0x1F);
; 351  :     pc->mmcStatus = statusInfo;
; 352  :     pc->mmcRdyState = pc->currentState & 01;
; 353  :     pc->currentState >>= 1;
; 354  : 
; 355  :     
; 356  :     if (statusInfo == 0)
; 357  :         return MMC_NO_ERROR;
; 358  : 
; 359  :     if (statusInfo & OUT_OF_RANGE_ERROR)

  000e8	e3140102	 tst       r4, #2, 2

; 360  :         return  MMC_OUT_OF_RANGE;

  000ec	13a000e4	 movne     r0, #0xE4

; 419  : }

  000f0	18bd40f0	 ldmneia   sp!, {r4 - r7, lr}
  000f4	112fff1e	 bxne      lr

; 361  : 
; 362  :     if (statusInfo & ADDRESS_ERROR)

  000f8	e3140101	 tst       r4, #1, 2

; 363  :         return  MMC_ADDRESS_ERROR;

  000fc	13a000d5	 movne     r0, #0xD5

; 419  : }

  00100	18bd40f0	 ldmneia   sp!, {r4 - r7, lr}
  00104	112fff1e	 bxne      lr

; 364  : 
; 365  :     if (statusInfo & BLK_LENGTH_ERROR)

  00108	e3140202	 tst       r4, #2, 4

; 366  :         return  MMC_DATA_LENGTH_ERROR;

  0010c	13a000e2	 movne     r0, #0xE2

; 419  : }

  00110	18bd40f0	 ldmneia   sp!, {r4 - r7, lr}
  00114	112fff1e	 bxne      lr

; 367  : 
; 368  :     if (statusInfo & ERASE_SEQ_ERROR)

  00118	e3140201	 tst       r4, #1, 4

; 369  :         return  MMC_ERASE_SEQ_ERROR;

  0011c	13a000da	 movne     r0, #0xDA

; 419  : }

  00120	18bd40f0	 ldmneia   sp!, {r4 - r7, lr}
  00124	112fff1e	 bxne      lr

; 370  : 
; 371  :     if (statusInfo & ERASE_PARAM)

  00128	e3140302	 tst       r4, #2, 6

; 372  :         return  MMC_ERASE_PARAM;

  0012c	13a000d1	 movne     r0, #0xD1

; 419  : }

  00130	18bd40f0	 ldmneia   sp!, {r4 - r7, lr}
  00134	112fff1e	 bxne      lr

; 373  : 
; 374  :     if (statusInfo & WP_VIOLATION)

  00138	e3140301	 tst       r4, #1, 6

; 375  :         return  MMC_WP_VIOLATION;

  0013c	13a000d2	 movne     r0, #0xD2

; 419  : }

  00140	18bd40f0	 ldmneia   sp!, {r4 - r7, lr}
  00144	112fff1e	 bxne      lr

; 376  : 
; 377  :     if (statusInfo & CMD_CRC_ERROR)

  00148	e3140502	 tst       r4, #2, 10

; 378  :         return MMC_CMD_CRC_ERROR;

  0014c	13a000ca	 movne     r0, #0xCA

; 419  : }

  00150	18bd40f0	 ldmneia   sp!, {r4 - r7, lr}
  00154	112fff1e	 bxne      lr

; 379  : 
; 380  :     if (statusInfo & COMUNC_ILLEG_COM)

  00158	e3140501	 tst       r4, #1, 10

; 381  :         return  MMC_COMUNC_ILLEG_COM;

  0015c	13a000d0	 movne     r0, #0xD0

; 419  : }

  00160	18bd40f0	 ldmneia   sp!, {r4 - r7, lr}
  00164	112fff1e	 bxne      lr

; 382  : 
; 383  :     if (statusInfo & CARD_ECC_FAILED)

  00168	e3140602	 tst       r4, #2, 12

; 384  :         return  MMC_CARD_ECC_FAILED;

  0016c	13a000e5	 movne     r0, #0xE5

; 419  : }

  00170	18bd40f0	 ldmneia   sp!, {r4 - r7, lr}
  00174	112fff1e	 bxne      lr

; 385  : 
; 386  :     if (statusInfo & CONTROLLER_ERROR)

  00178	e3140601	 tst       r4, #1, 12

; 387  :         return  MMC_INTERFACE_ERROR;

  0017c	13a000d7	 movne     r0, #0xD7

; 419  : }

  00180	18bd40f0	 ldmneia   sp!, {r4 - r7, lr}

⌨️ 快捷键说明

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