diff options
author | Salvador Arroyo <sarroyofdez@yahoo.es> | 2017-02-20 22:19:15 +0100 |
---|---|---|
committer | Freddie Chopin <freddie.chopin@gmail.com> | 2017-04-24 23:06:54 +0100 |
commit | 832f5974f2b408a051b0f673ca64453deb960185 (patch) | |
tree | e20dcd35674aa5b5483a1ea3beb0ab5cb2ca037a /src | |
parent | 3fe99295117bbd0702aebe2fbd26b641a8ffbf72 (diff) | |
download | riscv-openocd-832f5974f2b408a051b0f673ca64453deb960185.zip riscv-openocd-832f5974f2b408a051b0f673ca64453deb960185.tar.gz riscv-openocd-832f5974f2b408a051b0f673ca64453deb960185.tar.bz2 |
mips32, pic32 use uint8_t in 8 bit scan function
Makes code shorter.
Change-Id: I6cc01adffbea063ccb071ddf3a3e3d81727b29ce
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/4004
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/flash/nor/pic32mx.c | 3 | ||||
-rw-r--r-- | src/target/mips_ejtag.c | 21 | ||||
-rw-r--r-- | src/target/mips_ejtag.h | 2 |
3 files changed, 9 insertions, 17 deletions
diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c index de212ed..1f148fd 100644 --- a/src/flash/nor/pic32mx.c +++ b/src/flash/nor/pic32mx.c @@ -879,7 +879,6 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command) COMMAND_HANDLER(pic32mx_handle_unlock_command) { - uint32_t mchip_cmd; struct target *target = NULL; struct mips_m4k_common *mips_m4k; struct mips_ejtag *ejtag_info; @@ -904,7 +903,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command) mips_ejtag_set_instr(ejtag_info, MTAP_COMMAND); /* first check status of device */ - mchip_cmd = MCHP_STATUS; + uint8_t mchip_cmd = MCHP_STATUS; mips_ejtag_drscan_8(ejtag_info, &mchip_cmd); if (mchip_cmd & (1 << 7)) { /* device is not locked */ diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c index 594711f..650af3e 100644 --- a/src/target/mips_ejtag.c +++ b/src/target/mips_ejtag.c @@ -169,31 +169,24 @@ void mips_ejtag_drscan_32_out(struct mips_ejtag *ejtag_info, uint32_t data) jtag_add_dr_scan(tap, 1, &field, TAP_IDLE); } -int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint32_t *data) +int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint8_t *data) { - struct jtag_tap *tap; - tap = ejtag_info->tap; - assert(tap != NULL); + assert(ejtag_info->tap != NULL); + struct jtag_tap *tap = ejtag_info->tap; struct scan_field field; - uint8_t t[4] = {0, 0, 0, 0}, r[4]; - int retval; - field.num_bits = 8; - field.out_value = t; - buf_set_u32(t, 0, field.num_bits, *data); - field.in_value = r; + + field.out_value = data; + field.in_value = data; jtag_add_dr_scan(tap, 1, &field, TAP_IDLE); - retval = jtag_execute_queue(); + int retval = jtag_execute_queue(); if (retval != ERROR_OK) { LOG_ERROR("register read failed"); return retval; } - - *data = buf_get_u32(field.in_value, 0, 32); - return ERROR_OK; } diff --git a/src/target/mips_ejtag.h b/src/target/mips_ejtag.h index 6ef0867..2178afc 100644 --- a/src/target/mips_ejtag.h +++ b/src/target/mips_ejtag.h @@ -220,7 +220,7 @@ void mips_ejtag_add_scan_96(struct mips_ejtag *ejtag_info, void mips_ejtag_drscan_32_out(struct mips_ejtag *ejtag_info, uint32_t data); int mips_ejtag_drscan_32(struct mips_ejtag *ejtag_info, uint32_t *data); void mips_ejtag_drscan_8_out(struct mips_ejtag *ejtag_info, uint8_t data); -int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint32_t *data); +int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint8_t *data); int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data); int mips_ejtag_init(struct mips_ejtag *ejtag_info); |