jtag_interface: .speed can be NULL when not needed 31/1131/5
authorFranck Jullien <franck.jullien@gmail.com>
Sun, 3 Feb 2013 17:15:13 +0000 (18:15 +0100)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Fri, 8 Feb 2013 22:33:19 +0000 (22:33 +0000)
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>
19 files changed:
src/jtag/core.c
src/jtag/drivers/at91rm9200.c
src/jtag/drivers/buspirate.c
src/jtag/drivers/ep93xx.c
src/jtag/drivers/gw16012.c
src/jtag/drivers/opendous.c
src/jtag/drivers/osbdm.c
src/jtag/drivers/remote_bitbang.c
src/jtag/drivers/sysfsgpio.c
src/jtag/drivers/usb_blaster.c
src/jtag/drivers/usbprog.c
src/jtag/hla/hla_interface.c
tcl/interface/altera-usb-blaster.cfg
tcl/interface/osbdm.cfg
tcl/interface/stlink-v1.cfg
tcl/interface/stlink-v2.cfg
tcl/interface/sysfsgpio-raspberrypi.cfg
tcl/interface/ti-icdi.cfg
tcl/interface/usb-jtag.cfg

index 9f1e4cf03903fbe223473f7a0aec4b8cd1847386..86ba706bac1743511f188331c22ad43f653467dc 100644 (file)
@@ -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.");
index 3bba368fab6f5335027493146421fa29bbe7cd82..066d6b68a392efba45715828585a63e86bc50551 100644 (file)
@@ -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,
index 10b5e0fde6d19c8c0ef22abf8504755728aa34d9..ad9be41e2c6eb45e29ec7aadf1e5a4c504457a22 100644 (file)
@@ -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
index 978113076ee4aa26d86c255b267b01b9523013b8..ff4535bd3ed63166129b0cd026bd953dd54564bd 100644 (file)
@@ -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;
index bf027f8fe9b42712785a3bbbc17a01d3f8c05537..a37f8caff4112fb7aa9eb5cc1e7d1b20f68b1960 100644 (file)
@@ -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,
 };
index 3a6cf5c693bad67bb929adccb8dc2f84751cffa4..b13cbe054a16e027257c43ac796eeffcf0b3e82c 100644 (file)
@@ -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;
index 66dbf3de1d61bc08797f6a59ea02686caa53081d..2560db18f248a026fc9af3c4ee8d9526832cee95 100644 (file)
@@ -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
 };
index 73d9cfcc0d9164d97b75f9af525cf872359fba73..f6691bb625a5483690ec44528eebbd78217dedf7 100644 (file)
@@ -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,
 };
index 1cad268936547566f126cfa6ce2938fbcfecec80..283ec445a2c870b4d7938853063425ef056105e6 100644 (file)
@@ -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,
index 088ae34f80f92cf50d96a860bb79cbaf5caeae45..91c4836538c2deaf9a236c6dbeb068d19c72af45 100644 (file)
@@ -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,
 };
index e90d56931e3876ea1f1e82219eca4c914dc11ef6..77e7a7a824448a104b95f432a37f74afe24adf77 100644 (file)
@@ -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
 };
index 5f493ffe2454df739b94401b062bfe04e26f2810..53ad8e71739fbbdfbbecf092973993806f542ca7 100644 (file)
@@ -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,
 };
index 9f542d0a4c22ccab90aac68fb5b667f293ff6736..f19abfebe42b7131b29359ee5af69e6e5774a8f1 100644 (file)
@@ -8,4 +8,3 @@ interface usb_blaster
 # These are already the defaults.
 # usb_blaster_vid_pid 0x09FB 0x6001
 # usb_blaster_device_desc "USB-Blaster"
-adapter_khz 3000
index 4d0c79d3d90a6ec56b8f4b7e5a7a8f7753c1a8d5..e88ce50b594681ede42096edf942cb01e60d19d7 100644 (file)
@@ -5,8 +5,3 @@
 #
 interface osbdm
 reset_config srst_only
-
-#
-# OSBDM doesn't support speed control
-#
-adapter_khz 1
index 7f4a6720b20289f47afe39fbb8cf7450509c10fd..13f207dc6b467f76ec8e3df342a75d04a25598ce 100644 (file)
@@ -7,5 +7,3 @@ hla_layout stlink
 hla_device_desc "ST-LINK/V1"
 hla_vid_pid 0x0483 0x3744
 
-# unused but set to disable warnings
-adapter_khz 1000
index da0a2002f9080082b6406f95b359f5be1ea5b18a..e145d6353f5886727f1e5669d3cba121bfdd9e01 100644 (file)
@@ -7,5 +7,3 @@ hla_layout stlink
 hla_device_desc "ST-LINK/V2"
 hla_vid_pid 0x0483 0x3748
 
-# unused but set to disable warnings
-adapter_khz 1000
index 105173c94a4291bc7de380bb7d831b184b541c05..36364228478c6f2377aec7960f5db4e711264857 100644 (file)
@@ -10,9 +10,6 @@
 
 interface sysfsgpio
 
-# This has no effect on the driver, but is required
-adapter_khz 100
-
 # Each of the JTAG lines need a gpio number set: tck tms tdi tdo
 # Header pin numbers: 23 22 19 21
 sysfsgpio_jtag_nums 11 25 10 9
index 16a901e931687f5d50b142f07444e13cca5b826a..0fc3a9b6755181bb351f7b32833752c9bb151c5d 100644 (file)
@@ -11,5 +11,3 @@ interface hla
 hla_layout ti-icdi
 hla_vid_pid 0x1cbe 0x00fd
 
-# unused but set to disable warnings
-adapter_khz 1000
index a3db11e3635201e77c7a39dfd37aad054c78984f..f0164cafd7d67a450c939c5aac1be6286abe9d54 100644 (file)
@@ -7,5 +7,3 @@
 interface usb_blaster
 usb_blaster_vid_pid 0x16C0 0x06AD
 usb_blaster_device_desc "USB-JTAG-IF"
-adapter_khz 3000
-

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)