diff options
author | Fatih Aşıcı <fatih.asici@gmail.com> | 2014-02-14 13:37:04 +0200 |
---|---|---|
committer | Andreas Fritiofson <andreas.fritiofson@gmail.com> | 2014-06-28 09:25:06 +0000 |
commit | 31138437c38348711a1890f9d39f73f4e5e989d5 (patch) | |
tree | 8ae563f96f1c03d247d9cf560a93a951c6d7f935 /src/jtag/swd.h | |
parent | e3be699f51f11e54f8478e65367b90e3283eaf69 (diff) | |
download | riscv-openocd-31138437c38348711a1890f9d39f73f4e5e989d5.zip riscv-openocd-31138437c38348711a1890f9d39f73f4e5e989d5.tar.gz riscv-openocd-31138437c38348711a1890f9d39f73f4e5e989d5.tar.bz2 |
adi_v5_swd: Improve SWD support
Fix bug in parity calculation macro.
Cache and update the selected DP bank when necessary.
Add aborts when the Ack code signals a failure (we should really only
clear the sticky bits, but this will do for now).
Change-Id: I38a4da136ba1d9e989b33c1875a80c0b1b2be874
Signed-off-by: Fatih Aşıcı <fatih.asici@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1950
Tested-by: jenkins
Diffstat (limited to 'src/jtag/swd.h')
-rw-r--r-- | src/jtag/swd.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/jtag/swd.h b/src/jtag/swd.h index f131ddb..fee7f91 100644 --- a/src/jtag/swd.h +++ b/src/jtag/swd.h @@ -33,7 +33,7 @@ /* followed by TRN, 3-bits of ACK, TRN */ /* pbit16 holds precomputed parity bits for each nibble */ -#define pbit(parity, nibble) (parity << nibble) +#define pbit(parity, nibble) ((parity) << (nibble)) static const uint16_t pbit16 = pbit(0, 0) | pbit(1, 1) | pbit(1, 2) | pbit(0, 3) @@ -41,7 +41,7 @@ static const uint16_t pbit16 = | pbit(1, 8) | pbit(0, 9) | pbit(0, 0xa) | pbit(1, 0xb) | pbit(0, 0xc) | pbit(1, 0xd) | pbit(1, 0xe) | pbit(0, 0xf); -#define nibble_parity(nibble) (pbit16 & pbit(1, nibble)) +#define nibble_parity(nibble) (pbit16 & pbit(1, (nibble))) /** * Construct a "cmd" byte, in lSB bit order, which swd_driver.read_reg() |