X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Fmips_ejtag.c;h=449b6b828ede2b3e524a521f52da1b425608f726;hp=087be0766d686b4e9d31864931d1d55111905edd;hb=3a550e5b5fe011e526b150a5d234b48e8e2aaad6;hpb=378567da4e40a31efed349fbe68deebd14079b94 diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c index 087be0766d..449b6b828e 100644 --- a/src/target/mips_ejtag.c +++ b/src/target/mips_ejtag.c @@ -52,12 +52,13 @@ void mips_ejtag_set_instr(struct mips_ejtag *ejtag_info, int new_instr) int mips_ejtag_get_idcode(struct mips_ejtag *ejtag_info, uint32_t *idcode) { struct scan_field field; + uint8_t r[4]; mips_ejtag_set_instr(ejtag_info, EJTAG_INST_IDCODE); field.num_bits = 32; field.out_value = NULL; - field.in_value = (void*)idcode; + field.in_value = r; jtag_add_dr_scan(ejtag_info->tap, 1, &field, TAP_IDLE); @@ -67,18 +68,22 @@ int mips_ejtag_get_idcode(struct mips_ejtag *ejtag_info, uint32_t *idcode) LOG_ERROR("register read failed"); return retval; } + + *idcode = buf_get_u32(field.in_value, 0, 32); + return ERROR_OK; } static int mips_ejtag_get_impcode(struct mips_ejtag *ejtag_info, uint32_t *impcode) { struct scan_field field; + uint8_t r[4]; mips_ejtag_set_instr(ejtag_info, EJTAG_INST_IMPCODE); field.num_bits = 32; field.out_value = NULL; - field.in_value = (void*)impcode; + field.in_value = r; jtag_add_dr_scan(ejtag_info->tap, 1, &field, TAP_IDLE); @@ -88,6 +93,9 @@ static int mips_ejtag_get_impcode(struct mips_ejtag *ejtag_info, uint32_t *impco LOG_ERROR("register read failed"); return retval; } + + *impcode = buf_get_u32(field.in_value, 0, 32); + return ERROR_OK; } @@ -121,6 +129,24 @@ int mips_ejtag_drscan_32(struct mips_ejtag *ejtag_info, uint32_t *data) return ERROR_OK; } +void mips_ejtag_drscan_32_out(struct mips_ejtag *ejtag_info, uint32_t data) +{ + uint8_t t[4]; + struct jtag_tap *tap; + tap = ejtag_info->tap; + assert(tap != NULL); + + struct scan_field field; + + field.num_bits = 32; + field.out_value = t; + buf_set_u32(t, 0, field.num_bits, data); + + field.in_value = NULL; + + jtag_add_dr_scan(tap, 1, &field, TAP_IDLE); +} + int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint32_t *data) { struct jtag_tap *tap; @@ -316,6 +342,7 @@ int mips_ejtag_init(struct mips_ejtag *ejtag_info) int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data) { struct jtag_tap *tap; + tap = ejtag_info->tap; assert(tap != NULL); @@ -339,10 +366,15 @@ int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_ } else { - fields[1].in_value = (uint8_t *) data; + fields[1].in_value = (void *) data; } jtag_add_dr_scan(tap, 2, fields, TAP_IDLE); + + if ( (!write_t) && (data) ) + jtag_add_callback(mips_le_to_h_u32, + (jtag_callback_data_t) data); + keep_alive(); return ERROR_OK;