/*****************************************************************************
 * Copyright (c) 1990-2000 Digi International Inc., All Rights Reserved
 * 
 * This software contains proprietary and confidential information of Digi
 * International Inc.  By accepting transfer of this copy, Recipient agrees
 * to retain this software in confidence, to prevent disclosure to others,
 * and to make no use of this software other than that for which it was
 * delivered.  This is an unpublished copyrighted work of Digi International
 * Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
 * prohibited.
 * 
 * Restricted Rights Legend
 *
 * Use, duplication, or disclosure by the Government is subject to
 * restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
 * Technical Data and Computer Software clause at DFARS 252.227-7031 or
 * subparagraphs (c)(1) and (2) of the Commercial Computer Software -
 * Restricted Rights at 48 CFR 52.227-19, as applicable.
 *
 * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
 *
 *****************************************************************************/

#ifndef TSQUARED_H
#define TSQUARED_H

static const char tsquared_h_rcsid[] = "@(#) " "$Id: tsquared.h,v 1.7 2000/04/19 22:45:46 chrism Exp $";

#ifndef FALSE
#define FALSE 0
#endif

#ifndef TRUE
#define TRUE (!FALSE)
#endif

#ifndef BOOL
typedef int BOOL;
#endif

#ifndef CHAR
typedef char CHAR;
#endif

#ifndef UCHAR
typedef unsigned char UCHAR;
#endif

#ifndef SHORT
typedef short SHORT;
#endif

#ifndef USHORT
typedef unsigned short USHORT;
#endif

#ifndef LONG
typedef long LONG;
#endif

#ifndef ULONG
typedef unsigned long ULONG;
#endif


#include "dxbtypes.h"
#include "mgmtdflt.h"
#include "mgmthlc.h"
#include "mgmttigger.h"
#include "mgmtshim.h"


typedef trc_ds1_config_request_t trc_ds1_config_response_t;
typedef trc_ds1_ext_config_request_t trc_ds1_ext_config_response_t;
typedef trc_ds1_status_request_t trc_ds1_status_response_t;

typedef trc_bri_config_request_t trc_bri_config_response_t;
typedef trc_bri_status_request_t trc_bri_status_response_t;

typedef trc_dchan_ext_config_request_t trc_dchan_ext_config_response_t;
typedef trc_dchan_ext_status_request_t trc_dchan_ext_status_response_t;


/* Management top level functions */

#define MGMT_PAM_ERROR_UNABLETOLOADSHIM		(SPARTACUS_INTERNAL + 1)
#define MGMT_PAM_ERROR_INVALIDSHIMVERSION		(SPARTACUS_INTERNAL + 2)

BOOL OpenMgmtChannel(void);
BOOL CloseMgmtChannel(void);
uint32 GetMgmtLastError(void);

/* Common Functions */

BOOL CommandSendReceive(uint32 BoardNumber, uint16 Command, void *mpkt, uint16 mpktlen, void *rpkt, uint16 rpktlen);
BOOL CommandSend(uint32 BoardNumber, uint16 Command, void *mpkt, uint16 mpktlen);
BOOL CommandReceive(uint32 BoardNumber, uint16 Command, void *rpkt, uint16 rpktlen);

/* Managment Functions */

BOOL GetMgmtBoardCount(get_mgmt_board_no_response_t * response);
BOOL GetMgmtBoardInfo(uint32 BoardNumber, get_mgmt_board_info_response_t * response);
BOOL GetMgmtShimVersion(get_mgmt_shim_ver_response_t * response);
BOOL GetMgmtDriverVersions(uint32 BoardNumber, get_mgmt_drv_vers_response_t * response);

//BOOL SetMgmtStopTrace( void);

/* Adapter Functions */

BOOL GetAdapterInfo(uint32 BoardNumber, get_adapter_info_response_t * response);
BOOL GetAdapterState(uint32 BoardNumber, get_adapter_state_response_t * response);
BOOL GetModemNationality(uint32 BoardNumber, get_modem_nationality_response_t * response);
BOOL SetModemNationality(uint32 BoardNumber, uint32 CountryCode);
BOOL GetManagementProtocolVersion(uint32 BoardNumber, get_mgmt_protocol_ver_response_t * response);

/* DS1 Functions */

BOOL GetDS1Configuration(uint32 BoardNumber, uint32 Port, get_ds1_config_response_t * response);
BOOL SetDS1Configuration(uint32 BoardNumber, set_ds1_config_request_t * request);
BOOL GetDS1ExtendedConfiguration(uint32 BoardNumber, uint32 Port, get_ds1_ext_config_response_t * response);
BOOL SetDS1ExtendedConfiguration(uint32 BoardNumber, set_ds1_ext_config_request_t * request);
BOOL GetDS1Status(uint32 BoardNumber, uint32 Port, get_ds1_status_response_t * response);
BOOL GetDS1ExtendedStatus(uint32 BoardNumber, uint32 Port, get_ds1_ext_status_response_t * response);
BOOL GetDS1CT1SignalStatus(uint32 BoardNumber, uint32 Port, uint32 Channel, get_ds1_ct1_sig_status_response_t * response);
BOOL GetDS1AllCT1SignalStatus(uint32 BoardNumber, uint32 Port, get_all_ds1_ct1_sig_status_response_t * response);

/* BRI Functions */

BOOL GetBRIConfiguration(uint32 BoardNumber, uint32 Port, get_bri_config_response_t * response);
BOOL SetBRIConfiguration(uint32 BoardNumber, set_bri_config_request_t * request);
BOOL GetBRIStatus(uint32 BoardNumber, uint32 Port, get_bri_status_response_t * response);

/* Serial Functions */

BOOL GetSerialConfiguration(uint32 BoardNumber, uint32 Channel, get_serial_config_response_t * response);
BOOL SetSerialConfiguration(uint32 BoardNumber, set_serial_config_request_t * request);
BOOL GetSerialStatus(uint32 BoardNumber, uint32 Channel, get_serial_status_response_t * response);
BOOL GetSerialExtendedConfiguration(uint32 BoardNumber, uint32 Channel, get_serial_ext_config_response_t * response);
BOOL SetSerialExtendedConfiguration(uint32 BoardNumber, set_serial_ext_config_request_t * request);
BOOL GetSerialExtendedStatus(uint32 BoardNumber, uint32 Channel, get_serial_ext_status_response_t * response);
BOOL GetSerialTestChannelMode(uint32 BoardNumber, uint32 Channel, get_serial_channel_test_mode_response_t * response);
BOOL SetSerialTestChannelMode(uint32 BoardNumber, set_serial_channel_test_mode_request_t * request);
BOOL GetSerialTestStatus(uint32 BoardNumber, uint32 Channel, get_serial_test_status_response_t * response);
BOOL SetSerialTestStatus(uint32 BoardNumber, set_serial_test_status_request_t * request);
BOOL GetSerialTestConfiguration(uint32 BoardNumber, uint32 Channel, get_serial_test_config_response_t * response);
BOOL SetSerialTestConfiguration(uint32 BoardNumber, set_serial_test_config_request_t * request);

/* Call Functions */

BOOL GetCallStatus(uint32 BoardNumber, uint32 Port, uint32 Channel, get_call_status_response_t * response);
BOOL GetAllCallStatus(uint32 BoardNumber, uint32 Port, get_all_call_status_response_t * response);

/* Modem Functions */

BOOL GetModemConfiguration(uint32 BoardNumber, uint32 Channel, get_modem_config_response_t * response);
BOOL SetModemConfiguration(uint32 BoardNumber, set_modem_config_request_t * request);
BOOL GetModemStatus(uint32 BoardNumber, uint32 Channel, get_modem_status_response_t * response);
BOOL GetModemExtendedConfiguration(uint32 BoardNumber, uint32 Channel, get_modem_ext_config_response_t * response);
BOOL SetModemExtendedConfiguration(uint32 BoardNumber, set_modem_ext_config_request_t * request);
BOOL GetModemExtendedStatus(uint32 BoardNumber, uint32 Channel, get_modem_ext_status_response_t * response);

/* D Channel Functions */

BOOL GetDChannelExtendedConfiguration(uint32 BoardNumber, uint32 Port, get_dchan_ext_config_response_t * response);
BOOL SetDChannelExtendedConfiguration(uint32 BoardNumber, set_dchan_ext_config_request_t * request);
BOOL GetDChannelExtendedStatus(uint32 BoardNumber, uint32 Port, get_dchan_ext_status_response_t * response);

/* B CHannel Functions */

BOOL GetBChannelStatus(uint32 BoardNumber, uint32 Channel, get_bchan_status_response_t * response);
BOOL GetBChannelExtendedConfiguration(uint32 BoardNumber, uint32 Channel, get_bchan_ext_config_response_t * response);
BOOL SetBChannelExtendedConfiguration(uint32 BoardNumber, set_bchan_ext_config_request_t * request);
BOOL GetBChannelExtendedStatus(uint32 BoardNumber, uint32 Channel, get_bchan_ext_status_response_t * response);

#endif // TSQUARED_H
