⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 if_wireg.h

📁 一个学习SNMP项目:tmoerlan.
💻 H
📖 第 1 页 / 共 2 页
字号:
/*  Copyright (c) 2003, Tijmen Moerland (moerland@yahoo.com)*//* * Copyright (c) 1997, 1998, 1999 *	Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *	This product includes software developed by Bill Paul. * 4. Neither the name of the author nor the names of any co-contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/wi/if_wireg.h,v 1.40 2002/10/14 01:59:57 imp Exp $ */#define WI_DELAY	5#define WI_TIMEOUT	(500000/WI_DELAY)	/* 500 ms */#define WI_PORT0	0#define WI_PORT1	1#define WI_PORT2	2#define WI_PORT3	3#define WI_PORT4	4#define WI_PORT5	5#define WI_PCI_LMEMRES	0x10	/* PCI Memory (native PCI implementations) */#define WI_PCI_LOCALRES	0x14	/* The PLX chip's local registers */#define WI_PCI_MEMRES	0x18	/* The PCCard's attribute memory */#define WI_PCI_IORES	0x1C	/* The PCCard's I/O space */#define WI_LOCAL_INTCSR		0x4c#define WI_LOCAL_INTEN		0x40#define WI_HFA384X_SWSUPPORT0_OFF	0x28#define WI_PRISM2STA_MAGIC		0x4A2D#define WI_HFA384X_PCICOR_OFF		0x26/* Default port: 0 (only 0 exists on stations) */#define WI_DEFAULT_PORT	(WI_PORT0 << 8)/* Default TX rate: 2Mbps, auto fallback */#define WI_DEFAULT_TX_RATE	3/* Default network name: ANY *//* * [sommerfeld 1999/07/15] Changed from "ANY" to ""; according to Bill Fenner, * ANY is used in MS driver user interfaces, while "" is used over the * wire.. */#define WI_DEFAULT_NETNAME	""#define WI_DEFAULT_AP_DENSITY	1#define WI_DEFAULT_RTS_THRESH	2347#define WI_DEFAULT_DATALEN	2304#define WI_DEFAULT_CREATE_IBSS	0#define WI_DEFAULT_PM_ENABLED	0#define WI_DEFAULT_MAX_SLEEP	100#define WI_DEFAULT_ROAMING	1#define WI_DEFAULT_AUTHTYPE	1#ifdef __NetBSD__#define OS_STRING_NAME	"NetBSD"#endif#ifdef __FreeBSD__#define OS_STRING_NAME	"FreeBSD"#endif#ifdef __OpenBSD__#define OS_STRING_NAME	"OpenBSD"#endif#define WI_DEFAULT_NODENAME	OS_STRING_NAME " WaveLAN/IEEE node"#define WI_DEFAULT_IBSS		OS_STRING_NAME " IBSS"#define WI_DEFAULT_CHAN		3#define WI_BUS_PCCARD		0	/* pccard device */#define WI_BUS_PCI_PLX		1	/* PCI card w/ PLX PCI/PCMICA bridge */#define WI_BUS_PCI_NATIVE	2	/* native PCI device (Prism 2.5) *//* * register space access macros */#define CSR_WRITE_4(sc, reg, val)				\	bus_space_write_4((sc)->wi_btag, (sc)->wi_bhandle, 	\	    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)#define CSR_WRITE_2(sc, reg, val)				\	bus_space_write_2((sc)->wi_btag, (sc)->wi_bhandle,	\ 	    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)#define CSR_WRITE_1(sc, reg, val)				\	bus_space_write_1((sc)->wi_btag, (sc)->wi_bhandle,	\ 	    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)#define CSR_READ_4(sc, reg)					\	bus_space_read_4((sc)->wi_btag, (sc)->wi_bhandle,	\ 	    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))#define CSR_READ_2(sc, reg)					\	bus_space_read_2((sc)->wi_btag, (sc)->wi_bhandle,	\ 	    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))#define CSR_READ_1(sc, reg)					\	bus_space_read_1((sc)->wi_btag, (sc)->wi_bhandle,	\ 	    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))#define CSM_WRITE_1(sc, off, val)	\	bus_space_write_1((sc)->wi_bmemtag, (sc)->wi_bmemhandle, off, val)#define CSM_READ_1(sc, off)		\	bus_space_read_1((sc)->wi_bmemtag, (sc)->wi_bmemhandle, off)#define CSR_WRITE_STREAM_2(sc, reg, val)	\	bus_space_write_stream_2(sc->wi_btag, sc->wi_bhandle,	\	    (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), val)#define CSR_WRITE_MULTI_STREAM_2(sc, reg, val, count)	\	bus_space_write_multi_stream_2(sc->wi_btag, sc->wi_bhandle,	\	    (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), val, count)#define CSR_READ_STREAM_2(sc, reg)		\	bus_space_read_stream_2(sc->wi_btag, sc->wi_bhandle,	\	    (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)))#define CSR_READ_MULTI_STREAM_2(sc, reg, buf, count)		\	bus_space_read_multi_stream_2(sc->wi_btag, sc->wi_bhandle,	\	    (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), buf, count)/* * The WaveLAN/IEEE cards contain an 802.11 MAC controller which Lucent * calls 'Hermes.' In typical fashion, getting documentation about this * controller is about as easy as squeezing blood from a stone. Here * is more or less what I know: * * - The Hermes controller is firmware driven, and the host interacts *   with the Hermes via a firmware interface, which can change. * * - The Hermes is described in a document called: "Hermes Firmware *   WaveLAN/IEEE Station Functions," document #010245, which of course *   Lucent will not release without an NDA. * * - Lucent has created a library called HCF (Hardware Control Functions) *   though which it wants developers to interact with the card. The HCF *   is needlessly complex, ill conceived and badly documented. Actually, *   the comments in the HCP code itself aren't bad, but the publically *   available manual that comes with it is awful, probably due largely to *   the fact that it has been emasculated in order to hide information *   that Lucent wants to keep proprietary. The purpose of the HCF seems *   to be to insulate the driver programmer from the Hermes itself so that *   Lucent has an excuse not to release programming in for it. * * - Lucent only makes available documentation and code for 'HCF Light' *   which is a stripped down version of HCF with certain features not *   implemented, most notably support for 802.11 frames. * * - The HCF code which I have seen blows goats. Whoever decided to *   use a 132 column format should be shot. * * Rather than actually use the Lucent HCF library, I have stripped all * the useful information from it and used it to create a driver in the * usual BSD form. Note: I don't want to hear anybody whining about the * fact that the Lucent code is GPLed and mine isn't. I did not actually * put any of Lucent's code in this driver: I only used it as a reference * to obtain information about the underlying hardware. The Hermes * programming interface is not GPLed, so bite me. *//* * Size of Hermes & Prism2 I/O space. */#define WI_IOSIZ		0x40/* * Hermes & Prism2 register definitions  *//* Hermes command/status registers. */#define WI_COMMAND		0x00#define WI_PARAM0		0x02#define WI_PARAM1		0x04#define WI_PARAM2		0x06#define WI_STATUS		0x08#define WI_RESP0		0x0A#define WI_RESP1		0x0C#define WI_RESP2		0x0E/* Command register values. */#define WI_CMD_BUSY		0x8000 /* busy bit */#define WI_CMD_INI		0x0000 /* initialize */#define WI_CMD_ENABLE		0x0001 /* enable */#define WI_CMD_DISABLE		0x0002 /* disable */#define WI_CMD_DIAG		0x0003#define WI_CMD_ALLOC_MEM	0x000A /* allocate NIC memory */#define WI_CMD_TX		0x000B /* transmit */#define WI_CMD_NOTIFY		0x0010#define WI_CMD_INQUIRE		0x0011#define WI_CMD_ACCESS		0x0021#define WI_CMD_ACCESS_WRITE	0x0121#define WI_CMD_PROGRAM		0x0022#define WI_CMD_READEE		0x0030	/* symbol only */#define WI_CMD_READMIF		0x0030	/* prism2 */#define WI_CMD_WRITEMIF		0x0031	/* prism2 */#define WI_CMD_DEBUG		0x0038	/* Various test commands */#define WI_CMD_CODE_MASK	0x003F/* * Various cmd test stuff. */#define WI_TEST_MONITOR		0x0B#define WI_TEST_STOP		0x0F#define WI_TEST_CFG_BITS	0x15#define WI_TEST_CFG_BIT_ALC	0x08/* * Reclaim qualifier bit, applicable to the * TX and INQUIRE commands. */#define WI_RECLAIM		0x0100 /* reclaim NIC memory *//* * ACCESS command qualifier bits. */#define WI_ACCESS_READ		0x0000#define WI_ACCESS_WRITE		0x0100/* * PROGRAM command qualifier bits. */#define WI_PROGRAM_DISABLE	0x0000#define WI_PROGRAM_ENABLE_RAM	0x0100#define WI_PROGRAM_ENABLE_NVRAM	0x0200#define WI_PROGRAM_NVRAM	0x0300/* Status register values */#define WI_STAT_CMD_CODE	0x003F#define WI_STAT_DIAG_ERR	0x0100#define WI_STAT_INQ_ERR		0x0500#define WI_STAT_CMD_RESULT	0x7F00/* memory handle management registers */#define WI_INFO_FID		0x10#define WI_RX_FID		0x20#define WI_ALLOC_FID		0x22#define WI_TX_CMP_FID		0x24/* * Buffer Access Path (BAP) registers. * These are I/O channels. I believe you can use each one for * any desired purpose independently of the other. In general * though, we use BAP1 for reading and writing LTV records and * reading received data frames, and BAP0 for writing transmit * frames. This is a convention though, not a rule. */#define WI_SEL0			0x18#define WI_SEL1			0x1A#define WI_OFF0			0x1C#define WI_OFF1			0x1E#define WI_DATA0		0x36#define WI_DATA1		0x38#define WI_BAP0			WI_DATA0#define WI_BAP1			WI_DATA1#define WI_OFF_BUSY		0x8000#define WI_OFF_ERR		0x4000#define WI_OFF_DATAOFF		0x0FFF/* Event registers */#define WI_EVENT_STAT		0x30	/* Event status */#define WI_INT_EN		0x32	/* Interrupt enable/disable */#define WI_EVENT_ACK		0x34	/* Ack event *//* Events */#define WI_EV_TICK		0x8000	/* aux timer tick */#define WI_EV_RES		0x4000	/* controller h/w error (time out) */#define WI_EV_INFO_DROP		0x2000	/* no RAM to build unsolicited frame */#define WI_EV_NO_CARD		0x0800	/* card removed (hunh?) */#define WI_EV_DUIF_RX		0x0400	/* wavelan management packet received */#define WI_EV_INFO		0x0080	/* async info frame */#define WI_EV_CMD		0x0010	/* command completed */#define WI_EV_ALLOC		0x0008	/* async alloc/reclaim completed */#define WI_EV_TX_EXC		0x0004	/* async xmit completed with failure */#define WI_EV_TX		0x0002	/* async xmit completed succesfully */#define WI_EV_RX		0x0001	/* async rx completed */#define WI_INTRS	\	(WI_EV_RX|WI_EV_TX|WI_EV_TX_EXC|WI_EV_ALLOC|WI_EV_INFO|WI_EV_INFO_DROP)/* Host software registers */#define WI_SW0			0x28#define WI_SW1			0x2A#define WI_SW2			0x2C#define WI_SW3			0x2E 	/* does not appear in Prism2 */#define WI_CNTL			0x14#define WI_CNTL_AUX_ENA		0xC000#define WI_CNTL_AUX_ENA_STAT	0xC000#define WI_CNTL_AUX_DIS_STAT	0x0000#define WI_CNTL_AUX_ENA_CNTL	0x8000#define WI_CNTL_AUX_DIS_CNTL	0x4000#define WI_AUX_PAGE		0x3A#define WI_AUX_OFFSET		0x3C#define WI_AUX_DATA		0x3E#define WI_AUX_PGSZ		128#define WI_AUX_KEY0		0xfe01#define WI_AUX_KEY1		0xdc23#define WI_AUX_KEY2		0xba45#define WI_COR			0x40	/* only for Symbol */#define WI_COR_RESET		0x0080#define WI_COR_IOMODE		0x0041#define WI_HCR			0x42	/* only for Symbol */#define WI_HCR_4WIRE		0x0010#define WI_HCR_RUN		0x0007#define WI_HCR_HOLD		0x000f#define WI_HCR_EEHOLD		0x00ce#define WI_COR_OFFSET	0x3e0	/* OK for PCI, must be bogus for pccard */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -