OpenOCD
jtag.c File Reference
Include dependency graph for jtag.c:

Go to the source code of this file.

Functions

void jtag_clock_tck (uint16_t count)
 Generate TCK clock cycles. More...
 
void jtag_clock_tms (uint8_t count, uint8_t sequence)
 Perform TAP FSM state transitions at maximum TCK frequency. More...
 
void jtag_configure_tck_delay (uint8_t scan_in, uint8_t scan_out, uint8_t scan_io, uint8_t tck, uint8_t tms)
 Configure TCK delay parameters. More...
 
uint16_t jtag_get_signals (void)
 Get current JTAG signal states. More...
 
void jtag_scan_in (uint8_t out_offset, uint8_t in_offset)
 Perform JTAG SCAN-IN operation at maximum TCK frequency. More...
 
void jtag_scan_io (uint8_t out_offset, uint8_t in_offset)
 Perform bidirectional JTAG SCAN operation at maximum TCK frequency. More...
 
void jtag_scan_out (uint8_t out_offset)
 Perform JTAG SCAN-OUT operation at maximum TCK frequency. More...
 
void jtag_set_signals (uint8_t low, uint8_t high)
 Set state of JTAG output signals. More...
 
void jtag_slow_clock_tck (uint16_t count)
 Generate TCK clock cycles at variable frequency. More...
 
void jtag_slow_clock_tms (uint8_t count, uint8_t sequence)
 Perform TAP-FSM state transitions at less than maximum TCK frequency. More...
 
void jtag_slow_scan_in (uint8_t out_offset, uint8_t in_offset)
 Perform JTAG SCAN-IN operation at variable TCK frequency. More...
 
void jtag_slow_scan_io (uint8_t out_offset, uint8_t in_offset)
 Perform bidirectional JTAG SCAN operation at maximum TCK frequency. More...
 
void jtag_slow_scan_out (uint8_t out_offset)
 Perform JTAG SCAN-OUT operation at maximum TCK frequency. More...
 

Variables

uint8_t delay_scan_in
 Delay value for SCAN_IN operations with less than maximum TCK frequency. More...
 
uint8_t delay_scan_io
 Delay value for SCAN_IO operations with less than maximum TCK frequency. More...
 
uint8_t delay_scan_out
 Delay value for SCAN_OUT operations with less than maximum TCK frequency. More...
 
uint8_t delay_tck
 Delay value for CLOCK_TCK operations with less than maximum frequency. More...
 
uint8_t delay_tms
 Delay value for CLOCK_TMS operations with less than maximum frequency. More...
 

Function Documentation

◆ jtag_clock_tck()

void jtag_clock_tck ( uint16_t  count)

Generate TCK clock cycles.

Maximum achievable TCK frequency is 375 kHz for ULINK clocked at 24 MHz.

Parameters
countnumber of TCK clock cycles to generate.

Definition at line 560 of file jtag.c.

References count, and PIN_TCK.

Referenced by execute_command().

◆ jtag_clock_tms()

void jtag_clock_tms ( uint8_t  count,
uint8_t  sequence 
)

Perform TAP FSM state transitions at maximum TCK frequency.

Maximum achievable TCK frequency is 176 kHz for ULINK clocked at 24 MHz.

Parameters
countthe number of state transitions to perform.
sequencethe TMS pin levels for each state transition, starting with the least-significant bit.

Definition at line 603 of file jtag.c.

References count, PIN_TCK, and PIN_TMS.

Referenced by execute_command(), jtag_scan_in(), jtag_scan_io(), and jtag_scan_out().

◆ jtag_configure_tck_delay()

void jtag_configure_tck_delay ( uint8_t  scan_in,
uint8_t  scan_out,
uint8_t  scan_io,
uint8_t  tck,
uint8_t  tms 
)

Configure TCK delay parameters.

Parameters
scan_innumber of delay cycles in scan_in operations.
scan_outnumber of delay cycles in scan_out operations.
scan_ionumber of delay cycles in scan_io operations.
tcknumber of delay cycles in clock_tck operations.
tmsnumber of delay cycles in clock_tms operations.

Definition at line 706 of file jtag.c.

References delay_scan_in, delay_scan_io, delay_scan_out, delay_tck, and delay_tms.

Referenced by execute_command().

◆ jtag_get_signals()

uint16_t jtag_get_signals ( void  )

Get current JTAG signal states.

Returns
a 16-bit integer where the most-significant byte contains the state of the JTAG input signals and the least-significant byte contains the state of the JTAG output signals.

Definition at line 659 of file jtag.c.

References GET_BRKOUT, GET_RTCK, GET_TDO, GET_TRAP, MASK_PORTB_DIRECTION_OUT, SIGNAL_BRKOUT, SIGNAL_RTCK, SIGNAL_TDO, and SIGNAL_TRAP.

Referenced by execute_command().

◆ jtag_scan_in()

void jtag_scan_in ( uint8_t  out_offset,
uint8_t  in_offset 
)

Perform JTAG SCAN-IN operation at maximum TCK frequency.

Dummy data is shifted into the JTAG chain via TDI, TDO data is sampled and stored in the EP2 IN buffer.

Maximum achievable TCK frequency is 182 kHz for ULINK clocked at 24 MHz.

Parameters
out_offsetoffset in OUT2BUF where payload data starts
in_offset

Definition at line 42 of file jtag.c.

References GET_TDO, jtag_clock_tms(), PIN_TCK, PIN_TDI, and PIN_TMS.

Referenced by execute_command().

◆ jtag_scan_io()

void jtag_scan_io ( uint8_t  out_offset,
uint8_t  in_offset 
)

Perform bidirectional JTAG SCAN operation at maximum TCK frequency.

Data stored in EP2 OUT buffer is shifted into the JTAG chain via TDI, TDO data is sampled and stored in the EP2 IN buffer. The TAP-FSM state is always left in the PAUSE-DR/PAUSE-IR state.

Maximum achievable TCK frequency is 100 kHz for ULINK clocked at 24 MHz.

Parameters
out_offsetoffset in OUT2BUF where payload data starts
in_offset

Definition at line 369 of file jtag.c.

References GET_TDO, jtag_clock_tms(), PIN_TCK, PIN_TDI, and PIN_TMS.

Referenced by execute_command().

◆ jtag_scan_out()

void jtag_scan_out ( uint8_t  out_offset)

Perform JTAG SCAN-OUT operation at maximum TCK frequency.

Data stored in EP2 OUT buffer is shifted into the JTAG chain via TDI, TDO data is not sampled. The TAP-FSM state is always left in the PAUSE-DR/PAUSE-IR state.

Maximum achievable TCK frequency is 142 kHz for ULINK clocked at 24 MHz.

Parameters
out_offsetoffset in OUT2BUF where payload data starts

Definition at line 208 of file jtag.c.

References jtag_clock_tms(), PIN_TCK, PIN_TDI, and PIN_TMS.

Referenced by execute_command().

◆ jtag_set_signals()

void jtag_set_signals ( uint8_t  low,
uint8_t  high 
)

Set state of JTAG output signals.

Parameters
lowsignals which should be de-asserted.
highsignals which should be asserted.

Definition at line 691 of file jtag.c.

References low, and MASK_PORTB_DIRECTION_OUT.

Referenced by execute_command().

◆ jtag_slow_clock_tck()

void jtag_slow_clock_tck ( uint16_t  count)

Generate TCK clock cycles at variable frequency.

Maximum achievable TCK frequency is 166.6 kHz for ULINK clocked at 24 MHz.

Parameters
countnumber of TCK clock cycles to generate.

Definition at line 578 of file jtag.c.

References count, delay_tck, and PIN_TCK.

Referenced by execute_command().

◆ jtag_slow_clock_tms()

void jtag_slow_clock_tms ( uint8_t  count,
uint8_t  sequence 
)

Perform TAP-FSM state transitions at less than maximum TCK frequency.

Maximum achievable TCK frequency is 117 kHz for ULINK clocked at 24 MHz.

Parameters
countthe number of state transitions to perform.
sequencethe TMS pin levels for each state transition, starting with the least-significant bit.

Definition at line 630 of file jtag.c.

References count, delay_tms, PIN_TCK, and PIN_TMS.

Referenced by execute_command(), jtag_slow_scan_in(), jtag_slow_scan_io(), and jtag_slow_scan_out().

◆ jtag_slow_scan_in()

void jtag_slow_scan_in ( uint8_t  out_offset,
uint8_t  in_offset 
)

Perform JTAG SCAN-IN operation at variable TCK frequency.

Dummy data is shifted into the JTAG chain via TDI, TDO data is sampled and stored in the EP2 IN buffer.

Maximum achievable TCK frequency is 113 kHz for ULINK clocked at 24 MHz.

Parameters
out_offsetoffset in OUT2BUF where payload data starts
in_offset

Definition at line 120 of file jtag.c.

References delay_scan_in, GET_TDO, jtag_slow_clock_tms(), PIN_TCK, PIN_TDI, and PIN_TMS.

Referenced by execute_command().

◆ jtag_slow_scan_io()

void jtag_slow_scan_io ( uint8_t  out_offset,
uint8_t  in_offset 
)

Perform bidirectional JTAG SCAN operation at maximum TCK frequency.

Data stored in EP2 OUT buffer is shifted into the JTAG chain via TDI, TDO data is sampled and stored in the EP2 IN buffer. The TAP-FSM state is always left in the PAUSE-DR/PAUSE-IR state.

Maximum achievable TCK frequency is 78 kHz for ULINK clocked at 24 MHz.

Parameters
out_offsetoffset in OUT2BUF where payload data starts
in_offset

Definition at line 462 of file jtag.c.

References delay_scan_io, GET_TDO, jtag_slow_clock_tms(), PIN_TCK, PIN_TDI, and PIN_TMS.

Referenced by execute_command().

◆ jtag_slow_scan_out()

void jtag_slow_scan_out ( uint8_t  out_offset)

Perform JTAG SCAN-OUT operation at maximum TCK frequency.

Data stored in EP2 OUT buffer is shifted into the JTAG chain via TDI, TDO data is not sampled. The TAP-FSM state is always left in the PAUSE-DR/PAUSE-IR state.

Maximum achievable TCK frequency is 97 kHz for ULINK clocked at 24 MHz.

Parameters
out_offsetoffset in OUT2BUF where payload data starts

Definition at line 283 of file jtag.c.

References delay_scan_out, jtag_slow_clock_tms(), PIN_TCK, PIN_TDI, and PIN_TMS.

Referenced by execute_command().

Variable Documentation

◆ delay_scan_in

uint8_t delay_scan_in

Delay value for SCAN_IN operations with less than maximum TCK frequency.

Definition at line 17 of file jtag.c.

Referenced by angie_append_configure_tck_cmd(), jtag_configure_tck_delay(), jtag_slow_scan_in(), and ulink_append_configure_tck_cmd().

◆ delay_scan_io

uint8_t delay_scan_io

Delay value for SCAN_IO operations with less than maximum TCK frequency.

Definition at line 23 of file jtag.c.

Referenced by angie_append_configure_tck_cmd(), jtag_configure_tck_delay(), jtag_slow_scan_io(), and ulink_append_configure_tck_cmd().

◆ delay_scan_out

uint8_t delay_scan_out

Delay value for SCAN_OUT operations with less than maximum TCK frequency.

Definition at line 20 of file jtag.c.

Referenced by angie_append_configure_tck_cmd(), jtag_configure_tck_delay(), jtag_slow_scan_out(), and ulink_append_configure_tck_cmd().

◆ delay_tck

uint8_t delay_tck

Delay value for CLOCK_TCK operations with less than maximum frequency.

Definition at line 26 of file jtag.c.

Referenced by angie_append_configure_tck_cmd(), jtag_configure_tck_delay(), jtag_slow_clock_tck(), and ulink_append_configure_tck_cmd().

◆ delay_tms

uint8_t delay_tms

Delay value for CLOCK_TMS operations with less than maximum frequency.

Definition at line 29 of file jtag.c.

Referenced by angie_append_configure_tck_cmd(), jtag_configure_tck_delay(), jtag_slow_clock_tms(), and ulink_append_configure_tck_cmd().