-//! Set the program counter.
-void jtag430_setpc(unsigned int adr){
- jtag_ir_shift8(IR_CNTRL_SIG_16BIT);
- jtag_dr_shift16(0x3401);// release low byte
- jtag_ir_shift8(IR_DATA_16BIT);
- jtag_dr_shift16(0x4030);//Instruction to load PC
+unsigned int drwidth=16;
+
+//! Shift an address width of data
+uint32_t jtag430_shift_addr( uint32_t addr )
+{
+ if (!in_run_test_idle())
+ {
+ debugstr("Not in run-test-idle state");
+ return 0;
+ }
+
+ // get intot the right state
+ jtag_capture_dr();
+ jtag_shift_register();
+
+ // shift DR, then idle
+ return jtag_trans_n(addr, drwidth, MSB);
+}
+
+//! Set a register.
+void jtag430_setr(u8 reg, u16 val){
+ jtag_ir_shift_8(IR_CNTRL_SIG_16BIT);
+ jtag_dr_shift_16(0x3401);// release low byte
+ jtag_ir_shift_8(IR_DATA_16BIT);
+
+ //0x4030 is "MOV #foo, r0"
+ //Right-most field is register, so 0x4035 loads r5
+ jtag_dr_shift_16(0x4030+reg);