diff options
author | Franck Jullien <franck.jullien@gmail.com> | 2013-02-03 18:15:13 +0100 |
---|---|---|
committer | Andreas Fritiofson <andreas.fritiofson@gmail.com> | 2013-02-08 22:33:19 +0000 |
commit | 87668aebf1851c06af2513ab5f27ebb9ebf1ff16 (patch) | |
tree | 5f8fad191256e26517b18166b0a276bdd708b3eb /src/jtag | |
parent | feddedb6db72b81714780fae5d0b3a51dc1ddedc (diff) | |
download | riscv-openocd-87668aebf1851c06af2513ab5f27ebb9ebf1ff16.zip riscv-openocd-87668aebf1851c06af2513ab5f27ebb9ebf1ff16.tar.gz riscv-openocd-87668aebf1851c06af2513ab5f27ebb9ebf1ff16.tar.bz2 |
jtag_interface: .speed can be NULL when not needed
adapter_init (core.c) won't check speed configuration
of the selected interface if it's not needed (.speed = NULL).
When it's not needed, we can now omit adapter_khz in
init scripts and we don't have to implement dummy handlers
for speed_div and khz functions.
It also removes calls to adapter_khz in interface configuration
files when not used anymore.
Change-Id: I6eb1894385503fede542a368f297cec6565eed44
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1131
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Diffstat (limited to 'src/jtag')
-rw-r--r-- | src/jtag/core.c | 5 | ||||
-rw-r--r-- | src/jtag/drivers/at91rm9200.c | 8 | ||||
-rw-r--r-- | src/jtag/drivers/buspirate.c | 17 | ||||
-rw-r--r-- | src/jtag/drivers/ep93xx.c | 8 | ||||
-rw-r--r-- | src/jtag/drivers/gw16012.c | 7 | ||||
-rw-r--r-- | src/jtag/drivers/opendous.c | 33 | ||||
-rw-r--r-- | src/jtag/drivers/osbdm.c | 21 | ||||
-rw-r--r-- | src/jtag/drivers/remote_bitbang.c | 21 | ||||
-rw-r--r-- | src/jtag/drivers/sysfsgpio.c | 25 | ||||
-rw-r--r-- | src/jtag/drivers/usb_blaster.c | 22 | ||||
-rw-r--r-- | src/jtag/drivers/usbprog.c | 6 | ||||
-rw-r--r-- | src/jtag/hla/hla_interface.c | 22 |
12 files changed, 5 insertions, 190 deletions
diff --git a/src/jtag/core.c b/src/jtag/core.c index 9f1e4cf..86ba706 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -1371,6 +1371,11 @@ int adapter_init(struct command_context *cmd_ctx) return retval; } + if (jtag->speed == NULL) { + LOG_INFO("This adapter doesn't support configurable speed"); + return ERROR_OK; + } + if (CLOCK_MODE_UNSELECTED == clock_mode) { LOG_ERROR("An adapter speed is not selected in the init script." " Insert a call to adapter_khz or jtag_rclk to proceed."); diff --git a/src/jtag/drivers/at91rm9200.c b/src/jtag/drivers/at91rm9200.c index 3bba368..066d6b6 100644 --- a/src/jtag/drivers/at91rm9200.c +++ b/src/jtag/drivers/at91rm9200.c @@ -115,7 +115,6 @@ static int at91rm9200_read(void); static void at91rm9200_write(int tck, int tms, int tdi); static void at91rm9200_reset(int trst, int srst); -static int at91rm9200_speed(int speed); static int at91rm9200_init(void); static int at91rm9200_quit(void); @@ -163,12 +162,6 @@ static void at91rm9200_reset(int trst, int srst) pio_base[device->SRST_PIO + PIO_CODR] = device->SRST_MASK; } -static int at91rm9200_speed(int speed) -{ - - return ERROR_OK; -} - COMMAND_HANDLER(at91rm9200_handle_device_command) { if (CMD_ARGC == 0) @@ -196,7 +189,6 @@ static const struct command_registration at91rm9200_command_handlers[] = { struct jtag_interface at91rm9200_interface = { .name = "at91rm9200", .execute_queue = bitbang_execute_queue, - .speed = at91rm9200_speed, .commands = at91rm9200_command_handlers, .init = at91rm9200_init, .quit = at91rm9200_quit, diff --git a/src/jtag/drivers/buspirate.c b/src/jtag/drivers/buspirate.c index 10b5e0f..ad9be41 100644 --- a/src/jtag/drivers/buspirate.c +++ b/src/jtag/drivers/buspirate.c @@ -32,8 +32,6 @@ #undef DEBUG_SERIAL /*#define DEBUG_SERIAL */ static int buspirate_execute_queue(void); -static int buspirate_speed(int speed); -static int buspirate_khz(int khz, int *jtag_speed); static int buspirate_init(void); static int buspirate_quit(void); @@ -117,19 +115,6 @@ static int buspirate_serial_read(int fd, char *buf, int size); static void buspirate_serial_close(int fd); static void buspirate_print_buffer(char *buf, int size); -static int buspirate_speed(int speed) -{ - /* TODO */ - LOG_INFO("Want to set speed to %dkHz, but not implemented yet", speed); - return ERROR_OK; -} - -static int buspirate_khz(int khz, int *jtag_speed) -{ - *jtag_speed = khz; - return ERROR_OK; -} - static int buspirate_execute_queue(void) { /* currently processed command */ @@ -426,8 +411,6 @@ static const struct command_registration buspirate_command_handlers[] = { struct jtag_interface buspirate_interface = { .name = "buspirate", .execute_queue = buspirate_execute_queue, - .speed = buspirate_speed, - .khz = buspirate_khz, .commands = buspirate_command_handlers, .init = buspirate_init, .quit = buspirate_quit diff --git a/src/jtag/drivers/ep93xx.c b/src/jtag/drivers/ep93xx.c index 9781130..ff4535b 100644 --- a/src/jtag/drivers/ep93xx.c +++ b/src/jtag/drivers/ep93xx.c @@ -47,7 +47,6 @@ static int ep93xx_read(void); static void ep93xx_write(int tck, int tms, int tdi); static void ep93xx_reset(int trst, int srst); -static int ep93xx_speed(int speed); static int ep93xx_init(void); static int ep93xx_quit(void); @@ -59,7 +58,6 @@ struct jtag_interface ep93xx_interface = { .supported = DEBUG_CAP_TMS_SEQ, .execute_queue = bitbang_execute_queue, - .speed = ep93xx_speed, .init = ep93xx_init, .quit = ep93xx_quit, }; @@ -114,12 +112,6 @@ static void ep93xx_reset(int trst, int srst) nanosleep(&ep93xx_zzzz, NULL); } -static int ep93xx_speed(int speed) -{ - - return ERROR_OK; -} - static int set_gonk_mode(void) { void *syscon; diff --git a/src/jtag/drivers/gw16012.c b/src/jtag/drivers/gw16012.c index bf027f8..a37f8ca 100644 --- a/src/jtag/drivers/gw16012.c +++ b/src/jtag/drivers/gw16012.c @@ -146,12 +146,6 @@ static void gw16012_reset(int trst, int srst) gw16012_control(0x0b); } -static int gw16012_speed(int speed) -{ - - return ERROR_OK; -} - static void gw16012_end_state(tap_state_t state) { if (tap_is_state_stable(state)) @@ -547,6 +541,5 @@ struct jtag_interface gw16012_interface = { .init = gw16012_init, .quit = gw16012_quit, - .speed = gw16012_speed, .execute_queue = gw16012_execute_queue, }; diff --git a/src/jtag/drivers/opendous.c b/src/jtag/drivers/opendous.c index 3a6cf5c..b13cbe0 100644 --- a/src/jtag/drivers/opendous.c +++ b/src/jtag/drivers/opendous.c @@ -86,9 +86,6 @@ static uint8_t usb_out_buffer[OPENDOUS_OUT_BUFFER_SIZE]; /* External interface functions */ static int opendous_execute_queue(void); -static int opendous_speed(int speed); -static int opendous_speed_div(int speed, int *khz); -static int opendous_khz(int khz, int *jtag_speed); static int opendous_init(void); static int opendous_quit(void); @@ -194,9 +191,6 @@ struct jtag_interface opendous_interface = { .name = "opendous", .commands = opendous_command_handlers, .execute_queue = opendous_execute_queue, - .speed = opendous_speed, - .speed_div = opendous_speed_div, - .khz = opendous_khz, .init = opendous_init, .quit = opendous_quit, }; @@ -276,33 +270,6 @@ static int opendous_execute_queue(void) return opendous_tap_execute(); } -/* Sets speed in kHz. */ -static int opendous_speed(int speed) -{ - if (speed <= OPENDOUS_MAX_SPEED) { - /* one day... */ - return ERROR_OK; - } else - LOG_INFO("Requested speed %dkHz exceeds maximum of %dkHz, ignored", speed, OPENDOUS_MAX_SPEED); - - return ERROR_OK; -} - -static int opendous_speed_div(int speed, int *khz) -{ - *khz = speed; - - return ERROR_OK; -} - -static int opendous_khz(int khz, int *jtag_speed) -{ - *jtag_speed = khz; - /* TODO: convert this into delay value for opendous */ - - return ERROR_OK; -} - static int opendous_init(void) { int check_cnt; diff --git a/src/jtag/drivers/osbdm.c b/src/jtag/drivers/osbdm.c index 66dbf3d..2560db1 100644 --- a/src/jtag/drivers/osbdm.c +++ b/src/jtag/drivers/osbdm.c @@ -690,33 +690,12 @@ static int osbdm_init(void) return ERROR_OK; } -static int osbdm_khz(int khz, int *speed) -{ - *speed = khz; - return ERROR_OK; -} - -static int osbdm_speed(int speed) -{ - return ERROR_OK; -} - -static int osbdm_speed_div(int speed, int *khz) -{ - *khz = speed; - return ERROR_OK; -} - struct jtag_interface osbdm_interface = { .name = "osbdm", .transports = jtag_only, .execute_queue = osbdm_execute_queue, - .khz = osbdm_khz, - .speed = osbdm_speed, - .speed_div = osbdm_speed_div, - .init = osbdm_init, .quit = osbdm_quit }; diff --git a/src/jtag/drivers/remote_bitbang.c b/src/jtag/drivers/remote_bitbang.c index 73d9cfc..f6691bb 100644 --- a/src/jtag/drivers/remote_bitbang.c +++ b/src/jtag/drivers/remote_bitbang.c @@ -130,11 +130,6 @@ static struct bitbang_interface remote_bitbang_bitbang = { .blink = &remote_bitbang_blink, }; -static int remote_bitbang_speed(int speed) -{ - return ERROR_OK; -} - static int remote_bitbang_init_tcp(void) { LOG_INFO("Connecting to %s:%i", remote_bitbang_host, remote_bitbang_port); @@ -235,19 +230,6 @@ static int remote_bitbang_init(void) return remote_bitbang_init_tcp(); } -static int remote_bitbang_khz(int khz, int *jtag_speed) -{ - *jtag_speed = 0; - return ERROR_OK; -} - -static int remote_bitbang_speed_div(int speed, int *khz) -{ - /* I don't think this really matters any. */ - *khz = 1; - return ERROR_OK; -} - COMMAND_HANDLER(remote_bitbang_handle_remote_bitbang_port_command) { if (CMD_ARGC == 1) { @@ -290,10 +272,7 @@ static const struct command_registration remote_bitbang_command_handlers[] = { struct jtag_interface remote_bitbang_interface = { .name = "remote_bitbang", .execute_queue = &bitbang_execute_queue, - .speed = &remote_bitbang_speed, .commands = remote_bitbang_command_handlers, .init = &remote_bitbang_init, .quit = &remote_bitbang_quit, - .khz = &remote_bitbang_khz, - .speed_div = &remote_bitbang_speed_div, }; diff --git a/src/jtag/drivers/sysfsgpio.c b/src/jtag/drivers/sysfsgpio.c index 1cad268..283ec44 100644 --- a/src/jtag/drivers/sysfsgpio.c +++ b/src/jtag/drivers/sysfsgpio.c @@ -258,28 +258,6 @@ static void sysfsgpio_reset(int trst, int srst) } } -/* No speed control is implemented yet */ -static int sysfsgpio_speed(int speed) -{ - return ERROR_OK; -} - -static int sysfsgpio_khz(int khz, int *jtag_speed) -{ - /* no adaptive clocking */ - if (khz == 0) - return ERROR_FAIL; - - *jtag_speed = 0; - return ERROR_OK; -} - -static int sysfsgpio_speed_div(int speed, int *khz) -{ - *khz = 1; - return ERROR_OK; -} - /* gpio numbers for each gpio. Negative values are invalid */ static int tck_gpio = -1; static int tms_gpio = -1; @@ -415,9 +393,6 @@ struct jtag_interface sysfsgpio_interface = { .supported = DEBUG_CAP_TMS_SEQ, .execute_queue = bitbang_execute_queue, .transports = jtag_only, - .speed = sysfsgpio_speed, - .khz = sysfsgpio_khz, - .speed_div = sysfsgpio_speed_div, .commands = sysfsgpio_command_handlers, .init = sysfsgpio_init, .quit = sysfsgpio_quit, diff --git a/src/jtag/drivers/usb_blaster.c b/src/jtag/drivers/usb_blaster.c index 088ae34..91c4836 100644 --- a/src/jtag/drivers/usb_blaster.c +++ b/src/jtag/drivers/usb_blaster.c @@ -297,27 +297,6 @@ static void usb_blaster_write(int tck, int tms, int tdi) usb_blaster_addtowritebuffer(out_value, false); } -static int usb_blaster_speed(int speed) -{ -#if BUILD_USB_BLASTER_FTD2XX == 1 - LOG_DEBUG("TODO: usb_blaster_speed() isn't implemented for libftd2xx!"); -#elif BUILD_USB_BLASTER_LIBFTDI == 1 - LOG_DEBUG("TODO: usb_blaster_speed() isn't optimally implemented!"); - - /* TODO: libftdi's ftdi_set_baudrate chokes on high rates, use lowlevel - * usb function instead! And additionally allow user to throttle. - */ - if (ftdi_set_baudrate(&ftdic, 3000000 / 4) < 0) { - LOG_ERROR("Can't set baud rate to max: %s", - ftdi_get_error_string(&ftdic)); - return ERROR_JTAG_DEVICE_ERROR; - } - ; -#endif - - return ERROR_OK; -} - static void usb_blaster_reset(int trst, int srst) { LOG_DEBUG("TODO: usb_blaster_reset(%d,%d) isn't implemented!", @@ -588,7 +567,6 @@ struct jtag_interface usb_blaster_interface = { .execute_queue = bitbang_execute_queue, - .speed = usb_blaster_speed, .init = usb_blaster_init, .quit = usb_blaster_quit, }; diff --git a/src/jtag/drivers/usbprog.c b/src/jtag/drivers/usbprog.c index e90d569..77e7a7a 100644 --- a/src/jtag/drivers/usbprog.c +++ b/src/jtag/drivers/usbprog.c @@ -96,11 +96,6 @@ static void usbprog_jtag_write_slice(struct usbprog_jtag *usbprog_jtag, unsigned static void usbprog_jtag_set_bit(struct usbprog_jtag *usbprog_jtag, int bit, int value); /* static int usbprog_jtag_get_bit(struct usbprog_jtag *usbprog_jtag, int bit); */ -static int usbprog_speed(int speed) -{ - return ERROR_OK; -} - static int usbprog_execute_queue(void) { struct jtag_command *cmd = jtag_command_queue; /* currently processed command */ @@ -621,7 +616,6 @@ struct jtag_interface usbprog_interface = { .name = "usbprog", .execute_queue = usbprog_execute_queue, - .speed = usbprog_speed, .init = usbprog_init, .quit = usbprog_quit }; diff --git a/src/jtag/hla/hla_interface.c b/src/jtag/hla/hla_interface.c index 5f493ff..53ad8e7 100644 --- a/src/jtag/hla/hla_interface.c +++ b/src/jtag/hla/hla_interface.c @@ -108,25 +108,6 @@ static int hl_interface_quit(void) return ERROR_OK; } -static int hl_interface_speed(int speed) -{ - LOG_DEBUG("hl_interface_speed: ignore speed %d", speed); - - return ERROR_OK; -} - -static int hl_speed_div(int speed, int *khz) -{ - *khz = speed; - return ERROR_OK; -} - -static int hl_khz(int khz, int *jtag_speed) -{ - *jtag_speed = khz; - return ERROR_OK; -} - static int hl_interface_execute_queue(void) { LOG_DEBUG("hl_interface_execute_queue: ignored"); @@ -279,8 +260,5 @@ struct jtag_interface hl_interface = { .transports = hl_transports, .init = hl_interface_init, .quit = hl_interface_quit, - .speed = hl_interface_speed, - .speed_div = hl_speed_div, - .khz = hl_khz, .execute_queue = hl_interface_execute_queue, }; |