Visible to Intel only — GUID: sam1408411227468
Ixiasoft
1.1. Jam™ STAPL Players
1.2. Jam™ STAPL Files
1.3. Using the Jam™ STAPL Player
1.4. Using the quartus_jli Command-Line Executable
1.5. Using Jam™ STAPL for ISP with an Embedded Processor
1.6. Board Layout
1.7. Embedded Jam™ STAPL Players
1.8. Updating Devices Using Jam
1.9. Document Revision History for AN 425: Using the Command-Line Jam™ STAPL Solution for Device Programming
1.7.2.1. Step 1: Set the Preprocessor Statements to Exclude Extraneous Code
1.7.2.2. Step 2: Map the JTAG Signals to the Hardware Pins
PC Parallel Port Signal Mapping Sample Source Code for jbi_jtag_io()
1.7.2.3. Step 3: Handle Text Messages from jbi_export()
1.7.2.4. Step 4: Customize Delay Calibration
Visible to Intel only — GUID: sam1408411227468
Ixiasoft
1.7.2.2. Step 2: Map the JTAG Signals to the Hardware Pins
The jbi_jtag_io() function in jbistub.c contains the code that sends and receives the binary programming data. By default, the source code writes to the parallel port of the PC. You must remap all four JTAG signals to the pins of the embedded processor.
Figure 11. Default PC Parallel Port Signal MappingThis figure shows the jbi_jtag_io() signal mapping of the JTAG pins to the parallel port registers of the PC. The PC parallel port hardware inverts the most significant bit: TDO.
PC Parallel Port Signal Mapping Sample Source Code for jbi_jtag_io()
int jbi_jtag_io(int tms, int tdi, int read_tdo) { int data = 0; int tdo = 0; if (!jtag_hardware_initialized) { initialize_jtag_hardware(); jtag_hardware_initialized = TRUE; } data = ((tdi ? 0x40 : 0) | (tms ? 0x2 : 0)); /*TDI,TMS*/ write_byteblaster(0, data); if (read_tdo) { tdo = (read_byteblaster(1) & 0x80) ? 0 : 1; /*TDO*/ } write_blaster(0, data | 0x01); /*TCK*/ write_blaster(0, data); return (tdo); }
- The PC parallel port inverts the actual value of TDO. Because of this, the jbi_jtag_io() function in the preceding code inverts the value again to retrieve the original data in the following line:
tdo = (read_byteblaster(1) & 0x80) ? 0 : 1;
- If your target processor does not invert TDO, use the following code:
tdo = (read_byteblaster(1) & 0x80) ? 1 : 0;
- To map the signals to the correct addresses, use the left shift (<<) or right shift (>>) operator. For example, if TMS and TDI are at ports 2 and 3, respectively, use this code:
data = (((tdi ? 0x40 : 0) >> 3) | ((tms ? 0x02 : 0) << 1));
- Apply the same process to TCK and TDO.
The read_byteblaster and write_byteblaster signals use the inp() and outp() functions from the conio.h library, respectively, to read and write to the port. If these functions are not available, you must substitute them with equivalent functions.