summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2016-10-23 21:52:59 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2017-01-24 15:25:14 +0100
commit06c5e5f4c1e1938aa38763d6e5661ba31e8f2ad4 (patch)
tree5bed19fcf5924739b584bd972cadacb1482671e0
parent3a219cefe1560692107afaffa7ce91c0a9f63279 (diff)
downloadrockbox-06c5e5f4c1e1938aa38763d6e5661ba31e8f2ad4.tar.gz
rockbox-06c5e5f4c1e1938aa38763d6e5661ba31e8f2ad4.zip
hwstub: add Fiio X3II IPL/SPL dumping code
Change-Id: I76f7cffc700e8051d02936c24e8a70a0f8925edf
-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 @@
+--
+-- Fiio X3II
+--
+FIIOX3II = {}
+
+-- call with nil to get automatic name
+function FIIOX3II.dump_ipl(file)
+ if file == nil then
+ file = "fiio_x3ii_ipl.bin"
+ end
+ print("Dumping IPL to " .. file .." ...")
+ JZ.nand.rom.init()
+ JZ.nand.rom.read_flags()
+ local ipl = JZ.nand.rom.read_bootloader()
+ JZ.nand.rom.write_to_file(file, ipl)
+end
+
+-- call with nil to get automatic name
+function FIIOX3II.dump_spl(file)
+ if file == nil then
+ file = "fiio_x3ii_spl.bin"
+ end
+ print("Dumping SPL to " .. file .." ...")
+ -- hardcoded parameters are specific to the Shangling M2
+ local nand_params = {
+ bus_width = 16,
+ row_cycle = 2,
+ col_cycle = 2,
+ page_size = 2048,
+ page_per_block = 64,
+ oob_size = 128,
+ badblock_pos = 0,
+ badblock_page = 0,
+ ecc_pos = 4,
+ ecc_size = 13,
+ ecc_level = 8,
+ addr_setup_time = 4,
+ addr_hold_time = 4,
+ write_strobe_time = 4,
+ read_strobe_time = 4,
+ recovery_time = 13,
+ }
+ local spl = JZ.nand.rom.read_spl(nand_params, 0x400, 0x200)
+ JZ.nand.rom.write_to_file(file, spl)
+end
+
+function FIIOX3II.dump()
+ FIIOX3II.dump_ipl(nil)
+ FIIOX3II.dump_spl(nil)
+end