Skip to content

Commit

Permalink
jtag: set default "jtag_only" to uninitialized transports
Browse files Browse the repository at this point in the history
For legacy support, drivers that do not define a list of
transports get identified as jtag_only.

Cleanup this old crust and initialize properly the transports
field in the jtag_interface for all the drivers.

Change-Id: I9c86064e5d05bd0212bc18f4424414e615e617fe
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: http:https://openocd.zylin.com/4893
Tested-by: jenkins
Reviewed-by: Tomas Vanek <[email protected]>
  • Loading branch information
borneoa authored and tom-van committed Jun 6, 2019
1 parent 0cba5b4 commit 159f11f
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 23 deletions.
11 changes: 1 addition & 10 deletions src/jtag/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,7 @@ COMMAND_HANDLER(handle_interface_command)

jtag_interface = jtag_interfaces[i];

/* LEGACY SUPPORT ... adapter drivers must declare what
* transports they allow. Until they all do so, assume
* the legacy drivers are JTAG-only
*/
if (!jtag_interface->transports)
LOG_WARNING("Adapter driver '%s' did not declare "
"which transports it allows; assuming "
"legacy JTAG-only", jtag_interface->name);
return allow_transports(CMD_CTX, jtag_interface->transports
? jtag_interface->transports : jtag_only);
return allow_transports(CMD_CTX, jtag_interface->transports);
}

/* no valid interface was found (i.e. the configuration option,
Expand Down
13 changes: 0 additions & 13 deletions src/jtag/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1348,19 +1348,6 @@ int adapter_init(struct command_context *cmd_ctx)
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;
Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/amt_jtagaccel.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ static const struct command_registration amtjtagaccel_command_handlers[] = {

struct jtag_interface amt_jtagaccel_interface = {
.name = "amt_jtagaccel",
.transports = jtag_only,
.commands = amtjtagaccel_command_handlers,

.init = amt_jtagaccel_init,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/at91rm9200.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ static const struct command_registration at91rm9200_command_handlers[] = {
struct jtag_interface at91rm9200_interface = {
.name = "at91rm9200",
.execute_queue = bitbang_execute_queue,
.transports = jtag_only,
.commands = at91rm9200_command_handlers,
.init = at91rm9200_init,
.quit = at91rm9200_quit,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/ep93xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct jtag_interface ep93xx_interface = {

.supported = DEBUG_CAP_TMS_SEQ,
.execute_queue = bitbang_execute_queue,
.transports = jtag_only,

.init = ep93xx_init,
.quit = ep93xx_quit,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/gw16012.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ static const struct command_registration gw16012_command_handlers[] = {

struct jtag_interface gw16012_interface = {
.name = "gw16012",
.transports = jtag_only,
.commands = gw16012_command_handlers,

.init = gw16012_init,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/opendous.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ static const struct command_registration opendous_command_handlers[] = {

struct jtag_interface opendous_interface = {
.name = "opendous",
.transports = jtag_only,
.commands = opendous_command_handlers,
.execute_queue = opendous_execute_queue,
.init = opendous_init,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/openjtag.c
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,7 @@ static const struct command_registration openjtag_command_handlers[] = {

struct jtag_interface openjtag_interface = {
.name = "openjtag",
.transports = jtag_only,
.commands = openjtag_command_handlers,

.execute_queue = openjtag_execute_queue,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/parport.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ static const struct command_registration parport_command_handlers[] = {
struct jtag_interface parport_interface = {
.name = "parport",
.supported = DEBUG_CAP_TMS_SEQ,
.transports = jtag_only,
.commands = parport_command_handlers,

.init = parport_init,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/presto.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ static int presto_jtag_quit(void)

struct jtag_interface presto_interface = {
.name = "presto",
.transports = jtag_only,
.commands = presto_command_handlers,

.execute_queue = bitq_execute_queue,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/remote_bitbang.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ static const struct command_registration remote_bitbang_command_handlers[] = {
struct jtag_interface remote_bitbang_interface = {
.name = "remote_bitbang",
.execute_queue = &bitbang_execute_queue,
.transports = jtag_only,
.commands = remote_bitbang_command_handlers,
.init = &remote_bitbang_init,
.quit = &remote_bitbang_quit,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/rlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,7 @@ static int rlink_quit(void)

struct jtag_interface rlink_interface = {
.name = "rlink",
.transports = jtag_only,
.init = rlink_init,
.quit = rlink_quit,
.speed = rlink_speed,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/usb_blaster/usb_blaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ static const struct command_registration ublast_command_handlers[] = {

struct jtag_interface usb_blaster_interface = {
.name = "usb_blaster",
.transports = jtag_only,
.commands = ublast_command_handlers,
.supported = DEBUG_CAP_TMS_SEQ,

Expand Down
1 change: 1 addition & 0 deletions src/jtag/drivers/usbprog.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ static void usbprog_jtag_tms_send(struct usbprog_jtag *usbprog_jtag)

struct jtag_interface usbprog_interface = {
.name = "usbprog",
.transports = jtag_only,

.execute_queue = usbprog_execute_queue,
.init = usbprog_init,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/minidummy/minidummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct jtag_interface minidummy_interface = {
.name = "minidummy",
.execute_queue = NULL,
.speed = NULL,
.transports = jtag_only,
.commands = NULL,
.init = NULL,
.quit = NULL,
Expand Down
1 change: 1 addition & 0 deletions src/jtag/zy1000/zy1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,7 @@ struct jtag_interface zy1000_interface = {
.supported = DEBUG_CAP_TMS_SEQ,
.execute_queue = NULL,
.speed = zy1000_speed,
.transports = jtag_only,
.commands = zy1000_commands,
.init = zy1000_init,
.quit = zy1000_quit,
Expand Down

0 comments on commit 159f11f

Please sign in to comment.