aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2021-04-27 18:46:43 +0200
committerAntonio Borneo <borneo.antonio@gmail.com>2021-07-24 10:37:25 +0100
commitb159f5cdedd70fff9309722e927be670845f4df5 (patch)
tree5fd59562c7f4bc37adcb7f056f37ad45a11bb9c2 /src
parent20b29b7767097f999fe2eb4f7fb6c2917e9f66a6 (diff)
downloadriscv-openocd-b159f5cdedd70fff9309722e927be670845f4df5.zip
riscv-openocd-b159f5cdedd70fff9309722e927be670845f4df5.tar.gz
riscv-openocd-b159f5cdedd70fff9309722e927be670845f4df5.tar.bz2
target: rename CamelCase symbols
No major cross dependencies, mostly changes internal to each file/function. Change-Id: I7cc87458a341bae29a4f772b0af5d97b4bfc2da3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6343 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
Diffstat (limited to 'src')
-rw-r--r--src/target/avr32_ap7k.c2
-rw-r--r--src/target/avr32_ap7k.h2
-rw-r--r--src/target/dsp563xx.c22
-rw-r--r--src/target/dsp5680xx.c22
-rw-r--r--src/target/dsp5680xx.h2
-rw-r--r--src/target/esirisc.c68
-rw-r--r--src/target/esirisc.h4
-rw-r--r--src/target/esirisc_regs.h8
-rw-r--r--src/target/image.c70
-rw-r--r--src/target/target.c200
-rw-r--r--src/target/x86_32_common.c4
11 files changed, 202 insertions, 202 deletions
diff --git a/src/target/avr32_ap7k.c b/src/target/avr32_ap7k.c
index b0c0875..4cf0276 100644
--- a/src/target/avr32_ap7k.c
+++ b/src/target/avr32_ap7k.c
@@ -526,7 +526,7 @@ static int avr32_ap7k_target_create(struct target *target, Jim_Interp *interp)
struct avr32_ap7k_common *ap7k = calloc(1, sizeof(struct
avr32_ap7k_common));
- ap7k->common_magic = AP7k_COMMON_MAGIC;
+ ap7k->common_magic = AP7K_COMMON_MAGIC;
target->arch_info = ap7k;
return ERROR_OK;
diff --git a/src/target/avr32_ap7k.h b/src/target/avr32_ap7k.h
index 3f27534..65b856e 100644
--- a/src/target/avr32_ap7k.h
+++ b/src/target/avr32_ap7k.h
@@ -20,7 +20,7 @@
struct target;
-#define AP7k_COMMON_MAGIC 0x4150374b
+#define AP7K_COMMON_MAGIC 0x4150374b
struct avr32_ap7k_common {
int common_magic;
struct avr32_jtag jtag;
diff --git a/src/target/dsp563xx.c b/src/target/dsp563xx.c
index 5ad52b5..0d80ed3 100644
--- a/src/target/dsp563xx.c
+++ b/src/target/dsp563xx.c
@@ -96,10 +96,10 @@
/*
* OBCR Register bit definitions
*/
-#define OBCR_b0_and_b1 ((0x0) << 10)
-#define OBCR_b0_or_b1 ((0x1) << 10)
-#define OBCR_b1_after_b0 ((0x2) << 10)
-#define OBCR_b0_after_b1 ((0x3) << 10)
+#define OBCR_B0_AND_B1 ((0x0) << 10)
+#define OBCR_B0_OR_B1 ((0x1) << 10)
+#define OBCR_B1_AFTER_B0 ((0x2) << 10)
+#define OBCR_B0_AFTER_B1 ((0x3) << 10)
#define OBCR_BP_DISABLED (0x0)
#define OBCR_BP_MEM_P (0x1)
@@ -1885,17 +1885,17 @@ static int dsp563xx_remove_watchpoint(struct target *target, struct watchpoint *
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
-static int dsp563xx_add_custom_watchpoint(struct target *target, uint32_t address, uint32_t memType,
+static int dsp563xx_add_custom_watchpoint(struct target *target, uint32_t address, uint32_t mem_type,
enum watchpoint_rw rw, enum watchpoint_condition cond)
{
int err = ERROR_OK;
struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target);
- bool wasRunning = false;
+ bool was_running = false;
/* Only set breakpoint when halted */
if (target->state != TARGET_HALTED) {
dsp563xx_halt(target);
- wasRunning = true;
+ was_running = true;
}
if (dsp563xx->hardware_breakpoint[0].used) {
@@ -1905,8 +1905,8 @@ static int dsp563xx_add_custom_watchpoint(struct target *target, uint32_t addres
uint32_t obcr_value = 0;
if (err == ERROR_OK) {
- obcr_value |= OBCR_b0_or_b1;
- switch (memType) {
+ obcr_value |= OBCR_B0_OR_B1;
+ switch (mem_type) {
case MEM_X:
obcr_value |= OBCR_BP_MEM_X;
break;
@@ -1917,7 +1917,7 @@ static int dsp563xx_add_custom_watchpoint(struct target *target, uint32_t addres
obcr_value |= OBCR_BP_MEM_P;
break;
default:
- LOG_ERROR("Unknown memType parameter (%" PRIu32 ")", memType);
+ LOG_ERROR("Unknown mem_type parameter (%" PRIu32 ")", mem_type);
err = ERROR_TARGET_INVALID;
}
}
@@ -1981,7 +1981,7 @@ static int dsp563xx_add_custom_watchpoint(struct target *target, uint32_t addres
if (err == ERROR_OK)
dsp563xx->hardware_breakpoint[0].used = BPU_WATCHPOINT;
- if (err == ERROR_OK && wasRunning) {
+ if (err == ERROR_OK && was_running) {
/* Resume from current PC */
err = dsp563xx_resume(target, 1, 0x0, 0, 0);
}
diff --git a/src/target/dsp5680xx.c b/src/target/dsp5680xx.c
index 62844ea..71bf6f1 100644
--- a/src/target/dsp5680xx.c
+++ b/src/target/dsp5680xx.c
@@ -501,7 +501,7 @@ static int core_move_value_to_pc(struct target *target, uint32_t value)
return retval;
}
-static int eonce_load_TX_RX_to_r0(struct target *target)
+static int eonce_load_tx_rx_to_r0(struct target *target)
{
int retval;
@@ -512,7 +512,7 @@ static int eonce_load_TX_RX_to_r0(struct target *target)
return retval;
}
-static int core_load_TX_RX_high_addr_to_r0(struct target *target)
+static int core_load_tx_rx_high_addr_to_r0(struct target *target)
{
int retval = 0;
@@ -855,7 +855,7 @@ static int eonce_pc_store(struct target *target)
err_check_propagate(retval);
retval = core_move_r4_to_y(target);
err_check_propagate(retval);
- retval = eonce_load_TX_RX_to_r0(target);
+ retval = eonce_load_tx_rx_to_r0(target);
err_check_propagate(retval);
retval = core_move_y0_at_r0(target);
err_check_propagate(retval);
@@ -1110,7 +1110,7 @@ static int dsp5680xx_read_16_single(struct target *t, uint32_t a,
else
retval = core_move_at_r0_to_y0(target);
err_check_propagate(retval);
- retval = eonce_load_TX_RX_to_r0(target);
+ retval = eonce_load_tx_rx_to_r0(target);
err_check_propagate(retval);
retval = core_move_y0_at_r0(target);
err_check_propagate(retval);
@@ -1147,7 +1147,7 @@ static int dsp5680xx_read_32_single(struct target *t, uint32_t a,
err_check_propagate(retval);
}
/* Get lower part of data to TX/RX */
- retval = eonce_load_TX_RX_to_r0(target);
+ retval = eonce_load_tx_rx_to_r0(target);
err_check_propagate(retval);
retval = core_move_y0_at_r0_inc(target); /* This also load TX/RX high to r0 */
err_check_propagate(retval);
@@ -1543,7 +1543,7 @@ static int perl_crc(const uint8_t *buff8, uint32_t word_count)
*
* @return
*/
-static int dsp5680xx_f_SIM_reset(struct target *target)
+static int dsp5680xx_f_sim_reset(struct target *target)
{
int retval = ERROR_OK;
@@ -1575,7 +1575,7 @@ static int dsp5680xx_soft_reset_halt(struct target *target)
retval = dsp5680xx_halt(target);
err_check_propagate(retval);
- retval = dsp5680xx_f_SIM_reset(target);
+ retval = dsp5680xx_f_sim_reset(target);
err_check_propagate(retval);
return retval;
}
@@ -1617,7 +1617,7 @@ static int dsp5680xx_f_ex(struct target *target, uint16_t c, uint32_t address, u
uint32_t command = c;
int retval;
- retval = core_load_TX_RX_high_addr_to_r0(target);
+ retval = core_load_tx_rx_high_addr_to_r0(target);
err_check_propagate(retval);
retval = core_move_long_to_r2(target, HFM_BASE_ADDR);
err_check_propagate(retval);
@@ -1727,7 +1727,7 @@ static int set_fm_ck_div(struct target *target)
retval = core_move_long_to_r2(target, HFM_BASE_ADDR);
err_check_propagate(retval);
- retval = core_load_TX_RX_high_addr_to_r0(target);
+ retval = core_load_tx_rx_high_addr_to_r0(target);
err_check_propagate(retval);
/* read HFM_CLKD */
retval = core_move_at_r2_to_y0(target);
@@ -1882,7 +1882,7 @@ int dsp5680xx_f_erase(struct target *target, int first, int last)
* Reset SIM
*
*/
- retval = dsp5680xx_f_SIM_reset(target);
+ retval = dsp5680xx_f_sim_reset(target);
err_check_propagate(retval);
/*
* Set hfmdiv
@@ -2014,7 +2014,7 @@ int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t coun
retval = core_move_long_to_r3(target, address); /* Destination address to r3 */
err_check_propagate(retval);
- core_load_TX_RX_high_addr_to_r0(target); /* TX/RX reg address to r0 */
+ core_load_tx_rx_high_addr_to_r0(target); /* TX/RX reg address to r0 */
err_check_propagate(retval);
retval = core_move_long_to_r2(target, HFM_BASE_ADDR); /* FM base address to r2 */
err_check_propagate(retval);
diff --git a/src/target/dsp5680xx.h b/src/target/dsp5680xx.h
index 72557ce..b969417 100644
--- a/src/target/dsp5680xx.h
+++ b/src/target/dsp5680xx.h
@@ -238,7 +238,7 @@
* ----------------------------------------------------------------
*/
#define MC568013_SIM_BASE_ADDR 0xF140
-#define MC56803x_2x_SIM_BASE_ADDR 0xF100
+#define MC56803X_2X_SIM_BASE_ADDR 0xF100
#define SIM_CMD_RESET 0x10
/**
diff --git a/src/target/esirisc.c b/src/target/esirisc.c
index c928445..9476b0f 100644
--- a/src/target/esirisc.c
+++ b/src/target/esirisc.c
@@ -56,38 +56,38 @@ static const char * const esirisc_exception_strings[] = {
[EID_SYSTEM_CALL] = "SystemCall",
[EID_MEMORY_MANAGEMENT] = "MemoryManagement",
[EID_UNRECOVERABLE] = "Unrecoverable",
- [EID_INTERRUPTn+0] = "Interrupt0",
- [EID_INTERRUPTn+1] = "Interrupt1",
- [EID_INTERRUPTn+2] = "Interrupt2",
- [EID_INTERRUPTn+3] = "Interrupt3",
- [EID_INTERRUPTn+4] = "Interrupt4",
- [EID_INTERRUPTn+5] = "Interrupt5",
- [EID_INTERRUPTn+6] = "Interrupt6",
- [EID_INTERRUPTn+7] = "Interrupt7",
- [EID_INTERRUPTn+8] = "Interrupt8",
- [EID_INTERRUPTn+9] = "Interrupt9",
- [EID_INTERRUPTn+10] = "Interrupt10",
- [EID_INTERRUPTn+11] = "Interrupt11",
- [EID_INTERRUPTn+12] = "Interrupt12",
- [EID_INTERRUPTn+13] = "Interrupt13",
- [EID_INTERRUPTn+14] = "Interrupt14",
- [EID_INTERRUPTn+15] = "Interrupt15",
- [EID_INTERRUPTn+16] = "Interrupt16",
- [EID_INTERRUPTn+17] = "Interrupt17",
- [EID_INTERRUPTn+18] = "Interrupt18",
- [EID_INTERRUPTn+19] = "Interrupt19",
- [EID_INTERRUPTn+20] = "Interrupt20",
- [EID_INTERRUPTn+21] = "Interrupt21",
- [EID_INTERRUPTn+22] = "Interrupt22",
- [EID_INTERRUPTn+23] = "Interrupt23",
- [EID_INTERRUPTn+24] = "Interrupt24",
- [EID_INTERRUPTn+25] = "Interrupt25",
- [EID_INTERRUPTn+26] = "Interrupt26",
- [EID_INTERRUPTn+27] = "Interrupt27",
- [EID_INTERRUPTn+28] = "Interrupt28",
- [EID_INTERRUPTn+29] = "Interrupt29",
- [EID_INTERRUPTn+30] = "Interrupt30",
- [EID_INTERRUPTn+31] = "Interrupt31",
+ [EID_INTERRUPT_N+0] = "Interrupt0",
+ [EID_INTERRUPT_N+1] = "Interrupt1",
+ [EID_INTERRUPT_N+2] = "Interrupt2",
+ [EID_INTERRUPT_N+3] = "Interrupt3",
+ [EID_INTERRUPT_N+4] = "Interrupt4",
+ [EID_INTERRUPT_N+5] = "Interrupt5",
+ [EID_INTERRUPT_N+6] = "Interrupt6",
+ [EID_INTERRUPT_N+7] = "Interrupt7",
+ [EID_INTERRUPT_N+8] = "Interrupt8",
+ [EID_INTERRUPT_N+9] = "Interrupt9",
+ [EID_INTERRUPT_N+10] = "Interrupt10",
+ [EID_INTERRUPT_N+11] = "Interrupt11",
+ [EID_INTERRUPT_N+12] = "Interrupt12",
+ [EID_INTERRUPT_N+13] = "Interrupt13",
+ [EID_INTERRUPT_N+14] = "Interrupt14",
+ [EID_INTERRUPT_N+15] = "Interrupt15",
+ [EID_INTERRUPT_N+16] = "Interrupt16",
+ [EID_INTERRUPT_N+17] = "Interrupt17",
+ [EID_INTERRUPT_N+18] = "Interrupt18",
+ [EID_INTERRUPT_N+19] = "Interrupt19",
+ [EID_INTERRUPT_N+20] = "Interrupt20",
+ [EID_INTERRUPT_N+21] = "Interrupt21",
+ [EID_INTERRUPT_N+22] = "Interrupt22",
+ [EID_INTERRUPT_N+23] = "Interrupt23",
+ [EID_INTERRUPT_N+24] = "Interrupt24",
+ [EID_INTERRUPT_N+25] = "Interrupt25",
+ [EID_INTERRUPT_N+26] = "Interrupt26",
+ [EID_INTERRUPT_N+27] = "Interrupt27",
+ [EID_INTERRUPT_N+28] = "Interrupt28",
+ [EID_INTERRUPT_N+29] = "Interrupt29",
+ [EID_INTERRUPT_N+30] = "Interrupt30",
+ [EID_INTERRUPT_N+31] = "Interrupt31",
};
/*
@@ -508,7 +508,7 @@ static int esirisc_add_breakpoint(struct target *target, struct breakpoint *brea
esirisc->breakpoints_p[bp_index] = breakpoint;
/* specify instruction breakpoint address */
- retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_IBAn + bp_index,
+ retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_IBA_N + bp_index,
breakpoint->address);
if (retval != ERROR_OK) {
LOG_ERROR("%s: failed to write Debug CSR: IBA", target_name(target));
@@ -634,7 +634,7 @@ static int esirisc_add_watchpoint(struct target *target, struct watchpoint *watc
esirisc->watchpoints_p[wp_index] = watchpoint;
/* specify data breakpoint address */
- retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DBAn + wp_index,
+ retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DBA_N + wp_index,
watchpoint->address);
if (retval != ERROR_OK) {
LOG_ERROR("%s: failed to write Debug CSR: DBA", target_name(target));
diff --git a/src/target/esirisc.h b/src/target/esirisc.h
index 57deba6..ad14223 100644
--- a/src/target/esirisc.h
+++ b/src/target/esirisc.h
@@ -47,7 +47,7 @@
#define EID_SYSTEM_CALL 0x0b
#define EID_MEMORY_MANAGEMENT 0x0c
#define EID_UNRECOVERABLE 0x0d
-#define EID_INTERRUPTn 0x20
+#define EID_INTERRUPT_N 0x20
/* Exception Entry Points */
#define ENTRY_RESET 0x00
@@ -58,7 +58,7 @@
#define ENTRY_SYSCALL 0x05
#define ENTRY_DEBUG 0x06
#define ENTRY_NMI 0x07
-#define ENTRY_INTERRUPTn 0x08
+#define ENTRY_INTERRUPT_N 0x08
/* Hardware Debug Control */
#define HWDC_R (1<<4) /* Reset & Hardware Failure */
diff --git a/src/target/esirisc_regs.h b/src/target/esirisc_regs.h
index a946a2e..6ccda50 100644
--- a/src/target/esirisc_regs.h
+++ b/src/target/esirisc_regs.h
@@ -148,8 +148,8 @@ enum esirisc_reg_num {
#define CSR_DEBUG_HWDC 0x03 /* Hardware Debug Control */
#define CSR_DEBUG_DBS 0x04 /* Data Breakpoint Size */
#define CSR_DEBUG_DBR 0x05 /* Data Breakpoint Range */
-#define CSR_DEBUG_IBAn 0x08 /* Instruction Breakpoint Address [0..7] */
-#define CSR_DEBUG_DBAn 0x10 /* Data Breakpoint Address [0..7] */
+#define CSR_DEBUG_IBA_N 0x08 /* Instruction Breakpoint Address [0..7] */
+#define CSR_DEBUG_DBA_N 0x10 /* Data Breakpoint Address [0..7] */
/* Configuration CSRs */
#define CSR_CONFIG_ARCH0 0x00 /* Architectural Configuration 0 */
@@ -160,12 +160,12 @@ enum esirisc_reg_num {
#define CSR_CONFIG_IC 0x05 /* Instruction Cache Configuration */
#define CSR_CONFIG_DC 0x06 /* Data Cache Configuration */
#define CSR_CONFIG_INT 0x07 /* Interrupt Configuration */
-#define CSR_CONFIG_ISAn 0x08 /* Instruction Set Configuration [0..6] */
+#define CSR_CONFIG_ISA_N 0x08 /* Instruction Set Configuration [0..6] */
#define CSR_CONFIG_DBG 0x0f /* Debug Configuration */
#define CSR_CONFIG_MID 0x10 /* Manufacturer ID */
#define CSR_CONFIG_REV 0x11 /* Revision Number */
#define CSR_CONFIG_MPID 0x12 /* Multiprocessor ID */
-#define CSR_CONFIG_FREQn 0x13 /* Frequency [0..2] */
+#define CSR_CONFIG_FREQ_N 0x13 /* Frequency [0..2] */
#define CSR_CONFIG_TRACE 0x16 /* Trace Configuration */
/* Trace CSRs */
diff --git a/src/target/image.c b/src/target/image.c
index 8f72329..df07ea3 100644
--- a/src/target/image.c
+++ b/src/target/image.c
@@ -123,7 +123,7 @@ static int identify_image_type(struct image *image, const char *type_string, con
}
static int image_ihex_buffer_complete_inner(struct image *image,
- char *lpszLine,
+ char *lpsz_line,
struct imagesection *section)
{
struct image_ihex *ihex = image->type_private;
@@ -152,7 +152,7 @@ static int image_ihex_buffer_complete_inner(struct image *image,
section[image->num_sections].size = 0x0;
section[image->num_sections].flags = 0;
- while (fileio_fgets(fileio, 1023, lpszLine) == ERROR_OK) {
+ while (fileio_fgets(fileio, 1023, lpsz_line) == ERROR_OK) {
uint32_t count;
uint32_t address;
uint32_t record_type;
@@ -161,10 +161,10 @@ static int image_ihex_buffer_complete_inner(struct image *image,
size_t bytes_read = 0;
/* skip comments and blank lines */
- if ((lpszLine[0] == '#') || (strlen(lpszLine + strspn(lpszLine, "\n\t\r ")) == 0))
+ if ((lpsz_line[0] == '#') || (strlen(lpsz_line + strspn(lpsz_line, "\n\t\r ")) == 0))
continue;
- if (sscanf(&lpszLine[bytes_read], ":%2" SCNx32 "%4" SCNx32 "%2" SCNx32, &count,
+ if (sscanf(&lpsz_line[bytes_read], ":%2" SCNx32 "%4" SCNx32 "%2" SCNx32, &count,
&address, &record_type) != 3)
return ERROR_IMAGE_FORMAT_ERROR;
bytes_read += 9;
@@ -199,7 +199,7 @@ static int image_ihex_buffer_complete_inner(struct image *image,
while (count-- > 0) {
unsigned value;
- sscanf(&lpszLine[bytes_read], "%2x", &value);
+ sscanf(&lpsz_line[bytes_read], "%2x", &value);
ihex->buffer[cooked_bytes] = (uint8_t)value;
cal_checksum += (uint8_t)ihex->buffer[cooked_bytes];
bytes_read += 2;
@@ -225,7 +225,7 @@ static int image_ihex_buffer_complete_inner(struct image *image,
} else if (record_type == 2) { /* Linear Address Record */
uint16_t upper_address;
- sscanf(&lpszLine[bytes_read], "%4hx", &upper_address);
+ sscanf(&lpsz_line[bytes_read], "%4hx", &upper_address);
cal_checksum += (uint8_t)(upper_address >> 8);
cal_checksum += (uint8_t)upper_address;
bytes_read += 4;
@@ -257,14 +257,14 @@ static int image_ihex_buffer_complete_inner(struct image *image,
/* "Start Segment Address Record" will not be supported
* but we must consume it, and do not create an error. */
while (count-- > 0) {
- sscanf(&lpszLine[bytes_read], "%2" SCNx32, &dummy);
+ sscanf(&lpsz_line[bytes_read], "%2" SCNx32, &dummy);
cal_checksum += (uint8_t)dummy;
bytes_read += 2;
}
} else if (record_type == 4) { /* Extended Linear Address Record */
uint16_t upper_address;
- sscanf(&lpszLine[bytes_read], "%4hx", &upper_address);
+ sscanf(&lpsz_line[bytes_read], "%4hx", &upper_address);
cal_checksum += (uint8_t)(upper_address >> 8);
cal_checksum += (uint8_t)upper_address;
bytes_read += 4;
@@ -293,7 +293,7 @@ static int image_ihex_buffer_complete_inner(struct image *image,
} else if (record_type == 5) { /* Start Linear Address Record */
uint32_t start_address;
- sscanf(&lpszLine[bytes_read], "%8" SCNx32, &start_address);
+ sscanf(&lpsz_line[bytes_read], "%8" SCNx32, &start_address);
cal_checksum += (uint8_t)(start_address >> 24);
cal_checksum += (uint8_t)(start_address >> 16);
cal_checksum += (uint8_t)(start_address >> 8);
@@ -307,7 +307,7 @@ static int image_ihex_buffer_complete_inner(struct image *image,
return ERROR_IMAGE_FORMAT_ERROR;
}
- sscanf(&lpszLine[bytes_read], "%2" SCNx32, &checksum);
+ sscanf(&lpsz_line[bytes_read], "%2" SCNx32, &checksum);
if ((uint8_t)checksum != (uint8_t)(~cal_checksum + 1)) {
/* checksum failed */
@@ -317,7 +317,7 @@ static int image_ihex_buffer_complete_inner(struct image *image,
if (end_rec) {
end_rec = false;
- LOG_WARNING("continuing after end-of-file record: %.40s", lpszLine);
+ LOG_WARNING("continuing after end-of-file record: %.40s", lpsz_line);
}
}
}
@@ -336,23 +336,23 @@ static int image_ihex_buffer_complete_inner(struct image *image,
*/
static int image_ihex_buffer_complete(struct image *image)
{
- char *lpszLine = malloc(1023);
- if (lpszLine == NULL) {
+ char *lpsz_line = malloc(1023);
+ if (lpsz_line == NULL) {
LOG_ERROR("Out of memory");
return ERROR_FAIL;
}
struct imagesection *section = malloc(sizeof(struct imagesection) * IMAGE_MAX_SECTIONS);
if (section == NULL) {
- free(lpszLine);
+ free(lpsz_line);
LOG_ERROR("Out of memory");
return ERROR_FAIL;
}
int retval;
- retval = image_ihex_buffer_complete_inner(image, lpszLine, section);
+ retval = image_ihex_buffer_complete_inner(image, lpsz_line, section);
free(section);
- free(lpszLine);
+ free(lpsz_line);
return retval;
}
@@ -755,7 +755,7 @@ static int image_elf_read_section(struct image *image,
}
static int image_mot_buffer_complete_inner(struct image *image,
- char *lpszLine,
+ char *lpsz_line,
struct imagesection *section)
{
struct image_mot *mot = image->type_private;
@@ -784,7 +784,7 @@ static int image_mot_buffer_complete_inner(struct image *image,
section[image->num_sections].size = 0x0;
section[image->num_sections].flags = 0;
- while (fileio_fgets(fileio, 1023, lpszLine) == ERROR_OK) {
+ while (fileio_fgets(fileio, 1023, lpsz_line) == ERROR_OK) {
uint32_t count;
uint32_t address;
uint32_t record_type;
@@ -793,11 +793,11 @@ static int image_mot_buffer_complete_inner(struct image *image,
uint32_t bytes_read = 0;
/* skip comments and blank lines */
- if ((lpszLine[0] == '#') || (strlen(lpszLine + strspn(lpszLine, "\n\t\r ")) == 0))
+ if ((lpsz_line[0] == '#') || (strlen(lpsz_line + strspn(lpsz_line, "\n\t\r ")) == 0))
continue;
/* get record type and record length */
- if (sscanf(&lpszLine[bytes_read], "S%1" SCNx32 "%2" SCNx32, &record_type,
+ if (sscanf(&lpsz_line[bytes_read], "S%1" SCNx32 "%2" SCNx32, &record_type,
&count) != 2)
return ERROR_IMAGE_FORMAT_ERROR;
@@ -809,18 +809,18 @@ static int image_mot_buffer_complete_inner(struct image *image,
if (record_type == 0) {
/* S0 - starting record (optional) */
- int iValue;
+ int value;
while (count-- > 0) {
- sscanf(&lpszLine[bytes_read], "%2x", &iValue);
- cal_checksum += (uint8_t)iValue;
+ sscanf(&lpsz_line[bytes_read], "%2x", &value);
+ cal_checksum += (uint8_t)value;
bytes_read += 2;
}
} else if (record_type >= 1 && record_type <= 3) {
switch (record_type) {
case 1:
/* S1 - 16 bit address data record */
- sscanf(&lpszLine[bytes_read], "%4" SCNx32, &address);
+ sscanf(&lpsz_line[bytes_read], "%4" SCNx32, &address);
cal_checksum += (uint8_t)(address >> 8);
cal_checksum += (uint8_t)address;
bytes_read += 4;
@@ -829,7 +829,7 @@ static int image_mot_buffer_complete_inner(struct image *image,
case 2:
/* S2 - 24 bit address data record */
- sscanf(&lpszLine[bytes_read], "%6" SCNx32, &address);
+ sscanf(&lpsz_line[bytes_read], "%6" SCNx32, &address);
cal_checksum += (uint8_t)(address >> 16);
cal_checksum += (uint8_t)(address >> 8);
cal_checksum += (uint8_t)address;
@@ -839,7 +839,7 @@ static int image_mot_buffer_complete_inner(struct image *image,
case 3:
/* S3 - 32 bit address data record */
- sscanf(&lpszLine[bytes_read], "%8" SCNx32, &address);
+ sscanf(&lpsz_line[bytes_read], "%8" SCNx32, &address);
cal_checksum += (uint8_t)(address >> 24);
cal_checksum += (uint8_t)(address >> 16);
cal_checksum += (uint8_t)(address >> 8);
@@ -868,7 +868,7 @@ static int image_mot_buffer_complete_inner(struct image *image,
while (count-- > 0) {
unsigned value;
- sscanf(&lpszLine[bytes_read], "%2x", &value);
+ sscanf(&lpsz_line[bytes_read], "%2x", &value);
mot->buffer[cooked_bytes] = (uint8_t)value;
cal_checksum += (uint8_t)mot->buffer[cooked_bytes];
bytes_read += 2;
@@ -881,7 +881,7 @@ static int image_mot_buffer_complete_inner(struct image *image,
uint32_t dummy;
while (count-- > 0) {
- sscanf(&lpszLine[bytes_read], "%2" SCNx32, &dummy);
+ sscanf(&lpsz_line[bytes_read], "%2" SCNx32, &dummy);
cal_checksum += (uint8_t)dummy;
bytes_read += 2;
}
@@ -906,7 +906,7 @@ static int image_mot_buffer_complete_inner(struct image *image,
}
/* account for checksum, will always be 0xFF */
- sscanf(&lpszLine[bytes_read], "%2" SCNx32, &checksum);
+ sscanf(&lpsz_line[bytes_read], "%2" SCNx32, &checksum);
cal_checksum += (uint8_t)checksum;
if (cal_checksum != 0xFF) {
@@ -917,7 +917,7 @@ static int image_mot_buffer_complete_inner(struct image *image,
if (end_rec) {
end_rec = false;
- LOG_WARNING("continuing after end-of-file record: %.40s", lpszLine);
+ LOG_WARNING("continuing after end-of-file record: %.40s", lpsz_line);
}
}
}
@@ -936,23 +936,23 @@ static int image_mot_buffer_complete_inner(struct image *image,
*/
static int image_mot_buffer_complete(struct image *image)
{
- char *lpszLine = malloc(1023);
- if (lpszLine == NULL) {
+ char *lpsz_line = malloc(1023);
+ if (lpsz_line == NULL) {
LOG_ERROR("Out of memory");
return ERROR_FAIL;
}
struct imagesection *section = malloc(sizeof(struct imagesection) * IMAGE_MAX_SECTIONS);
if (section == NULL) {
- free(lpszLine);
+ free(lpsz_line);
LOG_ERROR("Out of memory");
return ERROR_FAIL;
}
int retval;
- retval = image_mot_buffer_complete_inner(image, lpszLine, section);
+ retval = image_mot_buffer_complete_inner(image, lpsz_line, section);
free(section);
- free(lpszLine);
+ free(lpsz_line);
return retval;
}
diff --git a/src/target/target.c b/src/target/target.c
index 7dbcadb..4d2c646 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2884,57 +2884,57 @@ COMMAND_HANDLER(handle_targets_command)
/* every 300ms we check for reset & powerdropout and issue a "reset halt" if so. */
-static int powerDropout;
-static int srstAsserted;
+static int power_dropout;
+static int srst_asserted;
-static int runPowerRestore;
-static int runPowerDropout;
-static int runSrstAsserted;
-static int runSrstDeasserted;
+static int run_power_restore;
+static int run_power_dropout;
+static int run_srst_asserted;
+static int run_srst_deasserted;
static int sense_handler(void)
{
- static int prevSrstAsserted;
- static int prevPowerdropout;
+ static int prev_srst_asserted;
+ static int prev_power_dropout;
- int retval = jtag_power_dropout(&powerDropout);
+ int retval = jtag_power_dropout(&power_dropout);
if (retval != ERROR_OK)
return retval;
- int powerRestored;
- powerRestored = prevPowerdropout && !powerDropout;
- if (powerRestored)
- runPowerRestore = 1;
+ int power_restored;
+ power_restored = prev_power_dropout && !power_dropout;
+ if (power_restored)
+ run_power_restore = 1;
int64_t current = timeval_ms();
- static int64_t lastPower;
- bool waitMore = lastPower + 2000 > current;
- if (powerDropout && !waitMore) {
- runPowerDropout = 1;
- lastPower = current;
+ static int64_t last_power;
+ bool wait_more = last_power + 2000 > current;
+ if (power_dropout && !wait_more) {
+ run_power_dropout = 1;
+ last_power = current;
}
- retval = jtag_srst_asserted(&srstAsserted);
+ retval = jtag_srst_asserted(&srst_asserted);
if (retval != ERROR_OK)
return retval;
- int srstDeasserted;
- srstDeasserted = prevSrstAsserted && !srstAsserted;
+ int srst_deasserted;
+ srst_deasserted = prev_srst_asserted && !srst_asserted;
- static int64_t lastSrst;
- waitMore = lastSrst + 2000 > current;
- if (srstDeasserted && !waitMore) {
- runSrstDeasserted = 1;
- lastSrst = current;
+ static int64_t last_srst;
+ wait_more = last_srst + 2000 > current;
+ if (srst_deasserted && !wait_more) {
+ run_srst_deasserted = 1;
+ last_srst = current;
}
- if (!prevSrstAsserted && srstAsserted)
- runSrstAsserted = 1;
+ if (!prev_srst_asserted && srst_asserted)
+ run_srst_asserted = 1;
- prevSrstAsserted = srstAsserted;
- prevPowerdropout = powerDropout;
+ prev_srst_asserted = srst_asserted;
+ prev_power_dropout = power_dropout;
- if (srstDeasserted || powerRestored) {
+ if (srst_deasserted || power_restored) {
/* Other than logging the event we can't do anything here.
* Issuing a reset is a particularly bad idea as we might
* be inside a reset already.
@@ -2965,21 +2965,21 @@ static int handle_target(void *priv)
* clearing the flags after running these events.
*/
int did_something = 0;
- if (runSrstAsserted) {
+ if (run_srst_asserted) {
LOG_INFO("srst asserted detected, running srst_asserted proc.");
Jim_Eval(interp, "srst_asserted");
did_something = 1;
}
- if (runSrstDeasserted) {
+ if (run_srst_deasserted) {
Jim_Eval(interp, "srst_deasserted");
did_something = 1;
}
- if (runPowerDropout) {
+ if (run_power_dropout) {
LOG_INFO("Power dropout detected, running power_dropout proc.");
Jim_Eval(interp, "power_dropout");
did_something = 1;
}
- if (runPowerRestore) {
+ if (run_power_restore) {
Jim_Eval(interp, "power_restore");
did_something = 1;
}
@@ -2991,10 +2991,10 @@ static int handle_target(void *priv)
/* clear action flags */
- runSrstAsserted = 0;
- runSrstDeasserted = 0;
- runPowerRestore = 0;
- runPowerDropout = 0;
+ run_srst_asserted = 0;
+ run_srst_deasserted = 0;
+ run_power_restore = 0;
+ run_power_dropout = 0;
recursive = 0;
}
@@ -3020,7 +3020,7 @@ static int handle_target(void *priv)
target->backoff.count = 0;
/* only poll target if we've got power and srst isn't asserted */
- if (!powerDropout && !srstAsserted) {
+ if (!power_dropout && !srst_asserted) {
/* polling may fail silently until the target has been examined */
retval = target_poll(target);
if (retval != ERROR_OK) {
@@ -3596,7 +3596,7 @@ COMMAND_HANDLER(handle_mw_command)
return target_fill_mem(target, address, fn, wordsize, value, count);
}
-static COMMAND_HELPER(parse_load_image_command_CMD_ARGV, struct image *image,
+static COMMAND_HELPER(parse_load_image_command, struct image *image,
target_addr_t *min_address, target_addr_t *max_address)
{
if (CMD_ARGC < 1 || CMD_ARGC > 5)
@@ -3637,7 +3637,7 @@ COMMAND_HANDLER(handle_load_image_command)
target_addr_t max_address = -1;
struct image image;
- int retval = CALL_COMMAND_HANDLER(parse_load_image_command_CMD_ARGV,
+ int retval = CALL_COMMAND_HANDLER(parse_load_image_command,
&image, &min_address, &max_address);
if (retval != ERROR_OK)
return retval;
@@ -4166,44 +4166,44 @@ COMMAND_HANDLER(handle_virt2phys_command)
return retval;
}
-static void writeData(FILE *f, const void *data, size_t len)
+static void write_data(FILE *f, const void *data, size_t len)
{
size_t written = fwrite(data, 1, len, f);
if (written != len)
LOG_ERROR("failed to write %zu bytes: %s", len, strerror(errno));
}
-static void writeLong(FILE *f, int l, struct target *target)
+static void write_long(FILE *f, int l, struct target *target)
{
uint8_t val[4];
target_buffer_set_u32(target, val, l);
- writeData(f, val, 4);
+ write_data(f, val, 4);
}
-static void writeString(FILE *f, char *s)
+static void write_string(FILE *f, char *s)
{
- writeData(f, s, strlen(s));
+ write_data(f, s, strlen(s));
}
typedef unsigned char UNIT[2]; /* unit of profiling */
/* Dump a gmon.out histogram file. */
-static void write_gmon(uint32_t *samples, uint32_t sampleNum, const char *filename, bool with_range,
+static void write_gmon(uint32_t *samples, uint32_t sample_num, const char *filename, bool with_range,
uint32_t start_address, uint32_t end_address, struct target *target, uint32_t duration_ms)
{
uint32_t i;
FILE *f = fopen(filename, "w");
if (f == NULL)
return;
- writeString(f, "gmon");
- writeLong(f, 0x00000001, target); /* Version */
- writeLong(f, 0, target); /* padding */
- writeLong(f, 0, target); /* padding */
- writeLong(f, 0, target); /* padding */
+ write_string(f, "gmon");
+ write_long(f, 0x00000001, target); /* Version */
+ write_long(f, 0, target); /* padding */
+ write_long(f, 0, target); /* padding */
+ write_long(f, 0, target); /* padding */
uint8_t zero = 0; /* GMON_TAG_TIME_HIST */
- writeData(f, &zero, 1);
+ write_data(f, &zero, 1);
/* figure out bucket size */
uint32_t min;
@@ -4214,7 +4214,7 @@ static void write_gmon(uint32_t *samples, uint32_t sampleNum, const char *filena
} else {
min = samples[0];
max = samples[0];
- for (i = 0; i < sampleNum; i++) {
+ for (i = 0; i < sample_num; i++) {
if (min > samples[i])
min = samples[i];
if (max < samples[i])
@@ -4226,50 +4226,50 @@ static void write_gmon(uint32_t *samples, uint32_t sampleNum, const char *filena
max++;
}
- int addressSpace = max - min;
- assert(addressSpace >= 2);
+ int address_space = max - min;
+ assert(address_space >= 2);
/* FIXME: What is the reasonable number of buckets?
* The profiling result will be more accurate if there are enough buckets. */
- static const uint32_t maxBuckets = 128 * 1024; /* maximum buckets. */
- uint32_t numBuckets = addressSpace / sizeof(UNIT);
- if (numBuckets > maxBuckets)
- numBuckets = maxBuckets;
- int *buckets = malloc(sizeof(int) * numBuckets);
+ static const uint32_t max_buckets = 128 * 1024; /* maximum buckets. */
+ uint32_t num_buckets = address_space / sizeof(UNIT);
+ if (num_buckets > max_buckets)
+ num_buckets = max_buckets;
+ int *buckets = malloc(sizeof(int) * num_buckets);
if (buckets == NULL) {
fclose(f);
return;
}
- memset(buckets, 0, sizeof(int) * numBuckets);
- for (i = 0; i < sampleNum; i++) {
+ memset(buckets, 0, sizeof(int) * num_buckets);
+ for (i = 0; i < sample_num; i++) {
uint32_t address = samples[i];
if ((address < min) || (max <= address))
continue;
long long a = address - min;
- long long b = numBuckets;
- long long c = addressSpace;
+ long long b = num_buckets;
+ long long c = address_space;
int index_t = (a * b) / c; /* danger!!!! int32 overflows */
buckets[index_t]++;
}
/* append binary memory gmon.out &profile_hist_hdr ((char*)&profile_hist_hdr + sizeof(struct gmon_hist_hdr)) */
- writeLong(f, min, target); /* low_pc */
- writeLong(f, max, target); /* high_pc */
- writeLong(f, numBuckets, target); /* # of buckets */
- float sample_rate = sampleNum / (duration_ms / 1000.0);
- writeLong(f, sample_rate, target);
- writeString(f, "seconds");
+ write_long(f, min, target); /* low_pc */
+ write_long(f, max, target); /* high_pc */
+ write_long(f, num_buckets, target); /* # of buckets */
+ float sample_rate = sample_num / (duration_ms / 1000.0);
+ write_long(f, sample_rate, target);
+ write_string(f, "seconds");
for (i = 0; i < (15-strlen("seconds")); i++)
- writeData(f, &zero, 1);
- writeString(f, "s");
+ write_data(f, &zero, 1);
+ write_string(f, "s");
/*append binary memory gmon.out profile_hist_data (profile_hist_data + profile_hist_hdr.hist_size) */
- char *data = malloc(2 * numBuckets);
+ char *data = malloc(2 * num_buckets);
if (data != NULL) {
- for (i = 0; i < numBuckets; i++) {
+ for (i = 0; i < num_buckets; i++) {
int val;
val = buckets[i];
if (val > 65535)
@@ -4278,7 +4278,7 @@ static void write_gmon(uint32_t *samples, uint32_t sampleNum, const char *filena
data[i * 2 + 1] = (val >> 8) & 0xff;
}
free(buckets);
- writeData(f, data, numBuckets * 2);
+ write_data(f, data, num_buckets * 2);
free(data);
} else
free(buckets);
@@ -4375,26 +4375,26 @@ COMMAND_HANDLER(handle_profile_command)
static int new_u64_array_element(Jim_Interp *interp, const char *varname, int idx, uint64_t val)
{
char *namebuf;
- Jim_Obj *nameObjPtr, *valObjPtr;
+ Jim_Obj *obj_name, *obj_val;
int result;
namebuf = alloc_printf("%s(%d)", varname, idx);
if (!namebuf)
return JIM_ERR;
- nameObjPtr = Jim_NewStringObj(interp, namebuf, -1);
+ obj_name = Jim_NewStringObj(interp, namebuf, -1);
jim_wide wide_val = val;
- valObjPtr = Jim_NewWideObj(interp, wide_val);
- if (!nameObjPtr || !valObjPtr) {
+ obj_val = Jim_NewWideObj(interp, wide_val);
+ if (!obj_name || !obj_val) {
free(namebuf);
return JIM_ERR;
}
- Jim_IncrRefCount(nameObjPtr);
- Jim_IncrRefCount(valObjPtr);
- result = Jim_SetVariable(interp, nameObjPtr, valObjPtr);
- Jim_DecrRefCount(interp, nameObjPtr);
- Jim_DecrRefCount(interp, valObjPtr);
+ Jim_IncrRefCount(obj_name);
+ Jim_IncrRefCount(obj_val);
+ result = Jim_SetVariable(interp, obj_name, obj_val);
+ Jim_DecrRefCount(interp, obj_name);
+ Jim_DecrRefCount(interp, obj_val);
free(namebuf);
/* printf("%s(%d) <= 0%08x\n", varname, idx, val); */
return result;
@@ -4579,21 +4579,21 @@ static int get_u64_array_element(Jim_Interp *interp, const char *varname, size_t
if (!namebuf)
return JIM_ERR;
- Jim_Obj *nameObjPtr = Jim_NewStringObj(interp, namebuf, -1);
- if (!nameObjPtr) {
+ Jim_Obj *obj_name = Jim_NewStringObj(interp, namebuf, -1);
+ if (!obj_name) {
free(namebuf);
return JIM_ERR;
}
- Jim_IncrRefCount(nameObjPtr);
- Jim_Obj *valObjPtr = Jim_GetVariable(interp, nameObjPtr, JIM_ERRMSG);
- Jim_DecrRefCount(interp, nameObjPtr);
+ Jim_IncrRefCount(obj_name);
+ Jim_Obj *obj_val = Jim_GetVariable(interp, obj_name, JIM_ERRMSG);
+ Jim_DecrRefCount(interp, obj_name);
free(namebuf);
- if (valObjPtr == NULL)
+ if (obj_val == NULL)
return JIM_ERR;
jim_wide wide_val;
- int result = Jim_GetWide(interp, valObjPtr, &wide_val);
+ int result = Jim_GetWide(interp, obj_val, &wide_val);
*val = wide_val;
return result;
}
@@ -5456,11 +5456,11 @@ static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const *a
e = target_wait_state(target, n->value, a);
if (e != ERROR_OK) {
- Jim_Obj *eObj = Jim_NewIntObj(interp, e);
+ Jim_Obj *obj = Jim_NewIntObj(interp, e);
Jim_SetResultFormatted(goi.interp,
"target: %s wait %s fails (%#s) %s",
target_name(target), n->name,
- eObj, target_strerror_safe(e));
+ obj, target_strerror_safe(e));
return JIM_ERR;
}
return JIM_OK;
@@ -6069,7 +6069,7 @@ static const struct command_registration target_subcommand_handlers[] = {
COMMAND_REGISTRATION_DONE
};
-struct FastLoad {
+struct fast_load {
target_addr_t address;
uint8_t *data;
int length;
@@ -6077,7 +6077,7 @@ struct FastLoad {
};
static int fastload_num;
-static struct FastLoad *fastload;
+static struct fast_load *fastload;
static void free_fastload(void)
{
@@ -6099,7 +6099,7 @@ COMMAND_HANDLER(handle_fast_load_image_command)
struct image image;
- int retval = CALL_COMMAND_HANDLER(parse_load_image_command_CMD_ARGV,
+ int retval = CALL_COMMAND_HANDLER(parse_load_image_command,
&image, &min_address, &max_address);
if (retval != ERROR_OK)
return retval;
@@ -6114,13 +6114,13 @@ COMMAND_HANDLER(handle_fast_load_image_command)
image_size = 0x0;
retval = ERROR_OK;
fastload_num = image.num_sections;
- fastload = malloc(sizeof(struct FastLoad)*image.num_sections);
+ fastload = malloc(sizeof(struct fast_load)*image.num_sections);
if (fastload == NULL) {
command_print(CMD, "out of memory");
image_close(&image);
return ERROR_FAIL;
}
- memset(fastload, 0, sizeof(struct FastLoad)*image.num_sections);
+ memset(fastload, 0, sizeof(struct fast_load)*image.num_sections);
for (unsigned int i = 0; i < image.num_sections; i++) {
buffer = malloc(image.sections[i].size);
if (buffer == NULL) {
diff --git a/src/target/x86_32_common.c b/src/target/x86_32_common.c
index d0b0e37..b7dff23 100644
--- a/src/target/x86_32_common.c
+++ b/src/target/x86_32_common.c
@@ -472,10 +472,10 @@ int calcaddr_physfromlin(struct target *t, target_addr_t addr, target_addr_t *ph
}
uint32_t cr4 = buf_get_u32(x86_32->cache->reg_list[CR4].value, 0, 32);
- bool isPAE = cr4 & 0x00000020; /* PAE - Physical Address Extension */
+ bool is_pae = cr4 & 0x00000020; /* PAE - Physical Address Extension */
uint32_t cr3 = buf_get_u32(x86_32->cache->reg_list[CR3].value, 0, 32);
- if (isPAE) {
+ if (is_pae) {
uint32_t pdpt_base = cr3 & 0xFFFFF000; /* lower 12 bits of CR3 must always be 0 */
uint32_t pdpt_index = (addr & 0xC0000000) >> 30; /* A[31:30] index to PDPT */
uint32_t pdpt_addr = pdpt_base + (8 * pdpt_index);