xref: /netbsd-src/sys/arch/amiga/dev/if_qnreg.h (revision 0cd793449e7320bd895c7da1052d0ad312bdd99b)
1*0cd79344Sjtc /*	$NetBSD: if_qnreg.h,v 1.2 1995/11/30 00:57:04 jtc Exp $	*/
2c6847624Schopps 
3c6847624Schopps /*
4c6847624Schopps  * Copyright (c) 1995 Mika Kortelainen
5c6847624Schopps  * All rights reserved.
6c6847624Schopps  *
7c6847624Schopps  * Redistribution and use in source and binary forms, with or without
8c6847624Schopps  * modification, are permitted provided that the following conditions
9c6847624Schopps  * are met:
10c6847624Schopps  * 1. Redistributions of source code must retain the above copyright
11c6847624Schopps  *    notice, this list of conditions and the following disclaimer.
12c6847624Schopps  * 2. Redistributions in binary form must reproduce the above copyright
13c6847624Schopps  *    notice, this list of conditions and the following disclaimer in the
14c6847624Schopps  *    documentation and/or other materials provided with the distribution.
15c6847624Schopps  * 3. All advertising materials mentioning features or use of this software
16c6847624Schopps  *    must display the following acknowledgement:
17c6847624Schopps  *      This product includes software developed by  Mika Kortelainen
18c6847624Schopps  * 4. The name of the author may not be used to endorse or promote products
19c6847624Schopps  *    derived from this software without specific prior written permission
20c6847624Schopps  *
21c6847624Schopps  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22c6847624Schopps  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23c6847624Schopps  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24c6847624Schopps  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25c6847624Schopps  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26c6847624Schopps  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27c6847624Schopps  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28c6847624Schopps  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29c6847624Schopps  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30c6847624Schopps  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31c6847624Schopps  *
32c6847624Schopps  * Thanks for Aspecs Oy (Finland) for the data book for the NIC used
33c6847624Schopps  * in this card and also many thanks for the Resource Management Force
34c6847624Schopps  * (QuickNet card manufacturer) and especially Daniel Koch for providing
35c6847624Schopps  * me with the necessary 'inside' information to write the driver.
36c6847624Schopps  *
37c6847624Schopps  */
38c6847624Schopps 
39c6847624Schopps /*
40c6847624Schopps  * The QuickNet card uses the Fujitsu's MB86950B NIC (Network Interface
41c6847624Schopps  * Controller) chip, located at card base address + 0xff00. NIC registers
42c6847624Schopps  * are accessible only at even byte addresses, so the register offsets must
43c6847624Schopps  * be multiplied by two. Actually, these registers are read/written as words.
44c6847624Schopps  *
45c6847624Schopps  * As the card doesn't use DMA, data is input/output at FIFO register
46c6847624Schopps  * (base address + 0xff20).  The card has 64K buffer memory and is pretty
47c6847624Schopps  * fast despite the lack of DMA.
48c6847624Schopps  *
49c6847624Schopps  * The FIFO register MUST be accessed as a word (16 bits).
50c6847624Schopps  *
51c6847624Schopps  */
52c6847624Schopps 
53c6847624Schopps #define QUICKNET_NIC_BASE	0xff00
54c6847624Schopps 
55c6847624Schopps 
56c6847624Schopps #define NIC_DLCR0		( 0    ) /* Transmit status */
57c6847624Schopps #define NIC_DLCR1		( 1 * 2) /* Transmit masks  */
58c6847624Schopps #define NIC_DLCR2		( 2 * 2) /* Receive status  */
59c6847624Schopps #define NIC_DLCR3		( 3 * 2) /* Receive masks   */
60c6847624Schopps #define NIC_DLCR4		( 4 * 2) /* Transmit mode   */
61c6847624Schopps #define NIC_DLCR5		( 5 * 2) /* Receive mode    */
62c6847624Schopps #define NIC_DLCR6		( 6 * 2) /* Software reset  */
63c6847624Schopps #define NIC_DLCR7		( 7 * 2) /* TDR (LSB)       */
64c6847624Schopps #define NIC_DLCR8		( 8 * 2) /* Node ID0        */
65c6847624Schopps #define NIC_DLCR9		( 9 * 2) /* Node ID1        */
66c6847624Schopps #define NIC_DLCR10		(10 * 2) /* Node ID2        */
67c6847624Schopps #define NIC_DLCR11		(11 * 2) /* Node ID3        */
68c6847624Schopps #define NIC_DLCR12		(12 * 2) /* Node ID4        */
69c6847624Schopps #define NIC_DLCR13		(13 * 2) /* Node ID5        */
70c6847624Schopps #define NIC_DLCR15		(15 * 2) /* TDR (MSB)       */
71c6847624Schopps #define NIC_BMPR0		(16 * 2) /* Buffer memory port (FIFO) */
72c6847624Schopps #define NIC_BMPR2		(18 * 2) /* Packet length   */
73c6847624Schopps #define NIC_BMPR4		(20 * 2) /* DMA enable      */
74c6847624Schopps 
75c6847624Schopps #define QNET_MAGIC		0x30     /* GAL magic */
76c6847624Schopps 
77c6847624Schopps 
78c6847624Schopps /* DLCR0 - Transmit Status */
79c6847624Schopps #define BUS_WRITE_ERROR		0x0101 /* Bus write error       */
80c6847624Schopps #define T_SIXTEEN_COL		0x0202 /* 16 collision          */
81c6847624Schopps #define T_COL			0x0404 /* Collision             */
82c6847624Schopps #define T_UNDERFLOW		0x0808 /* Underflow             */
83c6847624Schopps #define T_TMT_OK		0x8080 /* Transmit okay         */
84c6847624Schopps #define CLEAR_T_ERR		0x0f0f /* Clear transmit errors */
85c6847624Schopps 
86c6847624Schopps /* DLCR1 - Transmit Interrupt Masks */
87c6847624Schopps #define INT_SIXTEEN_COL		0x0202 /* 16 Collision          */
88c6847624Schopps #define INT_TMT_OK		0x8080 /* Transmit okay         */
89c6847624Schopps #define CLEAR_T_MASK		0x0000 /* Clear transmit interrupt masks */
90c6847624Schopps 
91c6847624Schopps /* DLCR2 - Receive Status */
92c6847624Schopps #define R_BUS_RD_ERR		0x4040 /* Bus read error        */
93c6847624Schopps #define R_PKT_RDY		0x8080 /* Packet ready          */
94c6847624Schopps #define CLEAR_R_ERR		0xcfcf /* Clear receive errors  */
95c6847624Schopps 
96c6847624Schopps /* DLCR3 - Receive Interrupt Masks */
97*0cd79344Sjtc #define R_INT_OVR_FLO		0x0101 /* Receive buf overflow  */
98*0cd79344Sjtc #define R_INT_CRC_ERR		0x0202 /* CRC error             */
99*0cd79344Sjtc #define R_INT_ALG_ERR		0x0404 /* Alignment error       */
100*0cd79344Sjtc #define R_INT_SRT_PKT		0x0808 /* Short packet          */
101c6847624Schopps #define R_INT_PKT_RDY		0x8080 /* Packet ready          */
102c6847624Schopps #define CLEAR_R_MASK		0x0000 /* Clear receive intr masks */
103c6847624Schopps 
104c6847624Schopps /* DLCR4 - Transmit Mode */
105c6847624Schopps #define NO_LOOPBACK		0x0202 /* Loopback control      */
106c6847624Schopps 
107c6847624Schopps /* DLCR5 - Receive Mode */
108*0cd79344Sjtc /* Normal mode: accept physical address, multicast group addresses
109c6847624Schopps  * which match the 1st three bytes and broadcast address.
110c6847624Schopps  */
111c6847624Schopps #define NORMAL_MODE		0x0101
112c6847624Schopps #define PROMISCUOUS_MODE	0x0303 /* Accept all packets    */
113c6847624Schopps #define RM_BUF_EMP		0x4040 /* Buffer empty          */
114c6847624Schopps 
115c6847624Schopps /* DLCR6 - Enable Data Link Controller */
116c6847624Schopps #define DISABLE_DLC		0x8080 /* Disable data link controller */
117c6847624Schopps #define ENABLE_DLC		0x0000 /* Enable data link controller  */
118c6847624Schopps 
119c6847624Schopps /* DLCR8:DLCR13 - Node ID Registers */
120c6847624Schopps #define QNET_HARDWARE_ADDRESS	NIC_DLCR8
121c6847624Schopps 
122c6847624Schopps /* BMPR3:BMPR2 - Packet Length Registers (Write-only) */
123c6847624Schopps #define TRANSMIT_START		0x0080
124