Guest User

lua.x5ii

a guest
Nov 4th, 2016
115
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --
  2. -- Fiio X5II
  3. --
  4. FIIOX5II = {}
  5.  
  6. -- call with nil to get automatic name
  7. function FIIOX5II.dump_ipl(file)
  8. if file == nil then
  9. file = "fiio_x5ii_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 FIIOX5II.dump_spl(file)
  20. if file == nil then
  21. file = "fiio_x5ii_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)
  45. end
  46.  
  47. function FIIOX5II.dump()
  48. FIIOX5II.dump_ipl(nil)
  49. FIIOX5II.dump_spl(nil)
  50. end
RAW Paste Data