2.5.3. ARMTAP_AccessDR_RW

Writes and reads data to and from a TAP data register (scan chain) and then clock the ARM core nClks times.

Syntax

#include “tapop.h”

extern TAPOp_Error ARMTAP_AccessDR_RW(unsigned8 connectId, ScanData40 *TDIbits, unsigned8 TDIrev, ScanData40 *TDObits, unsigned8 TDOrev, unsigned8 len, unsigned8 WRoffset, ScanData40 *WRmask, unsigned8 RDoffset, unsigned8 nClks, unsigned8 deselect);

where:

connectId

Connection ID, as returned by TAPOp_OpenConnection.

TDIbits

A pointer to up to 40 bits of data to be writtento the scan chain data register. This must not be NULL.

TDIrev

A flag determining the bit order of the data:

FALSE

Write LSB of TDIbits first (normal mode).

TRUE

Write MSB of TDIbits first (reversed mode).

To write less than 40 bits of data using reversed mode you must set WRmask with bits set in the high-order end of the mask, not the low-order end.

TDObits

A pointer to a 40-bit buffer that receives the data that is read from the scan chain data register. This must not be NULL.

TDOrev

A flag determining the bit order of the data:

FALSE

Read data into LSB of TDObits first (normal mode).

TRUE

Read data into MSB of TDObits first (reversed mode).

To read less than 40 bits of data using reversed mode you must mask the returned TDObits with bits set in the high-order end of the mask, not the low-order end.

len

Length of the selected data register (scan chain).

WRoffset

Offset of the selected data register (scan chain) where you start writing data. The rest of the scan chain is recirculated so that whatever data appears on TDO is written to TDI during the scan.

To write all 40 bits, you can set WRmask to NULL when using direct TAPOp calls. When defining macros, you must always specify the mask in full.

WRmask

A 40-bit mask that determines which bits are written to the data register (scan chain) during a scan:

  • if 1 then the bit is written

  • if 0 then the bit is recirculated, so that whatever comes out of the TDO pin is put back into TDI during the scan.

To write all 40 bits, you can set WRmask to NULL when using direct TAPOp calls.

RDoffset

Offset of the selected data register (scan chain) to start reading data from.

nClks

The number of ARM processor DCLKs to be generated. This is the number of transitions out of Run-Test/Idle that are made. If 0, Run-Test/Idle is avoided altogether. The value of nClks is range checked:

0 <= nClks <= 31

deselect

If 0, the connection to this TAP controller remains selected. This excludes access to this TAP controller from other Multi-ICE server connections. Otherwise the connection is deselected, giving other connections a chance to perform operations.

Return

The function returns:

TAPOp_NoError

No error.

TAPOp_UnableToSelect

Connection could not be made. You must try again later.

TAPOp_NoSuchConnection

The connectId was not recognized.

TAPOp_InBadTAPState

The TAP controller was reset or is not in Select-DR-Scan.

TAPOp_BadParameter

Failed because of one of the following:

  • TDIbits = NULL

  • TDObits = NULL

  • len = 0

  • WRoffset >= len

  • RDoffset >= len

  • nClks > 31 or nClks < 0.

TAPOp_RPC_Connection_Fail

The RPC connection was lost while processing this request.

Usage

The call attempts to select the connection. If this cannot be done (for example, because another TAP controller is being accessed), the call fails with a TAPOp_UnableToSelect error.

The data to write to the core is read from TDIbits and sent with the write mask and offset to the Multi-ICE interface unit. It is transferred to the scan chain that was selected by the last call to ARMTAP_AccessIR_nClks. The data written to the scan chain is clocked into the core if the value of nClks is non-zero, and the previous value of the register is shifted out of the scan chain and stored in TDObits.

The TAP controller must be in Select-DR-Scan state before the function is used, and is left in this state after the function has been performed.

If another connection on the same Multi-ICE server resets the TAP controllers by calling TAPOp_AnySequence_W, or TAPOp_AnySequence_RW, or TAPOp_TestResetSignal, all subsequent calls to ARMTAP_AccessDR_RW are rejected with the error TAPOp_InBadTAPState until the reset is acknowledged. See TAPOp_AnySequence_W for more details.

Example

This example is taken from example1.c in the source/examples subdirectory of the Multi-ICE installation. It returns the value in the IDcode register of an ARM processor system coprocessor.

TAPOp_Error idcode(unsigned32 *idcode)
{
    ScanData40  dummyTDIdata, TDOdata;
    /* First put the IDCODE instruction in the IR */
    TAPCheck(ARMTAP_AccessIR_nClks(connectId,  /* The connection ID we got from TAPOp_OpenConnection */
                                  IDCODE,     /* Put the IDCODE instruction in the IR */
                                  0,          /* The IR is not reversed */
                                  0,          /* No clock ticks */
                                  1));        /* Deselect. We have completed this operation and another
                                               * client can access the server without disturbing the
                                               * state of our session. */
    /* Now read the IDCODE scan chain */
    TAPCheck(ARMTAP_AccessDR_RW(connectId,     /* The connection ID we got from TAPOp_OpenConnection */
                                &dummyTDIdata, /* This is a read-only register therefore we don't care
                                                * about the data we put into it.
                                                */
                                0,             /* The register is not reversed for writing */
                                &TDOdata,      /* Put the result here (what comes out of TDO) */
                                0,             /* The register is not reversed for reading */
                                32,            /* ID code scan chain is 32 bits long */
                                0,             /* Start writing at bit 0 */
                                NULL,          /* Write all the bits */
                                0,             /* Start reading at bit 0 */
                                0,             /* Don't issue any processor clocks to the ARM */
                                1));           /* Deselect (as described above) */
    /* The bottom 32 bits of the 40-bit scan data structure contain the 32 bit value we need */
    *idcode = TDOdata.low32;
    return TAPOp_NoError;
}

See also

These TAPOp API functions provide similar or related functionality:

Copyright © 1998-2002 ARM Limited. All rights reserved.ARM DUI 0154B
Non-Confidential