150477Speter/* $FreeBSD: releng/10.2/sys/i386/include/if_wl_wavelan.h 139790 2005-01-06 22:18:23Z imp $ */ 2139790Simp/*- 326003Smsmith * Redistribution and use in source and binary forms, with or without 426003Smsmith * modification, are permitted provided that the following conditions 526003Smsmith * are met: 626003Smsmith * 1. Redistributions of source code must retain all copyright 726003Smsmith * notices, this list of conditions and the following disclaimer. 826003Smsmith * 2. The names of the authors may not be used to endorse or promote products 997748Sschweikh * derived from this software without specific prior written permission 1026003Smsmith * 1126003Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 1226003Smsmith * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1326003Smsmith * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1426003Smsmith * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, 1526003Smsmith * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1626003Smsmith * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1726003Smsmith * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1826003Smsmith * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1926003Smsmith * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2026003Smsmith * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2126003Smsmith * 2226003Smsmith */ 2326003Smsmith#ifndef _CHIPS_WAVELAN_H 2426003Smsmith#define _CHIPS_WAVELAN_H 2526003Smsmith 2626003Smsmith/* This file contains definitions that are common for all versions of 2726003Smsmith * the NCR WaveLAN 2826003Smsmith */ 2926003Smsmith 3026003Smsmith#define WAVELAN_ADDR_SIZE 6 /* Size of a MAC address */ 3126003Smsmith#define WAVELAN_MTU 1500 /* Maximum size of Wavelan packet */ 3226003Smsmith 3326003Smsmith/* Modem Management Controler write commands */ 3427816Smsmith#define MMC_ENCR_KEY 0x00 /* to 0x07 */ 3527816Smsmith#define MMC_ENCR_ENABLE 0x08 3627816Smsmith#define MMC_DES_IO_INVERT 0x0a 3726003Smsmith#define MMC_LOOPT_SEL 0x10 3826003Smsmith#define MMC_JABBER_ENABLE 0x11 3926003Smsmith#define MMC_FREEZE 0x12 4026003Smsmith#define MMC_ANTEN_SEL 0x13 4126003Smsmith#define MMC_IFS 0x14 4226003Smsmith#define MMC_MOD_DELAY 0x15 4326003Smsmith#define MMC_JAM_TIME 0x16 4426003Smsmith#define MMC_THR_PRE_SET 0x18 4526003Smsmith#define MMC_DECAY_PRM 0x19 4626003Smsmith#define MMC_DECAY_UPDAT_PRM 0x1a 4726003Smsmith#define MMC_QUALITY_THR 0x1b 4826003Smsmith#define MMC_NETW_ID_L 0x1c 4926003Smsmith#define MMC_NETW_ID_H 0x1d 5026003Smsmith#define MMC_MODE_SEL 0x1e 5127816Smsmith#define MMC_EECTRL 0x20 /* 2.4 Gz */ 5227816Smsmith#define MMC_EEADDR 0x21 /* 2.4 Gz */ 5327816Smsmith#define MMC_EEDATAL 0x22 /* 2.4 Gz */ 5427816Smsmith#define MMC_EEDATAH 0x23 /* 2.4 Gz */ 5527816Smsmith#define MMC_ANALCTRL 0x24 /* 2.4 Gz */ 5626003Smsmith 5727816Smsmith/* fields in MMC registers that relate to EEPROM in WaveMODEM daughtercard */ 5827816Smsmith#define MMC_EECTRL_EEPRE 0x10 /* 2.4 Gz EEPROM Protect Reg Enable */ 5927816Smsmith#define MMC_EECTRL_DWLD 0x08 /* 2.4 Gz EEPROM Download Synths */ 6027816Smsmith#define MMC_EECTRL_EEOP 0x07 /* 2.4 Gz EEPROM Opcode mask */ 6127816Smsmith#define MMC_EECTRL_EEOP_READ 0x06 /* 2.4 Gz EEPROM Read Opcode */ 6227816Smsmith#define MMC_EEADDR_CHAN 0xf0 /* 2.4 Gz EEPROM Channel # mask */ 6327816Smsmith#define MMC_EEADDR_WDCNT 0x0f /* 2.4 Gz EEPROM DNLD WordCount-1 */ 6427816Smsmith#define MMC_ANALCTRL_ANTPOL 0x02 /* 2.4 Gz Antenna Polarity mask */ 6527816Smsmith#define MMC_ANALCTRL_EXTANT 0x01 /* 2.4 Gz External Antenna mask */ 6627816Smsmith 6726003Smsmith/* MMC read register names */ 6826003Smsmith#define MMC_DCE_STATUS 0x10 6926003Smsmith#define MMC_CORRECT_NWID_L 0x14 7026003Smsmith#define MMC_CORRECT_NWID_H 0x15 7126003Smsmith#define MMC_WRONG_NWID_L 0x16 7226003Smsmith#define MMC_WRONG_NWID_H 0x17 7326003Smsmith#define MMC_THR_PRE_SET 0x18 7426003Smsmith#define MMC_SIGNAL_LVL 0x19 7526003Smsmith#define MMC_SILENCE_LVL 0x1a 7626003Smsmith#define MMC_SIGN_QUAL 0x1b 7726003Smsmith#define MMC_DES_AVAIL 0x09 7827816Smsmith#define MMC_EECTRLstat 0x20 /* 2.4 Gz EEPROM r/w/dwld status */ 7927816Smsmith#define MMC_EEDATALrv 0x22 /* 2.4 Gz EEPROM read value */ 8027816Smsmith#define MMC_EEDATAHrv 0x23 /* 2.4 Gz EEPROM read value */ 8126003Smsmith 8227816Smsmith/* fields in MMC registers that relate to EEPROM in WaveMODEM daughtercard */ 8327816Smsmith#define MMC_EECTRLstat_ID24 0xf0 /* 2.4 Gz =A0 rev-A, =B0 rev-B */ 8427816Smsmith#define MMC_EECTRLstat_DWLD 0x08 /* 2.4 Gz Synth/Tx-Pwr DWLD busy */ 8527816Smsmith#define MMC_EECTRLstat_EEBUSY 0x04 /* 2.4 Gz EEPROM busy */ 8626003Smsmith 8726003Smsmith/* additional socket ioctl params for wl card 8826003Smsmith * see sys/sockio.h for numbers. The 2nd params here 8926003Smsmith * must be greater than any values in sockio.h 9026003Smsmith */ 9126003Smsmith 9226003Smsmith#define SIOCGWLCNWID _IOWR('i', 60, struct ifreq) /* get wlan current nwid */ 9326003Smsmith#define SIOCSWLCNWID _IOWR('i', 61, struct ifreq) /* set wlan current nwid */ 9426003Smsmith#define SIOCGWLPSA _IOWR('i', 62, struct ifreq) /* get wlan PSA (all) */ 9526003Smsmith#define SIOCSWLPSA _IOWR('i', 63, struct ifreq) /* set wlan PSA (all) */ 9627816Smsmith#define SIOCDWLCACHE _IOW('i', 64, struct ifreq) /* clear SNR cache */ 9727816Smsmith#define SIOCSWLTHR _IOW('i', 65, struct ifreq) /* set new quality threshold */ 9827816Smsmith#define SIOCGWLEEPROM _IOWR('i', 66, struct ifreq) /* get modem EEPROM */ 9927816Smsmith#define SIOCGWLCACHE _IOWR('i', 67, struct ifreq) /* get SNR cache */ 10027816Smsmith#define SIOCGWLCITEM _IOWR('i', 68, struct ifreq) /* get cache element count */ 10126003Smsmith 10226003Smsmith/* PSA address definitions */ 10326003Smsmith#define WLPSA_ID 0x0 /* ID byte (0 for ISA, 0x14 for MCA) */ 10426003Smsmith#define WLPSA_IO1 0x1 /* I/O address 1 */ 10526003Smsmith#define WLPSA_IO2 0x2 /* I/O address 2 */ 10626003Smsmith#define WLPSA_IO3 0x3 /* I/O address 3 */ 10726003Smsmith#define WLPSA_BR1 0x4 /* Bootrom address 1 */ 10826003Smsmith#define WLPSA_BR2 0x5 /* Bootrom address 2 */ 10926003Smsmith#define WLPSA_BR3 0x6 /* Bootrom address 3 */ 11026003Smsmith#define WLPSA_HWCONF 0x7 /* HW config bits */ 11126003Smsmith#define WLPSA_IRQNO 0x8 /* IRQ value */ 11226003Smsmith#define WLPSA_UNIMAC 0x10 /* Universal MAC address */ 11326003Smsmith#define WLPSA_LOCALMAC 0x16 /* Locally configured MAC address */ 11426003Smsmith#define WLPSA_MACSEL 0x1c /* MAC selector */ 11572093Sasmodai#define WLPSA_COMPATNO 0x1d /* compatibility number */ 11626003Smsmith#define WLPSA_THRESH 0x1e /* RF modem threshold preset */ 11726003Smsmith#define WLPSA_FEATSEL 0x1f /* feature select */ 11826003Smsmith#define WLPSA_SUBBAND 0x20 /* subband selector */ 11926003Smsmith#define WLPSA_QUALTHRESH 0x21 /* RF modem quality threshold preset */ 12026003Smsmith#define WLPSA_HWVERSION 0x22 /* hardware version indicator */ 12126003Smsmith#define WLPSA_NWID 0x23 /* network ID */ 12226003Smsmith#define WLPSA_NWIDENABLE 0x24 /* network ID enable */ 12326003Smsmith#define WLPSA_SECURITY 0x25 /* datalink security enable */ 12426003Smsmith#define WLPSA_DESKEY 0x26 /* datalink security DES key */ 12526003Smsmith#define WLPSA_DBWIDTH 0x2f /* databus width select */ 12626003Smsmith#define WLPSA_CALLCODE 0x30 /* call code (japan only) */ 12726003Smsmith#define WLPSA_CONFIGURED 0x3c /* configuration status */ 12826003Smsmith#define WLPSA_CRCLOW 0x3d /* CRC-16 (lowbyte) */ 12926003Smsmith#define WLPSA_CRCHIGH 0x3e /* (highbyte) */ 13026003Smsmith#define WLPSA_CRCOK 0x3f /* CRC OK flag */ 13126003Smsmith 13227816Smsmith#define WLPSA_COMPATNO_WL24B 0x04 /* 2.4 Gz WaveMODEM ISA rev-B */ 13327816Smsmith 13426003Smsmith/* 13526003Smsmith * signal strength cache 13626003Smsmith * 13726003Smsmith * driver (wlp only at the moment) keeps cache of last 13826003Smsmith * IP (only) packets to arrive including signal strength info. 13926003Smsmith * daemons may read this with kvm. See if_wlp.c for globals 14026003Smsmith * that may be accessed through kvm. 14126003Smsmith * 14226003Smsmith * Each entry in the w_sigcache has a unique macsrc and age. 14326003Smsmith * Each entry is identified by its macsrc field. 14426003Smsmith * Age of the packet is identified by its age field. 14526003Smsmith */ 14626003Smsmith 14726003Smsmith#define MAXCACHEITEMS 10 14826003Smsmith#ifndef INT_MAX 14926003Smsmith#define INT_MAX 2147483647 15026003Smsmith#endif 15126003Smsmith#define MAX_AGE (INT_MAX - MAXCACHEITEMS) 15226003Smsmith 15326003Smsmith/* signal is 7 bits, 0..63, although it doesn't seem to get to 63. 15426003Smsmith * silence is 7 bits, 0..63 15526003Smsmith * quality is 4 bits, 0..15 15626003Smsmith */ 15726003Smsmithstruct w_sigcache { 15826003Smsmith char macsrc[6]; /* unique MAC address for entry */ 15926003Smsmith int ipsrc; /* ip address associated with packet */ 16026003Smsmith int signal; /* signal strength of the packet */ 16126003Smsmith int silence; /* silence of the packet */ 16226003Smsmith int quality; /* quality of the packet */ 16327816Smsmith int snr; /* packet has unique age between 1 to MAX_AGE - 1 */ 16426003Smsmith}; 16526003Smsmith 16633046Sbde#endif /* _CHIPS_WAVELAN_H */ 16733046Sbde 168