jt_tap.c File Reference

#include <stdlib.h>
#include <string.h>
#include "dbg_msg.h"
#include "jt_tap.h"
#include "jt_io.h"
#include "jt_arm.h"

Defines

Functions


Detailed Description

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                      |
     +-----------------------+<---------------------+
 *
See also:
IEEE Std 1149.1-1990 for all valid information of the TAP state machine

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 Documentation

 
#define tap_tick (  ) 

Referenced by tap_discover_chain().


Function Documentation

void tap_probe ( void   ) 

General probe to check if we are allow to access the LPT (or USB) port.

Parameters:
- 
Returns:
- (program will exit if lpt-port is not permitted)

Referenced by main().

void tap_delay ( void   ) 

delay by reading value from LPT status port (using inb())

Parameters:
- 
Returns:
-

Referenced by jtag_linger().

void tap_start ( void   ) 

Power on to adapter at LPT-driver cable.
Issue TAP - Reset.
Enter Run/idle state

Parameters:
- 
Returns:
-

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.

Parameters:
- 
Returns:
-

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

Parameters:
- 
Returns:
-

Referenced by jtag_hard_reset(), and jtag_identify_devices().

void tap_reset ( void   ) 

run trough tap states until reaching RESET state

Parameters:
- 
Returns:
-

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.

Parameters:
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.

Parameters:
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

  1. find out how many TAP controllers are chained together.
  2. if a TAP controller send its JTAG-IDCODE as a response to an answer to reset, store this IDCODE for later use.
  3. find out the size of each IR in the chain.

function uses struct chain_head chain_head

Parameters:
- 
Returns:
-

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

Parameters:
now set to 1 to enter TAP Run/Idle state now
Returns:
-

This file is part of the documentation for JTAG-GDB Server for ARM .

Generated on Mon Feb 15 21:23:21 2010 by doxygen 1.6.2.