11.2Smartin/*	$NetBSD: tms9914reg.h,v 1.2 2008/04/28 20:23:51 martin Exp $	*/
21.1Sgmcgarry
31.1Sgmcgarry/*-
41.1Sgmcgarry * Copyright (c) 2002 The NetBSD Foundation, Inc.
51.1Sgmcgarry * All rights reserved.
61.1Sgmcgarry *
71.1Sgmcgarry * This code is derived from software contributed to The NetBSD Foundation
81.1Sgmcgarry * by Gregory McGarry.
91.1Sgmcgarry *
101.1Sgmcgarry * Redistribution and use in source and binary forms, with or without
111.1Sgmcgarry * modification, are permitted provided that the following conditions
121.1Sgmcgarry * are met:
131.1Sgmcgarry * 1. Redistributions of source code must retain the above copyright
141.1Sgmcgarry *    notice, this list of conditions and the following disclaimer.
151.1Sgmcgarry * 2. Redistributions in binary form must reproduce the above copyright
161.1Sgmcgarry *    notice, this list of conditions and the following disclaimer in the
171.1Sgmcgarry *    documentation and/or other materials provided with the distribution.
181.1Sgmcgarry *
191.1Sgmcgarry * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.1Sgmcgarry * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.1Sgmcgarry * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.1Sgmcgarry * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.1Sgmcgarry * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.1Sgmcgarry * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.1Sgmcgarry * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.1Sgmcgarry * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.1Sgmcgarry * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.1Sgmcgarry * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.1Sgmcgarry * POSSIBILITY OF SUCH DAMAGE.
301.1Sgmcgarry */
311.1Sgmcgarry
321.1Sgmcgarry#define TMS9914_IOSIZE		8
331.1Sgmcgarry
341.1Sgmcgarry/*
351.1Sgmcgarry * Direct-access Registers (write only)
361.1Sgmcgarry */
371.1Sgmcgarry
381.1Sgmcgarry#define TMS9914_IMR0		0	/* (W) interrupt mask 0 */
391.1Sgmcgarry#define 	IMR0_MAC	0x01	/* my address change */
401.1Sgmcgarry#define 	IMR0_RLC	0x02	/* remote/local address change */
411.1Sgmcgarry#define 	IMR0_SPAS	0x04	/* serial poll active state */
421.1Sgmcgarry#define 	IMR0_END	0x08	/* EOI or EOS */
431.1Sgmcgarry#define 	IMR0_BO		0x10	/* byte out */
441.1Sgmcgarry#define 	IMR0_BI		0x20	/* byte in */
451.1Sgmcgarry#define TMS9914_IMR1		1	/* (W) interrupt mask 1 */
461.1Sgmcgarry#define 	IMR1_IFC	0x01	/* IFC asserted */
471.1Sgmcgarry#define		IMR1_SRQ	0x02	/* SRQ asserted */
481.1Sgmcgarry#define		IMR1_MA		0x04	/* my address */
491.1Sgmcgarry#define		IMR1_DCAS	0x08	/* device clear active state */
501.1Sgmcgarry#define		IMR1_APT	0x10	/* address pass-through */
511.1Sgmcgarry#define		IMR1_UCG	0x20	/* unrecognised command */
521.1Sgmcgarry#define		IMR1_ERR	0x40	/* data transmission error */
531.1Sgmcgarry#define		IMR1_GET	0x80	/* group execute trigger */
541.1Sgmcgarry#define TMS9914_AUXCR		3	/* (W) auxiliary command */
551.1Sgmcgarry#define TMS9914_ADDR		4	/* (W) address register */
561.1Sgmcgarry#define 	ADDR_DAT	0x20
571.1Sgmcgarry#define 	ADDR_DAL	0x40
581.1Sgmcgarry#define 	ADDR_EDPA	0x80
591.1Sgmcgarry#define TMS9914_SPMR		5	/* (W) serial poll register */
601.1Sgmcgarry#define TMS9914_PPR		6	/* (W) parallel poll */
611.1Sgmcgarry#define TMS9914_CDOR		7	/* (W) data-out register */
621.1Sgmcgarry
631.1Sgmcgarry/*
641.1Sgmcgarry * Direct-access Registers (read only)
651.1Sgmcgarry */
661.1Sgmcgarry
671.1Sgmcgarry#define TMS9914_ISR0		0	/* (R) interrupt status 0 */
681.1Sgmcgarry#define 	ISR0_MAC	0x01	/* my address change */
691.1Sgmcgarry#define 	ISR0_RLC	0x02	/* remote/local address change */
701.1Sgmcgarry#define 	ISR0_SPAS	0x04	/* serial poll active state */
711.1Sgmcgarry#define 	ISR0_END	0x08	/* EOI or EOS */
721.1Sgmcgarry#define 	ISR0_BO		0x10	/* byte out */
731.1Sgmcgarry#define 	ISR0_BI		0x20	/* byte in */
741.1Sgmcgarry#define TMS9914_ISR1		1	/* (R) interrupt status 1 */
751.1Sgmcgarry#define 	ISR1_IFC	0x01	/* IFC asserted */
761.1Sgmcgarry#define		ISR1_SRQ	0x02	/* SRQ asserted */
771.1Sgmcgarry#define		ISR1_MA		0x04	/* my address */
781.1Sgmcgarry#define		ISR1_DCAS	0x08	/* device clear active state */
791.1Sgmcgarry#define		ISR1_APT	0x10	/* address pass-through */
801.1Sgmcgarry#define		ISR1_UCG	0x20	/* unrecognised command */
811.1Sgmcgarry#define		ISR1_ERR	0x40	/* data transmission error */
821.1Sgmcgarry#define		ISR1_GET	0x80	/* group execute trigger */
831.1Sgmcgarry#define TMS9914_ADSR		2	/* (R) address status */
841.1Sgmcgarry#define 	ADSR_ULPA	0x01	/* store last address LSB */
851.1Sgmcgarry#define 	ADSR_TADS	0x02	/* talker addressed */
861.1Sgmcgarry#define 	ADSR_LADS	0x04	/* listener addressed */
871.1Sgmcgarry#define 	ADSR_TPAS	0x08	/* talker primary address state */
881.1Sgmcgarry#define 	ADSR_LPAS	0x10	/* listener primary address state */
891.1Sgmcgarry#define 	ADSR_ATN	0x20	/* ATN active */
901.1Sgmcgarry#define 	ADSR_LLO	0x40	/* LLO active */
911.1Sgmcgarry#define 	ADSR_REM	0x80	/* REM active */
921.1Sgmcgarry#define TMS9914_CPTR		6	/* (R) command pass-through */
931.1Sgmcgarry#define TMS9914_DIR		7	/* (R) data-in register */
941.1Sgmcgarry
951.1Sgmcgarry/*
961.1Sgmcgarry * Auxiliary Commands
971.1Sgmcgarry *
981.1Sgmcgarry * Two basic type of commands are implemented: pulsed and static.
991.1Sgmcgarry * Static commands enable (set) or disable (clear) chip features.
1001.1Sgmcgarry * Pulsed commands stay active for one clock pulse.
1011.1Sgmcgarry *
1021.1Sgmcgarry */
1031.1Sgmcgarry
1041.1Sgmcgarry/* pulsed commands */
1051.1Sgmcgarry#define	AUXCMD_RHDF	0x02	/* release RFD holdoff */
1061.1Sgmcgarry#define AUXCMD_NBAF	0x05	/* new byte available false */
1071.1Sgmcgarry#define	AUXCMD_SEOI	0x08	/* send EOI with next byte */
1081.1Sgmcgarry#define	AUXCMD_GTS	0x0b	/* go to standby (clear ATN line) */
1091.1Sgmcgarry#define	AUXCMD_TCA	0x0c	/* take control (async) */
1101.1Sgmcgarry#define	AUXCMD_TCS	0x0d	/* take control (sync) */
1111.1Sgmcgarry
1121.1Sgmcgarry/* static commands */
1131.1Sgmcgarry#define AUXCMD_SET	0x80
1141.1Sgmcgarry#define AUXCMD_CLEAR	0x00
1151.1Sgmcgarry#define	AUXCMD_SWRST	0x00	/* Software reset */
1161.1Sgmcgarry#define	AUXCMD_HDFA	0x03	/* holdoff on all data */
1171.1Sgmcgarry#define	AUXCMD_HDFE	0x04	/* holdoff on EOI data only */
1181.1Sgmcgarry#define AUXCMD_RTL	0x07	/* return to local */
1191.1Sgmcgarry#define	AUXCMD_LON	0x09	/* listen only */
1201.1Sgmcgarry#define	AUXCMD_TON	0x0a	/* talk only */
1211.1Sgmcgarry#define	AUXCMD_RPP	0x0e	/* request parallel poll */
1221.1Sgmcgarry#define	AUXCMD_SIC	0x0f	/* IFC (interface clear) line */
1231.1Sgmcgarry#define	AUXCMD_SRE	0x10	/* REN (remote enable) line */
1241.1Sgmcgarry#define	AUXCMD_DAI	0x13	/* interrupt disable */
1251.1Sgmcgarry#define	AUXCMD_STD1	0x15	/* 1200ns T1 delay */
1261.1Sgmcgarry#define	AUXCMD_SHDW	0x16	/* shadow handshake */
1271.1Sgmcgarry#define	AUXCMD_VSTD1	0x17	/* 600ns T1 delay */
128