From: David B. <dbr...@us...> - 2010-01-05 22:10:42
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via fccb812f829e55940e26466c4cda8c25765d4f6c (commit) via adf2a9a267422a2914a50b4a4a35a0e19b25d1c3 (commit) from 9d83df72dcbfc791b470b12949890df3f2d1508d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fccb812f829e55940e26466c4cda8c25765d4f6c Author: David Brownell <dbr...@us...> Date: Tue Jan 5 13:03:27 2010 -0800 ARM: add #defines for JTAG ack codes JTAG has only two possible JTAG ack codes for APACC and DPACC register reads/writes. Define them, and remove empty "else" clause in the code which now uses those codes. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 9f26064..96accf3 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -249,12 +249,14 @@ int swjdp_transaction_endcheck(struct swjdp_common *swjdp) swjdp->ack = swjdp->ack & 0x7; - if (swjdp->ack != 2) + /* common code path avoids calling timeval_ms() */ + if (swjdp->ack != JTAG_ACK_OK_FAULT) { long long then = timeval_ms(); - while (swjdp->ack != 2) + + while (swjdp->ack != JTAG_ACK_OK_FAULT) { - if (swjdp->ack == 1) + if (swjdp->ack == JTAG_ACK_WAIT) { if ((timeval_ms()-then) > 1000) { @@ -280,9 +282,6 @@ int swjdp_transaction_endcheck(struct swjdp_common *swjdp) return retval; swjdp->ack = swjdp->ack & 0x7; } - } else - { - /* common code path avoids fn to timeval_ms() */ } /* Check for STICKYERR and STICKYORUN */ diff --git a/src/target/arm_adi_v5.h b/src/target/arm_adi_v5.h index 4e1b1aa..675a173 100644 --- a/src/target/arm_adi_v5.h +++ b/src/target/arm_adi_v5.h @@ -38,6 +38,10 @@ #define JTAG_DP_APACC 0xB #define JTAG_DP_IDCODE 0xE +/* three-bit ACK values for DPACC and APACC reads */ +#define JTAG_ACK_OK_FAULT 0x2 +#define JTAG_ACK_WAIT 0x1 + #define DPAP_WRITE 0 #define DPAP_READ 1 commit adf2a9a267422a2914a50b4a4a35a0e19b25d1c3 Author: David Brownell <dbr...@us...> Date: Tue Jan 5 12:55:46 2010 -0800 ARM: add comments re DAP assumptions I think some of these assumptions are not well-founded. Related, that swjdp_transaction_endcheck() is a bit iffy. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 82a2a28..9f26064 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -195,8 +195,12 @@ static int scan_inout_check_u32(struct swjdp_common *swjdp, uint8_t instr, uint8_t reg_addr, uint8_t RnW, uint32_t outvalue, uint32_t *invalue) { + /* Issue the read or write */ adi_jtag_dp_scan_u32(swjdp, instr, reg_addr, RnW, outvalue, NULL, NULL); + /* For reads, collect posted value; RDBUFF has no other effect. + * Assumes read gets acked with OK/FAULT, and CTRL_STAT says "OK". + */ if ((RnW == DPAP_READ) && (invalue != NULL)) adi_jtag_dp_scan_u32(swjdp, JTAG_DP_DPACC, DP_RDBUFF, DPAP_READ, 0, invalue, &swjdp->ack); @@ -235,6 +239,9 @@ int swjdp_transaction_endcheck(struct swjdp_common *swjdp) /* Why??? second time it works??? */ #endif + /* Post CTRL/STAT read; discard any previous posted read value + * but collect its ACK status. + */ scan_inout_check_u32(swjdp, JTAG_DP_DPACC, DP_CTRL_STAT, DPAP_READ, 0, &ctrlstat); if ((retval = jtag_execute_queue()) != ERROR_OK) @@ -787,13 +794,18 @@ int mem_ap_read_buf_u32(struct swjdp_common *swjdp, uint8_t *buffer, int count, DPAP_READ, 0, NULL, NULL); for (readcount = 0; readcount < blocksize - 1; readcount++) { - /* Scan out read instruction and scan in previous value */ + /* Scan out next read; scan in posted value for the + * previous one. Assumes read is acked "OK/FAULT", + * and CTRL_STAT says that meant "OK". + */ adi_jtag_dp_scan(swjdp, JTAG_DP_APACC, AP_REG_DRW, DPAP_READ, 0, buffer + 4 * readcount, &swjdp->ack); } - /* Scan in last value */ + /* Scan in last posted value; RDBUFF has no other effect, + * assuming ack is OK/FAULT and CTRL_STAT says "OK". + */ adi_jtag_dp_scan(swjdp, JTAG_DP_DPACC, DP_RDBUFF, DPAP_READ, 0, buffer + 4 * readcount, &swjdp->ack); ----------------------------------------------------------------------- Summary of changes: src/target/arm_adi_v5.c | 27 +++++++++++++++++++-------- src/target/arm_adi_v5.h | 4 ++++ 2 files changed, 23 insertions(+), 8 deletions(-) hooks/post-receive -- Main OpenOCD repository |