/*
 * Copyright (c) 1997, Sun Microsystems, Inc.  All Rights Reserved.
 */

#pragma ident "@(#)serial.h 1.3       98/02/12 SMI"

/* ---- ports on 16550 serial chips ---- */
#define DAT	0	/* ... data */
#define ICR	1	/* ... intr control reg */
#define ISR	2	/* ... intr status reg */
#define LCR	3	/* ... line control reg */
#define MCR	4	/* ... modem control reg */
#define LSR	5	/* ... line status reg */
#define MSR	6	/* ... modem status reg */
#define DLL	0	/* ... data latch low (used for baud rate) */
#define DLH	1	/* ... data latch high (ditto) */
#define FIFOR	ISR	/* ... fifo write reg */

/* ---- convenant macros ---- */
/* this macro uses the _chario_io_p structure */
#define INB(a, off) \
	(inb((a) + off))
#define OUTB(a, off, val) \
	(outb((a)+(off), (char)(val)))

/* ---- LSR bits ---- */
#define RCA		0x01	/* ... receive char avail */
#define XHRE		0x20	/* ... xmit hold buffer empty */

/* ---- Modem bits ---- */
#define DTR		0x01
#define RTS		0x02
#define OUT2		0x08

#define FIFO_ON		0x01
#define FIFO_OFF	0x00
#define FIFORXFLSH	0x02
#define FIFOTXFLSH	0x04
#define FIFODMA		0x08

/* ---- LCR bits ---- */
#define STOP1		00
#define	STOP2   	0x04
#define	BITS5		0x00	/* 5 bits per char */
#define	BITS6		0x01	/* 6 bits per char */
#define	BITS7		0x02	/* 7 bits per char */
#define	BITS8		0x03	/* 8 bits per char */

/* baud rate definitions */
#define	DLAB		0x80	/* divisor latch access bit */
#define	ASY110		1047	/* 110 baud rate for serial console */
#define	ASY150		768	/* 150 baud rate for serial console */
#define	ASY300		384	/* 300 baud rate for serial console */
#define	ASY600		192	/* 600 baud rate for serial console */
#define	ASY1200		96	/* 1200 baud rate for serial console */
#define	ASY2400		48	/* 2400 baud rate for serial console */
#define	ASY4800		24	/* 4800 baud rate for serial console */
#define	ASY9600		12	/* 9600 baud rate for serial console */
#define	ASY19200	6	/* 19200 baud rate for serial console */
#define	ASY38400	3	/* 38400 baud rate for serial console */
#define	ASY57600	2	/* 57600 baud rate for serial console */
#define	ASY115200	1	/* 115200 baud rate for serial console */
