jtag: constify driver arrays
authorSpencer Oliver <spen@spen-soft.co.uk>
Thu, 11 Sep 2014 21:09:36 +0000 (22:09 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Mon, 6 Oct 2014 11:57:36 +0000 (11:57 +0000)
Change-Id: I81574fa8ca3cc748526dc61b75a2c75d6335ef04
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2294
Tested-by: jenkins
src/jtag/aice/aice_interface.c
src/jtag/aice/aice_interface.h
src/jtag/aice/aice_port.h
src/jtag/drivers/amt_jtagaccel.c
src/jtag/drivers/at91rm9200.c
src/jtag/drivers/cmsis_dap_usb.c
src/jtag/drivers/ft2232.c
src/jtag/drivers/opendous.c
src/jtag/drivers/parport.c
src/jtag/hla/hla_interface.h
src/jtag/interface.h

index 838b54faaf994ebfab045176fcddcf76ed767d2a..363b208a357db3229f16aac1f2b05bb1f992715c 100644 (file)
@@ -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,
index c7b896cad32c79c3eb9163905bae1b1b4fa88887..ddb6ad4199b9c440c2bcb1519105d636b690a5a7 100644 (file)
@@ -22,9 +22,9 @@
 
 struct aice_interface_param_s {
        /** */
-       char *device_desc;
+       const char *device_desc;
        /** */
-       char *serial;
+       const char *serial;
        /** */
        uint16_t vid;
        /** */
index 241f8b805884169b523cd08c7930f39c2a10be7e..d29e9e14287282088bab302324f9ecc3651f0543 100644 (file)
@@ -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;
        /** */
index 45f2d5c4ff1e0b6a92763305d8e17d8ec1305c2f..5aacead4bfc7c659f0d064631ac5db67d7d54310 100644 (file)
@@ -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 */
index f823ab64b34f79e02b7ec2a28a1f2e73ea44d662..d7e11df24f833dc35cb4a3ce775a04104426e698 100644 (file)
@@ -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;
 
index b8f004c4758dd19fd07fa86a07aea0909497833f..3e62ce9c87cf8e05e993bf25b585565ae316877a 100644 (file)
@@ -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"
 };
index 19f4dcb5f63fbc4078bd182619214c5ce8bf061f..6f8a0fcf1f6051f436fe5d6e02655ea29c365f9c 100644 (file)
@@ -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);
index 6af3b28f489209fee1aa3420a210c71abbe0288f..deb6c7a8091d4632f8225e5469a8bfa2e871f13a 100644 (file)
@@ -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;
 
index 59c542c9ff238d9b482dff2d9fe786d56b06ad0d..ff75859518a30054d5e31f80802ff69b400d1ad5 100644 (file)
@@ -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
index f83269bfc94495d918785a38b32ef3132140e868..cb961bdea7897eb968a5cf172473c3a53400d274 100644 (file)
@@ -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;
        /** */
index 275c49555d26e59ba6f5664a5118c808bfd036ec..c7130ccf4ff870d94058330a1d868c6e7f998f52 100644 (file)
@@ -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.