Catapult Perl Library provide access to Catapult JTAG Cable via perl scripts. Currently it is supported for 32bit Linux platform.

How to build

Untar the Catapult Perl Library framework.

  1. perl Makefile.PL
  2. make
  3. make install

“make install” is an optional instruction.

How to run sample script

  1. cd test
  2. export LD_LIBRARY_PATH=../lib
  3. perl discovery.pl

Users can see the following output, when the discovery.pl is executed..

##  ********************************************************************
##  * Catapult Chain Interrogation ver 0.1                             *
##  * Copyright (c) 2010 ByteTools Inc,   All Rights Reserved.         *
##  ********************************************************************
##  ByteTools Catapult Library Version : 0.3.0.19
### Enter IP Address of EJ1/EJ2, Eg. 192.168.15.120 ##

Initialization

Include the following lines in the script.

use lib "../blib/arch/auto/BTJtagLib";
use Catapult;

If “make install” is executed, there is no need to include “use lib ”../blib/arch/auto/BTJtagLib” ” statement.

Catapult device cable opened by using the following command.

my $jtag = Catapult->new(<identifier>);

<identifier> can be the IP address of the EJ cables, or the Serial Number of the UJ cables.

Once the device is opened, the rest of the sub-routines can be accessed via the returned handle ( eg. $jtag ).

Subroutines

Catapult Perl library provides the following subroutines ( Refer Catapult.pm )

version

Returns the version number of the library.

Eg.

$ver = $jtag->version();

reset_idle

Move the JTAG state machine to RESET state.

Eg.

$jtag->reset_idle();

set_debug

It accepts the following arguments.

  • Debug Level ( 1…8 )
  • Log File Name ( NULL, or valid file name, eg. “catapult.log”)

Eg.

$jtag->set_debug(5,"catapult.log");

assert_trst

Applies Test Reset on the device.

Eg.

$jtag->assert_trst();

release_trst

Releases Test Reset on the device.

Eg.

$jtag->release_trst();

set_tclk_rate

To set TCLK frequency on the cable. It accepts the frequency as argument.

For example, to set 6MHz as frequency, use

$jtag->set_tclk_rate(6000000);

shift_ir

Shifts data in the IR register. It accepts teh following arguments, tdi data, capture enable.

When the second argument, “capture enable” is set to 1, this subroutine will return the tdo data. Eg.

$jtag->shift_ir($tdi,1) #to capture tdo data
$jtag->shift_ir($tdi,0) # will not capture tdo data

shift_dr

Shifts data in the DR register. It accepts teh following arguments, tdi data, capture enable.

When the second argument, “capture enable” is set to 1, this subroutine will return the tdo data.

Eg.

$jtag->shift_dr($tdi,1) #to capture tdo data
$jtag->shift_dr($tdi,0) # will not capture tdo data

goto_state

To move the JTAG state machine to particular state. For shift_ir and shift_dr, there is no need to explicitly call this subroutine, which is taken care internally.

This subroutine accepts the following JTAG states. 'RESET','IDLE','DRSELECT','DRCAPTURE','DRSHIFT', 'DREXIT1','DRPAUSE','DREXIT2','DRUPDATE','IRSELECT' 'IRCAPTURE','IRSHIFT','IREXIT1','IRPAUSE','IREXIT2' 'IRUPDATE'

Eg.

$jtag->goto_state('IDLE');

Personal Tools