summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomek CEDRO <cederom@tlen.pl>2011-06-25 06:09:17 +0200
committerTomek CEDRO <cederom@tlen.pl>2011-06-25 06:09:17 +0200
commitc225664e61681b78eda4f450adceee140d5ffec0 (patch)
tree5b654cdc91a65f0594b2f2c62a0fe1341723ea8c
parent1cfa4bfd3bbd1f92d68b5e3d9bb8e149952dd3d4 (diff)
downloadopenocd+libswd-c225664e61681b78eda4f450adceee140d5ffec0.tar.gz
openocd+libswd-c225664e61681b78eda4f450adceee140d5ffec0.tar.bz2
openocd+libswd-c225664e61681b78eda4f450adceee140d5ffec0.tar.xz
openocd+libswd-c225664e61681b78eda4f450adceee140d5ffec0.zip
FT2232/BITBANG: Added layout specific bitbang_deny paramater that will block bitbaning selected signals that could damage interface hardware.
-rw-r--r--src/jtag/drivers/ft2232.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c
index 7db7bdd2..c040b740 100644
--- a/src/jtag/drivers/ft2232.c
+++ b/src/jtag/drivers/ft2232.c
@@ -166,12 +166,20 @@ static unsigned ft2232_max_tck = FTDI_2232C_MAX_TCK;
static uint16_t ft2232_vid[MAX_USB_IDS + 1] = { 0x0403, 0 };
static uint16_t ft2232_pid[MAX_USB_IDS + 1] = { 0x6010, 0 };
+/** This structure describes different layout of FT2232 based devices. */
struct ft2232_layout {
+ /// Layout name
char* name;
+ /// Lyout specific initialization routine
int (*init)(void);
+ /// Layout specific reset routine
void (*reset)(int trst, int srst);
+ /// Layout specific LED blink routine
void (*blink)(void);
+ /// Which FTDI channel does this layout use
int channel;
+ /// This will forbid bitbanging selected port pins
+ int bitbang_deny;
};
/* init procedures for supported layouts */
@@ -645,6 +653,12 @@ int ft2232_bitbang(void *device, char *signal_name, int GETnSET, int *value){
// Pin mask is also related with port direction and complicates it!!!
sigmask=sig->mask;
+ // First check against restricted port pins defined by the interface layout
+ if (sigmask & layout->bitbang_deny){
+ LOG_ERROR("This interface does not allow to bit-bang selected pins (0x%08X)!", layout->bitbang_deny);
+ return ERROR_FAIL;
+ }
+
if (!GETnSET){
// We will SET port pins selected by sigmask.
// Modify our pins value, but remember about other pins and their previous value