📄 m29w800dt.cod
字号:
; 144 :
; 145 : // reset the chip
; 146 : STIssueCmd(&s_STFlsInfo, ST_CMD_RESET);
0002c e5843024 str r3, [r4, #0x24]
00030 e2822c0a add r2, r2, #0xA, 24
00034 e3a060f0 mov r6, #0xF0
00038 e5841028 str r1, [r4, #0x28]
0003c e1c26aba strh r6, [r2, #0xAA]
; 147 :
; 148 : // change into autoselect mode
; 149 : STUnlockChip(&s_STFlsInfo);
00040 e5942024 ldr r2, [r4, #0x24]
00044 e5943000 ldr r3, [r4]
00048 e3a070aa mov r7, #0xAA
0004c e3a08055 mov r8, #0x55
00050 e18270b3 strh r7, [r2, +r3]
00054 e5942028 ldr r2, [r4, #0x28]
00058 e5943000 ldr r3, [r4]
; 150 : STIssueCmd(&s_STFlsInfo, ST_CMD_AUTOSEL);
0005c e3a09090 mov r9, #0x90
00060 e18280b3 strh r8, [r2, +r3]
00064 e5942020 ldr r2, [r4, #0x20]
00068 e5943000 ldr r3, [r4]
0006c e18290b3 strh r9, [r2, +r3]
; 151 :
; 152 : // read manufacture id and device id
; 153 : wMfgCode = STReadWord(&s_STFlsInfo, ST_MFG_CODE_OFF);
00070 e5943000 ldr r3, [r4]
00074 e1d310b0 ldrh r1, [r3]
; 154 : wDevCode = STReadWord(&s_STFlsInfo, ST_DEV_CODE_OFF);
00078 e1d350b2 ldrh r5, [r3, #2]
; 155 :
; 156 : if(ST_MFG_CODE == wMfgCode)
0007c e3510020 cmp r1, #0x20
00080 1a000002 bne |$L34286|
; 157 : {
; 158 : RETAILMSG(1, (TEXT("Detect Spansion Nor flash.\r\n")));
00084 e59f00e8 ldr r0, [pc, #0xE8]
00088 eb000000 bl NKDbgPrintfW
; 159 : }
; 160 : else
0008c ea00001e b |$L34652|
00090 |$L34286|
; 161 : {
; 162 : RETAILMSG(1, (TEXT("ERROR: Nor_FMD_Init: Bad manufacturer : Mfg=0x%x\r\n"), wMfgCode));
00090 e59f00d8 ldr r0, [pc, #0xD8]
00094 eb000000 bl NKDbgPrintfW
; 163 : s_STFlsInfo.stFlashCmd.dwEraseConfm = 0x50;
00098 e3a03050 mov r3, #0x50
0009c e584301c str r3, [r4, #0x1C]
; 164 : s_STFlsInfo.stFlashCmd.dwCmdAddr = (0x5555 << 1);
; 165 : s_STFlsInfo.stFlashCmd.dwUnlockAddr1 = (0x5555 << 1);
; 166 : s_STFlsInfo.stFlashCmd.dwUnlockAddr2 = (0x2AAA << 1);
000a0 e3a03caa mov r3, #0xAA, 24
000a4 e38330aa orr r3, r3, #0xAA
000a8 e3a02c55 mov r2, #0x55, 24
000ac e5843020 str r3, [r4, #0x20]
000b0 e3822054 orr r2, r2, #0x54
000b4 e5843024 str r3, [r4, #0x24]
000b8 e5842028 str r2, [r4, #0x28]
; 167 :
; 168 : // 尝试SST Flash
; 169 : // reset the chip
; 170 : STIssueCmd(&s_STFlsInfo, ST_CMD_RESET);
000bc e5943000 ldr r3, [r4]
000c0 e2833caa add r3, r3, #0xAA, 24
000c4 e1c36aba strh r6, [r3, #0xAA]
; 171 :
; 172 : // change into autoselect mode
; 173 : STUnlockChip(&s_STFlsInfo);
000c8 e5942024 ldr r2, [r4, #0x24]
000cc e5943000 ldr r3, [r4]
000d0 e18270b3 strh r7, [r2, +r3]
000d4 e5942028 ldr r2, [r4, #0x28]
000d8 e5943000 ldr r3, [r4]
000dc e18280b3 strh r8, [r2, +r3]
; 174 : STIssueCmd(&s_STFlsInfo, ST_CMD_AUTOSEL);
000e0 e5942020 ldr r2, [r4, #0x20]
000e4 e5943000 ldr r3, [r4]
000e8 e18290b3 strh r9, [r2, +r3]
; 175 :
; 176 : // read manufacture id and device id
; 177 : wMfgCode = STReadWord(&s_STFlsInfo, ST_MFG_CODE_OFF);
000ec e5942000 ldr r2, [r4]
000f0 e1d230b0 ldrh r3, [r2]
; 178 : wDevCode = STReadWord(&s_STFlsInfo, ST_DEV_CODE_OFF);
000f4 e1d250b2 ldrh r5, [r2, #2]
; 179 :
; 180 : if(wMfgCode == SST_MFG_CODE)
000f8 e35300bf cmp r3, #0xBF
000fc 1a000003 bne |$L34608|
; 181 : RETAILMSG(1, (TEXT("Detect SST Nor flash, code: 0x%x\r\n"), wDevCode));
00100 e59f0064 ldr r0, [pc, #0x64]
00104 e1a01005 mov r1, r5
00108 eb000000 bl NKDbgPrintfW
0010c |$L34652|
0010c e5942000 ldr r2, [r4]
00110 |$L34608|
; 182 :
; 183 : }
; 184 :
; 185 : // reset the chip
; 186 : STIssueCmd(&s_STFlsInfo, ST_CMD_RESET);
00110 e5943020 ldr r3, [r4, #0x20]
; 187 :
; 188 : s_STFlsInfo.pErsBlkRegion = s_STErsBlkInfo;
00114 e59f004c ldr r0, [pc, #0x4C]
; 189 : s_STFlsInfo.bBusWidth = 2;
; 190 : s_STFlsInfo.dwBlkNum = s_STFlsInfo.pErsBlkRegion[0].dwBlkNum;
; 191 : s_STFlsInfo.dwBlkSize = s_STFlsInfo.pErsBlkRegion[0].dwBlkSize;
; 192 : s_STFlsInfo.wUnusedBytesPerBlock = (USHORT)(s_STFlsInfo.dwBlkSize %(SECTOR_SIZE + sizeof(SectorInfo)) );
00118 e59f1044 ldr r1, [pc, #0x44]
0011c e18360b2 strh r6, [r3, +r2]
00120 e590e004 ldr lr, [r0, #4]
00124 e5902000 ldr r2, [r0]
00128 e3a06002 mov r6, #2
0012c e083119e umull r1, r3, lr, r1
00130 e5840008 str r0, [r4, #8]
00134 e5c46004 strb r6, [r4, #4]
00138 e584200c str r2, [r4, #0xC]
0013c e1a024a3 mov r2, r3, lsr #9
00140 e0823302 add r3, r2, r2, lsl #6
00144 e04e3183 sub r3, lr, r3, lsl #3
00148 e584e010 str lr, [r4, #0x10]
0014c e1c431b4 strh r3, [r4, #0x14]
; 193 : s_STFlsInfo.wSectorsPerBlock = (USHORT)(s_STFlsInfo.dwBlkSize / (SECTOR_SIZE + sizeof(SectorInfo)));
00150 e1c421b6 strh r2, [r4, #0x16]
; 194 : s_STFlsInfo.flashType = wDevCode;
00154 e5845018 str r5, [r4, #0x18]
; 195 :
; 196 : return (PVOID)s_STFlsInfo.dwBaseAddr;
00158 e5940000 ldr r0, [r4]
; 197 : }
0015c e8bd43f0 ldmia sp!, {r4 - r9, lr}
00160 e12fff1e bx lr
00164 |$L34658|
00164 fc0fc0fd DCD 0xfc0fc0fd
00168 00000000 DCD |s_STErsBlkInfo|
0016c 00000000 DCD |??_C@_1EG@CPNPAHEB@?$AAD?$AAe?$AAt?$AAe?$AAc?$AAt?$AA?5?$AAS?$AAS?$AAT?$AA?5?$AAN?$AAo?$AAr?$AA?5?$AAf?$AAl?$AAa?$AAs?$AAh@|
00170 00000000 DCD |??_C@_1GG@JGLKIKD@?$AAE?$AAR?$AAR?$AAO?$AAR?$AA?3?$AA?5?$AAN?$AAo?$AAr?$AA_?$AAF?$AAM?$AAD?$AA_?$AAI?$AAn?$AAi?$AAt?$AA?3@|
00174 00000000 DCD |??_C@_1DK@LLDFCACJ@?$AAD?$AAe?$AAt?$AAe?$AAc?$AAt?$AA?5?$AAS?$AAp?$AAa?$AAn?$AAs?$AAi?$AAo?$AAn?$AA?5?$AAN?$AAo?$AAr?$AA?5@|
00178 00000000 DCD |s_STFlsInfo|
0017c |$M34654|
ENDP ; |?Spansion_Nor_FMD_Init@@YAPAXPBGPAU_PCI_REG_INFO@@1@Z|, Spansion_Nor_FMD_Init
EXPORT |?Spansion_Nor_FMD_Deinit@@YAHPAX@Z| ; Spansion_Nor_FMD_Deinit
00000 AREA |.text| { |?Spansion_Nor_FMD_Deinit@@YAHPAX@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$?Spansion_Nor_FMD_Deinit@@YAHPAX@Z|, PDATA, SELECTION=5, ASSOC=|.text| { |?Spansion_Nor_FMD_Deinit@@YAHPAX@Z| } ; comdat associative
|$T34666| DCD |$L34665|
DCD 0x40000200
; Function compile flags: /Ogsy
00000 AREA |.text| { |?Spansion_Nor_FMD_Deinit@@YAHPAX@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |?Spansion_Nor_FMD_Deinit@@YAHPAX@Z| PROC ; Spansion_Nor_FMD_Deinit
; 206 : {
00000 |$L34665|
00000 |$M34663|
; 207 : return TRUE;
00000 e3a00001 mov r0, #1
; 208 : }
00004 e12fff1e bx lr
00008 |$M34664|
ENDP ; |?Spansion_Nor_FMD_Deinit@@YAHPAX@Z|, Spansion_Nor_FMD_Deinit
EXPORT |?Spansion_Nor_FMD_GetInfo@@YAHPAU_FlashInfo@@@Z| ; Spansion_Nor_FMD_GetInfo
00000 AREA |.text| { |?Spansion_Nor_FMD_GetInfo@@YAHPAU_FlashInfo@@@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$?Spansion_Nor_FMD_GetInfo@@YAHPAU_FlashInfo@@@Z|, PDATA, SELECTION=5, ASSOC=|.text| { |?Spansion_Nor_FMD_GetInfo@@YAHPAU_FlashInfo@@@Z| } ; comdat associative
|$T34676| DCD |$L34675|
DCD 0x40001101
; Function compile flags: /Ogsy
00000 AREA |.text| { |?Spansion_Nor_FMD_GetInfo@@YAHPAU_FlashInfo@@@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |?Spansion_Nor_FMD_GetInfo@@YAHPAU_FlashInfo@@@Z| PROC ; Spansion_Nor_FMD_GetInfo
; 222 : {
00000 |$L34675|
00000 e52de004 str lr, [sp, #-4]!
00004 |$M34673|
00004 e1a01000 mov r1, r0
; 223 : pFlashInfo->flashType = NOR;
; 224 : pFlashInfo->dwNumBlocks = s_STFlsInfo.dwBlkNum;
00008 e59f2030 ldr r2, [pc, #0x30]
0000c e3a03001 mov r3, #1
00010 e5813000 str r3, [r1]
00014 e592300c ldr r3, [r2, #0xC]
; 225 : pFlashInfo->dwBytesPerBlock = s_STFlsInfo.dwBlkSize;
; 226 : pFlashInfo->wDataBytesPerSector = SECTOR_SIZE;
00018 e3a0ec02 mov lr, #2, 24
; 227 : pFlashInfo->wSectorsPerBlock = s_STFlsInfo.wSectorsPerBlock;
; 228 : return(TRUE);
0001c e3a00001 mov r0, #1
00020 e5813004 str r3, [r1, #4]
00024 e5923010 ldr r3, [r2, #0x10]
00028 e1c1e0be strh lr, [r1, #0xE]
0002c e5813008 str r3, [r1, #8]
00030 e1d231b6 ldrh r3, [r2, #0x16]
00034 e1c130bc strh r3, [r1, #0xC]
; 229 : }
00038 e49de004 ldr lr, [sp], #4
0003c e12fff1e bx lr
00040 |$L34678|
00040 00000000 DCD |s_STFlsInfo|
00044 |$M34674|
ENDP ; |?Spansion_Nor_FMD_GetInfo@@YAHPAU_FlashInfo@@@Z|, Spansion_Nor_FMD_GetInfo
EXPORT |?Spansion_Nor_FMD_ReadSector@@YAHKPAEPAU_SectorInfo@@K@Z| ; Spansion_Nor_FMD_ReadSector
IMPORT |__rt_udiv|
IMPORT |memcpy|
00000 AREA |.text| { |?Spansion_Nor_FMD_ReadSector@@YAHKPAEPAU_SectorInfo@@K@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$?Spansion_Nor_FMD_ReadSector@@YAHKPAEPAU_SectorInfo@@K@Z|, PDATA, SELECTION=5, ASSOC=|.text| { |?Spansion_Nor_FMD_ReadSector@@YAHKPAEPAU_SectorInfo@@K@Z| } ; comdat associative
|$T34696| DCD |$L34695|
DCD 0x40003f02
; Function compile flags: /Ogsy
00000 AREA |.text| { |?Spansion_Nor_FMD_ReadSector@@YAHKPAEPAU_SectorInfo@@K@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |?Spansion_Nor_FMD_ReadSector@@YAHKPAEPAU_SectorInfo@@K@Z| PROC ; Spansion_Nor_FMD_ReadSector
; 247 : {
00000 |$L34695|
00000 e92d4ff0 stmdb sp!, {r4 - r11, lr}
00004 e24dd004 sub sp, sp, #4
00008 |$M34693|
00008 e3530000 cmp r3, #0
0000c e1a06002 mov r6, r2
00010 e1a05001 mov r5, r1
00014 e1a04000 mov r4, r0
; 248 : volatile SECTOR_ADDR physicalSectorAddr = 0;
00018 e3a02000 mov r2, #0
0001c e58d2000 str r2, [sp]
; 249 : BLOCK_ID blockID = 0;
; 250 : DWORD i = 0;
; 251 :
; 252 : //----- 1. Check the input parameters -----
; 253 : // NOTE: The FAL insures that the starting sector address is in the allowable range.
; 254 : if((dwNumSectors == 0) || ((pSectorBuff == NULL) && (pSectorInfoBuff == NULL)))
00020 0a000030 beq |$L34313|
00024 e3550000 cmp r5, #0
00028 1a000001 bne |$L34312|
0002c e3560000 cmp r6, #0
00030 0a00002c beq |$L34313|
00034 |$L34312|
; 257 : }
; 258 :
; 259 : //----- 2. Process the read request(s)... -----
; 260 : for(i = startSectorAddr ; i < (startSectorAddr + dwNumSectors) ; i++)
00034 e0848003 add r8, r4, r3
00038 e1540008 cmp r4, r8
0003c 2a000027 bcs |$L34316|
00040 e59fa0b0 ldr r10, [pc, #0xB0]
00044 e0843304 add r3, r4, r4, lsl #6
00048 e1a07484 mov r7, r4, lsl #9
0004c e59ab02c ldr r11, [r10, #0x2C]
00050 e1a09183 mov r9, r3, lsl #3
00054 |$L34314|
; 261 : {
; 262 : //----- Determine the block this physical sector resides in -----
; 263 : blockID = (i / s_STFlsInfo.wSectorsPerBlock);
; 264 :
; 265 : //----- Compute the physical address for the requested -----
; 266 : // Note we do this differently based on whether the caller wants us to read the sector information structure as well. Since we're
; 267 : // dealing with a NOR flash which is XIP-able, one might want to use this function to read from an XIP region (i.e., no sector information
; 268 : // structures in flash).
; 269 : //
; 270 : if (!s_bXIPMode)
00054 e35b0000 cmp r11, #0
00058 1a000007 bne |$L34317|
0005c e1da01b6 ldrh r0, [r10, #0x16]
00060 e1a01004 mov r1, r4
00064 eb000000 bl __rt_udiv
00068 e1da31b4 ldrh r3, [r10, #0x14]
0006c e59a2000 ldr r2, [r10]
00070 e0239390 mla r3, r0, r3, r9
; 271 : physicalSectorAddr = s_STFlsInfo.dwBaseAddr + i*(SECTOR_SIZE + sizeof(SectorInfo)) + (blockID * s_STFlsInfo.wUnusedBytesPerBlock);
00074 e0833002 add r3, r3, r2
; 272 : else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -