Procházet zdrojové kódy

Purge warnings from prism2 drivers

tags/v0.9.3
Marty Connor před 17 roky
rodič
revize
e5950283ec

+ 921
- 598
src/drivers/net/hfa384x.h
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 57
- 20
src/drivers/net/p80211hdr.h Zobrazit soubor

@@ -124,6 +124,8 @@
124 124
 #define WLAN_FSTYPE_DEAUTHEN		0x0c
125 125
 
126 126
 /* Control */
127
+#define WLAN_FSTYPE_BLOCKACKREQ		0x8
128
+#define WLAN_FSTYPE_BLOCKACK  		0x9
127 129
 #define WLAN_FSTYPE_PSPOLL		0x0a
128 130
 #define WLAN_FSTYPE_RTS			0x0b
129 131
 #define WLAN_FSTYPE_CTS			0x0c
@@ -218,35 +220,32 @@
218 220
 typedef UINT8 wlan_bss_ts_t[WLAN_BSS_TS_LEN];
219 221
 
220 222
 /* Generic 802.11 Header types */
221
-__WLAN_PRAGMA_PACK1__
223
+
222 224
 typedef struct p80211_hdr_a3
223 225
 {
224
-	UINT16	fc			__WLAN_ATTRIB_PACK__;
225
-	UINT16	dur			__WLAN_ATTRIB_PACK__;
226
-	UINT8	a1[WLAN_ADDR_LEN]	__WLAN_ATTRIB_PACK__;
227
-	UINT8	a2[WLAN_ADDR_LEN]	__WLAN_ATTRIB_PACK__;
228
-	UINT8	a3[WLAN_ADDR_LEN]	__WLAN_ATTRIB_PACK__;
229
-	UINT16	seq			__WLAN_ATTRIB_PACK__;
226
+	UINT16	fc;
227
+	UINT16	dur;
228
+	UINT8	a1[WLAN_ADDR_LEN];
229
+	UINT8	a2[WLAN_ADDR_LEN];
230
+	UINT8	a3[WLAN_ADDR_LEN];
231
+	UINT16	seq;
230 232
 } __WLAN_ATTRIB_PACK__ p80211_hdr_a3_t;
231
-__WLAN_PRAGMA_PACKDFLT__
232 233
 
233
-__WLAN_PRAGMA_PACK1__
234 234
 typedef struct p80211_hdr_a4
235 235
 {
236
-	UINT16	fc			__WLAN_ATTRIB_PACK__;
237
-	UINT16	dur			__WLAN_ATTRIB_PACK__;
238
-	UINT8	a1[WLAN_ADDR_LEN]	__WLAN_ATTRIB_PACK__;
239
-	UINT8	a2[WLAN_ADDR_LEN]	__WLAN_ATTRIB_PACK__;
240
-	UINT8	a3[WLAN_ADDR_LEN]	__WLAN_ATTRIB_PACK__;
241
-	UINT16	seq			__WLAN_ATTRIB_PACK__;
242
-	UINT8	a4[WLAN_ADDR_LEN]	__WLAN_ATTRIB_PACK__;
236
+	UINT16	fc;
237
+	UINT16	dur;
238
+	UINT8	a1[WLAN_ADDR_LEN];
239
+	UINT8	a2[WLAN_ADDR_LEN];
240
+	UINT8	a3[WLAN_ADDR_LEN];
241
+	UINT16	seq;
242
+	UINT8	a4[WLAN_ADDR_LEN];
243 243
 } __WLAN_ATTRIB_PACK__ p80211_hdr_a4_t;
244
-__WLAN_PRAGMA_PACKDFLT__
245 244
 
246 245
 typedef union p80211_hdr
247 246
 {
248
-	p80211_hdr_a3_t		a3 __WLAN_ATTRIB_PACK__;
249
-	p80211_hdr_a4_t		a4 __WLAN_ATTRIB_PACK__;
247
+	p80211_hdr_a3_t		a3;
248
+	p80211_hdr_a4_t		a4;
250 249
 } __WLAN_ATTRIB_PACK__ p80211_hdr_t;
251 250
 
252 251
 
@@ -257,6 +256,44 @@ typedef union p80211_hdr
257 256
 /*================================================================*/
258 257
 /* Function Declarations */
259 258
 
260
-void p802addr_to_str( char *buf, UINT8 *addr);
259
+/* Frame and header lenght macros */
260
+
261
+#define WLAN_CTL_FRAMELEN(fstype) (\
262
+	(fstype) == WLAN_FSTYPE_BLOCKACKREQ	? 24 : \
263
+	(fstype) == WLAN_FSTYPE_BLOCKACK   	? 152 : \
264
+	(fstype) == WLAN_FSTYPE_PSPOLL		? 20 : \
265
+	(fstype) == WLAN_FSTYPE_RTS		? 20 : \
266
+	(fstype) == WLAN_FSTYPE_CTS		? 14 : \
267
+	(fstype) == WLAN_FSTYPE_ACK		? 14 : \
268
+	(fstype) == WLAN_FSTYPE_CFEND		? 20 : \
269
+	(fstype) == WLAN_FSTYPE_CFENDCFACK	? 20 : 4)
270
+
271
+#define WLAN_FCS_LEN			4
272
+
273
+/* ftcl in HOST order */
274
+inline static UINT16 p80211_headerlen(UINT16 fctl)
275
+{
276
+	UINT16 hdrlen = 0;
277
+
278
+	switch ( WLAN_GET_FC_FTYPE(fctl) ) {
279
+	case WLAN_FTYPE_MGMT:
280
+		hdrlen = WLAN_HDR_A3_LEN;
281
+		break;
282
+	case WLAN_FTYPE_DATA:
283
+		hdrlen = WLAN_HDR_A3_LEN;
284
+		if ( WLAN_GET_FC_TODS(fctl) && WLAN_GET_FC_FROMDS(fctl) ) {
285
+			hdrlen += WLAN_ADDR_LEN;
286
+		}
287
+		break;
288
+	case WLAN_FTYPE_CTL:
289
+		hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) - 
290
+			WLAN_FCS_LEN; 
291
+		break;
292
+	default:
293
+		hdrlen = WLAN_HDR_A3_LEN;
294
+	}
295
+	
296
+	return hdrlen;
297
+}
261 298
 
262 299
 #endif /* _P80211HDR_H */

+ 14
- 9
src/drivers/net/prism2.c Zobrazit soubor

@@ -13,8 +13,8 @@ $Id$
13 13
  * your option) any later version.
14 14
  */
15 15
 
16
-#include "etherboot.h"
17
-#include "nic.h"
16
+#include <etherboot.h>
17
+#include <nic.h>
18 18
 #include <gpxe/pci.h>
19 19
 #include <gpxe/ethernet.h>
20 20
 
@@ -68,6 +68,11 @@ static const char hardcoded_ssid[] = "";
68 68
 #define __cpu_to_le16(x) (x)
69 69
 #define __cpu_to_le32(x) (x)
70 70
 
71
+#define hfa384x2host_16(n)	(__le16_to_cpu((UINT16)(n)))
72
+#define hfa384x2host_32(n)	(__le32_to_cpu((UINT32)(n)))
73
+#define host2hfa384x_16(n)	(__cpu_to_le16((UINT16)(n)))
74
+#define host2hfa384x_32(n)	(__cpu_to_le32((UINT32)(n)))
75
+
71 76
 /*
72 77
  * PLX9052 PCI register offsets
73 78
  * Taken from PLX9052 datasheet available from http://www.plxtech.com/download/9052/databook/9052db-20.pdf
@@ -135,19 +140,19 @@ static hfa384x_t hw_global = {
135 140
 
136 141
 typedef struct wlan_llc
137 142
 {
138
-  UINT8   dsap                            __WLAN_ATTRIB_PACK__;
139
-  UINT8   ssap                            __WLAN_ATTRIB_PACK__;
140
-  UINT8   ctl                             __WLAN_ATTRIB_PACK__;
141
-} __WLAN_ATTRIB_PACK__ wlan_llc_t;
143
+  UINT8   dsap;
144
+  UINT8   ssap;
145
+  UINT8   ctl;
146
+}  wlan_llc_t;
142 147
 
143 148
 static const wlan_llc_t wlan_llc_snap = { 0xaa, 0xaa, 0x03 }; /* LLC header indicating SNAP (?) */
144 149
 
145 150
 #define WLAN_IEEE_OUI_LEN 3
146 151
 typedef struct wlan_snap
147 152
 {
148
-  UINT8   oui[WLAN_IEEE_OUI_LEN]          __WLAN_ATTRIB_PACK__;
149
-  UINT16  type                            __WLAN_ATTRIB_PACK__;
150
-} __WLAN_ATTRIB_PACK__ wlan_snap_t;
153
+  UINT8   oui[WLAN_IEEE_OUI_LEN];
154
+  UINT16  type;
155
+} wlan_snap_t;
151 156
 
152 157
 typedef struct wlan_80211hdr
153 158
 {

+ 1
- 1
src/drivers/net/prism2_pci.c Zobrazit soubor

@@ -15,7 +15,7 @@ $Id$
15 15
  */
16 16
 
17 17
 #include <gpxe/pci.h>
18
-#include "nic.h"
18
+#include <nic.h>
19 19
 
20 20
 #define WLAN_HOSTIF WLAN_PCI
21 21
 #include "prism2.c"

+ 1
- 1
src/drivers/net/prism2_plx.c Zobrazit soubor

@@ -15,7 +15,7 @@ $Id$
15 15
  */
16 16
 
17 17
 #include <gpxe/pci.h>
18
-#include "nic.h"
18
+#include <nic.h>
19 19
 
20 20
 #define WLAN_HOSTIF WLAN_PLX
21 21
 #include "prism2.c"

Načítá se…
Zrušit
Uložit