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>
This commit is contained in:
Franck Jullien 2013-02-03 18:15:13 +01:00 committed by Andreas Fritiofson
parent feddedb6db
commit 87668aebf1
19 changed files with 5 additions and 207 deletions

View 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.");

View 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,

View 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

View 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;

View 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,
};

View 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;

View 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
};

View 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,
};

View 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,

View 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,
};

View 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
};

View 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,
};

View 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

View File

@ -5,8 +5,3 @@
#
interface osbdm
reset_config srst_only
#
# OSBDM doesn't support speed control
#
adapter_khz 1

View 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

View 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

View 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

View 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

View File

@ -7,5 +7,3 @@
interface usb_blaster
usb_blaster_vid_pid 0x16C0 0x06AD
usb_blaster_device_desc "USB-JTAG-IF"
adapter_khz 3000