Your browser does not allow scripts
Please click here to view a static table of contents without scripts
JTAG_WriteRead
Return to Introduction  Previous page  Next page
Write data from the FT2232C to an external device and then read data from an external device to the FT2232C using the JTAG protocol.

FTC_STATUS
JTAG_WriteRead
(FTC_HANDLE ftHandle, BOOL bInstructionTestData, DWORD dwNumBitsToWriteRead, PWriteDataByteBuffer pWriteDataBuffer, DWORD dwNumBytesToWrite, PReadDataByteBuffer pReadDataBuffer, LPDWORD lpdwNumBytesReturned, DWORD dwTapControllerState)




Parameters
ftHandle
Handle of the device.
bInstructionTestData
Selects the instruction register (TRUE) or the test register (FALSE) to write data to.
dwNumBitsToWriteRead
Number of bits to be written to and read from an external device. Valid range is 2 to 524280.
pWriteDataBuffer
Pointer to buffer that contains the data to be written to the external device.
dwNumBytesToWrite
Number of bytes in the write data buffer which contains all the specified bits to be written to the external device. Valid range is 1 to 65535 bytes.
pReadDataBuffer
Pointer to buffer that returns the data read from the external device. Size of buffer should be set to 65535.
lpdwNumBytesReturned
Pointer to the actual number of bytes read from the external device.
dwTapControllerState
State that the Test Access Port (TAP) controller will be left in.




Return Value
FTC_SUCCESS if successful, otherwise the return value is one of the following FTC error codes:

   FTC_INVALID_HANDLE
   FTC_INVALID_NUMBER_BITS
   FTC_NULL_WRITE_DATA_BUFFER_POINTER
   FTC_INVALID_NUMBER_BYTES
   FTC_NUMBER_BYTES_TOO_SMALL
   FTC_NULL_READ_DATA_BUFFER_POINTER
   FTC_INVALID_TAP_CONTROLLER_STATE
   FTC_
FAILED_TO_COMPLETE_COMMAND
   FTC_IO_ERROR



Remarks
This function will write data from the FT2232C to an external device using the JTAG protocol. It will then read data back from the external device to the FT2232C using the JTAG protocol. The data will be clocked at a rate specified by the clock divisor set by calling either the JTAG_InitDevice or JTAG_SetClock functions.

The write data byte buffer definition, read data byte buffer definition and valid TAP controller states are given in the
Appendix.



Example

FTC_STATUS Status = FTC_SUCCESS;
FTC_HANDLE ftHandle;
WriteDataByteBuffer WriteDataBuffer;
ReadDataByteBuffer ReadDataBuffer;
DWORD dwNumBytesReturned = 0;

// Add values to write buffer
WriteDataBuffer[0] = '\x00';
WriteDataBuffer[1] = '\x00';
WriteDataBuffer[2] = '\x00';
WriteDataBuffer[3] = '\x00';

// Write buffer to device and read data back
Status = JTAG_WriteRead(ftHandle, true, 524280, &WriteDataBuffer, 65535, &ReadDataBuffer, &dwNumBytesReturned, RUN_TEST_IDLE_STATE);