summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/hwstub/tools/lua/fiiox3ii.lua50
1 files changed, 50 insertions, 0 deletions
diff --git a/utils/hwstub/tools/lua/fiiox3ii.lua b/utils/hwstub/tools/lua/fiiox3ii.lua
new file mode 100644
index 0000000000..d393f46ab2
--- /dev/null
+++ b/utils/hwstub/tools/lua/fiiox3ii.lua
@@ -0,0 +1,50 @@
1--
2-- Fiio X3II
3--
4FIIOX3II = {}
5
6-- call with nil to get automatic name
7function FIIOX3II.dump_ipl(file)
8 if file == nil then
9 file = "fiio_x3ii_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)
16end
17
18-- call with nil to get automatic name
19function FIIOX3II.dump_spl(file)
20 if file == nil then
21 file = "fiio_x3ii_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 = 2,
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)
45end
46
47function FIIOX3II.dump()
48 FIIOX3II.dump_ipl(nil)
49 FIIOX3II.dump_spl(nil)
50end