Increases performance by a factor of two for long reads.
Change-Id: I81a7a83835058560c6a53a43c3cc991100f01766
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1954
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
/* YUK! - but this is currently a global.... */
extern struct jtag_interface *jtag_interface;
/* 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);
static int (swd_queue_dp_write)(struct adiv5_dap *dap, unsigned reg,
uint32_t data);
const struct swd_driver *swd = jtag_interface->swd;
assert(swd);
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;
retval = swd_queue_dp_bankselect(dap, reg);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK)
return retval;
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);
if (retval != ERROR_OK) {
/* fault response */
uint8_t ack = retval & 0xff;
swd_queue_ap_abort(dap, &ack);
/* REVISIT status return ... */
const struct swd_driver *swd = jtag_interface->swd;
assert(swd);
/* REVISIT status return ... */
const struct swd_driver *swd = jtag_interface->swd;
assert(swd);
- 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;
if (retval != ERROR_OK)
return retval;
{
/* for now the SWD interface hard-wires a zero-size queue. */
{
/* 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 ...
*/
/* FIXME but we still need to check and scrub
* any hardware errors ...
*/
}
const struct dap_ops swd_dap_ops = {
}
const struct dap_ops swd_dap_ops = {
*/
dap->ap_current = !0;
dap_ap_select(dap, 0);
*/
dap->ap_current = !0;
dap_ap_select(dap, 0);
/* information about current pending SWjDP-AHBAP transaction */
uint8_t ack;
/* information about current pending SWjDP-AHBAP transaction */
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).
/**
* Configures how many extra tck clocks are added after starting a
* MEM-AP access before we try to read its status (and/or result).
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)