if_wl.h revision 59874
126003Smsmith/* 226003Smsmith * Redistribution and use in source and binary forms, with or without 326003Smsmith * modification, are permitted provided that the following conditions 426003Smsmith * are met: 526003Smsmith * 1. Redistributions of source code must retain all copyright 626003Smsmith * notices, this list of conditions and the following disclaimer. 726003Smsmith * 2. The names of the authors may not be used to endorse or promote products 826003Smsmith * derived from this software withough specific prior written permission 926003Smsmith * 1026003Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 1126003Smsmith * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1226003Smsmith * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1326003Smsmith * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, 1426003Smsmith * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1526003Smsmith * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1626003Smsmith * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1726003Smsmith * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1826003Smsmith * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 1926003Smsmith * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2026003Smsmith * 2159874Speter * $FreeBSD: head/sys/dev/wl/if_wl.h 59874 2000-05-01 20:32:07Z peter $ 2226003Smsmith */ 2326003Smsmith/* Definitions for WaveLAN driver */ 2426003Smsmith 2526003Smsmith#ifndef _IF_WL_H 2626003Smsmith#define _IF_WL_H 2726003Smsmith 2826003Smsmith#define STATUS_TRIES 15000 2926003Smsmith 3026003Smsmith#define N_FD 100 3126003Smsmith#define N_RBD 100 3226003Smsmith#define N_TBD 72 3326003Smsmith#define RCVBUFSIZE 540 3426003Smsmith#define I82586NULL 0xffff 3526003Smsmith 3626003Smsmith#define DSF_RUNNING 1 3726003Smsmith 3826003Smsmith#define MOD_ENAL 1 3926003Smsmith#define MOD_PROM 2 4026003Smsmith 4126003Smsmithtypedef struct { 4226003Smsmith rbd_t r; 4326003Smsmith char rbd_pad[2]; 4426003Smsmith char rbuffer[RCVBUFSIZE]; 4526003Smsmith} ru_t; 4626003Smsmith 4726003Smsmith/* Board 64k RAM layout. Offsets from 0x0000 */ 4826003Smsmith 4926003Smsmith#define OFFSET_RU 0x0000 /* 0x64 * fd_t = 0x898 */ 5026003Smsmith#define OFFSET_RBD 0x0900 /* 0x64 * ru_t = 0xd7a0 */ 5126003Smsmith#define OFFSET_CU 0xe0a0 /* 0x100 */ 5226003Smsmith#define OFFSET_TBD 0xe1a0 /* 0x48 * tbd_t = 0x240 */ 5326003Smsmith#define OFFSET_TBUF 0xe3e0 /* 0x1bfe */ 5426003Smsmith#define OFFSET_SCB 0xffde /* 0x1 * scb_t = 0x10 */ 5526003Smsmith#define OFFSET_ISCP 0xffee /* 0x1 * iscp_t = 0x8 */ 5626003Smsmith#define OFFSET_SCP 0xfff6 /* 0x1 * scp_t = 0xa */ 5726003Smsmith 5826003Smsmith/* WaveLAN host interface definitions */ 5926003Smsmith 6026003Smsmith#define HACR(base) (base) /* Host Adapter Command Register */ 6126003Smsmith#define HASR(base) (base) /* Host Adapter Status Register */ 6226003Smsmith#define MMCR(base) (base+0x2) /* Modem Management Ctrl Register */ 6326003Smsmith#define PIOR0(base) (base+0x4) /* Program I/O Address Register 0 */ 6426003Smsmith#define PIOP0(base) (base+0x6) /* Program I/O Port 0 */ 6526003Smsmith#define PIOR1(base) (base+0x8) /* Program I/O Address Register 1 */ 6626003Smsmith#define PIOP1(base) (base+0xa) /* Program I/O Port 1 */ 6726003Smsmith#define PIOR2(base) (base+0xc) /* Program I/O Address Register 2 */ 6826003Smsmith#define PIOP2(base) (base+0xe) /* Program I/O Port 2 */ 6926003Smsmith 7026003Smsmith/* Program I/O Mode Register values */ 7126003Smsmith 7226003Smsmith#define STATIC_PIO 0 /* Mode 1: static mode */ 7326003Smsmith#define AUTOINCR_PIO 1 /* Mode 2: auto increment mode */ 7426003Smsmith#define AUTODECR_PIO 2 /* Mode 3: auto decrement mode */ 7526003Smsmith#define PARAM_ACCESS_PIO 3 /* Mode 4: LAN parameter access mode */ 7626003Smsmith#define PIO_MASK 3 /* register mask */ 7726003Smsmith#define PIOM(cmd,piono) ((u_short)cmd << 10 << (piono * 2)) 7826003Smsmith 7926003Smsmith/* Host Adapter status register definitions */ 8026003Smsmith 8126003Smsmith#define HASR_INTR 0x0001 /* Interrupt request from 82586 */ 8226003Smsmith#define HASR_MMC_INTR 0x0002 /* Interrupt request from MMC */ 8326003Smsmith#define HASR_MMC_BUSY 0x0004 /* MMC busy indication */ 8426003Smsmith#define HASR_PARA_BUSY 0x0008 /* LAN parameter storage area busy */ 8526003Smsmith 8626003Smsmith/* Host Adapter command register definitions */ 8726003Smsmith 8826003Smsmith#define HACR_RESET 0x0001 /* Reset board */ 8926003Smsmith#define HACR_CA 0x0002 /* Set Channel Attention for 82586 */ 9026003Smsmith#define HACR_16BITS 0x0004 /* 1==16 bits operation, 0==8 bits */ 9126003Smsmith#define HACR_OUT1 0x0008 /* General purpose output pin */ 9226003Smsmith#define HACR_OUT2 0x0010 /* General purpose output pin */ 9326003Smsmith#define HACR_MASK_82586 0x0020 /* Mask 82586 interrupts, 1==unmask */ 9426003Smsmith#define HACR_MASK_MMC 0x0040 /* Mask MMC interrupts, 1==unmask */ 9526003Smsmith#define HACR_INTR_CLEN 0x0080 /* interrupt status clear enable */ 9626003Smsmith 9726003Smsmith#define HACR_DEFAULT (HACR_OUT1 | HACR_OUT2 | HACR_16BITS | PIOM(STATIC_PIO, 0) | PIOM(AUTOINCR_PIO, 1) | PIOM(PARAM_ACCESS_PIO, 2)) 9826003Smsmith#define HACR_INTRON (HACR_MASK_82586 | HACR_MASK_MMC | HACR_INTR_CLEN) 9926003Smsmith#define CMD(unit) \ 10026003Smsmith { \ 10126003Smsmith outw(HACR(WLSOFTC(unit)->base),WLSOFTC(unit)->hacr); \ 10226003Smsmith /* delay for 50 us, might only be needed sometimes */ \ 10326003Smsmith DELAY(DELAYCONST); \ 10426003Smsmith } 10526003Smsmith 10626003Smsmith/* macro for setting the channel attention bit. No delays here since 10726003Smsmith * it is used in critical sections 10826003Smsmith */ 10926003Smsmith#define SET_CHAN_ATTN(unit) \ 11026003Smsmith { \ 11126003Smsmith outw(HACR(WLSOFTC(unit)->base),WLSOFTC(unit)->hacr | HACR_CA); \ 11226003Smsmith } 11326003Smsmith 11426003Smsmith 11526003Smsmith#define MMC_WRITE(cmd,val) \ 11626003Smsmith while(inw(HASR(WLSOFTC(unit)->base)) & HASR_MMC_BUSY) ; \ 11726003Smsmith outw(MMCR(WLSOFTC(unit)->base), \ 11826003Smsmith (u_short)(((u_short)(val) << 8) | ((cmd) << 1) | 1)) 11926003Smsmith 12041616Seivind#endif /* _IF_WL_H */ 12126003Smsmith 122