From 71f9339384b39e1f603dd26f490e8aba5d7628e6 Mon Sep 17 00:00:00 2001 From: Tomek CEDRO Date: Thu, 23 Jun 2011 02:54:38 +0200 Subject: FT2232: Added test implementation for transfer() function transfering bits in/out of the char array from/to the interface pins. --- src/jtag/drivers/ft2232.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src') diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c index d16d4d6a..7db7bdd2 100644 --- a/src/jtag/drivers/ft2232.c +++ b/src/jtag/drivers/ft2232.c @@ -694,6 +694,39 @@ int ft2232_bitbang(void *device, char *signal_name, int GETnSET, int *value){ } +/** Transfer bits in/out stored in char array starting from LSB/[0], + * if you want to make MSB-first shift put data in reverse order into array. + * \param *device void pointer to pass driver details to the function. + * \param bits is the number of bits (char array elements) to transfer. + * \param *mosidata pointer to char array with data to be send. + * \param *misodata pointer to char array with data to be received. + * \return number of bits sent on success, or ERROR_FAIL on failure. + */ +int ft2232_transfer(void *device, int bits, char *mosidata, char *misodata){ + uint8_t buf[3]; + int retval, bit; + uint32_t bytes_written, bytes_read; + + //No optimization for now, simply send one bit from one char element. + for (bit=0;bit