diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2016-10-23 21:12:13 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2017-01-24 15:25:14 +0100 |
commit | 3a219cefe1560692107afaffa7ce91c0a9f63279 (patch) | |
tree | 077b6c495ec2673189e2fa3867ff69d9667840f2 | |
parent | 8e07d6845277efb96e067306f1ec9bc378c58bc0 (diff) | |
download | rockbox-3a219cefe1560692107afaffa7ce91c0a9f63279.tar.gz rockbox-3a219cefe1560692107afaffa7ce91c0a9f63279.zip |
hwstub: add Shanling M2 IPL/SPL dumping code
Change-Id: I14987d9783dd371f4990a5bcfbfb2d1c0c9be213
-rw-r--r-- | utils/hwstub/tools/lua/shanlingm2.lua | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/utils/hwstub/tools/lua/shanlingm2.lua b/utils/hwstub/tools/lua/shanlingm2.lua new file mode 100644 index 0000000000..c384900c51 --- /dev/null +++ b/utils/hwstub/tools/lua/shanlingm2.lua | |||
@@ -0,0 +1,50 @@ | |||
1 | -- | ||
2 | -- Shangling M2 | ||
3 | -- | ||
4 | M2 = {} | ||
5 | |||
6 | -- call with nil to get automatic name | ||
7 | function M2.dump_ipl(file) | ||
8 | if file == nil then | ||
9 | file = "shangling_m2_ipl.bin" | ||
10 | end | ||
11 | print("Dumping IPL to " .. file .." ...") | ||
12 | JZ.nand.rom.init() | ||
13 | JZ.nand.rom.read_flags() | ||
14 | local ipl = JZ.nand.rom.read_bootloader() | ||
15 | JZ.nand.rom.write_to_file(file, ipl) | ||
16 | end | ||
17 | |||
18 | -- call with nil to get automatic name | ||
19 | function M2.dump_spl(file) | ||
20 | if file == nil then | ||
21 | file = "shangling_m2_spl.bin" | ||
22 | end | ||
23 | print("Dumping SPL to " .. file .." ...") | ||
24 | -- hardcoded parameters are specific to the Shangling M2 | ||
25 | local nand_params = { | ||
26 | bus_width = 16, | ||
27 | row_cycle = 3, | ||
28 | col_cycle = 2, | ||
29 | page_size = 2048, | ||
30 | page_per_block = 64, | ||
31 | oob_size = 128, | ||
32 | badblock_pos = 0, | ||
33 | badblock_page = 0, | ||
34 | ecc_pos = 4, | ||
35 | ecc_size = 13, | ||
36 | ecc_level = 8, | ||
37 | addr_setup_time = 4, | ||
38 | addr_hold_time = 4, | ||
39 | write_strobe_time = 4, | ||
40 | read_strobe_time = 4, | ||
41 | recovery_time = 13, | ||
42 | } | ||
43 | local spl = JZ.nand.rom.read_spl(nand_params, 0x400, 0x200) | ||
44 | JZ.nand.rom.write_to_file(file, spl) | ||
45 | end | ||
46 | |||
47 | function M2.dump() | ||
48 | M2.dump_ipl(nil) | ||
49 | M2.dump_spl(nil) | ||
50 | end | ||