2.5.16. TAPOp_CloseConnection

Close a TAPOp connection.

Syntax

#include “tapop.h”

extern TAPOp_Error TAPOp_CloseConnection(unsigned8 connectId);

where:

connectId

Connection ID, as returned by TAPOp_OpenConnection.

Returns

The function returns:

TAPOp_NoError

No error.

TAPOp_UnableToSelect

Connection could not be made.

TAPOp_NoSuchConnection

The connectId was not recognized.

TAPOp_RPC_Connection_Fail

The RPC connection was lost while processing thisrequest.

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 TAPOp connection is closed and the resources associated with it are released for use by another client. After this call, TAPOp functions must not use this connection ID. TAPOp_DeleteAllMacros is called to remove the macro definitions defined for this connection.

Note

Do not confuse closure of a connection with deselecting a connection, which enables the client to tell the server at what points the hardware can be shared with another client. Deselection occurs when a TAPOp function is called and the deselect parameter is nonzero.

Example

This example demonstrates closing a connection and then closing the base RPC interface in a program that only opens one connection. The TAPCheck macro is not used in this case because the error handling associated with it is inappropriate. Instead, an explicit loop is used, with a simple timeout counter.

{
    ... declarations
    int timeout = 20;
    // close TAP connection
    do {
        t_err = TAPOp_CloseConnection(connectId);
    } while (t_err == TAPOp_UnableToSelect && timeout-- > 0);
    // close TCP/IP connection
    TAPOp_RPC_Finalise();

See also

These TAPOp API functions provide similar or related functionality:

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