/*----------------------------------------------------------------------*/
/* CYCLOM.H - V_2.1.0  03/01/93  					*/
/* Copyright (C) Cyclades Corporation, 1992/1993			*/
/*                                                               	*/
/* This module contains proprietary information of Cyclades Corp.	*/
/* 									*/
/* CYCLOM.H is the header file containing all definitions used in	*/
/* Cyclades library routines.						*/
/*									*/
/*----------------------------------------------------------------------*/

typedef	unsigned char	uchar;
typedef	unsigned short	ushort;
typedef	unsigned int	uint;
typedef	unsigned long	ulong;


/* Control Word settings */

#define MASK_PARITY     0x0200
#define MASK_PAR_CHECK  0x0100
#define MASK_STOP_BITS  0x0040
#define MASK_CHAR_LEN   0x0030
#define MASK_BAUD_RATE  0x000f

#define ODD_PARITY      0x0200
#define EVEN_PARITY     0x0000

#define PAR_CHECK_ON    0x0100
#define PAR_CHECK_OFF   0x0000

#define TWO_STOP_BITS   0x0040
#define ONE_STOP_BIT    0x0000

#define CHAR_5          0x0000
#define CHAR_6          0x0010
#define CHAR_7          0x0020
#define CHAR_8          0x0030

#define BAUD_50         0x0001
#define BAUD_75         0x0002
#define BAUD_110        0x0003
#define BAUD_134        0x0004
#define BAUD_150        0x0005
#define BAUD_200        0x0006
#define BAUD_300        0x0007
#define BAUD_600        0x0008
#define BAUD_1200       0x0009
#define BAUD_1800       0x000a
#define BAUD_2400       0x000b
#define BAUD_4800       0x000c
#define BAUD_9600       0x000d
#define BAUD_19200      0x000e
#define BAUD_38400      0x000f

/* internal defines */

#define FLAG_ON		0xff
#define FLAG_OFF	0x00

/* command for close */

#define	CL_HANGUP		0x51
#define	CL_WAIT			0x52

/* defines for cyclom address */
#define A0 (unsigned char *)0xa0000000L
#define A2 (unsigned char *)0xa2000000L
#define A4 (unsigned char *)0xa4000000L
#define A6 (unsigned char *)0xa6000000L
#define A8 (unsigned char *)0xa8000000L
#define AA (unsigned char *)0xaa000000L
#define AC (unsigned char *)0xac000000L
#define AE (unsigned char *)0xae000000L
#define B0 (unsigned char *)0xb0000000L
#define B2 (unsigned char *)0xb2000000L
#define B4 (unsigned char *)0xb4000000L
#define B6 (unsigned char *)0xb6000000L
#define B8 (unsigned char *)0xb8000000L
#define BA (unsigned char *)0xba000000L
#define BC (unsigned char *)0xbc000000L
#define BE (unsigned char *)0xbe000000L
#define C0 (unsigned char *)0xc0000000L
#define C2 (unsigned char *)0xc2000000L
#define C4 (unsigned char *)0xc4000000L
#define C6 (unsigned char *)0xc6000000L
#define C8 (unsigned char *)0xc8000000L
#define CA (unsigned char *)0xca000000L
#define CC (unsigned char *)0xcc000000L
#define CE (unsigned char *)0xce000000L
#define D0 (unsigned char *)0xd0000000L
#define D2 (unsigned char *)0xd2000000L
#define D4 (unsigned char *)0xd4000000L
#define D6 (unsigned char *)0xd6000000L
#define D8 (unsigned char *)0xd8000000L
#define DA (unsigned char *)0xda000000L
#define DC (unsigned char *)0xdc000000L
#define DE (unsigned char *)0xde000000L
#define E0 (unsigned char *)0xe0000000L
#define E2 (unsigned char *)0xe2000000L
#define E4 (unsigned char *)0xe4000000L
#define E6 (unsigned char *)0xe6000000L
#define E8 (unsigned char *)0xe8000000L
#define EA (unsigned char *)0xea000000L
#define EC (unsigned char *)0xec000000L
#define EE (unsigned char *)0xee000000L

#define IRQ3    0x0003
#define IRQ4	0x0004
#define IRQ5	0x0005
#define IRQ7	0x0007
#define IRQ9	0x0009
#define IRQ10	0x000a
#define IRQ11	0x000b
#define IRQ12	0x000c
#define IRQ15	0x000e

struct ChannelParam {	/* structure to hold the parameters of a channel */
	unsigned short int channel;
	unsigned short int parity;
	unsigned short int parity_check;
	unsigned short int stopbits;
	unsigned short int char_len;
	unsigned short int baudrate;
};


/* library routines prototypes */

int 		Cyc_init(uchar *,ushort);
int 		Cyc_open(struct ChannelParam *);
int 		Cyc_close(ushort,ushort);
int 		Cyc_read_ch(ushort *,uchar *);
int 		Cyc_write_ch(ushort,uchar);
int 		Cyc_write_str(ushort,uchar *);
void		Cyc_curr_settings(ushort,struct ChannelParam *);
void 		Cyc_reset(ushort);

