From b675edcc95935cbdf77002db1e261536026f4cbe Mon Sep 17 00:00:00 2001 From: Spencer Oliver Date: Thu, 11 Sep 2014 22:09:36 +0100 Subject: [PATCH] jtag: constify driver arrays Change-Id: I81574fa8ca3cc748526dc61b75a2c75d6335ef04 Signed-off-by: Spencer Oliver Reviewed-on: http://openocd.zylin.com/2294 Tested-by: jenkins --- src/jtag/aice/aice_interface.c | 2 +- src/jtag/aice/aice_interface.h | 4 ++-- src/jtag/aice/aice_port.h | 6 +++--- src/jtag/drivers/amt_jtagaccel.c | 2 +- src/jtag/drivers/at91rm9200.c | 8 ++++---- src/jtag/drivers/cmsis_dap_usb.c | 2 +- src/jtag/drivers/ft2232.c | 2 +- src/jtag/drivers/opendous.c | 8 ++++---- src/jtag/drivers/parport.c | 8 ++++---- src/jtag/hla/hla_interface.h | 4 ++-- src/jtag/interface.h | 2 +- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/jtag/aice/aice_interface.c b/src/jtag/aice/aice_interface.c index 838b54faaf..363b208a35 100644 --- a/src/jtag/aice/aice_interface.c +++ b/src/jtag/aice/aice_interface.c @@ -31,7 +31,7 @@ #include "aice_usb.h" #define AICE_KHZ_TO_SPEED_MAP_SIZE 16 -static int aice_khz_to_speed_map[AICE_KHZ_TO_SPEED_MAP_SIZE] = { +static const int aice_khz_to_speed_map[AICE_KHZ_TO_SPEED_MAP_SIZE] = { 30000, 15000, 7500, diff --git a/src/jtag/aice/aice_interface.h b/src/jtag/aice/aice_interface.h index c7b896cad3..ddb6ad4199 100644 --- a/src/jtag/aice/aice_interface.h +++ b/src/jtag/aice/aice_interface.h @@ -22,9 +22,9 @@ struct aice_interface_param_s { /** */ - char *device_desc; + const char *device_desc; /** */ - char *serial; + const char *serial; /** */ uint16_t vid; /** */ diff --git a/src/jtag/aice/aice_port.h b/src/jtag/aice/aice_port.h index 241f8b8058..d29e9e1428 100644 --- a/src/jtag/aice/aice_port.h +++ b/src/jtag/aice/aice_port.h @@ -106,9 +106,9 @@ enum aice_command_mode { struct aice_port_param_s { /** */ - char *device_desc; + const char *device_desc; /** */ - char *serial; + const char *serial; /** */ uint16_t vid; /** */ @@ -225,7 +225,7 @@ struct aice_port_api_s { /** */ struct aice_port { /** */ - char *name; + const char *name; /** */ int type; /** */ diff --git a/src/jtag/drivers/amt_jtagaccel.c b/src/jtag/drivers/amt_jtagaccel.c index 45f2d5c4ff..5aacead4bf 100644 --- a/src/jtag/drivers/amt_jtagaccel.c +++ b/src/jtag/drivers/amt_jtagaccel.c @@ -124,7 +124,7 @@ static const int data_mode = IEEE1284_MODE_EPP | IEEE1284_DATA; * 4: Shift-IR * 5: Pause-IR */ -static uint8_t amt_jtagaccel_tap_move[6][6][2] = { +static const uint8_t amt_jtagaccel_tap_move[6][6][2] = { /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ { {0x1f, 0x00}, {0x0f, 0x00}, {0x05, 0x00}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00} }, /* RESET */ { {0x1f, 0x00}, {0x00, 0x00}, {0x04, 0x00}, {0x05, 0x00}, {0x06, 0x00}, {0x0b, 0x00} }, /* IDLE */ diff --git a/src/jtag/drivers/at91rm9200.c b/src/jtag/drivers/at91rm9200.c index f823ab64b3..d7e11df24f 100644 --- a/src/jtag/drivers/at91rm9200.c +++ b/src/jtag/drivers/at91rm9200.c @@ -79,7 +79,7 @@ #define P31 (1 << 31) struct device_t { - char *name; + const char *name; int TDO_PIO; /* PIO holding TDO */ uint32_t TDO_MASK; /* TDO bitmask */ int TRST_PIO; /* PIO holding TRST */ @@ -94,7 +94,7 @@ struct device_t { uint32_t SRST_MASK; /* SRST bitmask */ }; -static struct device_t devices[] = { +static const struct device_t devices[] = { { "rea_ecr", PIOD, P27, PIOA, NC, PIOD, P23, PIOD, P24, PIOD, P26, PIOC, P5 }, { .name = NULL }, }; @@ -104,7 +104,7 @@ static char *at91rm9200_device; /* interface variables */ -static struct device_t *device; +static const struct device_t *device; static int dev_mem_fd; static void *sys_controller; static uint32_t *pio_base; @@ -196,7 +196,7 @@ struct jtag_interface at91rm9200_interface = { static int at91rm9200_init(void) { - struct device_t *cur_device; + const struct device_t *cur_device; cur_device = devices; diff --git a/src/jtag/drivers/cmsis_dap_usb.c b/src/jtag/drivers/cmsis_dap_usb.c index b8f004c475..3e62ce9c87 100644 --- a/src/jtag/drivers/cmsis_dap_usb.c +++ b/src/jtag/drivers/cmsis_dap_usb.c @@ -137,7 +137,7 @@ static bool swd_mode; /* CMSIS-DAP Vendor Commands * None as yet... */ -static char *info_caps_str[] = { +static const char * const info_caps_str[] = { "SWD Supported", "JTAG Supported" }; diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c index 19f4dcb5f6..6f8a0fcf1f 100644 --- a/src/jtag/drivers/ft2232.c +++ b/src/jtag/drivers/ft2232.c @@ -164,7 +164,7 @@ static uint16_t ft2232_vid[MAX_USB_IDS + 1] = { 0x0403, 0 }; static uint16_t ft2232_pid[MAX_USB_IDS + 1] = { 0x6010, 0 }; struct ft2232_layout { - char *name; + const char *name; int (*init)(void); void (*reset)(int trst, int srst); void (*blink)(void); diff --git a/src/jtag/drivers/opendous.c b/src/jtag/drivers/opendous.c index 6af3b28f48..deb6c7a809 100644 --- a/src/jtag/drivers/opendous.c +++ b/src/jtag/drivers/opendous.c @@ -41,7 +41,7 @@ #define OPENDOUS_MAX_VIDS_PIDS 4 /* define some probes with similar interface */ struct opendous_probe { - char *name; + const char *name; uint16_t VID[OPENDOUS_MAX_VIDS_PIDS]; uint16_t PID[OPENDOUS_MAX_VIDS_PIDS]; uint8_t READ_EP; @@ -50,7 +50,7 @@ struct opendous_probe { int BUFFERSIZE; }; -static struct opendous_probe opendous_probes[] = { +static const struct opendous_probe opendous_probes[] = { {"usbprog-jtag", {0x1781, 0}, {0x0C63, 0}, 0x82, 0x02, 0x00, 510 }, {"opendous", {0x1781, 0x03EB, 0}, {0xC0C0, 0x204F, 0}, 0x81, 0x02, 0x00, 360 }, {"usbvlab", {0x16C0, 0}, {0x05DC, 0}, 0x81, 0x02, 0x01, 360 }, @@ -109,7 +109,7 @@ static struct pending_scan_result *pending_scan_results_buffer; #define FUNC_READ_DATA 0x51 static char *opendous_type; -static struct opendous_probe *opendous_probe; +static const struct opendous_probe *opendous_probe; /* External interface functions */ static int opendous_execute_queue(void); @@ -321,7 +321,7 @@ static int opendous_execute_queue(void) static int opendous_init(void) { int check_cnt; - struct opendous_probe *cur_opendous_probe; + const struct opendous_probe *cur_opendous_probe; cur_opendous_probe = opendous_probes; diff --git a/src/jtag/drivers/parport.c b/src/jtag/drivers/parport.c index 59c542c9ff..ff75859518 100644 --- a/src/jtag/drivers/parport.c +++ b/src/jtag/drivers/parport.c @@ -60,7 +60,7 @@ /* parallel port cable description */ struct cable { - char *name; + const char *name; uint8_t TDO_MASK; /* status port bit containing current TDO value */ uint8_t TRST_MASK; /* data port bit for TRST */ uint8_t TMS_MASK; /* data port bit for TMS */ @@ -74,7 +74,7 @@ struct cable { uint8_t LED_MASK; /* data port bit for LED */ }; -static struct cable cables[] = { +static const struct cable cables[] = { /* name tdo trst tms tck tdi srst o_inv i_inv init exit led */ { "wiggler", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x80, 0x00 }, { "wiggler2", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x00, 0x20 }, @@ -108,7 +108,7 @@ static int wait_states; /* interface variables */ -static struct cable *cable; +static const struct cable *cable; static uint8_t dataport_value; #if PARPORT_USE_PPDEV == 1 @@ -262,7 +262,7 @@ static struct bitbang_interface parport_bitbang = { static int parport_init(void) { - struct cable *cur_cable; + const struct cable *cur_cable; #if PARPORT_USE_PPDEV == 1 char buffer[256]; #endif diff --git a/src/jtag/hla/hla_interface.h b/src/jtag/hla/hla_interface.h index f83269bfc9..cb961bdea7 100644 --- a/src/jtag/hla/hla_interface.h +++ b/src/jtag/hla/hla_interface.h @@ -33,9 +33,9 @@ extern const char *hl_transports[]; struct hl_interface_param_s { /** */ - char *device_desc; + const char *device_desc; /** */ - char *serial; + const char *serial; /** */ uint16_t vid; /** */ diff --git a/src/jtag/interface.h b/src/jtag/interface.h index 275c49555d..c7130ccf4f 100644 --- a/src/jtag/interface.h +++ b/src/jtag/interface.h @@ -198,7 +198,7 @@ static inline tap_state_t jtag_debug_state_machine(const void *tms_buf, */ struct jtag_interface { /** The name of the JTAG interface driver. */ - char *name; + const char * const name; /** * Bit vector listing capabilities exposed by this driver. -- 2.30.2