]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/staging/ks7010/ks_hostif.h
743f31ead56e93e09ccd1b38e5a344f39e35fdab
[mirror_ubuntu-artful-kernel.git] / drivers / staging / ks7010 / ks_hostif.h
1 /*
2 * Driver for KeyStream wireless LAN
3 *
4 * Copyright (c) 2005-2008 KeyStream Corp.
5 * Copyright (C) 2009 Renesas Technology Corp.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12 #ifndef _KS_HOSTIF_H_
13 #define _KS_HOSTIF_H_
14
15 #include <linux/compiler.h>
16
17 /*
18 * HOST-MAC I/F events
19 */
20 #define HIF_DATA_REQ 0xE001
21 #define HIF_DATA_IND 0xE801
22 #define HIF_MIB_GET_REQ 0xE002
23 #define HIF_MIB_GET_CONF 0xE802
24 #define HIF_MIB_SET_REQ 0xE003
25 #define HIF_MIB_SET_CONF 0xE803
26 #define HIF_POWERMGT_REQ 0xE004
27 #define HIF_POWERMGT_CONF 0xE804
28 #define HIF_START_REQ 0xE005
29 #define HIF_START_CONF 0xE805
30 #define HIF_CONNECT_IND 0xE806
31 #define HIF_STOP_REQ 0xE006
32 #define HIF_STOP_CONF 0xE807
33 #define HIF_PS_ADH_SET_REQ 0xE007
34 #define HIF_PS_ADH_SET_CONF 0xE808
35 #define HIF_INFRA_SET_REQ 0xE008
36 #define HIF_INFRA_SET_CONF 0xE809
37 #define HIF_ADH_SET_REQ 0xE009
38 #define HIF_ADH_SET_CONF 0xE80A
39 #define HIF_AP_SET_REQ 0xE00A
40 #define HIF_AP_SET_CONF 0xE80B
41 #define HIF_ASSOC_INFO_IND 0xE80C
42 #define HIF_MIC_FAILURE_REQ 0xE00B
43 #define HIF_MIC_FAILURE_CONF 0xE80D
44 #define HIF_SCAN_REQ 0xE00C
45 #define HIF_SCAN_CONF 0xE80E
46 #define HIF_PHY_INFO_REQ 0xE00D
47 #define HIF_PHY_INFO_CONF 0xE80F
48 #define HIF_SLEEP_REQ 0xE00E
49 #define HIF_SLEEP_CONF 0xE810
50 #define HIF_PHY_INFO_IND 0xE811
51 #define HIF_SCAN_IND 0xE812
52 #define HIF_INFRA_SET2_REQ 0xE00F
53 #define HIF_INFRA_SET2_CONF 0xE813
54 #define HIF_ADH_SET2_REQ 0xE010
55 #define HIF_ADH_SET2_CONF 0xE814
56
57 #define HIF_REQ_MAX 0xE010
58
59 /*
60 * HOST-MAC I/F data structure
61 * Byte alignmet Little Endian
62 */
63
64 struct hostif_hdr {
65 uint16_t size;
66 uint16_t event;
67 } __packed;
68
69 struct hostif_data_request_t {
70 struct hostif_hdr header;
71 uint16_t auth_type;
72 #define TYPE_DATA 0x0000
73 #define TYPE_AUTH 0x0001
74 uint16_t reserved;
75 uint8_t data[0];
76 } __packed;
77
78 struct hostif_data_indication_t {
79 struct hostif_hdr header;
80 uint16_t auth_type;
81 /* #define TYPE_DATA 0x0000 */
82 #define TYPE_PMK1 0x0001
83 #define TYPE_GMK1 0x0002
84 #define TYPE_GMK2 0x0003
85 uint16_t reserved;
86 uint8_t data[0];
87 } __packed;
88
89 #define CHANNEL_LIST_MAX_SIZE 14
90 struct channel_list_t {
91 uint8_t size;
92 uint8_t body[CHANNEL_LIST_MAX_SIZE];
93 uint8_t pad;
94 } __packed;
95
96 /* MIB Attribute */
97 #define DOT11_MAC_ADDRESS 0x21010100 /* MAC Address (R) */
98 #define DOT11_PRODUCT_VERSION 0x31024100 /* FirmWare Version (R) */
99 #define DOT11_RTS_THRESHOLD 0x21020100 /* RTS Threshold (R/W) */
100 #define DOT11_FRAGMENTATION_THRESHOLD 0x21050100 /* Fragment Threshold (R/W) */
101 #define DOT11_PRIVACY_INVOKED 0x15010100 /* WEP ON/OFF (W) */
102 #define DOT11_WEP_DEFAULT_KEY_ID 0x15020100 /* WEP Index (W) */
103 #define DOT11_WEP_DEFAULT_KEY_VALUE1 0x13020101 /* WEP Key#1(TKIP AES: PairwiseTemporalKey) (W) */
104 #define DOT11_WEP_DEFAULT_KEY_VALUE2 0x13020102 /* WEP Key#2(TKIP AES: GroupKey1) (W) */
105 #define DOT11_WEP_DEFAULT_KEY_VALUE3 0x13020103 /* WEP Key#3(TKIP AES: GroupKey2) (W) */
106 #define DOT11_WEP_DEFAULT_KEY_VALUE4 0x13020104 /* WEP Key#4 (W) */
107 #define DOT11_WEP_LIST 0x13020100 /* WEP LIST */
108 #define DOT11_DESIRED_SSID 0x11090100 /* SSID */
109 #define DOT11_CURRENT_CHANNEL 0x45010100 /* channel set */
110 #define DOT11_OPERATION_RATE_SET 0x11110100 /* rate set */
111
112 #define LOCAL_AP_SEARCH_INTEAVAL 0xF1010100 /* AP search interval (R/W) */
113 #define LOCAL_CURRENTADDRESS 0xF1050100 /* MAC Adress change (W) */
114 #define LOCAL_MULTICAST_ADDRESS 0xF1060100 /* Multicast Adress (W) */
115 #define LOCAL_MULTICAST_FILTER 0xF1060200 /* Multicast Adress Filter enable/disable (W) */
116 #define LOCAL_SEARCHED_AP_LIST 0xF1030100 /* AP list (R) */
117 #define LOCAL_LINK_AP_STATUS 0xF1040100 /* Link AP status (R) */
118 #define LOCAL_PACKET_STATISTICS 0xF1020100 /* tx,rx packets statistics */
119 #define LOCAL_AP_SCAN_LIST_TYPE_SET 0xF1030200 /* AP_SCAN_LIST_TYPE */
120
121 #define DOT11_RSN_ENABLED 0x15070100 /* WPA enable/disable (W) */
122 #define LOCAL_RSN_MODE 0x56010100 /* RSN mode WPA/WPA2 (W) */
123 #define DOT11_RSN_CONFIG_MULTICAST_CIPHER 0x51040100 /* GroupKeyCipherSuite (W) */
124 #define DOT11_RSN_CONFIG_UNICAST_CIPHER 0x52020100 /* PairwiseKeyCipherSuite (W) */
125 #define DOT11_RSN_CONFIG_AUTH_SUITE 0x53020100 /* AuthenticationKeyManagementSuite (W) */
126 #define DOT11_RSN_CONFIG_VERSION 0x51020100 /* RSN version (W) */
127 #define LOCAL_RSN_CONFIG_ALL 0x5F010100 /* RSN CONFIG ALL (W) */
128 #define DOT11_PMK_TSC 0x55010100 /* PMK_TSC (W) */
129 #define DOT11_GMK1_TSC 0x55010101 /* GMK1_TSC (W) */
130 #define DOT11_GMK2_TSC 0x55010102 /* GMK2_TSC (W) */
131 #define DOT11_GMK3_TSC 0x55010103 /* GMK3_TSC */
132 #define LOCAL_PMK 0x58010100 /* Pairwise Master Key cache (W) */
133
134 #define LOCAL_REGION 0xF10A0100 /* Region setting */
135
136 #ifdef WPS
137 #define LOCAL_WPS_ENABLE 0xF10B0100 /* WiFi Protected Setup */
138 #define LOCAL_WPS_PROBE_REQ 0xF10C0100 /* WPS Probe Request */
139 #endif /* WPS */
140
141 #define LOCAL_GAIN 0xF10D0100 /* Carrer sense threshold for demo ato show */
142 #define LOCAL_EEPROM_SUM 0xF10E0100 /* EEPROM checksum information */
143
144 struct hostif_mib_get_request_t {
145 struct hostif_hdr header;
146 uint32_t mib_attribute;
147 } __packed;
148
149 struct hostif_mib_value_t {
150 uint16_t size;
151 uint16_t type;
152 #define MIB_VALUE_TYPE_NULL 0
153 #define MIB_VALUE_TYPE_INT 1
154 #define MIB_VALUE_TYPE_BOOL 2
155 #define MIB_VALUE_TYPE_COUNT32 3
156 #define MIB_VALUE_TYPE_OSTRING 4
157 uint8_t body[0];
158 } __packed;
159
160 struct hostif_mib_get_confirm_t {
161 struct hostif_hdr header;
162 uint32_t mib_status;
163 #define MIB_SUCCESS 0
164 #define MIB_INVALID 1
165 #define MIB_READ_ONLY 2
166 #define MIB_WRITE_ONLY 3
167 uint32_t mib_attribute;
168 struct hostif_mib_value_t mib_value;
169 } __packed;
170
171 struct hostif_mib_set_request_t {
172 struct hostif_hdr header;
173 uint32_t mib_attribute;
174 struct hostif_mib_value_t mib_value;
175 } __packed;
176
177 struct hostif_mib_set_confirm_t {
178 struct hostif_hdr header;
179 uint32_t mib_status;
180 uint32_t mib_attribute;
181 } __packed;
182
183 struct hostif_power_mngmt_request_t {
184 struct hostif_hdr header;
185 uint32_t mode;
186 #define POWER_ACTIVE 1
187 #define POWER_SAVE 2
188 uint32_t wake_up;
189 #define SLEEP_FALSE 0
190 #define SLEEP_TRUE 1 /* not used */
191 uint32_t receiveDTIMs;
192 #define DTIM_FALSE 0
193 #define DTIM_TRUE 1
194 } __packed;
195
196 /* power management mode */
197 enum {
198 POWMGT_ACTIVE_MODE = 0,
199 POWMGT_SAVE1_MODE,
200 POWMGT_SAVE2_MODE
201 };
202
203 #define RESULT_SUCCESS 0
204 #define RESULT_INVALID_PARAMETERS 1
205 #define RESULT_NOT_SUPPORTED 2
206 /* #define RESULT_ALREADY_RUNNING 3 */
207 #define RESULT_ALREADY_RUNNING 7
208
209 struct hostif_power_mngmt_confirm_t {
210 struct hostif_hdr header;
211 uint16_t result_code;
212 } __packed;
213
214 struct hostif_start_request_t {
215 struct hostif_hdr header;
216 uint16_t mode;
217 #define MODE_PSEUDO_ADHOC 0
218 #define MODE_INFRASTRUCTURE 1
219 #define MODE_AP 2 /* not used */
220 #define MODE_ADHOC 3
221 } __packed;
222
223 struct hostif_start_confirm_t {
224 struct hostif_hdr header;
225 uint16_t result_code;
226 } __packed;
227
228 #define SSID_MAX_SIZE 32
229 struct ssid_t {
230 uint8_t size;
231 uint8_t body[SSID_MAX_SIZE];
232 uint8_t ssid_pad;
233 } __packed;
234
235 #define RATE_SET_MAX_SIZE 16
236 struct rate_set8_t {
237 uint8_t size;
238 uint8_t body[8];
239 uint8_t rate_pad;
240 } __packed;
241
242 struct FhParms_t {
243 uint16_t dwellTime;
244 uint8_t hopSet;
245 uint8_t hopPattern;
246 uint8_t hopIndex;
247 } __packed;
248
249 struct DsParms_t {
250 uint8_t channel;
251 } __packed;
252
253 struct CfParms_t {
254 uint8_t count;
255 uint8_t period;
256 uint16_t maxDuration;
257 uint16_t durRemaining;
258 } __packed;
259
260 struct IbssParms_t {
261 uint16_t atimWindow;
262 } __packed;
263
264 struct rsn_t {
265 uint8_t size;
266 #define RSN_BODY_SIZE 64
267 uint8_t body[RSN_BODY_SIZE];
268 } __packed;
269
270 struct ErpParams_t {
271 uint8_t erp_info;
272 } __packed;
273
274 struct rate_set16_t {
275 uint8_t size;
276 uint8_t body[16];
277 uint8_t rate_pad;
278 } __packed;
279
280 struct ap_info_t {
281 uint8_t bssid[6]; /* +00 */
282 uint8_t rssi; /* +06 */
283 uint8_t sq; /* +07 */
284 uint8_t noise; /* +08 */
285 uint8_t pad0; /* +09 */
286 uint16_t beacon_period; /* +10 */
287 uint16_t capability; /* +12 */
288 #define BSS_CAP_ESS (1<<0)
289 #define BSS_CAP_IBSS (1<<1)
290 #define BSS_CAP_CF_POLABLE (1<<2)
291 #define BSS_CAP_CF_POLL_REQ (1<<3)
292 #define BSS_CAP_PRIVACY (1<<4)
293 #define BSS_CAP_SHORT_PREAMBLE (1<<5)
294 #define BSS_CAP_PBCC (1<<6)
295 #define BSS_CAP_CHANNEL_AGILITY (1<<7)
296 #define BSS_CAP_SHORT_SLOT_TIME (1<<10)
297 #define BSS_CAP_DSSS_OFDM (1<<13)
298 uint8_t frame_type; /* +14 */
299 uint8_t ch_info; /* +15 */
300 #define FRAME_TYPE_BEACON 0x80
301 #define FRAME_TYPE_PROBE_RESP 0x50
302 uint16_t body_size; /* +16 */
303 uint8_t body[1024]; /* +18 */
304 /* +1032 */
305 } __packed;
306
307 struct link_ap_info_t {
308 uint8_t bssid[6]; /* +00 */
309 uint8_t rssi; /* +06 */
310 uint8_t sq; /* +07 */
311 uint8_t noise; /* +08 */
312 uint8_t pad0; /* +09 */
313 uint16_t beacon_period; /* +10 */
314 uint16_t capability; /* +12 */
315 struct rate_set8_t rate_set; /* +14 */
316 struct FhParms_t fh_parameter; /* +24 */
317 struct DsParms_t ds_parameter; /* +29 */
318 struct CfParms_t cf_parameter; /* +30 */
319 struct IbssParms_t ibss_parameter; /* +36 */
320 struct ErpParams_t erp_parameter; /* +38 */
321 uint8_t pad1; /* +39 */
322 struct rate_set8_t ext_rate_set; /* +40 */
323 uint8_t DTIM_period; /* +50 */
324 uint8_t rsn_mode; /* +51 */
325 #define RSN_MODE_NONE 0
326 #define RSN_MODE_WPA 1
327 #define RSN_MODE_WPA2 2
328 struct {
329 uint8_t size; /* +52 */
330 uint8_t body[128]; /* +53 */
331 } __packed rsn;
332 } __packed;
333
334 struct hostif_connect_indication_t {
335 struct hostif_hdr header;
336 uint16_t connect_code;
337 #define RESULT_CONNECT 0
338 #define RESULT_DISCONNECT 1
339 struct link_ap_info_t link_ap_info;
340 } __packed;
341
342 struct hostif_stop_request_t {
343 struct hostif_hdr header;
344 } __packed;
345
346 struct hostif_stop_confirm_t {
347 struct hostif_hdr header;
348 uint16_t result_code;
349 } __packed;
350
351 struct hostif_ps_adhoc_set_request_t {
352 struct hostif_hdr header;
353 uint16_t phy_type;
354 #define D_11B_ONLY_MODE 0
355 #define D_11G_ONLY_MODE 1
356 #define D_11BG_COMPATIBLE_MODE 2
357 #define D_11A_ONLY_MODE 3
358 uint16_t cts_mode;
359 #define CTS_MODE_FALSE 0
360 #define CTS_MODE_TRUE 1
361 uint16_t channel;
362 struct rate_set16_t rate_set;
363 uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0
364 * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */
365 uint16_t scan_type;
366 } __packed;
367
368 struct hostif_ps_adhoc_set_confirm_t {
369 struct hostif_hdr header;
370 uint16_t result_code;
371 } __packed;
372
373 struct hostif_infrastructure_set_request_t {
374 struct hostif_hdr header;
375 uint16_t phy_type;
376 uint16_t cts_mode;
377 struct rate_set16_t rate_set;
378 struct ssid_t ssid;
379 uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0
380 * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */
381 uint16_t beacon_lost_count;
382 uint16_t auth_type;
383 #define AUTH_TYPE_OPEN_SYSTEM 0
384 #define AUTH_TYPE_SHARED_KEY 1
385 struct channel_list_t channel_list;
386 uint16_t scan_type;
387 } __packed;
388
389 struct hostif_infrastructure_set2_request_t {
390 struct hostif_hdr header;
391 uint16_t phy_type;
392 uint16_t cts_mode;
393 struct rate_set16_t rate_set;
394 struct ssid_t ssid;
395 uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0
396 * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */
397 uint16_t beacon_lost_count;
398 uint16_t auth_type;
399 #define AUTH_TYPE_OPEN_SYSTEM 0
400 #define AUTH_TYPE_SHARED_KEY 1
401 struct channel_list_t channel_list;
402 uint16_t scan_type;
403 uint8_t bssid[ETH_ALEN];
404 } __packed;
405
406 struct hostif_infrastructure_set_confirm_t {
407 struct hostif_hdr header;
408 uint16_t result_code;
409 } __packed;
410
411 struct hostif_adhoc_set_request_t {
412 struct hostif_hdr header;
413 uint16_t phy_type;
414 uint16_t cts_mode;
415 uint16_t channel;
416 struct rate_set16_t rate_set;
417 struct ssid_t ssid;
418 uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0
419 * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */
420 uint16_t scan_type;
421 } __packed;
422
423 struct hostif_adhoc_set2_request_t {
424 struct hostif_hdr header;
425 uint16_t phy_type;
426 uint16_t cts_mode;
427 uint16_t reserved;
428 struct rate_set16_t rate_set;
429 struct ssid_t ssid;
430 uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0
431 * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */
432 uint16_t scan_type;
433 struct channel_list_t channel_list;
434 uint8_t bssid[ETH_ALEN];
435 } __packed;
436
437 struct hostif_adhoc_set_confirm_t {
438 struct hostif_hdr header;
439 uint16_t result_code;
440 } __packed;
441
442 struct last_associate_t {
443 uint8_t type;
444 uint8_t status;
445 } __packed;
446
447 struct association_request_t {
448 uint8_t type;
449 #define FRAME_TYPE_ASSOC_REQ 0x00
450 #define FRAME_TYPE_REASSOC_REQ 0x20
451 uint8_t pad;
452 uint16_t capability;
453 uint16_t listen_interval;
454 uint8_t ap_address[6];
455 uint16_t reqIEs_size;
456 } __packed;
457
458 struct association_response_t {
459 uint8_t type;
460 #define FRAME_TYPE_ASSOC_RESP 0x10
461 #define FRAME_TYPE_REASSOC_RESP 0x30
462 uint8_t pad;
463 uint16_t capability;
464 uint16_t status;
465 uint16_t association_id;
466 uint16_t respIEs_size;
467 } __packed;
468
469 struct hostif_associate_indication_t {
470 struct hostif_hdr header;
471 struct association_request_t assoc_req;
472 struct association_response_t assoc_resp;
473 /* followed by (reqIEs_size + respIEs_size) octets of data */
474 /* reqIEs data *//* respIEs data */
475 } __packed;
476
477 struct hostif_bss_scan_request_t {
478 struct hostif_hdr header;
479 uint8_t scan_type;
480 #define ACTIVE_SCAN 0
481 #define PASSIVE_SCAN 1
482 uint8_t pad[3];
483 uint32_t ch_time_min;
484 uint32_t ch_time_max;
485 struct channel_list_t channel_list;
486 struct ssid_t ssid;
487 } __packed;
488
489 struct hostif_bss_scan_confirm_t {
490 struct hostif_hdr header;
491 uint16_t result_code;
492 uint16_t reserved;
493 } __packed;
494
495 struct hostif_phy_information_request_t {
496 struct hostif_hdr header;
497 uint16_t type;
498 #define NORMAL_TYPE 0
499 #define TIME_TYPE 1
500 uint16_t time; /* unit 100ms */
501 } __packed;
502
503 struct hostif_phy_information_confirm_t {
504 struct hostif_hdr header;
505 uint8_t rssi;
506 uint8_t sq;
507 uint8_t noise;
508 uint8_t link_speed;
509 uint32_t tx_frame;
510 uint32_t rx_frame;
511 uint32_t tx_error;
512 uint32_t rx_error;
513 } __packed;
514
515 /* sleep mode */
516 #define SLP_ACTIVE 0
517 #define SLP_SLEEP 1
518 struct hostif_sleep_request_t {
519 struct hostif_hdr header;
520 } __packed;
521
522 struct hostif_sleep_confirm_t {
523 struct hostif_hdr header;
524 uint16_t result_code;
525 } __packed;
526
527 struct hostif_mic_failure_request_t {
528 struct hostif_hdr header;
529 uint16_t failure_count;
530 uint16_t timer;
531 } __packed;
532
533 struct hostif_mic_failure_confirm_t {
534 struct hostif_hdr header;
535 uint16_t result_code;
536 } __packed;
537
538 #define BASIC_RATE 0x80
539 #define RATE_MASK 0x7F
540
541 #define TX_RATE_AUTO 0xff
542 #define TX_RATE_1M_FIXED 0
543 #define TX_RATE_2M_FIXED 1
544 #define TX_RATE_1_2M_AUTO 2
545 #define TX_RATE_5M_FIXED 3
546 #define TX_RATE_11M_FIXED 4
547
548 #define TX_RATE_FULL_AUTO 0
549 #define TX_RATE_11_AUTO 1
550 #define TX_RATE_11B_AUTO 2
551 #define TX_RATE_11BG_AUTO 3
552 #define TX_RATE_MANUAL_AUTO 4
553 #define TX_RATE_FIXED 5
554
555 /* 11b rate */
556 #define TX_RATE_1M (uint8_t)(10/5) /* 11b 11g basic rate */
557 #define TX_RATE_2M (uint8_t)(20/5) /* 11b 11g basic rate */
558 #define TX_RATE_5M (uint8_t)(55/5) /* 11g basic rate */
559 #define TX_RATE_11M (uint8_t)(110/5) /* 11g basic rate */
560
561 /* 11g rate */
562 #define TX_RATE_6M (uint8_t)(60/5) /* 11g basic rate */
563 #define TX_RATE_12M (uint8_t)(120/5) /* 11g basic rate */
564 #define TX_RATE_24M (uint8_t)(240/5) /* 11g basic rate */
565 #define TX_RATE_9M (uint8_t)(90/5)
566 #define TX_RATE_18M (uint8_t)(180/5)
567 #define TX_RATE_36M (uint8_t)(360/5)
568 #define TX_RATE_48M (uint8_t)(480/5)
569 #define TX_RATE_54M (uint8_t)(540/5)
570
571 #define IS_11B_RATE(A) (((A&RATE_MASK)==TX_RATE_1M)||((A&RATE_MASK)==TX_RATE_2M)||\
572 ((A&RATE_MASK)==TX_RATE_5M)||((A&RATE_MASK)==TX_RATE_11M))
573
574 #define IS_OFDM_RATE(A) (((A&RATE_MASK)==TX_RATE_6M)||((A&RATE_MASK)==TX_RATE_12M)||\
575 ((A&RATE_MASK)==TX_RATE_24M)||((A&RATE_MASK)==TX_RATE_9M)||\
576 ((A&RATE_MASK)==TX_RATE_18M)||((A&RATE_MASK)==TX_RATE_36M)||\
577 ((A&RATE_MASK)==TX_RATE_48M)||((A&RATE_MASK)==TX_RATE_54M))
578
579 #define IS_11BG_RATE(A) (IS_11B_RATE(A)||IS_OFDM_RATE(A))
580
581 #define IS_OFDM_EXT_RATE(A) (((A&RATE_MASK)==TX_RATE_9M)||((A&RATE_MASK)==TX_RATE_18M)||\
582 ((A&RATE_MASK)==TX_RATE_36M)||((A&RATE_MASK)==TX_RATE_48M)||\
583 ((A&RATE_MASK)==TX_RATE_54M))
584
585 enum {
586 CONNECT_STATUS = 0,
587 DISCONNECT_STATUS
588 };
589
590 /* preamble type */
591 enum {
592 LONG_PREAMBLE = 0,
593 SHORT_PREAMBLE
594 };
595
596 /* multicast filter */
597 #define MCAST_FILTER_MCAST 0
598 #define MCAST_FILTER_MCASTALL 1
599 #define MCAST_FILTER_PROMISC 2
600
601 #define NIC_MAX_MCAST_LIST 32
602
603 /* macro function */
604 #define HIF_EVENT_MASK 0xE800
605 #define IS_HIF_IND(_EVENT) ((_EVENT&HIF_EVENT_MASK)==0xE800 && \
606 ((_EVENT&~HIF_EVENT_MASK)==0x0001 || \
607 (_EVENT&~HIF_EVENT_MASK)==0x0006 || \
608 (_EVENT&~HIF_EVENT_MASK)==0x000C || \
609 (_EVENT&~HIF_EVENT_MASK)==0x0011 || \
610 (_EVENT&~HIF_EVENT_MASK)==0x0012))
611
612 #define IS_HIF_CONF(_EVENT) ((_EVENT&HIF_EVENT_MASK)==0xE800 && \
613 (_EVENT&~HIF_EVENT_MASK)>0x0000 && \
614 (_EVENT&~HIF_EVENT_MASK)<0x0012 && \
615 !IS_HIF_IND(_EVENT) )
616
617 #ifdef __KERNEL__
618
619 #include "ks_wlan.h"
620
621 /* function prototype */
622 int hostif_data_request(struct ks_wlan_private *priv,
623 struct sk_buff *packet);
624 void hostif_receive(struct ks_wlan_private *priv, unsigned char *p,
625 unsigned int size);
626 void hostif_sme_enqueue(struct ks_wlan_private *priv, uint16_t event);
627 int hostif_init(struct ks_wlan_private *priv);
628 void hostif_exit(struct ks_wlan_private *priv);
629 int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p,
630 unsigned long size,
631 void (*complete_handler) (void *arg1, void *arg2),
632 void *arg1, void *arg2);
633 void send_packet_complete(void *, void *);
634
635 void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv);
636 int ks_wlan_hw_power_save(struct ks_wlan_private *priv);
637
638 static
639 inline int hif_align_size(int size)
640 {
641 #ifdef KS_ATOM
642 if (size < 1024)
643 size = 1024;
644 #endif
645 #ifdef DEVICE_ALIGNMENT
646 return (size % DEVICE_ALIGNMENT) ? size + DEVICE_ALIGNMENT -
647 (size % DEVICE_ALIGNMENT) : size;
648 #else
649 return size;
650 #endif
651 }
652
653 #endif /* __KERNEL__ */
654
655 #endif /* _KS_HOSTIF_H_ */