📄 nandfls.cod
字号:
EXPORT |Nand_FMD_ReadSector|
EXPORT |??_C@_1FG@OONLMNOF@?$AAM?$AAa?$AAs?$AAs?$AA_?$AAF?$AAM?$AAD?$AA_?$AAR?$AAe?$AAa?$AAd?$AAS?$AAe?$AAc?$AAt?$AAo?$AAr?$AA?3@| [ DATA ] ; `string'
00044 AREA |.bss|, NOINIT
|g_bSectorInfo| % 0x40
00000 AREA |.text| { |Nand_FMD_ReadSector| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$Nand_FMD_ReadSector|, PDATA, SELECTION=5, ASSOC=|.text| { |Nand_FMD_ReadSector| } ; comdat associative
|$T36123| DCD |$L36122|
DCD 0x40004501
00000 AREA |.rdata| { |??_C@_1FG@OONLMNOF@?$AAM?$AAa?$AAs?$AAs?$AA_?$AAF?$AAM?$AAD?$AA_?$AAR?$AAe?$AAa?$AAd?$AAS?$AAe?$AAc?$AAt?$AAo?$AAr?$AA?3@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_1FG@OONLMNOF@?$AAM?$AAa?$AAs?$AAs?$AA_?$AAF?$AAM?$AAD?$AA_?$AAR?$AAe?$AAa?$AAd?$AAS?$AAe?$AAc?$AAt?$AAo?$AAr?$AA?3@| DCB "M"
DCB 0x0, "a", 0x0, "s", 0x0, "s", 0x0, "_", 0x0, "F", 0x0, "M"
DCB 0x0, "D", 0x0, "_", 0x0, "R", 0x0, "e", 0x0, "a", 0x0, "d"
DCB 0x0, "S", 0x0, "e", 0x0, "c", 0x0, "t", 0x0, "o", 0x0, "r"
DCB 0x0, ":", 0x0, " ", 0x0, "I", 0x0, "n", 0x0, "v", 0x0, "a"
DCB 0x0, "l", 0x0, "i", 0x0, "d", 0x0, " ", 0x0, "p", 0x0, "a"
DCB 0x0, "r", 0x0, "a", 0x0, "m", 0x0, "e", 0x0, "t", 0x0, "e"
DCB 0x0, "r", 0x0, "s", 0x0, "!", 0x0, 0xd, 0x0, 0xa, 0x0, 0x0
DCB 0x0 ; `string'
; Function compile flags: /Ogsy
00000 AREA |.text| { |Nand_FMD_ReadSector| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |Nand_FMD_ReadSector| PROC
; 251 : {
00000 |$L36122|
00000 e92d47f0 stmdb sp!, {r4 - r10, lr}
00004 |$M36120|
00004 e1a06003 mov r6, r3
00008 e1a05002 mov r5, r2
0000c e1b08001 movs r8, r1
00010 e1a07000 mov r7, r0
; 252 : DWORD i;
; 253 : #ifdef IMGENABLEECC
; 254 : BYTE *bpEcc;
; 255 : BYTE *bpECCBuff;
; 256 : DWORD j;
; 257 : BYTE bpCalECC[ECC_LEN];
; 258 : int iECCResult;
; 259 : #endif
; 260 :
; 261 : // RETAILMSG(1, (TEXT("FMD_ReadSector, addr = %d, num = %d, (%X, %X)\r\n"), startSectorAddr, dwNumSectors, pSectorBuff, pSectorInfoBuff));
; 262 :
; 263 : // Sanity check
; 264 : if(!pSectorBuff && !pSectorInfoBuff)
00014 1a000006 bne |$L35630|
00018 e3550000 cmp r5, #0
0001c 1a000004 bne |$L35630|
; 265 : {
; 266 : RETAILMSG(1, (TEXT( "Mass_FMD_ReadSector: Invalid parameters!\r\n")));
00020 e59f00e8 ldr r0, [pc, #0xE8]
00024 eb000000 bl NKDbgPrintfW
; 360 :
; 361 : READ_ERROR:
; 362 :
; 363 : return FALSE;
00028 e3a00000 mov r0, #0
0002c |$READ_ERROR$35632|
; 364 : }
0002c e8bd47f0 ldmia sp!, {r4 - r10, lr}
00030 e12fff1e bx lr
00034 |$L35630|
; 267 : goto READ_ERROR;
; 268 : }
; 269 :
; 270 : for(i = 0; i < dwNumSectors; i++)
00034 e3560000 cmp r6, #0
00038 0a000030 beq |$L35636|
0003c e59f40c8 ldr r4, [pc, #0xC8]
00040 e3a09000 mov r9, #0
00044 e3a0a030 mov r10, #0x30
00048 |$L35634|
; 271 : {
; 272 : if(pSectorBuff)
; 273 : {
; 274 : PXANandInputCmd(CMD_READ);
00048 e5943044 ldr r3, [r4, #0x44]
0004c e3580000 cmp r8, #0
; 275 : PXANandInputAdd(startSectorAddr, 0);
00050 e1a00007 mov r0, r7
00054 e5c39004 strb r9, [r3, #4]
00058 0a000011 beq |$L35637|
0005c e3a01000 mov r1, #0
00060 eb000000 bl |?PXANandInputAdd@@YAXKK@Z|
; 276 : PXANandInputCmd(CMD_READ_2);
00064 e5943044 ldr r3, [r4, #0x44]
00068 e5c3a004 strb r10, [r3, #4]
; 277 : NandDeviceReady();
0006c eb000000 bl |?NandDeviceReady@@YAXXZ|
; 278 : PXANandReadData(sg_PXANandFlash.Info.wDataBytesPerSector, pSectorBuff);
00070 e1d405be ldrh r0, [r4, #0x5E]
00074 e1a01008 mov r1, r8
00078 eb000000 bl |?PXANandReadData@@YAXKPAE@Z|
; 279 : #ifdef IMGENABLEECC
; 280 : PXANandReadData(ECC_PLUS_SECTORINFO, g_bSectorInfo);
; 281 : if(pSectorInfoBuff)
; 282 : {
; 283 : pSectorInfoBuff->bBadBlock = g_bSectorInfo[0];
; 284 : pSectorInfoBuff->bOEMReserved = g_bSectorInfo[1];
; 285 : pSectorInfoBuff->wReserved2 = *((WORD*)g_bSectorInfo + 1);
; 286 : pSectorInfoBuff->dwReserved1 = *((DWORD*)g_bSectorInfo + 1);
; 287 : pSectorInfoBuff++;
; 288 : }
; 289 : bpEcc = (BYTE *)(g_bSectorInfo + 8);
; 290 : bpECCBuff = pSectorBuff;
; 291 : for(j = 0; j < ECC_CAL_TIMES; j++)
; 292 : {
; 293 : // Test the data integrity; if the data is invalid, attempt to fix it using ECC
; 294 : NandCalECC(bpECCBuff, bpCalECC);
; 295 : iECCResult = NandCorrectData(bpECCBuff, bpEcc, bpCalECC);
; 296 : if(iECCResult == 1)
; 297 : {
; 298 : RETAILMSG(1,(TEXT("Mass_FMD_ReadSector: Invalid data was corrected using ECC!\r\n")));
; 299 : }
; 300 : else if(iECCResult == -1)
; 301 : {
; 302 : RETAILMSG(1,(TEXT("Mass_FMD_ReadSector: ERROR - Sector data (sector 0x%x) Unable to correct invalid data!\r\n"),startSectorAddr));
; 303 : goto READ_ERROR;
; 304 : }
; 305 : else if(iECCResult == 2)
; 306 : {
; 307 : RETAILMSG(1, (TEXT("Wrong ECC Code!\r\n")));
; 308 : }
; 309 : /*
; 310 : if(!Nand_ECC_IsDataValid(bpECCBuff, 512, bpEcc, ECC_BUFF_LEN))
; 311 : {
; 312 : if(!Nand_ECC_CorrectData(bpECCBuff, 512, bpEcc, ECC_BUFF_LEN))
; 313 : {
; 314 : // NOTE: this is specifically a debug message because sometimes it's valid to try to read from a sector in a good
; 315 : // block which might contain bogus data (ECC fails) - example: loader code that needs to save/restore non-block-aligned
; 316 : // data and we don't want a bunch of warnings in a retail build.
; 317 : RETAILMSG(1,(TEXT("Mass_FMD_ReadSector: ERROR - Sector data (sector 0x%x) Unable to correct invalid data!\r\n"),startSectorAddr));
; 318 :
; 319 : goto READ_ERROR;
; 320 : }
; 321 : else
; 322 : {
; 323 : RETAILMSG(1,(TEXT("Mass_FMD_ReadSector: Invalid data was corrected using ECC!\r\n")));
; 324 : }
; 325 : }
; 326 : */
; 327 : bpECCBuff += 512;
; 328 : bpEcc += ECC_LEN;
; 329 : }
; 330 : #else
; 331 : if(pSectorInfoBuff)
0007c e3550000 cmp r5, #0
00080 0a00001b beq |$L35641|
; 332 : {
; 333 : PXANandReadData(8, g_bSectorInfo);
00084 e5941044 ldr r1, [r4, #0x44]
00088 e3a02000 mov r2, #0
0008c |$L36095|
0008c e5d13000 ldrb r3, [r1]
00090 e7c23004 strb r3, [r2, +r4]
00094 e2822001 add r2, r2, #1
00098 e3520008 cmp r2, #8
0009c 3afffffa bcc |$L36095|
; 334 : pSectorInfoBuff->bBadBlock = g_bSectorInfo[0];
; 335 : pSectorInfoBuff->bOEMReserved = g_bSectorInfo[1];
; 336 : pSectorInfoBuff->wReserved2 = *((WORD*)g_bSectorInfo + 1);
; 337 : pSectorInfoBuff->dwReserved1 = *((DWORD*)g_bSectorInfo + 1);
; 338 : pSectorInfoBuff++;
; 339 : }
; 340 : #endif
; 341 : }
; 342 : else
000a0 ea00000b b |$L36119|
000a4 |$L35637|
; 343 : {
; 344 : PXANandInputCmd(CMD_READ);
; 345 : PXANandInputAdd(startSectorAddr, sg_PXANandFlash.Info.wDataBytesPerSector);
000a4 e1d415be ldrh r1, [r4, #0x5E]
000a8 eb000000 bl |?PXANandInputAdd@@YAXKK@Z|
; 346 : PXANandInputCmd(CMD_READ_2);
000ac e5943044 ldr r3, [r4, #0x44]
000b0 e5c3a004 strb r10, [r3, #4]
; 347 : NandDeviceReady();
000b4 eb000000 bl |?NandDeviceReady@@YAXXZ|
; 348 : PXANandReadData(8, g_bSectorInfo);
000b8 e5941044 ldr r1, [r4, #0x44]
000bc e3a02000 mov r2, #0
000c0 |$L36102|
000c0 e5d13000 ldrb r3, [r1]
000c4 e7c23004 strb r3, [r2, +r4]
000c8 e2822001 add r2, r2, #1
000cc e3520008 cmp r2, #8
000d0 3afffffa bcc |$L36102|
000d4 |$L36119|
; 349 : pSectorInfoBuff->bBadBlock = g_bSectorInfo[0];
000d4 e5d43000 ldrb r3, [r4]
000d8 e5c53005 strb r3, [r5, #5]
; 350 : pSectorInfoBuff->bOEMReserved = g_bSectorInfo[1];
000dc e5d43001 ldrb r3, [r4, #1]
000e0 e5c53004 strb r3, [r5, #4]
; 351 : pSectorInfoBuff->wReserved2 = *((WORD*)g_bSectorInfo + 1);
000e4 e1d430b2 ldrh r3, [r4, #2]
000e8 e1c530b6 strh r3, [r5, #6]
; 352 : pSectorInfoBuff->dwReserved1 = *((DWORD*)g_bSectorInfo + 1);
000ec e5943004 ldr r3, [r4, #4]
000f0 e4853008 str r3, [r5], #8
000f4 |$L35641|
; 353 : pSectorInfoBuff++;
; 354 : }
; 355 :
; 356 : startSectorAddr++;
000f4 e2877001 add r7, r7, #1
000f8 e2566001 subs r6, r6, #1
000fc 1affffd1 bne |$L35634|
00100 |$L35636|
; 357 : }
; 358 :
; 359 : return TRUE;
00100 e3a00001 mov r0, #1
; 364 : }
00104 e8bd47f0 ldmia sp!, {r4 - r10, lr}
00108 e12fff1e bx lr
0010c |$L36125|
0010c 00000000 DCD |g_bSectorInfo|
00110 00000000 DCD |??_C@_1FG@OONLMNOF@?$AAM?$AAa?$AAs?$AAs?$AA_?$AAF?$AAM?$AAD?$AA_?$AAR?$AAe?$AAa?$AAd?$AAS?$AAe?$AAc?$AAt?$AAo?$AAr?$AA?3@|
00114 |$M36121|
ENDP ; |Nand_FMD_ReadSector|
EXPORT |Nand_FMD_WriteSector|
EXPORT |??_C@_1FG@IIEAIPBG@?$AAM?$AAa?$AAs?$AAs?$AA_?$AAF?$AAM?$AAD?$AA_?$AAW?$AAr?$AAi?$AAt?$AAe?$AAS?$AAe?$AAc?$AAt?$AAo?$AAr@| [ DATA ] ; `string'
EXPORT |??_C@_1JG@PAJOOBDI@?$AAF?$AAM?$AAD?$AA_?$AAW?$AAr?$AAi?$AAt?$AAe?$AAS?$AAe?$AAc?$AAt?$AAo?$AAr?$AA?3?$AA?5?$AAU?$AAn?$AAa@| [ DATA ] ; `string'
00000 AREA |.text| { |Nand_FMD_WriteSector| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$Nand_FMD_WriteSector|, PDATA, SELECTION=5, ASSOC=|.text| { |Nand_FMD_WriteSector| } ; comdat associative
|$T36196| DCD |$L36195|
DCD 0x40006c01
00000 AREA |.rdata| { |??_C@_1JG@PAJOOBDI@?$AAF?$AAM?$AAD?$AA_?$AAW?$AAr?$AAi?$AAt?$AAe?$AAS?$AAe?$AAc?$AAt?$AAo?$AAr?$AA?3?$AA?5?$AAU?$AAn?$AAa@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_1JG@PAJOOBDI@?$AAF?$AAM?$AAD?$AA_?$AAW?$AAr?$AAi?$AAt?$AAe?$AAS?$AAe?$AAc?$AAt?$AAo?$AAr?$AA?3?$AA?5?$AAU?$AAn?$AAa@| DCB "F"
DCB 0x0, "M", 0x0, "D", 0x0, "_", 0x0, "W", 0x0, "r", 0x0, "i"
DCB 0x0, "t", 0x0, "e", 0x0, "S", 0x0, "e", 0x0, "c", 0x0, "t"
DCB 0x0, "o", 0x0, "r", 0x0, ":", 0x0, " ", 0x0, "U", 0x0, "n"
DCB 0x0, "a", 0x0, "b", 0x0, "l", 0x0, "e", 0x0, " ", 0x0, "t"
DCB 0x0, "o", 0x0, " ", 0x0, "F", 0x0, "M", 0x0, "D", 0x0, "_"
DCB 0x0, "W", 0x0, "r", 0x0, "i", 0x0, "t", 0x0, "e", 0x0, "S"
DCB 0x0, "e", 0x0, "c", 0x0, "t", 0x0, "o", 0x0, "r", 0x0, "("
DCB 0x0, "s", 0x0, "e", 0x0, "c", 0x0, "t", 0x0, "o", 0x0, "r"
DCB 0x0, " ", 0x0, "0", 0x0, "x", 0x0, "%", 0x0, "x", 0x0, ")"
DCB 0x0, ",", 0x0, " ", 0x0, "s", 0x0, "t", 0x0, "a", 0x0, "t"
DCB 0x0, "u", 0x0, "s", 0x0, "=", 0x0, "0", 0x0, "x", 0x0, "%"
DCB 0x0, "x", 0x0, " ", 0x0, "!", 0x0, "!", 0x0, "!", 0x0, 0xd
DCB 0x0, 0xa, 0x0, 0x0, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_1FG@IIEAIPBG@?$AAM?$AAa?$AAs?$AAs?$AA_?$AAF?$AAM?$AAD?$AA_?$AAW?$AAr?$AAi?$AAt?$AAe?$AAS?$AAe?$AAc?$AAt?$AAo?$AAr@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_1FG@IIEAIPBG@?$AAM?$AAa?$AAs?$AAs?$AA_?$AAF?$AAM?$AAD?$AA_?$AAW?$AAr?$AAi?$AAt?$AAe?$AAS?$AAe?$AAc?$AAt?$AAo?$AAr@| DCB "M"
DCB 0x0, "a", 0x0, "s", 0x0, "s", 0x0, "_", 0x0, "F", 0x0, "M"
DCB 0x0, "D", 0x0, "_", 0x0, "W", 0x0, "r", 0x0, "i", 0x0, "t"
DCB 0x0, "e", 0x0, "S", 0x0, "e", 0x0, "c", 0x0, "t", 0x0, "o"
DCB 0x0, "r", 0x0, ":", 0x0, " ", 0x0, "I", 0x0, "n", 0x0, "v"
DCB 0x0, "a", 0x0, "l", 0x0, "i", 0x0, "d", 0x0, " ", 0x0, "p"
DCB 0x0, "a", 0x0, "r", 0x0, "a", 0x0, "m", 0x0, "e", 0x0, "t"
DCB 0x0, "e", 0x0, "r", 0x0, "s", 0x0, "!", 0x0, 0xa, 0x0, 0x0
DCB 0x0 ; `string'
; Function compile flags: /Ogsy
00000 AREA |.text| { |Nand_FMD_WriteSector| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |Nand_FMD_WriteSector| PROC
; 370 : {
00000 |$L36195|
00000 e92d4ff0 stmdb sp!, {r4 - r11, lr}
00004 |$M36193|
00004 e1a0a003 mov r10, r3
00008 e1a04002 mov r4, r2
0000c e1b07001 movs r7, r1
00010 e1a06000 mov r6, r0
; 371 : DWORD i;
; 372 : BYTE status;
; 373 : #ifdef IMGENABLEECC
; 374 : BYTE *bpEcc;
; 375 : BYTE *bpECCBuff;
; 376 : DWORD j;
; 377 : #endif
; 378 : // RETAILMSG(1, (TEXT("FMD_WriteSector, addr = %d, num = %d, (%X, %X)\r\n"), startSectorAddr, dwNumSectors, pSectorBuff, pSectorInfoBuff));
; 379 :
; 380 : // Sanity check
; 381 : if(!pSectorBuff && !pSectorInfoBuff)
00014 1a000006 bne |$L35652|
00018 e3540000 cmp r4, #0
0001c 1a000004 bne |$L35652|
; 382 : {
; 383 : RETAILMSG(1, (TEXT("Mass_FMD_WriteSector: Invalid parameters!\n")));
00020 e59f0184 ldr r0, [pc, #0x184]
00024 eb000000 bl NKDbgPrintfW
; 456 :
; 457 : WRITE_ERROR:
; 458 :
; 459 : return FALSE;
00028 e3a00000 mov r0, #0
; 460 : }
0002c e8bd4ff0 ldmia sp!, {r4 - r11, lr}
00030 e12fff1e bx lr
00034 |$L35652|
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -