| Line 424... |
Line 424... |
| 424 |
|
424 |
|
| 425 |
def hmac_sha1(self, addr, size, destination):
|
425 |
def hmac_sha1(self, addr, size, destination):
|
| 426 |
""" Generates a HMAC-SHA1 hash of the buffer and saves it to 'destination' """
|
426 |
""" Generates a HMAC-SHA1 hash of the buffer and saves it to 'destination' """
|
| 427 |
return self.lib.monitorcommand(struct.pack("IIII", 26, addr, size, destination), "III", (None, None, None))
|
427 |
return self.lib.monitorcommand(struct.pack("IIII", 26, addr, size, destination), "III", (None, None, None))
|
| 428 |
|
428 |
|
| - |
|
429 |
def ipodnano2g_getnandinfo(self):
|
| - |
|
430 |
""" Target-specific function: ipodnano2g
|
| - |
|
431 |
Gathers some information about the NAND chip used
|
| - |
|
432 |
"""
|
| - |
|
433 |
return self.lib.monitorcommand(struct.pack("IIII", 0xffff0001, 0, 0, 0), "IHHHH", ("type", "pagesperblock", "banks", "userblocks", "blocks"))
|
| - |
|
434 |
|
| - |
|
435 |
def ipodnano2g_nandread(self, addr, start, count, doecc, checkempty):
|
| - |
|
436 |
""" Target-specific function: ipodnano2g
|
| - |
|
437 |
Reads data from the NAND chip into memory
|
| - |
|
438 |
"""
|
| - |
|
439 |
return self.lib.monitorcommand(struct.pack("IIII", 0xffff0002, addr | (0x80000000 if doecc != 0 else 0) | (0x40000000 if checkempty != 0 else 0), start, count), "III", (None, None, None))
|
| - |
|
440 |
|
| - |
|
441 |
def ipodnano2g_nandwrite(self, addr, start, count, doecc):
|
| - |
|
442 |
""" Target-specific function: ipodnano2g
|
| - |
|
443 |
Writes data to the NAND chip
|
| - |
|
444 |
"""
|
| - |
|
445 |
return self.lib.monitorcommand(struct.pack("IIII", 0xffff0003, addr | (0x80000000 if doecc != 0 else 0), start, count), "III", (None, None, None))
|
| - |
|
446 |
|
| - |
|
447 |
def ipodnano2g_nanderase(self, addr, start, count):
|
| - |
|
448 |
""" Target-specific function: ipodnano2g
|
| - |
|
449 |
Erases blocks on the NAND chip and stores the results to memory
|
| - |
|
450 |
"""
|
| - |
|
451 |
return self.lib.monitorcommand(struct.pack("IIII", 0xffff0004, addr, start, count), "III", (None, None, None))
|
| - |
|
452 |
|
| 429 |
|
453 |
|
| 430 |
class Lib(object):
|
454 |
class Lib(object):
|
| 431 |
def __init__(self):
|
455 |
def __init__(self):
|
| 432 |
self.idVendor = 0xFFFF
|
456 |
self.idVendor = 0xFFFF
|
| 433 |
self.idProduct = 0xE000
|
457 |
self.idProduct = 0xE000
|