
/************************************************************************/
/*	History								*/
/*	12/30/98	Casper		Modified for linux		*/
/*      07/20/99        Casper          Update for Ver5.1               */
/************************************************************************/


#ifndef _MOXAADM_H
#define _MOXAADM_H

#include	<termio.h>

#define MOXA_VER	"5.1"

/* define for C218/C320 genernal used */
#define C218320_MAXCARD		4
#define C218320_PORTPERCARD	32
#define C218320_MAXPORT 	(C218320_MAXCARD * C218320_PORTPERCARD)
#define C218320_PORTPERBOX	8

#define C218TPCI		1
#define C218TISA		2
#define C320TPCI		3	
#define C320TISA		4	
#define CP204J			5

#define	C218TSERIES		1
#define C320TSERIES		2
#define CP204JSERIES		3

#define C218320_MAXTYPE		5
#define C218320_MAXTUNE		10

/* define genernal used for moxaadm configuraiton */
#define ON		1
#define OFF		0
#define	ENABLE		0
#define	DISABLE		1
#define	NORMALBAUD	1
#define	HIGHBAUD	2
#define INSTALL		1
#define REMOVE		2
#define	REBUILD_C168	1
#define	REBUILD_C218320	2
#define	C168_EXIST	1
#define C218320_EXIST	2

/* define for C218/C320 address */
#define Addr01		0x0C8000L
#define Addr02		0x0CC000L
#define Addr03		0x0D0000L
#define Addr04		0x0D4000L
#define Addr05		0x0D8000L
#define Addr06		0x0DC000L

#define RESP_FAST	0
#define RESP_NORM	1
#define RESP_SLOW	2

#define MAX_TUNE	10	/* must be 0 - 9 */
#define MAX_BANK	10	/* max bank select */

/*
 *	MOXA ioctls
 */
#define	MOXA		0x400
#define MOXA_GET_IQUEUE 	(MOXA + 1)	/* get input buffered count */
#define MOXA_GET_OQUEUE 	(MOXA + 2)	/* get output buffered count */
#define MOXA_INIT_DRIVER	(MOXA + 6)	/* moxaCard=0 */
#define MOXA_LOAD_BIOS		(MOXA + 9)	/* download BIOS */
#define MOXA_FIND_BOARD		(MOXA + 10)	/* Check if MOXA card exist? */
#define MOXA_LOAD_C320B		(MOXA + 11)	/* download 320B firmware */
#define MOXA_LOAD_CODE		(MOXA + 12)	/* download firmware */
#define MOXA_GET_LOG		(MOXA + 23)
#define MOXA_GET_IOQUEUE	(MOXA + 27)
#define MOXA_FLUSH_QUEUE	(MOXA + 28)
#define MOXA_GET_CONF		(MOXA + 35)	/* configuration */
#define MOXA_GET_MAJOR          (MOXA + 62)


/* For PCI Boards Settings */
#define	MAX_PCI_BOARDS	8

typedef	struct	moxa_pci_devinfo {
	ushort	BusNum;
	ushort	DevNum;
} MOXA_PCI_DevInfo;

typedef	struct	_moxa_boards {
	ushort	             NoBoards;
	MOXA_PCI_DevInfo     Pci[MAX_PCI_BOARDS];
	ushort	             BoardType[MAX_PCI_BOARDS];
	ushort	             Irq[MAX_PCI_BOARDS];
	ulong	             IrqAckPort[MAX_PCI_BOARDS];
	ulong	             BaseAddr[MAX_PCI_BOARDS];
} MOXA_PCI_Config;

#define MAGICCODE	0x404

typedef struct _moxa_board_conf {
	int			boardType;
	int			numPorts;
	int			baseAddr;
	int			busType;
	MOXA_PCI_DevInfo	Pci;
} moxa_board_conf;


struct C218320Mon_str {
	int	tick;
	int	rxcnt[C218320_MAXPORT];
	int	txcnt[C218320_MAXPORT];
};
typedef struct	C218320Mon_str	C218320Mon_t;
typedef struct	C218320Mon_str  * f_C218320Mon_t;

#ifndef B921600
#define B921600 (B460800+1)
#endif

#endif
