def wr_ir(self, ir): """write instruction register""" if self.ir == ir: # no changes return #print('ir[%s]' % ir_name[ir]) self.device.wr_ir(bits.from_val(ir, _IR_LEN)) self.ir = ir
def ir_survey(self): """return a string with all IR values and the DR lengths""" s = [] for ir in range((1 << self.irlen)): self.wr_ir(bits.from_val(ir, self.irlen)) try: n = self.chain.dr_length() - self.devs_after - self.devs_before s.append('ir %d drlen %d' % (ir, n)) except: s.append('ir %d drlen unknown' % ir) return '\n'.join(s)
def rw_apacc(self, rnw, adr, val): """write to and readback from the selected apacc register""" x = (val << 3) | ((adr >> 1) & 0x06) | rnw self.wr_ir(_IR_APACC) rd = self.device.rw_dr(bits.from_val(x, _DR_APACC_LEN)) ack, val = rd.split((3, 32)) if ack == _ACK_WAIT: raise jtag_dp_error('JTAG-DP ACK timeout') if ack != _ACK_OK_FAULT: raise jtag_dp_error('JTAG-DP invalid ACK') return val
def wr_abort(self, val): """write abort register""" self.wr_ir(_IR_ABORT) self.device.wr_dr(bits.from_val(val, _DR_ABORT_LEN))