target: constify structures

Change-Id: I875cfab8dec4ade72ed9c9cd7d52baaca182a1ef
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2295
Tested-by: jenkins
This commit is contained in:
Spencer Oliver 2014-09-11 22:14:31 +01:00
parent b675edcc95
commit 3160c66408
16 changed files with 27 additions and 27 deletions

View File

@ -987,7 +987,7 @@ static int dap_rom_display(struct command_context *cmd_ctx,
uint32_t c_pid0, c_pid1, c_pid2, c_pid3, c_pid4; uint32_t c_pid0, c_pid1, c_pid2, c_pid3, c_pid4;
uint32_t component_base; uint32_t component_base;
unsigned part_num; unsigned part_num;
char *type, *full; const char *type, *full;
component_base = (dbgbase & 0xFFFFF000) + (romentry & 0xFFFFF000); component_base = (dbgbase & 0xFFFFF000) + (romentry & 0xFFFFF000);
@ -1046,7 +1046,7 @@ static int dap_rom_display(struct command_context *cmd_ctx,
if (((c_cid1 >> 4) & 0x0f) == 9) { if (((c_cid1 >> 4) & 0x0f) == 9) {
uint32_t devtype; uint32_t devtype;
unsigned minor; unsigned minor;
char *major = "Reserved", *subtype = "Reserved"; const char *major = "Reserved", *subtype = "Reserved";
retval = mem_ap_read_atomic_u32(dap, retval = mem_ap_read_atomic_u32(dap,
(component_base & 0xfffff000) | 0xfcc, (component_base & 0xfffff000) | 0xfcc,

View File

@ -48,7 +48,7 @@
#include <helper/log.h> #include <helper/log.h>
#include <sys/stat.h> #include <sys/stat.h>
static int open_modeflags[12] = { static const int open_modeflags[12] = {
O_RDONLY, O_RDONLY,
O_RDONLY | O_BINARY, O_RDONLY | O_BINARY,
O_RDWR, O_RDWR,

View File

@ -44,7 +44,7 @@
#define _DEBUG_INSTRUCTION_EXECUTION_ #define _DEBUG_INSTRUCTION_EXECUTION_
#endif #endif
static char *armv7m_exception_strings[] = { static const char * const armv7m_exception_strings[] = {
"", "Reset", "NMI", "HardFault", "", "Reset", "NMI", "HardFault",
"MemManage", "BusFault", "UsageFault", "RESERVED", "MemManage", "BusFault", "UsageFault", "RESERVED",
"RESERVED", "RESERVED", "RESERVED", "SVCall", "RESERVED", "RESERVED", "RESERVED", "SVCall",
@ -148,7 +148,7 @@ int armv7m_restore_context(struct target *target)
* They are assigned by vendors, which generally assign different numbers to * They are assigned by vendors, which generally assign different numbers to
* peripherals (such as UART0 or a USB peripheral controller). * peripherals (such as UART0 or a USB peripheral controller).
*/ */
char *armv7m_exception_string(int number) const char *armv7m_exception_string(int number)
{ {
static char enamebuf[32]; static char enamebuf[32];

View File

@ -33,7 +33,7 @@
extern const int armv7m_psp_reg_map[]; extern const int armv7m_psp_reg_map[];
extern const int armv7m_msp_reg_map[]; extern const int armv7m_msp_reg_map[];
char *armv7m_exception_string(int number); const char *armv7m_exception_string(int number);
/* offsets into armv7m core register cache */ /* offsets into armv7m core register cache */
enum { enum {

View File

@ -35,12 +35,12 @@
#include "avr32_regs.h" #include "avr32_regs.h"
#include "avr32_ap7k.h" #include "avr32_ap7k.h"
static char *avr32_core_reg_list[] = { static const char * const avr32_core_reg_list[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
"r9", "r10", "r11", "r12", "sp", "lr", "pc", "sr" "r9", "r10", "r11", "r12", "sp", "lr", "pc", "sr"
}; };
static struct avr32_core_reg static const struct avr32_core_reg
avr32_core_reg_list_arch_info[AVR32NUMCOREREGS] = { avr32_core_reg_list_arch_info[AVR32NUMCOREREGS] = {
{0, NULL, NULL}, {0, NULL, NULL},
{1, NULL, NULL}, {1, NULL, NULL},

View File

@ -29,12 +29,12 @@
#include <helper/log.h> #include <helper/log.h>
#include "breakpoints.h" #include "breakpoints.h"
static char *breakpoint_type_strings[] = { static const char * const breakpoint_type_strings[] = {
"hardware", "hardware",
"software" "software"
}; };
static char *watchpoint_rw_strings[] = { static const char * const watchpoint_rw_strings[] = {
"read", "read",
"write", "write",
"access" "access"
@ -50,7 +50,7 @@ int breakpoint_add_internal(struct target *target,
{ {
struct breakpoint *breakpoint = target->breakpoints; struct breakpoint *breakpoint = target->breakpoints;
struct breakpoint **breakpoint_p = &target->breakpoints; struct breakpoint **breakpoint_p = &target->breakpoints;
char *reason; const char *reason;
int retval; int retval;
int n; int n;
@ -396,7 +396,7 @@ int watchpoint_add(struct target *target, uint32_t address, uint32_t length,
struct watchpoint *watchpoint = target->watchpoints; struct watchpoint *watchpoint = target->watchpoints;
struct watchpoint **watchpoint_p = &target->watchpoints; struct watchpoint **watchpoint_p = &target->watchpoints;
int retval; int retval;
char *reason; const char *reason;
while (watchpoint) { while (watchpoint) {
if (watchpoint->address == address) { if (watchpoint->address == address) {

View File

@ -335,7 +335,7 @@ enum watchpoint_condition {
((s & 1) << 16) | ((w & 1) << 15) | ((d & 0x3f) << 8) | (p & 0x3f)) ((s & 1) << 16) | ((w & 1) << 15) | ((d & 0x3f) << 8) | (p & 0x3f))
/* the gdb register list is send in this order */ /* the gdb register list is send in this order */
static uint8_t gdb_reg_list_idx[] = { static const uint8_t gdb_reg_list_idx[] = {
DSP563XX_REG_IDX_X1, DSP563XX_REG_IDX_X0, DSP563XX_REG_IDX_Y1, DSP563XX_REG_IDX_Y0, DSP563XX_REG_IDX_X1, DSP563XX_REG_IDX_X0, DSP563XX_REG_IDX_Y1, DSP563XX_REG_IDX_Y0,
DSP563XX_REG_IDX_A2, DSP563XX_REG_IDX_A1, DSP563XX_REG_IDX_A0, DSP563XX_REG_IDX_B2, DSP563XX_REG_IDX_A2, DSP563XX_REG_IDX_A1, DSP563XX_REG_IDX_A0, DSP563XX_REG_IDX_B2,
DSP563XX_REG_IDX_B1, DSP563XX_REG_IDX_B0, DSP563XX_REG_IDX_PC, DSP563XX_REG_IDX_SR, DSP563XX_REG_IDX_B1, DSP563XX_REG_IDX_B0, DSP563XX_REG_IDX_PC, DSP563XX_REG_IDX_SR,

View File

@ -63,9 +63,9 @@
#define DSP563XX_ONCE_NOREG 0x01F /* no register selected */ #define DSP563XX_ONCE_NOREG 0x01F /* no register selected */
struct once_reg { struct once_reg {
uint8_t num; const uint8_t num;
uint8_t addr; const uint8_t addr;
uint8_t len; const uint8_t len;
const char *name; const char *name;
uint32_t reg; uint32_t reg;
}; };

View File

@ -54,9 +54,9 @@ static int embeddedice_set_reg_w_exec(struct reg *reg, uint8_t *buf);
* From: ARM9E-S TRM, DDI 0165, table C-4 (and similar, for other cores) * From: ARM9E-S TRM, DDI 0165, table C-4 (and similar, for other cores)
*/ */
static const struct { static const struct {
char *name; const char *name;
unsigned short addr; unsigned short addr;
unsigned short width; unsigned short width;
} eice_regs[] = { } eice_regs[] = {
[EICE_DBG_CTRL] = { [EICE_DBG_CTRL] = {
.name = "debug_ctrl", .name = "debug_ctrl",

View File

@ -27,7 +27,7 @@
#include "etb.h" #include "etb.h"
#include "register.h" #include "register.h"
static char *etb_reg_list[] = { static const char * const etb_reg_list[] = {
"ETB_identification", "ETB_identification",
"ETB_ram_depth", "ETB_ram_depth",
"ETB_ram_width", "ETB_ram_width",

View File

@ -67,7 +67,7 @@ struct etm_reg_info {
uint8_t size; /* low-N of 32 bits */ uint8_t size; /* low-N of 32 bits */
uint8_t mode; /* RO, WO, RW */ uint8_t mode; /* RO, WO, RW */
uint8_t bcd_vers; /* 1.0, 2.0, etc */ uint8_t bcd_vers; /* 1.0, 2.0, etc */
char *name; const char *name;
}; };
/* /*

View File

@ -26,7 +26,7 @@
static bool nds32_reg_init_done; static bool nds32_reg_init_done;
static struct nds32_reg_s nds32_regs[TOTAL_REG_NUM]; static struct nds32_reg_s nds32_regs[TOTAL_REG_NUM];
static struct nds32_reg_exception_s nds32_ex_reg_values[] = { static const struct nds32_reg_exception_s nds32_ex_reg_values[] = {
{IR0, 3, 0x3, 2}, {IR0, 3, 0x3, 2},
{IR0, 3, 0x3, 3}, {IR0, 3, 0x3, 3},
{IR1, 3, 0x3, 2}, {IR1, 3, 0x3, 2},
@ -358,7 +358,7 @@ const char *nds32_reg_symbolic_name(uint32_t number)
bool nds32_reg_exception(uint32_t number, uint32_t value) bool nds32_reg_exception(uint32_t number, uint32_t value)
{ {
int i; int i;
struct nds32_reg_exception_s *ex_reg_value; const struct nds32_reg_exception_s *ex_reg_value;
uint32_t field_value; uint32_t field_value;
i = 0; i = 0;

View File

@ -37,7 +37,7 @@ static char *jsp_port;
* the client should be forced into character mode. However it doesn't make any difference. * the client should be forced into character mode. However it doesn't make any difference.
*/ */
static char *negotiate = static const char * const negotiate =
"\xFF\xFB\x03" /* IAC WILL Suppress Go Ahead */ "\xFF\xFB\x03" /* IAC WILL Suppress Go Ahead */
"\xFF\xFB\x01" /* IAC WILL Echo */ "\xFF\xFB\x01" /* IAC WILL Echo */
"\xFF\xFD\x03" /* IAC DO Suppress Go Ahead */ "\xFF\xFD\x03" /* IAC DO Suppress Go Ahead */

View File

@ -50,7 +50,7 @@ static int or1k_write_core_reg(struct target *target, int num);
static struct or1k_core_reg *or1k_core_reg_list_arch_info; static struct or1k_core_reg *or1k_core_reg_list_arch_info;
struct or1k_core_reg_init or1k_init_reg_list[] = { static const struct or1k_core_reg_init or1k_init_reg_list[] = {
{"r0" , GROUP0 + 1024, "org.gnu.gdb.or1k.group0", NULL}, {"r0" , GROUP0 + 1024, "org.gnu.gdb.or1k.group0", NULL},
{"r1" , GROUP0 + 1025, "org.gnu.gdb.or1k.group0", NULL}, {"r1" , GROUP0 + 1025, "org.gnu.gdb.or1k.group0", NULL},
{"r2" , GROUP0 + 1026, "org.gnu.gdb.or1k.group0", NULL}, {"r2" , GROUP0 + 1026, "org.gnu.gdb.or1k.group0", NULL},

View File

@ -61,7 +61,7 @@
#define OR1K_TAP_INST_IDCODE 0x2 #define OR1K_TAP_INST_IDCODE 0x2
#define OR1K_TAP_INST_DEBUG 0x8 #define OR1K_TAP_INST_DEBUG 0x8
static char *id_to_string(unsigned char id) static const char *id_to_string(unsigned char id)
{ {
switch (id) { switch (id) {
case VJTAG_NODE_ID: case VJTAG_NODE_ID:

View File

@ -78,7 +78,7 @@ static const uint8_t xscale_debug_handler[] = {
#include "xscale_debug.inc" #include "xscale_debug.inc"
}; };
static char *const xscale_reg_list[] = { static const char *const xscale_reg_list[] = {
"XSCALE_MAINID", /* 0 */ "XSCALE_MAINID", /* 0 */
"XSCALE_CACHETYPE", "XSCALE_CACHETYPE",
"XSCALE_CTRL", "XSCALE_CTRL",