XJAPI_ScanMultiple
Execute multiple JTAG scan cycles.
XJAPI_ERROR XJAPI_ScanMultiple( unsigned int nScans, XJAPI_SCAN_TYPE * scanTypes, unsigned int * length, unsigned int ** tdiData, unsigned int ** tdoData );
Arguments
- nScans
- The number of scans to perform.
- scanTypes
- An array of XJAPI_SCAN_TYPE of size nScans.
- length
- An array of size nScans specifying the length of each of the scans.
- tdiData
- An array of size nScans of arrays of words of data representing each of the chains to send from the host to the chain. The data is packed into 32 bit words, with the least-significant bit of the first word clocked into the chain first.
- tdoData
- An array of size nScans of arrays of words to receive the data back to the host from the JTAG chain. The data is packed into 32 bit words, with the first bit out of the chain in the least-significant bit of the first word.
Return value
An XJAPI_ERROR value indicating whether the function call was successful or not.
Notes
This function allows several chains to be sent in one go. This is more efficient than repeatedly calling XJAPI_Scan because the system does not wait for the previous chain to be returned before processing the next.
Each of the four arrays must have nScans items in it. For XJAPI_SCAN_IR and XJAPI_SCAN_DR scans, the tdiData buffer must be specified, but the tdoData buffer can be left as NULL if the data is not required. For XJAPI_SCAN_CLOCK scans, the length value is ignored. Instead the tdiData buffer must be 4 bytes in size and contain the number of times to toggle TCK and the tdoData buffer left as NULL.
This function can only be used once the hardware has been initialised with XJAPI_HardwareSetup.
Example
// Send an Instruction Register and a Data Register scan XJAPI_ERROR ec; XJAPI_SCAN_TYPE types[2]; unsigned int lengths[2]; unsigned int *buffersOut[2]; unsigned int *buffersIn[2]; // First scan is an Instruction Register scan types[0] = XJAPI_SCAN_IR; // Instruction Register length is 18 lengths[0] = 18; // Allocate buffers big enough for the Instruction Register length buffersOut[0] = malloc((lengths[0] + 31) / 32 * 4); buffersIn[0] = malloc((lengths[0] + 31) / 32 * 4); // Set up Instruction Register data ... // Second scan is a Data Register scan types[1] = XJAPI_SCAN_DR; // Data Register length is 208 lengths[1] = 208; // Allocate buffers big enough for the Data Register length buffersOut[1] = malloc((lengths[1] + 31) / 32 * 4); buffersIn[1] = malloc((lengths[1] + 31) / 32 * 4); // Set up Data Register data ... // Send the two chains ec = XJAPI_ScanMultiple(2, types, lengths, buffersOut, buffersIn); if (ec != XJAPI_SUCCESS) { // handle the error ... }
XJTAG v4.1.100