From e55a45ba5f0cb99b0093a378e5171d48f476e2aa Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 23 Jan 2010 20:37:32 +0000 Subject: [PATCH] constify the usb cable drivers git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1717 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 5 +++ urjtag/src/tap/cable/ft2232.c | 56 +++++++++++++------------- urjtag/src/tap/cable/generic_usbconn.c | 2 +- urjtag/src/tap/cable/generic_usbconn.h | 2 +- urjtag/src/tap/cable/jlink.c | 2 +- urjtag/src/tap/cable/usbblaster.c | 16 ++++---- urjtag/src/tap/cable/xpc.c | 4 +- 7 files changed, 46 insertions(+), 41 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 365f020d..c9282020 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -56,6 +56,11 @@ * src/tap/cable/ft2232.c, src/tap/cable/ft2232_list.h: Unify the list of ftdi usb cable drivers. + * src/tap/cable/ft2232.c, src/tap/cable/generic_usbconn.c, + src/tap/cable/generic_usbconn.h, src/tap/cable/jlink.c, + src/tap/cable/usbblaster.c, src/tap/cable/xpc.c: Constify the usb cable + drivers + 2010-01-22 Mike Frysinger * src/cmd/cmd_bit.c (cmd_bit_print_params): Fix strncat length handling. diff --git a/urjtag/src/tap/cable/ft2232.c b/urjtag/src/tap/cable/ft2232.c index 679b1530..6eb4de83 100644 --- a/urjtag/src/tap/cable/ft2232.c +++ b/urjtag/src/tap/cable/ft2232.c @@ -1819,14 +1819,14 @@ ft2232_cable_free (urj_cable_t *cable) } -#define _URJ_FTDI(usb) urj_usbconn_cable_t urj_tap_cable_usbconn_##usb##_ftdi; +#define _URJ_FTDI(usb) const urj_usbconn_cable_t urj_tap_cable_usbconn_##usb##_ftdi; #include "ft2232_list.h" static void ft2232_usbcable_help (urj_log_level_t ll, const char *cablename) { - urj_usbconn_cable_t *conn; + const urj_usbconn_cable_t *conn; #define _URJ_FTDI(usb) \ conn = &urj_tap_cable_usbconn_##usb##_ftdi; \ @@ -1864,14 +1864,14 @@ const urj_cable_driver_t urj_tap_cable_ft2232_driver = { ft2232_flush, ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftdi = { "FT2232", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x0000, /* VID */ 0x0000 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftd2xx = { "FT2232", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ @@ -1897,28 +1897,28 @@ const urj_cable_driver_t urj_tap_cable_ft2232_armusbocd_driver = { ft2232_flush, ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftdi = { "ARM-USB-OCD", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x15BA, /* VID */ 0x0003 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftd2xx = { "ARM-USB-OCD", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ 0x15BA, /* VID */ 0x0003 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocdtiny_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocdtiny_ftdi = { "ARM-USB-OCD", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x15BA, /* VID */ 0x0004 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocdtiny_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocdtiny_ftd2xx = { "ARM-USB-OCD", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ @@ -1944,14 +1944,14 @@ const urj_cable_driver_t urj_tap_cable_ft2232_armusbtiny_h_driver = { ft2232_flush, ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_armusbtiny_h_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_armusbtiny_h_ftdi = { "ARM-USB-TINY-H", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x15BA, /* VID */ 0x002A /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_armusbtiny_h_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_armusbtiny_h_ftd2xx = { "ARM-USB-TINY-H", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ @@ -1978,14 +1978,14 @@ const urj_cable_driver_t urj_tap_cable_ft2232_gnice_driver = { ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftdi = { "gnICE", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x0456, /* VID */ 0xF000 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftd2xx = { "gnICE", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ @@ -2012,14 +2012,14 @@ const urj_cable_driver_t urj_tap_cable_ft2232_gniceplus_driver = { ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_gniceplus_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_gniceplus_ftdi = { "gnICE+", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x0456, /* VID */ 0xF001 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_gniceplus_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_gniceplus_ftd2xx = { "gnICE+", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ @@ -2045,14 +2045,14 @@ const urj_cable_driver_t urj_tap_cable_ft2232_jtagkey_driver = { ft2232_flush, ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftdi = { "JTAGkey", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x0403, /* VID */ 0xCFF8 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftd2xx = { "JTAGkey", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ @@ -2078,14 +2078,14 @@ const urj_cable_driver_t urj_tap_cable_ft2232_oocdlinks_driver = { ft2232_flush, ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftdi = { "OOCDLink-s", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x0403, /* VID */ 0xbaf8 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftd2xx = { "OOCDLink-s", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ @@ -2111,14 +2111,14 @@ const urj_cable_driver_t urj_tap_cable_ft2232_turtelizer2_driver = { ft2232_flush, ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftdi = { "Turtelizer2", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x0403, /* VID */ 0xBDC8 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftd2xx = { "Turtelizer2", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ @@ -2144,14 +2144,14 @@ const urj_cable_driver_t urj_tap_cable_ft2232_usbtojtagif_driver = { ft2232_flush, ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftdi = { "USB-to-JTAG-IF", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x0000, /* VID */ 0x0000 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftd2xx = { "USB-to-JTAG-IF", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ @@ -2177,14 +2177,14 @@ const urj_cable_driver_t urj_tap_cable_ft2232_signalyzer_driver = { ft2232_flush, ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftdi = { "Signalyzer", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x0403, /* VID */ 0xbca1 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftd2xx = { "Signalyzer", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ @@ -2210,14 +2210,14 @@ const urj_cable_driver_t urj_tap_cable_ft2232_flyswatter_driver = { ft2232_flush, ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftdi = { "Flyswatter", /* cable name */ NULL, /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x0403, /* VID */ 0x6010 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftd2xx = { "Flyswatter", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ @@ -2243,14 +2243,14 @@ const urj_cable_driver_t urj_tap_cable_ft2232_usbscarab2_driver = { ft2232_flush, ft2232_usbcable_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftdi = { "usbScarab2", /* cable name */ "usbScarab2", /* string pattern, not used */ "ftdi-mpsse", /* default usbconn driver */ 0x0403, /* VID */ 0xbbe0 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftd2xx = { "usbScarab2", /* cable name */ "usbScarab2", /* string pattern, not used */ "ftd2xx-mpsse", /* default usbconn driver */ diff --git a/urjtag/src/tap/cable/generic_usbconn.c b/urjtag/src/tap/cable/generic_usbconn.c index a3af2389..bb2135bc 100644 --- a/urjtag/src/tap/cable/generic_usbconn.c +++ b/urjtag/src/tap/cable/generic_usbconn.c @@ -35,7 +35,7 @@ #include -urj_usbconn_cable_t *urj_tap_cable_usbconn_cables[] = { +const urj_usbconn_cable_t *urj_tap_cable_usbconn_cables[] = { #define _URJ_USB(usb) &urj_tap_cable_usbconn_##usb, #include "generic_usbconn_list.h" NULL diff --git a/urjtag/src/tap/cable/generic_usbconn.h b/urjtag/src/tap/cable/generic_usbconn.h index 105c4949..ac343646 100644 --- a/urjtag/src/tap/cable/generic_usbconn.h +++ b/urjtag/src/tap/cable/generic_usbconn.h @@ -28,7 +28,7 @@ #include #include -#define _URJ_USB(usb) extern urj_usbconn_cable_t urj_tap_cable_usbconn_##usb; +#define _URJ_USB(usb) extern const urj_usbconn_cable_t urj_tap_cable_usbconn_##usb; #include "generic_usbconn_list.h" /** diff --git a/urjtag/src/tap/cable/jlink.c b/urjtag/src/tap/cable/jlink.c index 3c7ccfde..a7ee3f36 100644 --- a/urjtag/src/tap/cable/jlink.c +++ b/urjtag/src/tap/cable/jlink.c @@ -607,7 +607,7 @@ const urj_cable_driver_t urj_tap_cable_jlink_driver = { urj_tap_cable_generic_usbconn_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_jlink = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_jlink = { "jlink", /* cable name */ NULL, /* string pattern, not used */ "libusb", /* usbconn driver */ diff --git a/urjtag/src/tap/cable/usbblaster.c b/urjtag/src/tap/cable/usbblaster.c index f221726e..b4dbe18a 100644 --- a/urjtag/src/tap/cable/usbblaster.c +++ b/urjtag/src/tap/cable/usbblaster.c @@ -529,56 +529,56 @@ const urj_cable_driver_t urj_tap_cable_usbblaster_driver = { usbblaster_flush, usbblaster_help, }; -urj_usbconn_cable_t urj_tap_cable_usbconn_usbblaster_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_usbblaster_ftdi = { "UsbBlaster", /* cable name */ NULL, /* string pattern, not used */ "ftdi", /* default usbconn driver */ 0x09FB, /* VID */ 0x6001 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_cubic_cyclonium_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_cubic_cyclonium_ftdi = { "UsbBlaster", /* cable name */ NULL, /* string pattern, not used */ "ftdi", /* default usbconn driver */ 0x09FB, /* VID */ 0x6002 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_nios_eval_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_nios_eval_ftdi = { "UsbBlaster", /* cable name */ NULL, /* string pattern, not used */ "ftdi", /* default usbconn driver */ 0x09FB, /* VID */ 0x6003 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_usb_jtag_ftdi = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_usb_jtag_ftdi = { "UsbBlaster", /* cable name */ NULL, /* string pattern, not used */ "ftdi", /* default usbconn driver */ 0x16C0, /* VID */ 0x06AD /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_usbblaster_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_usbblaster_ftd2xx = { "UsbBlaster", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx", /* default usbconn driver */ 0x09FB, /* VID */ 0x6001 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_cubic_cyclonium_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_cubic_cyclonium_ftd2xx = { "UsbBlaster", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx", /* default usbconn driver */ 0x09FB, /* VID */ 0x6002 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_nios_eval_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_nios_eval_ftd2xx = { "UsbBlaster", /* cable name */ NULL, /* string pattern, not used */ "ftdi", /* default usbconn driver */ 0x09FB, /* VID */ 0x6003 /* PID */ }; -urj_usbconn_cable_t urj_tap_cable_usbconn_usb_jtag_ftd2xx = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_usb_jtag_ftd2xx = { "UsbBlaster", /* cable name */ NULL, /* string pattern, not used */ "ftd2xx", /* default usbconn driver */ diff --git a/urjtag/src/tap/cable/xpc.c b/urjtag/src/tap/cable/xpc.c index 31ee2cfe..d873e063 100644 --- a/urjtag/src/tap/cable/xpc.c +++ b/urjtag/src/tap/cable/xpc.c @@ -699,7 +699,7 @@ const urj_cable_driver_t urj_tap_cable_xpc_int_driver = { urj_tap_cable_generic_usbconn_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_xpc_int = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_xpc_int = { "xpc_int", /* cable name */ NULL, /* string pattern, not used */ "libusb", /* usbconn driver */ @@ -726,7 +726,7 @@ const urj_cable_driver_t urj_tap_cable_xpc_ext_driver = { urj_tap_cable_generic_usbconn_help }; -urj_usbconn_cable_t urj_tap_cable_usbconn_xpc_ext = { +const urj_usbconn_cable_t urj_tap_cable_usbconn_xpc_ext = { "xpc_ext", /* cable name */ NULL, /* string pattern, not used */ "libusb", /* usbconn driver */