def setUp(self): self.jtag = JtagEngine(trst=True, frequency=3E6) self.jtag.configure(vendor=0x403, product=0x6011, interface=1) self.jtag.reset() self.tool = JtagTool(self.jtag)
def __init__(self, vendor, product, interface): self.jtag = JtagEngine() self.jtag.configure(vendor, product, interface) self.jtag.reset()
class JtagTestCase(unittest.TestCase): def setUp(self): self.jtag = JtagEngine(trst=True, frequency=3E6) self.jtag.configure(vendor=0x403, product=0x6011, interface=1) self.jtag.reset() self.tool = JtagTool(self.jtag) def tearDown(self): del self.jtag def test_idcode_reset(self): """Read the IDCODE right after a JTAG reset""" self.jtag.reset() idcode = self.jtag.read_dr(32) self.jtag.go_idle() print "IDCODE (reset): 0x%x" % int(idcode) def test_idcode_sequence(self): """Read the IDCODE using the dedicated instruction""" instruction = JTAG_INSTR['IDCODE'] self.jtag.write_ir(instruction) idcode = self.jtag.read_dr(32) self.jtag.go_idle() print "IDCODE (idcode): 0x%08x" % int(idcode) def _test_detect_ir_length(self): """Detect the instruction register length""" self.jtag.go_idle() self.jtag.capture_ir() self.tool.detect_register_size()
class ArmJtag(object): """JTAG helper for ARM core""" def __init__(self, vendor, product, interface): self.jtag = JtagEngine() self.jtag.configure(vendor, product, interface) self.jtag.reset() def get_idcode_from_reset(self): """Read the IDCODE right after a JTAG reset""" idcode = self.jtag.read_dr(32) self.jtag.go_idle() print "IDCODE: 0x%x" % int(idcode) return int(idcode) def get_idcode_from_instruction(self): """Read the IDCODE using the dedicated instruction""" instruction = JTAG_INSTR['IDCODE'] self.jtag.write_ir(instruction) idcode = self.jtag.read_dr(32) self.jtag.go_idle() revision = idcode[28:32] partnumber = idcode[12:28] manufacturer = idcode[1:12] ieee = idcode[0:1] print "IDCODE: 0x%x %s %s %s %s" % (int(idcode), revision, partnumber, manufacturer, ieee) return idcode