.text:00000160 ; FlashReadCmd(uint32 row) .text:00000160 .text:00000160 EXPORT FlashReadCmd .text:00000160 FlashReadCmd ; CODE XREF: FlashReadPage+74p .text:00000160 ; FlashReadPage+1B4p .text:00000160 STMFD SP!, {R4-R8,LR} .text:00000164 MOV R5, R0 .text:00000168 MOV R7, R5 .text:0000016C MOV R0, R5 .text:00000170 BL FlashGetChip .text:00000174 MOV R1, #0 .text:00000178 LDR R8, =(FlashReadStatusCmd+0x2110) ; FlashSpec .text:0000017C MOV R3, #0xB .text:00000180 B check_chip_num .text:00000184 ; --------------------------------------------------------------------------- .text:00000184 .text:00000184 loc_184 ; CODE XREF: FlashReadCmd+48j .text:00000184 SMULBB R2, R1, R3 .text:00000188 ADD R2, R8, R2,LSL#2 .text:0000018C LDR R2, [R2,#0x18] ; FlashSpec[i].TotPhySec .text:00000190 CMP R2, R5 .text:00000194 BHI loc_1AC ; FlashSpec[i].TotPhySec > row .text:00000198 SUB R5, R5, R2 ; row -= FlashSpec[i].TotPhySec .text:0000019C ADD R1, R1, #1 .text:000001A0 AND R1, R1, #0xFF ; cnt++ .text:000001A4 .text:000001A4 check_chip_num ; CODE XREF: FlashReadCmd+20j .text:000001A4 CMP R1, R0 ; r0 - FlashGetChip() .text:000001A4 ; r1 - cnt .text:000001A8 BCC loc_184 ; cnt < chip_num .text:000001AC .text:000001AC loc_1AC ; CODE XREF: FlashReadCmd+34j .text:000001AC SMULBB R0, R0, R3 .text:000001B0 MOV R2, #0x210 .text:000001B4 ADD R4, R8, R0,LSL#2 .text:000001B8 LDRB R0, [R4,#9] ; FlashSpec[chip_num].SecPerPageRaw .text:000001BC SUB R1, R0, #1 ; SecPerPageRaw - 1 .text:000001C0 AND R1, R1, R5 ; row % SecPerPageRaw .text:000001C4 MUL R1, R2, R1 ; (row % SecPerPageRaw) * 0x210 .text:000001C8 MOV R6, R1,LSL#16 .text:000001CC MOV R6, R6,LSR#16 ; & 0xffff .text:000001D0 MOV R1, R5 ; row .text:000001D4 BL __rt_udiv ; r0 = row / FlashSpec[chip_num].SecPerPageRaw .text:000001D8 LDRB R1, [R4,#1] ; Mulplane .text:000001DC CMP R1, #1 .text:000001E0 BLS nand_addr ; Mulplane <= 1 .text:000001E4 LDR R2, =FlashReadStatusCmd .text:000001E8 LDRH R1, [R8,#0xA] ; FlashSpec[0].SecPerBlock .text:000001EC LDRH R2, [R2,#2] ; SysAreaBlockRaw .text:000001F0 MUL R1, R2, R1 ; r1 = FlashSpec[0].SecPerBlock * SysAreaBlockRaw .text:000001F4 CMP R1, R7 .text:000001F8 BHI nand_addr ; r1 > row .text:000001FC LDRB R1, [R4,#6] ; FlashSpec[].Vonder??? .text:00000200 CMP R1, #1 .text:00000204 BNE not_Toshiba ; not Toshiba??? .text:00000208 LDRH R2, [R4,#0xE] ; PagePerBlock .text:0000020C LDR R1, [R4,#0x1C] ; TotBlks .text:00000210 MUL R1, R2, R1 ; r1 = PagePerBlock * TotBlks (totpages) .text:00000214 LDRB R2, [R4,#2] ; Interleave .text:00000218 ADD R3, R2, #1 ; r3 = (Interleave + 1) .text:0000021C MOV R12, R1,LSR R3 ; r12 = totpages >> (Interleave + 1) .text:00000220 SUB R3, R12, #1 ; r3 = (totpages >> (interleave + 1)) - 1 .text:00000224 AND R3, R3, R0,LSR#1 ; r3 = (row>>1) % (totpages >> interleaved + 1) .text:00000228 AND LR, R0, #1 ; LR = row & 1 .text:0000022C MUL R12, LR, R12 ; r12 = PagePerBlock * TotBlks >> (Interleave + 1) * LR .text:00000230 AND R0, R0, R1,LSR R2 ; r0 = row & (totpages>>Interleave) .text:00000234 ADD R0, R0, R12 .text:00000238 ADD R0, R0, R3 .text:0000023C B nand_addr .text:00000240 ; --------------------------------------------------------------------------- .text:00000240 .text:00000240 not_Toshiba ; CODE XREF: FlashReadCmd+A4j .text:00000240 LDRH R1, [R4,#0x10] ; PagePerBlockRaw .text:00000244 SUB R2, R1, #1 ; PagePerBlockRaw - 1 .text:00000248 AND R2, R2, R0,LSR#1 ; r2 = (PagePerBlockRaw - 1)&(SecPerPageRaw >>1) .text:0000024C LDRH R3, [R4,#0xE] ; PagePerBlock .text:00000250 SUB R3, R3, #1 ; PagePerBlock - 1 .text:00000254 BIC R3, R0, R3 ; r3 = SecPerPageRaw & ~(PagePerBlock - 1) .text:00000258 ADD R2, R3, R2 ; r2 = SecPerPageRaw ~(PagePerBlock-1) + (PagePerBlockRaw - 1)&(SecPerPageRaw >>1) .text:0000025C AND R0, R0, #1 ; r0 = SecPerPageRaw & 1 .text:00000260 MLA R0, R1, R0, R2 .text:00000264 .text:00000264 nand_addr ; CODE XREF: FlashReadCmd+80j .text:00000264 ; FlashReadCmd+98j ... .text:00000264 LDRB R2, [R4,#3] ; Large .text:00000268 MOV R1, #0 .text:0000026C CMP R2, #0 .text:00000270 BEQ small_block .text:00000274 LDR R2, [R4,#0x20] ; Cmd .text:00000278 STRB R1, [R2] ; Cmd = 0 .text:0000027C LDR R1, [R4,#0x24] ; Addr .text:00000280 STRB R6, [R1] ; Addr = r6 .text:00000284 LDR R2, [R4,#0x24] .text:00000288 MOV R1, R6,LSR#8 .text:0000028C STRB R1, [R2] ; Addr = r6>>8 .text:00000290 LDR R1, [R4,#0x24] .text:00000294 STRB R0, [R1] ; Addr = r0 .text:00000298 LDR R2, [R4,#0x24] .text:0000029C MOV R1, R0,LSR#8 .text:000002A0 STRB R1, [R2] ; Addr = r0>>8 .text:000002A4 LDRB R1, [R4,#4] ; Five .text:000002A8 CMP R1, #0 .text:000002AC BEQ cmd_read .text:000002B0 LDR R1, [R4,#0x24] .text:000002B4 MOV R0, R0,LSR#16 .text:000002B8 STRB R0, [R1] ; Addr = r0>>16 .text:000002BC .text:000002BC cmd_read ; CODE XREF: FlashReadCmd+14Cj .text:000002BC LDR R1, [R4,#0x20] ; Cmd .text:000002C0 MOV R0, #0x30 ; '0' .text:000002C4 STRB R0, [R1] ; Cmd = READ_CMD .text:000002C8 .text:000002C8 return ; CODE XREF: FlashReadCmd+19Cj .text:000002C8 LDMFD SP!, {R4-R8,PC} .text:000002CC ; --------------------------------------------------------------------------- .text:000002CC .text:000002CC small_block ; CODE XREF: FlashReadCmd+110j .text:000002CC LDR R2, [R4,#0x20] .text:000002D0 STRB R1, [R2] ; Cmd = READ0_CMD .text:000002D4 LDR R2, [R4,#0x24] .text:000002D8 STRB R1, [R2] ; Addr = 0 .text:000002DC LDR R1, [R4,#0x24] .text:000002E0 STRB R0, [R1] ; Addr = r0 .text:000002E4 LDR R2, [R4,#0x24] .text:000002E8 MOV R1, R0,LSR#8 .text:000002EC STRB R1, [R2] ; Addr = r0>>8 .text:000002F0 LDR R1, [R4,#0x24] .text:000002F4 MOV R0, R0,LSR#16 .text:000002F8 STRB R0, [R1] ; Addr = r0>>16 .text:000002FC B return .text:000002FC ; End of function FlashReadCmd .text:000002FC