freemyipod r518 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r517‎ | r518 | r519 >
Date:02:44, 5 February 2011
Author:farthen
Status:new
Tags:
Comment:
emcore tools: Improve readability for even more strings, make all hex representations of numbers the same case.
Modified paths:
  • /emcore/trunk/tools/emcore.py (modified) (history)
  • /emcore/trunk/tools/libemcore.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/emcore.py
@@ -1187,7 +1187,7 @@
11881188 size = self._hexint(size)
11891189 self.logger.info("Allocating %d bytes of memory\n" % size)
11901190 addr = self.emcore.malloc(size)
1191 - self.logger.info("Allocated %d bytes of memory at 0x%x\n" % (size, addr))
 1191+ self.logger.info("Allocated %d bytes of memory at 0x%X\n" % (size, addr))
11921192
11931193 @command
11941194 def memalign(self, align, size):
@@ -1194,9 +1194,9 @@
11951195 """ Allocates <size> bytes aligned to <align> and returns a pointer to the allocated memory """
11961196 align = self._hexint(align)
11971197 size = self._hexint(size)
1198 - self.logger.info("Allocating %d bytes of memory aligned to 0x%x\n" % (size, align))
 1198+ self.logger.info("Allocating %d bytes of memory aligned to 0x%X\n" % (size, align))
11991199 addr = self.emcore.memalign(align, size)
1200 - self.logger.info("Allocated %d bytes of memory at 0x%x\n" % (size, addr))
 1200+ self.logger.info("Allocated %d bytes of memory at 0x%X\n" % (size, addr))
12011201
12021202 @command
12031203 def realloc(self, ptr, size):
@@ -1206,9 +1206,9 @@
12071207 """
12081208 ptr = self._hexint(ptr)
12091209 size = self._hexint(size)
1210 - self.logger.info("Reallocating 0x%x to have the new size %d\n" % (ptr, size))
 1210+ self.logger.info("Reallocating 0x%X to have the new size %d\n" % (ptr, size))
12111211 addr = self.emcore.realloc(ptr, size)
1212 - self.logger.info("Reallocated memory at 0x%x to 0x%x with the new size %d\n" % (ptr, addr, size))
 1212+ self.logger.info("Reallocated memory at 0x%X to 0x%X with the new size %d\n" % (ptr, addr, size))
12131213
12141214 @command
12151215 def reownalloc(self, ptr, owner):
@@ -1215,17 +1215,17 @@
12161216 """ Changes the owner of the memory allocation <ptr> to the thread struct at addr <owner> """
12171217 ptr = self._hexint(ptr)
12181218 owner = self._hexint(owner)
1219 - self.logger.info("Changing owner of the memory region 0x%x to 0x%x\n" % (ptr, owner))
 1219+ self.logger.info("Changing owner of the memory region 0x%X to 0x%X\n" % (ptr, owner))
12201220 self.emcore.reownalloc(ptr, owner)
1221 - self.logger.info("Successfully changed owner of 0x%x to 0x%x\n" % (ptr, owner))
 1221+ self.logger.info("Successfully changed owner of 0x%X to 0x%X\n" % (ptr, owner))
12221222
12231223 @command
12241224 def free(self, ptr):
12251225 """ Frees the memory space pointed to by 'ptr' """
12261226 ptr = self._hexint(ptr)
1227 - self.logger.info("Freeing the memory region at 0x%x\n" % ptr)
 1227+ self.logger.info("Freeing the memory region at 0x%X\n" % ptr)
12281228 self.emcore.free(ptr)
1229 - self.logger.info("Successfully freed the memory region at 0x%x\n" % ptr)
 1229+ self.logger.info("Successfully freed the memory region at 0x%X\n" % ptr)
12301230
12311231 @command
12321232 def free_all(self):
Index: emcore/trunk/tools/libemcore.py
@@ -67,7 +67,8 @@
6868 # precommand stuff
6969 if target is not None:
7070 if self.lib.dev.hwtypeid != target:
71 - raise DeviceError("Wrong device for target-specific command. Expected \'" + gethwname(target) + "\' but got \'" + gethwname(self.lib.dev.hwtypeid) + "\'")
 71+ raise DeviceError("Wrong device for target-specific command. Expected \'%s\' but got \'%s\'" %
 72+ (gethwname(target), gethwname(self.lib.dev.hwtypeid)))
7273 timeout = None
7374 if "timeout" in kwargs.keys():
7475 timeout = kwargs['timeout']
@@ -169,9 +170,9 @@
170171 self.lib.dev.version.majorv = resp.majorv
171172 self.lib.dev.version.minorv = resp.minorv
172173 self.lib.dev.version.patchv = resp.patchv
173 - self.logger.debug("Device Software Type ID = " + str(resp.swtypeid) + "\n")
 174+ self.logger.debug("Device Software Type ID = 0x%X\n" % resp.swtypeid)
174175 self.lib.dev.swtypeid = resp.swtypeid
175 - self.logger.debug("Device Hardware Type ID = " + str(resp.hwtypeid) + "\n")
 176+ self.logger.debug("Device Hardware Type ID = 0x%X\n" % resp.hwtypeid)
176177 self.lib.dev.hwtypeid = resp.hwtypeid
177178 return resp
178179
@@ -181,13 +182,13 @@
182183 It also sets the properties of the device object accordingly.
183184 """
184185 resp = self.lib.monitorcommand(struct.pack("IIII", 1, 1, 0, 0), "HHII", ("coutmax", "cinmax", "doutmax", "dinmax"))
185 - self.logger.debug("Device cout packet size limit = " + str(resp.coutmax) + "\n")
 186+ self.logger.debug("Device cout packet size limit = %d\n" % resp.coutmax)
186187 self.lib.dev.packetsizelimit.cout = resp.coutmax
187 - self.logger.debug("Device cin packet size limit = " + str(resp.cinmax) + "\n")
 188+ self.logger.debug("Device cin packet size limit = %d\n" % resp.cinmax)
188189 self.lib.dev.packetsizelimit.cin = resp.cinmax
189 - self.logger.debug("Device din packet size limit = " + str(resp.doutmax) + "\n")
 190+ self.logger.debug("Device din packet size limit = %d\n" % resp.doutmax)
190191 self.lib.dev.packetsizelimit.din = resp.dinmax
191 - self.logger.debug("Device dout packet size limit = " + str(resp.dinmax) + "\n")
 192+ self.logger.debug("Device dout packet size limit = %d\n" % resp.dinmax)
192193 self.lib.dev.packetsizelimit.dout = resp.doutmax
193194 return resp
194195
@@ -195,7 +196,7 @@
196197 def getusermemrange(self):
197198 """ This returns the memory range the user has access to. """
198199 resp = self.lib.monitorcommand(struct.pack("IIII", 1, 2, 0, 0), "III", ("lower", "upper", None))
199 - self.logger.debug("Device user memory = 0x%x - 0x%x\n" % (resp.lower, resp.upper))
 200+ self.logger.debug("Device user memory = 0x%X - 0x%X\n" % (resp.lower, resp.upper))
200201 self.lib.dev.usermem.lower = resp.lower
201202 self.lib.dev.usermem.upper = resp.upper
202203 return resp
@@ -226,7 +227,7 @@
227228 din_maxsize = self.lib.dev.packetsizelimit.din
228229 data = ""
229230 (headsize, bodysize, tailsize) = self._alignsplit(addr, size, cin_maxsize, 16)
230 - self.logger.debug("Downloading %d bytes from 0x%x, split as (%d/%d/%d)\n" % (size, addr, headsize, bodysize, tailsize))
 231+ self.logger.debug("Downloading %d bytes from 0x%X, split as (%d/%d/%d)\n" % (size, addr, headsize, bodysize, tailsize))
231232 if headsize != 0:
232233 data += self._readmem(addr, headsize)
233234 addr += headsize
@@ -252,7 +253,7 @@
253254 cout_maxsize = self.lib.dev.packetsizelimit.cout - self.lib.headersize
254255 dout_maxsize = self.lib.dev.packetsizelimit.dout
255256 (headsize, bodysize, tailsize) = self._alignsplit(addr, len(data), cout_maxsize, 16)
256 - self.logger.debug("Uploading %d bytes to 0x%x, split as (%d/%d/%d)\n" % (len(data), addr, headsize, bodysize, tailsize))
 257+ self.logger.debug("Uploading %d bytes to 0x%X, split as (%d/%d/%d)\n" % (len(data), addr, headsize, bodysize, tailsize))
257258 offset = 0
258259 if headsize != 0:
259260 self._writemem(addr, data[offset:offset+headsize])
@@ -380,7 +381,7 @@
381382 id = 0
382383 while structptr != 0:
383384 threadstruct = scheduler_thread()
384 - self.logger.debug("Reading thread struct of thread at 0x%x\n" % structptr)
 385+ self.logger.debug("Reading thread struct of thread at 0x%X\n" % structptr)
385386 threaddata = self.read(structptr, ctypes.sizeof(scheduler_thread))
386387 threadstruct._from_string(threaddata)
387388 threadstruct = threadstruct._to_bunch()
@@ -440,7 +441,7 @@
441442 raise ArgumentError("State must be either 'ready' or 'suspended'")
442443 resp = self.lib.monitorcommand(struct.pack("IIIIIIII", 19, nameptr, entrypoint, stackptr, stacksize, threadtype, priority, state), "III", ("threadptr", None, None))
443444 if resp.threadptr < 0:
444 - raise DeviceError("The device returned the error code "+str(resp.threadptr))
 445+ raise DeviceError("The device returned the error code %d" % resp.threadptr)
445446 return resp
446447
447448 @command()
@@ -480,7 +481,7 @@
481482 @command()
482483 def execfirmware(self, targetaddr, addr, size):
483484 """ Moves the firmware at 'addr' with size 'size' to 'targetaddr' and passes all control to it. """
484 - self.logger.debug("Moving firmware at 0x%x with the size %d to 0x%x and executing it\n" % (addr, size, targetaddr))
 485+ self.logger.debug("Moving firmware at 0x%X with the size %d to 0x%X and executing it\n" % (addr, size, targetaddr))
485486 return self.lib.monitorcommand(struct.pack("IIII", 24, targetaddr, addr, size))
486487
487488 @command(timeout = 30000)
@@ -594,9 +595,9 @@
595596 @command(timeout = 50000)
596597 def storage_read_sectors_md(self, volume, sector, count, addr):
597598 """ Read sectors from as storage device """
598 - self.logger.debug("Reading %d sectors from disk at volume %d, sector %d to memory at 0x%x\n" % (count, volume, sector, addr))
 599+ self.logger.debug("Reading %d sectors from disk at volume %d, sector %d to memory at 0x%X\n" % (count, volume, sector, addr))
599600 result = self.lib.monitorcommand(struct.pack("IIQIIII", 28, volume, sector, count, addr, 0, 0), "III", ("rc", None, None))
600 - self.logger.debug("Read sectors, result: 0x%x\n" % result.rc)
 601+ self.logger.debug("Read sectors, result: 0x%X\n" % result.rc)
601602 if result.rc > 0x80000000:
602603 raise DeviceError("storage_read_sectors_md(volume=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (volume, sector, count, addr, rc))
603604
@@ -603,9 +604,9 @@
604605 @command(timeout = 50000)
605606 def storage_write_sectors_md(self, volume, sector, count, addr):
606607 """ Read sectors from as storage device """
607 - self.logger.debug("Writing %d sectors from memory at 0x%x to disk at volume %d, sector %d\n" % (count, addr, volume, sector))
 608+ self.logger.debug("Writing %d sectors from memory at 0x%X to disk at volume %d, sector %d\n" % (count, addr, volume, sector))
608609 result = self.lib.monitorcommand(struct.pack("IIQIIII", 29, volume, sector, count, addr, 0, 0), "III", ("rc", None, None))
609 - self.logger.debug("Wrote sectors, result: 0x%x\n" % result.rc)
 610+ self.logger.debug("Wrote sectors, result: 0x%X\n" % result.rc)
610611 if result.rc > 0x80000000:
611612 raise DeviceError("storage_write_sectors_md(volume=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (volume, sector, count, addr, rc))
612613
@@ -625,13 +626,13 @@
626627 result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(filename), 30, mode, 0, 0, filename, 0), "III", ("fd", None, None))
627628 if result.fd > 0x80000000:
628629 raise DeviceError("file_open(filename=\"%s\", mode=0x%X) failed with RC=0x%08X, errno=%d" % (filename, mode, result.fd, self.errno()))
629 - self.logger.debug("Opened file as handle 0x%x\n" % result.fd)
 630+ self.logger.debug("Opened file as handle 0x%X\n" % result.fd)
630631 return result.fd
631632
632633 @command(timeout = 30000)
633634 def file_size(self, fd):
634635 """ Gets the size of a file referenced by a handle """
635 - self.logger.debug("Getting file size of handle 0x%x\n" % fd)
 636+ self.logger.debug("Getting file size of handle 0x%X\n" % fd)
636637 result = self.lib.monitorcommand(struct.pack("IIII", 31, fd, 0, 0), "III", ("size", None, None))
637638 if result.size > 0x80000000:
638639 raise DeviceError("file_size(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.size, self.errno()))
@@ -646,7 +647,7 @@
647648 malloc = True
648649 else:
649650 malloc = False
650 - self.logger.debug("Reading %d bytes from file handle 0x%x to 0x%x\n" % (size, fd, addr))
 651+ self.logger.debug("Reading %d bytes from file handle 0x%X to 0x%X\n" % (size, fd, addr))
651652 try:
652653 result = self.lib.monitorcommand(struct.pack("IIII", 32, fd, addr, size), "III", ("rc", None, None))
653654 if result.rc > 0x80000000:
@@ -655,57 +656,57 @@
656657 if malloc == True:
657658 self.free(addr)
658659 raise
659 - self.logger.debug("File read result: 0x%x\n" % result.rc)
 660+ self.logger.debug("File read result: 0x%X\n" % result.rc)
660661 return Bunch(rc = result.rc, addr = addr)
661662
662663 @command(timeout = 30000)
663664 def file_write(self, fd, size, addr):
664665 """ Writes data from a file referenced by a handle. """
665 - self.logger.debug("Writing %d bytes from 0x%x to file handle 0x%x\n" % (size, addr, fd))
 666+ self.logger.debug("Writing %d bytes from 0x%X to file handle 0x%X\n" % (size, addr, fd))
666667 result = self.lib.monitorcommand(struct.pack("IIII", 33, fd, addr, size), "III", ("rc", None, None))
667668 if result.rc > 0x80000000:
668669 raise DeviceError("file_write(fd=%d, addr=0x%08X, size=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, addr, size, result.rc, self.errno()))
669 - self.logger.debug("File write result: 0x%x\n" % result.rc)
 670+ self.logger.debug("File write result: 0x%X\n" % result.rc)
670671 return result.rc
671672
672673 @command(timeout = 30000)
673674 def file_seek(self, fd, offset, whence):
674675 """ Seeks the file handle to the specified position in the file """
675 - self.logger.debug("Seeking file handle 0x%x to whence=%d, offset=0x%x\n" % (fd, whence, offset))
 676+ self.logger.debug("Seeking file handle 0x%X to whence=%d, offset=0x%X\n" % (fd, whence, offset))
676677 result = self.lib.monitorcommand(struct.pack("IIII", 34, fd, offset, whence), "III", ("rc", None, None))
677678 if result.rc > 0x80000000:
678679 raise DeviceError("file_seek(fd=%d, offset=0x%08X, whence=%d) failed with RC=0x%08X, errno=%d" % (fd, offset, whence, result.rc, self.errno()))
679 - self.logger.debug("File seek result: 0x%x\n" % (result.rc))
 680+ self.logger.debug("File seek result: 0x%X\n" % (result.rc))
680681 return result.rc
681682
682683 @command(timeout = 30000)
683684 def file_truncate(self, fd, length):
684685 """ Truncates a file referenced by a handle to a specified length """
685 - self.logger.debug("Truncating file with handle 0x%x to 0x%x bytes\n" % (fd, length))
 686+ self.logger.debug("Truncating file with handle 0x%X to 0x%X bytes\n" % (fd, length))
686687 result = self.lib.monitorcommand(struct.pack("IIII", 35, fd, offset, 0), "III", ("rc", None, None))
687688 if result.rc > 0x80000000:
688689 raise DeviceError("file_truncate(fd=%d, length=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, length, result.rc, self.errno()))
689 - self.logger.debug("File truncate result: 0x%x\n" % (result.rc))
 690+ self.logger.debug("File truncate result: 0x%X\n" % (result.rc))
690691 return result.rc
691692
692693 @command(timeout = 30000)
693694 def file_sync(self, fd):
694695 """ Flushes a file handles' buffers """
695 - self.logger.debug("Flushing buffers of file with handle 0x%x\n" % (fd))
 696+ self.logger.debug("Flushing buffers of file with handle 0x%X\n" % (fd))
696697 result = self.lib.monitorcommand(struct.pack("IIII", 36, fd, 0, 0), "III", ("rc", None, None))
697698 if result.rc > 0x80000000:
698699 raise DeviceError("file_sync(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.rc, self.errno()))
699 - self.logger.debug("File flush result: 0x%x\n" % (result.rc))
 700+ self.logger.debug("File flush result: 0x%X\n" % (result.rc))
700701 return result.rc
701702
702703 @command(timeout = 30000)
703704 def file_close(self, fd):
704705 """ Closes a file handle """
705 - self.logger.debug("Closing file handle 0x%x\n" % (fd))
 706+ self.logger.debug("Closing file handle 0x%X\n" % (fd))
706707 result = self.lib.monitorcommand(struct.pack("IIII", 37, fd, 0, 0), "III", ("rc", None, None))
707708 if result.rc > 0x80000000:
708709 raise DeviceError("file_close(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.rc, self.errno()))
709 - self.logger.debug("File close result: 0x%x\n" % (result.rc))
 710+ self.logger.debug("File close result: 0x%X\n" % (result.rc))
710711 return result.rc
711712
712713 @command(timeout = 30000)
@@ -735,7 +736,7 @@
736737 result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(filename), 40, 0, 0, 0, filename, 0), "III", ("rc", None, None))
737738 if result.rc > 0x80000000:
738739 raise DeviceError("file_unlink(filename=\"%s\") failed with RC=0x%08X, errno=%d" % (filename, result.rc, self.errno()))
739 - self.logger.debug("Delete file result: 0x%x\n" % (result.rc))
 740+ self.logger.debug("Delete file result: 0x%X\n" % (result.rc))
740741 return result.rc
741742
742743 @command(timeout = 30000)
@@ -745,7 +746,7 @@
746747 result = self.lib.monitorcommand(struct.pack("IIII248s%dsB" % min(247, len(newname)), 41, 0, 0, 0, oldname, newname, 0), "III", ("rc", None, None))
747748 if result.rc > 0x80000000:
748749 raise DeviceError("file_rename(oldname=\"%s\", newname=\"%s\") failed with RC=0x%08X, errno=%d" % (oldname, newname, result.rc, self.errno()))
749 - self.logger.debug("Rename file result: 0x%x\n" % (result.rc))
 750+ self.logger.debug("Rename file result: 0x%X\n" % (result.rc))
750751 return result.rc
751752
752753 @command(timeout = 30000)
@@ -755,13 +756,13 @@
756757 result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 42, 0, 0, 0, dirname, 0), "III", ("handle", None, None))
757758 if result.handle == 0:
758759 raise DeviceError("dir_open(dirname=\"%s\") failed with RC=0x%08X, errno=%d" % (dirname, result.handle, self.errno()))
759 - self.logger.debug("Opened directory as handle 0x%x\n" % (result.handle))
 760+ self.logger.debug("Opened directory as handle 0x%X\n" % (result.handle))
760761 return result.handle
761762
762763 @command(timeout = 30000)
763764 def dir_read(self, handle):
764765 """ Reads the next entry from a directory """
765 - self.logger.debug("Reading next entry of directory handle 0x%x\n" % (handle))
 766+ self.logger.debug("Reading next entry of directory handle 0x%X\n" % (handle))
766767 result = self.lib.monitorcommand(struct.pack("IIII", 43, handle, 0, 0), "III", ("version", "maxpath", "ptr"))
767768 if result.ptr == 0:
768769 raise DeviceError("dir_read(handle=0x%08X) failed with RC=0x%08X, errno=%d" % (handle, result.ptr, self.errno()))
@@ -773,21 +774,21 @@
774775 ret.name = ret.name[:ret.name.index('\x00')]
775776 self.logger.debug("Read directory entry:\n")
776777 self.logger.debug("Name: %s\n" % ret.name)
777 - self.logger.debug("Attributes: 0x%x\n" % ret.attributes)
 778+ self.logger.debug("Attributes: 0x%X\n" % ret.attributes)
778779 self.logger.debug("Size: %d\n" % ret.size)
779780 self.logger.debug("Start cluster: %d\n" % ret.startcluster)
780 - self.logger.debug("Last written date: 0x%x\n" % ret.wrtdate)
781 - self.logger.debug("Last written time: 0x%x\n" % ret.wrttime)
 781+ self.logger.debug("Last written date: 0x%X\n" % ret.wrtdate)
 782+ self.logger.debug("Last written time: 0x%X\n" % ret.wrttime)
782783 return ret
783784
784785 @command(timeout = 30000)
785786 def dir_close(self, handle):
786787 """ Closes a directory handle """
787 - self.logger.debug("Closing directory handle 0x%x\n" % (handle))
 788+ self.logger.debug("Closing directory handle 0x%X\n" % (handle))
788789 result = self.lib.monitorcommand(struct.pack("IIII", 44, handle, 0, 0), "III", ("rc", None, None))
789790 if result.rc > 0x80000000:
790791 raise DeviceError("dir_close(handle=0x%08X) failed with RC=0x%08X, errno=%d" % (handle, result.rc, self.errno()))
791 - self.logger.debug("Close directory result: 0x%x\n" % (result.rc))
 792+ self.logger.debug("Close directory result: 0x%X\n" % (result.rc))
792793 return result.rc
793794
794795 @command(timeout = 30000)
@@ -817,7 +818,7 @@
818819 result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 47, 0, 0, 0, dirname, 0), "III", ("rc", None, None))
819820 if result.rc > 0x80000000:
820821 raise DeviceError("dir_create(dirname=\"%s\") failed with RC=0x%08X, errno=%d" % (dirname, result.rc, self.errno()))
821 - self.logger.debug("Create directory result: 0x%x\n" % (result.rc))
 822+ self.logger.debug("Create directory result: 0x%X\n" % (result.rc))
822823 return result.rc
823824
824825 @command(timeout = 30000)
@@ -827,7 +828,7 @@
828829 result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 48, 0, 0, 0, dirname, 0), "III", ("rc", None, None))
829830 if result.rc > 0x80000000:
830831 raise DeviceError("dir_remove(dirname=\"%s\") failed with RC=0x%08X, errno=%d" % (dirname, result.rc, self.errno()))
831 - self.logger.debug("Remove directory result: 0x%x\n" % (result.rc))
 832+ self.logger.debug("Remove directory result: 0x%X\n" % (result.rc))
832833 return result.rc
833834
834835 @command()
@@ -835,7 +836,7 @@
836837 """ Returns the number of the last error that happened """
837838 self.logger.debug("Getting last error number\n")
838839 result = self.lib.monitorcommand(struct.pack("IIII", 49, 0, 0, 0), "III", ("errno", None, None))
839 - self.logger.debug("Last error: 0x%x\n" % (result.errno))
 840+ self.logger.debug("Last error: 0x%X\n" % (result.errno))
840841 return result.errno
841842
842843 @command()
@@ -845,7 +846,7 @@
846847 result = self.lib.monitorcommand(struct.pack("IIII", 50, volume, 0, 0), "III", ("rc", None, None))
847848 if result.rc > 0x80000000:
848849 raise DeviceError("disk_mount(volume=%d) failed with RC=0x%08X, errno=%d" % (volume, result.rc, self.errno()))
849 - self.logger.debug("Mount volume result: 0x%x\n" % (result.rc))
 850+ self.logger.debug("Mount volume result: 0x%X\n" % (result.rc))
850851 return result.rc
851852
852853 @command()
@@ -855,7 +856,7 @@
856857 result = self.lib.monitorcommand(struct.pack("IIII", 51, volume, 0, 0), "III", ("rc", None, None))
857858 if result.rc > 0x80000000:
858859 raise DeviceError("disk_unmount(volume=%d) failed with RC=0x%08X, errno=%d" % (volume, result.rc, self.errno()))
859 - self.logger.debug("Unmount volume result: 0x%x\n" % (result.rc))
 860+ self.logger.debug("Unmount volume result: 0x%X\n" % (result.rc))
860861 return result.rc
861862
862863 @command()
@@ -863,15 +864,15 @@
864865 """ Allocates 'size' bytes and returns a pointer to the allocated memory """
865866 self.logger.debug("Allocating %d bytes of memory\n" % size)
866867 result = self.lib.monitorcommand(struct.pack("IIII", 52, size, 0, 0), "III", ("ptr", None, None))
867 - self.logger.debug("Allocated %d bytes of memory at 0x%x\n" % (size, result.ptr))
 868+ self.logger.debug("Allocated %d bytes of memory at 0x%X\n" % (size, result.ptr))
868869 return result.ptr
869870
870871 @command()
871872 def memalign(self, align, size):
872873 """ Allocates 'size' bytes aligned to 'align' and returns a pointer to the allocated memory """
873 - self.logger.debug("Allocating %d bytes of memory aligned to 0x%x\n" % (size, align))
 874+ self.logger.debug("Allocating %d bytes of memory aligned to 0x%X\n" % (size, align))
874875 result = self.lib.monitorcommand(struct.pack("IIII", 53, align, size, 0), "III", ("ptr", None, None))
875 - self.logger.debug("Allocated %d bytes of memory at 0x%x\n" % (size, result.ptr))
 876+ self.logger.debug("Allocated %d bytes of memory at 0x%X\n" % (size, result.ptr))
876877 return result.ptr
877878
878879 @command()
@@ -880,21 +881,21 @@
881882 expanding or reducing the amount of memory available in the block.
882883 Returns a pointer to the reallocated memory.
883884 """
884 - self.logger.debug("Reallocating 0x%x to have the new size %d\n" % (ptr, size))
 885+ self.logger.debug("Reallocating 0x%X to have the new size %d\n" % (ptr, size))
885886 result = self.lib.monitorcommand(struct.pack("IIII", 54, ptr, size, 0), "III", ("ptr", None, None))
886 - self.logger.debug("Reallocated memory at 0x%x to 0x%x with the new size %d\n" % (ptr, result.ptr, size))
 887+ self.logger.debug("Reallocated memory at 0x%X to 0x%X with the new size %d\n" % (ptr, result.ptr, size))
887888 return result.ptr
888889
889890 @command()
890891 def reownalloc(self, ptr, owner):
891892 """ Changes the owner of the memory allocation 'ptr' to the thread struct at addr 'owner' """
892 - self.logger.debug("Changing owner of the memory region 0x%x to 0x%x\n" % (ptr, owner))
 893+ self.logger.debug("Changing owner of the memory region 0x%X to 0x%X\n" % (ptr, owner))
893894 return self.lib.monitorcommand(struct.pack("IIII", 55, ptr, owner, 0), "III", (None, None, None))
894895
895896 @command()
896897 def free(self, ptr):
897898 """ Frees the memory space pointed to by 'ptr' """
898 - self.logger.debug("Freeing the memory region at 0x%x\n" % ptr)
 899+ self.logger.debug("Freeing the memory region at 0x%X\n" % ptr)
899900 return self.lib.monitorcommand(struct.pack("IIII", 56, ptr, 0, 0), "III", (None, None, None))
900901
901902 @command()
@@ -1002,20 +1003,20 @@
10031004 for intf in cfg:
10041005 for ep in intf:
10051006 if epcounter == 0:
1006 - self.logger.debug("Found cout endpoint at 0x%x\n" % ep.bEndpointAddress)
 1007+ self.logger.debug("Found cout endpoint at 0x%X\n" % ep.bEndpointAddress)
10071008 self.endpoint.cout = ep.bEndpointAddress
10081009 elif epcounter == 1:
1009 - self.logger.debug("Found cin endpoint at 0x%x\n" % ep.bEndpointAddress)
 1010+ self.logger.debug("Found cin endpoint at 0x%X\n" % ep.bEndpointAddress)
10101011 self.endpoint.cin = ep.bEndpointAddress
10111012 elif epcounter == 2:
1012 - self.logger.debug("Found dout endpoint at 0x%x\n" % ep.bEndpointAddress)
 1013+ self.logger.debug("Found dout endpoint at 0x%X\n" % ep.bEndpointAddress)
10131014 self.endpoint.dout = ep.bEndpointAddress
10141015 elif epcounter == 3:
1015 - self.logger.debug("Found din endpoint at 0x%x\n" % ep.bEndpointAddress)
 1016+ self.logger.debug("Found din endpoint at 0x%X\n" % ep.bEndpointAddress)
10161017 self.endpoint.din = ep.bEndpointAddress
10171018 epcounter += 1
10181019 if epcounter <= 3:
1019 - raise DeviceError("Not all endpoints found in the descriptor. Only "+str(epcounter)+" found, we need 4")
 1020+ raise DeviceError("Not all endpoints found in the descriptor. Only %d endpoints found, at least 4 endpoints were expeceted" % epcounter)
10201021
10211022 def connect(self):
10221023 self.logger.debug("Looking for emCORE device\n")
@@ -1042,25 +1043,25 @@
10431044 return read
10441045
10451046 def cout(self, data):
1046 - self.logger.debug("Sending data to cout endpoint with the size " + str(len(data)) + "\n")
 1047+ self.logger.debug("Sending data to cout endpoint with the size %d\n" % len(data))
10471048 if self.packetsizelimit.cout and len(data) > self.packetsizelimit.cout:
10481049 raise SendError("Packet too big")
10491050 return self.send(self.endpoint.cout, data)
10501051
10511052 def cin(self, size):
1052 - self.logger.debug("Receiving data on the cin endpoint with the size " + str(size) + "\n")
 1053+ self.logger.debug("Receiving data on the cin endpoint with the size %d\n" % size)
10531054 if self.packetsizelimit.cin and size > self.packetsizelimit.cin:
10541055 raise ReceiveError("Packet too big")
10551056 return self.receive(self.endpoint.cin, size)
10561057
10571058 def dout(self, data):
1058 - self.logger.debug("Sending data to cout endpoint with the size " + str(len(data)) + "\n")
 1059+ self.logger.debug("Sending data to cout endpoint with the size %d\n" % len(data))
10591060 if self.packetsizelimit.dout and len(data) > self.packetsizelimit.dout:
10601061 raise SendError("Packet too big")
10611062 return self.send(self.endpoint.dout, data)
10621063
10631064 def din(self, size):
1064 - self.logger.debug("Receiving data on the din endpoint with the size " + str(size) + "\n")
 1065+ self.logger.debug("Receiving data on the din endpoint with the size %d\n" % size)
10651066 if self.packetsizelimit.din and size > self.packetsizelimit.din:
10661067 raise ReceiveError("Packet too big")
10671068 return self.receive(self.endpoint.din, size)
@@ -1085,14 +1086,14 @@
10861087 emcore = Emcore()
10871088 logger.write("Allocating 200 bytes of memory: ")
10881089 addr = emcore.malloc(200)
1089 - logger.write("0x%x\n" % addr)
 1090+ logger.write("0x%X\n" % addr)
10901091 logger.write("Reallocating to 2000 bytes: ")
10911092 addr = emcore.realloc(addr, 2000)
1092 - logger.write("0x%x\n" % addr)
1093 - logger.write("Freeing 0x%x\n" % addr)
 1093+ logger.write("0x%X\n" % addr)
 1094+ logger.write("Freeing 0x%X\n" % addr)
10941095 emcore.free(addr)
10951096 logger.write("Allocating 1000 bytes of memory aligned to 100 bytes: ")
10961097 addr = emcore.memalign(100, 1000)
1097 - logger.write("0x%x\n" % addr)
1098 - logger.write("Freeing 0x%x\n" % addr)
 1098+ logger.write("0x%X\n" % addr)
 1099+ logger.write("Freeing 0x%X\n" % addr)
10991100 emcore.free(addr)
\ No newline at end of file