#include <stdlib.h>
#include <string.h>
#include "dbg_msg.h"
#include "jt_tap.h"
#include "jt_io.h"
#include "jt_arm.h"
Test Access Port Controller Interface
general behaviour
The tap controller changes its internal states on TMS at rising edge off TCK.
All Inputs (TDFROM) are sampled after TCLK rising
All Outputs (TDTO) are propagated after TCLK falling
+-------+ | Reset |<--------------------------------------------------+ +---+---+ | | TMS=0 |TMS=1 Y | +--------+ TMS=1 +-----------+ TMS=1 +-----------+ | |RUN/IDLE|---->+----->|Sel DR-scan|--------->|Sel IR-scan|--+ +--------+ ^ +-----------+ +-----------+ ^ | | TMS=0 | TMS=0 | | Y Y | | +-----------+ TMS=1 +-----------+ TMS=1 | | |Capture DR |--+ |Capture IR |--+ | | +-----------+ | +-----------+ | | | | TMS=0 | | TMS=0 | | | Y | Y | | | +-----------+ | +-----------+ | | | +->| Shift DR | | +->| Shift IR | | | | | +-----------+ | | +-----------+ | | | | | TMS=1 | | | TMS=1 | | | | Y | | Y | | | | +-----------+ <+ | +-----------+ <+ | | | | Exit 1 DR | TMS=1 | | Exit 1 IR | TMS=1 | | | +-----------+--+ | +-----------+--+ | | | | TMS=0 | | | TMS=0 | | | | Y | | Y | | | | +-----------+ | | +-----------+ | | | | | Pause DR | | | | Pause IR | | | | | +-----------+ | | +-----------+ | | | | | TMS=1 | | | TMS=1 | | | |TMS=0 Y | |TMS=0 Y | | | | +-----------+ | | +-----------+ | | | +--| Exit 2 DR | | +--| Exit 2 IR | | | | +-----------+ | +-----------+ | | | | TMS=1 | | TMS=1 | | | Y | Y | | |TMS=1 +-----------+ <+ TMS=1+-----------+ <+ | +<-----| Update DR | +----| Update IR | | | +-----------+ | +-----------+ | +------------|-----------+ | | | TMS=0 | TMS=0 | Y | +-----------------------+<---------------------+ *
Here we running trough a simplified tap-state machine:
+-------+ | Reset |<--------------------------------------------------+ +---+---+ | | TMS=0 |TMS=1 Y | +--------+ TMS=1 +-----------+ TMS=1 +-----------+ | |RUN/IDLE|---->+----->| DR |--------->| IR |--+ +--------+ ^ +- - - - - -+ +- - - - - -+ ^ | |DR exchange| |IR exchange| | | +- - - - - -+ +- - - - - -+ | +<-----| Update DR | +----| Update IR | | | +-----------+ | +-----------+ | +------------|-----------+ | | | TMS=0 | TMS=0 | Y | +-----------------------+<---------------------+
#define tap_tick | ( | ) |
Referenced by tap_discover_chain().
void tap_probe | ( | void | ) |
General probe to check if we are allow to access the LPT (or USB) port.
- |
Referenced by main().
void tap_delay | ( | void | ) |
delay by reading value from LPT status port (using inb())
- |
Referenced by jtag_linger().
void tap_start | ( | void | ) |
Power on to adapter at LPT-driver cable.
Issue TAP - Reset.
Enter Run/idle state
- |
References DBG_LEVEL_GDB_ARM_ERROR, and dbgPrintf().
Referenced by jtag_start(), and jtag_test().
void tap_stop | ( | void | ) |
Power off to adapter at LPT-driver cable.
- |
References DBG_LEVEL_JTAG_TAP, and dbgPrintf().
Referenced by jtag_test().
void tap_hard_reset | ( | void | ) |
grant TRESET and SRESET lines (if exists)
grant Sytem reset for timeline of tap_grant_sreset_timout
continue after tap_settle_system_timeout
- |
Referenced by jtag_hard_reset(), and jtag_identify_devices().
void tap_reset | ( | void | ) |
run trough tap states until reaching RESET state
- |
References inb, and LPT_STATUS_PORT.
Referenced by jtag_identify_devices(), and jtag_reset().
void tap_idle | ( | int | now | ) |
Referenced by jtag_eos(), and jtag_identify_devices().
void tap_instr | ( | int | num_bits, | |
char * | to_dev, | |||
char * | from_dev | |||
) |
Walk from run/idle (or any update) state trough the IR states, up to Update-IR state.
The first char of to_dev is shifted as first bit into jtag chain.
The first char of from_dev is the first shifted out of the jtag chain.
num_bits | number of bits to shift in and out | |
to_dev | string pointer to send data | |
from_dev | string pointer to receive data |
Referenced by jtag_exchange_instr().
void tap_data | ( | int | num_bits, | |
char * | to_dev, | |||
char * | from_dev | |||
) |
Walk from run/idle (or any update) state trough the DR states, up to Update-DR state.
The first char of to_dev is shifted as first bit into jtag chain.
The first char of from_dev is the first shifted out of the jtag chain.
num_bits | number of bits to shift in and out | |
to_dev | string pointer to send data | |
from_dev | string pointer to receive data |
Referenced by jtag_exchange_data().
void tap_discover_chain | ( | void | ) |
discover the TAP chain
function uses struct chain_head chain_head
- |
References raw_Tin(), raw_Tout(), tap_tick, TCLK, and TMS.
Referenced by jtag_identify_devices().
void tap_idle | ( | int now | __attribute__(unused) | ) |
Step from RESET, Update-DR, Update-IR or Run/Idle state into Run/Idle state
now | set to 1 to enter TAP Run/Idle state now |