|
@@ -69,10 +69,10 @@ static const char hardcoded_ssid[] = "";
|
69
|
69
|
#define __cpu_to_le16(x) (x)
|
70
|
70
|
#define __cpu_to_le32(x) (x)
|
71
|
71
|
|
72
|
|
-#define hfa384x2host_16(n) (__le16_to_cpu((UINT16)(n)))
|
73
|
|
-#define hfa384x2host_32(n) (__le32_to_cpu((UINT32)(n)))
|
74
|
|
-#define host2hfa384x_16(n) (__cpu_to_le16((UINT16)(n)))
|
75
|
|
-#define host2hfa384x_32(n) (__cpu_to_le32((UINT32)(n)))
|
|
72
|
+#define hfa384x2host_16(n) (__le16_to_cpu((uint16_t)(n)))
|
|
73
|
+#define hfa384x2host_32(n) (__le32_to_cpu((uint32_t)(n)))
|
|
74
|
+#define host2hfa384x_16(n) (__cpu_to_le16((uint16_t)(n)))
|
|
75
|
+#define host2hfa384x_32(n) (__cpu_to_le32((uint32_t)(n)))
|
76
|
76
|
|
77
|
77
|
/*
|
78
|
78
|
* PLX9052 PCI register offsets
|
|
@@ -119,14 +119,14 @@ static const char hardcoded_ssid[] = "";
|
119
|
119
|
|
120
|
120
|
typedef struct hfa384x
|
121
|
121
|
{
|
122
|
|
- UINT32 iobase;
|
|
122
|
+ uint32_t iobase;
|
123
|
123
|
void *membase;
|
124
|
|
- UINT16 lastcmd;
|
125
|
|
- UINT16 status; /* in host order */
|
126
|
|
- UINT16 resp0; /* in host order */
|
127
|
|
- UINT16 resp1; /* in host order */
|
128
|
|
- UINT16 resp2; /* in host order */
|
129
|
|
- UINT8 bssid[WLAN_BSSID_LEN];
|
|
124
|
+ uint16_t lastcmd;
|
|
125
|
+ uint16_t status; /* in host order */
|
|
126
|
+ uint16_t resp0; /* in host order */
|
|
127
|
+ uint16_t resp1; /* in host order */
|
|
128
|
+ uint16_t resp2; /* in host order */
|
|
129
|
+ uint8_t bssid[WLAN_BSSID_LEN];
|
130
|
130
|
} hfa384x_t;
|
131
|
131
|
|
132
|
132
|
/* The global instance of the hardware (i.e. where we store iobase and membase, in the absence of anywhere better to put them */
|
|
@@ -141,9 +141,9 @@ static hfa384x_t hw_global = {
|
141
|
141
|
|
142
|
142
|
typedef struct wlan_llc
|
143
|
143
|
{
|
144
|
|
- UINT8 dsap;
|
145
|
|
- UINT8 ssap;
|
146
|
|
- UINT8 ctl;
|
|
144
|
+ uint8_t dsap;
|
|
145
|
+ uint8_t ssap;
|
|
146
|
+ uint8_t ctl;
|
147
|
147
|
} wlan_llc_t;
|
148
|
148
|
|
149
|
149
|
static const wlan_llc_t wlan_llc_snap = { 0xaa, 0xaa, 0x03 }; /* LLC header indicating SNAP (?) */
|
|
@@ -151,8 +151,8 @@ static const wlan_llc_t wlan_llc_snap = { 0xaa, 0xaa, 0x03 }; /* LLC header indi
|
151
|
151
|
#define WLAN_IEEE_OUI_LEN 3
|
152
|
152
|
typedef struct wlan_snap
|
153
|
153
|
{
|
154
|
|
- UINT8 oui[WLAN_IEEE_OUI_LEN];
|
155
|
|
- UINT16 type;
|
|
154
|
+ uint8_t oui[WLAN_IEEE_OUI_LEN];
|
|
155
|
+ uint16_t type;
|
156
|
156
|
} wlan_snap_t;
|
157
|
157
|
|
158
|
158
|
typedef struct wlan_80211hdr
|
|
@@ -168,11 +168,11 @@ typedef struct wlan_80211hdr
|
168
|
168
|
/*
|
169
|
169
|
* Hardware-level hfa384x functions
|
170
|
170
|
* These are based on the ones in hfa384x.h (which are ifdef'd out since __KERNEL__ is not defined).
|
171
|
|
- * Basically, these functions are the result of hand-evaluating all the ifdefs and defines in the hfa384x.h versions.
|
|
171
|
+ * Basically, these functions are the result of hand-evaluating all the ifdefs and defines in the hfa384x.h versions.
|
172
|
172
|
*/
|
173
|
173
|
|
174
|
174
|
/* Retrieve the value of one of the MAC registers. */
|
175
|
|
-static inline UINT16 hfa384x_getreg( hfa384x_t *hw, UINT reg )
|
|
175
|
+static inline uint16_t hfa384x_getreg( hfa384x_t *hw, unsigned int reg )
|
176
|
176
|
{
|
177
|
177
|
#if (WLAN_HOSTIF == WLAN_PLX)
|
178
|
178
|
return inw ( hw->iobase + reg );
|
|
@@ -182,7 +182,7 @@ static inline UINT16 hfa384x_getreg( hfa384x_t *hw, UINT reg )
|
182
|
182
|
}
|
183
|
183
|
|
184
|
184
|
/* Set the value of one of the MAC registers. */
|
185
|
|
-static inline void hfa384x_setreg( hfa384x_t *hw, UINT16 val, UINT reg )
|
|
185
|
+static inline void hfa384x_setreg( hfa384x_t *hw, uint16_t val, unsigned int reg )
|
186
|
186
|
{
|
187
|
187
|
#if (WLAN_HOSTIF == WLAN_PLX)
|
188
|
188
|
outw ( val, hw->iobase + reg );
|
|
@@ -192,15 +192,15 @@ static inline void hfa384x_setreg( hfa384x_t *hw, UINT16 val, UINT reg )
|
192
|
192
|
return;
|
193
|
193
|
}
|
194
|
194
|
|
195
|
|
-/*
|
|
195
|
+/*
|
196
|
196
|
* Noswap versions
|
197
|
197
|
* Etherboot is i386 only, so swap and noswap are the same...
|
198
|
198
|
*/
|
199
|
|
-static inline UINT16 hfa384x_getreg_noswap( hfa384x_t *hw, UINT reg )
|
|
199
|
+static inline uint16_t hfa384x_getreg_noswap( hfa384x_t *hw, unsigned int reg )
|
200
|
200
|
{
|
201
|
201
|
return hfa384x_getreg ( hw, reg );
|
202
|
202
|
}
|
203
|
|
-static inline void hfa384x_setreg_noswap( hfa384x_t *hw, UINT16 val, UINT reg )
|
|
203
|
+static inline void hfa384x_setreg_noswap( hfa384x_t *hw, uint16_t val, unsigned int reg )
|
204
|
204
|
{
|
205
|
205
|
hfa384x_setreg ( hw, val, reg );
|
206
|
206
|
}
|
|
@@ -227,12 +227,12 @@ static inline void hfa384x_setreg_noswap( hfa384x_t *hw, UINT16 val, UINT reg )
|
227
|
227
|
* >0 command indicated error, Status and Resp0-2 are
|
228
|
228
|
* in hw structure.
|
229
|
229
|
*/
|
230
|
|
-static int hfa384x_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1, UINT16 parm2)
|
|
230
|
+static int hfa384x_docmd_wait( hfa384x_t *hw, uint16_t cmd, uint16_t parm0, uint16_t parm1, uint16_t parm2)
|
231
|
231
|
{
|
232
|
|
- UINT16 reg = 0;
|
233
|
|
- UINT16 counter = 0;
|
234
|
|
-
|
235
|
|
- /* wait for the busy bit to clear */
|
|
232
|
+ uint16_t reg = 0;
|
|
233
|
+ uint16_t counter = 0;
|
|
234
|
+
|
|
235
|
+ /* wait for the busy bit to clear */
|
236
|
236
|
counter = 0;
|
237
|
237
|
reg = hfa384x_getreg(hw, HFA384x_CMD);
|
238
|
238
|
while ( HFA384x_CMD_ISBUSY(reg) && (counter < 10) ) {
|
|
@@ -251,7 +251,7 @@ static int hfa384x_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 p
|
251
|
251
|
hfa384x_setreg(hw, parm2, HFA384x_PARAM2);
|
252
|
252
|
hw->lastcmd = cmd;
|
253
|
253
|
hfa384x_setreg(hw, cmd, HFA384x_CMD);
|
254
|
|
-
|
|
254
|
+
|
255
|
255
|
/* Now wait for completion */
|
256
|
256
|
counter = 0;
|
257
|
257
|
reg = hfa384x_getreg(hw, HFA384x_EVSTAT);
|
|
@@ -286,14 +286,14 @@ static int hfa384x_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 p
|
286
|
286
|
* hw device structure
|
287
|
287
|
* id FID or RID, destined for the select register (host order)
|
288
|
288
|
* offset An _even_ offset into the buffer for the given FID/RID.
|
289
|
|
- * Returns:
|
|
289
|
+ * Returns:
|
290
|
290
|
* 0 success
|
291
|
291
|
*/
|
292
|
|
-static int hfa384x_prepare_bap(hfa384x_t *hw, UINT16 id, UINT16 offset)
|
|
292
|
+static int hfa384x_prepare_bap(hfa384x_t *hw, uint16_t id, uint16_t offset)
|
293
|
293
|
{
|
294
|
294
|
int result = 0;
|
295
|
|
- UINT16 reg;
|
296
|
|
- UINT16 i;
|
|
295
|
+ uint16_t reg;
|
|
296
|
+ uint16_t i;
|
297
|
297
|
|
298
|
298
|
/* Validate offset, buf, and len */
|
299
|
299
|
if ( (offset > HFA384x_BAP_OFFSET_MAX) || (offset % 2) ) {
|
|
@@ -304,7 +304,7 @@ static int hfa384x_prepare_bap(hfa384x_t *hw, UINT16 id, UINT16 offset)
|
304
|
304
|
udelay(10);
|
305
|
305
|
hfa384x_setreg(hw, offset, HFA384x_OFFSET0);
|
306
|
306
|
/* Wait for offset[busy] to clear (see BAP_TIMEOUT) */
|
307
|
|
- i = 0;
|
|
307
|
+ i = 0;
|
308
|
308
|
do {
|
309
|
309
|
reg = hfa384x_getreg(hw, HFA384x_OFFSET0);
|
310
|
310
|
if ( i > 0 ) udelay(2);
|
|
@@ -330,28 +330,28 @@ static int hfa384x_prepare_bap(hfa384x_t *hw, UINT16 id, UINT16 offset)
|
330
|
330
|
* offset An _even_ offset into the buffer for the given FID/RID.
|
331
|
331
|
* buf ptr to array of bytes
|
332
|
332
|
* len length of data to transfer in bytes
|
333
|
|
- * Returns:
|
|
333
|
+ * Returns:
|
334
|
334
|
* 0 success
|
335
|
335
|
*/
|
336
|
|
-static int hfa384x_copy_from_bap(hfa384x_t *hw, UINT16 id, UINT16 offset,
|
337
|
|
- void *buf, UINT len)
|
|
336
|
+static int hfa384x_copy_from_bap(hfa384x_t *hw, uint16_t id, uint16_t offset,
|
|
337
|
+ void *buf, unsigned int len)
|
338
|
338
|
{
|
339
|
339
|
int result = 0;
|
340
|
|
- UINT8 *d = (UINT8*)buf;
|
341
|
|
- UINT16 i;
|
342
|
|
- UINT16 reg = 0;
|
343
|
|
-
|
|
340
|
+ uint8_t *d = (uint8_t*)buf;
|
|
341
|
+ uint16_t i;
|
|
342
|
+ uint16_t reg = 0;
|
|
343
|
+
|
344
|
344
|
/* Prepare BAP */
|
345
|
345
|
result = hfa384x_prepare_bap ( hw, id, offset );
|
346
|
346
|
if ( result == 0 ) {
|
347
|
347
|
/* Read even(len) buf contents from data reg */
|
348
|
348
|
for ( i = 0; i < (len & 0xfffe); i+=2 ) {
|
349
|
|
- *(UINT16*)(&(d[i])) = hfa384x_getreg_noswap(hw, HFA384x_DATA0);
|
|
349
|
+ *(uint16_t*)(&(d[i])) = hfa384x_getreg_noswap(hw, HFA384x_DATA0);
|
350
|
350
|
}
|
351
|
351
|
/* If len odd, handle last byte */
|
352
|
352
|
if ( len % 2 ){
|
353
|
353
|
reg = hfa384x_getreg_noswap(hw, HFA384x_DATA0);
|
354
|
|
- d[len-1] = ((UINT8*)(®))[0];
|
|
354
|
+ d[len-1] = ((uint8_t*)(®))[0];
|
355
|
355
|
}
|
356
|
356
|
}
|
357
|
357
|
if (result) {
|
|
@@ -369,30 +369,30 @@ static int hfa384x_copy_from_bap(hfa384x_t *hw, UINT16 id, UINT16 offset,
|
369
|
369
|
* offset An _even_ offset into the buffer for the given FID/RID.
|
370
|
370
|
* buf ptr to array of bytes
|
371
|
371
|
* len length of data to transfer in bytes
|
372
|
|
- * Returns:
|
|
372
|
+ * Returns:
|
373
|
373
|
* 0 success
|
374
|
374
|
*/
|
375
|
|
-static int hfa384x_copy_to_bap(hfa384x_t *hw, UINT16 id, UINT16 offset,
|
376
|
|
- void *buf, UINT len)
|
|
375
|
+static int hfa384x_copy_to_bap(hfa384x_t *hw, uint16_t id, uint16_t offset,
|
|
376
|
+ void *buf, unsigned int len)
|
377
|
377
|
{
|
378
|
378
|
int result = 0;
|
379
|
|
- UINT8 *d = (UINT8*)buf;
|
380
|
|
- UINT16 i;
|
381
|
|
- UINT16 savereg;
|
|
379
|
+ uint8_t *d = (uint8_t*)buf;
|
|
380
|
+ uint16_t i;
|
|
381
|
+ uint16_t savereg;
|
382
|
382
|
|
383
|
383
|
/* Prepare BAP */
|
384
|
384
|
result = hfa384x_prepare_bap ( hw, id, offset );
|
385
|
385
|
if ( result == 0 ) {
|
386
|
386
|
/* Write even(len) buf contents to data reg */
|
387
|
387
|
for ( i = 0; i < (len & 0xfffe); i+=2 ) {
|
388
|
|
- hfa384x_setreg_noswap(hw, *(UINT16*)(&(d[i])), HFA384x_DATA0);
|
|
388
|
+ hfa384x_setreg_noswap(hw, *(uint16_t*)(&(d[i])), HFA384x_DATA0);
|
389
|
389
|
}
|
390
|
390
|
/* If len odd, handle last byte */
|
391
|
391
|
if ( len % 2 ){
|
392
|
392
|
savereg = hfa384x_getreg_noswap(hw, HFA384x_DATA0);
|
393
|
393
|
result = hfa384x_prepare_bap ( hw, id, offset + (len & 0xfffe) );
|
394
|
394
|
if ( result == 0 ) {
|
395
|
|
- ((UINT8*)(&savereg))[0] = d[len-1];
|
|
395
|
+ ((uint8_t*)(&savereg))[0] = d[len-1];
|
396
|
396
|
hfa384x_setreg_noswap(hw, savereg, HFA384x_DATA0);
|
397
|
397
|
}
|
398
|
398
|
}
|
|
@@ -412,10 +412,10 @@ static int hfa384x_copy_to_bap(hfa384x_t *hw, UINT16 id, UINT16 offset,
|
412
|
412
|
* configuration record. (host order)
|
413
|
413
|
* rid RID of the record to read/write. (host order)
|
414
|
414
|
*
|
415
|
|
- * Returns:
|
|
415
|
+ * Returns:
|
416
|
416
|
* 0 success
|
417
|
417
|
*/
|
418
|
|
-static inline int hfa384x_cmd_access(hfa384x_t *hw, UINT16 write, UINT16 rid)
|
|
418
|
+static inline int hfa384x_cmd_access(hfa384x_t *hw, uint16_t write, uint16_t rid)
|
419
|
419
|
{
|
420
|
420
|
return hfa384x_docmd_wait(hw, HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_ACCESS) | HFA384x_CMD_WRITE_SET(write), rid, 0, 0);
|
421
|
421
|
}
|
|
@@ -427,14 +427,14 @@ static inline int hfa384x_cmd_access(hfa384x_t *hw, UINT16 write, UINT16 rid)
|
427
|
427
|
* hw device structure
|
428
|
428
|
* rid config/info record id (host order)
|
429
|
429
|
* buf host side record buffer. Upon return it will
|
430
|
|
- * contain the body portion of the record (minus the
|
|
430
|
+ * contain the body portion of the record (minus the
|
431
|
431
|
* RID and len).
|
432
|
432
|
* len buffer length (in bytes, should match record length)
|
433
|
433
|
*
|
434
|
|
- * Returns:
|
|
434
|
+ * Returns:
|
435
|
435
|
* 0 success
|
436
|
436
|
*/
|
437
|
|
-static int hfa384x_drvr_getconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len)
|
|
437
|
+static int hfa384x_drvr_getconfig(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len)
|
438
|
438
|
{
|
439
|
439
|
int result = 0;
|
440
|
440
|
hfa384x_rec_t rec;
|
|
@@ -469,27 +469,27 @@ static int hfa384x_drvr_getconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 l
|
469
|
469
|
* rid config/info record id (in host order)
|
470
|
470
|
* val ptr to 16/32 bit buffer to receive value (in host order)
|
471
|
471
|
*
|
472
|
|
- * Returns:
|
|
472
|
+ * Returns:
|
473
|
473
|
* 0 success
|
474
|
474
|
*/
|
475
|
475
|
#if 0 /* Not actually used anywhere */
|
476
|
|
-static int hfa384x_drvr_getconfig16(hfa384x_t *hw, UINT16 rid, void *val)
|
|
476
|
+static int hfa384x_drvr_getconfig16(hfa384x_t *hw, uint16_t rid, void *val)
|
477
|
477
|
{
|
478
|
478
|
int result = 0;
|
479
|
|
- result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(UINT16));
|
|
479
|
+ result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(uint16_t));
|
480
|
480
|
if ( result == 0 ) {
|
481
|
|
- *((UINT16*)val) = hfa384x2host_16(*((UINT16*)val));
|
|
481
|
+ *((uint16_t*)val) = hfa384x2host_16(*((uint16_t*)val));
|
482
|
482
|
}
|
483
|
483
|
return result;
|
484
|
484
|
}
|
485
|
485
|
#endif
|
486
|
486
|
#if 0 /* Not actually used anywhere */
|
487
|
|
-static int hfa384x_drvr_getconfig32(hfa384x_t *hw, UINT16 rid, void *val)
|
|
487
|
+static int hfa384x_drvr_getconfig32(hfa384x_t *hw, uint16_t rid, void *val)
|
488
|
488
|
{
|
489
|
489
|
int result = 0;
|
490
|
|
- result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(UINT32));
|
|
490
|
+ result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(uint32_t));
|
491
|
491
|
if ( result == 0 ) {
|
492
|
|
- *((UINT32*)val) = hfa384x2host_32(*((UINT32*)val));
|
|
492
|
+ *((uint32_t*)val) = hfa384x2host_32(*((uint32_t*)val));
|
493
|
493
|
}
|
494
|
494
|
return result;
|
495
|
495
|
}
|
|
@@ -504,10 +504,10 @@ static int hfa384x_drvr_getconfig32(hfa384x_t *hw, UINT16 rid, void *val)
|
504
|
504
|
* buf host side record buffer
|
505
|
505
|
* len buffer length (in bytes)
|
506
|
506
|
*
|
507
|
|
- * Returns:
|
|
507
|
+ * Returns:
|
508
|
508
|
* 0 success
|
509
|
509
|
*/
|
510
|
|
-static int hfa384x_drvr_setconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len)
|
|
510
|
+static int hfa384x_drvr_setconfig(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len)
|
511
|
511
|
{
|
512
|
512
|
int result = 0;
|
513
|
513
|
hfa384x_rec_t rec;
|
|
@@ -541,21 +541,21 @@ static int hfa384x_drvr_setconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 l
|
541
|
541
|
* rid config/info record id (in host order)
|
542
|
542
|
* val 16/32 bit value to store (in host order)
|
543
|
543
|
*
|
544
|
|
- * Returns:
|
|
544
|
+ * Returns:
|
545
|
545
|
* 0 success
|
546
|
546
|
*/
|
547
|
|
-static int hfa384x_drvr_setconfig16(hfa384x_t *hw, UINT16 rid, UINT16 *val)
|
|
547
|
+static int hfa384x_drvr_setconfig16(hfa384x_t *hw, uint16_t rid, uint16_t *val)
|
548
|
548
|
{
|
549
|
|
- UINT16 value;
|
|
549
|
+ uint16_t value;
|
550
|
550
|
value = host2hfa384x_16(*val);
|
551
|
|
- return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(UINT16));
|
|
551
|
+ return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(uint16_t));
|
552
|
552
|
}
|
553
|
553
|
#if 0 /* Not actually used anywhere */
|
554
|
|
-static int hfa384x_drvr_setconfig32(hfa384x_t *hw, UINT16 rid, UINT32 *val)
|
|
554
|
+static int hfa384x_drvr_setconfig32(hfa384x_t *hw, uint16_t rid, uint32_t *val)
|
555
|
555
|
{
|
556
|
|
- UINT32 value;
|
|
556
|
+ uint32_t value;
|
557
|
557
|
value = host2hfa384x_32(*val);
|
558
|
|
- return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(UINT32));
|
|
558
|
+ return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(uint32_t));
|
559
|
559
|
}
|
560
|
560
|
#endif
|
561
|
561
|
|
|
@@ -573,14 +573,14 @@ static int hfa384x_drvr_setconfig32(hfa384x_t *hw, UINT16 rid, UINT32 *val)
|
573
|
573
|
* descr Descriptive text string of what is being waited for
|
574
|
574
|
* (will be printed out if a timeout happens)
|
575
|
575
|
*
|
576
|
|
- * Returns:
|
577
|
|
- * value of EVSTAT register, or 0 on failure
|
|
576
|
+ * Returns:
|
|
577
|
+ * value of EVSTAT register, or 0 on failure
|
578
|
578
|
*/
|
579
|
|
-static int hfa384x_wait_for_event(hfa384x_t *hw, UINT16 event_mask, UINT16 event_ack, int wait, int timeout, const char *descr)
|
|
579
|
+static int hfa384x_wait_for_event(hfa384x_t *hw, uint16_t event_mask, uint16_t event_ack, int wait, int timeout, const char *descr)
|
580
|
580
|
{
|
581
|
|
- UINT16 reg;
|
|
581
|
+ uint16_t reg;
|
582
|
582
|
int count = 0;
|
583
|
|
-
|
|
583
|
+
|
584
|
584
|
do {
|
585
|
585
|
reg = hfa384x_getreg(hw, HFA384x_EVSTAT);
|
586
|
586
|
if ( count > 0 ) udelay(wait);
|
|
@@ -600,12 +600,12 @@ POLL - Wait for a frame
|
600
|
600
|
***************************************************************************/
|
601
|
601
|
static int prism2_poll(struct nic *nic, int retrieve)
|
602
|
602
|
{
|
603
|
|
- UINT16 reg;
|
604
|
|
- UINT16 rxfid;
|
605
|
|
- UINT16 result;
|
|
603
|
+ uint16_t reg;
|
|
604
|
+ uint16_t rxfid;
|
|
605
|
+ uint16_t result;
|
606
|
606
|
hfa384x_rx_frame_t rxdesc;
|
607
|
607
|
hfa384x_t *hw = &hw_global;
|
608
|
|
-
|
|
608
|
+
|
609
|
609
|
/* Check for received packet */
|
610
|
610
|
reg = hfa384x_getreg(hw, HFA384x_EVSTAT);
|
611
|
611
|
if ( ! HFA384x_EVSTAT_ISRX(reg) ) {
|
|
@@ -617,7 +617,7 @@ static int prism2_poll(struct nic *nic, int retrieve)
|
617
|
617
|
|
618
|
618
|
/* Acknowledge RX event */
|
619
|
619
|
hfa384x_setreg(hw, HFA384x_EVACK_RX_SET(1), HFA384x_EVACK);
|
620
|
|
- /* Get RX FID */
|
|
620
|
+ /* Get RX FID */
|
621
|
621
|
rxfid = hfa384x_getreg(hw, HFA384x_RXFID);
|
622
|
622
|
/* Get the descriptor (including headers) */
|
623
|
623
|
result = hfa384x_copy_from_bap(hw, rxfid, 0, &rxdesc, sizeof(rxdesc));
|
|
@@ -660,8 +660,8 @@ static void prism2_transmit(
|
660
|
660
|
hfa384x_t *hw = &hw_global;
|
661
|
661
|
hfa384x_tx_frame_t txdesc;
|
662
|
662
|
wlan_80211hdr_t p80211hdr = { wlan_llc_snap, {{0,0,0},0} };
|
663
|
|
- UINT16 fid;
|
664
|
|
- UINT16 status;
|
|
663
|
+ uint16_t fid;
|
|
664
|
+ uint16_t status;
|
665
|
665
|
int result;
|
666
|
666
|
|
667
|
667
|
// Request FID allocation
|
|
@@ -675,7 +675,7 @@ static void prism2_transmit(
|
675
|
675
|
|
676
|
676
|
/* Build Tx frame structure */
|
677
|
677
|
memset(&txdesc, 0, sizeof(txdesc));
|
678
|
|
- txdesc.tx_control = host2hfa384x_16( HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) |
|
|
678
|
+ txdesc.tx_control = host2hfa384x_16( HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) |
|
679
|
679
|
HFA384x_TX_TXEX_SET(1) | HFA384x_TX_TXOK_SET(1) );
|
680
|
680
|
txdesc.frame_control = host2ieee16( WLAN_SET_FC_FTYPE(WLAN_FTYPE_DATA) |
|
681
|
681
|
WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_DATAONLY) |
|
|
@@ -687,13 +687,13 @@ static void prism2_transmit(
|
687
|
687
|
/* Set up SNAP header */
|
688
|
688
|
/* Let OUI default to RFC1042 (0x000000) */
|
689
|
689
|
p80211hdr.snap.type = htons(t);
|
690
|
|
-
|
|
690
|
+
|
691
|
691
|
/* Copy txdesc, p80211hdr and payload parts to FID */
|
692
|
692
|
result = hfa384x_copy_to_bap(hw, fid, 0, &txdesc, sizeof(txdesc));
|
693
|
693
|
if ( result ) return; /* fail */
|
694
|
694
|
result = hfa384x_copy_to_bap( hw, fid, sizeof(txdesc), &p80211hdr, sizeof(p80211hdr) );
|
695
|
695
|
if ( result ) return; /* fail */
|
696
|
|
- result = hfa384x_copy_to_bap( hw, fid, sizeof(txdesc) + sizeof(p80211hdr), (UINT8*)p, s );
|
|
696
|
+ result = hfa384x_copy_to_bap( hw, fid, sizeof(txdesc) + sizeof(p80211hdr), (uint8_t*)p, s );
|
697
|
697
|
if ( result ) return; /* fail */
|
698
|
698
|
|
699
|
699
|
/* Issue Tx command */
|
|
@@ -702,7 +702,7 @@ static void prism2_transmit(
|
702
|
702
|
printf("hfa384x: Transmit failed with result %#hx.\n", result);
|
703
|
703
|
return;
|
704
|
704
|
}
|
705
|
|
-
|
|
705
|
+
|
706
|
706
|
/* Wait for transmit completion (or exception) */
|
707
|
707
|
result = hfa384x_wait_for_event(hw, HFA384x_EVSTAT_TXEXC | HFA384x_EVSTAT_TX, HFA384x_EVACK_INFO,
|
708
|
708
|
200, 500, "Tx to complete\n" );
|
|
@@ -760,8 +760,8 @@ You should omit the last argument struct pci_device * for a non-PCI NIC
|
760
|
760
|
***************************************************************************/
|
761
|
761
|
static int prism2_probe ( struct nic *nic, hfa384x_t *hw ) {
|
762
|
762
|
int result;
|
763
|
|
- UINT16 tmp16 = 0;
|
764
|
|
- UINT16 infofid;
|
|
763
|
+ uint16_t tmp16 = 0;
|
|
764
|
+ uint16_t infofid;
|
765
|
765
|
hfa384x_InfFrame_t inf;
|
766
|
766
|
char ssid[HFA384x_RID_CNFDESIREDSSID_LEN];
|
767
|
767
|
int info_count = 0;
|
|
@@ -820,17 +820,17 @@ static int prism2_probe ( struct nic *nic, hfa384x_t *hw ) {
|
820
|
820
|
} else {
|
821
|
821
|
printf ( "Attempting to autojoin to SSID %s (attempt %d)...", &ssid[2], info_count );
|
822
|
822
|
}
|
823
|
|
-
|
|
823
|
+
|
824
|
824
|
if ( !hfa384x_wait_for_event(hw, HFA384x_EVSTAT_INFO, 0, 1000, 2000, "Info event" ) ) return 0;
|
825
|
825
|
printf("done\n");
|
826
|
826
|
infofid = hfa384x_getreg(hw, HFA384x_INFOFID);
|
827
|
827
|
/* Retrieve the length */
|
828
|
|
- result = hfa384x_copy_from_bap( hw, infofid, 0, &inf.framelen, sizeof(UINT16));
|
|
828
|
+ result = hfa384x_copy_from_bap( hw, infofid, 0, &inf.framelen, sizeof(uint16_t));
|
829
|
829
|
if ( result ) return 0; /* fail */
|
830
|
830
|
inf.framelen = hfa384x2host_16(inf.framelen);
|
831
|
831
|
/* Retrieve the rest */
|
832
|
|
- result = hfa384x_copy_from_bap( hw, infofid, sizeof(UINT16),
|
833
|
|
- &(inf.infotype), inf.framelen * sizeof(UINT16));
|
|
832
|
+ result = hfa384x_copy_from_bap( hw, infofid, sizeof(uint16_t),
|
|
833
|
+ &(inf.infotype), inf.framelen * sizeof(uint16_t));
|
834
|
834
|
if ( result ) return 0; /* fail */
|
835
|
835
|
if ( inf.infotype != HFA384x_IT_LINKSTATUS ) {
|
836
|
836
|
/* Not a Link Status info frame: die */
|
|
@@ -843,13 +843,13 @@ static int prism2_probe ( struct nic *nic, hfa384x_t *hw ) {
|
843
|
843
|
printf ( "Link not connected (status %#hx)\n", inf.info.linkstatus.linkstatus );
|
844
|
844
|
}
|
845
|
845
|
} while ( inf.info.linkstatus.linkstatus != HFA384x_LINK_CONNECTED );
|
846
|
|
-
|
|
846
|
+
|
847
|
847
|
/* Retrieve BSSID and print Connected message */
|
848
|
848
|
result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CURRENTBSSID, hw->bssid, WLAN_BSSID_LEN);
|
849
|
849
|
|
850
|
850
|
DBG ( "Link connected (BSSID %s - ", eth_ntoa ( hw->bssid ) );
|
851
|
851
|
DBG ( " MAC address %s)\n", eth_ntoa (nic->node_addr ) );
|
852
|
|
-
|
|
852
|
+
|
853
|
853
|
/* point to NIC specific routines */
|
854
|
854
|
nic->nic_op = &prism2_operations;
|
855
|
855
|
return 1;
|