FreeBSD/Linux Kernel Cross Reference
sys/pc/wavelan.h
1 #define DEBUG if(1){}else print
2
3 #define SEEKEYS 0
4
5 // Lucent's Length-Type-Value records to talk to the wavelan.
6 // most operational parameters are read/set using this.
7 enum
8 {
9 WTyp_Stats = 0xf100,
10 WTyp_Scan = 0xf101,
11 WTyp_Link = 0xf200,
12 WTyp_Ptype = 0xfc00,
13 WTyp_Mac = 0xfc01,
14 WTyp_WantName = 0xfc02,
15 WTyp_Chan = 0xfc03,
16 WTyp_NetName = 0xfc04,
17 WTyp_ApDens = 0xfc06,
18 WTyp_MaxLen = 0xfc07,
19 WTyp_PM = 0xfc09,
20 WTyp_PMWait = 0xfc0c,
21 WTyp_NodeName = 0xfc0e,
22 WTyp_Crypt = 0xfc20,
23 WTyp_XClear = 0xfc22,
24 WTyp_CreateIBSS = 0xfc81,
25 WTyp_RtsThres = 0xfc83,
26 WTyp_TxRate = 0xfc84,
27 WTx1Mbps = 0x0,
28 WTx2Mbps = 0x1,
29 WTxAuto = 0x3,
30 WTyp_Prom = 0xfc85,
31 WTyp_Keys = 0xfcb0,
32 WTyp_TxKey = 0xfcb1,
33 WTyp_StationID = 0xfd20,
34 WTyp_CurName = 0xfd41,
35 WTyp_BaseID = 0xfd42, // ID of the currently connected-to base station
36 WTyp_CurTxRate = 0xfd44, // Current TX rate
37 WTyp_HasCrypt = 0xfd4f,
38 WTyp_Tick = 0xfce0,
39 };
40
41 // Controller
42 enum
43 {
44 WDfltIRQ = 3, // default irq
45 WDfltIOB = 0x180, // default IO base
46
47 WIOLen = 0x40, // Hermes IO length
48
49 WTmOut = 65536, // Cmd time out
50
51 WPTypeManaged = 1,
52 WPTypeWDS = 2,
53 WPTypeAdHoc = 3,
54 WDfltPType = WPTypeManaged,
55
56 WDfltApDens = 1,
57 WDfltRtsThres = 2347, // == disabled
58 WDfltTxRate = WTxAuto, // 2Mbps
59
60 WMaxLen = 2304,
61 WNameLen = 32,
62
63 WNKeys = 4,
64 WKeyLen = 14,
65 WMinKeyLen = 5,
66 WMaxKeyLen = 13,
67
68 // Wavelan hermes registers
69 WR_Cmd = 0x00,
70 WCmdIni = 0x0000,
71 WCmdEna = 0x0001,
72 WCmdDis = 0x0002,
73 WCmdTx = 0x000b,
74 WCmdMalloc = 0x000a,
75 WCmdEnquire = 0x0011,
76 WCmdMsk = 0x003f,
77 WCmdAccRd = 0x0021,
78 WCmdReclaim = 0x0100,
79 WCmdAccWr = 0x0121,
80 WCmdBusy = 0x8000,
81 WR_Parm0 = 0x02,
82 WR_Parm1 = 0x04,
83 WR_Parm2 = 0x06,
84 WR_Sts = 0x08,
85 WR_InfoId = 0x10,
86 WR_Sel0 = 0x18,
87 WR_Sel1 = 0x1a,
88 WR_Off0 = 0x1c,
89 WR_Off1 = 0x1e,
90 WBusyOff = 0x8000,
91 WErrOff = 0x4000,
92 WResSts = 0x7f00,
93 WR_RXId = 0x20,
94 WR_Alloc = 0x22,
95 WR_EvSts = 0x30,
96 WR_IntEna = 0x32,
97 WCmdEv = 0x0010,
98 WRXEv = 0x0001,
99 WTXEv = 0x0002,
100 WTxErrEv = 0x0004,
101 WAllocEv = 0x0008,
102 WInfoEv = 0x0080,
103 WIDropEv = 0x2000,
104 WTickEv = 0x8000,
105 WEvs = WRXEv|WTXEv|WAllocEv|WInfoEv|WIDropEv,
106
107 WR_EvAck = 0x34,
108 WR_Data0 = 0x36,
109 WR_Data1 = 0x38,
110
111 WR_PciCor = 0x26,
112 WR_PciHcr = 0x2E,
113
114 // Frame stuff
115
116 WF_Err = 0x0003,
117 WF_1042 = 0x2000,
118 WF_Tunnel = 0x4000,
119 WF_WMP = 0x6000,
120
121 WF_Data = 0x0008,
122
123 WSnapK1 = 0xaa,
124 WSnapK2 = 0x00,
125 WSnapCtlr = 0x03,
126 WSnap0 = (WSnapK1|(WSnapK1<<8)),
127 WSnap1 = (WSnapK2|(WSnapCtlr<<8)),
128 WSnapHdrLen = 6,
129
130 WF_802_11_Off = 0x44,
131 WF_802_3_Off = 0x2e,
132
133 };
134
135 typedef struct Ctlr Ctlr;
136 typedef struct Wltv Wltv;
137 typedef struct WFrame WFrame;
138 typedef struct Stats Stats;
139 typedef struct WStats WStats;
140 typedef struct WScan WScan;
141 typedef struct WKey WKey;
142
143 struct WStats
144 {
145 ulong ntxuframes; // unicast frames
146 ulong ntxmframes; // multicast frames
147 ulong ntxfrags; // fragments
148 ulong ntxubytes; // unicast bytes
149 ulong ntxmbytes; // multicast bytes
150 ulong ntxdeferred; // deferred transmits
151 ulong ntxsretries; // single retries
152 ulong ntxmultiretries; // multiple retries
153 ulong ntxretrylimit;
154 ulong ntxdiscards;
155 ulong nrxuframes; // unicast frames
156 ulong nrxmframes; // multicast frames
157 ulong nrxfrags; // fragments
158 ulong nrxubytes; // unicast bytes
159 ulong nrxmbytes; // multicast bytes
160 ulong nrxfcserr;
161 ulong nrxdropnobuf;
162 ulong nrxdropnosa;
163 ulong nrxcantdecrypt;
164 ulong nrxmsgfrag;
165 ulong nrxmsgbadfrag;
166 ulong end;
167 };
168
169 struct WScan
170 {
171 ushort chan; /* dss channel */
172 ushort noise; /* average noise in the air */
173 ushort signal; /* signal strength */
174 uchar bssid[Eaddrlen]; /* MAC address of the ap */
175 ushort interval; /* beacon transmit interval */
176 ushort capinfo; /* capability bits (0-ess, 1-ibss, 4-privacy [wep]) */
177 ushort ssid_len; /* ssid length */
178 char ssid[WNameLen]; /* ssid (ap name) */
179 };
180
181 struct WFrame
182 {
183 ushort sts;
184 ushort rsvd0;
185 ushort rsvd1;
186 ushort qinfo;
187 ushort rsvd2;
188 ushort rsvd3;
189 ushort txctl;
190 ushort framectl;
191 ushort id;
192 uchar addr1[Eaddrlen];
193 uchar addr2[Eaddrlen];
194 uchar addr3[Eaddrlen];
195 ushort seqctl;
196 uchar addr4[Eaddrlen];
197 ushort dlen;
198 uchar dstaddr[Eaddrlen];
199 uchar srcaddr[Eaddrlen];
200 ushort len;
201 ushort dat[3];
202 ushort type;
203 };
204
205 struct WKey
206 {
207 ushort len;
208 char dat[WKeyLen];
209 };
210
211 struct Wltv
212 {
213 ushort len;
214 ushort type;
215 union
216 {
217 struct {
218 ushort val;
219 ushort pad;
220 };
221 struct {
222 uchar addr[8];
223 };
224 struct {
225 ushort slen;
226 char s[WNameLen];
227 };
228 struct {
229 char name[WNameLen];
230 };
231 struct {
232 WKey keys[WNKeys];
233 };
234 };
235 };
236
237 // What the driver thinks. Not what the card thinks.
238 struct Stats
239 {
240 ulong nints;
241 ulong ndoubleint;
242 ulong nrx;
243 ulong ntx;
244 ulong ntxrq;
245 ulong nrxerr;
246 ulong ntxerr;
247 ulong nalloc; // allocation (reclaim) events
248 ulong ninfo;
249 ulong nidrop;
250 ulong nwatchdogs; // transmit time outs, actually
251 int ticks;
252 int tickintr;
253 int signal;
254 int noise;
255 };
256
257 enum {
258 Attached = 0x01,
259 Power = 0x02,
260 };
261
262 struct Ctlr
263 {
264 Lock;
265
266 int state; // Attached | Power
267 int slot;
268 int iob;
269 int createibss;
270 int ptype;
271 int apdensity;
272 int rtsthres;
273 int txbusy;
274 int txrate;
275 int txdid;
276 int txmid;
277 int txtmout;
278 int maxlen;
279 int chan;
280 int pmena;
281 int pmwait;
282
283 Proc *timerproc;
284 int scanticks;
285
286 char netname[WNameLen];
287 char wantname[WNameLen];
288 char nodename[WNameLen];
289 WFrame txf;
290 uchar txbuf[1536];
291
292 int hascrypt; // card has encryption
293 int crypt; // encryption off/on
294 int txkey; // transmit key
295 Wltv keys; // default keys
296 int xclear; // exclude clear packets off/on
297
298 int ctlrno;
299
300 ushort *mmb;
301 /* for PCI-based devices */
302 Ctlr *next;
303 int active;
304 Pcidev *pcidev;
305
306 Stats;
307 WStats;
308 };
309
310 extern char* wavenames[];
311
312 void csr_outs(Ctlr*, int, ushort);
313 ushort csr_ins(Ctlr*, int);
314 void w_intdis(Ctlr*);
315 int w_cmd(Ctlr *, ushort, ushort);
316 void ltv_outs(Ctlr*, int, ushort);
317 int ltv_ins(Ctlr*, int);
318 int w_option(Ctlr*, char*, long);
319 int w_inltv(Ctlr*, Wltv*);
320 void w_attach(Ether*);
321 void w_interrupt(Ureg*,void*);
322 void w_transmit(Ether*);
323 long w_ifstat(Ether*, void*, long, ulong);
324 long w_ctl(Ether*, void*, long);
325 void w_promiscuous(void*, int);
326 void w_multicast(void*, uchar*, int);
327 int wavelanreset(Ether*, Ctlr*);
Cache object: b5e326f396bf832288d8b5fbdfc5f6a3
|