freemyipod r96 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r95‎ | r96 | r97 >
Date:16:16, 11 August 2010
Author:benedikt93
Status:new
Tags:
Comment:
add commands 22 & 23 to libembios.py and embios.py
Modified paths:
  • /embios/trunk/tools/embios.py (modified) (history)
  • /embios/trunk/tools/libembios.py (modified) (history)

Diff [purge]

Index: embios/trunk/tools/embios.py
@@ -172,6 +172,18 @@
173173 print " Executes the emBIOS executable image at <offset>."
174174 print ""
175175 print ""
 176+ print " readrawbootflash <addr_bootflsh> <addr_mem> <size>"
 177+ print " Reads <size> bytes from bootflash to memory."
 178+ print " <addr_bootflsh>: the address in bootflash to read from"
 179+ print " <addr_mem>: the address in memory to copy the data to"
 180+ print ""
 181+ print " writerawbootflash <addr_mem> <addr_bootflsh> <size>"
 182+ print " Writes <size> bytes from memory to bootflash."
 183+ print " Don't call this unless you really know what you're doing."
 184+ print " <addr_mem>: the address in memory to copy the data from"
 185+ print " <addr_bootflsh>: the address in bootflash to write to"
 186+ print ""
 187+ print ""
176188 print " flushcaches"
177189 print " Flushes the CPUs data and instruction caches."
178190 print ""
@@ -342,10 +354,18 @@
343355 dev.createthread(int(argv[2], 16), int(argv[3], 16), int(argv[4], 16), int(argv[5], 16), int(argv[6], 16), int(argv[7], 16), int(argv[8], 16))
344356
345357 elif argv[1] == "execimage":
346 - if len(argv) != 3: usage
 358+ if len(argv) != 3: usage()
347359 dev.execimage(int(argv[2], 16))
348360
349361
 362+ elif argv[1] == "readrawbootflash":
 363+ if len(argv) != 5: usage()
 364+ dev.readrawbootflash(int(argv[2]), int(argv[3]), int(argv[4]))
 365+
 366+ elif argv[1] == "writerawbootflash":
 367+ if len(argv) != 5: usage()
 368+ dev.writerawbootflash(int(argv[2]), int(argv[3]), int(argv[4]))
 369+
350370 elif argv[1] == "flushcaches":
351371 if len(argv) != 2: usage()
352372 dev.flushcaches()
Index: embios/trunk/tools/libembios.py
@@ -21,7 +21,7 @@
2222 #
2323 #
2424
25 -# note: handles commands 1 to 20
 25+# note: handles commands 1 to 21
2626
2727 import sys
2828 import math
@@ -1011,7 +1011,7 @@
10121012 return out
10131013
10141014
1015 - def execimage(self, offset):
 1015+ def execimage(self, offset, silent = 0):
10161016 self.__myprint("Executing emBIOS executable image at 0x%08x..." % offset, silent)
10171017
10181018 self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 18, threadid, 0, 0))
@@ -1025,6 +1025,29 @@
10261026
10271027 #=====================================================================================
10281028
 1029+
 1030+ def readrawbootflash(self, addr_bootflsh, addr_mem, size, silent = 0):
 1031+ self.__myprint("Reading 0x%x bytes from 0x%08x at bootflash to 0x%08x..." % (size, addr_bootflsh, addr_mem), silent)
 1032+
 1033+ self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 22, addr_mem, addr_bootflsh, size))
 1034+ response = self.__getbulk(self.handle, self.__cinep, 0x10)
 1035+ self.__checkstatus(response)
 1036+
 1037+ self.__myprint(" done\n", silent)
 1038+
 1039+
 1040+ def writerawbootflash(self, addr_mem, addr_bootflsh, size, silent = 0):
 1041+ self.__myprint("Writing 0x%x bytes from 0x%08x to bootflash at 0x%08x..." % (size, addr_fmem, addr_bootflsh), silent)
 1042+
 1043+ self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 23, addr_mem, addr_bootflsh, size))
 1044+ response = self.__getbulk(self.handle, self.__cinep, 0x10)
 1045+ self.__checkstatus(response)
 1046+
 1047+ self.__myprint(" done\n", silent)
 1048+
 1049+
 1050+#=====================================================================================
 1051+
10291052
10301053 def flushcaches(self, silent = 0):
10311054 self.__myprint("Flushing caches...", silent)