xref: /netbsd-src/sys/dev/pcmcia/if_cnwreg.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /*	$NetBSD: if_cnwreg.h,v 1.6 2008/04/28 20:23:56 martin Exp $	*/
2512db612Schristos 
3512db612Schristos /*-
4512db612Schristos  * Copyright (c) 1998 The NetBSD Foundation, Inc.
5512db612Schristos  * All rights reserved.
6512db612Schristos  *
7512db612Schristos  * This code is derived from software contributed to The NetBSD Foundation
8512db612Schristos  * by Michael Eriksson.
9512db612Schristos  *
10512db612Schristos  * Redistribution and use in source and binary forms, with or without
11512db612Schristos  * modification, are permitted provided that the following conditions
12512db612Schristos  * are met:
13512db612Schristos  * 1. Redistributions of source code must retain the above copyright
14512db612Schristos  *    notice, this list of conditions and the following disclaimer.
15512db612Schristos  * 2. Redistributions in binary form must reproduce the above copyright
16512db612Schristos  *    notice, this list of conditions and the following disclaimer in the
17512db612Schristos  *    documentation and/or other materials provided with the distribution.
18512db612Schristos  *
19512db612Schristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20512db612Schristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21512db612Schristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22512db612Schristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23512db612Schristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24512db612Schristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25512db612Schristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26512db612Schristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27512db612Schristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28512db612Schristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29512db612Schristos  * POSSIBILITY OF SUCH DAMAGE.
30512db612Schristos  */
31512db612Schristos 
32512db612Schristos 
33512db612Schristos /* I/O area */
34512db612Schristos #define CNW_IO_SIZE		0x10
355f1c4bb5Sitojun /* I/O area can be accessed via mapped memory too */
365f1c4bb5Sitojun #define CNW_IOM_ADDR		0x28000
375f1c4bb5Sitojun #define CNW_IOM_SIZE		CNW_IO_SIZE
385f1c4bb5Sitojun #define CNW_IOM_OFF		(CNW_IOM_ADDR - CNW_MEM_ADDR)
39512db612Schristos 
40512db612Schristos /* I/O registers */
41512db612Schristos #define CNW_REG_COR		0x0
42512db612Schristos #    define CNW_COR_IENA		0x01	/* Interrupt enable */
43512db612Schristos #    define CNW_COR_LVLREQ		0x40	/* Keep high */
44512db612Schristos #define CNW_REG_CCSR		0x2
45512db612Schristos #define CNW_REG_ASR		0x4
46512db612Schristos #    define CNW_ASR_TXBA		0x01	/* Trasmit buffer available */
47512db612Schristos #    define CNW_ASR_WOC			0x08	/* Write Operation Complete */
48512db612Schristos #    define CNW_ASR_TXDN		0x20	/* Transmit done */
49512db612Schristos #    define CNW_ASR_RXERR		0x40	/* Receive error */
50512db612Schristos #    define CNW_ASR_RXRDY		0x80	/* Packet received */
51512db612Schristos #define CNW_REG_IOLOW		0x6
52512db612Schristos #define CNW_REG_IOHI		0x7
53512db612Schristos #define CNW_REG_IOCONTROL	0x8
54512db612Schristos #define CNW_REG_IMR		0xa
55512db612Schristos #    define CNW_IMR_IENA		0x02	/* Interrupt enable */
56512db612Schristos #    define CNW_IMR_RFU1		0x10	/* RFU intr mask, keep high */
57512db612Schristos #define CNW_REG_PMR		0xc
58512db612Schristos #    define CNW_PMR_RESET		0x80
59512db612Schristos #define CNW_REG_DATA		0xf
60512db612Schristos 
61512db612Schristos 
62512db612Schristos /* Mapped memory */
63512db612Schristos #define CNW_MEM_ADDR		0x20000
64512db612Schristos #define CNW_MEM_SIZE		0x8000
65512db612Schristos 
66512db612Schristos /* Extended I/O registers (memory mapped) */
67512db612Schristos #define CNW_EREG_CB		0x100
68512db612Schristos #define CNW_EREG_ASCC		0x114
69512db612Schristos #define CNW_EREG_RSER		0x120
70512db612Schristos #    define CNW_RSER_RXBIG		0x02
71512db612Schristos #    define CNW_RSER_RXCRC		0x04
721b6504a1Sitojun #    define CNW_RSER_RXOVERRUN		0x08
731b6504a1Sitojun #    define CNW_RSER_RXOVERFLOW		0x10
74512db612Schristos #    define CNW_RSER_RXERR		0x40
75512db612Schristos #    define CNW_RSER_RXAVAIL		0x80
76512db612Schristos #define CNW_EREG_RSERW		0x124
77512db612Schristos #define CNW_EREG_TSER		0x130
78512db612Schristos #    define CNW_TSER_RTRY		0x0f
79512db612Schristos #    define CNW_TSER_TXERR		0x10
80512db612Schristos #    define CNW_TSER_TXOK		0x20
81512db612Schristos #    define CNW_TSER_TXNOAP		0x40
82512db612Schristos #    define CNW_TSER_TXGU		0x80
83512db612Schristos #    define CNW_TSER_ERROR		(CNW_TSER_TXERR | CNW_TSER_TXNOAP | \
84512db612Schristos 					 CNW_TSER_TXGU)
85512db612Schristos #define CNW_EREG_TSERW		0x134
86512db612Schristos #define CNW_EREG_TDP		0x140
87512db612Schristos #define CNW_EREG_LIF		0x14e
88512db612Schristos #define CNW_EREG_RDP		0x150
89512db612Schristos #define CNW_EREG_SPCQ		0x154
90512db612Schristos #define CNW_EREG_SPU		0x155
91512db612Schristos #define CNW_EREG_ISPLQ		0x156
92512db612Schristos #define CNW_EREG_HHC		0x158
93512db612Schristos #define CNW_EREG_PA		0x160
94512db612Schristos #define CNW_EREG_ARW		0x166
95512db612Schristos #define CNW_EREG_MHS		0x16b
96512db612Schristos #define CNW_EREG_NI		0x16e
97512db612Schristos #define CNW_EREG_CRBP		0x17a
98512db612Schristos #define CNW_EREG_EC		0x180
991b6504a1Sitojun #define CNW_EREG_STAT_RXERR	0x184
1001b6504a1Sitojun #define CNW_EREG_STAT_FRAME	0x186
1011b6504a1Sitojun #define CNW_EREG_STAT_IBEAT	0x188
1021b6504a1Sitojun #define CNW_EREG_STAT_RXBUF	0x18e
1031b6504a1Sitojun #define CNW_EREG_STAT_RXMULTI	0x190
1041b6504a1Sitojun #define CNW_EREG_STAT_TXRETRY	0x192
1051b6504a1Sitojun #define CNW_EREG_STAT_TXABORT	0x194
1061b6504a1Sitojun #define CNW_EREG_STAT_OBEAT	0x198
1071b6504a1Sitojun #define CNW_EREG_STAT_TXOK	0x19a
1081b6504a1Sitojun #define CNW_EREG_STAT_TXSENT	0x19c
109512db612Schristos 
110512db612Schristos /*
111512db612Schristos  * Commands used in the extended command buffer
112512db612Schristos  * CNW_EREG_CB (0x100-0x10f)
113512db612Schristos  */
114512db612Schristos #define CNW_CMD_NOP		0x00
115512db612Schristos #define CNW_CMD_SRC		0x01
116512db612Schristos #    define CNW_RXCONF_RXENA		0x80	/* Receive Enable */
117512db612Schristos #    define CNW_RXCONF_MAC		0x20	/* MAC host receive mode */
118512db612Schristos #    define CNW_RXCONF_PRO		0x10	/* Promiscuous */
119512db612Schristos #    define CNW_RXCONF_AMP		0x08	/* Accept Multicast Packets */
120512db612Schristos #    define CNW_RXCONF_BCAST		0x04	/* Accept Broadcast Packets */
121512db612Schristos #define CNW_CMD_STC		0x02
122512db612Schristos #    define CNW_TXCONF_TXENA		0x80	/* Transmit Enable */
123512db612Schristos #    define CNW_TXCONF_MAC		0x20	/* Host sends MAC mode */
124512db612Schristos #    define CNW_TXCONF_EUD		0x10	/* Enable Uni-Data packets */
125512db612Schristos #    define CNW_TXCONF_KEY		0x02	/* Scramble data packets */
126512db612Schristos #    define CNW_TXCONF_LOOP		0x01	/* Loopback mode */
127512db612Schristos #define CNW_CMD_AMA		0x03
128512db612Schristos #define CNW_CMD_DMA		0x04
129512db612Schristos #define CNW_CMD_SAMA		0x05
130512db612Schristos #define CNW_CMD_ER		0x06
131512db612Schristos #define CNW_CMD_DR		0x07
132512db612Schristos #define CNW_CMD_TL		0x08
133512db612Schristos #define CNW_CMD_SRP		0x09
134512db612Schristos #define CNW_CMD_SSK		0x0a
135512db612Schristos #define CNW_CMD_SMD		0x0b
136512db612Schristos #define CNW_CMD_SAPD		0x0c
137512db612Schristos #define CNW_CMD_SSS		0x11
138512db612Schristos #define CNW_CMD_EOC		0x00		/* End-of-command marker */
139512db612Schristos 
140