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