return true;
/* optionally ignore the JTAG version field - bits 28-31 of IDCODE */
- uint32_t mask = tap->ignore_version ? ~(0xf << 28) : ~0;
+ uint32_t mask = tap->ignore_version ? ~(0xfU << 28) : ~0U;
uint32_t idcode = tap->idcode & mask;
/* Loop over the expected identification codes and test for a match */
return retval;
jtag = jtag_interface;
- /* LEGACY SUPPORT ... adapter drivers must declare what
- * transports they allow. Until they all do so, assume
- * the legacy drivers are JTAG-only
- */
- if (!transports_are_declared()) {
- LOG_ERROR("Adapter driver '%s' did not declare "
- "which transports it allows; assuming "
- "JTAG-only", jtag->name);
- retval = allow_transports(cmd_ctx, jtag_only);
- if (retval != ERROR_OK)
- return retval;
- }
-
if (jtag->speed == NULL) {
LOG_INFO("This adapter doesn't support configurable speed");
return ERROR_OK;
t = n;
}
- dap_cleanup_all();
-
return ERROR_OK;
}
{
LOG_DEBUG("convert khz to interface specific speed value");
speed_khz = khz;
- if (jtag != NULL) {
- LOG_DEBUG("have interface set up");
- int speed_div1;
- int retval = jtag->khz(jtag_get_speed_khz(), &speed_div1);
- if (ERROR_OK != retval)
- return retval;
- *speed = speed_div1;
+ if (!jtag)
+ return ERROR_OK;
+ LOG_DEBUG("have interface set up");
+ if (!jtag->khz) {
+ LOG_ERROR("Translation from khz to jtag_speed not implemented");
+ return ERROR_FAIL;
}
+ int speed_div1;
+ int retval = jtag->khz(jtag_get_speed_khz(), &speed_div1);
+ if (ERROR_OK != retval)
+ return retval;
+ *speed = speed_div1;
return ERROR_OK;
}
int retval = jtag_get_speed(&jtag_speed_var);
if (retval != ERROR_OK)
return retval;
- return jtag ? jtag->speed_div(jtag_speed_var, khz) : ERROR_OK;
+ if (!jtag)
+ return ERROR_OK;
+ if (!jtag->speed_div) {
+ LOG_ERROR("Translation from jtag_speed to khz not implemented");
+ return ERROR_FAIL;
+ }
+ return jtag->speed_div(jtag_speed_var, khz);
}
void jtag_set_verify(bool enable)
LOG_ERROR("No Valid JTAG Interface Configured.");
exit(-1);
}
- return jtag->power_dropout(dropout);
+ if (jtag->power_dropout)
+ return jtag->power_dropout(dropout);
+
+ *dropout = 0; /* by default we can't detect power dropout */
+ return ERROR_OK;
}
int jtag_srst_asserted(int *srst_asserted)
{
- return jtag->srst_asserted(srst_asserted);
+ if (jtag->srst_asserted)
+ return jtag->srst_asserted(srst_asserted);
+
+ *srst_asserted = 0; /* by default we can't detect srst asserted */
+ return ERROR_OK;
}
enum reset_types jtag_get_reset_config(void)
LOG_ERROR("transport is not selected");
}
-int adapter_config_trace(bool enabled, enum tpio_pin_protocol pin_protocol,
+int adapter_config_trace(bool enabled, enum tpiu_pin_protocol pin_protocol,
uint32_t port_size, unsigned int *trace_freq)
{
if (jtag->config_trace)