C:/Source/PCW/Sample Code/JTAG-Out.h File Reference

JTAG driver for Atmel ARM AT91SAM7x. More...

Go to the source code of this file.

Defines

#define TDI_PIN   27
#define TCK_PIN   30
#define TMS_PIN   29
#define TDO_PIN   28
#define TRST_PIN   21
#define TSEL0_PIN   19
#define TSEL1_PIN   20
#define TDI   (1 << TDI_PIN)
#define TCK   (1 << TCK_PIN)
#define TMS   (1 << TMS_PIN)
#define TDO   (1 << TDO_PIN)
#define TRST   (1 << TRST_PIN)
#define TSEL0   (1 << TSEL0_PIN)
#define TSEL1   (1 << TSEL1_PIN)
#define INSTR_EXTEST   0x00
#define INSTR_IDCODE   0x01
#define INSTR_SAMPLE   0x02
#define INSTR_IMPCODE   0x03
#define INSTR_ADDRESS   0x08
#define INSTR_DATA   0x09
#define INSTR_CONTROL   0x0A
#define INSTR_BYPASS   0xFF

Typedefs

typedef unsigned char SCAN_DATA_TYPE

Enumerations

enum  SHIFT_REGISTER_TYPE { INSTRUCTION_REGISTER = 0, DATA_REGISTER, MAX_SHIFT_REGISTER }
enum  JTAG_STATE_TYPE {
  TEST_LOGIC_RESET = 0, RUN_TEST_IDLE, PAUSE_DR, PAUSE_IR,
  SHIFT_DR, SHIFT_IR, UNDEFINED_JTAG_STATE, MAX_JTAG_STATE
}

Functions

void JTAG_Initialize (void)
 JTAG_Initialize -Initializes the IO for the JTAG out functionality.
void JTAG_ResetJSM (int Select, Bool Reset, JTAG_STATE_TYPE state_e)
 JTAG_ResetJSM - Brings the JTAG interface to a known state.
void JTAG_ScanIO (int Select, SHIFT_REGISTER_TYPE jtag_register_e, int length_in_bits, SCAN_DATA_TYPE *out_data, SCAN_DATA_TYPE *in_data, JTAG_STATE_TYPE state_e)
 JTAG_ScanIO - Move the JTAG State Machine (JSM) controller to the shift state specified by register (instruction_register or data_register), clock test data pointed to by out_data out (to target's TDI pin), read data clocked in (from target's TDO pin) and store in location pointed to by in_data, and move the JSM to the state specifyed by state.
unsigned char ClockJTAG (int Select, unsigned int, unsigned int)
 ClockJTAG - Clock out TDI data and clock in TDO data and return it.
void ScanDataInOut (int Select, unsigned char *, unsigned int, unsigned char *)
 ScanDataInOut - Routine for shifting data in and out of shitf DR or shift IR JTAG states.
void PulseClock (int Select)
 PulseClock - toggles the JTAG clock ONLY!


Detailed Description

JTAG driver for Atmel ARM AT91SAM7x.

***************************************************************************

Author:
Pro Code Works, LLC. - http://www.ProCodeWorks.com
Date:
June 2007
---------------------------------------------------------------------------- "THE BEER-WARE LICENSE" (Revision 42): nelson@ProCodeWorks.com wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return. Nelson Yaple ----------------------------------------------------------------------------

---------------------------------------------------------------------------


Define Documentation

#define INSTR_ADDRESS   0x08

#define INSTR_BYPASS   0xFF

#define INSTR_CONTROL   0x0A

#define INSTR_DATA   0x09

#define INSTR_EXTEST   0x00

#define INSTR_IDCODE   0x01

#define INSTR_IMPCODE   0x03

#define INSTR_SAMPLE   0x02

#define TCK   (1 << TCK_PIN)

#define TCK_PIN   30

#define TDI   (1 << TDI_PIN)

#define TDI_PIN   27

#define TDO   (1 << TDO_PIN)

#define TDO_PIN   28

#define TMS   (1 << TMS_PIN)

#define TMS_PIN   29

#define TRST   (1 << TRST_PIN)

#define TRST_PIN   21

#define TSEL0   (1 << TSEL0_PIN)

#define TSEL0_PIN   19

#define TSEL1   (1 << TSEL1_PIN)

#define TSEL1_PIN   20


Typedef Documentation

typedef unsigned char SCAN_DATA_TYPE


Enumeration Type Documentation

Enumerator:
TEST_LOGIC_RESET 
RUN_TEST_IDLE 
PAUSE_DR 
PAUSE_IR 
SHIFT_DR 
SHIFT_IR 
UNDEFINED_JTAG_STATE 
MAX_JTAG_STATE 

Enumerator:
INSTRUCTION_REGISTER 
DATA_REGISTER 
MAX_SHIFT_REGISTER 


Function Documentation

unsigned char ClockJTAG ( int  Select,
unsigned int  tms,
unsigned int  tdi 
)

ClockJTAG - Clock out TDI data and clock in TDO data and return it.

***************************************************************************

Parameters:
Select JTAG Bus
tms (Test Mode Select)
tdi (Test Data In) bits
Returns:
one bit of JTAG data

void JTAG_Initialize ( void   ) 

JTAG_Initialize -Initializes the IO for the JTAG out functionality.

**************************************************************************

Returns:
Nothing

void JTAG_ResetJSM ( int  Select,
Bool  Reset,
JTAG_STATE_TYPE  state_e 
)

JTAG_ResetJSM - Brings the JTAG interface to a known state.

***************************************************************************

Parameters:
Select JTAG Bus Number
Reset [Boolean] if True toggle the TRST pin,
state_e [JTAG_STATE_TYPE] - new jtag state upon exit state_e = state to leave in
Returns:
Nothing

void JTAG_ScanIO ( int  Select,
SHIFT_REGISTER_TYPE  jtag_register_e,
int  length_in_bits,
SCAN_DATA_TYPE in_data,
SCAN_DATA_TYPE out_data,
JTAG_STATE_TYPE  state_e 
)

JTAG_ScanIO - Move the JTAG State Machine (JSM) controller to the shift state specified by register (instruction_register or data_register), clock test data pointed to by out_data out (to target's TDI pin), read data clocked in (from target's TDO pin) and store in location pointed to by in_data, and move the JSM to the state specifyed by state.

**************************************************************************

Parameters:
Select JTAG Bus Number
jtag_register_e [SHIFT_REGISTER_TYPE] - target register
length_in_bits [1 - ...] - number of bits in scan chain contained in in_data and/or out_data
in_data - pointer to array of bytes containing the scan chain to be output via jtag OR NULL if no data to be scanned out
out_data - pointer to an array of bytes which will contain the scan chain to be input via jtag OR NULL of no data to be scanned in
state_e [JTAG_STATE_TYPE] - new jtag state upon exit
Returns:
Nothing

void PulseClock ( int  Select  ) 

PulseClock - toggles the JTAG clock ONLY!

***************************************************************************

Parameters:
Select JTAG Bus Number
Returns:
Nothing

void ScanDataInOut ( int  Select,
unsigned char *  in_data,
unsigned int  in_length,
unsigned char *  out_data 
)

ScanDataInOut - Routine for shifting data in and out of shitf DR or shift IR JTAG states.

***************************************************************************

Parameters:
Select JTAG Bus Number
in_data pointer to data to be shifted into the shift DR or shift IR JTAG register.
in_length = number of bits to shift
out_data = pointer to outgoing buffer
Returns:
nothing. (JTAG State machine is at exit DR/IR)


Generated on Sun Feb 15 20:19:28 2009 for JTAG by  doxygen 1.5.8