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
This commit is contained in:
Fatih Aşıcı
2014-02-14 13:37:04 +02:00
committed by Andreas Fritiofson
parent e3be699f51
commit 31138437c3
4 changed files with 121 additions and 20 deletions

View File

@@ -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()