Browse Source

[prism2] Use standard type names

Avoid using UINT16 and similar typedefs, which are non-standard in the
iPXE codebase and generate conflicts when trying to include any of the
EFI headers.

Also fix trailing whitespace in the affected files, to prevent
complaints from git.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
8a49782eeb
4 changed files with 1361 additions and 1383 deletions
  1. 1203
    1203
      src/drivers/net/hfa384x.h
  2. 51
    51
      src/drivers/net/p80211hdr.h
  3. 95
    95
      src/drivers/net/prism2.c
  4. 12
    34
      src/drivers/net/wlan_compat.h

+ 1203
- 1203
src/drivers/net/hfa384x.h
File diff suppressed because it is too large
View File


+ 51
- 51
src/drivers/net/p80211hdr.h View File

@@ -39,7 +39,7 @@
39 39
 *
40 40
 * --------------------------------------------------------------------
41 41
 *
42
-* Portions of the development of this software were funded by 
42
+* Portions of the development of this software were funded by
43 43
 * Intersil Corporation as part of PRISM(R) chipset product development.
44 44
 *
45 45
 * --------------------------------------------------------------------
@@ -47,7 +47,7 @@
47 47
 * This file declares the constants and types used in the interface
48 48
 * between a wlan driver and the user mode utilities.
49 49
 *
50
-* Note: 
50
+* Note:
51 51
 *  - Constant values are always in HOST byte order.  To assign
52 52
 *    values to multi-byte fields they _must_ be converted to
53 53
 *    ieee byte order.  To retrieve multi-byte values from incoming
@@ -117,7 +117,7 @@ FILE_LICENCE ( GPL2_ONLY );
117 117
 #define WLAN_FSTYPE_ASSOCRESP		0x01
118 118
 #define WLAN_FSTYPE_REASSOCREQ		0x02
119 119
 #define WLAN_FSTYPE_REASSOCRESP		0x03
120
-#define WLAN_FSTYPE_PROBEREQ		0x04 
120
+#define WLAN_FSTYPE_PROBEREQ		0x04
121 121
 #define WLAN_FSTYPE_PROBERESP		0x05
122 122
 #define WLAN_FSTYPE_BEACON		0x08
123 123
 #define WLAN_FSTYPE_ATIM		0x09
@@ -168,29 +168,29 @@ FILE_LICENCE ( GPL2_ONLY );
168 168
 /*                        SET_FC_FSTYPE(WLAN_FSTYPE_RTS) );   */
169 169
 /*------------------------------------------------------------*/
170 170
 
171
-#define WLAN_GET_FC_PVER(n)	 (((UINT16)(n)) & (BIT0 | BIT1))
172
-#define WLAN_GET_FC_FTYPE(n)	((((UINT16)(n)) & (BIT2 | BIT3)) >> 2)
173
-#define WLAN_GET_FC_FSTYPE(n)	((((UINT16)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
174
-#define WLAN_GET_FC_TODS(n) 	((((UINT16)(n)) & (BIT8)) >> 8)
175
-#define WLAN_GET_FC_FROMDS(n)	((((UINT16)(n)) & (BIT9)) >> 9)
176
-#define WLAN_GET_FC_MOREFRAG(n) ((((UINT16)(n)) & (BIT10)) >> 10)
177
-#define WLAN_GET_FC_RETRY(n)	((((UINT16)(n)) & (BIT11)) >> 11)
178
-#define WLAN_GET_FC_PWRMGT(n)	((((UINT16)(n)) & (BIT12)) >> 12)
179
-#define WLAN_GET_FC_MOREDATA(n) ((((UINT16)(n)) & (BIT13)) >> 13)
180
-#define WLAN_GET_FC_ISWEP(n)	((((UINT16)(n)) & (BIT14)) >> 14)
181
-#define WLAN_GET_FC_ORDER(n)	((((UINT16)(n)) & (BIT15)) >> 15)
182
-
183
-#define WLAN_SET_FC_PVER(n)	((UINT16)(n))
184
-#define WLAN_SET_FC_FTYPE(n)	(((UINT16)(n)) << 2)
185
-#define WLAN_SET_FC_FSTYPE(n)	(((UINT16)(n)) << 4)
186
-#define WLAN_SET_FC_TODS(n) 	(((UINT16)(n)) << 8)
187
-#define WLAN_SET_FC_FROMDS(n)	(((UINT16)(n)) << 9)
188
-#define WLAN_SET_FC_MOREFRAG(n) (((UINT16)(n)) << 10)
189
-#define WLAN_SET_FC_RETRY(n)	(((UINT16)(n)) << 11)
190
-#define WLAN_SET_FC_PWRMGT(n)	(((UINT16)(n)) << 12)
191
-#define WLAN_SET_FC_MOREDATA(n) (((UINT16)(n)) << 13)
192
-#define WLAN_SET_FC_ISWEP(n)	(((UINT16)(n)) << 14)
193
-#define WLAN_SET_FC_ORDER(n)	(((UINT16)(n)) << 15)
171
+#define WLAN_GET_FC_PVER(n)	 (((uint16_t)(n)) & (BIT0 | BIT1))
172
+#define WLAN_GET_FC_FTYPE(n)	((((uint16_t)(n)) & (BIT2 | BIT3)) >> 2)
173
+#define WLAN_GET_FC_FSTYPE(n)	((((uint16_t)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
174
+#define WLAN_GET_FC_TODS(n) 	((((uint16_t)(n)) & (BIT8)) >> 8)
175
+#define WLAN_GET_FC_FROMDS(n)	((((uint16_t)(n)) & (BIT9)) >> 9)
176
+#define WLAN_GET_FC_MOREFRAG(n) ((((uint16_t)(n)) & (BIT10)) >> 10)
177
+#define WLAN_GET_FC_RETRY(n)	((((uint16_t)(n)) & (BIT11)) >> 11)
178
+#define WLAN_GET_FC_PWRMGT(n)	((((uint16_t)(n)) & (BIT12)) >> 12)
179
+#define WLAN_GET_FC_MOREDATA(n) ((((uint16_t)(n)) & (BIT13)) >> 13)
180
+#define WLAN_GET_FC_ISWEP(n)	((((uint16_t)(n)) & (BIT14)) >> 14)
181
+#define WLAN_GET_FC_ORDER(n)	((((uint16_t)(n)) & (BIT15)) >> 15)
182
+
183
+#define WLAN_SET_FC_PVER(n)	((uint16_t)(n))
184
+#define WLAN_SET_FC_FTYPE(n)	(((uint16_t)(n)) << 2)
185
+#define WLAN_SET_FC_FSTYPE(n)	(((uint16_t)(n)) << 4)
186
+#define WLAN_SET_FC_TODS(n) 	(((uint16_t)(n)) << 8)
187
+#define WLAN_SET_FC_FROMDS(n)	(((uint16_t)(n)) << 9)
188
+#define WLAN_SET_FC_MOREFRAG(n) (((uint16_t)(n)) << 10)
189
+#define WLAN_SET_FC_RETRY(n)	(((uint16_t)(n)) << 11)
190
+#define WLAN_SET_FC_PWRMGT(n)	(((uint16_t)(n)) << 12)
191
+#define WLAN_SET_FC_MOREDATA(n) (((uint16_t)(n)) << 13)
192
+#define WLAN_SET_FC_ISWEP(n)	(((uint16_t)(n)) << 14)
193
+#define WLAN_SET_FC_ORDER(n)	(((uint16_t)(n)) << 15)
194 194
 
195 195
 /*--- Duration Macros ----------------------------------------*/
196 196
 /* Macros to get/set the bitfields of the Duration Field      */
@@ -203,45 +203,45 @@ FILE_LICENCE ( GPL2_ONLY );
203 203
 /* Macros to get/set the bitfields of the Sequence Control    */
204 204
 /* Field.                                                     */
205 205
 /*------------------------------------------------------------*/
206
-#define WLAN_GET_SEQ_FRGNUM(n) (((UINT16)(n)) & (BIT0|BIT1|BIT2|BIT3))
207
-#define WLAN_GET_SEQ_SEQNUM(n) ((((UINT16)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) 
206
+#define WLAN_GET_SEQ_FRGNUM(n) (((uint16_t)(n)) & (BIT0|BIT1|BIT2|BIT3))
207
+#define WLAN_GET_SEQ_SEQNUM(n) ((((uint16_t)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)
208 208
 
209 209
 /*--- Data ptr macro -----------------------------------------*/
210
-/* Creates a UINT8* to the data portion of a frame            */
210
+/* Creates a uint8_t* to the data portion of a frame            */
211 211
 /* Assumes you're passing in a ptr to the beginning of the hdr*/
212 212
 /*------------------------------------------------------------*/
213
-#define WLAN_HDR_A3_DATAP(p) (((UINT8*)(p)) + WLAN_HDR_A3_LEN)
214
-#define WLAN_HDR_A4_DATAP(p) (((UINT8*)(p)) + WLAN_HDR_A4_LEN)
213
+#define WLAN_HDR_A3_DATAP(p) (((uint8_t*)(p)) + WLAN_HDR_A3_LEN)
214
+#define WLAN_HDR_A4_DATAP(p) (((uint8_t*)(p)) + WLAN_HDR_A4_LEN)
215 215
 
216
-#define DOT11_RATE5_ISBASIC_GET(r)     (((UINT8)(r)) & BIT7)
216
+#define DOT11_RATE5_ISBASIC_GET(r)     (((uint8_t)(r)) & BIT7)
217 217
 
218 218
 /*================================================================*/
219 219
 /* Types */
220 220
 
221 221
 /* BSS Timestamp */
222
-typedef UINT8 wlan_bss_ts_t[WLAN_BSS_TS_LEN];
222
+typedef uint8_t wlan_bss_ts_t[WLAN_BSS_TS_LEN];
223 223
 
224 224
 /* Generic 802.11 Header types */
225 225
 
226 226
 typedef struct p80211_hdr_a3
227 227
 {
228
-	UINT16	fc;
229
-	UINT16	dur;
230
-	UINT8	a1[WLAN_ADDR_LEN];
231
-	UINT8	a2[WLAN_ADDR_LEN];
232
-	UINT8	a3[WLAN_ADDR_LEN];
233
-	UINT16	seq;
228
+	uint16_t	fc;
229
+	uint16_t	dur;
230
+	uint8_t	a1[WLAN_ADDR_LEN];
231
+	uint8_t	a2[WLAN_ADDR_LEN];
232
+	uint8_t	a3[WLAN_ADDR_LEN];
233
+	uint16_t	seq;
234 234
 } __WLAN_ATTRIB_PACK__ p80211_hdr_a3_t;
235 235
 
236 236
 typedef struct p80211_hdr_a4
237 237
 {
238
-	UINT16	fc;
239
-	UINT16	dur;
240
-	UINT8	a1[WLAN_ADDR_LEN];
241
-	UINT8	a2[WLAN_ADDR_LEN];
242
-	UINT8	a3[WLAN_ADDR_LEN];
243
-	UINT16	seq;
244
-	UINT8	a4[WLAN_ADDR_LEN];
238
+	uint16_t	fc;
239
+	uint16_t	dur;
240
+	uint8_t	a1[WLAN_ADDR_LEN];
241
+	uint8_t	a2[WLAN_ADDR_LEN];
242
+	uint8_t	a3[WLAN_ADDR_LEN];
243
+	uint16_t	seq;
244
+	uint8_t	a4[WLAN_ADDR_LEN];
245 245
 } __WLAN_ATTRIB_PACK__ p80211_hdr_a4_t;
246 246
 
247 247
 typedef union p80211_hdr
@@ -273,9 +273,9 @@ typedef union p80211_hdr
273 273
 #define WLAN_FCS_LEN			4
274 274
 
275 275
 /* ftcl in HOST order */
276
-inline static UINT16 p80211_headerlen(UINT16 fctl)
276
+inline static uint16_t p80211_headerlen(uint16_t fctl)
277 277
 {
278
-	UINT16 hdrlen = 0;
278
+	uint16_t hdrlen = 0;
279 279
 
280 280
 	switch ( WLAN_GET_FC_FTYPE(fctl) ) {
281 281
 	case WLAN_FTYPE_MGMT:
@@ -288,13 +288,13 @@ inline static UINT16 p80211_headerlen(UINT16 fctl)
288 288
 		}
289 289
 		break;
290 290
 	case WLAN_FTYPE_CTL:
291
-		hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) - 
292
-			WLAN_FCS_LEN; 
291
+		hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) -
292
+			WLAN_FCS_LEN;
293 293
 		break;
294 294
 	default:
295 295
 		hdrlen = WLAN_HDR_A3_LEN;
296 296
 	}
297
-	
297
+
298 298
 	return hdrlen;
299 299
 }
300 300
 

+ 95
- 95
src/drivers/net/prism2.c View File

@@ -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*)(&reg))[0];
354
+      d[len-1] = ((uint8_t*)(&reg))[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;

+ 12
- 34
src/drivers/net/wlan_compat.h View File

@@ -39,7 +39,7 @@
39 39
 *
40 40
 * --------------------------------------------------------------------
41 41
 *
42
-* Portions of the development of this software were funded by 
42
+* Portions of the development of this software were funded by
43 43
 * Intersil Corporation as part of PRISM(R) chipset product development.
44 44
 *
45 45
 * --------------------------------------------------------------------
@@ -109,7 +109,7 @@ FILE_LICENCE ( GPL2_ONLY );
109 109
 /* Lets try to figure out what we've got.  Kernel mode or User mode? */
110 110
 #if defined(__KERNEL__)
111 111
 	#define WLAN_OS				WLAN_LINUX_KERNEL
112
-#else 
112
+#else
113 113
 	#define WLAN_OS				WLAN_LINUX_USER
114 114
 #endif
115 115
 
@@ -179,8 +179,8 @@ FILE_LICENCE ( GPL2_ONLY );
179 179
           Linux/PPC on PowerMacs (PCI)
180 180
 	  Arm/Intel Xscale (PCI)
181 181
 
182
-   This may also affect PLX boards and other BE &| PPC platforms; 
183
-   as new ones are discovered, add them below. 
182
+   This may also affect PLX boards and other BE &| PPC platforms;
183
+   as new ones are discovered, add them below.
184 184
 */
185 185
 
186 186
 #if (WLAN_HOSTIF == WLAN_PCI)
@@ -226,28 +226,6 @@ FILE_LICENCE ( GPL2_ONLY );
226 226
 #define BIT30	0x40000000
227 227
 #define BIT31	0x80000000
228 228
 
229
-typedef unsigned char   UINT8;
230
-typedef unsigned short  UINT16;
231
-typedef unsigned long   UINT32;
232
-
233
-typedef signed char     INT8;
234
-typedef signed short    INT16;
235
-typedef signed long     INT32;
236
-
237
-typedef unsigned int    UINT;
238
-typedef signed int      INT;
239
-
240
-typedef unsigned long long	UINT64;
241
-typedef signed long long	INT64;
242
-
243
-#define UINT8_MAX	(0xffUL)
244
-#define UINT16_MAX	(0xffffUL)
245
-#define UINT32_MAX	(0xffffffffUL)
246
-
247
-#define INT8_MAX	(0x7fL)
248
-#define INT16_MAX	(0x7fffL)
249
-#define INT32_MAX	(0x7fffffffL)
250
-
251 229
 /*=============================================================*/
252 230
 /*------ Compiler Portability Macros --------------------------*/
253 231
 /*=============================================================*/
@@ -298,7 +276,7 @@ typedef signed long long	INT64;
298 276
 			int __i__; \
299 277
 			printk(KERN_DEBUG x ":"); \
300 278
 			for( __i__=0; __i__ < (n); __i__++) \
301
-				printk( " %02x", ((UINT8*)(p))[__i__]); \
279
+				printk( " %02x", ((uint8_t*)(p))[__i__]); \
302 280
 			printk("\n"); }
303 281
 
304 282
 		#define DBFENTER { if ( WLAN_DBVAR >= 4 ){ WLAN_LOG_DEBUG0(3,"Enter\n"); } }
@@ -312,11 +290,11 @@ typedef signed long long	INT64;
312 290
 		#define WLAN_LOG_DEBUG5(l,x,n1,n2,n3,n4,n5) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x , __FUNCTION__ , (n1), (n2), (n3), (n4), (n5));
313 291
 		#define WLAN_LOG_DEBUG6(l,x,n1,n2,n3,n4,n5,n6) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x , __FUNCTION__ , (n1), (n2), (n3), (n4), (n5), (n6));
314 292
 	#else
315
-		#define WLAN_ASSERT(c) 
293
+		#define WLAN_ASSERT(c)
316 294
 		#define WLAN_HEX_DUMP( l, s, p, n)
317 295
 
318
-		#define DBFENTER 
319
-		#define DBFEXIT 
296
+		#define DBFENTER
297
+		#define DBFEXIT
320 298
 
321 299
 		#define WLAN_LOG_DEBUG0(l, s)
322 300
 		#define WLAN_LOG_DEBUG1(l, s,n)
@@ -344,11 +322,11 @@ typedef signed long long	INT64;
344 322
 	#define WLAN_LOG_NOTICE3(s,n1,n2,n3)
345 323
 	#define WLAN_LOG_NOTICE4(s,n1,n2,n3,n4)
346 324
 
347
-		#define WLAN_ASSERT(c) 
325
+		#define WLAN_ASSERT(c)
348 326
 		#define WLAN_HEX_DUMP( l, s, p, n)
349 327
 
350
-		#define DBFENTER 
351
-		#define DBFEXIT 
328
+		#define DBFENTER
329
+		#define DBFEXIT
352 330
 
353 331
 		#define WLAN_LOG_INFO0(s)
354 332
 		#define WLAN_LOG_INFO1(s,n)
@@ -378,7 +356,7 @@ typedef signed long long	INT64;
378 356
 
379 357
 #ifdef CONFIG_SMP
380 358
 #define __SMP__			1
381
-#endif	
359
+#endif
382 360
 
383 361
 #ifndef KERNEL_VERSION
384 362
 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

Loading…
Cancel
Save