2.5.26. TAPOp_OpenConnection

Open a connection through a Multi-ICE server to one or more scan chains on a TAP controller.


#include “tapop.h”

extern TAPOp_Error TAPOp_OpenConnection(unsigned8 TAPPos, unsigned8 *connectId, unsigned8 numScanChains, unsigned8 *scanChains, unsigned8 startState, unsigned8 IRlen, unsigned32 intest, unsigned8 SCSRlen, unsigned32 scan_n, unsigned8 allowAutoDisconnect, char *appName, char *driverName);



The position in the scan chain of the TAP controllerto connect to. Position 0 is closest to TDI.


The connection ID to be used when calling other TAPOp functions.


The number of scan chains claimed by this connection.


An array containing the numbers of the scan chains claimed by this connection.


The startup state of TAP controller for this connection:

  • 1 starts the TAP controller(s) in Select-DR-Scan

  • 0 starts the TAP controller(s) in Run-Test/Idle

  • other values are invalid.


This is the length of the IR of the TAP being connected. This is compared with the length stored in IRlength.arm for the device.


INTEST instruction bit pattern for the TAP that this connection is associated with.


Length of the scan chain select register for the TAP being connected. If it is 0, the TAP does not support multiple scan chains.


SCAN_N instruction bit pattern for the TAP that this connection is associated with. It is only valid if SCSRlen 0.


This flag is set if the server is allowed to disconnect this client due to another client attempting to connect. If this client implements the standard heartbeat mechanism (automatic for Win32 clients), this flag must be set. If this is a non-Win32 client and there is no special heartbeat set up, this flag must be 0.


A null-terminated string that gives the identity of the debugger.


A null-terminated string that contains the driver name from TAPOp_GetDriverDetails for this connection.


The function returns:


No error.


Bad TAP controller position.


The Multi-ICE server is not configured.


There are no free connection IDs.


Bad parameter value passed.


One of the required scan chains has already been claimed by another connection.


A parameter conflicts with the configuration data in the server configuration file.


The RPC connection was lost while processing this request.


At the beginning of a debug session, this function creates a connection to one or more scan chains on a TAP controller, and returns a connection ID to be used when calling other TAPOp functions. The parameters passed to the function enable the Multi-ICE server to manipulate the TAP controller itself, so that it can virtualize TAP connections.

The parameter, allowAutoDisconnect, is passed to TAPOp_OpenConnection. If it is defined as 1, the server disconnects the client if the server does not receive a TAPOp request from the client within a predefined timeout. On Microsoft Windows systems, a separate thread is used that calls TAPOp_PingServer at regular intervals to keep the connection alive. This is not done for the UNIX clients, and so allowAutoDisconnect is set to 0.

The details of the device passed to TAPOp_OpenConnection (for example, the length of the Scan Chain Select Register (SCSR), or the encoding of INTEST) must be known or derived by the client. The Multi-ICE server does not know anything about individual devices. You can however use the DriverName as a key to look this information up, because the DriverName is fixed for any particular device.


Do not confuse this function with selecting a connection that occurs when a TAPOp function is called and a different connection was previously selected.


The example demonstrates opening a connection to the Multi-ICE server. It follows on from the example presented for TAPOp_GetDriverDetails. In overview:

  1. TAPOp_RPC_Initialise() (not shown here) is called to set up an RPC connection.

  2. TAPOp_RPC_Initialise() calls GetServerName() (not shown here) to get the hostname of the Multi-ICE server.

  3. TAPOp_GetDriverDetails() (not shown here) is called to query the server and returned array is scanned to find the required device.

  4. An array is set up containing the scan chains that this connection is using. In calling TAPOp_OpenConnection, you are only connecting to the listed scan chains.

  5. The information in driverDets is used to make a call to TAPOp_OpenConnection().

    MultiICE_DriverDetails  driverDetails[10];
    int                     driverNo;
    unsigned8               TAP_ScanChainsClaimed[4];
    unsigned8               TAP_TotalClaimedChains;
    unsigned8               allowAutoDisconnect;
    unsigned32              driverCount;
    ... call TAPOp_RPC_Initialise
    ... call TAPOp_GetDriverDetails to get the available drivers
    ... search driverDets[] for the correct driver and set driverNo
    /* The scan chains we will try to claim - this assumes it is an ARM */
    TAP_ScanChainsClaimed[0] = 0;
    TAP_ScanChainsClaimed[1] = 1;
    TAP_ScanChainsClaimed[2] = 2;
    TAP_TotalClaimedChains = 3;
#ifdef WIN32
    allowAutoDisconnect = 1;
    allowAutoDisconnect = 0;
    /* Try to connect to the device on the Multi-ICE server */
    err=TAPOp_OpenConnection(TAP_pos,  /* The TAP number */
              &connectId,              /* The connection ID is returned 
                                        * here if a connection is made */
              TAP_TotalClaimedChains,  /* Number of scan chains to claim */
              TAP_ScanChainsClaimed,   /* List of scan chains claimed */
              1,                       /* Start in Select-DR-scan state */
              4,                       /* instruction register is 4 bits wide */
              INTEST,                  /* INTEST instruction encoding */
              4,                       /* SCS register is 4 bits wide */
              SCAN_N,                  /* SCAN_N instruction encoding */
              allowAutoDisconnect,     /* Allow server to disconnect us if
                                        * the connection appears to be dead */
              appName,                 /* A name identifying the connection */
    /* If the device is already connected we get this error back */
    if (err == TAPOp_ScanChainAlreadyClaimed) {
        ... handle error, for example by prompting the user to change TAP pos.

See also

This TAPOp API function provides similar or related functionality:

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