- waitIdle();
- ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1);
- ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1);
- ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0);
- ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0);
- ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0);
- ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1);
- ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0);
- ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0);
- /* we don't have to wait for the queue to empty here. waitIdle(); */
- ZY1000_POKE(ZY1000_JTAG_BASE + 0x20, TAP_DRSHIFT);
+ uint32_t value;
+ value = *t++;
+ value |= (*t++<<8);
+ value |= (*t++<<16);
+ value |= (*t++<<24);
+
+ shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, 32, value);
+ /* minimum 2 bits */
+ shiftValueInner(TAP_DRSHIFT, TAP_DRPAUSE, post_bits, 0);
+
+ /* copy & paste from arm11_dbgtap.c */
+ //TAP_DREXIT2, TAP_DRUPDATE, TAP_IDLE, TAP_IDLE, TAP_IDLE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DRSHIFT
+ /* KLUDGE! we have to flush the fifo or the Nios CPU locks up.
+ * This is probably a bug in the Avalon bus(cross clocking bridge?)
+ * or in the jtag registers module.
+ */
+ waitIdle();
+ ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1);
+ ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1);
+ ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0);
+ ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0);
+ ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0);
+ ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1);
+ ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0);
+ ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0);
+ /* we don't have to wait for the queue to empty here */
+ ZY1000_POKE(ZY1000_JTAG_BASE + 0x20, TAP_DRSHIFT);
+ waitIdle();