From c18947b947064e7eceed8047c42d4c8dfd8ae964 Mon Sep 17 00:00:00 2001 From: zwelch Date: Thu, 18 Jun 2009 07:07:12 +0000 Subject: [PATCH] Transform 'u8' to 'uint8_t' - Replace '\([^_]\)u8' with '\1uint8_t'. - Replace '^u8' with 'uint8_t'. git-svn-id: svn://svn.berlios.de/openocd/trunk@2276 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/helper/binarybuffer.c | 22 +++---- src/helper/binarybuffer.h | 22 +++---- src/helper/fileio.c | 12 ++-- src/helper/fileio.h | 4 +- src/helper/types.h | 44 +++++++------- src/jtag/amt_jtagaccel.c | 38 ++++++------ src/jtag/arm-jtag-ew.c | 44 +++++++------- src/jtag/bitbang.c | 6 +- src/jtag/bitq.c | 12 ++-- src/jtag/commands.c | 10 ++-- src/jtag/commands.h | 4 +- src/jtag/core.c | 30 +++++----- src/jtag/driver.c | 10 ++-- src/jtag/ep93xx.c | 6 +- src/jtag/ft2232.c | 86 ++++++++++++++-------------- src/jtag/gw16012.c | 22 +++---- src/jtag/interface.c | 14 ++--- src/jtag/jlink.c | 42 +++++++------- src/jtag/jtag.h | 28 ++++----- src/jtag/minidriver.h | 10 ++-- src/jtag/minidummy/minidummy.c | 4 +- src/jtag/parport.c | 26 ++++----- src/jtag/presto.c | 14 ++--- src/jtag/rlink/rlink.c | 46 +++++++-------- src/jtag/rlink/rlink.h | 4 +- src/jtag/rlink/rlink_speed_table.c | 8 +-- src/jtag/usbprog.c | 8 +-- src/jtag/vsllink.c | 92 +++++++++++++++--------------- src/jtag/zy1000/zy1000.c | 12 ++-- src/pld/virtex2.c | 8 +-- src/pld/xilinx_bit.c | 4 +- src/pld/xilinx_bit.h | 12 ++-- src/server/gdb_server.c | 22 +++---- src/svf/svf.c | 48 ++++++++-------- src/xsvf/xsvf.c | 54 +++++++++--------- 35 files changed, 414 insertions(+), 414 deletions(-) diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c index 87b9fa79..f2ca4719 100644 --- a/src/helper/binarybuffer.c +++ b/src/helper/binarybuffer.c @@ -48,7 +48,7 @@ const unsigned char bit_reverse_table256[] = }; -u8* buf_cpy(const u8 *from, u8 *to, int size) +uint8_t* buf_cpy(const uint8_t *from, uint8_t *to, int size) { unsigned int num_bytes = CEIL(size, 8); unsigned int i; @@ -68,7 +68,7 @@ u8* buf_cpy(const u8 *from, u8 *to, int size) return to; } -int buf_cmp(const u8 *buf1, const u8 *buf2, int size) +int buf_cmp(const uint8_t *buf1, const uint8_t *buf2, int size) { int num_bytes = CEIL(size, 8); int i; @@ -95,7 +95,7 @@ int buf_cmp(const u8 *buf1, const u8 *buf2, int size) return 0; } -int buf_cmp_mask(const u8 *buf1, const u8 *buf2, const u8 *mask, int size) +int buf_cmp_mask(const uint8_t *buf1, const uint8_t *buf2, const uint8_t *mask, int size) { int num_bytes = CEIL(size, 8); int i; @@ -120,7 +120,7 @@ int buf_cmp_mask(const u8 *buf1, const u8 *buf2, const u8 *mask, int size) return 0; } -u8* buf_set_ones(u8 *buf, int count) +uint8_t* buf_set_ones(uint8_t *buf, int count) { int num_bytes = CEIL(count, 8); int i; @@ -138,7 +138,7 @@ u8* buf_set_ones(u8 *buf, int count) return buf; } -u8* buf_set_buf(const u8 *src, int src_start, u8 *dst, int dst_start, int len) +uint8_t* buf_set_buf(const uint8_t *src, int src_start, uint8_t *dst, int dst_start, int len) { int src_idx = src_start, dst_idx = dst_start; int i; @@ -186,7 +186,7 @@ int ceil_f_to_u32(float x) return y; } -char* buf_to_str(const u8 *buf, int buf_len, int radix) +char* buf_to_str(const uint8_t *buf, int buf_len, int radix) { const char *DIGITS = "0123456789ABCDEF"; float factor; @@ -225,7 +225,7 @@ char* buf_to_str(const u8 *buf, int buf_len, int radix) for (j = str_len; j > 0; j--) { tmp += (u32)str[j-1] * 256; - str[j-1] = (u8)(tmp % radix); + str[j-1] = (uint8_t)(tmp % radix); tmp /= radix; } } @@ -236,12 +236,12 @@ char* buf_to_str(const u8 *buf, int buf_len, int radix) return str; } -int str_to_buf(const char *str, int str_len, u8 *buf, int buf_len, int radix) +int str_to_buf(const char *str, int str_len, uint8_t *buf, int buf_len, int radix) { char *charbuf; u32 tmp; float factor; - u8 *b256_buf; + uint8_t *b256_buf; int b256_len; int j; /* base-256 digits */ @@ -304,7 +304,7 @@ int str_to_buf(const char *str, int str_len, u8 *buf, int buf_len, int radix) for (j = 0; j < b256_len; j++) { tmp += (u32)b256_buf[j] * radix; - b256_buf[j] = (u8)(tmp & 0xFF); + b256_buf[j] = (uint8_t)(tmp & 0xFF); tmp >>= 8; } @@ -328,7 +328,7 @@ int str_to_buf(const char *str, int str_len, u8 *buf, int buf_len, int radix) return i; } -int buf_to_u32_handler(u8 *in_buf, void *priv, struct scan_field_s *field) +int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field_s *field) { u32 *dest = priv; diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h index 3305caf3..49ea6b32 100644 --- a/src/helper/binarybuffer.h +++ b/src/helper/binarybuffer.h @@ -30,7 +30,7 @@ */ /* inlining this will help show what fn that is taking time during profiling. */ -static inline void buf_set_u32(u8* buffer, unsigned int first, unsigned int num, u32 value) +static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int num, u32 value) { if ((num==32)&&(first==0)) { @@ -51,7 +51,7 @@ static inline void buf_set_u32(u8* buffer, unsigned int first, unsigned int num, } } } -static inline u32 buf_get_u32(const u8* buffer, unsigned int first, unsigned int num) +static inline u32 buf_get_u32(const uint8_t* buffer, unsigned int first, unsigned int num) { if ((num==32)&&(first==0)) { @@ -73,23 +73,23 @@ static inline u32 buf_get_u32(const u8* buffer, unsigned int first, unsigned int extern u32 flip_u32(u32 value, unsigned int num); -extern int buf_cmp(const u8 *buf1, const u8 *buf2, int size); -extern int buf_cmp_mask(const u8 *buf1, const u8 *buf2, const u8 *mask, int size); -extern u8* buf_cpy(const u8 *from, u8 *to, int size); +extern int buf_cmp(const uint8_t *buf1, const uint8_t *buf2, int size); +extern int buf_cmp_mask(const uint8_t *buf1, const uint8_t *buf2, const uint8_t *mask, int size); +extern uint8_t* buf_cpy(const uint8_t *from, uint8_t *to, int size); -extern u8* buf_set_ones(u8 *buf, int count); -extern u8* buf_set_buf(const u8 *src, int src_start, u8 *dst, int dst_start, int len); +extern uint8_t* buf_set_ones(uint8_t *buf, int count); +extern uint8_t* buf_set_buf(const uint8_t *src, int src_start, uint8_t *dst, int dst_start, int len); -extern int str_to_buf(const char *str, int len, u8 *bin_buf, int buf_size, int radix); -extern char* buf_to_str(const u8 *buf, int size, int radix); +extern int str_to_buf(const char *str, int len, uint8_t *bin_buf, int buf_size, int radix); +extern char* buf_to_str(const uint8_t *buf, int size, int radix); struct scan_field_s; -extern int buf_to_u32_handler(u8 *in_buf, void *priv, struct scan_field_s *field); +extern int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field_s *field); #define CEIL(m, n) ((m + n - 1) / n) /* read a u32 from a buffer in target memory endianness */ -static inline u32 fast_target_buffer_get_u32(const u8 *buffer, int little) +static inline u32 fast_target_buffer_get_u32(const uint8_t *buffer, int little) { if (little) return le_to_h_u32(buffer); diff --git a/src/helper/fileio.c b/src/helper/fileio.c index 3a111525..b3a9bfe4 100644 --- a/src/helper/fileio.c +++ b/src/helper/fileio.c @@ -155,21 +155,21 @@ int fileio_seek(fileio_t *fileio, u32 position) return ERROR_OK; } -static inline int fileio_local_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read) +static inline int fileio_local_read(fileio_t *fileio, u32 size, uint8_t *buffer, u32 *size_read) { *size_read = fread(buffer, 1, size, fileio->file); return ERROR_OK; } -int fileio_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read) +int fileio_read(fileio_t *fileio, u32 size, uint8_t *buffer, u32 *size_read) { return fileio_local_read(fileio, size, buffer, size_read); } int fileio_read_u32(fileio_t *fileio, u32 *data) { - u8 buf[4]; + uint8_t buf[4]; u32 size_read; int retval; @@ -193,14 +193,14 @@ int fileio_fgets(fileio_t *fileio, u32 size, char *buffer) return fileio_local_fgets(fileio, size, buffer); } -static inline int fileio_local_write(fileio_t *fileio, u32 size, const u8 *buffer, u32 *size_written) +static inline int fileio_local_write(fileio_t *fileio, u32 size, const uint8_t *buffer, u32 *size_written) { *size_written = fwrite(buffer, 1, size, fileio->file); return ERROR_OK; } -int fileio_write(fileio_t *fileio, u32 size, const u8 *buffer, u32 *size_written) +int fileio_write(fileio_t *fileio, u32 size, const uint8_t *buffer, u32 *size_written) { int retval; @@ -214,7 +214,7 @@ int fileio_write(fileio_t *fileio, u32 size, const u8 *buffer, u32 *size_written int fileio_write_u32(fileio_t *fileio, u32 data) { - u8 buf[4]; + uint8_t buf[4]; u32 size_written; int retval; diff --git a/src/helper/fileio.h b/src/helper/fileio.h index e62f0ba8..99137674 100644 --- a/src/helper/fileio.h +++ b/src/helper/fileio.h @@ -54,8 +54,8 @@ typedef struct fileio_s FILE *file; } fileio_t; -extern int fileio_write(fileio_t *fileio, u32 size, const u8 *buffer, u32 *size_written); -extern int fileio_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read); +extern int fileio_write(fileio_t *fileio, u32 size, const uint8_t *buffer, u32 *size_written); +extern int fileio_read(fileio_t *fileio, u32 size, uint8_t *buffer, u32 *size_read); extern int fileio_fgets(fileio_t *fileio, u32 size, char *buffer); extern int fileio_seek(fileio_t *fileio, u32 position); extern int fileio_close(fileio_t *fileio); diff --git a/src/helper/types.h b/src/helper/types.h index 49933184..4ea66e24 100644 --- a/src/helper/types.h +++ b/src/helper/types.h @@ -30,8 +30,8 @@ #include #endif -#ifndef u8 -typedef unsigned char u8; +#ifndef uint8_t +typedef unsigned char uint8_t; #endif #ifndef u16 @@ -88,52 +88,52 @@ typedef bool _Bool; */ -static inline u32 le_to_h_u32(const u8* buf) +static inline u32 le_to_h_u32(const uint8_t* buf) { return (u32)(buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24); } -static inline u16 le_to_h_u16(const u8* buf) +static inline u16 le_to_h_u16(const uint8_t* buf) { return (u16)(buf[0] | buf[1] << 8); } -static inline u32 be_to_h_u32(const u8* buf) +static inline u32 be_to_h_u32(const uint8_t* buf) { return (u32)(buf[3] | buf[2] << 8 | buf[1] << 16 | buf[0] << 24); } -static inline u16 be_to_h_u16(const u8* buf) +static inline u16 be_to_h_u16(const uint8_t* buf) { return (u16)(buf[1] | buf[0] << 8); } -static inline void h_u32_to_le(u8* buf, int val) +static inline void h_u32_to_le(uint8_t* buf, int val) { - buf[3] = (u8) (val >> 24); - buf[2] = (u8) (val >> 16); - buf[1] = (u8) (val >> 8); - buf[0] = (u8) (val >> 0); + buf[3] = (uint8_t) (val >> 24); + buf[2] = (uint8_t) (val >> 16); + buf[1] = (uint8_t) (val >> 8); + buf[0] = (uint8_t) (val >> 0); } -static inline void h_u32_to_be(u8* buf, int val) +static inline void h_u32_to_be(uint8_t* buf, int val) { - buf[0] = (u8) (val >> 24); - buf[1] = (u8) (val >> 16); - buf[2] = (u8) (val >> 8); - buf[3] = (u8) (val >> 0); + buf[0] = (uint8_t) (val >> 24); + buf[1] = (uint8_t) (val >> 16); + buf[2] = (uint8_t) (val >> 8); + buf[3] = (uint8_t) (val >> 0); } -static inline void h_u16_to_le(u8* buf, int val) +static inline void h_u16_to_le(uint8_t* buf, int val) { - buf[1] = (u8) (val >> 8); - buf[0] = (u8) (val >> 0); + buf[1] = (uint8_t) (val >> 8); + buf[0] = (uint8_t) (val >> 0); } -static inline void h_u16_to_be(u8* buf, int val) +static inline void h_u16_to_be(uint8_t* buf, int val) { - buf[0] = (u8) (val >> 8); - buf[1] = (u8) (val >> 0); + buf[0] = (uint8_t) (val >> 8); + buf[1] = (uint8_t) (val >> 0); } #ifdef __ECOS diff --git a/src/jtag/amt_jtagaccel.c b/src/jtag/amt_jtagaccel.c index c7524cc1..843fc05e 100644 --- a/src/jtag/amt_jtagaccel.c +++ b/src/jtag/amt_jtagaccel.c @@ -46,9 +46,9 @@ static u16 amt_jtagaccel_port; /* interface variables */ -static u8 aw_control_rst = 0x00; -static u8 aw_control_fsm = 0x10; -static u8 aw_control_baudrate = 0x20; +static uint8_t aw_control_rst = 0x00; +static uint8_t aw_control_fsm = 0x10; +static uint8_t aw_control_baudrate = 0x20; static int rtck_enabled = 0; @@ -89,7 +89,7 @@ static int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, * 4: Shift-IR * 5: Pause-IR */ -static u8 amt_jtagaccel_tap_move[6][6][2] = +static uint8_t amt_jtagaccel_tap_move[6][6][2] = { /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ {{0x1f, 0x00}, {0x0f, 0x00}, {0x8a, 0x04}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00}}, /* RESET */ @@ -161,7 +161,7 @@ static void amt_jtagaccel_end_state(tap_state_t state) static void amt_wait_scan_busy(void) { int timeout = 4096; - u8 ar_status; + uint8_t ar_status; AMT_AR(ar_status); while (((ar_status) & 0x80) && (timeout-- > 0)) @@ -176,8 +176,8 @@ static void amt_wait_scan_busy(void) static void amt_jtagaccel_state_move(void) { - u8 aw_scan_tms_5; - u8 tms_scan[2]; + uint8_t aw_scan_tms_5; + uint8_t tms_scan[2]; tap_state_t cur_state = tap_get_state(); tap_state_t end_state = tap_get_end_state(); @@ -205,8 +205,8 @@ static void amt_jtagaccel_state_move(void) static void amt_jtagaccel_runtest(int num_cycles) { int i = 0; - u8 aw_scan_tms_5; - u8 aw_scan_tms_1to4; + uint8_t aw_scan_tms_5; + uint8_t aw_scan_tms_1to4; tap_state_t saved_end_state = tap_get_end_state(); @@ -235,16 +235,16 @@ static void amt_jtagaccel_runtest(int num_cycles) amt_jtagaccel_state_move(); } -static void amt_jtagaccel_scan(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size) +static void amt_jtagaccel_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size) { int bits_left = scan_size; int bit_count = 0; tap_state_t saved_end_state = tap_get_end_state(); - u8 aw_tdi_option; - u8 dw_tdi_scan; - u8 dr_tdo; - u8 aw_tms_scan; - u8 tms_scan[2]; + uint8_t aw_tdi_option; + uint8_t dw_tdi_scan; + uint8_t dr_tdo; + uint8_t aw_tms_scan; + uint8_t tms_scan[2]; int jtag_speed = jtag_get_speed(); if (ir_scan) @@ -323,7 +323,7 @@ static int amt_jtagaccel_execute_queue(void) jtag_command_t *cmd = jtag_command_queue; /* currently processed command */ int scan_size; enum scan_type type; - u8 *buffer; + uint8_t *buffer; int retval; /* return ERROR_OK, unless a jtag_read_buffer returns a failed check @@ -419,11 +419,11 @@ static int amt_jtagaccel_init(void) #if PARPORT_USE_PPDEV == 1 char buffer[256]; int i = 0; - u8 control_port; + uint8_t control_port; #else - u8 status_port; + uint8_t status_port; #endif - u8 ar_status; + uint8_t ar_status; #if PARPORT_USE_PPDEV == 1 if (device_handle > 0) diff --git a/src/jtag/arm-jtag-ew.c b/src/jtag/arm-jtag-ew.c index 98fd0d62..b951f61b 100644 --- a/src/jtag/arm-jtag-ew.c +++ b/src/jtag/arm-jtag-ew.c @@ -54,8 +54,8 @@ #define CMD_TGPWR_SETUP 0x22 /* Global USB buffers */ -static u8 usb_in_buffer[ARMJTAGEW_IN_BUFFER_SIZE]; -static u8 usb_out_buffer[ARMJTAGEW_OUT_BUFFER_SIZE]; +static uint8_t usb_in_buffer[ARMJTAGEW_IN_BUFFER_SIZE]; +static uint8_t usb_out_buffer[ARMJTAGEW_OUT_BUFFER_SIZE]; /* External interface functions */ static int armjtagew_execute_queue(void); @@ -73,9 +73,9 @@ static void armjtagew_end_state(tap_state_t state); static void armjtagew_state_move(void); static void armjtagew_path_move(int num_states, tap_state_t *path); static void armjtagew_runtest(int num_cycles); -static void armjtagew_scan(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command); +static void armjtagew_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, scan_command_t *command); static void armjtagew_reset(int trst, int srst); -//static void armjtagew_simple_command(u8 command); +//static void armjtagew_simple_command(uint8_t command); static int armjtagew_get_status(void); /* tap buffer functions */ @@ -83,7 +83,7 @@ static void armjtagew_tap_init(void); static int armjtagew_tap_execute(void); static void armjtagew_tap_ensure_space(int scans, int bits); static void armjtagew_tap_append_step(int tms, int tdi); -static void armjtagew_tap_append_scan(int length, u8 *buffer, scan_command_t *command); +static void armjtagew_tap_append_scan(int length, uint8_t *buffer, scan_command_t *command); /* ARM-JTAG-EW lowlevel functions */ typedef struct armjtagew_jtag @@ -101,7 +101,7 @@ static int armjtagew_usb_read(armjtagew_jtag_t *armjtagew_jtag, int exp_in_lengt static int armjtagew_get_version_info(void); #ifdef _DEBUG_USB_COMMS_ -static void armjtagew_debug_buffer(u8 *buffer, int length); +static void armjtagew_debug_buffer(uint8_t *buffer, int length); #endif static armjtagew_jtag_t* armjtagew_jtag_handle; @@ -128,7 +128,7 @@ static int armjtagew_execute_queue(void) jtag_command_t *cmd = jtag_command_queue; int scan_size; enum scan_type type; - u8 *buffer; + uint8_t *buffer; while (cmd != NULL) { @@ -315,7 +315,7 @@ static void armjtagew_state_move(void) { int i; int tms = 0; - u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); + uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); for (i = 0; i < tms_count; i++) @@ -385,7 +385,7 @@ static void armjtagew_runtest(int num_cycles) } } -static void armjtagew_scan(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command) +static void armjtagew_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, scan_command_t *command) { tap_state_t saved_end_state; @@ -415,11 +415,11 @@ static void armjtagew_scan(bool ir_scan, enum scan_type type, u8 *buffer, int sc static void armjtagew_reset(int trst, int srst) { - const u8 trst_mask = (1u<<5); - const u8 srst_mask = (1u<<6); - u8 val = 0; - u8 outp_en = 0; - u8 change_mask = 0; + const uint8_t trst_mask = (1u<<5); + const uint8_t srst_mask = (1u<<6); + uint8_t val = 0; + uint8_t outp_en = 0; + uint8_t change_mask = 0; int result; LOG_DEBUG("trst: %i, srst: %i", trst, srst); @@ -541,16 +541,16 @@ static int armjtagew_handle_armjtagew_info_command(struct command_context_s *cmd #define ARMJTAGEW_TAP_BUFFER_SIZE 2048 static int tap_length; -static u8 tms_buffer[ARMJTAGEW_TAP_BUFFER_SIZE]; -static u8 tdi_buffer[ARMJTAGEW_TAP_BUFFER_SIZE]; -static u8 tdo_buffer[ARMJTAGEW_TAP_BUFFER_SIZE]; +static uint8_t tms_buffer[ARMJTAGEW_TAP_BUFFER_SIZE]; +static uint8_t tdi_buffer[ARMJTAGEW_TAP_BUFFER_SIZE]; +static uint8_t tdo_buffer[ARMJTAGEW_TAP_BUFFER_SIZE]; typedef struct { int first; /* First bit position in tdo_buffer to read */ int length; /* Number of bits to read */ scan_command_t *command; /* Corresponding scan command */ - u8 *buffer; + uint8_t *buffer; } pending_scan_result_t; #define MAX_PENDING_SCAN_RESULTS 256 @@ -585,7 +585,7 @@ static void armjtagew_tap_append_step(int tms, int tdi) if (index < ARMJTAGEW_TAP_BUFFER_SIZE) { int bit_index = tap_length % 8; - u8 bit = 1 << bit_index; + uint8_t bit = 1 << bit_index; if (tms) { @@ -613,7 +613,7 @@ static void armjtagew_tap_append_step(int tms, int tdi) } } -void armjtagew_tap_append_scan(int length, u8 *buffer, scan_command_t *command) +void armjtagew_tap_append_scan(int length, uint8_t *buffer, scan_command_t *command) { pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length]; int i; @@ -687,7 +687,7 @@ static int armjtagew_tap_execute(void) for (i = 0; i < pending_scan_results_length; i++) { pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[i]; - u8 *buffer = pending_scan_result->buffer; + uint8_t *buffer = pending_scan_result->buffer; int length = pending_scan_result->length; int first = pending_scan_result->first; scan_command_t *command = pending_scan_result->command; @@ -845,7 +845,7 @@ static int armjtagew_usb_read(armjtagew_jtag_t *armjtagew_jtag, int exp_in_lengt #ifdef _DEBUG_USB_COMMS_ #define BYTES_PER_LINE 16 -static void armjtagew_debug_buffer(u8 *buffer, int length) +static void armjtagew_debug_buffer(uint8_t *buffer, int length) { char line[81]; char s[4]; diff --git a/src/jtag/bitbang.c b/src/jtag/bitbang.c index f5bfd15e..0acfc6f4 100644 --- a/src/jtag/bitbang.c +++ b/src/jtag/bitbang.c @@ -77,7 +77,7 @@ static void bitbang_end_state(tap_state_t state) static void bitbang_state_move(int skip) { int i=0, tms=0; - u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); + uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); for (i = skip; i < tms_count; i++) @@ -170,7 +170,7 @@ static void bitbang_stableclocks(int num_cycles) -static void bitbang_scan(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size) +static void bitbang_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size) { tap_state_t saved_end_state = tap_get_end_state(); int bit_cnt; @@ -233,7 +233,7 @@ int bitbang_execute_queue(void) jtag_command_t *cmd = jtag_command_queue; /* currently processed command */ int scan_size; enum scan_type type; - u8 *buffer; + uint8_t *buffer; int retval; if (!bitbang_interface) diff --git a/src/jtag/bitq.c b/src/jtag/bitq.c index 83e14e66..be5e8c73 100644 --- a/src/jtag/bitq.c +++ b/src/jtag/bitq.c @@ -29,7 +29,7 @@ bitq_interface_t* bitq_interface; /* low level bit queue interface */ static bitq_state_t bitq_in_state; /* state of input queue */ -static u8* bitq_in_buffer; /* buffer dynamically reallocated as needed */ +static uint8_t* bitq_in_buffer; /* buffer dynamically reallocated as needed */ static int bitq_in_bufsize = 32; /* min. buffer size */ /* @@ -40,9 +40,9 @@ static int bitq_in_bufsize = 32; /* min. buffer size */ void bitq_in_proc(void) { /* static information preserved between calls to increase performance */ - static u8* in_buff; /* pointer to buffer for scanned data */ + static uint8_t* in_buff; /* pointer to buffer for scanned data */ static int in_idx; /* index of byte being scanned */ - static u8 in_mask; /* mask of next bit to be scanned */ + static uint8_t in_mask; /* mask of next bit to be scanned */ scan_field_t* field; int tdo; @@ -150,7 +150,7 @@ void bitq_end_state(tap_state_t state) void bitq_state_move(tap_state_t new_state) { int i = 0; - u8 tms_scan; + uint8_t tms_scan; if (!tap_is_state_stable(tap_get_state()) || !tap_is_state_stable(new_state)) { @@ -218,8 +218,8 @@ void bitq_scan_field(scan_field_t* field, int pause) int bit_cnt; int tdo_req; - u8* out_ptr; - u8 out_mask; + uint8_t* out_ptr; + uint8_t out_mask; if (field->in_value) tdo_req = 1; diff --git a/src/jtag/commands.c b/src/jtag/commands.c index c9c7cf7f..b7b411b1 100644 --- a/src/jtag/commands.c +++ b/src/jtag/commands.c @@ -64,7 +64,7 @@ void* cmd_queue_alloc(size_t size) { cmd_queue_page_t **p_page = &cmd_queue_pages; int offset; - u8 *t; + uint8_t *t; /* * WARNING: @@ -117,7 +117,7 @@ void* cmd_queue_alloc(size_t size) offset = (*p_page)->used; (*p_page)->used += size; - t=(u8 *)((*p_page)->address); + t=(uint8_t *)((*p_page)->address); return t + offset; } @@ -174,7 +174,7 @@ int jtag_scan_size(const scan_command_t *cmd) return bit_count; } -int jtag_build_buffer(const scan_command_t *cmd, u8 **buffer) +int jtag_build_buffer(const scan_command_t *cmd, uint8_t **buffer) { int bit_count = 0; int i; @@ -218,7 +218,7 @@ int jtag_build_buffer(const scan_command_t *cmd, u8 **buffer) return bit_count; } -int jtag_read_buffer(u8 *buffer, const scan_command_t *cmd) +int jtag_read_buffer(uint8_t *buffer, const scan_command_t *cmd) { int i; int bit_count = 0; @@ -235,7 +235,7 @@ int jtag_read_buffer(u8 *buffer, const scan_command_t *cmd) if (cmd->fields[i].in_value) { int num_bits = cmd->fields[i].num_bits; - u8 *captured = buf_set_buf(buffer, bit_count, malloc(CEIL(num_bits, 8)), 0, num_bits); + uint8_t *captured = buf_set_buf(buffer, bit_count, malloc(CEIL(num_bits, 8)), 0, num_bits); #ifdef _DEBUG_JTAG_IO_ char *char_buf = buf_to_str(captured, (num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : num_bits, 16); diff --git a/src/jtag/commands.h b/src/jtag/commands.h index 38c7e5c4..fb70654e 100644 --- a/src/jtag/commands.h +++ b/src/jtag/commands.h @@ -156,7 +156,7 @@ void jtag_command_queue_reset(void); enum scan_type jtag_scan_type(const scan_command_t* cmd); int jtag_scan_size(const scan_command_t* cmd); -int jtag_read_buffer(u8* buffer, const scan_command_t* cmd); -int jtag_build_buffer(const scan_command_t* cmd, u8** buffer); +int jtag_read_buffer(uint8_t* buffer, const scan_command_t* cmd); +int jtag_build_buffer(const scan_command_t* cmd, uint8_t** buffer); #endif // JTAG_COMMANDS_H diff --git a/src/jtag/core.c b/src/jtag/core.c index aaa7da1f..f1e41247 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -353,23 +353,23 @@ void jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields, jtag_set_error(retval); } -void jtag_add_callback(jtag_callback1_t f, u8 *in) +void jtag_add_callback(jtag_callback1_t f, uint8_t *in) { interface_jtag_add_callback(f, in); } -void jtag_add_callback4(jtag_callback_t f, u8 *in, +void jtag_add_callback4(jtag_callback_t f, uint8_t *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3) { interface_jtag_add_callback4(f, in, data1, data2, data3); } -int jtag_check_value_inner(u8 *captured, u8 *in_check_value, u8 *in_check_mask, int num_bits); +int jtag_check_value_inner(uint8_t *captured, uint8_t *in_check_value, uint8_t *in_check_mask, int num_bits); -static int jtag_check_value_mask_callback(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3) +static int jtag_check_value_mask_callback(uint8_t *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3) { - return jtag_check_value_inner(in, (u8 *)data1, (u8 *)data2, (int)data3); + return jtag_check_value_inner(in, (uint8_t *)data1, (uint8_t *)data2, (int)data3); } static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state), @@ -693,7 +693,7 @@ void jtag_add_sleep(u32 us) jtag_set_error(interface_jtag_add_sleep(us)); } -int jtag_check_value_inner(u8 *captured, u8 *in_check_value, u8 *in_check_mask, int num_bits) +int jtag_check_value_inner(uint8_t *captured, uint8_t *in_check_value, uint8_t *in_check_mask, int num_bits) { int retval = ERROR_OK; @@ -742,7 +742,7 @@ int jtag_check_value_inner(u8 *captured, u8 *in_check_value, u8 *in_check_mask, return retval; } -void jtag_check_value_mask(scan_field_t *field, u8 *value, u8 *mask) +void jtag_check_value_mask(scan_field_t *field, uint8_t *value, uint8_t *mask) { assert(field->in_value != NULL); @@ -819,7 +819,7 @@ void jtag_sleep(u32 us) #define EXTRACT_PART(X) (((X) & 0xffff000) >> 12) #define EXTRACT_VER(X) (((X) & 0xf0000000) >> 28) -static int jtag_examine_chain_execute(u8 *idcode_buffer, unsigned num_idcode) +static int jtag_examine_chain_execute(uint8_t *idcode_buffer, unsigned num_idcode) { scan_field_t field = { .tap = NULL, @@ -836,10 +836,10 @@ static int jtag_examine_chain_execute(u8 *idcode_buffer, unsigned num_idcode) return jtag_execute_queue(); } -static bool jtag_examine_chain_check(u8 *idcodes, unsigned count) +static bool jtag_examine_chain_check(uint8_t *idcodes, unsigned count) { - u8 zero_check = 0x0; - u8 one_check = 0xff; + uint8_t zero_check = 0x0; + uint8_t one_check = 0xff; for (unsigned i = 0; i < count * 4; i++) { @@ -879,7 +879,7 @@ static bool jtag_idcode_is_final(u32 idcode) * read back correctly. This can help identify and diagnose problems * with the JTAG chain earlier, gives more helpful/explicit error messages. */ -static void jtag_examine_chain_end(u8 *idcodes, unsigned count, unsigned max) +static void jtag_examine_chain_end(uint8_t *idcodes, unsigned count, unsigned max) { bool triggered = false; for ( ; count < max - 31; count += 32) @@ -907,7 +907,7 @@ static bool jtag_examine_chain_match_tap(const struct jtag_tap_s *tap) } /* Loop over the expected identification codes and test for a match */ - u8 ii; + uint8_t ii; for (ii = 0; ii < tap->expected_ids_cnt; ii++) { if (tap->idcode == tap->expected_ids[ii]) @@ -937,7 +937,7 @@ static bool jtag_examine_chain_match_tap(const struct jtag_tap_s *tap) */ int jtag_examine_chain(void) { - u8 idcode_buffer[JTAG_MAX_CHAIN_SIZE * 4]; + uint8_t idcode_buffer[JTAG_MAX_CHAIN_SIZE * 4]; unsigned device_count = 0; jtag_examine_chain_execute(idcode_buffer, JTAG_MAX_CHAIN_SIZE); @@ -1015,7 +1015,7 @@ int jtag_validate_chain(void) { jtag_tap_t *tap; int total_ir_length = 0; - u8 *ir_test = NULL; + uint8_t *ir_test = NULL; scan_field_t field; int chain_pos = 0; diff --git a/src/jtag/driver.c b/src/jtag/driver.c index ec211bf1..9f53f276 100644 --- a/src/jtag/driver.c +++ b/src/jtag/driver.c @@ -40,7 +40,7 @@ struct jtag_callback_entry struct jtag_callback_entry *next; jtag_callback_t callback; - u8 *in; + uint8_t *in; jtag_callback_data_t data1; jtag_callback_data_t data2; jtag_callback_data_t data3; @@ -311,7 +311,7 @@ void interface_jtag_add_dr_out(jtag_tap_t *target_tap, for (int j = 0; j < in_num_fields; j++) { - u8 out_value[4]; + uint8_t out_value[4]; size_t scan_size = num_bits[j]; buf_set_u32(out_value, 0, scan_size, value[j]); @@ -465,7 +465,7 @@ int interface_jtag_add_sleep(u32 us) } /* add callback to end of queue */ -void interface_jtag_add_callback4(jtag_callback_t callback, u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3) +void interface_jtag_add_callback4(jtag_callback_t callback, uint8_t *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3) { struct jtag_callback_entry *entry=cmd_queue_alloc(sizeof(struct jtag_callback_entry)); @@ -507,13 +507,13 @@ int interface_jtag_execute_queue(void) return retval; } -static int jtag_convert_to_callback4(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3) +static int jtag_convert_to_callback4(uint8_t *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3) { ((jtag_callback1_t)data1)(in); return ERROR_OK; } -void interface_jtag_add_callback(jtag_callback1_t callback, u8 *in) +void interface_jtag_add_callback(jtag_callback1_t callback, uint8_t *in) { jtag_add_callback4(jtag_convert_to_callback4, in, (jtag_callback_data_t)callback, 0, 0); } diff --git a/src/jtag/ep93xx.c b/src/jtag/ep93xx.c index 38b9acb0..bf723c13 100644 --- a/src/jtag/ep93xx.c +++ b/src/jtag/ep93xx.c @@ -34,11 +34,11 @@ #include -static u8 output_value = 0x0; +static uint8_t output_value = 0x0; static int dev_mem_fd; static void *gpio_controller; -static volatile u8 *gpio_data_register; -static volatile u8 *gpio_data_direction_register; +static volatile uint8_t *gpio_data_register; +static volatile uint8_t *gpio_data_direction_register; /* low level command set */ diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c index a458315b..0a73b024 100644 --- a/src/jtag/ft2232.c +++ b/src/jtag/ft2232.c @@ -101,7 +101,7 @@ static char * ft2232_device_desc_A = NULL; static char* ft2232_device_desc = NULL; static char* ft2232_serial = NULL; static char* ft2232_layout = NULL; -static u8 ft2232_latency = 2; +static uint8_t ft2232_latency = 2; static unsigned ft2232_max_tck = 6000; @@ -168,13 +168,13 @@ static const ft2232_layout_t ft2232_layouts[] = { NULL, NULL, NULL, NULL }, }; -static u8 nTRST, nTRSTnOE, nSRST, nSRSTnOE; +static uint8_t nTRST, nTRSTnOE, nSRST, nSRSTnOE; static const ft2232_layout_t *layout; -static u8 low_output = 0x0; -static u8 low_direction = 0x0; -static u8 high_output = 0x0; -static u8 high_direction = 0x0; +static uint8_t low_output = 0x0; +static uint8_t low_direction = 0x0; +static uint8_t high_output = 0x0; +static uint8_t high_direction = 0x0; #if BUILD_FT2232_FTD2XX == 1 static FT_HANDLE ftdih = NULL; @@ -203,7 +203,7 @@ static int require_send; #define FT2232_BUFFER_SIZE 131072 -static u8* ft2232_buffer = NULL; +static uint8_t* ft2232_buffer = NULL; static int ft2232_buffer_size = 0; static int ft2232_read_pointer = 0; static int ft2232_expect_read = 0; @@ -213,7 +213,7 @@ static int ft2232_expect_read = 0; * writes a byte into the byte buffer, "ft2232_buffer", which must be sent later. * @param val is the byte to send. */ -static inline void buffer_write(u8 val) +static inline void buffer_write(uint8_t val) { assert(ft2232_buffer); assert((unsigned) ft2232_buffer_size < (unsigned) FT2232_BUFFER_SIZE); @@ -224,7 +224,7 @@ static inline void buffer_write(u8 val) * Function buffer_read * returns a byte from the byte buffer. */ -static inline u8 buffer_read(void) +static inline uint8_t buffer_read(void) { assert(ft2232_buffer); assert(ft2232_read_pointer < ft2232_buffer_size); @@ -249,9 +249,9 @@ static inline u8 buffer_read(void) * * See the MPSSE spec referenced above. */ -static void clock_tms(u8 mpsse_cmd, int tms_bits, int tms_count, bool tdi_bit) +static void clock_tms(uint8_t mpsse_cmd, int tms_bits, int tms_count, bool tdi_bit) { - u8 tms_byte; + uint8_t tms_byte; int i; int tms_ndx; /* bit index into tms_byte */ @@ -338,7 +338,7 @@ jtag_interface_t ft2232_interface = .quit = ft2232_quit, }; -static int ft2232_write(u8* buf, int size, u32* bytes_written) +static int ft2232_write(uint8_t* buf, int size, u32* bytes_written) { #if BUILD_FT2232_FTD2XX == 1 FT_STATUS status; @@ -371,7 +371,7 @@ static int ft2232_write(u8* buf, int size, u32* bytes_written) } -static int ft2232_read(u8* buf, u32 size, u32* bytes_read) +static int ft2232_read(uint8_t* buf, u32 size, u32* bytes_read) { #if BUILD_FT2232_FTD2XX == 1 DWORD dw_bytes_read; @@ -438,7 +438,7 @@ static int ft2232_adaptive_clocking(int speed) } } - u8 buf = use_adaptive_clocking ? 0x96 : 0x97; + uint8_t buf = use_adaptive_clocking ? 0x96 : 0x97; LOG_DEBUG("%2.2x", buf); u32 bytes_written; @@ -461,7 +461,7 @@ static int ft2232_adaptive_clocking(int speed) static int ft2232_speed(int speed) { - u8 buf[3]; + uint8_t buf[3]; int retval; u32 bytes_written; @@ -569,7 +569,7 @@ static void ft2232_end_state(tap_state_t state) } } -static void ft2232_read_scan(enum scan_type type, u8* buffer, int scan_size) +static void ft2232_read_scan(enum scan_type type, uint8_t* buffer, int scan_size) { int num_bytes = (scan_size + 7) / 8; int bits_left = scan_size; @@ -617,7 +617,7 @@ static void ft2232_debug_dump_buffer(void) static int ft2232_send_and_recv(jtag_command_t* first, jtag_command_t* last) { jtag_command_t* cmd; - u8* buffer; + uint8_t* buffer; int scan_size; enum scan_type type; int retval; @@ -775,7 +775,7 @@ static void ft2232_add_pathmove(tap_state_t* path, int num_states) } -static void ft2232_add_scan(bool ir_scan, enum scan_type type, u8* buffer, int scan_size) +static void ft2232_add_scan(bool ir_scan, enum scan_type type, uint8_t* buffer, int scan_size) { int num_bytes = (scan_size + 7) / 8; int bits_left = scan_size; @@ -823,8 +823,8 @@ static void ft2232_add_scan(bool ir_scan, enum scan_type type, u8* buffer, int s thisrun_bytes = (num_bytes > 65537) ? 65536 : (num_bytes - 1); num_bytes -= thisrun_bytes; - buffer_write((u8) (thisrun_bytes - 1)); - buffer_write((u8) ((thisrun_bytes - 1) >> 8)); + buffer_write((uint8_t) (thisrun_bytes - 1)); + buffer_write((uint8_t) ((thisrun_bytes - 1) >> 8)); if (type != SCAN_IN) { @@ -902,7 +902,7 @@ static void ft2232_add_scan(bool ir_scan, enum scan_type type, u8* buffer, int s { int tms_bits; int tms_count; - u8 mpsse_cmd; + uint8_t mpsse_cmd; /* move from Shift-IR/DR to end state */ if (type != SCAN_OUT) @@ -934,14 +934,14 @@ static void ft2232_add_scan(bool ir_scan, enum scan_type type, u8* buffer, int s } -static int ft2232_large_scan(scan_command_t* cmd, enum scan_type type, u8* buffer, int scan_size) +static int ft2232_large_scan(scan_command_t* cmd, enum scan_type type, uint8_t* buffer, int scan_size) { int num_bytes = (scan_size + 7) / 8; int bits_left = scan_size; int cur_byte = 0; int last_bit; - u8* receive_buffer = malloc(CEIL(scan_size, 8)); - u8* receive_pointer = receive_buffer; + uint8_t* receive_buffer = malloc(CEIL(scan_size, 8)); + uint8_t* receive_pointer = receive_buffer; u32 bytes_written; u32 bytes_read; int retval; @@ -993,8 +993,8 @@ static int ft2232_large_scan(scan_command_t* cmd, enum scan_type type, u8* buffe thisrun_bytes = (num_bytes > 65537) ? 65536 : (num_bytes - 1); thisrun_read = thisrun_bytes; num_bytes -= thisrun_bytes; - buffer_write((u8) (thisrun_bytes - 1)); - buffer_write((u8) ((thisrun_bytes - 1) >> 8)); + buffer_write((uint8_t) (thisrun_bytes - 1)); + buffer_write((uint8_t) ((thisrun_bytes - 1) >> 8)); if (type != SCAN_IN) { @@ -1095,7 +1095,7 @@ static int ft2232_large_scan(scan_command_t* cmd, enum scan_type type, u8* buffe { int tms_bits = tap_get_tms_path(tap_get_state(), tap_get_end_state()); int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); - u8 mpsse_cmd; + uint8_t mpsse_cmd; /* move from Shift-IR/DR to end state */ if (type != SCAN_OUT) @@ -1599,7 +1599,7 @@ static int ft2232_execute_pathmove(jtag_command_t *cmd) static int ft2232_execute_scan(jtag_command_t *cmd) { - u8* buffer; + uint8_t* buffer; int scan_size; /* size of IR or DR scan */ int predicted_size = 0; int retval = ERROR_OK; @@ -1788,7 +1788,7 @@ static int ft2232_init_ftd2xx(u16 vid, u16 pid, int more, int* try_more) char Description[64]; DWORD openex_flags = 0; char* openex_string = NULL; - u8 latency_timer; + uint8_t latency_timer; LOG_DEBUG("'ft2232' interface using FTD2XX with '%s' layout (%4.4x:%4.4x)", ft2232_layout, vid, pid); @@ -1960,7 +1960,7 @@ static int ft2232_purge_ftd2xx(void) #if BUILD_FT2232_LIBFTDI == 1 static int ft2232_init_libftdi(u16 vid, u16 pid, int more, int* try_more) { - u8 latency_timer; + uint8_t latency_timer; LOG_DEBUG("'ft2232' interface using libftdi with '%s' layout (%4.4x:%4.4x)", ft2232_layout, vid, pid); @@ -2032,7 +2032,7 @@ static int ft2232_purge_libftdi(void) static int ft2232_init(void) { - u8 buf[1]; + uint8_t buf[1]; int retval; u32 bytes_written; const ft2232_layout_t* cur_layout = ft2232_layouts; @@ -2123,7 +2123,7 @@ static int ft2232_init(void) static int usbjtag_init(void) { - u8 buf[3]; + uint8_t buf[3]; u32 bytes_written; low_output = 0x08; @@ -2199,7 +2199,7 @@ static int usbjtag_init(void) static int axm0432_jtag_init(void) { - u8 buf[3]; + uint8_t buf[3]; u32 bytes_written; low_output = 0x08; @@ -2270,7 +2270,7 @@ static int axm0432_jtag_init(void) static int jtagkey_init(void) { - u8 buf[3]; + uint8_t buf[3]; u32 bytes_written; low_output = 0x08; @@ -2353,7 +2353,7 @@ static int jtagkey_init(void) static int olimex_jtag_init(void) { - u8 buf[3]; + uint8_t buf[3]; u32 bytes_written; low_output = 0x08; @@ -2421,7 +2421,7 @@ static int olimex_jtag_init(void) static int flyswatter_init(void) { - u8 buf[3]; + uint8_t buf[3]; u32 bytes_written; low_output = 0x18; @@ -2468,7 +2468,7 @@ static int flyswatter_init(void) static int turtle_init(void) { - u8 buf[3]; + uint8_t buf[3]; u32 bytes_written; low_output = 0x08; @@ -2509,7 +2509,7 @@ static int turtle_init(void) static int comstick_init(void) { - u8 buf[3]; + uint8_t buf[3]; u32 bytes_written; low_output = 0x08; @@ -2553,7 +2553,7 @@ static int comstick_init(void) static int stm32stick_init(void) { - u8 buf[3]; + uint8_t buf[3]; u32 bytes_written; low_output = 0x88; @@ -2597,7 +2597,7 @@ static int stm32stick_init(void) static int sheevaplug_init(void) { - u8 buf[3]; + uint8_t buf[3]; u32 bytes_written; low_output = 0x08; @@ -2648,7 +2648,7 @@ static int sheevaplug_init(void) static int cortino_jtag_init(void) { - u8 buf[3]; + uint8_t buf[3]; u32 bytes_written; low_output = 0x08; @@ -2884,7 +2884,7 @@ static int ft2232_stableclocks(int num_cycles, jtag_command_t* cmd) int retval = 0; /* 7 bits of either ones or zeros. */ - u8 tms = (tap_get_state() == TAP_RESET ? 0x7F : 0x00); + uint8_t tms = (tap_get_state() == TAP_RESET ? 0x7F : 0x00); while (num_cycles > 0) { @@ -2949,7 +2949,7 @@ static int ft2232_stableclocks(int num_cycles, jtag_command_t* cmd) * ADBUS7 - GND */ static int icebear_jtag_init(void) { - u8 buf[3]; + uint8_t buf[3]; u32 bytes_written; low_direction = 0x0b; /* output: TCK TDI TMS; input: TDO */ diff --git a/src/jtag/gw16012.c b/src/jtag/gw16012.c index b5fd2881..1d1edd27 100644 --- a/src/jtag/gw16012.c +++ b/src/jtag/gw16012.c @@ -71,8 +71,8 @@ u16 gw16012_port; /* interface variables */ -static u8 gw16012_msb = 0x0; -static u8 gw16012_control_value = 0x0; +static uint8_t gw16012_msb = 0x0; +static uint8_t gw16012_control_value = 0x0; #if PARPORT_USE_PPDEV == 1 static int device_handle; @@ -106,7 +106,7 @@ static int gw16012_register_commands(struct command_context_s *cmd_ctx) return ERROR_OK; } -static void gw16012_data(u8 value) +static void gw16012_data(uint8_t value) { value = (value & 0x7f) | gw16012_msb; gw16012_msb ^= 0x80; /* toggle MSB */ @@ -126,7 +126,7 @@ static void gw16012_data(u8 value) #endif } -static void gw16012_control(u8 value) +static void gw16012_control(uint8_t value) { if (value != gw16012_control_value) { @@ -148,7 +148,7 @@ static void gw16012_control(u8 value) } } -static void gw16012_input(u8 *value) +static void gw16012_input(uint8_t *value) { #if PARPORT_USE_PPDEV == 1 ioctl(device_handle, PPRSTATUS, value); @@ -197,7 +197,7 @@ static void gw16012_end_state(tap_state_t state) static void gw16012_state_move(void) { int i=0, tms=0; - u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); + uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); gw16012_control(0x0); /* single-bit mode */ @@ -265,12 +265,12 @@ static void gw16012_runtest(int num_cycles) gw16012_state_move(); } -static void gw16012_scan(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size) +static void gw16012_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size) { int bits_left = scan_size; int bit_count = 0; tap_state_t saved_end_state = tap_get_end_state(); - u8 scan_out, scan_in; + uint8_t scan_out, scan_in; /* only if we're not already in the correct Shift state */ if (!((!ir_scan && (tap_get_state() == TAP_DRSHIFT)) || (ir_scan && (tap_get_state() == TAP_IRSHIFT)))) @@ -296,7 +296,7 @@ static void gw16012_scan(bool ir_scan, enum scan_type type, u8 *buffer, int scan gw16012_control(0x0); /* single-bit mode */ while (bits_left-- > 0) { - u8 tms = 0; + uint8_t tms = 0; scan_out = buf_get_u32(buffer, bit_count, 1); @@ -343,7 +343,7 @@ static int gw16012_execute_queue(void) jtag_command_t *cmd = jtag_command_queue; /* currently processed command */ int scan_size; enum scan_type type; - u8 *buffer; + uint8_t *buffer; int retval; /* return ERROR_OK, unless a jtag_read_buffer returns a failed check @@ -549,7 +549,7 @@ static int gw16012_init_device(void) static int gw16012_init(void) { - u8 status_port; + uint8_t status_port; if (gw16012_init_device() != ERROR_OK) return ERROR_JTAG_INIT_FAILED; diff --git a/src/jtag/interface.c b/src/jtag/interface.c index 059fe322..14c626ee 100644 --- a/src/jtag/interface.c +++ b/src/jtag/interface.c @@ -106,8 +106,8 @@ int tap_move_ndx( tap_state_t astate ) */ struct tms_sequences { - u8 bits; - u8 bit_count; + uint8_t bits; + uint8_t bit_count; }; @@ -127,7 +127,7 @@ struct tms_sequences +(((x) & 0x0F000000LU)?(1<<6):0) \ +(((x) & 0xF0000000LU)?(1<<7):0) -#define B8(bits,count) { ((u8)B8__(HEX__(bits))), (count) } +#define B8(bits,count) { ((uint8_t)B8__(HEX__(bits))), (count) } static const struct tms_sequences old_tms_seqs[6][6] = /* [from_state_ndx][to_state_ndx] */ { @@ -380,8 +380,8 @@ tap_state_t tap_state_by_name(const char *name) tap_state_t jtag_debug_state_machine(const void *tms_buf, const void *tdi_buf, unsigned tap_bits, tap_state_t next_state) { - const u8 *tms_buffer; - const u8 *tdi_buffer; + const uint8_t *tms_buffer; + const uint8_t *tdi_buffer; unsigned tap_bytes; unsigned cur_byte; unsigned cur_bit; @@ -396,8 +396,8 @@ tap_state_t jtag_debug_state_machine(const void *tms_buf, const void *tdi_buf, last_state = next_state; DEBUG_JTAG_IO("TAP/SM: START state: %s", tap_state_name(next_state)); - tms_buffer = (const u8 *)tms_buf; - tdi_buffer = (const u8 *)tdi_buf; + tms_buffer = (const uint8_t *)tms_buf; + tdi_buffer = (const uint8_t *)tdi_buf; tap_bytes = TAP_SCAN_BYTES(tap_bits); DEBUG_JTAG_IO("TAP/SM: TMS bits: %u (bytes: %u)", tap_bits, tap_bytes); diff --git a/src/jtag/jlink.c b/src/jtag/jlink.c index ce0489c0..d7bcba43 100644 --- a/src/jtag/jlink.c +++ b/src/jtag/jlink.c @@ -54,9 +54,9 @@ static unsigned int jlink_hw_jtag_version = 2; #define JLINK_EMU_RESULT_BUFFER_SIZE 64 /* Global USB buffers */ -static u8 usb_in_buffer[JLINK_IN_BUFFER_SIZE]; -static u8 usb_out_buffer[JLINK_OUT_BUFFER_SIZE]; -static u8 usb_emu_result_buffer[JLINK_EMU_RESULT_BUFFER_SIZE]; +static uint8_t usb_in_buffer[JLINK_IN_BUFFER_SIZE]; +static uint8_t usb_out_buffer[JLINK_OUT_BUFFER_SIZE]; +static uint8_t usb_emu_result_buffer[JLINK_EMU_RESULT_BUFFER_SIZE]; /* Constants for JLink command */ #define EMU_CMD_VERSION 0x01 @@ -100,9 +100,9 @@ static void jlink_end_state(tap_state_t state); static void jlink_state_move(void); static void jlink_path_move(int num_states, tap_state_t *path); static void jlink_runtest(int num_cycles); -static void jlink_scan(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command); +static void jlink_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, scan_command_t *command); static void jlink_reset(int trst, int srst); -static void jlink_simple_command(u8 command); +static void jlink_simple_command(uint8_t command); static int jlink_get_status(void); /* J-Link tap buffer functions */ @@ -110,7 +110,7 @@ static void jlink_tap_init(void); static int jlink_tap_execute(void); static void jlink_tap_ensure_space(int scans, int bits); static void jlink_tap_append_step(int tms, int tdi); -static void jlink_tap_append_scan(int length, u8 *buffer, scan_command_t *command); +static void jlink_tap_append_scan(int length, uint8_t *buffer, scan_command_t *command); /* Jlink lowlevel functions */ typedef struct jlink_jtag @@ -129,7 +129,7 @@ static int jlink_usb_read_emu_result(jlink_jtag_t *jlink_jtag); static int jlink_get_version_info(void); #ifdef _DEBUG_USB_COMMS_ -static void jlink_debug_buffer(u8 *buffer, int length); +static void jlink_debug_buffer(uint8_t *buffer, int length); #endif static enum tap_state jlink_last_state = TAP_RESET; @@ -184,7 +184,7 @@ static void jlink_execute_scan(jtag_command_t *cmd) { int scan_size; enum scan_type type; - u8 *buffer; + uint8_t *buffer; DEBUG_JTAG_IO("scan end in %s", tap_state_name(cmd->cmd.scan->end_state)); @@ -379,8 +379,8 @@ static void jlink_state_move(void) { int i; int tms = 0; - u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); - u8 tms_scan_bits = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); + uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); + uint8_t tms_scan_bits = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); for (i = 0; i < tms_scan_bits; i++) { @@ -447,7 +447,7 @@ static void jlink_runtest(int num_cycles) } } -static void jlink_scan(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command) +static void jlink_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, scan_command_t *command) { tap_state_t saved_end_state; @@ -505,7 +505,7 @@ static void jlink_reset(int trst, int srst) } } -static void jlink_simple_command(u8 command) +static void jlink_simple_command(uint8_t command) { int result; @@ -670,16 +670,16 @@ static int jlink_handle_jlink_hw_jtag_command(struct command_context_s *cmd_ctx, static unsigned tap_length=0; -static u8 tms_buffer[JLINK_TAP_BUFFER_SIZE]; -static u8 tdi_buffer[JLINK_TAP_BUFFER_SIZE]; -static u8 tdo_buffer[JLINK_TAP_BUFFER_SIZE]; +static uint8_t tms_buffer[JLINK_TAP_BUFFER_SIZE]; +static uint8_t tdi_buffer[JLINK_TAP_BUFFER_SIZE]; +static uint8_t tdo_buffer[JLINK_TAP_BUFFER_SIZE]; typedef struct { int first; /* First bit position in tdo_buffer to read */ int length; /* Number of bits to read */ scan_command_t *command; /* Corresponding scan command */ - u8 *buffer; + uint8_t *buffer; } pending_scan_result_t; #define MAX_PENDING_SCAN_RESULTS 256 @@ -716,7 +716,7 @@ static void jlink_tap_append_step(int tms, int tdi) } int bit_index = tap_length % 8; - u8 bit = 1 << bit_index; + uint8_t bit = 1 << bit_index; // we do not pad TMS, so be sure to initialize all bits if (0 == bit_index) @@ -737,7 +737,7 @@ static void jlink_tap_append_step(int tms, int tdi) tap_length++; } -static void jlink_tap_append_scan(int length, u8 *buffer, scan_command_t *command) +static void jlink_tap_append_scan(int length, uint8_t *buffer, scan_command_t *command) { pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length]; @@ -802,7 +802,7 @@ static int jlink_tap_execute(void) for (i = 0; i < pending_scan_results_length; i++) { pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[i]; - u8 *buffer = pending_scan_result->buffer; + uint8_t *buffer = pending_scan_result->buffer; int length = pending_scan_result->length; int first = pending_scan_result->first; scan_command_t *command = pending_scan_result->command; @@ -876,7 +876,7 @@ static jlink_jtag_t* jlink_usb_open() struct usb_interface_descriptor *desc = iface->altsetting; for (int i = 0; i < desc->bNumEndpoints; i++) { - u8 epnum = desc->endpoint[i].bEndpointAddress; + uint8_t epnum = desc->endpoint[i].bEndpointAddress; bool is_input = epnum & 0x80; LOG_DEBUG("usb ep %s %02x", is_input ? "in" : "out", epnum); if (is_input) @@ -1054,7 +1054,7 @@ static int jlink_usb_read_emu_result(jlink_jtag_t *jlink_jtag) #ifdef _DEBUG_USB_COMMS_ #define BYTES_PER_LINE 16 -static void jlink_debug_buffer(u8 *buffer, int length) +static void jlink_debug_buffer(uint8_t *buffer, int length) { char line[81]; char s[4]; diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index 459f7fd0..a7c6b2f9 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -123,21 +123,21 @@ typedef struct scan_field_s /// The number of bits this field specifies (up to 32) int num_bits; /// A pointer to value to be scanned into the device - u8* out_value; + uint8_t* out_value; /// A pointer to a 32-bit memory location for data scanned out - u8* in_value; + uint8_t* in_value; /// The value used to check the data scanned out. - u8* check_value; + uint8_t* check_value; /// The mask to go with check_value - u8* check_mask; + uint8_t* check_mask; /// in_value has been allocated for the queue int allocated; /// Indicates we modified the in_value. int modified; /// temporary storage for performing value checks synchronously - u8 intmp[4]; + uint8_t intmp[4]; } scan_field_t; typedef struct jtag_tap_event_action_s jtag_tap_event_action_t; @@ -157,19 +157,19 @@ struct jtag_tap_s bool enabled; int ir_length; /**< size of instruction register */ u32 ir_capture_value; - u8* expected; /**< Capture-IR expected value */ + uint8_t* expected; /**< Capture-IR expected value */ u32 ir_capture_mask; - u8* expected_mask; /**< Capture-IR expected mask */ + uint8_t* expected_mask; /**< Capture-IR expected mask */ u32 idcode; /**< device identification code */ /// Array of expected identification codes */ u32* expected_ids; /// Number of expected identification codes - u8 expected_ids_cnt; + uint8_t expected_ids_cnt; /// current instruction - u8* cur_instr; + uint8_t* cur_instr; /// Bypass register selected int bypass; @@ -393,10 +393,10 @@ extern void jtag_add_plain_dr_scan(int num_fields, const scan_field_t* fields, t * For conversion types or checks that can fail, use the more complete * variant: jtag_callback_t. */ -typedef void (*jtag_callback1_t)(u8 *in); +typedef void (*jtag_callback1_t)(uint8_t *in); /// A simpler version of jtag_add_callback4(). -extern void jtag_add_callback(jtag_callback1_t, u8 *in); +extern void jtag_add_callback(jtag_callback1_t, uint8_t *in); /** @@ -414,7 +414,7 @@ typedef intptr_t jtag_callback_data_t; * @param data3 An integer big enough to use as an @c int or a pointer. * @returns an error code */ -typedef int (*jtag_callback_t)(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3); +typedef int (*jtag_callback_t)(uint8_t *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3); /** @@ -445,7 +445,7 @@ typedef int (*jtag_callback_t)(u8 *in, jtag_callback_data_t data1, jtag_callback * @param data3 An integer big enough to use as an @c int or a pointer. * */ -extern void jtag_add_callback4(jtag_callback_t f, u8 *in, +extern void jtag_add_callback4(jtag_callback_t f, uint8_t *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3); @@ -646,7 +646,7 @@ extern int jtag_srst_asserted(int* srst_asserted); * @param mask Pointer to scan mask; may be NULL. * @returns Nothing, but calls jtag_set_error() on any error. */ -extern void jtag_check_value_mask(scan_field_t *field, u8 *value, u8 *mask); +extern void jtag_check_value_mask(scan_field_t *field, uint8_t *value, uint8_t *mask); extern void jtag_sleep(u32 us); diff --git a/src/jtag/minidriver.h b/src/jtag/minidriver.h index 8bd80126..9f5d8b01 100644 --- a/src/jtag/minidriver.h +++ b/src/jtag/minidriver.h @@ -59,7 +59,7 @@ static inline void interface_jtag_add_scan_check_alloc(scan_field_t *field) if (field->num_bits > 32) { unsigned num_bytes = TAP_SCAN_BYTES(field->num_bits); - field->in_value = (u8 *)malloc(num_bytes); + field->in_value = (uint8_t *)malloc(num_bytes); field->allocated = 1; } else @@ -72,22 +72,22 @@ static inline void interface_jtag_add_scan_check_alloc(scan_field_t *field) static inline void interface_jtag_alloc_in_value32(scan_field_t *field) { - field->in_value = (u8 *)cmd_queue_alloc(4); + field->in_value = (uint8_t *)cmd_queue_alloc(4); } static inline void interface_jtag_add_scan_check_alloc(scan_field_t *field) { unsigned num_bytes = TAP_SCAN_BYTES(field->num_bits); - field->in_value = (u8 *)cmd_queue_alloc(num_bytes); + field->in_value = (uint8_t *)cmd_queue_alloc(num_bytes); } extern void interface_jtag_add_dr_out(jtag_tap_t* tap, int num_fields, const int* num_bits, const u32* value, tap_state_t end_state); -extern void interface_jtag_add_callback(jtag_callback1_t f, u8 *in); +extern void interface_jtag_add_callback(jtag_callback1_t f, uint8_t *in); -extern void interface_jtag_add_callback4(jtag_callback_t f, u8 *in, +extern void interface_jtag_add_callback4(jtag_callback_t f, uint8_t *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3); diff --git a/src/jtag/minidummy/minidummy.c b/src/jtag/minidummy/minidummy.c index f9e8bf48..7088d1a8 100644 --- a/src/jtag/minidummy/minidummy.c +++ b/src/jtag/minidummy/minidummy.c @@ -57,7 +57,7 @@ int interface_jtag_execute_queue(void) -extern int jtag_check_value(u8 *captured, void *priv); +extern int jtag_check_value(uint8_t *captured, void *priv); int interface_jtag_set_end_state(tap_state_t state) { @@ -178,7 +178,7 @@ int interface_jtag_add_pathmove(int num_states, const tap_state_t *path) -void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little, int count) +void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, uint8_t *buffer, int little, int count) { int i; for (i = 0; i < count; i++) diff --git a/src/jtag/parport.c b/src/jtag/parport.c index 129caf0b..cd8e8e8b 100644 --- a/src/jtag/parport.c +++ b/src/jtag/parport.c @@ -62,17 +62,17 @@ typedef struct cable_s { char* name; - u8 TDO_MASK; /* status port bit containing current TDO value */ - u8 TRST_MASK; /* data port bit for TRST */ - u8 TMS_MASK; /* data port bit for TMS */ - u8 TCK_MASK; /* data port bit for TCK */ - u8 TDI_MASK; /* data port bit for TDI */ - u8 SRST_MASK; /* data port bit for SRST */ - u8 OUTPUT_INVERT; /* data port bits that should be inverted */ - u8 INPUT_INVERT; /* status port that should be inverted */ - u8 PORT_INIT; /* initialize data port with this value */ - u8 PORT_EXIT; /* de-initialize data port with this value */ - u8 LED_MASK; /* data port bit for LED */ + 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 */ + uint8_t TCK_MASK; /* data port bit for TCK */ + uint8_t TDI_MASK; /* data port bit for TDI */ + uint8_t SRST_MASK; /* data port bit for SRST */ + uint8_t OUTPUT_INVERT; /* data port bits that should be inverted */ + uint8_t INPUT_INVERT; /* status port that should be inverted */ + uint8_t PORT_INIT; /* initialize data port with this value */ + uint8_t PORT_EXIT; /* de-initialize data port with this value */ + uint8_t LED_MASK; /* data port bit for LED */ } cable_t; static cable_t cables[] = @@ -109,7 +109,7 @@ static int parport_exit = 0; /* interface variables */ static cable_t* cable; -static u8 dataport_value = 0x0; +static uint8_t dataport_value = 0x0; #if PARPORT_USE_PPDEV == 1 static int device_handle; @@ -173,7 +173,7 @@ static int parport_read(void) static __inline__ void parport_write_data(void) { - u8 output; + uint8_t output; output = dataport_value ^ cable->OUTPUT_INVERT; #if PARPORT_USE_PPDEV == 1 diff --git a/src/jtag/presto.c b/src/jtag/presto.c index 125658be..58389e69 100644 --- a/src/jtag/presto.c +++ b/src/jtag/presto.c @@ -98,10 +98,10 @@ typedef struct presto_s char serial[FT_DEVICE_SERNUM_LEN]; - u8 buff_out[BUFFER_SIZE]; + uint8_t buff_out[BUFFER_SIZE]; int buff_out_pos; - u8 buff_in[BUFFER_SIZE]; + uint8_t buff_in[BUFFER_SIZE]; int buff_in_exp; /* expected in buffer length */ int buff_in_len; /* length of data received */ int buff_in_pos; @@ -123,12 +123,12 @@ typedef struct presto_s static presto_t presto_state; static presto_t *presto = &presto_state; -static u8 presto_init_seq[] = +static uint8_t presto_init_seq[] = { 0x80, 0xA0, 0xA8, 0xB0, 0xC0, 0xE0 }; -static int presto_write(u8 *buf, u32 size) +static int presto_write(uint8_t *buf, u32 size) { #if BUILD_PRESTO_FTD2XX == 1 DWORD ftbytes; @@ -157,7 +157,7 @@ static int presto_write(u8 *buf, u32 size) return ERROR_OK; } -static int presto_read(u8* buf, u32 size) +static int presto_read(uint8_t* buf, u32 size) { #if BUILD_PRESTO_FTD2XX == 1 DWORD ftbytes; @@ -332,7 +332,7 @@ static int presto_open_ftd2xx(char *req_serial) #elif BUILD_PRESTO_LIBFTDI == 1 static int presto_open_libftdi(char *req_serial) { - u8 presto_data; + uint8_t presto_data; LOG_DEBUG("searching for PRESTO using libftdi"); @@ -521,7 +521,7 @@ static int presto_sendbyte(int data) if (presto->buff_out_pos < BUFFER_SIZE) { - presto->buff_out[presto->buff_out_pos++] = (u8)data; + presto->buff_out[presto->buff_out_pos++] = (uint8_t)data; if (((data & 0xC0) == 0x40) || ((data & 0xD0)== 0xD0)) presto->buff_in_exp++; } diff --git a/src/jtag/rlink/rlink.c b/src/jtag/rlink/rlink.c index 554cca29..d22b804d 100644 --- a/src/jtag/rlink/rlink.c +++ b/src/jtag/rlink/rlink.c @@ -327,17 +327,17 @@ static int dtc_load_from_buffer( usb_dev_handle *pHDev, - const u8 *buffer, + const uint8_t *buffer, size_t length ) { struct header_s { - u8 type; - u8 length; + uint8_t type; + uint8_t length; }; int usb_err; struct header_s *header; - u8 lut_start = 0xc0; + uint8_t lut_start = 0xc0; dtc_entry_download = 0; @@ -439,7 +439,7 @@ static int dtc_start_download(void) { int usb_err; - u8 ep2txr; + uint8_t ep2txr; /* set up for download mode and make sure EP2 is set up to transmit */ usb_err = ep1_generic_commandl( @@ -497,12 +497,12 @@ static int dtc_run_download( usb_dev_handle *pHDev, - u8 *command_buffer, + uint8_t *command_buffer, int command_buffer_size, - u8 *reply_buffer, + uint8_t *reply_buffer, int reply_buffer_size ) { - u8 ep2_buffer[USB_EP2IN_SIZE]; + uint8_t ep2_buffer[USB_EP2IN_SIZE]; int usb_err; int i; @@ -582,7 +582,7 @@ struct dtc_reply_queue_entry_s { jtag_command_t *cmd; /* the command that resulted in this entry */ struct { - u8 *buffer; /* the scan buffer */ + uint8_t *buffer; /* the scan buffer */ int size; /* size of the scan buffer in bits */ int offset; /* how many bits were already done before this? */ int length; /* how many bits are processed in this operation? */ @@ -602,7 +602,7 @@ struct { dtc_reply_queue_entry_t *rq_tail; u32 cmd_index; u32 reply_index; - u8 cmd_buffer[USB_EP2BANK_SIZE]; + uint8_t cmd_buffer[USB_EP2BANK_SIZE]; } dtc_queue; @@ -634,7 +634,7 @@ inline dtc_reply_queue_entry_t * dtc_queue_enqueue_reply( enum scan_type type, - u8 *buffer, + uint8_t *buffer, int size, int offset, int length, @@ -677,9 +677,9 @@ dtc_queue_run(void) { int usb_err; int bit_cnt; int x; - u8 *dtc_p, *tdo_p; - u8 dtc_mask, tdo_mask; - u8 reply_buffer[USB_EP2IN_SIZE]; + uint8_t *dtc_p, *tdo_p; + uint8_t dtc_mask, tdo_mask; + uint8_t reply_buffer[USB_EP2IN_SIZE]; retval = ERROR_OK; @@ -827,7 +827,7 @@ int tap_state_queue_run(void) { int i; int bits; - u8 byte; + uint8_t byte; int retval; retval = 0; @@ -881,7 +881,7 @@ tap_state_queue_run(void) { static int tap_state_queue_append( - u8 tms + uint8_t tms ) { int retval; @@ -916,7 +916,7 @@ static void rlink_state_move(void) { int i=0, tms=0; - u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); + uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); for (i = 0; i < tms_count; i++) @@ -994,7 +994,7 @@ void rlink_runtest(int num_cycles) static void rlink_reset(int trst, int srst) { - u8 bitmap; + uint8_t bitmap; int usb_err; /* Read port A for bit op */ @@ -1093,7 +1093,7 @@ int rlink_scan( jtag_command_t *cmd, enum scan_type type, - u8 *buffer, + uint8_t *buffer, int scan_size ) { bool ir_scan; @@ -1105,8 +1105,8 @@ rlink_scan( int x; int tdi_bit_offset; - u8 tdi_mask, *tdi_p; - u8 dtc_mask; + uint8_t tdi_mask, *tdi_p; + uint8_t dtc_mask; if(scan_size < 1) { LOG_ERROR("scan_size cannot be less than 1 bit\n"); @@ -1382,7 +1382,7 @@ int rlink_execute_queue(void) jtag_command_t *cmd = jtag_command_queue; /* currently processed command */ int scan_size; enum scan_type type; - u8 *buffer; + uint8_t *buffer; int retval, tmp_retval; /* return ERROR_OK, unless something goes wrong */ @@ -1622,7 +1622,7 @@ int rlink_init(void) int i, j, retries; int found=0; int success=0; - u8 reply_buffer[USB_EP1IN_SIZE]; + uint8_t reply_buffer[USB_EP1IN_SIZE]; usb_init(); usb_find_busses(); diff --git a/src/jtag/rlink/rlink.h b/src/jtag/rlink/rlink.h index d24bbe79..9948d45c 100644 --- a/src/jtag/rlink/rlink.h +++ b/src/jtag/rlink/rlink.h @@ -22,10 +22,10 @@ typedef struct rlink_speed_table_s { - u8 const *dtc; + uint8_t const *dtc; u16 dtc_size; u16 khz; - u8 prescaler; + uint8_t prescaler; } rlink_speed_table_t; extern const rlink_speed_table_t rlink_speed_table[]; diff --git a/src/jtag/rlink/rlink_speed_table.c b/src/jtag/rlink/rlink_speed_table.c index f91a58eb..1f3e973b 100644 --- a/src/jtag/rlink/rlink_speed_table.c +++ b/src/jtag/rlink/rlink_speed_table.c @@ -6,7 +6,7 @@ #include "rlink.h" #include "st7.h" -static const u8 dtc_64[] = { +static const uint8_t dtc_64[] = { 0, 2, 68, 84, 67, 2, 13, 160, 176, 151, 147, 182, 141, 152, 177, 129, 148, 191, 143, 142, 5, 3, 0, 0, 0, 2, 68, 84, 67, 4, 0, 192, 5, 15, 0, 42, 42, 42, 73, 0, 88, 0, 160, 189, 0, 0, 0, 0, 106, 9, 1, 8, 22, 100, 111, 119, @@ -27,7 +27,7 @@ static const u8 dtc_64[] = { 60, 97, 203, 8, 2, 36, 139, 124, 193, 151, 96 }; -static const u8 dtc_11[] = { +static const uint8_t dtc_11[] = { 0, 2, 68, 84, 67, 2, 13, 160, 176, 151, 147, 182, 141, 152, 177, 129, 148, 188, 143, 142, 5, 3, 0, 0, 0, 2, 68, 84, 67, 4, 0, 192, 5, 15, 0, 42, 42, 42, 73, 0, 88, 0, 154, 183, 0, 0, 0, 0, 106, 9, 1, 8, 22, 100, 111, 119, @@ -47,7 +47,7 @@ static const u8 dtc_11[] = { 203, 8, 2, 36, 139, 117, 193, 151, 96 }; -static const u8 dtc_8[] = { +static const uint8_t dtc_8[] = { 0, 2, 68, 84, 67, 2, 13, 160, 176, 151, 147, 182, 141, 152, 177, 129, 148, 187, 143, 142, 5, 3, 0, 0, 0, 2, 68, 84, 67, 4, 0, 192, 5, 15, 0, 42, 42, 42, 73, 0, 88, 0, 152, 181, 0, 0, 0, 0, 106, 9, 1, 8, 22, 100, 111, 119, @@ -67,7 +67,7 @@ static const u8 dtc_8[] = { 8, 2, 36, 139, 115, 193, 151, 96 }; -static const u8 dtc_2[] = { +static const uint8_t dtc_2[] = { 0, 2, 68, 84, 67, 2, 14, 160, 176, 151, 147, 182, 141, 152, 177, 129, 148, 186, 143, 185, 142, 5, 3, 0, 0, 0, 2, 68, 84, 67, 4, 0, 192, 5, 15, 0, 42, 42, 42, 73, 0, 88, 0, 149, 178, 0, 0, 0, 0, 106, 9, 1, 8, 22, 100, diff --git a/src/jtag/usbprog.c b/src/jtag/usbprog.c index 487e9b16..5d9c71b5 100644 --- a/src/jtag/usbprog.c +++ b/src/jtag/usbprog.c @@ -59,7 +59,7 @@ static void usbprog_end_state(tap_state_t state); static void usbprog_state_move(void); static void usbprog_path_move(pathmove_command_t *cmd); static void usbprog_runtest(int num_cycles); -static void usbprog_scan(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size); +static void usbprog_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size); jtag_interface_t usbprog_interface = { @@ -130,7 +130,7 @@ static int usbprog_execute_queue(void) jtag_command_t *cmd = jtag_command_queue; /* currently processed command */ int scan_size; enum scan_type type; - u8 *buffer; + uint8_t *buffer; while (cmd) { @@ -237,7 +237,7 @@ static void usbprog_end_state(tap_state_t state) static void usbprog_state_move(void) { int i = 0, tms = 0; - u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); + uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); usbprog_jtag_write_tms(usbprog_jtag_handle, (char)tms_scan); @@ -328,7 +328,7 @@ static void usbprog_runtest(int num_cycles) */ } -static void usbprog_scan(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size) +static void usbprog_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size) { tap_state_t saved_end_state = tap_get_end_state(); diff --git a/src/jtag/vsllink.c b/src/jtag/vsllink.c index 8e0ef666..7ecd6c7f 100644 --- a/src/jtag/vsllink.c +++ b/src/jtag/vsllink.c @@ -39,10 +39,10 @@ static u16 vsllink_usb_vid; static u16 vsllink_usb_pid; -static u8 vsllink_usb_bulkout; -static u8 vsllink_usb_bulkin; -static u8 vsllink_usb_interface; -static u8 vsllink_mode = VSLLINK_MODE_NORMAL; +static uint8_t vsllink_usb_bulkout; +static uint8_t vsllink_usb_bulkin; +static uint8_t vsllink_usb_interface; +static uint8_t vsllink_mode = VSLLINK_MODE_NORMAL; static int VSLLINK_USB_TIMEOUT = 10000; static int VSLLINK_BufferSize = 1024; @@ -50,8 +50,8 @@ static int VSLLINK_BufferSize = 1024; /* Global USB buffers */ static int vsllink_usb_out_buffer_idx; static int vsllink_usb_in_want_length; -static u8* vsllink_usb_in_buffer = NULL; -static u8* vsllink_usb_out_buffer = NULL; +static uint8_t* vsllink_usb_in_buffer = NULL; +static uint8_t* vsllink_usb_out_buffer = NULL; /* Constants for VSLLink command */ #define VSLLINK_CMD_CONN 0x80 @@ -94,7 +94,7 @@ static u8* vsllink_usb_out_buffer = NULL; * * SD->SD and SI->SI have to be caught in interface specific code */ -static u8 VSLLINK_tap_move[6][6] = +static uint8_t VSLLINK_tap_move[6][6] = { /* TLR RTI SD PD SI PI */ {0xff, 0x7f, 0x2f, 0x0a, 0x37, 0x16}, /* TLR */ @@ -158,7 +158,7 @@ static insert_insignificant_operation_t VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[6] {0, 0,}}, /* PI */ }; -static u8 VSLLINK_BIT_MSK[8] = +static uint8_t VSLLINK_BIT_MSK[8] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f }; @@ -168,7 +168,7 @@ typedef struct int offset; int length; /* Number of bits to read */ scan_command_t *command; /* Corresponding scan command */ - u8 *buffer; + uint8_t *buffer; } pending_scan_result_t; #define MAX_PENDING_SCAN_RESULTS 256 @@ -205,11 +205,11 @@ static void vsllink_runtest(int num_cycles); static void vsllink_stableclocks_dma(int num_cycles, int tms); static void vsllink_stableclocks_normal(int num_cycles, int tms); static void (*vsllink_stableclocks)(int num_cycles, int tms); -static void vsllink_scan_dma(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command); -static void vsllink_scan_normal(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command); -static void (*vsllink_scan)(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command); +static void vsllink_scan_dma(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, scan_command_t *command); +static void vsllink_scan_normal(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, scan_command_t *command); +static void (*vsllink_scan)(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, scan_command_t *command); static void vsllink_reset(int trst, int srst); -static void vsllink_simple_command(u8 command); +static void vsllink_simple_command(uint8_t command); static int vsllink_connect(void); static int vsllink_disconnect(void); @@ -224,8 +224,8 @@ static int (*vsllink_tap_execute)(void); static void vsllink_tap_ensure_space_dma(int scans, int length); static void vsllink_tap_ensure_space_normal(int scans, int length); static void (*vsllink_tap_ensure_space)(int scans, int length); -static void vsllink_tap_append_scan_dma(int length, u8 *buffer, scan_command_t *command); -static void vsllink_tap_append_scan_normal(int length, u8 *buffer, scan_command_t *command, int offset); +static void vsllink_tap_append_scan_dma(int length, uint8_t *buffer, scan_command_t *command); +static void vsllink_tap_append_scan_normal(int length, uint8_t *buffer, scan_command_t *command, int offset); /* VSLLink lowlevel functions */ typedef struct vsllink_jtag @@ -240,17 +240,17 @@ static int vsllink_usb_write(vsllink_jtag_t *vsllink_jtag, int out_length); static int vsllink_usb_read(vsllink_jtag_t *vsllink_jtag); #if defined _DEBUG_USB_COMMS_ || defined _DEBUG_JTAG_IO_ -static void vsllink_debug_buffer(u8 *buffer, int length); +static void vsllink_debug_buffer(uint8_t *buffer, int length); #endif static int vsllink_tms_data_len = 0; -static u8* vsllink_tms_cmd_pos; +static uint8_t* vsllink_tms_cmd_pos; static int tap_length = 0; static int tap_buffer_size = 0; -static u8 *tms_buffer = NULL; -static u8 *tdi_buffer = NULL; -static u8 *tdo_buffer = NULL; +static uint8_t *tms_buffer = NULL; +static uint8_t *tdi_buffer = NULL; +static uint8_t *tdo_buffer = NULL; static int last_tms; static vsllink_jtag_t* vsllink_jtag_handle = NULL; @@ -288,7 +288,7 @@ static int vsllink_execute_queue(void) jtag_command_t *cmd = jtag_command_queue; int scan_size; enum scan_type type; - u8 *buffer; + uint8_t *buffer; DEBUG_JTAG_IO("--------------------------------- vsllink -------------------------------------"); @@ -491,9 +491,9 @@ static int vsllink_init(void) if (vsllink_mode == VSLLINK_MODE_DMA) { tap_buffer_size = (VSLLINK_BufferSize - 3) / 2; - tms_buffer = (u8*)malloc(tap_buffer_size); - tdi_buffer = (u8*)malloc(tap_buffer_size); - tdo_buffer = (u8*)malloc(tap_buffer_size); + tms_buffer = (uint8_t*)malloc(tap_buffer_size); + tdi_buffer = (uint8_t*)malloc(tap_buffer_size); + tdo_buffer = (uint8_t*)malloc(tap_buffer_size); if ((tms_buffer == NULL) || (tdi_buffer == NULL) || (tdo_buffer == NULL)) { LOG_ERROR("Not enough memory"); @@ -626,7 +626,7 @@ static int vsllink_connect(void) // length of VSLLINK_CMDJTAGSEQ_TMSBYTE has been set, no need to set it here. static void vsllink_append_tms(void) { - u8 tms_scan = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state()); + uint8_t tms_scan = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state()); u16 tms2; insert_insignificant_operation_t *insert = \ &VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())]; @@ -691,7 +691,7 @@ static void vsllink_state_move_dma(void) int i, insert_length = (tap_length % 8) ? (8 - (tap_length % 8)) : 0; insert_insignificant_operation_t *insert = \ &VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())]; - u8 tms_scan = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state()); + uint8_t tms_scan = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state()); if (tap_get_state() == TAP_RESET) { @@ -980,14 +980,14 @@ static void vsllink_stableclocks_normal(int num_cycles, int tms) // just add to vsllink_tms_data_len // same result if tun through //vsllink_tms_data_len += num_cycles; - vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] |= (u8)(tms_append_byte & 0xFF); + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] |= (uint8_t)(tms_append_byte & 0xFF); } else if (tms_len == 8) { // end last tms shift command // just reduce it, and append last tms byte (*vsllink_tms_cmd_pos)--; - vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (u8)(tms_append_byte & 0xFF); + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (uint8_t)(tms_append_byte & 0xFF); } else if (tms_len < 16) { @@ -997,8 +997,8 @@ static void vsllink_stableclocks_normal(int num_cycles, int tms) // there is enought tms length in the current tms shift command // increase the tms byte length by 1 and set the last byte to 0 (*vsllink_tms_cmd_pos)++; - vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (u8)(tms_append_byte & 0xFF); - vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] = (u8)(tms_append_byte >> 8); + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (uint8_t)(tms_append_byte & 0xFF); + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] = (uint8_t)(tms_append_byte >> 8); } else { @@ -1008,19 +1008,19 @@ static void vsllink_stableclocks_normal(int num_cycles, int tms) // first decrease byte length of last tms shift command (*vsllink_tms_cmd_pos)--; // append last tms byte and move the command pointer to the next empty position - vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (u8)(tms_append_byte & 0xFF); + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (uint8_t)(tms_append_byte & 0xFF); // add new command(3 bytes) vsllink_tap_ensure_space(0, 3); vsllink_tms_cmd_pos = &vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx]; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_TMSBYTE | 1; - vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] = (u8)(tms_append_byte >> 8); + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] = (uint8_t)(tms_append_byte >> 8); } } else if (tms_len == 16) { // end last tms shift command - vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (u8)(tms_append_byte & 0xFF); - vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (u8)(tms_append_byte >> 8); + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (uint8_t)(tms_append_byte & 0xFF); + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (uint8_t)(tms_append_byte >> 8); } vsllink_tms_data_len = tms_len & 7; @@ -1033,8 +1033,8 @@ static void vsllink_stableclocks_normal(int num_cycles, int tms) else { // more shifts will be needed - vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (u8)(tms_append_byte & 0xFF); - vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (u8)(tms_append_byte >> 8); + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (uint8_t)(tms_append_byte & 0xFF); + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (uint8_t)(tms_append_byte >> 8); num_cycles -= 16 - vsllink_tms_data_len; vsllink_tms_data_len = 0; @@ -1172,10 +1172,10 @@ static void vsllink_runtest(int num_cycles) } } -static void vsllink_scan_normal(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command) +static void vsllink_scan_normal(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, scan_command_t *command) { tap_state_t saved_end_state; - u8 bits_left, tms_tmp, tdi_len; + uint8_t bits_left, tms_tmp, tdi_len; int i; if (0 == scan_size ) @@ -1288,7 +1288,7 @@ static void vsllink_scan_normal(bool ir_scan, enum scan_type type, u8 *buffer, i tap_set_state(tap_get_end_state()); } -static void vsllink_scan_dma(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command) +static void vsllink_scan_dma(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, scan_command_t *command) { tap_state_t saved_end_state; @@ -1342,7 +1342,7 @@ static void vsllink_reset(int trst, int srst) } } -static void vsllink_simple_command(u8 command) +static void vsllink_simple_command(uint8_t command) { int result; @@ -1505,7 +1505,7 @@ static void vsllink_tap_append_step(int tms, int tdi) if (index < tap_buffer_size) { int bit_index = tap_length % 8; - u8 bit = 1 << bit_index; + uint8_t bit = 1 << bit_index; if (tms) { @@ -1533,7 +1533,7 @@ static void vsllink_tap_append_step(int tms, int tdi) } } -static void vsllink_tap_append_scan_normal(int length, u8 *buffer, scan_command_t *command, int offset) +static void vsllink_tap_append_scan_normal(int length, uint8_t *buffer, scan_command_t *command, int offset) { pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length]; int i; @@ -1558,7 +1558,7 @@ static void vsllink_tap_append_scan_normal(int length, u8 *buffer, scan_command_ pending_scan_results_length++; } -static void vsllink_tap_append_scan_dma(int length, u8 *buffer, scan_command_t *command) +static void vsllink_tap_append_scan_dma(int length, uint8_t *buffer, scan_command_t *command) { pending_scan_result_t *pending_scan_result; int len_tmp, len_all, i; @@ -1639,7 +1639,7 @@ static int vsllink_tap_execute_normal(void) for (i = 0; i < pending_scan_results_length; i++) { pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[i]; - u8 *buffer = pending_scan_result->buffer; + uint8_t *buffer = pending_scan_result->buffer; int length = pending_scan_result->length; int offset = pending_scan_result->offset; scan_command_t *command = pending_scan_result->command; @@ -1712,7 +1712,7 @@ static int vsllink_tap_execute_dma(void) for (i = 0; i < pending_scan_results_length; i++) { pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[i]; - u8 *buffer = pending_scan_result->buffer; + uint8_t *buffer = pending_scan_result->buffer; int length = pending_scan_result->length; int first = pending_scan_result->offset; @@ -1910,7 +1910,7 @@ static int vsllink_usb_read(vsllink_jtag_t *vsllink_jtag) #define BYTES_PER_LINE 16 #if defined _DEBUG_USB_COMMS_ || defined _DEBUG_JTAG_IO_ -static void vsllink_debug_buffer(u8 *buffer, int length) +static void vsllink_debug_buffer(uint8_t *buffer, int length) { char line[81]; char s[4]; diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index daac0772..924a8bf9 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -424,7 +424,7 @@ static void shiftValueInnerFlip(const tap_state_t state, const tap_state_t endSt } #endif -extern int jtag_check_value(u8 *captured, void *priv); +extern int jtag_check_value(uint8_t *captured, void *priv); static __inline void scanFields(int num_fields, scan_field_t *fields, tap_state_t shiftState, tap_state_t end_state) { @@ -436,9 +436,9 @@ static __inline void scanFields(int num_fields, scan_field_t *fields, tap_state_ { cyg_uint32 value; - static u8 *in_buff=NULL; /* pointer to buffer for scanned data */ + static uint8_t *in_buff=NULL; /* pointer to buffer for scanned data */ static int in_buff_size=0; - u8 *inBuffer=NULL; + uint8_t *inBuffer=NULL; // figure out where to store the input data @@ -545,7 +545,7 @@ int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_s if (!found) { /* if a device isn't listed, set it to BYPASS */ - u8 ones[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; + uint8_t ones[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; scan_field_t tmp; memset(&tmp, 0, sizeof(tmp)); @@ -668,7 +668,7 @@ static int zy1000_jtag_add_clocks(int num_cycles, tap_state_t state, tap_state_t tap_state_t t=TAP_IDLE; /* test manual drive code on any target */ int tms; - u8 tms_scan = tap_get_tms_path(t, state); + uint8_t tms_scan = tap_get_tms_path(t, state); int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); for (i = 0; i < tms_count; i++) @@ -744,7 +744,7 @@ int interface_jtag_add_pathmove(int num_states, const tap_state_t *path) -void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little, int count) +void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, uint8_t *buffer, int little, int count) { // static int const reg_addr=0x5; tap_state_t end_state=jtag_get_end_state(); diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c index 6af83beb..57af0f18 100644 --- a/src/pld/virtex2.c +++ b/src/pld/virtex2.c @@ -66,7 +66,7 @@ static int virtex2_send_32(struct pld_device_s *pld_device, { virtex2_pld_device_t *virtex2_info = pld_device->driver_priv; scan_field_t scan_field; - u8 *values; + uint8_t *values; int i; values = malloc(num_words * 4); @@ -88,7 +88,7 @@ static int virtex2_send_32(struct pld_device_s *pld_device, return ERROR_OK; } -static __inline__ void virtexflip32(u8 *in) +static __inline__ void virtexflip32(uint8_t *in) { *((u32 *)in) = flip_u32(le_to_h_u32(in), 32); } @@ -108,11 +108,11 @@ static int virtex2_receive_32(struct pld_device_s *pld_device, while (num_words--) { - scan_field.in_value = (u8 *)words; + scan_field.in_value = (uint8_t *)words; jtag_add_dr_scan(1, &scan_field, jtag_set_end_state(TAP_DRPAUSE)); - jtag_add_callback(virtexflip32, (u8 *)words); + jtag_add_callback(virtexflip32, (uint8_t *)words); words++;; } diff --git a/src/pld/xilinx_bit.c b/src/pld/xilinx_bit.c index e647a9c5..5dacdac3 100644 --- a/src/pld/xilinx_bit.c +++ b/src/pld/xilinx_bit.c @@ -29,9 +29,9 @@ static int read_section(FILE *input_file, int length_size, char section, - u32 *buffer_length, u8 **buffer) + u32 *buffer_length, uint8_t **buffer) { - u8 length_buffer[4]; + uint8_t length_buffer[4]; int length; char section_char; int read_count; diff --git a/src/pld/xilinx_bit.h b/src/pld/xilinx_bit.h index 505957ab..6e002c46 100644 --- a/src/pld/xilinx_bit.h +++ b/src/pld/xilinx_bit.h @@ -24,13 +24,13 @@ typedef struct xilinx_bit_file_s { - u8 unknown_header[13]; - u8 *source_file; - u8 *part_name; - u8 *date; - u8 *time; + uint8_t unknown_header[13]; + uint8_t *source_file; + uint8_t *part_name; + uint8_t *date; + uint8_t *time; u32 length; - u8 *data; + uint8_t *data; } xilinx_bit_file_t; int xilinx_read_bit_file(xilinx_bit_file_t *bit_file, char *filename); diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 88c9ec88..3a7f7881 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -844,7 +844,7 @@ int gdb_connection_closed(connection_t *connection) return ERROR_OK; } -void gdb_send_error(connection_t *connection, u8 the_error) +void gdb_send_error(connection_t *connection, uint8_t the_error) { char err[4]; snprintf(err, 4, "E%2.2X", the_error ); @@ -885,7 +885,7 @@ void gdb_str_to_target(target_t *target, char *tstr, reg_t *reg) { int i; - u8 *buf; + uint8_t *buf; int buf_len; buf = reg->value; buf_len = CEIL(reg->size, 8); @@ -914,7 +914,7 @@ static int hextoint(char c) } /* copy over in register buffer */ -void gdb_target_to_reg(target_t *target, char *tstr, int str_len, u8 *bin) +void gdb_target_to_reg(target_t *target, char *tstr, int str_len, uint8_t *bin) { if (str_len % 2) { @@ -925,7 +925,7 @@ void gdb_target_to_reg(target_t *target, char *tstr, int str_len, u8 *bin) int i; for (i = 0; i < str_len; i+=2) { - u8 t = hextoint(tstr[i])<<4; + uint8_t t = hextoint(tstr[i])<<4; t |= hextoint(tstr[i+1]); int j = gdb_reg_pos(target, i/2, str_len/2); @@ -1013,7 +1013,7 @@ int gdb_set_registers_packet(connection_t *connection, target_t *target, char *p packet_p = packet; for (i = 0; i < reg_list_size; i++) { - u8 *bin_buf; + uint8_t *bin_buf; int chars = (CEIL(reg_list[i]->size, 8) * 2); if (packet_p + chars > packet + packet_size) @@ -1083,7 +1083,7 @@ int gdb_get_register_packet(connection_t *connection, target_t *target, char *pa int gdb_set_register_packet(connection_t *connection, target_t *target, char *packet, int packet_size) { char *separator; - u8 *bin_buf; + uint8_t *bin_buf; int reg_num = strtoul(packet + 1, &separator, 16); reg_t **reg_list; int reg_list_size; @@ -1166,7 +1166,7 @@ int gdb_read_memory_packet(connection_t *connection, target_t *target, char *pac u32 addr = 0; u32 len = 0; - u8 *buffer; + uint8_t *buffer; char *hex_buffer; int retval = ERROR_OK; @@ -1215,7 +1215,7 @@ int gdb_read_memory_packet(connection_t *connection, target_t *target, char *pac u32 i; for (i = 0; i < len; i++) { - u8 t = buffer[i]; + uint8_t t = buffer[i]; hex_buffer[2 * i] = DIGITS[(t >> 4) & 0xf]; hex_buffer[2 * i + 1] = DIGITS[t & 0xf]; } @@ -1240,7 +1240,7 @@ int gdb_write_memory_packet(connection_t *connection, target_t *target, char *pa u32 addr = 0; u32 len = 0; - u8 *buffer; + uint8_t *buffer; u32 i; int retval; @@ -1323,7 +1323,7 @@ int gdb_write_memory_binary_packet(connection_t *connection, target_t *target, c { LOG_DEBUG("addr: 0x%8.8x, len: 0x%8.8x", addr, len); - retval = target_write_buffer(target, addr, len, (u8*)separator); + retval = target_write_buffer(target, addr, len, (uint8_t*)separator); } if (retval == ERROR_OK) @@ -1918,7 +1918,7 @@ int gdb_v_packet(connection_t *connection, target_t *target, char *packet, int p } /* create new section with content from packet buffer */ - if((retval = image_add_section(gdb_connection->vflash_image, addr, length, 0x0, (u8*)parse)) != ERROR_OK) + if((retval = image_add_section(gdb_connection->vflash_image, addr, length, 0x0, (uint8_t*)parse)) != ERROR_OK) { return retval; } diff --git a/src/svf/svf.c b/src/svf/svf.c index 068a8730..609830fe 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -132,10 +132,10 @@ typedef struct { int len; int data_mask; - u8 *tdi; - u8 *tdo; - u8 *mask; - u8 *smask; + uint8_t *tdi; + uint8_t *tdo; + uint8_t *mask; + uint8_t *smask; }svf_xxr_para_t; typedef struct @@ -197,7 +197,7 @@ static int svf_check_tdo_para_index = 0; static int svf_read_command_from_file(int fd); static int svf_check_tdo(void); -static int svf_add_check_para(u8 enabled, int buffer_offset, int bit_len); +static int svf_add_check_para(uint8_t enabled, int buffer_offset, int bit_len); static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str); static int handle_svf_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); @@ -209,7 +209,7 @@ static int svf_line_number = 1; static jtag_tap_t *tap = NULL; #define SVF_MAX_BUFFER_SIZE_TO_COMMIT (4 * 1024) -static u8 *svf_tdi_buffer = NULL, *svf_tdo_buffer = NULL, *svf_mask_buffer = NULL; +static uint8_t *svf_tdi_buffer = NULL, *svf_tdo_buffer = NULL, *svf_mask_buffer = NULL; static int svf_buffer_index = 0, svf_buffer_size = 0; static int svf_quiet = 0; @@ -300,7 +300,7 @@ static const char* tap_state_svf_name(tap_state_t state) static int svf_add_statemove(tap_state_t state_to) { tap_state_t state_from = cmd_queue_cur_state; - u8 index; + uint8_t index; for (index = 0; index < dimof(svf_statemoves); index++) { @@ -390,21 +390,21 @@ static int handle_svf_command(struct command_context_s *cmd_ctx, char *cmd, char // in case current command cannot be commited, and next command is a bit scan command // here is 32K bits for this big scan command, it should be enough // buffer will be reallocated if buffer size is not enough - svf_tdi_buffer = (u8 *)malloc(2 * SVF_MAX_BUFFER_SIZE_TO_COMMIT); + svf_tdi_buffer = (uint8_t *)malloc(2 * SVF_MAX_BUFFER_SIZE_TO_COMMIT); if (NULL == svf_tdi_buffer) { LOG_ERROR("not enough memory"); ret = ERROR_FAIL; goto free_all; } - svf_tdo_buffer = (u8 *)malloc(2 * SVF_MAX_BUFFER_SIZE_TO_COMMIT); + svf_tdo_buffer = (uint8_t *)malloc(2 * SVF_MAX_BUFFER_SIZE_TO_COMMIT); if (NULL == svf_tdo_buffer) { LOG_ERROR("not enough memory"); ret = ERROR_FAIL; goto free_all; } - svf_mask_buffer = (u8 *)malloc(2 * SVF_MAX_BUFFER_SIZE_TO_COMMIT); + svf_mask_buffer = (uint8_t *)malloc(2 * SVF_MAX_BUFFER_SIZE_TO_COMMIT); if (NULL == svf_mask_buffer) { LOG_ERROR("not enough memory"); @@ -631,7 +631,7 @@ static int svf_find_string_in_array(char *str, char **strs, int num_of_element) return 0xFF; } -static int svf_adjust_array_length(u8 **arr, int orig_bit_len, int new_bit_len) +static int svf_adjust_array_length(uint8_t **arr, int orig_bit_len, int new_bit_len) { int new_byte_len = (new_bit_len + 7) >> 3; @@ -642,7 +642,7 @@ static int svf_adjust_array_length(u8 **arr, int orig_bit_len, int new_bit_len) free(*arr); *arr = NULL; } - *arr = (u8*)malloc(new_byte_len); + *arr = (uint8_t*)malloc(new_byte_len); if (NULL == *arr) { LOG_ERROR("not enough memory"); @@ -653,10 +653,10 @@ static int svf_adjust_array_length(u8 **arr, int orig_bit_len, int new_bit_len) return ERROR_OK; } -static int svf_copy_hexstring_to_binary(char *str, u8 **bin, int orig_bit_len, int bit_len) +static int svf_copy_hexstring_to_binary(char *str, uint8_t **bin, int orig_bit_len, int bit_len) { int i, str_len = strlen(str), str_byte_len = (bit_len + 3) >> 2, loop_cnt; - u8 ch, need_write = 1; + uint8_t ch, need_write = 1; if (ERROR_OK != svf_adjust_array_length(bin, orig_bit_len, bit_len)) { @@ -770,7 +770,7 @@ static int svf_check_tdo(void) return ERROR_OK; } -static int svf_add_check_para(u8 enabled, int buffer_offset, int bit_len) +static int svf_add_check_para(uint8_t enabled, int buffer_offset, int bit_len) { if (svf_check_tdo_para_index >= SVF_CHECK_TDO_PARA_SIZE) { @@ -816,7 +816,7 @@ static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str) float min_time, max_time; // for XXR svf_xxr_para_t *xxr_para_tmp; - u8 **pbuffer_tmp; + uint8_t **pbuffer_tmp; scan_field_t field; // for STATE tap_state_t *path = NULL, state; @@ -1011,10 +1011,10 @@ static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str) LOG_ERROR("buffer is not enough, report to author"); return ERROR_FAIL; #else - u8 *buffer_tmp; + uint8_t *buffer_tmp; // reallocate buffer - buffer_tmp = (u8 *)malloc(svf_buffer_index + ((i + 7) >> 3)); + buffer_tmp = (uint8_t *)malloc(svf_buffer_index + ((i + 7) >> 3)); if (NULL == buffer_tmp) { LOG_ERROR("not enough memory"); @@ -1025,7 +1025,7 @@ static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str) free(svf_tdi_buffer); svf_tdi_buffer = buffer_tmp; - buffer_tmp = (u8 *)malloc(svf_buffer_index + ((i + 7) >> 3)); + buffer_tmp = (uint8_t *)malloc(svf_buffer_index + ((i + 7) >> 3)); if (NULL == buffer_tmp) { LOG_ERROR("not enough memory"); @@ -1036,7 +1036,7 @@ static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str) free(svf_tdo_buffer); svf_tdo_buffer = buffer_tmp; - buffer_tmp = (u8 *)malloc(svf_buffer_index + ((i + 7) >> 3)); + buffer_tmp = (uint8_t *)malloc(svf_buffer_index + ((i + 7) >> 3)); if (NULL == buffer_tmp) { LOG_ERROR("not enough memory"); @@ -1106,10 +1106,10 @@ static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str) LOG_ERROR("buffer is not enough, report to author"); return ERROR_FAIL; #else - u8 *buffer_tmp; + uint8_t *buffer_tmp; // reallocate buffer - buffer_tmp = (u8 *)malloc(svf_buffer_index + ((i + 7) >> 3)); + buffer_tmp = (uint8_t *)malloc(svf_buffer_index + ((i + 7) >> 3)); if (NULL == buffer_tmp) { LOG_ERROR("not enough memory"); @@ -1120,7 +1120,7 @@ static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str) free(svf_tdi_buffer); svf_tdi_buffer = buffer_tmp; - buffer_tmp = (u8 *)malloc(svf_buffer_index + ((i + 7) >> 3)); + buffer_tmp = (uint8_t *)malloc(svf_buffer_index + ((i + 7) >> 3)); if (NULL == buffer_tmp) { LOG_ERROR("not enough memory"); @@ -1131,7 +1131,7 @@ static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str) free(svf_tdo_buffer); svf_tdo_buffer = buffer_tmp; - buffer_tmp = (u8 *)malloc(svf_buffer_index + ((i + 7) >> 3)); + buffer_tmp = (uint8_t *)malloc(svf_buffer_index + ((i + 7) >> 3)); if (NULL == buffer_tmp) { LOG_ERROR("not enough memory"); diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c index 4ede9fc9..bc1b72ef 100644 --- a/src/xsvf/xsvf.c +++ b/src/xsvf/xsvf.c @@ -169,7 +169,7 @@ int xsvf_register_commands(struct command_context_s *cmd_ctx) return ERROR_OK; } -static int xsvf_read_buffer(int num_bits, int fd, u8* buf) +static int xsvf_read_buffer(int num_bits, int fd, uint8_t* buf) { int num_bytes; @@ -186,9 +186,9 @@ static int xsvf_read_buffer(int num_bits, int fd, u8* buf) static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - u8 *dr_out_buf = NULL; /* from host to device (TDI) */ - u8 *dr_in_buf = NULL; /* from device to host (TDO) */ - u8 *dr_in_mask = NULL; + uint8_t *dr_out_buf = NULL; /* from host to device (TDI) */ + uint8_t *dr_in_buf = NULL; /* from device to host (TDO) */ + uint8_t *dr_in_mask = NULL; int xsdrsize = 0; int xruntest = 0; /* number of TCK cycles OR microseconds */ @@ -197,8 +197,8 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha tap_state_t xendir = TAP_IDLE; /* see page 8 of the SVF spec, initial xendir to be TAP_IDLE */ tap_state_t xenddr = TAP_IDLE; - u8 opcode; - u8 uc; + uint8_t opcode; + uint8_t uc; long file_offset = 0; int loop_count = 0; @@ -287,7 +287,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha case XRUNTEST: { - u8 xruntest_buf[4]; + uint8_t xruntest_buf[4]; if (read(xsvf_fd, xruntest_buf, 4) < 0) { @@ -302,7 +302,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha case XREPEAT: { - u8 myrepeat; + uint8_t myrepeat; if (read(xsvf_fd, &myrepeat, 1) < 0) do_abort = 1; @@ -316,7 +316,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha case XSDRSIZE: { - u8 xsdrsize_buf[4]; + uint8_t xsdrsize_buf[4]; if (read(xsvf_fd, xsdrsize_buf, 4) < 0) { @@ -488,7 +488,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha case XSTATE: { tap_state_t mystate; - u8 uc; + uint8_t uc; if (read(xsvf_fd, &uc, 1) < 0) { @@ -578,8 +578,8 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha case XSIR: case XSIR2: { - u8 short_buf[2]; - u8* ir_buf; + uint8_t short_buf[2]; + uint8_t* ir_buf; int bitcount; tap_state_t my_end_state = xruntest ? TAP_IDLE : xendir; @@ -678,12 +678,12 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha case XWAIT: { /* expected in stream: - XWAIT + XWAIT */ - u8 wait; - u8 end; - u8 delay_buf[4]; + uint8_t wait; + uint8_t end; + uint8_t delay_buf[4]; tap_state_t wait_state; tap_state_t end_state; @@ -719,13 +719,13 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha case XWAITSTATE: { /* expected in stream: - XWAITSTATE + XWAITSTATE */ - u8 clock_buf[4]; - u8 usecs_buf[4]; - u8 wait; - u8 end; + uint8_t clock_buf[4]; + uint8_t usecs_buf[4]; + uint8_t wait; + uint8_t end; tap_state_t wait_state; tap_state_t end_state; int clock_count; @@ -777,7 +777,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha /* expected in stream: LCOUNT */ - u8 count_buf[4]; + uint8_t count_buf[4]; if ( read(xsvf_fd, count_buf, 4) < 0 ) { @@ -793,11 +793,11 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha case LDELAY: { /* expected in stream: - LDELAY + LDELAY */ - u8 state; - u8 clock_buf[4]; - u8 usecs_buf[4]; + uint8_t state; + uint8_t clock_buf[4]; + uint8_t usecs_buf[4]; if ( read(xsvf_fd, &state, 1) < 0 || read(xsvf_fd, clock_buf, 4) < 0 @@ -882,7 +882,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha case XTRST: { - u8 trst_mode; + uint8_t trst_mode; if (read(xsvf_fd, &trst_mode, 1) < 0) { -- 2.39.5