From bc4f1620779fb64fe5a9bedeefcd9513770473b7 Mon Sep 17 00:00:00 2001 From: Tomek CEDRO Date: Wed, 2 Nov 2011 03:46:25 +0000 Subject: driver/ft2232: Added raw-wire level debug of data read/written by ft2232. This might help debug bugs in drivers ;-) --- src/jtag/drivers/ft2232.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c index df5c5e35..4d417899 100644 --- a/src/jtag/drivers/ft2232.c +++ b/src/jtag/drivers/ft2232.c @@ -729,6 +729,9 @@ int ft2232_transfer(void *device, int bits, char *mosidata, char *misodata, int int retval, bit, i; uint32_t bytes_written, bytes_read; + LOG_DEBUG("ft2232_transfer(device=@%p, bits=%d, mosidata=@%p, misodata=@%p, nLSDfirst=%d) ",\ + (void*)device, bits, (void*)mosidata, (void*)misodata, nLSBfirst); + //No optimization for now, simply send one bit from one char element. for (bit=0;bit Date: Wed, 2 Nov 2011 03:48:31 +0000 Subject: transport/swd_drv: Fixed critical issue with bitswapping of transmitted data. ACK and DATA packets are always transmitted LSb-First, no matter how ARM draws its fuckin timing diagrams! --- src/transport/swd_libswd_drv_openocd.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/transport/swd_libswd_drv_openocd.c b/src/transport/swd_libswd_drv_openocd.c index acc8830c..49a1f946 100644 --- a/src/transport/swd_libswd_drv_openocd.c +++ b/src/transport/swd_libswd_drv_openocd.c @@ -62,7 +62,7 @@ int swd_drv_mosi_8(swd_ctx_t *swdctx, swd_cmd_t *cmd, char *data, int bits, int static char misodata[8], mosidata[8]; /* Split output data into char array. */ - for (i=0;i<8;i++) mosidata[(nLSBfirst==SWD_DIR_LSBFIRST)?(i):(7-i)]=((1<transfer(NULL, bits, mosidata, misodata, 0); if (res<0) return SWD_ERROR_DRIVER; @@ -91,7 +91,7 @@ int swd_drv_mosi_32(swd_ctx_t *swdctx, swd_cmd_t *cmd, int *data, int bits, int static char misodata[32], mosidata[32]; //UrJTAG drivers shift data LSB-First. - for (i=0;i<32;i++) mosidata[(nLSBfirst==SWD_DIR_LSBFIRST)?(i):(31-i)]=((1<transfer(NULL, bits, mosidata, misodata, 0); if (res<0) return SWD_ERROR_DRIVER; return i; @@ -116,12 +116,11 @@ int swd_drv_miso_8(swd_ctx_t *swdctx, swd_cmd_t *cmd, char *data, int bits, int static signed int res; static char misodata[8], mosidata[8]; - // This function sends and reveice MSb-first. - res=jtag_interface->transfer(NULL, bits, mosidata, misodata, 0); + res=jtag_interface->transfer(NULL, bits, mosidata, misodata, SWD_DIR_LSBFIRST); if (res<0) return SWD_ERROR_DRIVER; /* Now we need to reconstruct the data byte from shifted in LSBfirst byte array. */ *data=0; - for (i=0;itransfer(NULL, bits, mosidata, misodata, 0); + res=jtag_interface->transfer(NULL, bits, mosidata, misodata, SWD_DIR_LSBFIRST); if (res<0) return SWD_ERROR_DRIVER; /* Now we need to reconstruct the data byte from shifted in LSBfirst byte array. */ *data=0; - for (i=0;i Date: Wed, 2 Nov 2011 23:49:27 +0000 Subject: Fixed bad SWD_ACK values definitions. --- src/target/arm_adi_v5.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/target/arm_adi_v5.h b/src/target/arm_adi_v5.h index c190c433..19ea0acf 100644 --- a/src/target/arm_adi_v5.h +++ b/src/target/arm_adi_v5.h @@ -41,9 +41,9 @@ #define JTAG_DP_APACC 0xB /* three-bit ACK values for SWD access (sent LSB first) */ -#define SWD_ACK_OK 0x4 +#define SWD_ACK_OK 0x1 #define SWD_ACK_WAIT 0x2 -#define SWD_ACK_FAULT 0x1 +#define SWD_ACK_FAULT 0x4 #define DPAP_WRITE 0 #define DPAP_READ 1 -- cgit v1.2.3