1 /*
2  *	 Aironet 4500 Pcmcia driver
3  *
4  *		Elmer Joandi, Januar 1999
5  *	Copyright:	GPL
6  *
7  *
8  *	Revision 0.1 ,started  30.12.1998
9  *
10  *
11  */
12 
13 
14 #ifndef AIRONET4500_H
15 #define	AIRONET4500_H
16 // redefined to avoid PCMCIA includes
17 
18  #include <linux/version.h>
19 /*#include <linux/module.h>
20  #include <linux/kernel.h>
21 */
22 
23 /*
24 #include <linux/types.h>
25 #include <linux/netdevice.h>
26 #include <linux/etherdevice.h>
27 #include <linux/delay.h>
28 #include <linux/time.h>
29 */
30 #include <linux/802_11.h>
31 
32 //damn idiot PCMCIA stuff
33 #ifndef DEV_NAME_LEN
34 	#define DEV_NAME_LEN 32
35 #endif
36 
37 struct pcmcia_junkdev_node_t {
38     char		dev_name[DEV_NAME_LEN];
39     u_short		major, minor;
40     struct dev_node_t	*next;
41 };
42 
43 #ifndef CS_RELEASE
44 typedef struct pcmcia_junkdev_node_t dev_node_t;
45 #endif
46 
47 
48 
49 #include <linux/spinlock.h>
50 
51 
52 #define AWC_ERROR	-1
53 #define AWC_SUCCESS	0
54 
55 struct awc_cis {
56 	unsigned char cis[0x301];
57 	unsigned char unknown302[0xdf];
58 	unsigned short configuration_register;
59 	unsigned short pin_replacement_register;
60 	unsigned short socket_and_copy_register;
61 
62 };
63 
64 
65 /* timeout for transmit watchdog timer, AP default is 8 sec */
66 #define AWC_TX_TIMEOUT			(HZ * 8)
67 
68 
69 
70 /***************************  REGISTER OFFSETS *********************/
71 #define awc_Command_register 		0x00
72 #define awc_Param0_register 		0x02
73 #define awc_Param1_register 		0x04
74 #define awc_Param2_register 		0x06
75 #define awc_Status_register 		0x08
76 #define awc_Resp0_register 		0x0A
77 #define awc_Resp1_register 		0x0C
78 #define awc_Resp2_register 		0x0E
79 #define awc_EvStat_register 		0x30
80 #define awc_EvIntEn_register 		0x32
81 #define awc_EvAck_register 		0x34
82 #define awc_SWSupport0_register 	0x28
83 #define awc_SWSupport1_register 	0x2A
84 #define awc_SWSupport2_register 	0x2C
85 #define awc_SWSupport3_register 	0x2E
86 #define awc_LinkStatus_register 	0x10
87 // Memory access  RID FID
88 #define awc_Select0_register 		0x18
89 #define awc_Offset0_register 		0x1C
90 #define awc_Data0_register 		0x36
91 #define awc_Select1_register 		0x1A
92 #define awc_Offset1_register 		0x1E
93 #define awc_Data1_register 		0x38
94 //
95 #define awc_RxFID_register 		0x20
96 #define awc_TxAllocFID_register 	0x22
97 #define awc_TxComplFID_register 	0x24
98 #define awc_AuxPage_register 		0x3A
99 #define awc_AuxOffset_register 		0x3C
100 #define awc_AuxData_register 		0x3E
101 
102 
103 struct awc_bap {
104 	u16 select;
105 	u16 offset;
106 	u16 data;
107 	volatile int lock;
108 	volatile int	status;
109 	struct semaphore sem;
110 	spinlock_t spinlock;
111 	unsigned long flags;
112 };
113 
114 
115 
116 #define AWC_COMMAND_STATE_WAIT_CMD_BUSY		1
117 #define AWC_COMMAND_STATE_WAIT_CMD_ACK		2
118 #define AWC_COMMAND_STATE_WAIT_BAP_BUSY		3
119 #define AWC_COMMAND_STATE_BAP_NOT_SET		4
120 #define AWC_COMMAND_STATE_BAP_SET		5
121 
122 struct awc_command {
123 	volatile int		state;
124 	volatile int		lock_state;
125 	struct net_device *		dev;
126 	struct awc_private *	priv;
127 	u16			port;
128 	struct awc_bap * 	bap;
129 	u16			command;
130 	u16			par0;
131 	u16			par1;
132 	u16			par2;
133 	u16			status;
134 	u16			resp0;
135 	u16			resp1;
136 	u16			resp2;
137 	u16			rid;
138 	u16			offset;
139 	u16			len;
140 	void *			buff;
141 
142 };
143 
144 
145 
146 
147 #define DOWN(a) down_interruptible( a ) ;
148 //	if (in_interrupt()) { down_interruptible( a ) ; } else printk("semaphore DOWN in interrupt tried \n");
149 #define UP(a)   up( a ) ;
150 //	if (in_interrupt()) {up( a ) ; } else printk("semaphore UP in interrupt tried \n");
151 
152 /*	if (!in_interrupt())\
153 	printk("bap lock under cli but not in int\n");\
154 */
155 
156 #define AWC_LOCK_COMMAND_ISSUING(a) spin_lock_irqsave(&a->command_issuing_spinlock,a->command_issuing_spinlock_flags);
157 #define AWC_UNLOCK_COMMAND_ISSUING(a) spin_unlock_irqrestore(&a->command_issuing_spinlock,a->command_issuing_spinlock_flags);
158 
159 #define AWC_BAP_LOCK_UNDER_CLI_REAL(cmd) \
160  	if (!cmd.priv) {\
161 		printk(KERN_CRIT "awc4500: no priv present in command !");\
162 	}\
163 	cmd.bap = &(cmd.priv->bap1);\
164 	if (both_bap_lock)\
165 	spin_lock_irqsave(&cmd.priv->both_bap_spinlock,cmd.priv->both_bap_spinlock_flags);\
166 	if (cmd.bap){\
167 		spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\
168 		cmd.bap->lock++;\
169 		if (cmd.bap->lock > 1)\
170 			printk("Bap 1 lock high\n");\
171 		cmd.lock_state |= AWC_BAP_LOCKED;\
172 	}
173 
174 #define AWC_BAP_LOCK_NOT_CLI_REAL(cmd) {\
175 	if (in_interrupt())\
176 	printk("bap lock not cli in int\n");\
177  	if (!cmd.priv) {\
178 		printk(KERN_CRIT "awc4500: no priv present in command,lockup follows !");\
179 	}\
180 	cmd.bap = &(cmd.priv->bap0);\
181 	if (both_bap_lock)\
182 		spin_lock_irqsave(&cmd.priv->both_bap_spinlock,cmd.priv->both_bap_spinlock_flags);\
183 	spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\
184 	DOWN(&(cmd.priv->bap0.sem));\
185 	cmd.bap->lock++;\
186 	if (cmd.bap->lock > 1)\
187 		printk("Bap 0 lock high\n");\
188 	cmd.lock_state |= AWC_BAP_SEMALOCKED;\
189 }
190 
191 #define AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd) {\
192 	cmd.bap = &(cmd.priv->bap0);\
193 	if (both_bap_lock)\
194 		spin_lock_irqsave(&cmd.priv->both_bap_spinlock,cmd.priv->both_bap_spinlock_flags);\
195 	spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\
196 	cmd.bap->lock++;\
197 	if (cmd.bap->lock > 1)\
198 		printk("Bap 0 lock high\n");\
199 	cmd.lock_state |= AWC_BAP_LOCKED;\
200 }
201 
202 #define BAP_LOCK_ANY(cmd)\
203 	if (in_interrupt())	AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd)\
204 	else AWC_BAP_LOCK_NOT_CLI_REAL(cmd)
205 
206 #define AWC_BAP_LOCK_NOT_CLI(cmd)	BAP_LOCK_ANY(cmd)
207 #define AWC_BAP_LOCK_UNDER_CLI(cmd)	AWC_BAP_LOCK_UNDER_CLI_REAL(cmd)
208 /*
209 	if (!cmd.priv->bap1.lock ) {BAP_LOCK_ANY(cmd);}\
210 	else AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd);
211 */
212 #define AWC_BAP_LOCKED 		0x01
213 #define AWC_BAP_SEMALOCKED 	0x02
214 
215 #define AWC_BAP_BUSY	0x8000
216 #define AWC_BAP_ERR	0x4000
217 #define AWC_BAP_DONE	0x2000
218 
219 #define AWC_CLI		1
220 #define AWC_NOT_CLI 	2
221 
222 /*#define WAIT61x3	inb(0x61);\
223          		inb(0x61);\
224                     	inb(0x61);
225 */
226 #define WAIT61x3 	udelay(bap_sleep)
227 
228 #define AWC_INIT_COMMAND(context, a_com, a_dev,a_cmmand,a_pr0, a_rid, a_offset, a_len, a_buff) {\
229 	memset(&a_com,0,sizeof(a_com) );\
230 	a_com.dev = a_dev;\
231 	a_com.priv = a_dev->priv;\
232 	a_com.port = a_dev->base_addr;\
233 	a_com.bap = NULL;\
234 	a_com.command = a_cmmand;\
235 	a_com.par0 = a_pr0;\
236 	a_com.rid = a_rid;\
237 	a_com.offset = a_offset;\
238 	a_com.len = a_len;\
239 	a_com.buff = a_buff;\
240 	a_com.lock_state = 0;\
241 };
242 
243 /* v�ga veider asi j�rgnevast
244  makrost v�lja j�etud	if (cmd.bap) AWC_IN((cmd.bap)->data);\
245 */
246 
247 #define AWC_BAP_UNLOCK(com) { \
248 	if (com.bap){ \
249 		if ( (com.lock_state & AWC_BAP_SEMALOCKED) &&\
250 		     (com.lock_state & AWC_BAP_LOCKED) ){\
251 		     	printk("Both Sema and simple lock \n");\
252 		}\
253 		if ( com.lock_state & AWC_BAP_SEMALOCKED ){\
254 			 com.bap->lock--; \
255 			 com.lock_state &= ~AWC_BAP_SEMALOCKED;\
256 			 UP(&(com.bap->sem)); \
257 			 spin_unlock_irqrestore(&(cmd.bap->spinlock),cmd.bap->flags);\
258 		} else if (com.lock_state & AWC_BAP_LOCKED){\
259 			 com.bap->lock--; \
260 			 com.lock_state &= ~AWC_BAP_LOCKED;\
261 			 spin_unlock_irqrestore(&(cmd.bap->spinlock),cmd.bap->flags);\
262 		}\
263 	}\
264 	if (both_bap_lock)\
265 		spin_unlock_irqrestore(&cmd.priv->both_bap_spinlock,cmd.priv->both_bap_spinlock_flags);\
266 }
267 
268 #define AWC_RELEASE_COMMAND(com) {\
269 		AWC_BAP_UNLOCK(cmd);\
270 	}
271 
272 
273 
274 #define awc_manufacturer_code 	0x015F
275 #define awc_product_code	0x0005
276 
277 
278 #define awc_write(base,register,u16value) outw(u16value, (base)+(register))
279 #define awc_read(base,register)           inw((base)+(register))
280 #define AWC_OUT(base,val)		outw(val, base)
281 #define AWC_IN(base)			inw(base)
282 
283 
284 #define awc_read_response(cmd)	{	\
285 	cmd->status=awc_read(cmd->port,awc_Status_register);\
286 	cmd->resp0=awc_read(cmd->port,awc_Resp0_register);\
287 	cmd->resp1=awc_read(cmd->port,awc_Resp1_register);\
288 	cmd->resp2=awc_read(cmd->port,awc_Resp2_register);\
289 };
290 
291 #define awc_command_busy(base)		(awc_read(base,awc_Command_register) & 0x8000)
292 #define awc_command_read(base)		awc_read(base,awc_Command_register)
293 #define awc_command_write(base,cmd)	awc_write(base,awc_Command_register,cmd)
294 #define awc_event_status_Awake(base)	(awc_read(base,awc_EvStat_register) & 0x0100)
295 #define awc_event_status_Link(base)	(awc_read(base,awc_EvStat_register) & 0x0080)
296 #define awc_event_status_Cmd(base)	(awc_read(base,awc_EvStat_register) & 0x0010)
297 #define awc_event_status_Alloc(base)	(awc_read(base,awc_EvStat_register) & 0x0008)
298 #define awc_event_status_TxExc(base)	(awc_read(base,awc_EvStat_register) & 0x0004)
299 #define awc_event_status_Tx(base)	(awc_read(base,awc_EvStat_register) & 0x0002)
300 #define awc_event_status_TxResp(base)	(awc_read(base,awc_EvStat_register) & 0x0006)
301 #define awc_event_status_Rx(base)	(awc_read(base,awc_EvStat_register) & 0x0001)
302 #define awc_event_status(base)		(awc_read(base,awc_EvStat_register))
303 
304 #define awc_Link_Status(base)		awc_read(base,awc_LinkStatus_register)
305 
306 #define awc_Rx_Fid(base)		awc_read(base,awc_RxFID_register)
307 #define awc_Tx_Allocated_Fid(base)	awc_read(base,awc_TxAllocFID_register)
308 #define awc_Tx_Compl_Fid(base)		awc_read(base,awc_TxComplFID_register)
309 
310 #define awc_event_ack_ClrStckCmdBsy(base) awc_write(base,awc_EvAck_register, 0x4000)
311 #define awc_event_ack_WakeUp(base)	awc_write(base,awc_EvAck_register, 0x2000)
312 #define awc_event_ack_Awaken(base)	awc_write(base,awc_EvAck_register, 0x0100)
313 #define awc_event_ack_Link(base)	awc_write(base,awc_EvAck_register, 0x0080)
314 #define awc_event_ack_Cmd(base)		awc_write(base,awc_EvAck_register, 0x0010)
315 #define awc_event_ack_Alloc(base)	awc_write(base,awc_EvAck_register, 0x0008)
316 #define awc_event_ack_TxExc(base)	awc_write(base,awc_EvAck_register, 0x0004)
317 #define awc_event_ack_Tx(base)		awc_write(base,awc_EvAck_register, 0x0002)
318 #define awc_event_ack_Rx(base)		awc_write(base,awc_EvAck_register, 0x0001)
319 
320 #define awc_event_ack(base,ints)	awc_write(base,awc_EvAck_register,ints)
321 
322 #define awc_ints_enabled(base)		(awc_read(base,awc_EvIntEn_register))
323 #define awc_ints_enable(base,ints)	awc_write(base,awc_EvIntEn_register,ints)
324 
325 
326 
327 /************************  	RX TX 	BUFF	************************/
328 
329 
330 struct aironet4500_radio_rx_header {
331 	u32	RxTime;
332 	u16	Status;
333 	u16	PayloadLength;
334 	u8	Reserved0;
335 	u8	RSSI;
336 	u8	Rate;
337 	u8	Frequency;
338 	u8	Rx_association_count;
339 	u8 	Reserved1[3];
340 	u8	PLCP_header[4];
341 
342 };
343 
344 
345 struct aironet4500_radio_tx_header {
346 	u32	SWSupport;
347 	u16	Status;
348 	#define aironet4500_tx_status_max_retries	0x0002
349 	#define aironet4500_tx_status_lifetime_exceeded	0x0004
350 	#define aironet4500_tx_status_AID_failure	0x0008
351 	#define aironet4500_tx_status_MAC_disabled	0x0010
352 	#define aironet4500_tx_status_association_lost	0x0020
353 	u16	PayloadLength;
354 	u16	TX_Control;
355 	#define aironet4500_tx_control_tx_ok_event_enable 	0x0002
356 	#define aironet4500_tx_control_tx_fail_event_enable 	0x0004
357 	#define aironet4500_tx_control_header_type_802_11 	0x0008
358 	#define aironet4500_tx_control_payload_type_llc 	0x0010
359 	#define aironet4500_tx_control_no_release 		0x0020
360 	#define aironet4500_tx_control_reuse_fid \
361 		(aironet4500_tx_control_tx_ok_event_enable |\
362 		 aironet4500_tx_control_tx_fail_event_enable |\
363 		  aironet4500_tx_control_no_release)
364 	#define aironet4500_tx_control_no_retries 		0x0040
365 	#define aironet4500_tx_control_clear_AID 		0x0080
366 	#define aironet4500_tx_control_strict_order 		0x0100
367 	#define aironet4500_tx_control_use_rts 			0x0200
368 	u16	AID;
369 	u8	Tx_Long_Retry;
370 	u8	Tx_Short_Retry;
371 	u8	tx_association_count;
372 	u8	tx_bit_rate;
373 	#define	aironet4500_tx_bit_rate_automatic 0
374 	#define aironet4500_tx_bit_rate_500kbps	1
375 	#define aironet4500_tx_bit_rate_1Mbps	2
376 	#define aironet4500_tx_bit_rate_2Mbps	4
377 	u8	Max_Long_Retry;
378 	u8	Max_Short_Retry;
379 	u8	Reserved0[2];
380 };
381 
382 
383 struct aironet4500_rx_fid {
384 
385 	u16						rid;
386 	struct aironet4500_radio_rx_header 		radio_rx;
387 	struct ieee_802_11_header 	   		ieee_802_11;
388 	u16 						gap_length;
389 	struct ieee_802_3_header	   		ieee_802_3;
390 	u8					*	payload;
391 };
392 
393 
394 struct aironet4500_tx_fid {
395 
396 	u16						fid;
397 	u16						fid_size;
398 	struct aironet4500_radio_tx_header 		radio_tx;
399 	struct ieee_802_11_header 	   		ieee_802_11;
400 	u16 						gap_length;
401 	#define aironet4500_gap_len_without_802_3	6
402 	#define aironet4500_gap_len_with_802_3		0
403 	struct ieee_802_3_header	   		ieee_802_3;
404 	u8					*	payload;
405 };
406 
407 struct awc_fid {
408 
409 	u32	type;
410 	#define p80211_llc_snap		0x0100
411 	#define p80211_8021H		0x0200
412 	#define p80211_8022		0x0400
413 	#define p80211_8023		0x0800
414 	#define p80211_snap_8021H	0x1000
415 	#define p80211copy_path_skb	0x2000
416 
417 	u8	priority;
418 	u8	busy;
419 
420 	#define awc_tx_fid_complete_read 0x01
421 	u16	state;
422 	union {
423 		struct aironet4500_tx_fid tx;
424 		struct aironet4500_rx_fid rx;
425 	} u;
426 
427 	struct ieee_802_11_snap_header snap;
428 	struct ieee_802_11_802_1H_header bridge;
429 	u16			bridge_size;
430 	struct ieee_802_11_802_2_header p8022;
431 
432 	u16			pkt_len;
433 	u8	* mac;
434 	struct sk_buff *	skb;
435 	long long		transmit_start_time;
436 	struct awc_fid	*	next;
437 	struct awc_fid	*	prev;
438 
439 };
440 
441 
442 
443 struct awc_fid_queue {
444 
445 
446 	struct awc_fid * head;
447 	struct awc_fid * tail;
448 	int	size;
449 	spinlock_t spinlock;
450 };
451 
452 
453 extern  __inline__ void
awc_fid_queue_init(struct awc_fid_queue * queue)454 awc_fid_queue_init(struct awc_fid_queue * queue){
455 
456 	unsigned long flags;
457 	memset(queue,0, sizeof(struct awc_fid_queue));
458 	spin_lock_init(&queue->spinlock);
459 	spin_lock_irqsave(&queue->spinlock,flags);
460 	queue->head = NULL;
461 	queue->tail = NULL;
462 	queue->size = 0;
463 	spin_unlock_irqrestore(&queue->spinlock,flags);
464 };
465 
466 static inline void
awc_fid_queue_push_tail(struct awc_fid_queue * queue,struct awc_fid * fid)467 awc_fid_queue_push_tail(	struct awc_fid_queue * 	queue,
468 				struct awc_fid *	fid){
469 
470 	unsigned long flags;
471 
472 	spin_lock_irqsave(&queue->spinlock,flags);
473 
474 	fid->prev = queue->tail;
475 	fid->next = NULL;
476 
477 	if (queue->tail){
478 		queue->tail->next = fid;
479 	}
480 	queue->tail  = fid;
481 
482 	if (!queue->head)
483 		queue->head = fid;
484 	queue->size++;
485 
486 	spin_unlock_irqrestore(&queue->spinlock,flags);
487 
488 };
489 
490 
491 static inline void
awc_fid_queue_push_head(struct awc_fid_queue * queue,struct awc_fid * fid)492 awc_fid_queue_push_head(	struct awc_fid_queue * 	queue,
493 				struct awc_fid *	fid){
494 
495 	unsigned long flags;
496 
497 	spin_lock_irqsave(&queue->spinlock,flags);
498 
499 	fid->prev = NULL;
500 	fid->next = queue->head;
501 
502 	if (queue->head){
503 		queue->head->prev = fid;
504 	}
505 	queue->head  = fid;
506 
507 	if (!queue->tail)
508 		queue->tail = fid;
509 	queue->size++;
510 
511 	spin_unlock_irqrestore(&queue->spinlock,flags);
512 };
513 
514 
515 
516 static inline void
awc_fid_queue_rm(struct awc_fid_queue * queue,struct awc_fid * fid)517 awc_fid_queue_rm(		struct awc_fid_queue * 	queue,
518 				struct awc_fid *	fid){
519 
520 
521 	if (fid->prev) {
522 		fid->prev->next = fid->next;
523 	};
524 
525 	if (fid->next) {
526 		fid->next->prev = fid->prev;
527 	};
528 
529 	if (fid == queue->tail) {
530 		queue->tail = fid->prev;
531 	};
532 	if (fid == queue->head) {
533 		queue->head = fid->next;
534 	};
535 	fid->next = NULL;
536 	fid->prev = NULL;
537 	queue->size--;
538 	if (queue->size ==0 ){
539 		queue->tail = NULL;
540 		queue->head = NULL;
541 	}
542 };
543 
544 static inline void
awc_fid_queue_remove(struct awc_fid_queue * queue,struct awc_fid * fid)545 awc_fid_queue_remove(		struct awc_fid_queue * 	queue,
546 				struct awc_fid *	fid){
547 	unsigned long flags;
548 	spin_lock_irqsave(&queue->spinlock,flags);
549 
550 	awc_fid_queue_rm(queue,fid);
551 
552 	spin_unlock_irqrestore(&queue->spinlock,flags);
553 
554 };
555 
556 
557 
558 static inline struct awc_fid *
awc_fid_queue_pop_head(struct awc_fid_queue * queue)559 awc_fid_queue_pop_head(		struct awc_fid_queue * 	queue){
560 
561 	unsigned long flags;
562 	struct awc_fid * fid;
563 
564 	spin_lock_irqsave(&queue->spinlock,flags);
565 
566 	fid = queue->head;
567 	if (fid)
568 		awc_fid_queue_rm(queue,fid);
569 
570 	spin_unlock_irqrestore(&queue->spinlock,flags);
571 
572 	return fid;
573 };
574 
575 
576 
577 
578 static inline struct awc_fid *
awc_fid_queue_pop_tail(struct awc_fid_queue * queue)579 awc_fid_queue_pop_tail(		struct awc_fid_queue * 	queue){
580 
581 	unsigned long flags;
582 	struct awc_fid * fid;
583 
584 	spin_lock_irqsave(&queue->spinlock,flags);
585 
586 	fid = queue->tail;
587 	if (fid)
588 			awc_fid_queue_rm(queue,fid);
589 
590 	spin_unlock_irqrestore(&queue->spinlock,flags);
591 
592 	return fid;
593 };
594 
595 
596 
597 #define AWC_TX_HEAD_SIZE		0x44
598 #define AWC_TX_ALLOC_SMALL_SIZE 	200
599 #define AWC_RX_BUFFS			50
600 
601 
602 /*****************************     	RID & CONFIG 	***********************/
603 
604 struct awc_config{
605     unsigned short    Len;                                /* sizeof(PC4500_CONFIG) */
606     unsigned short    OperatingMode;                      /* operating mode        */
607 
608     #define           MODE_STA_IBSS                0
609     #define           MODE_STA_ESS                 1
610     #define           MODE_AP                      2
611     #define           MODE_AP_RPTR                 3
612     #define           MODE_ETHERNET_HOST           (0<<8)    /* rx payloads converted */
613     #define           MODE_LLC_HOST                (1<<8)    /* rx payloads left as is */
614     #define           MODE_AIRONET_EXTEND          (1<<9)    /* enable Aironet extenstions */
615     #define           MODE_AP_INTERFACE            (1<<10) /* enable ap interface extensions */
616     unsigned short    ReceiveMode;                        /* receive mode */
617     #define           RXMODE_BC_MC_ADDR            0
618     #define           RXMODE_BC_ADDR               1         /* ignore multicasts */
619     #define           RXMODE_ADDR                  2         /* ignore multicast and broadcast */
620     #define           RXMODE_RFMON                 3         /* wireless monitor mode */
621     #define           RXMODE_RFMON_ANYBSS 4
622     #define           RXMODE_LANMON                5         /* lan style monitor -- data packets only */
623     #define           RXMODE_DISABLE_802_3_HEADER  0x100    /* disables 802.3 header on rx */
624 
625     unsigned short    FragmentThreshold;
626     unsigned short    RtsThreshold;
627     unsigned char     StationMacAddress[6];
628     unsigned char     Rates[8];
629     unsigned short    ShortRetryLimit;
630     unsigned short    LongRetryLimit;
631     unsigned short    TxLifetime;                         /* in kusec */
632     unsigned short    RxLifetime;                         /* in kusec */
633     unsigned short    Stationary;
634     unsigned short    Ordering;
635     unsigned short    DeviceType;                         /* for overriding device type */
636     unsigned short    _reserved1[5];                         /*---------- Scanning/Associating ----------*/
637     unsigned short    ScanMode;
638     #define           SCANMODE_ACTIVE              0
639     #define           SCANMODE_PASSIVE             1
640     #define           SCANMODE_AIROSCAN            2
641     unsigned short    ProbeDelay;                         /* in kusec */
642     unsigned short    ProbeEnergyTimeout;                 /* in kusec */
643     unsigned short    ProbeResponseTimeout;
644     unsigned short    BeaconListenTimeout;
645     unsigned short    JoinNetTimeout;
646     unsigned short    AuthenticationTimeout;
647     unsigned short    AuthenticationType;
648     #define           AUTH_OPEN                    1
649     #define           AUTH_SHAREDKEY               2
650     #define           AUTH_EXCLUDENONWEP           4
651     unsigned short    AssociationTimeout;
652     unsigned short    SpecifiedApTimeout;
653     unsigned short    OfflineScanInterval;
654     unsigned short    OfflineScanDuration;
655     unsigned short    LinkLossDelay;
656     unsigned short    MaxBeaconLostTime;
657     unsigned short    RefreshInterval;
658    #define           DISABLE_REFRESH           0xFFFF
659    unsigned short    _reserved1a[1];                      /*---------- Power save operation ----------*/
660    unsigned short    PowerSaveMode;
661    #define           POWERSAVE_CAM             0
662    #define           POWERSAVE_PSP             1
663    #define           POWERSAVE_PSP_CAM         2
664    unsigned short    SleepForDtims;
665    unsigned short    ListenInterval;
666    unsigned short    FastListenInterval;
667    unsigned short    ListenDecay;
668    unsigned short    FastListenDelay;
669    unsigned short    _reserved2[2];                       /*---------- Ap/Ibss config items ----------*/
670    unsigned short    BeaconPeriod;
671    unsigned short    AtimDuration;
672    unsigned short    HopPeriod;
673    unsigned short    ChannelSet;
674    unsigned short    Channel;
675    unsigned short    DtimPeriod;
676    unsigned short    _reserved3[2];                       /*---------- Radio configuration ----------*/
677    unsigned short    RadioType;
678    #define           RADIOTYPE_DEFAULT         0
679    #define           RADIOTYPE_802_11          1
680    #define           RADIOTYPE_LEGACY          2
681    unsigned char     u8RxDiversity;
682    unsigned char     u8TxDiversity;
683    unsigned short    TxPower;
684    #define           TXPOWER_DEFAULT           0
685    unsigned short    RssiThreshold;
686    #define           RSSI_DEFAULT              0
687    unsigned short    RadioSpecific[4];                 /*---------- Aironet Extensions ----------*/
688    unsigned char     NodeName[16];
689    unsigned short    ArlThreshold;
690    unsigned short    ArlDecay;
691    unsigned short    ArlDelay;
692    unsigned short    _reserved4[1];                       /*---------- Aironet Extensions ----------*/
693    unsigned short    MagicAction;
694    #define           MAGIC_ACTION_STSCHG       1
695    #define           MACIC_ACTION_RESUME       2
696    #define           MAGIC_IGNORE_MCAST        (1<<8)
697    #define           MAGIC_IGNORE_BCAST        (1<<9)
698    #define           MAGIC_SWITCH_TO_PSP       (0<<10)
699    #define           MAGIC_STAY_IN_CAM         (1<<10)
700 };
701 
702 
703 
704 struct awc_SSID {
705 	u16 	lenght;
706 	u8	SSID[32];
707 };
708 
709 struct awc_SSIDs {
710 	u16 	ridLen;
711 	struct awc_SSID SSID[3];
712 
713 };
714 
715 struct awc_fixed_APs{
716 	u16	ridLen;
717 	u8	AP[4][6];
718 };
719 
720 struct awc_driver_name{
721 	u16	ridLen;
722 	u8	name[16];
723 };
724 
725 struct awc_encapsulation{
726 	u16 	etherType;
727 	u16	Action;
728 };
729 
730 struct awc_enc_trans{
731 	u16				ridLen;
732 	struct awc_encapsulation 	rules[8];
733 };
734 
735 struct awc_wep_key {
736 	u16	ridLen;
737 	u16	KeyIndex;
738 	u8	Address[6];
739 	u16	KeyLen;
740 	u8	Key[16];
741 };
742 
743 struct awc_modulation {
744 	u16	ridLen;
745 	u16	Modulation;
746 };
747 
748 struct awc_cap{
749 	u16		ridLen;
750 	u8		OUI[3];
751 	u8		ProductNum[3];
752 	u8		ManufacturerName[32];
753 	u8		ProductName[16];
754 	u8		ProductVersion[8];
755 	u8		FactoryAddress[6];
756 	u8		AironetAddress[6];
757 	u16		RadioType;
758 	u16		RegDomain;
759 	u8		Callid[6];
760 	u8		SupportedRates[8];
761 	u8		RxDiversity;
762 	u8		TxDiversity;
763 	u16		TxPowerLevels[8];
764 	u16		HardwareVersion;
765 	u16		HardwareCapabilities;
766 	u16		TemperatureRange;
767 	u16		SoftwareVersion;
768 	u16		SoftwareSubVersion;
769 	u16		InterfaceVersion;
770 	u16		SoftwareCapabilities;
771 	u8		BootBlockVersionMajor;
772 	u8              BootBlockVersionMinor;
773 
774 };
775 
776 
777 struct awc_status{
778 	u16	ridLen;
779 	u8	MacAddress[6];
780 	u16	OperationalMode;
781 	u16	ErrorCode;
782 	u16	CurrentSignalQuality;
783 	u16	SSIDlength;
784 	u8	SSID[32];
785 	u8	ApName[16];
786 	u8	CurrentBssid[32];
787 	u8	PreviousBSSIDs[3][6];
788 	u16	BeaconPeriod;
789 	u16	DtimPeriod;
790 	u16	AtimDuration;
791 	u16	HopPeriod;
792 	u16	ChannelSet;
793 	u16	Channel;
794 
795 	u16	HopsToBackbone;
796 	u16	ApTotalLoad;
797 	u16	OurGeneratedLoad;
798 	u16	AccumulatedArl;
799 
800 };
801 
802 
803 struct awc_AP{
804 	u16	ridLen;
805 	u16	TIM_Addr;
806 	u16	Airo_Addr;
807 };
808 
809 struct awc_Statistics_32 {
810 
811 	u32	RidLen;
812 	u32	RxOverrunErr;
813 	u32	RxPlcpCrcErr;
814 	u32	RxPlcpFormat;
815 	u32	RxPlcpLength;
816 	u32	RxMacCrcErr;
817 	u32	RxMacCrcOk;
818 	u32	RxWepErr;
819 	u32	RxWepOk;
820 	u32	RetryLong;
821 	u32	RetryShort;
822 	u32	MaxRetries;
823 	u32	NoAck;
824 
825 	u32	NoCts;
826 	u32	RxAck;
827 	u32	RxCts;
828 	u32	TxAck;
829 	u32	TxRts;
830 	u32	TxCts;
831 	u32	TxMc;
832 	u32	TxBc;
833 	u32	TxUcFrags;
834 	u32	TxUcPackets;
835 	u32	TxBeacon;
836 	u32	RxBeacon;
837 	u32	TxSinColl;
838 	u32	TxMulColl;
839 	u32	DefersNo;
840 	u32	DefersProt;
841 	u32	DefersEngy;
842 	u32	DupFram;
843 	u32	RxFragDisc;
844 	u32	TxAged;
845 	u32	RxAged;
846 	u32	LostSync_Max;
847 	u32	LostSync_Mis;
848 	u32	LostSync_Arl;
849 	u32	LostSync_Dea;
850 	u32	LostSync_Disa;
851 	u32	LostSync_Tsf;
852 	u32	HostTxMc;
853 	u32	HostTxBc;
854 	u32	HostTxUc;
855 	u32	HostTxFail;
856 	u32	HostRxMc;
857 	u32	HostRxBc;
858 	u32	HostRxUc;
859 	u32	HostRxDiscar;
860 	u32	HmacTxMc;
861 	u32	HmacTxBc;
862 	u32	HmacTxUc;
863 	u32	HmacTxFail;
864 	u32	HmacRxMc;
865 	u32	HmacRxBc;
866 	u32	HmacRxUc;
867 	u32	HmacRxDisca;
868 	u32	HmacRxAcce;
869 	u32	SsidMismatch;
870 	u32	ApMismatch;
871 	u32	RatesMismatc;
872 	u32	AuthReject;
873 	u32	AuthTimeout;
874 	u32	AssocReject;
875 	u32	AssocTimeout;
876 	u32	NewReason;
877 	u32	AuthFail_1;
878 	u32	AuthFail_2;
879 	u32	AuthFail_3;
880 	u32	AuthFail_4;
881 	u32	AuthFail_5;
882 	u32	AuthFail_6;
883 	u32	AuthFail_7;
884 	u32	AuthFail_8;
885 	u32	AuthFail_9;
886 	u32	AuthFail_10;
887 	u32	AuthFail_11;
888 	u32	AuthFail_12;
889 	u32	AuthFail_13;
890 	u32	AuthFail_14;
891 	u32	AuthFail_15;
892 	u32	AuthFail_16;
893 	u32	AuthFail_17;
894 	u32	AuthFail_18;
895 	u32	AuthFail_19;
896 	u32	RxMan;
897 	u32	TxMan;
898 	u32	RxRefresh;
899 	u32	TxRefresh;
900 	u32	RxPoll;
901 	u32	TxPoll;
902 	u32	HostRetries;
903 	u32	LostSync_HostReq;
904 	u32	HostTxBytes;
905 	u32	HostRxBytes;
906 	u32	ElapsedUsec;
907 	u32	ElapsedSec;
908 	u32	LostSyncBett;
909 };
910 
911 struct awc_Statistics_16 {
912 
913 	u16	RidLen;
914 	u16	RxOverrunErr;
915 	u16	RxPlcpCrcErr;
916 	u16	RxPlcpFormat;
917 	u16	RxPlcpLength;
918 	u16	RxMacCrcErr;
919 	u16	RxMacCrcOk;
920 	u16	RxWepErr;
921 	u16	RxWepOk;
922 	u16	RetryLong;
923 	u16	RetryShort;
924 	u16	MaxRetries;
925 	u16	NoAck;
926 	u16	NoCts;
927 	u16	RxAck;
928 	u16	RxCts;
929 	u16	TxAck;
930 	u16	TxRts;
931 	u16	TxCts;
932 	u16	TxMc;
933 	u16	TxBc;
934 	u16	TxUcFrags;
935 	u16	TxUcPackets;
936 	u16	TxBeacon;
937 	u16	RxBeacon;
938 	u16	TxSinColl;
939 	u16	TxMulColl;
940 	u16	DefersNo;
941 	u16	DefersProt;
942 	u16	DefersEngy;
943 	u16	DupFram;
944 	u16	RxFragDisc;
945 	u16	TxAged;
946 	u16	RxAged;
947 	u16	LostSync_Max;
948 	u16	LostSync_Mis;
949 	u16	LostSync_Arl;
950 	u16	LostSync_Dea;
951 	u16	LostSync_Disa;
952 	u16	LostSync_Tsf;
953 	u16	HostTxMc;
954 	u16	HostTxBc;
955 	u16	HostTxUc;
956 	u16	HostTxFail;
957 	u16	HostRxMc;
958 	u16	HostRxBc;
959 	u16	HostRxUc;
960 	u16	HostRxDiscar;
961 	u16	HmacTxMc;
962 	u16	HmacTxBc;
963 	u16	HmacTxUc;
964 	u16	HmacTxFail;
965 	u16	HmacRxMc;
966 	u16	HmacRxBc;
967 	u16	HmacRxUc;
968 	u16	HmacRxDisca;
969 	u16	HmacRxAcce;
970 	u16	SsidMismatch;
971 	u16	ApMismatch;
972 	u16	RatesMismatc;
973 	u16	AuthReject;
974 	u16	AuthTimeout;
975 	u16	AssocReject;
976 	u16	AssocTimeout;
977 	u16	NewReason;
978 	u16	AuthFail_1;
979 	u16	AuthFail_2;
980 	u16	AuthFail_3;
981 	u16	AuthFail_4;
982 	u16	AuthFail_5;
983 	u16	AuthFail_6;
984 	u16	AuthFail_7;
985 	u16	AuthFail_8;
986 	u16	AuthFail_9;
987 	u16	AuthFail_10;
988 	u16	AuthFail_11;
989 	u16	AuthFail_12;
990 	u16	AuthFail_13;
991 	u16	AuthFail_14;
992 	u16	AuthFail_15;
993 	u16	AuthFail_16;
994 	u16	AuthFail_17;
995 	u16	AuthFail_18;
996 	u16	AuthFail_19;
997 	u16	RxMan;
998 	u16	TxMan;
999 	u16	RxRefresh;
1000 	u16	TxRefresh;
1001 	u16	RxPoll;
1002 	u16	TxPoll;
1003 	u16	HostRetries;
1004 	u16	LostSync_HostReq;
1005 	u16	HostTxBytes;
1006 	u16	HostRxBytes;
1007 	u16	ElapsedUsec;
1008 	u16	ElapsedSec;
1009 	u16	LostSyncBett;
1010 };
1011 
1012 
1013 #define AWC_TXCTL_TXOK 		(1<<1)	/* report if tx is ok */
1014 #define AWC_TXCTL_TXEX 		(1<<2)	/* report if tx fails */
1015 #define AWC_TXCTL_802_3		(0<<3)	/* 802.3 packet */
1016 #define AWC_TXCTL_802_11    	(1<<3)	/* 802.11 mac packet */
1017 #define AWC_TXCTL_ETHERNET  	(0<<4)	/* payload has ethertype */
1018 #define AWC_TXCTL_LLC  		(1<<4)	/* payload is llc */
1019 #define AWC_TXCTL_RELEASE   	(0<<5)	/* release after completion */
1020 #define AWC_TXCTL_NORELEASE 	(1<<5)	/* on completion returns to host */
1021 
1022 
1023 /************************* LINK STATUS STUFF *******************/
1024 
1025 #define	awc_link_status_loss_of_sync_missed_beacons	0x8000
1026 #define	awc_link_status_loss_of_sync_max_retries 	0x8001
1027 #define	awc_link_status_loss_of_sync_ARL_exceed  	0x8002
1028 #define	awc_link_status_loss_of_sync_host_request 	0x8003
1029 #define	awc_link_status_loss_of_sync_TSF_sync		0x8004
1030 #define	awc_link_status_deauthentication		0x8100
1031 #define	awc_link_status_disassociation			0x8200
1032 #define	awc_link_status_association_failed		0x8400
1033 #define	awc_link_status_authentication_failed		0x0300
1034 #define	awc_link_status_associated			0x0400
1035 
1036 struct awc_strings {
1037 	int	par;
1038 	unsigned int	mask;
1039 	const char * string;
1040 
1041 };
1042 
1043 #define awc_link_status_strings {\
1044 {awc_link_status_loss_of_sync_missed_beacons,	0xFFFF,"Loss of sync -- missed beacons"},\
1045 {awc_link_status_loss_of_sync_max_retries,	0xFFFF,"Loss of sync -- max retries"},\
1046 {awc_link_status_loss_of_sync_ARL_exceed,	0xFFFF,"Loss of sync -- average retry level (ARL) exceeded"},\
1047 {awc_link_status_loss_of_sync_host_request,	0xFFFF,"Loss of sync -- host request"},\
1048 {awc_link_status_loss_of_sync_TSF_sync,		0xFFFF,"Loss of sync -- TSF synchronization"},\
1049 {awc_link_status_deauthentication,		0xFF00,"Deauthentication "},\
1050 {awc_link_status_disassociation,		0xFF00,"Disassocation "},\
1051 {awc_link_status_association_failed ,		0xFF00,"Association failed "},\
1052 {awc_link_status_authentication_failed,		0xFF00,"Authentication failure"},\
1053 {awc_link_status_associated,			0xFFFF,"Associated "},\
1054 {0,0,NULL}\
1055 }
1056 
1057 
1058 /****************************** COMMANDS and DEFAULTS and STATUSES ***********/
1059 
1060 /****************************** COMMANDS */
1061 
1062 
1063 // Command definitions
1064 
1065 
1066 
1067 
1068 #define awc4500wout(base, com, p0,p1,p2) {\
1069 	awc_write(base,awc_Param0_register, p0);\
1070 	awc_write(base,awc_Param1_register, p1);\
1071 	awc_write(base,awc_Param2_register, p2);\
1072 	WAIT61x3;\
1073 	awc_write(base,awc_Command_register, com);\
1074 	WAIT61x3;\
1075 }
1076 #define awc_wout(cmd, com, p0,p1,p2) {\
1077 	awc_write(base,awc_Param0_register, p0);\
1078 	awc_write(base,awc_Param1_register, p1);\
1079 	awc_write(base,awc_Param2_register, p2);\
1080 	WAIT61x3;\
1081 	awc_write(base,awc_Command_register, com);\
1082 	WAIT61x3;\
1083 }
1084 
1085 
1086 #define awc_command_NOP(cmd)			awc_wout( cmd,0x0000,0,0,0) // 	NOP
1087 #define awc_command_Enable_All(cmd)		awc_wout( cmd,0x0001,0,0,0) // 	Enable
1088 #define awc_command_Enable_MAC(cmd)		awc_wout( cmd,0x0101,0,0,0) // 	Enable Mac
1089 #define awc_command_Enable_Rx(cmd)		awc_wout( cmd,0x0201,0,0,0) // 	Enable Rx
1090 #define awc_command_Disable_MAC(cmd)		awc_wout( cmd,0x0002,0,0,0) // 	Disable
1091 #define awc_command_Sync_Loss(cmd)		awc_wout( cmd,0x0003,0,0,0) // 	Force a Loss of Sync
1092 #define awc_command_Soft_Reset(cmd)		awc_wout( cmd,0x0004,0,0,0) // 	Firmware Restart (soft reset)
1093 #define awc_command_Host_Sleep(cmd)		awc_wout( cmd,0x0005,0,0,0) // 	Host Sleep (must be issued as 0x0085)
1094 #define awc_command_Magic_Packet(cmd)		awc_wout( cmd,0x0006,0,0,0) // 	Magic Packet
1095 #define awc_command_Read_Configuration(cmd)	awc_wout( cmd,0x0008,0,0,0) // 	Read the Configuration from nonvolatile  storage
1096 #define awc_command_Allocate_TX_Buff(cmd,size)	awc_wout( cmd,0x000A,size,0,0) // 	Allocate Transmit Buffer
1097 #define awc_command_TX(cmd,FID)			awc_wout( cmd,0x000B,FID ,0,0) // 	Transmit
1098 #define awc_command_Deallocate(cmd,FID)		awc_wout( cmd,0x000C,FID ,0,0) // 	Deallocate
1099 #define awc_command_NOP2(cmd)			awc_wout( cmd,0x0010,0,0,0) // 	NOP (same as 0x0000)
1100 #define awc_command_Read_RID(cmd,RID)		awc_wout( cmd,0x0021,RID ,0,0) // 	Read RID
1101 #define awc_command_Write_RID(cmd,RID)		awc_wout( cmd,0x0121,RID ,0,0) // 	Write RID
1102 #define awc_command_Allocate_Buff(cmd,size)	awc_wout( cmd,0x0028,size,0,0) // 	Allocate Buffer
1103 #define awc_command_PSP_Nodes(cmd)		awc_wout( cmd,0x0030,0,0,0) // 	PSP nodes (AP only)
1104 #define awc_command_Set_Phy_register(cmd,phy_register,clear_bits, set_bits)\
1105 							awc_wout( cmd,0x003E,phy_register,clear_bits, set_bits) // 	Set PHY register
1106 #define awc_command_TX_Test(cmd,command, frequency, pattern)		awc_wout( cmd,0x003F,command, frequency, pattern) // 	Transmitter Test
1107 #define awc_command_RX_Test(cmd)		awc_wout( cmd,0x013F,0,0,0) // 	RX Test
1108 #define awc_command_Sleep(cmd)			awc_wout( cmd,0x0085,0,0,0) // 	Go to Sleep (No Ack bit is mandatory)
1109 #define awc_command_Save_Configuration(cmd)	awc_wout( cmd,0x0108,0,0,0) // 	Save the configuration to nonvolatile
1110 
1111 
1112 #define AWC_COMMAND_NOOP_BULL 		0x000
1113 #define AWC_COMMAND_ENABLE		0x001
1114 #define AWC_COMMAND_ENABLE_MAC		0x101
1115 #define AWC_COMMAND_ENABLE_RX		0x201
1116 #define AWC_COMMAND_DISABLE		0x002
1117 #define AWC_COMMAND_LOSE_SYNC		0x003
1118 #define AWC_COMMAND_SOFT_RESET		0x004
1119 #define AWC_COMMAND_HOST_SLEEP		0x085
1120 #define AWC_COMMAND_MAGIC_PACKET	0x006
1121 #define AWC_COMMAND_READ_CONF		0x008
1122 #define AWC_COMMAND_SAVE_CONF		0x108
1123 #define AWC_COMMAND_TX_ALLOC		0x00A
1124 #define AWC_COMMAND_TX			0x00B
1125 #define AWC_COMMAND_DEALLOC		0x00C
1126 #define AWC_COMMAND_NOOP		0x010
1127 #define AWC_COMMAND_READ_RID		0x021
1128 #define AWC_COMMAND_WRITE_RID		0x121
1129 #define AWC_COMMAND_ALLOC		0x028
1130 #define AWC_COMMAND_PSP_NODES		0x030
1131 #define AWC_COMMAND_SET_PHY		0x03E
1132 #define AWC_COMMAND_TX_TEST		0x03F
1133 #define AWC_COMMAND_SLEEP		0x085
1134 
1135 
1136 #define awc_command_name_strings {\
1137 	{0x0000, 0x00FF,"awc_command_NOP " },\
1138 	{0x0001, 0x00FF,"awc_command_Enable_All " },\
1139 	{0x0101, 0x01FF,"awc_command_Enable_MAC " },\
1140 	{0x0201, 0x01FF,"awc_command_Enable_Rx " },\
1141 	{0x0002, 0x00FF,"awc_command_Disable_MAC " },\
1142 	{0x0003, 0x00FF,"awc_command_Sync_Loss " },\
1143 	{0x0004, 0x00FF,"awc_command_Soft_Reset " },\
1144 	{0x0005, 0x00FF,"awc_command_Host_Sleep " },\
1145 	{0x0006, 0x00FF,"awc_command_Magic_Packet " },\
1146 	{0x0008, 0x00FF,"awc_command_Read_Configuration " },\
1147 	{0x000A, 0x00FF,"awc_command_Allocate_TX_Buff " },\
1148 	{0x000B, 0x00FF,"awc_command_TX " },\
1149 	{0x000C, 0x00FF,"awc_command_Deallocate " },\
1150 	{0x0010, 0x00FF,"awc_command_NOP2 " },\
1151 	{0x0021, 0x00FF,"awc_command_Read_RID " },\
1152 	{0x0121, 0x01FF,"awc_command_Write_RID " },\
1153 	{0x0028, 0x00FF,"awc_command_Allocate_Buff " },\
1154 	{0x0030, 0x00FF,"awc_command_PSP_Nodes " },\
1155 	{0x003E, 0x00FF,"awc_command_Set_Phy_register " },\
1156 	{0x003F, 0x00FF,"awc_command_TX_Test " },\
1157 	{0x013F, 0x01FF,"awc_command_RX_Test " },\
1158 	{0x0085, 0x00FF,"awc_command_Sleep " },\
1159 	{0x0108, 0x01FF,"awc_command_Save_Configuration " },\
1160 	{0x0000, 0x00FF, NULL}\
1161 };
1162 
1163 
1164 /***************************** STATUSES */
1165 
1166 #define awc_reply_success 0x0000
1167 
1168 #define awc_reply_error_strings {\
1169    { 0x0000, 0x00FF,"    Success"},\
1170    { 0x0001, 0x00FF,"    Illegal command."},\
1171    { 0x0002, 0x00FF,"    Illegal format."},\
1172    { 0x0003, 0x00FF,"    Invalid FID."},\
1173    { 0x0004, 0x00FF,"    Invalid RID."},\
1174    { 0x0005, 0x00FF,"    Too Large"},\
1175    { 0x0006, 0x00FF,"    MAC is not disabled."},\
1176    { 0x0007, 0x00FF,"    Alloc is still busy processing previous alloc"},\
1177    { 0x0008, 0x00FF,"    Invalid Mode Field"},\
1178    { 0x0009, 0x00FF,"    Tx is not allowed in monitor mode"},\
1179    { 0x000A, 0x00FF,"    Loop test or memory test error"},\
1180    { 0x000B, 0x00FF,"    Cannot read this RID."},\
1181    { 0x000C, 0x00FF,"    Cannot write to this RID."},\
1182    { 0x000D, 0x00FF,"    Tag not found."},\
1183    { 0x0080, 0x00FF,"    Config mode is invalid."},\
1184    { 0x0081, 0x00FF,"    Config hop interval is invalid."},\
1185    { 0x0082, 0x00FF,"    Config beacon interval is invalid."},\
1186    { 0x0083, 0x00FF,"    Config receive mode is invalid."},\
1187    { 0x0084, 0x00FF,"    Config MAC address is invalid."},\
1188    { 0x0085, 0x00FF,"    Config rates are invalid."},\
1189    { 0x0086, 0x00FF,"    Config ordering field is invalid."},\
1190    { 0x0087, 0x00FF,"    Config scan mode is invalid."},\
1191    { 0x0088, 0x00FF,"    Config authentication type is invalid."},\
1192    { 0x0089, 0x00FF,"    Config power save mode is invalid."},\
1193    { 0x008A, 0x00FF,"    Config radio type is invalid."},\
1194    { 0x008B, 0x00FF,"    Config diversity is invalid."},\
1195    { 0x008C, 0x00FF,"    Config SSID list is invalid."},\
1196    { 0x008D, 0x00FF,"    Config specified AP list is invalid."},\
1197    { 0x0000, 0x00FF, NULL}\
1198 };
1199 
1200 #define awc_reply_command_failed( status) ((status & 0x7F00) == 0x7F)
1201 
1202 
1203 /*************************   PHY and TEST commands   ****************/
1204 
1205 
1206 // this might be wrong and reading is not implemented(was not in spec properly)
1207 #define awc_Set_PLCP_Word(PLCP_Word)\
1208 	awc_command_Set_Phy_register(base,0x8000,0 ,PLCP_Word)
1209 #define awc_Set_TX_Test_Freq(Tx_Test_Freq)\
1210 	awc_command_Set_Phy_register(base,0x8002,0 ,Tx_Test_Freq)
1211 #define awc_Set_Tx_Power(Tx_Power)\
1212 	awc_command_Set_Phy_register(base,0x8004,0 ,Tx_Power)
1213 #define awc_Set_RSSI_Treshold(RSSI_Treshold)\
1214 	awc_command_Set_Phy_register(base,0x8006,0 ,RSSI_Treshold)
1215 #define awc_Get_PLCP_Word(PLCP_Word)\
1216 	awc_command_Set_Phy_register(base,0x8000,0 ,0)
1217 #define awc_Get_TX_Test_Freq(Tx_Test_Freq)\
1218 	awc_command_Set_Phy_register(base,0x8002,0 ,0)
1219 #define awc_Get_Tx_Power(Tx_Power)\
1220 	awc_command_Set_Phy_register(base,0x8004,0 ,0)
1221 #define awc_Get_RSSI_Treshold(RSSI_Treshold)\
1222 	awc_command_Set_Phy_register(base,0x8006,0 ,0)
1223 
1224 
1225 #define awc_tx_test_code_end 	0x0000   //  Ends the transmitter test
1226 #define awc_tx_test_code_loop	0x0001   //  Loop back to the beginning of the commands
1227 #define awc_tx_test_code_start	0x0002   //  Start transmitting
1228 #define awc_tx_test_code_stop	0x0003   //  Stop transmitting
1229 #define awc_tx_test_code_delayu 0x0004   //  Delay for N usec where N is the next word
1230 #define awc_tx_test_code_delayk 0x0005   //  Delay for N Kusec where N is the next word
1231 #define awc_tx_test_code_next	0x0006   //  Go to the next frequency in the frequency RID
1232 #define awc_tx_test_code_rx	0x0007   //  Start receive mode
1233 
1234 #define awc_tx_test_code_strings {\
1235 {  awc_tx_test_code_end , 	0x000f ,"    Ends the transmitter test"},\
1236 {  awc_tx_test_code_loop , 	0x000f ,"     Loop back to the beginning of the commands"},\
1237 {  awc_tx_test_code_start , 	0x000f ,"    Start transmitting"},\
1238 {  awc_tx_test_code_stop ,	0x000f ,"    Stop transmitting"},\
1239 {  awc_tx_test_code_delayu , 	0x000f ,"    Delay for N usec where N is the next word"},\
1240 {  awc_tx_test_code_delayk , 	0x000f ,"    Delay for N Kusec where N is the next word"},\
1241 {  awc_tx_test_code_next , 	0x000f ,"    Go to the next frequency in the frequency RID"},\
1242 {  awc_tx_test_code_rx 	,	0x000f ,"    Start receive mode"},\
1243 { 			0   , 0x000f ,NULL}\
1244 };
1245 
1246 
1247 
1248 #define AWC_COMMSTAT_HARD_RESET		0x0000001
1249 #define AWC_COMMSTAT_WAKE		0x0000002
1250 #define AWC_COMMSTAT_SOFT_RESET		0x0000004
1251 #define AWC_COMMSTAT_CONFIGURE		0x0000008
1252 #define AWC_COMMSTAT_READ_CONF		0x0000010
1253 #define AWC_COMMSTAT_SAVE_CONF		0x0000020
1254 #define AWC_COMMSTAT_DEALLOC		0x0000040
1255 #define AWC_COMMSTAT_ALLOC_TX		0x0000080
1256 #define AWC_COMMSTAT_ALLOC_TEST		0x0000100
1257 #define AWC_COMMSTAT_ENABLE_MAC		0x0000200
1258 #define AWC_COMMSTAT_ENABLE_RX		0x0000400
1259 #define AWC_COMMSTAT_DISABLE_MAC	0x0000800
1260 #define AWC_COMMSTAT_RX_ACK		0x0001000
1261 #define AWC_COMMSTAT_TX_ACK		0x0002000
1262 #define AWC_COMMSTAT_AWAKEN_ACK		0x0004000
1263 #define AWC_COMMSTAT_TX_FAIL_ACK	0x0008000
1264 #define AWC_COMMSTAT_LINK_ACK		0x0010000
1265 #define AWC_COMMSTAT_CLR_CMD		0x0020000
1266 #define AWC_COMMSTAT_ALLOC_ACK		0x0040000
1267 #define AWC_COMMSTAT_HOST_SLEEP		0x0080000
1268 #define AWC_COMMSTAT_RX			0x0100000
1269 #define AWC_COMMSTAT_TX			0x0200000
1270 #define AWC_COMMSTAT_SLEEP		0x0400000
1271 #define AWC_COMMSTAT_PSP_NODES		0x0800000
1272 #define AWC_COMMSTAT_SET_TX_POWER 	0x1000000
1273 
1274 
1275 /*****************************     R  I  D	***************/
1276 
1277 #define AWC_NOF_RIDS	18
1278 extern int awc_rid_setup(struct net_device * dev);
1279 
1280 struct aironet4500_rid_selector{
1281 	const u16 selector;
1282 	const unsigned 	MAC_Disable_at_write:1;
1283 	const unsigned	read_only:1;
1284 	const unsigned  may_change:1;
1285 	const char *	name;
1286 };
1287 
1288 
1289 
1290 
1291 
1292 extern const struct aironet4500_rid_selector aironet4500_RID_Select_General_Config;
1293 extern const struct aironet4500_rid_selector aironet4500_RID_Select_SSID_list;
1294 extern const struct aironet4500_rid_selector aironet4500_RID_Select_AP_list	;
1295 extern const struct aironet4500_rid_selector aironet4500_RID_Select_Driver_name;
1296 extern const struct aironet4500_rid_selector aironet4500_RID_Select_Encapsulation;
1297 extern const struct aironet4500_rid_selector aironet4500_RID_Select_Active_Config;
1298 extern const struct aironet4500_rid_selector aironet4500_RID_Select_Capabilities;
1299 extern const struct aironet4500_rid_selector aironet4500_RID_Select_AP_Info	;
1300 extern const struct aironet4500_rid_selector aironet4500_RID_Select_Radio_Info;
1301 extern const struct aironet4500_rid_selector aironet4500_RID_Select_Status	;
1302 extern const struct aironet4500_rid_selector aironet4500_RID_Select_Modulation	;
1303 extern const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_volatile	;
1304 extern const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_nonvolatile	;
1305 extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats;
1306 extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_delta;
1307 extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_clear;
1308 extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats;
1309 extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_delta;
1310 extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_clear;
1311 
1312 #define awc_def_gen_RID(offset,name, bits,mask,value,value_name)\
1313  {&aironet4500_RID_Select_General_Config,offset, bits,1,1,0,0, mask, value, name, value_name}
1314 #define awc_def_SSID_RID(offset,name, bits,mask,value,value_name)\
1315   {&aironet4500_RID_Select_SSID_list,offset, bits,1,1,0,0, mask, value, name, value_name}
1316 #define awc_def_AP_List_RID(offset,name, bits,mask,value,value_name)\
1317  {&aironet4500_RID_Select_AP_list,offset, bits,1,1,0,0, mask, value, name, value_name}
1318 #define awc_def_Dname_RID(offset,name, bits,mask,value,value_name)\
1319  {&aironet4500_RID_Select_Driver_name,offset, bits,1,1,0,0, mask, value, name, value_name}
1320 #define awc_def_act_RID(offset,name, bits,mask,value,value_name)\
1321  {&aironet4500_RID_Select_Active_Config,offset, bits,1,1,0,0, mask, value, name, value_name}
1322 #define awc_def_Cap_RID(offset,name, bits,mask,value,value_name)\
1323  {&aironet4500_RID_Select_Capabilities,offset, bits,1,1,0,0, mask, value, name, value_name}
1324 #define awc_def_AP_RID(offset,name, bits,mask,value,value_name)\
1325  {&aironet4500_RID_Select_AP_Info,offset, bits,1,1,0,0, mask, value, name, value_name}
1326 #define awc_def_Radio_RID(offset,name, bits,mask,value,value_name)\
1327  {&aironet4500_RID_Select_Radio_Info,offset, bits,1,1,0,0, mask, value, name, value_name}
1328 #define awc_def_Stat_RID(offset,name, bits,mask,value,value_name)\
1329  {&aironet4500_RID_Select_Status,offset, bits,1,1,0,0, mask, value, name, value_name}
1330 #define awc_def_Enc_RID(offset,name, bits,mask,value,value_name)\
1331  {&aironet4500_RID_Select_Encapsulation,offset, bits,1,1,0,0, mask, value, name, value_name}
1332 
1333 #define awc_def_WEPv_RID(offset,name, bits,mask,value,value_name)\
1334  {&aironet4500_RID_Select_WEP_volatile,offset, bits,1,1,0,0, mask, value, name, value_name}
1335 #define awc_def_WEPnv_RID(offset,name, bits,mask,value,value_name)\
1336  {&aironet4500_RID_Select_WEP_nonvolatile,offset, bits,1,1,0,0, mask, value, name, value_name}
1337 #define awc_def_Modulation_RID(offset,name, bits,mask,value,value_name)\
1338  {&aironet4500_RID_Select_Modulation,offset, bits,1,1,0,0, mask, value, name, value_name}
1339 
1340 #define awc_def_Stats_RID(o16,offset,name, value_name)\
1341  {&aironet4500_RID_Select_32_stats,offset, 32,1,1,0,0, 0xffffffff, 0, name, value_name}
1342 #define awc_def_Stats_delta_RID(o16,offset,name, value_name)\
1343  {&aironet4500_RID_Select_32_stats_delta,offset, 32,1,1,0,0, 0xffffffff, 0, name, value_name}
1344 #define awc_def_Stats_clear_RID(o16,offset,name, value_name)\
1345  {&aironet4500_RID_Select_32_stats_delta,offset,32,1,1,0,0, 0xffffffff,  0, name,value_name}
1346 
1347 #define awc_def_Stats16_RID(offset,o32,name, value_name)\
1348  {&aironet4500_RID_Select_16_stats,offset, 16,1,1,0,0, 0xffffffff, 0, name, value_name}
1349 #define awc_def_Stats16_delta_RID(offset,o32,name, value_name)\
1350  {&aironet4500_RID_Select_16_stats_delta,offset, 16,1,1,0,0, 0xffffffff,  0, name,value_name}
1351 #define awc_def_Stats16_clear_RID(offset,o32,name, value_name)\
1352  {&aironet4500_RID_Select_16_stats_delta,offset, 16,1,1,0,0, 0xffffffff,  0, name,value_name}
1353 
1354 
1355 #define aironet4500_RID_Select_strings {\
1356 { 0xFF10, 0xffff, "General Configuration"},\
1357 { 0xFF11, 0xffff, "Valid SSID list" },\
1358 { 0xFF12, 0xffff, "Valid AP list"},\
1359 { 0xFF13, 0xffff, "Driver name"},\
1360 { 0xFF14, 0xffff, "Ethernet Protocol"},\
1361 { 0xFF15, 0xffff, "WEP volatile"},\
1362 { 0xFF16, 0xffff, "WEP nonvolatile"},\
1363 { 0xFF17, 0xffff, "Modulation"},\
1364 { 0xFF20, 0xffff, "Actual Configuration"},\
1365 { 0xFF00, 0xffff, "Capabilities"},\
1366 { 0xFF01, 0xffff, "AP Info"},\
1367 { 0xFF02, 0xffff, "Radio Info"},\
1368 { 0xFF50, 0xffff, "Status"},\
1369 { 0xFF60, 0xffff, "Cumulative 16-bit Statistics"},\
1370 { 0xFF61, 0xffff, "Delta 16-bit Statistics"},\
1371 { 0xFF62, 0xffff, "Delta 16-bit Statistics and Clear"},\
1372 { 0xFF68, 0xffff, "Cumulative 32-bit Statistics"},\
1373 { 0xFF69, 0xffff, "Delta 32-bit Statistics "},\
1374 { 0xFF6A, 0xffff, "Delta 32-bit Statistics and Clear"},\
1375 { 0x0000, 0xffff, NULL}\
1376 }
1377 
1378 
1379 
1380 
1381 
1382 struct aironet4500_RID {
1383 	const struct aironet4500_rid_selector	*  selector;
1384 	const u32 	offset;
1385 	const u8 	bits;
1386 	const u8 	array;
1387 	const u32 	units;
1388 	const unsigned read_only:1;
1389 	const unsigned null_terminated:1;
1390 	const u32 	mask;
1391 	const u32 	value;
1392 	const char * name;
1393 	const char * value_name;
1394 
1395 };
1396 
1397 struct aironet4500_RID_names{
1398 	struct aironet4500_RID rid;
1399 	char *name;
1400 };
1401 
1402 struct aironet4500_RID_names_values{
1403 	struct aironet4500_RID rid;
1404 	char *name;
1405 	u32	mask;
1406 };
1407 
1408 struct awc_rid_dir{
1409 	const struct aironet4500_rid_selector *	selector;
1410 	const int size;
1411 	const struct aironet4500_RID * rids;
1412 	struct net_device * dev ;
1413 	void * 	buff;
1414 	int	bufflen; // just checking
1415 };
1416 
1417 extern int awc_nof_rids;
1418 extern struct awc_rid_dir  awc_rids[];
1419 
1420 
1421 
1422 
1423 
1424 struct awc_private {
1425 	dev_node_t node; // somewhere back in times PCMCIA needed that
1426 
1427 	int dummy_test; // left for cleanup
1428 	// card rid inmemory copy
1429 	struct awc_config 		config; // card RID mirrors
1430 	struct awc_config 		general_config; //
1431 	struct awc_SSIDs  		SSIDs;
1432 	struct awc_fixed_APs 		fixed_APs;
1433 	struct awc_driver_name		driver_name;
1434 	struct awc_enc_trans		enc_trans;
1435 	struct awc_cap			capabilities;
1436 	struct awc_status		status;
1437 	struct awc_AP			AP;
1438 	struct awc_Statistics_32 	statistics;
1439 	struct awc_Statistics_32 	statistics_delta;
1440 	struct awc_Statistics_32 	statistics_delta_clear;
1441 	struct awc_Statistics_16 	statistics16;
1442 	struct awc_Statistics_16 	statistics16_delta;
1443 	struct awc_Statistics_16 	statistics16_delta_clear;
1444 	struct awc_wep_key		wep_volatile;
1445 	struct awc_wep_key		wep_nonvolatile;
1446 	struct awc_modulation		modulation;
1447 
1448 	// here are just references to rids
1449 	struct awc_rid_dir		rid_dir[AWC_NOF_RIDS];
1450 	int	rids_read;
1451 
1452 
1453 	struct awc_bap		bap0;
1454 	struct awc_bap		bap1;
1455 	int			sleeping_bap;
1456 
1457 	struct awc_fid_queue    tx_small_ready;
1458 	struct awc_fid_queue    tx_large_ready;
1459 	struct awc_fid_queue    tx_post_process;
1460 	struct awc_fid_queue    tx_in_transmit;
1461 	spinlock_t		queues_lock;
1462 
1463 	struct awc_fid_queue    rx_ready;
1464 	struct awc_fid_queue    rx_post_process;
1465 
1466 
1467 
1468 	struct semaphore	tx_buff_semaphore;
1469 	volatile int		tx_buffs_in_use;
1470 	volatile int 		tx_small_buffs_in_use;
1471 	volatile int		tx_buffs_total;
1472 	volatile int		tx_small_buffs_total;
1473 	int			large_buff_mem;
1474 	int			small_buff_no;
1475 
1476 	volatile int		mac_enabled;
1477 	u16			link_status;
1478 	u8			link_status_changed;
1479 
1480 	volatile int		ejected;
1481 	volatile int		bh_running;
1482 	volatile int		bh_active;
1483 	volatile long		tx_chain_active;
1484 	volatile u16		enabled_interrupts;
1485 	volatile u16		waiting_interrupts;
1486 	volatile int		interrupt_count;
1487 
1488 	// Command serialize stuff
1489 //changed to spinlock        struct semaphore 	command_semaphore;
1490 	spinlock_t		both_bap_spinlock; // on SMP, card should theorethically live without that
1491 	unsigned long		both_bap_spinlock_flags;
1492 	spinlock_t		bap_setup_spinlock; // on SMP, card should theoretically live without that
1493 	unsigned long		bap_setup_spinlock_flags;
1494 	spinlock_t		command_issuing_spinlock;
1495 	unsigned long		command_issuing_spinlock_flags;
1496 	spinlock_t		interrupt_spinlock;
1497 
1498         volatile int		unlock_command_postponed;
1499         struct awc_command	cmd;
1500         long long		async_command_start;
1501         volatile int		command_semaphore_on;
1502         struct tq_struct 	immediate_bh;
1503 	volatile int		process_tx_results;
1504 
1505 	u8			p2p[6];
1506 	u8			bssid[6];
1507 	int			p2p_uc;
1508 	int			p2p_found;
1509 	int			p802_11_send;
1510 	int			simple_bridge;
1511 	int			force_rts_on_shorter;
1512 	int			force_tx_rate;
1513 	int			ip_tos_reliability_rts;
1514 	int			ip_tos_troughput_no_retries;
1515 	int 			full_stats;
1516 	int 			debug;
1517 
1518 	struct net_device_stats stats;
1519 
1520 	struct ctl_table * proc_table;
1521 
1522 	void	* 		bus;
1523 	int 			card_type;
1524 };
1525 
1526 extern int 		awc_init(struct net_device * dev);
1527 extern void 		awc_reset(struct net_device *dev);
1528 extern int 		awc_config(struct net_device *dev);
1529 extern int 		awc_open(struct net_device *dev);
1530 extern void 		awc_tx_timeout(struct net_device *dev);
1531 extern int 		awc_start_xmit(struct sk_buff *, struct net_device *);
1532 extern void 		awc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
1533 extern struct net_device_stats *	awc_get_stats(struct net_device *dev);
1534 extern void		awc_set_multicast_list(struct net_device *dev);
1535 extern int awc_change_mtu(struct net_device *dev, int new_mtu);
1536 extern int 		awc_close(struct net_device *dev);
1537 extern int		awc_private_init(struct net_device * dev);
1538 extern int awc_register_proc(int (*awc_proc_set_device) (int),int (*awc_proc_unset_device)(int));
1539 extern int awc_unregister_proc(void);
1540 extern int (* awc_proc_set_fun) (int) ;
1541 extern int (* awc_proc_unset_fun) (int) ;
1542 extern int	awc_interrupt_process(struct net_device * dev);
1543 extern int	awc_readrid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf );
1544 extern int 	awc_writerid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf);
1545 extern int 	awc_readrid_dir(struct net_device * dev, struct awc_rid_dir * rid );
1546 extern int 	awc_writerid_dir(struct net_device * dev, struct awc_rid_dir * rid);
1547 extern int 	awc_tx_alloc(struct net_device * dev) ;
1548 extern int	awc_tx_dealloc(struct net_device * dev);
1549 extern struct awc_fid *awc_tx_fid_lookup(struct net_device * dev, u16 fid);
1550 extern int 	awc_issue_soft_reset(struct net_device * dev);
1551 extern int	awc_issue_noop(struct net_device * dev);
1552 extern int 	awc_dump_registers(struct net_device * dev);
1553 extern unsigned short  awc_issue_command_and_block(struct awc_command * cmd);
1554 extern int	awc_enable_MAC(struct net_device * dev);
1555 extern int	awc_disable_MAC(struct net_device * dev);
1556 extern int	awc_read_all_rids(struct net_device * dev);
1557 extern int	awc_write_all_rids(struct net_device * dev);
1558 extern int	awc_receive_packet(struct net_device * dev);
1559 extern int	awc_transmit_packet(struct net_device * dev, struct awc_fid * tx_buff) ;
1560 extern int	awc_tx_complete_check(struct net_device * dev);
1561 extern int	awc_interrupt_process(struct net_device * dev);
1562 extern void 	awc_bh(struct net_device *dev);
1563 extern int 	awc_802_11_find_copy_path(struct net_device * dev, struct awc_fid * rx_buff);
1564 extern void 	awc_802_11_router_rx(struct net_device * dev,struct awc_fid * rx_buff);
1565 extern int 	awc_802_11_tx_find_path_and_post(struct net_device * dev, struct sk_buff * skb);
1566 extern void 	awc_802_11_after_tx_packet_to_card_write(struct net_device * dev, struct awc_fid * tx_buff);
1567 extern void 	awc_802_11_after_failed_tx_packet_to_card_write(struct net_device * dev,struct awc_fid * tx_buff);
1568 extern void 	awc_802_11_after_tx_complete(struct net_device * dev, struct awc_fid * tx_buff);
1569 extern void 	awc_802_11_failed_rx_copy(struct net_device * dev,struct awc_fid * rx_buff);
1570 extern int 	awc_tx_alloc(struct net_device * dev) ;
1571 extern int 	awc_tx_dealloc_fid(struct net_device * dev,struct awc_fid * fid);
1572 extern int	awc_tx_dealloc(struct net_device * dev);
1573 extern struct awc_fid *
1574 	awc_tx_fid_lookup_and_remove(struct net_device * dev, u16 fid_handle);
1575 extern int 	awc_queues_init(struct net_device * dev);
1576 extern int 	awc_queues_destroy(struct net_device * dev);
1577 extern int 	awc_rids_setup(struct net_device * dev);
1578 
1579 
1580 
1581 extern int		awc_debug;
1582 extern int bap_sleep ;
1583 extern int bap_sleep_after_setup ;
1584 extern int sleep_before_command  ;
1585 extern int bap_sleep_before_write;
1586 extern int sleep_in_command    ;
1587 extern int both_bap_lock;
1588 extern int bap_setup_spinlock;
1589 extern int tx_queue_len ;
1590 extern int tx_rate;
1591 extern int awc_full_stats;
1592 
1593 #define MAX_AWCS	4
1594 extern struct net_device * aironet4500_devices[MAX_AWCS];
1595 
1596 #define AWC_DEBUG 1
1597 
1598 #ifdef AWC_DEBUG
1599 	#define DEBUG(a,args...) if (awc_debug & a) printk( args)
1600 	#define AWC_ENTRY_EXIT_DEBUG(a)  if (awc_debug & 8) printk( a)
1601 #else
1602 	#define DEBUG(a, args...)
1603 	#define AWC_ENTRY_EXIT_DEBUG(a)
1604 #endif
1605 
1606 #endif /* AIRONET4500_H */
1607