From: <mi...@ma...> - 2009-04-19 21:15:22
|
Author: mifi Date: 2009-04-19 21:15:09 +0200 (Sun, 19 Apr 2009) New Revision: 1471 Modified: trunk/src/jtag/jlink.c trunk/src/jtag/usbprog.c Log: Partially fix USBprog and JLink adapters on XScale target Thanks to Peter Denison <openwrt(at)marshadder.org> Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-19 14:51:51 UTC (rev 1470) +++ trunk/src/jtag/jlink.c 2009-04-19 19:15:09 UTC (rev 1471) @@ -433,7 +433,10 @@ /* Move to appropriate scan state */ jlink_end_state(ir_scan ? TAP_IRSHIFT : TAP_DRSHIFT); - jlink_state_move(); + /* Only move if we're not already there */ + if (tap_get_state() != tap_get_end_state()) + jlink_state_move(); + jlink_end_state(saved_end_state); /* Scan */ Modified: trunk/src/jtag/usbprog.c =================================================================== --- trunk/src/jtag/usbprog.c 2009-04-19 14:51:51 UTC (rev 1470) +++ trunk/src/jtag/usbprog.c 2009-04-19 19:15:09 UTC (rev 1471) @@ -265,6 +265,10 @@ int num_states = cmd->num_states; int state_count; + /* There may be queued transitions, and before following a specified + path, we must flush those queued transitions */ + usbprog_jtag_tms_send(usbprog_jtag_handle); + state_count = 0; while (num_states) { @@ -323,6 +327,10 @@ usbprog_write(0, 0, 0); } +#ifdef _DEBUG_JTAG_IO_ + LOG_DEBUG("runtest: cur_state %s end_state %s", tap_state_name(tap_get_state()), tap_state_name(tap_get_end_state())); +#endif + /* finish in end_state */ /* usbprog_end_state(saved_end_state); @@ -340,9 +348,10 @@ else usbprog_end_state(TAP_DRSHIFT); - /* usbprog_jtag_tms_send(usbprog_jtag_handle); */ + /* Only move if we're not already there */ + if (tap_get_state() != tap_get_end_state()) + usbprog_state_move(); - usbprog_state_move(); usbprog_end_state(saved_end_state); usbprog_jtag_tms_send(usbprog_jtag_handle); @@ -358,6 +367,7 @@ } f(usbprog_jtag_handle, (char *)buffer, scan_size); + /* The adapter does the transition to PAUSE internally */ if (ir_scan) tap_set_state(TAP_IRPAUSE); else |