jtag: remove useless forward declarations
authorZachary T Welch <zw@superlucidity.net>
Sat, 21 Nov 2009 18:20:56 +0000 (10:20 -0800)
committerZachary T Welch <zw@superlucidity.net>
Sat, 21 Nov 2009 18:20:56 +0000 (10:20 -0800)
Removes some more useless forward declarations from a few JTAG drivers.
Moves interface and bit-bang structure defitions below their callbacks.

src/jtag/arm-jtag-ew.c
src/jtag/dummy.c
src/jtag/jlink.c
src/jtag/presto.c
src/jtag/usbprog.c

index 18b353acf34a0a35a4f6efa20d2d9346bd6e8536..46dacc6dccd25373897373a1d0f2e6b8b12f25de 100644 (file)
 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);
@@ -105,18 +97,6 @@ static struct armjtagew* armjtagew_handle;
 /***************************************************************************/
 /* 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;
@@ -529,6 +509,16 @@ static int armjtagew_register_commands(struct command_context *cmd_ctx)
        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 */
 
index 324ea7e94409de98d1fc30b1eb3e00d967e24180..051679009976e4010196f1c7f5e7e60d26608c1f 100644 (file)
@@ -35,45 +35,6 @@ static int clock_count;         /* count clocks in any stable state, only stable
 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;
@@ -129,6 +90,18 @@ static void dummy_reset(int trst, int srst)
        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)
@@ -178,7 +151,19 @@ static int dummy_quit(void)
        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,
+       };
index dbbddb868a2fe83be82ff2850b4a89ea2baf2490..ebc9acd26c060d4cc8d2338f1502bbe2f71d057d 100644 (file)
@@ -82,15 +82,6 @@ static uint8_t usb_emu_result_buffer[JLINK_EMU_RESULT_BUFFER_SIZE];
 /* 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);
@@ -134,18 +125,6 @@ static struct jlink* jlink_handle;
 /***************************************************************************/
 /* 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",
@@ -661,6 +640,17 @@ static int jlink_register_commands(struct command_context *cmd_ctx)
        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 */
 
index 1d6bc1db3f39e2f80b75f11101505ddefb8c5e13..437e2c08ccb68bbb3353d4ca25e56c1ab5e1d648 100644 (file)
 #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
@@ -699,6 +663,15 @@ static int presto_bitq_reset(int trst, int srst)
        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)
@@ -807,3 +780,14 @@ static int presto_jtag_quit(void)
 
        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,
+       };
index 10dfe0619fc42b579e840011895f7ea2fab4349a..e8c0eadf9f87e54f4d6bb4c49b4e6ee19cf3f8bd 100644 (file)
 #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
@@ -120,11 +104,6 @@ static int usbprog_speed(int speed)
        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 */
@@ -688,3 +667,11 @@ static void usbprog_jtag_tms_send(struct usbprog_jtag *usbprog_jtag)
                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
+       };

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)