static uint16_t cmsis_dap_pid[MAX_USB_IDS + 1] = { 0 };
static int cmsis_dap_backend = -1;
static bool swd_mode;
+static bool cmsis_dap_quirk_mode; /* enable expensive workarounds */
/* CMSIS-DAP General Commands */
#define CMD_DAP_INFO 0x00
goto skip;
}
- unsigned int packet_count = dap->quirk_mode ? 1 : dap->packet_count;
+ unsigned int packet_count = cmsis_dap_quirk_mode ? 1 : dap->packet_count;
dap->pending_fifo_put_idx = (dap->pending_fifo_put_idx + 1) % packet_count;
dap->pending_fifo_block_count++;
if (dap->pending_fifo_block_count > packet_count)
skip:
block->transfer_count = 0;
- if (!dap->quirk_mode && dap->packet_count > 1)
+ if (!cmsis_dap_quirk_mode && dap->packet_count > 1)
dap->pending_fifo_get_idx = (dap->pending_fifo_get_idx + 1) % dap->packet_count;
dap->pending_fifo_block_count--;
}
/* Not enough room in the queue. Run the queue. */
cmsis_dap_swd_write_from_queue(cmsis_dap_handle);
- unsigned int packet_count = cmsis_dap_handle->quirk_mode ? 1 : cmsis_dap_handle->packet_count;
+ unsigned int packet_count = cmsis_dap_quirk_mode ? 1 : cmsis_dap_handle->packet_count;
if (cmsis_dap_handle->pending_fifo_block_count >= packet_count)
cmsis_dap_swd_read_process(cmsis_dap_handle, CMSIS_DAP_BLOCKING);
}
if (swd_mode)
queued_retval = cmsis_dap_swd_run_queue();
- if (cmsis_dap_handle->quirk_mode && seq != LINE_RESET &&
+ if (cmsis_dap_quirk_mode && seq != LINE_RESET &&
(output_pins & (SWJ_PIN_SRST | SWJ_PIN_TRST))
== (SWJ_PIN_SRST | SWJ_PIN_TRST)) {
/* Following workaround deasserts reset on most adapters.
return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC == 1)
- COMMAND_PARSE_ENABLE(CMD_ARGV[0], cmsis_dap_handle->quirk_mode);
+ COMMAND_PARSE_ENABLE(CMD_ARGV[0], cmsis_dap_quirk_mode);
command_print(CMD, "CMSIS-DAP quirk workarounds %s",
- cmsis_dap_handle->quirk_mode ? "enabled" : "disabled");
+ cmsis_dap_quirk_mode ? "enabled" : "disabled");
return ERROR_OK;
}