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>
gitignore-build
Salvador Arroyo 2017-02-20 22:19:15 +01:00 committed by Freddie Chopin
parent 3fe9929511
commit 832f5974f2
3 changed files with 9 additions and 17 deletions

View File

@ -879,7 +879,6 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command)
COMMAND_HANDLER(pic32mx_handle_unlock_command) COMMAND_HANDLER(pic32mx_handle_unlock_command)
{ {
uint32_t mchip_cmd;
struct target *target = NULL; struct target *target = NULL;
struct mips_m4k_common *mips_m4k; struct mips_m4k_common *mips_m4k;
struct mips_ejtag *ejtag_info; struct mips_ejtag *ejtag_info;
@ -904,7 +903,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
mips_ejtag_set_instr(ejtag_info, MTAP_COMMAND); mips_ejtag_set_instr(ejtag_info, MTAP_COMMAND);
/* first check status of device */ /* first check status of device */
mchip_cmd = MCHP_STATUS; uint8_t mchip_cmd = MCHP_STATUS;
mips_ejtag_drscan_8(ejtag_info, &mchip_cmd); mips_ejtag_drscan_8(ejtag_info, &mchip_cmd);
if (mchip_cmd & (1 << 7)) { if (mchip_cmd & (1 << 7)) {
/* device is not locked */ /* device is not locked */

View File

@ -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); 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; assert(ejtag_info->tap != NULL);
tap = ejtag_info->tap; struct jtag_tap *tap = ejtag_info->tap;
assert(tap != NULL);
struct scan_field field; struct scan_field field;
uint8_t t[4] = {0, 0, 0, 0}, r[4];
int retval;
field.num_bits = 8; field.num_bits = 8;
field.out_value = t;
buf_set_u32(t, 0, field.num_bits, *data); field.out_value = data;
field.in_value = r; field.in_value = data;
jtag_add_dr_scan(tap, 1, &field, TAP_IDLE); jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
retval = jtag_execute_queue(); int retval = jtag_execute_queue();
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
LOG_ERROR("register read failed"); LOG_ERROR("register read failed");
return retval; return retval;
} }
*data = buf_get_u32(field.in_value, 0, 32);
return ERROR_OK; return ERROR_OK;
} }

View File

@ -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); 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); 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); 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_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data);
int mips_ejtag_init(struct mips_ejtag *ejtag_info); int mips_ejtag_init(struct mips_ejtag *ejtag_info);