/*****************************************************************************
* Copyright (c) 1990-96 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
*
*****************************************************************************/

/*
 * $Id: dxb.h,v 1.4 1997/10/21 20:47:58 gary Exp $
 */

typedef struct msg_p {
	uint8 type ;			/* DXB Command */
	uint8 chan ;			/* Channel */
	
	union {
		uint16 pos_rpt_value ;	/* Position Report Value */
		uint16 subtype  ;	/* OOB IOCTL SUBTYPE */
		uint16 priority ;	/* Priority */
		uint16 options ;	/* Close options */
		uint16 pad ;		/* Placard */
		uint16 value ;		/* Open Ack Value */
		uint16 ioctl_resp ;	/* IOCTL resp IOCACK/IOCNAK (0/1)*/
		uint16 data_len ;	/* Data Message Length */
	} st ;

	uint16	cp_len ;		/* Control Portion Length */
	uint16	dp_len ;		/* Data Portion Length */

} DXB_MSG_TYPE ;
	
#define MSG_NOP_TYPE 		1
#define MSG_DATA_TYPE		2
#define MSG_CONTROL_DATA_TYPE	3
#define MSG_IOCTL_TYPE		4
#define MSG_OOB_IOCTL_TYPE	5
#define MSG_FLOW_CONTROL_TYPE	6
#define MSG_OPEN_TYPE		8
#define MSG_CLOSE_TYPE		9
#define MSG_OPEN_ACK_TYPE	10
#define MSG_CLOSE_ACK_TYPE	11
#define MSG_KME_READ_REQUEST_TYPE	12
#define MSG_KME_READ_RESPONSE_TYPE	13
#define MSG_KME_WRITE_REQUEST_TYPE	14
#define MSG_KME_WRITE_RESPONSE_TYPE	15

#define	DXB_IOCTL_RESP_IOCACK	0
#define	DXB_IOCTL_RESP_IOCNAK	1

typedef struct msg_nop_s {
	uint8	type ;	/* Set to MSG_NOP_TYPE */ 
	uint8	pad[3]  ;	/* 0 */
}MSG_NOP ;

typedef struct msg_data_s {
	uint8	type ;		/* Set to MSG_DATA_TYPE */
	uint8	chan ;		/* Channel Number */
	uint16	dp_len;		/* Data Length */
} MSG_DATA ;

typedef struct msg_control_data_s {
	uint8	type ;			/* Set to MSG_CONTROL_DATA_TYPE */
	uint8	chan ;			/* Channel Number */
	uint16	priority ;		/* Priority  Low/High (0/1)*/
	uint16	cp_len ;			/* Control Portion Length */
	uint16	dp_len ;	 		/* Data Portion Length  */
} MSG_CONTROL_DATA ;

typedef struct {
	uint8	type ;			/* Set to MSG_IOCTL_TYPE */
	uint8	chan ;			/* Channel Number */
	uint16	pad ;			/* Pad */
	uint16	cp_len ;			/* Control Field  Count */
	uint16	dp_len ;			/* Data Field Count  */
} MSG_IOCTL ;

typedef struct  {
	uint8	type ;			/* Set to MSG_OOB_IOCTL_TYPE */
	uint8	chan ;			/* Channel Number */
	uint16	subtype;			/* Subtype of Command  */
	uint16	cp_len ;			/* Control Portion Length */
	uint16	dp_len ;			/* Data Portion Length */
} MSG_OOB_IOCTL ;

typedef struct msg_flow_control_s {
	uint8	type ;			/* Set to MSG_FLOW_CONTROL_TYPE */
	uint8	chan ;			/* Channel Number */
	uint16	pos_rpt_value  ;		/* Bytes to report */
} MSG_FLOW_CONTROL ;

typedef struct msg_open_s {
	uint8	type ;			/* Set to MSG_OPEN_TYPE */
	uint8	chan ;			/* Channel Number */
	uint16	pad ;
	uint16	cp_len   ;		/* Control Field Count */
	uint16	dp_len ;			/* Data Field Count */
} MSG_OPEN ;

typedef struct msg_close_s {
	uint8	type ;			/* Set to MSG_CLOSE_TYPE */
	uint8	chan ;			/* Channel Number */
	uint16	options  ;		/* Close Options  */
} MSG_CLOSE ;

typedef struct msg_open_ack_s {
	uint8	type ;			/* Set to MSG_OPEN_ACK_TYPE */
	uint8	chan ;			/* Channel Number */
	uint16	value  ;		/* Bytes of response */
} MSG_OPEN_ACK ;


typedef struct msg_close_ack_s {
	uint8	type ;			/* Set to MSG_CLOSE_ACK_TYPE */
	uint8	chan ;			/* Channel Number */
	uint16	pad  ;			/* Reserved  */
} MSG_CLOSE_ACK ;

typedef struct dxb_link_s {
	uint32 error ;
	uint32 rval ;
	uint32 index ;
}DXB_LINK ;

#define	DXB_MAX_CREDITS		0x4650
#define	DXB_MSG_FIXED_COST	64
#define	DXB_MAX_CHANNELS	256
