| Index: emcore/trunk/tools/emcore.py | 
| — | — | @@ -1187,7 +1187,7 @@ | 
| 1188 | 1188 | size = self._hexint(size) | 
| 1189 | 1189 | self.logger.info("Allocating %d bytes of memory\n" % size) | 
| 1190 | 1190 | 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)) | 
| 1192 | 1192 |  | 
| 1193 | 1193 | @command | 
| 1194 | 1194 | def memalign(self, align, size): | 
| — | — | @@ -1194,9 +1194,9 @@ | 
| 1195 | 1195 | """ Allocates <size> bytes aligned to <align> and returns a pointer to the allocated memory """ | 
| 1196 | 1196 | align = self._hexint(align) | 
| 1197 | 1197 | 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)) | 
| 1199 | 1199 | 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)) | 
| 1201 | 1201 |  | 
| 1202 | 1202 | @command | 
| 1203 | 1203 | def realloc(self, ptr, size): | 
| — | — | @@ -1206,9 +1206,9 @@ | 
| 1207 | 1207 | """ | 
| 1208 | 1208 | ptr = self._hexint(ptr) | 
| 1209 | 1209 | 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)) | 
| 1211 | 1211 | 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)) | 
| 1213 | 1213 |  | 
| 1214 | 1214 | @command | 
| 1215 | 1215 | def reownalloc(self, ptr, owner): | 
| — | — | @@ -1215,17 +1215,17 @@ | 
| 1216 | 1216 | """ Changes the owner of the memory allocation <ptr> to the thread struct at addr <owner> """ | 
| 1217 | 1217 | ptr = self._hexint(ptr) | 
| 1218 | 1218 | 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)) | 
| 1220 | 1220 | 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)) | 
| 1222 | 1222 |  | 
| 1223 | 1223 | @command | 
| 1224 | 1224 | def free(self, ptr): | 
| 1225 | 1225 | """ Frees the memory space pointed to by 'ptr' """ | 
| 1226 | 1226 | 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) | 
| 1228 | 1228 | 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) | 
| 1230 | 1230 |  | 
| 1231 | 1231 | @command | 
| 1232 | 1232 | def free_all(self): | 
| Index: emcore/trunk/tools/libemcore.py | 
| — | — | @@ -67,7 +67,8 @@ | 
| 68 | 68 | # precommand stuff | 
| 69 | 69 | if target is not None: | 
| 70 | 70 | 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))) | 
| 72 | 73 | timeout = None | 
| 73 | 74 | if "timeout" in kwargs.keys(): | 
| 74 | 75 | timeout = kwargs['timeout'] | 
| — | — | @@ -169,9 +170,9 @@ | 
| 170 | 171 | self.lib.dev.version.majorv = resp.majorv | 
| 171 | 172 | self.lib.dev.version.minorv = resp.minorv | 
| 172 | 173 | 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) | 
| 174 | 175 | 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) | 
| 176 | 177 | self.lib.dev.hwtypeid = resp.hwtypeid | 
| 177 | 178 | return resp | 
| 178 | 179 |  | 
| — | — | @@ -181,13 +182,13 @@ | 
| 182 | 183 | It also sets the properties of the device object accordingly. | 
| 183 | 184 | """ | 
| 184 | 185 | 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) | 
| 186 | 187 | 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) | 
| 188 | 189 | 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) | 
| 190 | 191 | 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) | 
| 192 | 193 | self.lib.dev.packetsizelimit.dout = resp.doutmax | 
| 193 | 194 | return resp | 
| 194 | 195 |  | 
| — | — | @@ -195,7 +196,7 @@ | 
| 196 | 197 | def getusermemrange(self): | 
| 197 | 198 | """ This returns the memory range the user has access to. """ | 
| 198 | 199 | 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)) | 
| 200 | 201 | self.lib.dev.usermem.lower = resp.lower | 
| 201 | 202 | self.lib.dev.usermem.upper = resp.upper | 
| 202 | 203 | return resp | 
| — | — | @@ -226,7 +227,7 @@ | 
| 227 | 228 | din_maxsize = self.lib.dev.packetsizelimit.din | 
| 228 | 229 | data = "" | 
| 229 | 230 | (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)) | 
| 231 | 232 | if headsize != 0: | 
| 232 | 233 | data += self._readmem(addr, headsize) | 
| 233 | 234 | addr += headsize | 
| — | — | @@ -252,7 +253,7 @@ | 
| 253 | 254 | cout_maxsize = self.lib.dev.packetsizelimit.cout - self.lib.headersize | 
| 254 | 255 | dout_maxsize = self.lib.dev.packetsizelimit.dout | 
| 255 | 256 | (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)) | 
| 257 | 258 | offset = 0 | 
| 258 | 259 | if headsize != 0: | 
| 259 | 260 | self._writemem(addr, data[offset:offset+headsize]) | 
| — | — | @@ -380,7 +381,7 @@ | 
| 381 | 382 | id = 0 | 
| 382 | 383 | while structptr != 0: | 
| 383 | 384 | 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) | 
| 385 | 386 | threaddata = self.read(structptr, ctypes.sizeof(scheduler_thread)) | 
| 386 | 387 | threadstruct._from_string(threaddata) | 
| 387 | 388 | threadstruct = threadstruct._to_bunch() | 
| — | — | @@ -440,7 +441,7 @@ | 
| 441 | 442 | raise ArgumentError("State must be either 'ready' or 'suspended'") | 
| 442 | 443 | resp = self.lib.monitorcommand(struct.pack("IIIIIIII", 19, nameptr, entrypoint, stackptr, stacksize, threadtype, priority, state), "III", ("threadptr", None, None)) | 
| 443 | 444 | 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) | 
| 445 | 446 | return resp | 
| 446 | 447 |  | 
| 447 | 448 | @command() | 
| — | — | @@ -480,7 +481,7 @@ | 
| 481 | 482 | @command() | 
| 482 | 483 | def execfirmware(self, targetaddr, addr, size): | 
| 483 | 484 | """ 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)) | 
| 485 | 486 | return self.lib.monitorcommand(struct.pack("IIII", 24, targetaddr, addr, size)) | 
| 486 | 487 |  | 
| 487 | 488 | @command(timeout = 30000) | 
| — | — | @@ -594,9 +595,9 @@ | 
| 595 | 596 | @command(timeout = 50000) | 
| 596 | 597 | def storage_read_sectors_md(self, volume, sector, count, addr): | 
| 597 | 598 | """ 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)) | 
| 599 | 600 | 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) | 
| 601 | 602 | if result.rc > 0x80000000: | 
| 602 | 603 | 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)) | 
| 603 | 604 |  | 
| — | — | @@ -603,9 +604,9 @@ | 
| 604 | 605 | @command(timeout = 50000) | 
| 605 | 606 | def storage_write_sectors_md(self, volume, sector, count, addr): | 
| 606 | 607 | """ 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)) | 
| 608 | 609 | 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) | 
| 610 | 611 | if result.rc > 0x80000000: | 
| 611 | 612 | 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)) | 
| 612 | 613 |  | 
| — | — | @@ -625,13 +626,13 @@ | 
| 626 | 627 | result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(filename), 30, mode, 0, 0, filename, 0), "III", ("fd", None, None)) | 
| 627 | 628 | if result.fd > 0x80000000: | 
| 628 | 629 | 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) | 
| 630 | 631 | return result.fd | 
| 631 | 632 |  | 
| 632 | 633 | @command(timeout = 30000) | 
| 633 | 634 | def file_size(self, fd): | 
| 634 | 635 | """ 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) | 
| 636 | 637 | result = self.lib.monitorcommand(struct.pack("IIII", 31, fd, 0, 0), "III", ("size", None, None)) | 
| 637 | 638 | if result.size > 0x80000000: | 
| 638 | 639 | raise DeviceError("file_size(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.size, self.errno())) | 
| — | — | @@ -646,7 +647,7 @@ | 
| 647 | 648 | malloc = True | 
| 648 | 649 | else: | 
| 649 | 650 | 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)) | 
| 651 | 652 | try: | 
| 652 | 653 | result = self.lib.monitorcommand(struct.pack("IIII", 32, fd, addr, size), "III", ("rc", None, None)) | 
| 653 | 654 | if result.rc > 0x80000000: | 
| — | — | @@ -655,57 +656,57 @@ | 
| 656 | 657 | if malloc == True: | 
| 657 | 658 | self.free(addr) | 
| 658 | 659 | 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) | 
| 660 | 661 | return Bunch(rc = result.rc, addr = addr) | 
| 661 | 662 |  | 
| 662 | 663 | @command(timeout = 30000) | 
| 663 | 664 | def file_write(self, fd, size, addr): | 
| 664 | 665 | """ 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)) | 
| 666 | 667 | result = self.lib.monitorcommand(struct.pack("IIII", 33, fd, addr, size), "III", ("rc", None, None)) | 
| 667 | 668 | if result.rc > 0x80000000: | 
| 668 | 669 | 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) | 
| 670 | 671 | return result.rc | 
| 671 | 672 |  | 
| 672 | 673 | @command(timeout = 30000) | 
| 673 | 674 | def file_seek(self, fd, offset, whence): | 
| 674 | 675 | """ 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)) | 
| 676 | 677 | result = self.lib.monitorcommand(struct.pack("IIII", 34, fd, offset, whence), "III", ("rc", None, None)) | 
| 677 | 678 | if result.rc > 0x80000000: | 
| 678 | 679 | 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)) | 
| 680 | 681 | return result.rc | 
| 681 | 682 |  | 
| 682 | 683 | @command(timeout = 30000) | 
| 683 | 684 | def file_truncate(self, fd, length): | 
| 684 | 685 | """ 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)) | 
| 686 | 687 | result = self.lib.monitorcommand(struct.pack("IIII", 35, fd, offset, 0), "III", ("rc", None, None)) | 
| 687 | 688 | if result.rc > 0x80000000: | 
| 688 | 689 | 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)) | 
| 690 | 691 | return result.rc | 
| 691 | 692 |  | 
| 692 | 693 | @command(timeout = 30000) | 
| 693 | 694 | def file_sync(self, fd): | 
| 694 | 695 | """ 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)) | 
| 696 | 697 | result = self.lib.monitorcommand(struct.pack("IIII", 36, fd, 0, 0), "III", ("rc", None, None)) | 
| 697 | 698 | if result.rc > 0x80000000: | 
| 698 | 699 | 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)) | 
| 700 | 701 | return result.rc | 
| 701 | 702 |  | 
| 702 | 703 | @command(timeout = 30000) | 
| 703 | 704 | def file_close(self, fd): | 
| 704 | 705 | """ 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)) | 
| 706 | 707 | result = self.lib.monitorcommand(struct.pack("IIII", 37, fd, 0, 0), "III", ("rc", None, None)) | 
| 707 | 708 | if result.rc > 0x80000000: | 
| 708 | 709 | 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)) | 
| 710 | 711 | return result.rc | 
| 711 | 712 |  | 
| 712 | 713 | @command(timeout = 30000) | 
| — | — | @@ -735,7 +736,7 @@ | 
| 736 | 737 | result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(filename), 40, 0, 0, 0, filename, 0), "III", ("rc", None, None)) | 
| 737 | 738 | if result.rc > 0x80000000: | 
| 738 | 739 | 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)) | 
| 740 | 741 | return result.rc | 
| 741 | 742 |  | 
| 742 | 743 | @command(timeout = 30000) | 
| — | — | @@ -745,7 +746,7 @@ | 
| 746 | 747 | result = self.lib.monitorcommand(struct.pack("IIII248s%dsB" % min(247, len(newname)), 41, 0, 0, 0, oldname, newname, 0), "III", ("rc", None, None)) | 
| 747 | 748 | if result.rc > 0x80000000: | 
| 748 | 749 | 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)) | 
| 750 | 751 | return result.rc | 
| 751 | 752 |  | 
| 752 | 753 | @command(timeout = 30000) | 
| — | — | @@ -755,13 +756,13 @@ | 
| 756 | 757 | result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 42, 0, 0, 0, dirname, 0), "III", ("handle", None, None)) | 
| 757 | 758 | if result.handle == 0: | 
| 758 | 759 | 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)) | 
| 760 | 761 | return result.handle | 
| 761 | 762 |  | 
| 762 | 763 | @command(timeout = 30000) | 
| 763 | 764 | def dir_read(self, handle): | 
| 764 | 765 | """ 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)) | 
| 766 | 767 | result = self.lib.monitorcommand(struct.pack("IIII", 43, handle, 0, 0), "III", ("version", "maxpath", "ptr")) | 
| 767 | 768 | if result.ptr == 0: | 
| 768 | 769 | raise DeviceError("dir_read(handle=0x%08X) failed with RC=0x%08X, errno=%d" % (handle, result.ptr, self.errno())) | 
| — | — | @@ -773,21 +774,21 @@ | 
| 774 | 775 | ret.name = ret.name[:ret.name.index('\x00')] | 
| 775 | 776 | self.logger.debug("Read directory entry:\n") | 
| 776 | 777 | 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) | 
| 778 | 779 | self.logger.debug("Size: %d\n" % ret.size) | 
| 779 | 780 | 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) | 
| 782 | 783 | return ret | 
| 783 | 784 |  | 
| 784 | 785 | @command(timeout = 30000) | 
| 785 | 786 | def dir_close(self, handle): | 
| 786 | 787 | """ 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)) | 
| 788 | 789 | result = self.lib.monitorcommand(struct.pack("IIII", 44, handle, 0, 0), "III", ("rc", None, None)) | 
| 789 | 790 | if result.rc > 0x80000000: | 
| 790 | 791 | 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)) | 
| 792 | 793 | return result.rc | 
| 793 | 794 |  | 
| 794 | 795 | @command(timeout = 30000) | 
| — | — | @@ -817,7 +818,7 @@ | 
| 818 | 819 | result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 47, 0, 0, 0, dirname, 0), "III", ("rc", None, None)) | 
| 819 | 820 | if result.rc > 0x80000000: | 
| 820 | 821 | 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)) | 
| 822 | 823 | return result.rc | 
| 823 | 824 |  | 
| 824 | 825 | @command(timeout = 30000) | 
| — | — | @@ -827,7 +828,7 @@ | 
| 828 | 829 | result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 48, 0, 0, 0, dirname, 0), "III", ("rc", None, None)) | 
| 829 | 830 | if result.rc > 0x80000000: | 
| 830 | 831 | 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)) | 
| 832 | 833 | return result.rc | 
| 833 | 834 |  | 
| 834 | 835 | @command() | 
| — | — | @@ -835,7 +836,7 @@ | 
| 836 | 837 | """ Returns the number of the last error that happened """ | 
| 837 | 838 | self.logger.debug("Getting last error number\n") | 
| 838 | 839 | 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)) | 
| 840 | 841 | return result.errno | 
| 841 | 842 |  | 
| 842 | 843 | @command() | 
| — | — | @@ -845,7 +846,7 @@ | 
| 846 | 847 | result = self.lib.monitorcommand(struct.pack("IIII", 50, volume, 0, 0), "III", ("rc", None, None)) | 
| 847 | 848 | if result.rc > 0x80000000: | 
| 848 | 849 | 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)) | 
| 850 | 851 | return result.rc | 
| 851 | 852 |  | 
| 852 | 853 | @command() | 
| — | — | @@ -855,7 +856,7 @@ | 
| 856 | 857 | result = self.lib.monitorcommand(struct.pack("IIII", 51, volume, 0, 0), "III", ("rc", None, None)) | 
| 857 | 858 | if result.rc > 0x80000000: | 
| 858 | 859 | 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)) | 
| 860 | 861 | return result.rc | 
| 861 | 862 |  | 
| 862 | 863 | @command() | 
| — | — | @@ -863,15 +864,15 @@ | 
| 864 | 865 | """ Allocates 'size' bytes and returns a pointer to the allocated memory """ | 
| 865 | 866 | self.logger.debug("Allocating %d bytes of memory\n" % size) | 
| 866 | 867 | 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)) | 
| 868 | 869 | return result.ptr | 
| 869 | 870 |  | 
| 870 | 871 | @command() | 
| 871 | 872 | def memalign(self, align, size): | 
| 872 | 873 | """ 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)) | 
| 874 | 875 | 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)) | 
| 876 | 877 | return result.ptr | 
| 877 | 878 |  | 
| 878 | 879 | @command() | 
| — | — | @@ -880,21 +881,21 @@ | 
| 881 | 882 | expanding or reducing the amount of memory available in the block. | 
| 882 | 883 | Returns a pointer to the reallocated memory. | 
| 883 | 884 | """ | 
| 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)) | 
| 885 | 886 | 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)) | 
| 887 | 888 | return result.ptr | 
| 888 | 889 |  | 
| 889 | 890 | @command() | 
| 890 | 891 | def reownalloc(self, ptr, owner): | 
| 891 | 892 | """ 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)) | 
| 893 | 894 | return self.lib.monitorcommand(struct.pack("IIII", 55, ptr, owner, 0), "III", (None, None, None)) | 
| 894 | 895 |  | 
| 895 | 896 | @command() | 
| 896 | 897 | def free(self, ptr): | 
| 897 | 898 | """ 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) | 
| 899 | 900 | return self.lib.monitorcommand(struct.pack("IIII", 56, ptr, 0, 0), "III", (None, None, None)) | 
| 900 | 901 |  | 
| 901 | 902 | @command() | 
| — | — | @@ -1002,20 +1003,20 @@ | 
| 1003 | 1004 | for intf in cfg: | 
| 1004 | 1005 | for ep in intf: | 
| 1005 | 1006 | 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) | 
| 1007 | 1008 | self.endpoint.cout = ep.bEndpointAddress | 
| 1008 | 1009 | 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) | 
| 1010 | 1011 | self.endpoint.cin = ep.bEndpointAddress | 
| 1011 | 1012 | 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) | 
| 1013 | 1014 | self.endpoint.dout = ep.bEndpointAddress | 
| 1014 | 1015 | 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) | 
| 1016 | 1017 | self.endpoint.din = ep.bEndpointAddress | 
| 1017 | 1018 | epcounter += 1 | 
| 1018 | 1019 | 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) | 
| 1020 | 1021 |  | 
| 1021 | 1022 | def connect(self): | 
| 1022 | 1023 | self.logger.debug("Looking for emCORE device\n") | 
| — | — | @@ -1042,25 +1043,25 @@ | 
| 1043 | 1044 | return read | 
| 1044 | 1045 |  | 
| 1045 | 1046 | 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)) | 
| 1047 | 1048 | if self.packetsizelimit.cout and len(data) > self.packetsizelimit.cout: | 
| 1048 | 1049 | raise SendError("Packet too big") | 
| 1049 | 1050 | return self.send(self.endpoint.cout, data) | 
| 1050 | 1051 |  | 
| 1051 | 1052 | 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) | 
| 1053 | 1054 | if self.packetsizelimit.cin and size > self.packetsizelimit.cin: | 
| 1054 | 1055 | raise ReceiveError("Packet too big") | 
| 1055 | 1056 | return self.receive(self.endpoint.cin, size) | 
| 1056 | 1057 |  | 
| 1057 | 1058 | 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)) | 
| 1059 | 1060 | if self.packetsizelimit.dout and len(data) > self.packetsizelimit.dout: | 
| 1060 | 1061 | raise SendError("Packet too big") | 
| 1061 | 1062 | return self.send(self.endpoint.dout, data) | 
| 1062 | 1063 |  | 
| 1063 | 1064 | 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) | 
| 1065 | 1066 | if self.packetsizelimit.din and size > self.packetsizelimit.din: | 
| 1066 | 1067 | raise ReceiveError("Packet too big") | 
| 1067 | 1068 | return self.receive(self.endpoint.din, size) | 
| — | — | @@ -1085,14 +1086,14 @@ | 
| 1086 | 1087 | emcore = Emcore() | 
| 1087 | 1088 | logger.write("Allocating 200 bytes of memory: ") | 
| 1088 | 1089 | addr = emcore.malloc(200) | 
| 1089 |  | -        logger.write("0x%x\n" % addr)
 | 
|  | 1090 | +        logger.write("0x%X\n" % addr) | 
| 1090 | 1091 | logger.write("Reallocating to 2000 bytes: ") | 
| 1091 | 1092 | 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) | 
| 1094 | 1095 | emcore.free(addr) | 
| 1095 | 1096 | logger.write("Allocating 1000 bytes of memory aligned to 100 bytes: ") | 
| 1096 | 1097 | 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) | 
| 1099 | 1100 | emcore.free(addr) | 
| \ No newline at end of file |