jtagtap: Added support for configurable TAP idle cycles ready for RISC-V support
This commit is contained in:
parent
0f0435a7c1
commit
02b979d382
|
@ -50,6 +50,13 @@ typedef struct jtag_proc_s {
|
|||
void (*jtagtap_tdi_tdo_seq)(uint8_t *data_out, const bool final_tms, const uint8_t *data_in, size_t clock_cycles);
|
||||
void (*jtagtap_tdi_seq)(const bool final_tms, const uint8_t *data_in, size_t clock_cycles);
|
||||
void (*jtagtap_cycle)(const bool tms, const bool tdi, const size_t clock_cycles);
|
||||
|
||||
/*
|
||||
* Some debug controllers such as the RISC-V debug controller use idle
|
||||
* cycles during operations as part of their function, while others
|
||||
* allow the desirable skipping of the entire state under some circumstances.
|
||||
*/
|
||||
uint8_t tap_idle_cycles;
|
||||
} jtag_proc_t;
|
||||
|
||||
extern jtag_proc_t jtag_proc;
|
||||
|
@ -64,7 +71,7 @@ extern jtag_proc_t jtag_proc;
|
|||
#define jtagtap_shift_dr() jtag_proc.jtagtap_tms_seq(0x01, 3)
|
||||
|
||||
/* Goto Run-test/Idle: 1, 1, 0 */
|
||||
#define jtagtap_return_idle() jtag_proc.jtagtap_tms_seq(0x01, 2)
|
||||
#define jtagtap_return_idle(cycles) jtag_proc.jtagtap_tms_seq(0x01, (cycles) + 1U)
|
||||
|
||||
#if PC_HOSTED == 1
|
||||
int platform_jtagtap_init(void);
|
||||
|
|
|
@ -45,6 +45,7 @@ int jtagtap_init()
|
|||
jtag_proc.jtagtap_tdi_tdo_seq = jtagtap_tdi_tdo_seq;
|
||||
jtag_proc.jtagtap_tdi_seq = jtagtap_tdi_seq;
|
||||
jtag_proc.jtagtap_cycle = jtagtap_cycle;
|
||||
jtag_proc.tap_idle_cycles = 1;
|
||||
|
||||
/* Go to JTAG mode for SWJ-DP */
|
||||
for (size_t i = 0; i <= 50U; ++i)
|
||||
|
|
|
@ -146,7 +146,7 @@ int jtag_scan(const uint8_t *irlens)
|
|||
|
||||
DEBUG_INFO("Return to Run-Test/Idle\n");
|
||||
jtag_proc.jtagtap_next(1, 1);
|
||||
jtagtap_return_idle();
|
||||
jtagtap_return_idle(1);
|
||||
|
||||
/* All devices should be in BYPASS now */
|
||||
|
||||
|
@ -165,7 +165,7 @@ int jtag_scan(const uint8_t *irlens)
|
|||
|
||||
DEBUG_INFO("Return to Run-Test/Idle\n");
|
||||
jtag_proc.jtagtap_next(1, 1);
|
||||
jtagtap_return_idle();
|
||||
jtagtap_return_idle(1);
|
||||
if(!jtag_dev_count) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ int jtag_scan(const uint8_t *irlens)
|
|||
}
|
||||
DEBUG_INFO("Return to Run-Test/Idle\n");
|
||||
jtag_proc.jtagtap_next(1, 1);
|
||||
jtagtap_return_idle();
|
||||
jtagtap_return_idle(jtag_proc.tap_idle_cycles);
|
||||
#if PC_HOSTED == 1
|
||||
/*Transfer needed device information to firmware jtag_devs*/
|
||||
for(i = 0; i < jtag_dev_count; i++)
|
||||
|
@ -235,7 +235,7 @@ void jtag_dev_write_ir(jtag_proc_t *jp, uint8_t jd_index, uint32_t ir)
|
|||
jp->jtagtap_tdi_seq(0, ones, d->ir_prescan);
|
||||
jp->jtagtap_tdi_seq(d->ir_postscan?0:1, (void*)&ir, d->ir_len);
|
||||
jp->jtagtap_tdi_seq(1, ones, d->ir_postscan);
|
||||
jtagtap_return_idle();
|
||||
jtagtap_return_idle(1);
|
||||
}
|
||||
|
||||
void jtag_dev_shift_dr(jtag_proc_t *jp, uint8_t jd_index, uint8_t *dout, const uint8_t *din, int ticks)
|
||||
|
@ -248,6 +248,5 @@ void jtag_dev_shift_dr(jtag_proc_t *jp, uint8_t jd_index, uint8_t *dout, const u
|
|||
else
|
||||
jp->jtagtap_tdi_seq(d->dr_postscan?0:1, (void*)din, ticks);
|
||||
jp->jtagtap_tdi_seq(1, ones, d->dr_postscan);
|
||||
jtagtap_return_idle();
|
||||
jtagtap_return_idle(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue