xref: /csrg-svn/sys/luna68k/stand/sioreg.h (revision 63199)
157101Sakito /*
257101Sakito  * Copyright (c) 1992 OMRON Corporation.
3*63199Sbostic  * Copyright (c) 1992, 1993
4*63199Sbostic  *	The Regents of the University of California.  All rights reserved.
557101Sakito  *
657101Sakito  * This code is derived from software contributed to Berkeley by
757101Sakito  * OMRON Corporation.
857101Sakito  *
957101Sakito  * %sccs.include.redist.c%
1057101Sakito  *
11*63199Sbostic  *	@(#)sioreg.h	8.1 (Berkeley) 06/10/93
1257101Sakito  */
1357101Sakito 
1457101Sakito /* sioreg.h   NOV-26-1991 */
1557101Sakito 
1657101Sakito struct siodevice {
1757101Sakito 	volatile u_char sio_data;
1857101Sakito 	u_char sio_pad1;
1957101Sakito 	volatile u_char sio_cmd;
2057101Sakito 	u_char sio_pad2;
2157101Sakito };
2257101Sakito 
2357101Sakito #define sio_stat sio_cmd
2457101Sakito 
2557101Sakito #define splsio			spl6
2657101Sakito 
2757101Sakito 
2857101Sakito #define REG(u, r)	( (u << 4) | r )
2957101Sakito #define CHANNEL(r)	( r >> 4 )
3057101Sakito #define REGNO(r)	( r & 0x07 )
3157101Sakito #define isStatusReg(r)	( r & 0x08 )
3257101Sakito 
3357101Sakito #define WR0		0x00
3457101Sakito #define WR1		0x01
3557101Sakito #define WR2		0x02
3657101Sakito #define WR3		0x03
3757101Sakito #define WR4		0x04
3857101Sakito #define WR5		0x05
3957101Sakito #define WR6		0x06
4057101Sakito #define WR7		0x07
4157101Sakito 
4257101Sakito #define WR2A		0x02
4357101Sakito #define WR2B		0x12
4457101Sakito 
4557101Sakito #define RR0		0x08
4657101Sakito #define RR1		0x09
4757101Sakito #define RR2		0x0A
4857101Sakito #define RR3		0x0B
4957101Sakito #define RR4		0x0C
5057101Sakito 
5157101Sakito #define RR2A		0x0A
5257101Sakito #define RR2B		0x1A
5357101Sakito 
5457101Sakito #define WR0_NOP		0x00	/* No Operation */
5557101Sakito #define WR0_SNDABRT	0x08	/* Send Abort (HDLC) */
5657101Sakito #define WR0_RSTINT	0x10	/* Reset External/Status Interrupt */
5757101Sakito #define WR0_CHANRST	0x18	/* Channel Reset */
5857101Sakito #define WR0_INTNXT	0x20	/* Enable Interrupt on Next Receive Character */
5957101Sakito #define WR0_RSTPEND	0x28	/* Reset Transmitter Interrput/DMA Pending */
6057101Sakito #define WR0_ERRRST	0x30	/* Error Reset */
6157101Sakito #define WR0_ENDINTR	0x38	/* End of Interrupt */
6257101Sakito 
6357101Sakito #define WR1_ESENBL	0x01	/* External/Status Interrupt Enable */
6457101Sakito #define WR1_TXENBL	0x02	/* Tx Interrupt/DMA Enable */
6557101Sakito #define WR1_STATVEC	0x04	/* Status Affects Vector (Only Chan-B) */
6657101Sakito #define WR1_RXDSEBL	0x00	/* Rx Interrupt/DMA Disable */
6757101Sakito #define WR1_RXFIRST	0x08	/* Interrupt only First Character Received */
6857101Sakito #define WR1_RXALLS	0x10	/* Interrupt Every Characters Received (with Special Char.) */
6957101Sakito #define WR1_RXALL	0x18	/* Interrupt Every Characters Received (without Special Char.) */
7057101Sakito 
7157101Sakito #define WR2_INTR_0	0x00	/* Interrupt Priority: RxA TxA RxB TxB E/SA E/SA */
7257101Sakito #define WR2_INTR_1	0x04	/* Interrupt Priority: RxA RxB TxA TxB E/SA E/SA */
7357101Sakito #define WR2_VEC85_1	0x00	/* 8085 Vectored Mode - 1 */
7457101Sakito #define WR2_VEC85_2	0x08	/* 8085 Vectored Mode - 2 */
7557101Sakito #define WR2_VEC86	0x10	/* 8086 Vectored */
7657101Sakito #define WR2_VEC85_3	0x18	/* 8085 Vectored Mode - 3 */
7757101Sakito 
7857101Sakito #define WR3_RXENBL	0x01	/* Rx Enable */
7957101Sakito #define WR3_RXCRC	0x08	/* Rx CRC Check */
8057101Sakito #define WR3_AUTOEBL	0x20	/* Auto Enable (flow control for MODEM) */
8157101Sakito #define WR3_RX5BIT	0x00	/* Rx Bits/Character: 5 Bits */
8257101Sakito #define WR3_RX7BIT	0x40	/* Rx Bits/Character: 7 Bits */
8357101Sakito #define WR3_RX6BIT	0x80	/* Rx Bits/Character: 6 Bits */
8457101Sakito #define WR3_RX8BIT	0xc0	/* Rx Bits/Character: 8 Bits */
8557101Sakito 
8657101Sakito #define WR4_NPARITY	0x00	/* No Parity */
8757101Sakito #define WR4_OPARITY	0x01	/* Parity Odd */
8857101Sakito #define WR4_EPARITY	0x02	/* Parity Even */
8957101Sakito #define WR4_STOP1	0x04	/* Stop  Bits (1bit) */
9057101Sakito #define WR4_STOP15	0x08	/* Stop  Bits (1.5bit) */
9157101Sakito #define WR4_STOP2	0x0c	/* Stop  Bits (2bit) */
9257101Sakito #define WR4_BAUD96	0x40	/* Clock Rate (9600 BAUD) */
9357101Sakito #define WR4_BAUD48	0x80	/* Clock Rate (4800 BAUD) */
9457101Sakito #define WR4_BAUD24	0xc0	/* Clock Rate (2400 BAUD) */
9557101Sakito 
9657101Sakito #define WR5_TXCRC	0x01	/* Tx CRC Check */
9757101Sakito #define WR5_REQSND	0x02	/* Request To Send (LOW) */
9857101Sakito #define WR5_TXENBL	0x08	/* Transmit Enable */
9957101Sakito #define WR5_BREAK	0x10	/* Send Break */
10057101Sakito #define WR5_TX5BIT	0x00	/* Tx Bits/Character: 5 Bits */
10157101Sakito #define WR5_TX7BIT	0x20	/* Tx Bits/Character: 7 Bits */
10257101Sakito #define WR5_TX6BIT	0x40	/* Tx Bits/Character: 6 Bits */
10357101Sakito #define WR5_TX8BIT	0x60	/* Tx Bits/Character: 8 Bits */
10457101Sakito 
10557101Sakito #define RR0_RXAVAIL	0x01	/* Rx Character Available */
10657101Sakito #define RR0_INTRPEND	0x02	/* Interrupt Pending (Channel-A Only) */
10757101Sakito #define RR0_TXEMPTY	0x04	/* Tx Buffer Empty */
10857101Sakito #define RR0_BREAK	0x80	/* Break Detected */
10957101Sakito 
11057101Sakito #define RR1_PARITY	0x10	/* Parity Error */
11157101Sakito #define RR1_OVERRUN	0x20	/* Data Over Run */
11257101Sakito #define RR1_FRAMING	0x40	/* Framing Error */
113