Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2011
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.37 KB | None | 0 0
  1. .text:00000160 ; FlashReadCmd(uint32 row)
  2. .text:00000160
  3. .text:00000160 EXPORT FlashReadCmd
  4. .text:00000160 FlashReadCmd ; CODE XREF: FlashReadPage+74p
  5. .text:00000160 ; FlashReadPage+1B4p
  6. .text:00000160 STMFD SP!, {R4-R8,LR}
  7. .text:00000164 MOV R5, R0
  8. .text:00000168 MOV R7, R5
  9. .text:0000016C MOV R0, R5
  10. .text:00000170 BL FlashGetChip
  11. .text:00000174 MOV R1, #0
  12. .text:00000178 LDR R8, =(FlashReadStatusCmd+0x2110) ; FlashSpec
  13. .text:0000017C MOV R3, #0xB
  14. .text:00000180 B check_chip_num
  15. .text:00000184 ; ---------------------------------------------------------------------------
  16. .text:00000184
  17. .text:00000184 loc_184 ; CODE XREF: FlashReadCmd+48j
  18. .text:00000184 SMULBB R2, R1, R3
  19. .text:00000188 ADD R2, R8, R2,LSL#2
  20. .text:0000018C LDR R2, [R2,#0x18] ; FlashSpec[i].TotPhySec
  21. .text:00000190 CMP R2, R5
  22. .text:00000194 BHI loc_1AC ; FlashSpec[i].TotPhySec > row
  23. .text:00000198 SUB R5, R5, R2 ; row -= FlashSpec[i].TotPhySec
  24. .text:0000019C ADD R1, R1, #1
  25. .text:000001A0 AND R1, R1, #0xFF ; cnt++
  26. .text:000001A4
  27. .text:000001A4 check_chip_num ; CODE XREF: FlashReadCmd+20j
  28. .text:000001A4 CMP R1, R0 ; r0 - FlashGetChip()
  29. .text:000001A4 ; r1 - cnt
  30. .text:000001A8 BCC loc_184 ; cnt < chip_num
  31. .text:000001AC
  32. .text:000001AC loc_1AC ; CODE XREF: FlashReadCmd+34j
  33. .text:000001AC SMULBB R0, R0, R3
  34. .text:000001B0 MOV R2, #0x210
  35. .text:000001B4 ADD R4, R8, R0,LSL#2
  36. .text:000001B8 LDRB R0, [R4,#9] ; FlashSpec[chip_num].SecPerPageRaw
  37. .text:000001BC SUB R1, R0, #1 ; SecPerPageRaw - 1
  38. .text:000001C0 AND R1, R1, R5 ; row % SecPerPageRaw
  39. .text:000001C4 MUL R1, R2, R1 ; (row % SecPerPageRaw) * 0x210
  40. .text:000001C8 MOV R6, R1,LSL#16
  41. .text:000001CC MOV R6, R6,LSR#16 ; & 0xffff
  42. .text:000001D0 MOV R1, R5 ; row
  43. .text:000001D4 BL __rt_udiv ; r0 = row / FlashSpec[chip_num].SecPerPageRaw
  44. .text:000001D8 LDRB R1, [R4,#1] ; Mulplane
  45. .text:000001DC CMP R1, #1
  46. .text:000001E0 BLS nand_addr ; Mulplane <= 1
  47. .text:000001E4 LDR R2, =FlashReadStatusCmd
  48. .text:000001E8 LDRH R1, [R8,#0xA] ; FlashSpec[0].SecPerBlock
  49. .text:000001EC LDRH R2, [R2,#2] ; SysAreaBlockRaw
  50. .text:000001F0 MUL R1, R2, R1 ; r1 = FlashSpec[0].SecPerBlock * SysAreaBlockRaw
  51. .text:000001F4 CMP R1, R7
  52. .text:000001F8 BHI nand_addr ; r1 > row
  53. .text:000001FC LDRB R1, [R4,#6] ; FlashSpec[].Vonder???
  54. .text:00000200 CMP R1, #1
  55. .text:00000204 BNE not_Toshiba ; not Toshiba???
  56. .text:00000208 LDRH R2, [R4,#0xE] ; PagePerBlock
  57. .text:0000020C LDR R1, [R4,#0x1C] ; TotBlks
  58. .text:00000210 MUL R1, R2, R1 ; r1 = PagePerBlock * TotBlks (totpages)
  59. .text:00000214 LDRB R2, [R4,#2] ; Interleave
  60. .text:00000218 ADD R3, R2, #1 ; r3 = (Interleave + 1)
  61. .text:0000021C MOV R12, R1,LSR R3 ; r12 = totpages >> (Interleave + 1)
  62. .text:00000220 SUB R3, R12, #1 ; r3 = (totpages >> (interleave + 1)) - 1
  63. .text:00000224 AND R3, R3, R0,LSR#1 ; r3 = (row>>1) % (totpages >> interleaved + 1)
  64. .text:00000228 AND LR, R0, #1 ; LR = row & 1
  65. .text:0000022C MUL R12, LR, R12 ; r12 = PagePerBlock * TotBlks >> (Interleave + 1) * LR
  66. .text:00000230 AND R0, R0, R1,LSR R2 ; r0 = row & (totpages>>Interleave)
  67. .text:00000234 ADD R0, R0, R12
  68. .text:00000238 ADD R0, R0, R3
  69. .text:0000023C B nand_addr
  70. .text:00000240 ; ---------------------------------------------------------------------------
  71. .text:00000240
  72. .text:00000240 not_Toshiba ; CODE XREF: FlashReadCmd+A4j
  73. .text:00000240 LDRH R1, [R4,#0x10] ; PagePerBlockRaw
  74. .text:00000244 SUB R2, R1, #1 ; PagePerBlockRaw - 1
  75. .text:00000248 AND R2, R2, R0,LSR#1 ; r2 = (PagePerBlockRaw - 1)&(SecPerPageRaw >>1)
  76. .text:0000024C LDRH R3, [R4,#0xE] ; PagePerBlock
  77. .text:00000250 SUB R3, R3, #1 ; PagePerBlock - 1
  78. .text:00000254 BIC R3, R0, R3 ; r3 = SecPerPageRaw & ~(PagePerBlock - 1)
  79. .text:00000258 ADD R2, R3, R2 ; r2 = SecPerPageRaw ~(PagePerBlock-1) + (PagePerBlockRaw - 1)&(SecPerPageRaw >>1)
  80. .text:0000025C AND R0, R0, #1 ; r0 = SecPerPageRaw & 1
  81. .text:00000260 MLA R0, R1, R0, R2
  82. .text:00000264
  83. .text:00000264 nand_addr ; CODE XREF: FlashReadCmd+80j
  84. .text:00000264 ; FlashReadCmd+98j ...
  85. .text:00000264 LDRB R2, [R4,#3] ; Large
  86. .text:00000268 MOV R1, #0
  87. .text:0000026C CMP R2, #0
  88. .text:00000270 BEQ small_block
  89. .text:00000274 LDR R2, [R4,#0x20] ; Cmd
  90. .text:00000278 STRB R1, [R2] ; Cmd = 0
  91. .text:0000027C LDR R1, [R4,#0x24] ; Addr
  92. .text:00000280 STRB R6, [R1] ; Addr = r6
  93. .text:00000284 LDR R2, [R4,#0x24]
  94. .text:00000288 MOV R1, R6,LSR#8
  95. .text:0000028C STRB R1, [R2] ; Addr = r6>>8
  96. .text:00000290 LDR R1, [R4,#0x24]
  97. .text:00000294 STRB R0, [R1] ; Addr = r0
  98. .text:00000298 LDR R2, [R4,#0x24]
  99. .text:0000029C MOV R1, R0,LSR#8
  100. .text:000002A0 STRB R1, [R2] ; Addr = r0>>8
  101. .text:000002A4 LDRB R1, [R4,#4] ; Five
  102. .text:000002A8 CMP R1, #0
  103. .text:000002AC BEQ cmd_read
  104. .text:000002B0 LDR R1, [R4,#0x24]
  105. .text:000002B4 MOV R0, R0,LSR#16
  106. .text:000002B8 STRB R0, [R1] ; Addr = r0>>16
  107. .text:000002BC
  108. .text:000002BC cmd_read ; CODE XREF: FlashReadCmd+14Cj
  109. .text:000002BC LDR R1, [R4,#0x20] ; Cmd
  110. .text:000002C0 MOV R0, #0x30 ; '0'
  111. .text:000002C4 STRB R0, [R1] ; Cmd = READ_CMD
  112. .text:000002C8
  113. .text:000002C8 return ; CODE XREF: FlashReadCmd+19Cj
  114. .text:000002C8 LDMFD SP!, {R4-R8,PC}
  115. .text:000002CC ; ---------------------------------------------------------------------------
  116. .text:000002CC
  117. .text:000002CC small_block ; CODE XREF: FlashReadCmd+110j
  118. .text:000002CC LDR R2, [R4,#0x20]
  119. .text:000002D0 STRB R1, [R2] ; Cmd = READ0_CMD
  120. .text:000002D4 LDR R2, [R4,#0x24]
  121. .text:000002D8 STRB R1, [R2] ; Addr = 0
  122. .text:000002DC LDR R1, [R4,#0x24]
  123. .text:000002E0 STRB R0, [R1] ; Addr = r0
  124. .text:000002E4 LDR R2, [R4,#0x24]
  125. .text:000002E8 MOV R1, R0,LSR#8
  126. .text:000002EC STRB R1, [R2] ; Addr = r0>>8
  127. .text:000002F0 LDR R1, [R4,#0x24]
  128. .text:000002F4 MOV R0, R0,LSR#16
  129. .text:000002F8 STRB R0, [R1] ; Addr = r0>>16
  130. .text:000002FC B return
  131. .text:000002FC ; End of function FlashReadCmd
  132. .text:000002FC
  133.  
  134.  
  135.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement