📄 flash.cod
字号:
001f0 e3833020 orr r3, r3, #0x20
001f4 e5823000 str r3, [r2]
; 285 : *gpulCurAddr = FLASH_BLOCK_ERASE_RESUME;
001f8 e59f30a4 ldr r3, [pc, #0xA4]
001fc e5932000 ldr r2, [r3]
00200 e3a0360d mov r3, #0xD, 12
00204 e38330d0 orr r3, r3, #0xD0
00208 e5823000 str r3, [r2]
; 286 : *gpulCurAddr = FLASH_READ_STATUS;
0020c e59f3090 ldr r3, [pc, #0x90]
00210 e5932000 ldr r2, [r3]
00214 e3a03607 mov r3, #7, 12
00218 e3833070 orr r3, r3, #0x70
0021c e5823000 str r3, [r2]
; 287 :
; 288 : //
; 289 : // Wait for the Flash block command to succeed.
; 290 : //
; 291 : bSuccess = WaitForReady(gpulCurAddr, 10000, EXT_STATUS_WBUFFER_READY);
00220 e3a03502 mov r3, #2, 10
00224 e3832080 orr r2, r3, #0x80
00228 e3a03c27 mov r3, #0x27, 24
0022c e3831010 orr r1, r3, #0x10
00230 e59f306c ldr r3, [pc, #0x6C]
00234 e5930000 ldr r0, [r3]
00238 eb000000 bl WaitForReady
0023c e58d0014 str r0, [sp, #0x14]
00240 e59d3014 ldr r3, [sp, #0x14]
00244 e58d3000 str r3, [sp]
; 292 : *gpulCurAddr = FLASH_CLEAR_STATUS;
00248 e59f3054 ldr r3, [pc, #0x54]
0024c e5932000 ldr r2, [r3]
00250 e3a03605 mov r3, #5, 12
00254 e3833050 orr r3, r3, #0x50
00258 e5823000 str r3, [r2]
; 293 :
; 294 : if(!bSuccess)
0025c e59d3000 ldr r3, [sp]
00260 e3530000 cmp r3, #0
00264 1a000000 bne |$L38129|
; 295 : {
; 296 : break;
00268 ea000007 b |$L38127|
0026c |$L38129|
; 297 : }
; 298 :
; 299 : //
; 300 : // Occasionally write out a dot so they don't think
; 301 : // the system is dead.
; 302 : //
; 303 : EdbgOutputDebugString(".");
0026c e59f0034 ldr r0, [pc, #0x34]
00270 eb000000 bl EdbgOutputDebugString
; 304 :
; 305 : //
; 306 : // Increment to the next block.
; 307 : //
; 308 : gpulCurAddr += FLASH_BLOCK_SIZE>>2;
00274 e59f3028 ldr r3, [pc, #0x28]
00278 e5933000 ldr r3, [r3]
0027c e2832701 add r2, r3, #1, 14
00280 e59f301c ldr r3, [pc, #0x1C]
00284 e5832000 str r2, [r3]
; 309 : }
00288 eaffffaa b |$L38126|
0028c |$L38127|
; 310 : return bSuccess;
0028c e59d3000 ldr r3, [sp]
00290 e58d3004 str r3, [sp, #4]
00294 |$L38118|
; 206 : {
; 207 : return TRUE;
00294 e59d0004 ldr r0, [sp, #4]
; 311 : }
00298 e28dd018 add sp, sp, #0x18
0029c e49de004 ldr lr, [sp], #4
002a0 e12fff1e bx lr
002a4 |$L38400|
002a4 00000000 DCD |gpulCurAddr|
002a8 00000000 DCD |??_C@_01LFCBOECM@?4?$AA@|
002ac 00000000 DCD |gdwLength|
002b0 00000000 DCD |gdwStartAddr|
002b4 00000000 DCD |gbUnlocked|
002b8 00000000 DCD |gbFlashEraseComplete|
002bc |$M38396|
ENDP ; |FinishEraseFlashJ3_2x16|
EXPORT |WriteFlashJ3_2x16|
EXPORT |??_C@_0CB@BBCEBAHK@FLASH_WRITE_TO_BUFFER?5?9?5Failed?6?4@| [ DATA ] ; `string'
EXPORT |??_C@_0BI@NJPDFMHF@pulBlockAddress?5?5?$DN?5?$CFx?4?6?$AA@| [ DATA ] ; `string'
EXPORT |??_C@_0BI@DAENKHLI@?$CKpulBlockAddress?5?$DN?5?$CFx?4?6?$AA@| [ DATA ] ; `string'
EXPORT |??_C@_0CK@IHGKIHOF@?$CKFLASH_READ_STATUS?5pulBlockAddre@| [ DATA ] ; `string'
EXPORT |??_C@_0CG@GDOOMMMM@FLASH_BLOCK_PROGRAM_RESUME?5?9?5Fai@| [ DATA ] ; `string'
IMPORT |GetSystemTimeInMsec|
IMPORT |DelayInuSec|
00000 AREA |.text| { |WriteFlashJ3_2x16| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$WriteFlashJ3_2x16|, PDATA, SELECTION=5, ASSOC=|.text| { |WriteFlashJ3_2x16| } ; comdat associative
|$T38407| DCD |$L38406|
DCD 0x4000b704
00000 AREA |.rdata| { |??_C@_0CG@GDOOMMMM@FLASH_BLOCK_PROGRAM_RESUME?5?9?5Fai@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CG@GDOOMMMM@FLASH_BLOCK_PROGRAM_RESUME?5?9?5Fai@| DCB "FLASH_BLOC"
DCB "K_PROGRAM_RESUME - Failed", 0xa, ".", 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CK@IHGKIHOF@?$CKFLASH_READ_STATUS?5pulBlockAddre@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CK@IHGKIHOF@?$CKFLASH_READ_STATUS?5pulBlockAddre@| DCB "*FLASH_RE"
DCB "AD_STATUS pulBlockAddress = %x.", 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0BI@DAENKHLI@?$CKpulBlockAddress?5?$DN?5?$CFx?4?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0BI@DAENKHLI@?$CKpulBlockAddress?5?$DN?5?$CFx?4?6?$AA@| DCB "*pulB"
DCB "lockAddress = %x.", 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0BI@NJPDFMHF@pulBlockAddress?5?5?$DN?5?$CFx?4?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0BI@NJPDFMHF@pulBlockAddress?5?5?$DN?5?$CFx?4?6?$AA@| DCB "pulBloc"
DCB "kAddress = %x.", 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CB@BBCEBAHK@FLASH_WRITE_TO_BUFFER?5?9?5Failed?6?4@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CB@BBCEBAHK@FLASH_WRITE_TO_BUFFER?5?9?5Failed?6?4@| DCB "FLASH_WR"
DCB "ITE_TO_BUFFER - Failed", 0xa, ".", 0x0 ; `string'
; Function compile flags: /Ods
00000 AREA |.text| { |WriteFlashJ3_2x16| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |WriteFlashJ3_2x16| PROC
; 331 : {
00000 |$L38406|
00000 e1a0c00d mov r12, sp
00004 e92d0007 stmdb sp!, {r0 - r2}
00008 e92d5000 stmdb sp!, {r12, lr}
0000c e24dd038 sub sp, sp, #0x38
00010 |$M38404|
; 332 : ULONG ulCount;
; 333 : ULONG ulEndCount;
; 334 : volatile PULONG pulBlockAddress;
; 335 : volatile PULONG pulDest, pulSource;
; 336 : USHORT usWordsToWrite;
; 337 : ULONG ulStart,ulCurrent;
; 338 : BOOL bSuccess;
; 339 : ULONG ulAddDelay;
; 340 :
; 341 : ulCount = 0;
00010 e3a03000 mov r3, #0
00014 e58d3018 str r3, [sp, #0x18]
; 342 : pulDest = (PULONG)dwDest;
00018 e59d3040 ldr r3, [sp, #0x40]
0001c e58d300c str r3, [sp, #0xC]
; 343 : pulSource = (PULONG)dwSource;
00020 e59d3044 ldr r3, [sp, #0x44]
00024 e58d3000 str r3, [sp]
00028 |$L38152|
; 344 :
; 345 : while( ulCount < dwLength)
00028 e59d2018 ldr r2, [sp, #0x18]
0002c e59d3048 ldr r3, [sp, #0x48]
00030 e1520003 cmp r2, r3
00034 2a000098 bcs |$L38153|
; 346 : {
; 347 : //
; 348 : // Calculate the block address
; 349 : //
; 350 : pulBlockAddress = (ULONG *)(((ULONG)&pulDest[ulCount>>2]) & FLASH_BLOCK_MASK);
00038 e59d3018 ldr r3, [sp, #0x18]
0003c e1a01123 mov r1, r3, lsr #2
00040 e3a03004 mov r3, #4
00044 e0020391 mul r2, r1, r3
00048 e59d300c ldr r3, [sp, #0xC]
0004c e0832002 add r2, r3, r2
00050 e3a034ff mov r3, #0xFF, 8
00054 e383373f orr r3, r3, #0x3F, 14
00058 e0023003 and r3, r2, r3
0005c e58d3014 str r3, [sp, #0x14]
; 351 : //
; 352 : // Write the Flash to buffer command until the flash is ready.
; 353 : //
; 354 : ulStart = GetSystemTimeInMsec();
00060 eb000000 bl GetSystemTimeInMsec
00064 e58d002c str r0, [sp, #0x2C]
00068 e59d302c ldr r3, [sp, #0x2C]
0006c e58d301c str r3, [sp, #0x1C]
; 355 : ulAddDelay = 1;
00070 e3a03001 mov r3, #1
00074 e58d3010 str r3, [sp, #0x10]
00078 |$L38156|
; 356 : do
; 357 : {
; 358 : *pulBlockAddress = FLASH_WRITE_TO_BUFFER;
00078 e59d2014 ldr r2, [sp, #0x14]
0007c e3a0373a mov r3, #0x3A, 14
00080 e38330e8 orr r3, r3, #0xE8
00084 e5823000 str r3, [r2]
; 359 : //
; 360 : // Check to make sure that we are not in a loop.
; 361 : //
; 362 : ulCurrent = GetSystemTimeInMsec();
00088 eb000000 bl GetSystemTimeInMsec
0008c e58d0030 str r0, [sp, #0x30]
00090 e59d3030 ldr r3, [sp, #0x30]
00094 e58d3008 str r3, [sp, #8]
; 363 : if(ulStart + 10000 <ulCurrent)
00098 e59d301c ldr r3, [sp, #0x1C]
0009c e2833c27 add r3, r3, #0x27, 24
000a0 e2832010 add r2, r3, #0x10
000a4 e59d3008 ldr r3, [sp, #8]
000a8 e1520003 cmp r2, r3
000ac 2a000011 bcs |$L38159|
; 364 : {
; 365 : EdbgOutputDebugString("FLASH_WRITE_TO_BUFFER - Failed\n.");
000b0 e59f0220 ldr r0, [pc, #0x220]
000b4 eb000000 bl EdbgOutputDebugString
; 366 : EdbgOutputDebugString("pulBlockAddress = %x.\n",(ULONG)pulBlockAddress);
000b8 e59d1014 ldr r1, [sp, #0x14]
000bc e59f0208 ldr r0, [pc, #0x208]
000c0 eb000000 bl EdbgOutputDebugString
; 367 : EdbgOutputDebugString("*pulBlockAddress = %x.\n",(ULONG)*pulBlockAddress);
000c4 e59d3014 ldr r3, [sp, #0x14]
000c8 e5931000 ldr r1, [r3]
000cc e59f01f4 ldr r0, [pc, #0x1F4]
000d0 eb000000 bl EdbgOutputDebugString
; 368 : *pulBlockAddress = FLASH_READ_STATUS;
000d4 e59d2014 ldr r2, [sp, #0x14]
000d8 e3a03607 mov r3, #7, 12
000dc e3833070 orr r3, r3, #0x70
000e0 e5823000 str r3, [r2]
; 369 : EdbgOutputDebugString("*FLASH_READ_STATUS pulBlockAddress = %x.\n",(ULONG)*pulBlockAddress);
000e4 e59d3014 ldr r3, [sp, #0x14]
000e8 e5931000 ldr r1, [r3]
000ec e59f01d0 ldr r0, [pc, #0x1D0]
000f0 eb000000 bl EdbgOutputDebugString
000f4 |$L38168|
; 370 : while(1);
000f4 eafffffe b |$L38168|
000f8 |$L38159|
; 372 : }
; 373 : DelayInuSec(ulAddDelay);
000f8 e59d0010 ldr r0, [sp, #0x10]
000fc eb000000 bl DelayInuSec
; 374 : ulAddDelay =(ulAddDelay<<1);
00100 e59d3010 ldr r3, [sp, #0x10]
00104 e1a03083 mov r3, r3, lsl #1
00108 e58d3010 str r3, [sp, #0x10]
; 375 : }
; 376 : while((*pulBlockAddress & EXT_STATUS_WBUFFER_READY)!= EXT_STATUS_WBUFFER_READY);
0010c e59d3014 ldr r3, [sp, #0x14]
00110 e5932000 ldr r2, [r3]
00114 e3a03502 mov r3, #2, 10
00118 e3833080 orr r3, r3, #0x80
0011c e0022003 and r2, r2, r3
00120 e3a03502 mov r3, #2, 10
00124 e3833080 orr r3, r3, #0x80
00128 e1520003 cmp r2, r3
0012c 1affffd1 bne |$L38156|
; 377 :
; 378 : //
; 379 : // Program the Flash size to be written.
; 380 : //
; 381 : usWordsToWrite = (FLASH_BUFFER_SIZE - 1)>>2;
00130 e3a0300f mov r3, #0xF
00134 e1cd32b4 strh r3, [sp, #0x24]
; 382 : *pulBlockAddress = (usWordsToWrite<<16) | usWordsToWrite;
00138 e1dd32b4 ldrh r3, [sp, #0x24]
0013c e1a02803 mov r2, r3, lsl #16
00140 e1dd32b4 ldrh r3, [sp, #0x24]
00144 e1822003 orr r2, r2, r3
00148 e59d3014 ldr r3, [sp, #0x14]
0014c e5832000 str r2, [r3]
; 383 :
; 384 : ulEndCount = ulCount + FLASH_BUFFER_SIZE;
00150 e59d3018 ldr r3, [sp, #0x18]
00154 e2833040 add r3, r3, #0x40
00158 e58d3020 str r3, [sp, #0x20]
0015c |$L38170|
; 385 : do
; 386 : {
; 387 : pulDest[ulCount>>2] = pulSource[ulCount>>2];
0015c e59d3018 ldr r3, [sp, #0x18]
00160 e1a01123 mov r1, r3, lsr #2
00164 e3a03004 mov r3, #4
00168 e0020391 mul r2, r1, r3
0016c e59d3000 ldr r3, [sp]
00170 e0830002 add r0, r3, r2
00174 e59d3018 ldr r3, [sp, #0x18]
00178 e1a01123 mov r1, r3, lsr #2
0017c e3a03004 mov r3, #4
00180 e0020391 mul r2, r1, r3
00184 e59d300c ldr r3, [sp, #0xC]
00188 e0832002 add r2, r3, r2
0018c e5903000 ldr r3, [r0]
00190 e5823000 str r3, [r2]
; 388 : ulCount += sizeof(ULONG);
00194 e59d3018 ldr r3, [sp, #0x18]
00198 e2833004 add r3, r3, #4
0019c e58d3018 str r3, [sp, #0x18]
001a0 |$L38174|
; 389 : //
; 390 : // Account for timing problem.
; 391 : //
; 392 : do
; 393 : {
; 394 : } while(!(*pulBlockAddress & EXT_STATUS_WBUFFER_READY) && (ulAddDelay-- != 0));
001a0 e59d3014 ldr r3, [sp, #0x14]
001a4 e5932000 ldr r2, [r3]
001a8 e3a03502 mov r3, #2, 10
001ac e3833080 orr r3, r3, #0x80
001b0 e1120003 tst r2, r3
001b4 1a000005 bne |$L38177|
001b8 e59d3010 ldr r3, [sp, #0x10]
001bc e3530000 cmp r3, #0
001c0 e59d3010 ldr r3, [sp, #0x10]
001c4 e2433001 sub r3, r3, #1
001c8 e58d3010 str r3, [sp, #0x10]
001cc 1afffff3 bne |$L38174|
001d0 |$L38177|
; 395 : } while(ulCount < ulEndCount);
001d0 e59d2018 ldr r2, [sp, #0x18]
001d4 e59d3020 ldr r3, [sp, #0x20]
001d8 e1520003 cmp r2, r3
001dc 3affffde bcc |$L38170|
; 396 :
; 397 : //
; 398 : // End of programming the block.
; 399 : //
; 400 : *pulBlockAddress = FLASH_BLOCK_PROGRAM_RESUME;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -