Removes some more useless forward declarations from a few JTAG drivers.
Moves interface and bit-bang structure defitions below their callbacks.
static uint8_t usb_in_buffer[ARMJTAGEW_IN_BUFFER_SIZE];
static uint8_t usb_out_buffer[ARMJTAGEW_OUT_BUFFER_SIZE];
-/* External interface functions */
-static int armjtagew_execute_queue(void);
-static int armjtagew_speed(int speed);
-static int armjtagew_khz(int khz, int *jtag_speed);
-static int armjtagew_register_commands(struct command_context *cmd_ctx);
-static int armjtagew_init(void);
-static int armjtagew_quit(void);
-
/* Queue command functions */
static void armjtagew_end_state(tap_state_t state);
static void armjtagew_state_move(void);
/***************************************************************************/
/* External interface implementation */
-struct jtag_interface armjtagew_interface =
-{
- .name = "arm-jtag-ew",
- .execute_queue = armjtagew_execute_queue,
- .speed = armjtagew_speed,
- .khz = armjtagew_khz,
- .register_commands = armjtagew_register_commands,
- .init = armjtagew_init,
- .quit = armjtagew_quit
-};
-
-
static int armjtagew_execute_queue(void)
{
struct jtag_command *cmd = jtag_command_queue;
return ERROR_OK;
}
+struct jtag_interface armjtagew_interface = {
+ .name = "arm-jtag-ew",
+ .execute_queue = &armjtagew_execute_queue,
+ .speed = &armjtagew_speed,
+ .khz = &armjtagew_khz,
+ .register_commands = &armjtagew_register_commands,
+ .init = &armjtagew_init,
+ .quit = &armjtagew_quit,
+ };
+
/***************************************************************************/
/* ARM-JTAG-EW tap functions */
static uint32_t dummy_data;
-static int dummy_speed(int speed);
-static int dummy_register_commands(struct command_context *cmd_ctx);
-static int dummy_init(void);
-static int dummy_quit(void);
-static int dummy_khz(int khz, int *jtag_speed);
-static int dummy_speed_div(int speed, int *khz);
-
-
-/* The dummy driver is used to easily check the code path
- * where the target is unresponsive.
- */
-struct jtag_interface dummy_interface =
-{
- .name = "dummy",
-
- .execute_queue = bitbang_execute_queue,
-
- .speed = dummy_speed,
- .register_commands = dummy_register_commands,
- .khz = dummy_khz,
- .speed_div = dummy_speed_div,
-
- .init = dummy_init,
- .quit = dummy_quit,
-};
-
-static int dummy_read(void);
-static void dummy_write(int tck, int tms, int tdi);
-static void dummy_reset(int trst, int srst);
-static void dummy_led(int on);
-
-static struct bitbang_interface dummy_bitbang =
-{
- .read = dummy_read,
- .write = dummy_write,
- .reset = dummy_reset,
- .blink = dummy_led
-};
-
static int dummy_read(void)
{
int data = 1 & dummy_data;
LOG_DEBUG("reset to: %s", tap_state_name(dummy_state));
}
+static void dummy_led(int on)
+{
+}
+
+static struct bitbang_interface dummy_bitbang = {
+ .read = &dummy_read,
+ .write = &dummy_write,
+ .reset = &dummy_reset,
+ .blink = &dummy_led,
+ };
+
+
static int dummy_khz(int khz, int *jtag_speed)
{
if (khz == 0)
return ERROR_OK;
}
-static void dummy_led(int on)
-{
-}
+/* The dummy driver is used to easily check the code path
+ * where the target is unresponsive.
+ */
+struct jtag_interface dummy_interface = {
+ .name = "dummy",
+
+ .execute_queue = &bitbang_execute_queue,
+
+ .speed = &dummy_speed,
+ .register_commands = &dummy_register_commands,
+ .khz = &dummy_khz,
+ .speed_div = &dummy_speed_div,
+ .init = &dummy_init,
+ .quit = &dummy_quit,
+ };
/* max speed 12MHz v5.0 jlink */
#define JLINK_MAX_SPEED 12000
-/* External interface functions */
-static int jlink_execute_queue(void);
-static int jlink_speed(int speed);
-static int jlink_speed_div(int speed, int* khz);
-static int jlink_khz(int khz, int *jtag_speed);
-static int jlink_register_commands(struct command_context *cmd_ctx);
-static int jlink_init(void);
-static int jlink_quit(void);
-
/* Queue command functions */
static void jlink_end_state(tap_state_t state);
static void jlink_state_move(void);
/***************************************************************************/
/* External interface implementation */
-struct jtag_interface jlink_interface =
-{
- .name = "jlink",
- .execute_queue = jlink_execute_queue,
- .speed = jlink_speed,
- .speed_div = jlink_speed_div,
- .khz = jlink_khz,
- .register_commands = jlink_register_commands,
- .init = jlink_init,
- .quit = jlink_quit
-};
-
static void jlink_execute_runtest(struct jtag_command *cmd)
{
DEBUG_JTAG_IO("runtest %i cycles, end in %i",
return ERROR_OK;
}
+struct jtag_interface jlink_interface = {
+ .name = "jlink",
+ .execute_queue = &jlink_execute_queue,
+ .speed = &jlink_speed,
+ .speed_div = &jlink_speed_div,
+ .khz = &jlink_khz,
+ .register_commands = &jlink_register_commands,
+ .init = &jlink_init,
+ .quit = &jlink_quit,
+ };
+
/***************************************************************************/
/* J-Link tap functions */
#error "BUG: either FTD2XX and LIBFTDI has to be used"
#endif
-static int presto_jtag_speed(int speed);
-static int presto_jtag_khz(int khz, int *jtag_speed);
-static int presto_jtag_speed_div(int speed, int *khz);
-static int presto_jtag_register_commands(struct command_context *cmd_ctx);
-static int presto_jtag_init(void);
-static int presto_jtag_quit(void);
-
-struct jtag_interface presto_interface =
-{
- .name = "presto",
- .execute_queue = bitq_execute_queue,
- .speed = presto_jtag_speed,
- .khz = presto_jtag_khz,
- .speed_div = presto_jtag_speed_div,
- .register_commands = presto_jtag_register_commands,
- .init = presto_jtag_init,
- .quit = presto_jtag_quit,
-};
-
-static int presto_bitq_out(int tms, int tdi, int tdo_req);
-static int presto_bitq_flush(void);
-static int presto_bitq_sleep(unsigned long us);
-static int presto_bitq_reset(int trst, int srst);
-static int presto_bitq_in_rdy(void);
-static int presto_bitq_in(void);
-
-static struct bitq_interface presto_bitq =
-{
- .out = presto_bitq_out,
- .flush = presto_bitq_flush,
- .sleep = presto_bitq_sleep,
- .reset = presto_bitq_reset,
- .in_rdy = presto_bitq_in_rdy,
- .in = presto_bitq_in,
-};
-
/* -------------------------------------------------------------------------- */
#define FT_DEVICE_NAME_LEN 64
return 0;
}
+static struct bitq_interface presto_bitq = {
+ .out = &presto_bitq_out,
+ .flush = &presto_bitq_flush,
+ .sleep = &presto_bitq_sleep,
+ .reset = &presto_bitq_reset,
+ .in_rdy = &presto_bitq_in_rdy,
+ .in = &presto_bitq_in,
+ };
+
/* -------------------------------------------------------------------------- */
static int presto_jtag_khz(int khz, int *jtag_speed)
return ERROR_OK;
}
+
+struct jtag_interface presto_interface = {
+ .name = "presto",
+ .execute_queue = &bitq_execute_queue,
+ .speed = &presto_jtag_speed,
+ .khz = &presto_jtag_khz,
+ .speed_div = &presto_jtag_speed_div,
+ .register_commands = &presto_jtag_register_commands,
+ .init = &presto_jtag_init,
+ .quit = &presto_jtag_quit,
+ };
#define TCK_BIT 2
#define TMS_BIT 1
-static int usbprog_execute_queue(void);
-static int usbprog_speed(int speed);
-static int usbprog_register_commands(struct command_context *cmd_ctx);
-static int usbprog_init(void);
-static int usbprog_quit(void);
-
static void usbprog_end_state(tap_state_t state);
static void usbprog_state_move(void);
static void usbprog_path_move(struct pathmove_command *cmd);
static void usbprog_runtest(int num_cycles);
static void usbprog_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size);
-struct jtag_interface usbprog_interface =
-{
- .name = "usbprog",
- .execute_queue = usbprog_execute_queue,
- .speed = usbprog_speed,
- .register_commands = usbprog_register_commands,
- .init = usbprog_init,
- .quit = usbprog_quit
-};
-
#define UNKOWN_COMMAND 0x00
#define PORT_DIRECTION 0x01
#define PORT_SET 0x02
return ERROR_OK;
}
-static int usbprog_register_commands(struct command_context *cmd_ctx)
-{
- return ERROR_OK;
-}
-
static int usbprog_execute_queue(void)
{
struct jtag_command *cmd = jtag_command_queue; /* currently processed command */
tms_chain_index = 0;
}
}
+
+struct jtag_interface usbprog_interface = {
+ .name = "usbprog",
+ .execute_queue = &usbprog_execute_queue,
+ .speed = &usbprog_speed,
+ .init = &usbprog_init,
+ .quit = &usbprog_quit
+ };