freemyipod r675 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r674‎ | r675 | r676 >
Date:17:26, 26 March 2011
Author:farthen
Status:new
Tags:
Comment:
emcore tools: rename user memory to malloc pool, libemcore.getusermemrange() to libemcore.getmallocpoolbounds() and emcore.getinfo("usermemrange") to emcore.getinfo("mallocpoolbounds")
Modified paths:
  • /emcore/trunk/tools/emcore.py (modified) (history)
  • /emcore/trunk/tools/libemcore.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/emcore.py
@@ -156,7 +156,7 @@
157157 def getinfo(self, infotype):
158158 """
159159 Get info on the running emCORE.
160 - <infotype> may be either of 'version', 'packetsize', 'usermemrange'.
 160+ <infotype> may be either of 'version', 'packetsize', 'mallocpoolbounds'.
161161 """
162162 if infotype == "version":
163163 hwtype = gethwname(self.emcore.lib.dev.hwtypeid)
@@ -175,14 +175,14 @@
176176 self.logger.info("data out: %d\n" % self.emcore.lib.dev.packetsizelimit.dout, 4)
177177 self.logger.info("data in: %d\n" % self.emcore.lib.dev.packetsizelimit.din, 4)
178178
179 - elif infotype == "usermemrange":
180 - resp = self.emcore.getusermemrange()
181 - self.logger.info("The user memory range is 0x%X - 0x%X" % (
182 - self.emcore.lib.dev.usermem.lower,
183 - self.emcore.lib.dev.usermem.upper - 1))
 179+ elif infotype == "mallocpoolbounds":
 180+ resp = self.emcore.getmallocpoolbounds()
 181+ self.logger.info("The malloc pool is 0x%X - 0x%X" % (
 182+ self.emcore.lib.dev.mallocpool.lower,
 183+ self.emcore.lib.dev.mallocpool.upper - 1))
184184
185185 else:
186 - raise ArgumentTypeError("one out of 'version', 'packetsize', 'usermemrange'", infotype)
 186+ raise ArgumentTypeError("one out of 'version', 'packetsize', 'mallocpoolbounds'", infotype)
187187
188188 @command
189189 def reset(self, force=False):
Index: emcore/trunk/tools/libemcore.py
@@ -113,7 +113,7 @@
114114 raise DeviceError("Connected to unknown software type. Exiting")
115115
116116 self.getpacketsizeinfo()
117 - self.getusermemrange()
 117+ self.getmallocpoolbounds()
118118
119119 @staticmethod
120120 def _alignsplit(addr, size, blksize, align):
@@ -191,12 +191,12 @@
192192 return resp
193193
194194 @command()
195 - def getusermemrange(self):
196 - """ This returns the memory range the user has access to. """
 195+ def getmallocpoolbounds(self):
 196+ """ This returns the memory range of the malloc pool """
197197 resp = self.lib.monitorcommand(struct.pack("<IIII", 1, 2, 0, 0), "III", ("lower", "upper", None))
198 - self.logger.debug("Device user memory = 0x%X - 0x%X\n" % (resp.lower, resp.upper))
199 - self.lib.dev.usermem.lower = resp.lower
200 - self.lib.dev.usermem.upper = resp.upper
 198+ self.logger.debug("Malloc pool bounds = 0x%X - 0x%X\n" % (resp.lower, resp.upper))
 199+ self.lib.dev.mallocpool.lower = resp.lower
 200+ self.lib.dev.mallocpool.upper = resp.upper
201201 return resp
202202
203203 @command()
@@ -1037,9 +1037,9 @@
10381038 self.swtypeid = None
10391039 self.hwtypeid = None
10401040
1041 - self.usermem = Bunch()
1042 - self.usermem.lower = None
1043 - self.usermem.upper = None
 1041+ self.mallocpool = Bunch()
 1042+ self.mallocpool.lower = None
 1043+ self.mallocpool.upper = None
10441044
10451045 def __del__(self):
10461046 self.disconnect()