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

📄 diskio.cod

📁 ARM读写SD卡程序
💻 COD
📖 第 1 页 / 共 5 页
字号:
	DCD	|$L41557|
	DCD	|$L41552|
	DCD	|$L41553|

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

  00000			 AREA	 |.pdata$$MMCREAD|, PDATA, SELECTION=5, ASSOC=|.text| { |MMCREAD| } ; comdat associative
|$T41574| DCD	|MMCREAD|
	DCD	0xc0002304

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

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

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

  00000	00000000	 DCD       |__C_specific_handler|
  00004	00000000	 DCD       |$T41573|

  00008		 |MMCREAD| PROC

; 172  : {

  00008	e1a0c00d	 mov       r12, sp
  0000c	e92d59f0	 stmdb     sp!, {r4 - r8, r11, r12, lr}
  00010	e28db020	 add       r11, sp, #0x20
  00014	e24dd008	 sub       sp, sp, #8
  00018		 |$L41571|
  00018	e1a06000	 mov       r6, r0
  0001c	e1a05001	 mov       r5, r1

; 173  : 	
; 174  :    

; 175  :     DWORD num_sg;
; 176  :   

; 177  :     DWORD bytes_this_sg;
; 178  : 	unsigned short num_of_sector;
; 179  : 	

; 180  :     PSG_BUF pSg;
; 181  :     UCHAR *pBuf16;
; 182  :    

; 183  :     DWORD sectno;
; 184  :     DWORD endsect;
; 185  :     DWORD error;
; 186  :    
; 187  : 
; 188  : 

; 189  :     num_sg = pSgr->sr_num_sg;
; 190  : 

; 191  :     pSg = &(pSgr->sr_sglist[0]);

  00020	e1a04005	 mov       r4, r5

; 192  :     bytes_this_sg = pSg->sb_len;
; 193  : 

; 194  :     pBuf16 = (UCHAR *)  MapPtrToProcess((LPVOID)pSg->sb_buf, GetCallerProcess());

  00024	eb000000	 bl        GetCallerProcess
  00028	e1a01000	 mov       r1, r0
  0002c	e5b40014	 ldr       r0, [r4, #0x14]!
  00030	eb000000	 bl        MapPtrToProcess
  00034	e1a07000	 mov       r7, r0

; 195  :     
; 196  :     sectno = pSgr->sr_start;

  00038	e5958000	 ldr       r8, [r5]

; 197  : 

; 198  :     endsect = sectno + pSgr->sr_num_sec;
; 199  : 

; 200  : 	num_of_sector = (unsigned short) pSgr->sr_num_sec;

  0003c	e5950004	 ldr       r0, [r5, #4]
  00040	e1a01800	 mov       r1, r0, lsl #16
  00044	e1a04821	 mov       r4, r1, lsr #16
  00048		 |$L41556|

; 201  :     error = ERROR_SUCCESS;
; 202  :     

; 203  :     

; 204  :     

; 205  :     

; 206  :     

; 207  : 

; 208  : #ifdef USE_INTERRUPT
; 209  :     ResetEvent(pDisk->d_IRQEvent);
; 210  : #endif
; 211  : 
; 212  :     try {
; 213  :         error = CheckMedia(pDisk);

  00048	e1a00006	 mov       r0, r6
  0004c	eb000000	 bl        CheckMedia
  00050	e1a05000	 mov       r5, r0
  00054	e50b5028	 str       r5, [r11, #-0x28]

; 214  : 
; 215  :     if ( error == ERROR_SUCCESS)

  00058	e3550000	 cmp       r5, #0
  0005c	1a000007	 bne       |$L41557|

; 216  : 
; 217  : 
; 218  : #if (USE_SPI || USE_SPI_EMULATION)
; 219  :         if (spi_read(0, sectno, WorkBuf, 1) == 0)
; 220  :                      error = ERROR_READ_FAULT;
; 221  : 
; 222  : #else
; 223  : 		

; 224  : 		     
; 225  :        

; 226  : 			

; 227  : 			

; 228  :              if (mmc_read(0, sectno, pBuf16, num_of_sector) == 0)

  00060	e1a03004	 mov       r3, r4
  00064	e1a02007	 mov       r2, r7
  00068	e1a01008	 mov       r1, r8
  0006c	e3a00000	 mov       r0, #0
  00070	eb000000	 bl        mmc_read
  00074	e3500000	 cmp       r0, #0

; 229  :                      error = ERROR_READ_FAULT;

  00078	03a0501e	 moveq     r5, #0x1E
  0007c	050b5028	 streq     r5, [r11, #-0x28]
  00080		 |$L41557|
  00080	ea000000	 b         |$L41271|
  00084		 |$L41553|

; 242  :         error = ERROR_READ_FAULT;

  00084	e3a0501e	 mov       r5, #0x1E
  00088		 |$L41271|

; 243  :     }
; 244  :     if (error != ERROR_SUCCESS) {

  00088	e1a00005	 mov       r0, r5

; 245  :         return error;
; 246  :     }
; 247  : 
; 248  : #ifdef USE_INTERRUPT
; 249  :     if (pDisk->d_DiskCardState == STATE_OPENED) {
; 250  :         WaitForSingleObject(pDisk->d_IRQEvent, DISK_IO_TIME_OUT);
; 251  :     }
; 252  :     if (pDisk->d_DiskCardState != STATE_OPENED) {
; 253  :         return GetDiskStateError(pDisk->d_DiskCardState);
; 254  :     }
; 255  : #endif
; 256  : 
; 257  : 
; 258  :  
; 259  :  
; 260  :  	

; 261  :     return 0;
; 262  : }    


  0008c	e91b69f0	 ldmdb     r11, {r4 - r8, r11, sp, lr}
  00090	e12fff1e	 bx        lr

			 ENDP  ; |MMCREAD|

  00094		 |$L41555|
  00094		 |$L41572|
  00094		 |$L41552|

; 230  : 
; 231  :         

; 232  : 
; 233  : #endif
; 234  : 
; 235  : 
; 236  : 
; 237  : 
; 238  :        

; 239  : 
; 240  :     } except (GetExceptionCode() == STATUS_ACCESS_VIOLATION ?
; 241  :         EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {

  00094	e5901000	 ldr       r1, [r0]
  00098	e5912000	 ldr       r2, [r1]
  0009c	e3520117	 cmp       r2, #0x17, 2
  000a0	e3a00001	 mov       r0, #1
  000a4	13a00000	 movne     r0, #0
  000a8		 |$L41554|
  000a8	e1a0f00e	 mov       pc, lr
  000ac		 |$L41575|
	EXPORT	|MMCWRITE|
	IMPORT	|GetDiskStateError|
	IMPORT	|platform_delayms|
	IMPORT	|mmc_write|

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

  00000			 AREA	 |.xdata$$MMCWRITE|, DATA, SELECTION=5, ASSOC=|.text| { |MMCWRITE| } ; comdat associative
|$T41627| DCD	0x2
	DCD	|$L41600|
	DCD	|$L41601|
	DCD	|$L41596|
	DCD	|$L41597|
	DCD	|$L41593|
	DCD	|$L41594|
	DCD	|$L41589|
	DCD	|$L41590|

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

  00000			 AREA	 |.pdata$$MMCWRITE|, PDATA, SELECTION=5, ASSOC=|.text| { |MMCWRITE| } ; comdat associative
|$T41628| DCD	|MMCWRITE|
	DCD	0xc0009705

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

  00000			 AREA	 |.pdata$$MMCWRITE|, PDATA, SELECTION=5, ASSOC=|.text| { |MMCWRITE| } ; comdat associative
|$T41630| DCD	|$L41596|
	DCD	0x40000600

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

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

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

  00000	00000000	 DCD       |__C_specific_handler|
  00004	00000000	 DCD       |$T41627|

  00008		 |MMCWRITE| PROC

; 273  : {

  00008	e1a0c00d	 mov       r12, sp
  0000c	e92d0001	 stmdb     sp!, {r0}
  00010	e92d5ff0	 stmdb     sp!, {r4 - r12, lr}
  00014	e28db028	 add       r11, sp, #0x28
  00018	e24dd038	 sub       sp, sp, #0x38
  0001c		 |$L41625|
  0001c	e1a09000	 mov       r9, r0
  00020	e1a04001	 mov       r4, r1

; 274  : 	
; 275  :     DWORD i;
; 276  :     DWORD num_sg;
; 277  :     DWORD bytes_this_int;
; 278  :     DWORD bytes_this_sg;
; 279  :     PSG_BUF pSg;
; 280  :     PUSHORT pBuf16;
; 281  :     DWORD sectno;
; 282  :     DWORD endsect;
; 283  :     DWORD error;
; 284  :     
; 285  : 

; 286  : 

; 287  :     
; 288  :     OS_WAIT(50);

  00024	e3a00032	 mov       r0, #0x32
  00028	eb000000	 bl        platform_delayms

; 289  :     
; 290  : 

; 291  : 

; 292  :     num_sg = pSgr->sr_num_sg;

  0002c	e594a008	 ldr       r10, [r4, #8]
  00030	e50ba060	 str       r10, [r11, #-0x60]
  00034	e50ba05c	 str       r10, [r11, #-0x5C]

; 293  :     pSg = &(pSgr->sr_sglist[0]);

  00038	e2842014	 add       r2, r4, #0x14
  0003c	e50b2058	 str       r2, [r11, #-0x58]
  00040	e50b2054	 str       r2, [r11, #-0x54]

; 294  :     bytes_this_sg = pSg->sb_len;

  00044	e5921004	 ldr       r1, [r2, #4]
  00048	e50b1050	 str       r1, [r11, #-0x50]
  0004c	e50b104c	 str       r1, [r11, #-0x4C]

; 295  :     bytes_this_int = pDisk->d_DiskInfo.di_bytes_per_sect;
; 296  :     pBuf16 = (PUSHORT) MapPtrToProcess((LPVOID)pSg->sb_buf, GetCallerProcess());

  00050	eb000000	 bl        GetCallerProcess
  00054	e1a01000	 mov       r1, r0
  00058	e51b2058	 ldr       r2, [r11, #-0x58]
  0005c	e5920000	 ldr       r0, [r2]
  00060	eb000000	 bl        MapPtrToProcess
  00064	e50b0048	 str       r0, [r11, #-0x48]
  00068	e50b0044	 str       r0, [r11, #-0x44]

; 297  : 
; 298  :     sectno = pSgr->sr_start;

  0006c	e5947000	 ldr       r7, [r4]

; 299  :     endsect = sectno + pSgr->sr_num_sec;

  00070	e5940004	 ldr       r0, [r4, #4]

; 297  : 
; 298  :     sectno = pSgr->sr_start;

  00074	e50b7040	 str       r7, [r11, #-0x40]

; 299  :     endsect = sectno + pSgr->sr_num_sec;

  00078	e0806007	 add       r6, r0, r7
  0007c	e50b603c	 str       r6, [r11, #-0x3C]
  00080	e3a0501d	 mov       r5, #0x1D
  00084	e3a08000	 mov       r8, #0
  00088	ea000000	 b         |$L41290|
  0008c		 |$L41623|

; 289  :     
; 290  : 

; 291  : 

; 292  :     num_sg = pSgr->sr_num_sg;

  0008c	e51ba060	 ldr       r10, [r11, #-0x60]
  00090		 |$L41290|

; 300  :     error = ERROR_SUCCESS;
; 301  : 
; 302  :     

; 303  :     

; 304  :     

; 305  :     

; 306  :     while (num_sg) {

  00090	e35a0000	 cmp       r10, #0
  00094	0a00005b	 beq       |$L41291|
  00098		 |$L41593|

; 307  : 
; 308  :     try {
; 309  :         error = CheckMedia(pDisk);

  00098	e1a00009	 mov       r0, r9
  0009c	eb000000	 bl        CheckMedia
  000a0	e1a0a000	 mov       r10, r0
  000a4	e50ba038	 str       r10, [r11, #-0x38]

; 310  : 
; 311  :     if ( error == ERROR_SUCCESS)

  000a8	e35a0000	 cmp       r10, #0
  000ac	1a000007	 bne       |$L41594|

; 312  : 
; 313  : #if (USE_SPI || USE_SPI_EMULATION)
; 314  : 
; 315  :         if (spi_write(0, sectno, (UTINY *) pBuf16 , 1) == 0)
; 316  :                      error = ERROR_WRITE_FAULT;
; 317  : 
; 318  : #else
; 319  :         if (mmc_write(0, sectno, (UTINY *) pBuf16 , 1) == 0)

  000b0	e3a03001	 mov       r3, #1
  000b4	e51b2048	 ldr       r2, [r11, #-0x48]
  000b8	e1a01007	 mov       r1, r7
  000bc	e3a00000	 mov       r0, #0
  000c0	eb000000	 bl        mmc_write
  000c4	e3500000	 cmp       r0, #0

; 320  :                      error = ERROR_WRITE_FAULT;

  000c8	01a0a005	 moveq     r10, r5
  000cc	050ba038	 streq     r10, [r11, #-0x38]
  000d0		 |$L41594|

; 374  :     bytes_this_sg = pSg->sb_len;

  000d0	e51b1050	 ldr       r1, [r11, #-0x50]
  000d4	e51b2058	 ldr       r2, [r11, #-0x58]
  000d8	ea00000d	 b         |$L41595|
  000dc		 |$L41590|

; 325  :         error = ERROR_WRITE_FAULT;

  000dc	e3a0501d	 mov       r5, #0x1D
  000e0	e1a0a005	 mov       r10, r5
  000e4	e3a08000	 mov       r8, #0
  000e8	e59b9000	 ldr       r9, [r11]
  000ec	e51b005c	 ldr       r0, [r11, #-0x5C]
  000f0	e50b0060	 str       r0, [r11, #-0x60]
  000f4	e51b2054	 ldr       r2, [r11, #-0x54]
  000f8	e50b2058	 str       r2, [r11, #-0x58]
  000fc	e51b104c	 ldr       r1, [r11, #-0x4C]
  00100	e50b1050	 str       r1, [r11, #-0x50]
  00104	e51b0044	 ldr       r0, [r11, #-0x44]
  00108	e50b0048	 str       r0, [r11, #-0x48]
  0010c	e51b7040	 ldr       r7, [r11, #-0x40]
  00110	e51b603c	 ldr       r6, [r11, #-0x3C]
  00114		 |$L41595|

; 326  :     }
; 327  :     if (error != ERROR_SUCCESS) {

  00114	e35a0000	 cmp       r10, #0

; 328  :         return GetDiskStateError(pDisk->d_DiskCardState);

  00118	1599001c	 ldrne     r0, [r9, #0x1C]

; 326  :     }
; 327  :     if (error != ERROR_SUCCESS) {

  0011c	1a00002f	 bne       |$L41624|

; 329  :     }
; 330  : 
; 331  :     sectno++;

  00120	e2877001	 add       r7, r7, #1
  00124	e50b7040	 str       r7, [r11, #-0x40]

; 332  :     bytes_this_int = pDisk->d_DiskInfo.di_bytes_per_sect;

  00128	e5994024	 ldr       r4, [r9, #0x24]
  0012c		 |$aw_continue_sector$41298|

; 333  : 
; 334  : aw_continue_sector:
; 335  :     i = (bytes_this_sg < bytes_this_int) ? bytes_this_sg : bytes_this_int;

  0012c	e1510004	 cmp       r1, r4
  00130	e1a00001	 mov       r0, r1
  00134	21a00004	 movcs     r0, r4

; 336  :     bytes_this_sg -= i;

  00138	e0411000	 sub       r1, r1, r0
  0013c	e50b1050	 str       r1, [r11, #-0x50]
  00140	e50b104c	 str       r1, [r11, #-0x4C]

; 337  :     bytes_this_int -= i;

  00144	e0444000	 sub       r4, r4, r0
  00148	e50b4034	 str       r4, [r11, #-0x34]
  0014c		 |$L41600|

; 338  : 
; 339  :     try {
; 340  :         i = (i+1) / 2;

⌨️ 快捷键说明

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