This is an automated email from Gerrit. Andreas Fritiofson ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/1954
-- gerrit commit 451cfd526bb9ddaa62d04fc4e5fc04332e54dfa7 Author: Andreas Fritiofson <[email protected]> Date: Sun Feb 16 09:29:01 2014 +0100 adi_v5_swd: Read RDBUFF once after a sequence of AP reads Increases performance by a factor of two for long reads. Change-Id: I81a7a83835058560c6a53a43c3cc991100f01766 Signed-off-by: Andreas Fritiofson <[email protected]> diff --git a/src/target/adi_v5_swd.c b/src/target/adi_v5_swd.c index 52b524e..a94034d 100644 --- a/src/target/adi_v5_swd.c +++ b/src/target/adi_v5_swd.c @@ -58,6 +58,17 @@ /* YUK! - but this is currently a global.... */ extern struct jtag_interface *jtag_interface; +static int swd_finish_read(struct adiv5_dap *dap) +{ + const struct swd_driver *swd = jtag_interface->swd; + int retval = ERROR_OK; + if (dap->last_read != NULL) { + retval = swd->read_reg(swd_cmd(true, false, DP_RDBUFF), dap->last_read); + dap->last_read = NULL; + } + return retval; +} + static int (swd_queue_dp_write)(struct adiv5_dap *dap, unsigned reg, uint32_t data); @@ -129,6 +140,10 @@ static int (swd_queue_dp_write)(struct adiv5_dap *dap, unsigned reg, const struct swd_driver *swd = jtag_interface->swd; assert(swd); + retval = swd_finish_read(dap); + if (retval != ERROR_OK) + return retval; + retval = swd_queue_dp_bankselect(dap, reg); if (retval != ERROR_OK) return retval; @@ -169,12 +184,14 @@ static int (swd_queue_ap_read)(struct adiv5_dap *dap, unsigned reg, if (retval != ERROR_OK) return retval; - retval = swd->read_reg(swd_cmd(true, true, reg), data); + retval = swd->read_reg(swd_cmd(true, true, reg), dap->last_read); + dap->last_read = data; if (retval != ERROR_OK) { /* fault response */ uint8_t ack = retval & 0xff; swd_queue_ap_abort(dap, &ack); + return retval; } return retval; @@ -186,8 +203,13 @@ static int (swd_queue_ap_write)(struct adiv5_dap *dap, unsigned reg, /* REVISIT status return ... */ const struct swd_driver *swd = jtag_interface->swd; assert(swd); + int retval; - int retval = swd_queue_ap_bankselect(dap, reg); + retval = swd_finish_read(dap); + if (retval != ERROR_OK) + return retval; + + retval = swd_queue_ap_bankselect(dap, reg); if (retval != ERROR_OK) return retval; @@ -207,10 +229,12 @@ static int swd_run(struct adiv5_dap *dap) { /* for now the SWD interface hard-wires a zero-size queue. */ + int retval = swd_finish_read(dap); + /* FIXME but we still need to check and scrub * any hardware errors ... */ - return ERROR_OK; + return retval; } const struct dap_ops swd_dap_ops = { diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index b997143..9b44d11 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -778,6 +778,7 @@ int ahbap_debugport_init(struct adiv5_dap *dap) */ dap->ap_current = !0; dap_ap_select(dap, 0); + dap->last_read = NULL; /* DP initialization */ diff --git a/src/target/arm_adi_v5.h b/src/target/arm_adi_v5.h index f406c21..ad156bd 100644 --- a/src/target/arm_adi_v5.h +++ b/src/target/arm_adi_v5.h @@ -188,6 +188,12 @@ struct adiv5_dap { uint8_t ack; /** + * Holds the pointer to the destination word for the last queued read, + * for use with posted AP read sequence optimization. + */ + uint32_t *last_read; + + /** * Configures how many extra tck clocks are added after starting a * MEM-AP access before we try to read its status (and/or result). */ -- ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
