GET_JTAG_CHAINS
The GET_JTAG_CHAINS function returns STRING device references for every JTAG device currently available on every JTAG chain. When run from a test of a dynamic chains project it will return all JTAG devices associated with the profile of that test. In a subchain reset sequence it will return just those that make up the subchain. When run in a non-dynamic project it will always return all JTAG devices defined in the project.
Syntax
GET_JTAG_CHAINS( )
Return value
Returns an array of STRING arrays ( STRING[][] ). For every JTAG chain available to the current hardware (for example 4 for the XJLink2, 8 for the XJLink2-PF40) a STRING[] is returned that contains a STRING device reference for every JTAG device currently in that chain.
Examples using an XJLink2 (that supports up to 4 JTAG chains) and the XJDemo board
Printing the JTAG devices using FOREACH loops when running inside the 'All chains' profile:
LOCAL PrintJtagDevices()() STRING[][] jtagChains := GET_JTAG_CHAINS(); FOREACH STRING[] chain IN jtagChains FOREACH STRING deviceRef IN chain PRINT(deviceRef, "\n"); END; END; END;
Output
U1 U2
Printing the contents of every chain array returned:
LOCAL PrintAllJtagChains()() INT chainNumber := 1; STRING[][] jtagChains := GET_JTAG_CHAINS(); FOREACH STRING[] chain IN jtagChains PRINT("Chain ", chainNumber, ". JTAG device count: ", WIDTHOF(chain), ". JTAG device references: "); FOREACH STRING deviceRef IN chain PRINT(deviceRef, ", "); END; PRINT("\n"); chainNumber := chainNumber + 1; END; END;
Output
Chain 1. JTAG device count: 1. JTAG device references: U1, Chain 2. JTAG device count: 1. JTAG device references: U2, Chain 3. JTAG device count: 0. JTAG device references: Chain 4. JTAG device count: 0. JTAG device references:
JTAG device references returned by GET_JTAG_CHAINS are always unique and guaranteed to work with built-in functions that take JTAG or non-JTAG device references.
The indexes of JTAG chains and the indexes of JTAG device references within those chains are off-by-one when compared to the values used by GET_JTAG_DEVICE and GET_JTAG_DEVICE_COUNT. This is because GET_JTAG_DEVICE and GET_JTAG_DEVICE_COUNT use 1-based positions whereas GET_JTAG_CHAINS uses 0-based arrays.
See also
XJTAG v4.2.0
