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