jtag_sleep(us);
}
+static void ublast_initial_wipeout(void)
+{
+ static uint8_t tms_reset = 0xff;
+ uint8_t out_value;
+ uint32_t retlen;
+ int i;
+
+ out_value = ublast_build_out(SCAN_OUT);
+ for (i = 0; i < BUF_LEN; i++)
+ info.buf[i] = out_value | ((i % 2) ? TCK : 0);
+
+ /*
+ * Flush USB-Blaster queue fifos
+ * - empty the write FIFO (128 bytes)
+ * - empty the read FIFO (384 bytes)
+ */
+ ublast_buf_write(info.buf, BUF_LEN, &retlen);
+ /*
+ * Put JTAG in RESET state (five 1 on TMS)
+ */
+ ublast_tms_seq(&tms_reset, 5);
+ tap_set_state(TAP_RESET);
+}
+
static int ublast_execute_queue(void)
{
struct jtag_command *cmd;
+ static int first_call = 1;
int ret = ERROR_OK;
+ if (first_call) {
+ first_call--;
+ ublast_initial_wipeout();
+ }
+
for (cmd = jtag_command_queue; ret == ERROR_OK && cmd != NULL;
cmd = cmd->next) {
switch (cmd->type) {
*
* Initialize the device :
* - open the USB device
- * - empty the write FIFO (128 bytes)
- * - empty the read FIFO (384 bytes)
+ * - pretend it's initialized while actual init is delayed until first jtag command
*
* Returns ERROR_OK if USB device found, error if not.
*/
static int ublast_init(void)
{
- static uint8_t tms_reset = 0xff;
int ret, i;
if (info.lowlevel_name) {
info.flags |= info.drv->flags;
ret = info.drv->open(info.drv);
- if (ret == ERROR_OK) {
- /*
- * Flush USB-Blaster queue fifos
- */
- uint32_t retlen;
- ublast_buf_write(info.buf, BUF_LEN, &retlen);
- /*
- * Put JTAG in RESET state (five 1 on TMS)
- */
- ublast_tms_seq(&tms_reset, 5);
- tap_set_state(TAP_RESET);
- }
+
+ /*
+ * Let lie here : the TAP is in an unknown state, but the first
+ * execute_queue() will trigger a ublast_initial_wipeout(), which will
+ * put the TAP in RESET.
+ */
+ tap_set_state(TAP_RESET);
return ret;
}