1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *   Driver for KeyStream wireless LAN
4  *
5  *   Copyright (c) 2005-2008 KeyStream Corp.
6  *   Copyright (C) 2009 Renesas Technology Corp.
7  */
8 
9 #ifndef _KS_HOSTIF_H_
10 #define _KS_HOSTIF_H_
11 
12 #include <linux/compiler.h>
13 #include <linux/ieee80211.h>
14 
15 /*
16  * HOST-MAC I/F events
17  */
18 #define HIF_DATA_REQ		0xE001
19 #define HIF_DATA_IND		0xE801
20 #define HIF_MIB_GET_REQ		0xE002
21 #define HIF_MIB_GET_CONF	0xE802
22 #define HIF_MIB_SET_REQ		0xE003
23 #define HIF_MIB_SET_CONF	0xE803
24 #define HIF_POWER_MGMT_REQ	0xE004
25 #define HIF_POWER_MGMT_CONF	0xE804
26 #define HIF_START_REQ		0xE005
27 #define HIF_START_CONF		0xE805
28 #define HIF_CONNECT_IND		0xE806
29 #define HIF_STOP_REQ		0xE006
30 #define HIF_STOP_CONF		0xE807
31 #define HIF_PS_ADH_SET_REQ	0xE007
32 #define HIF_PS_ADH_SET_CONF	0xE808
33 #define HIF_INFRA_SET_REQ	0xE008
34 #define HIF_INFRA_SET_CONF	0xE809
35 #define HIF_ADH_SET_REQ		0xE009
36 #define HIF_ADH_SET_CONF	0xE80A
37 #define HIF_AP_SET_REQ		0xE00A
38 #define HIF_AP_SET_CONF		0xE80B
39 #define HIF_ASSOC_INFO_IND	0xE80C
40 #define HIF_MIC_FAILURE_REQ	0xE00B
41 #define HIF_MIC_FAILURE_CONF	0xE80D
42 #define HIF_SCAN_REQ		0xE00C
43 #define HIF_SCAN_CONF		0xE80E
44 #define HIF_PHY_INFO_REQ	0xE00D
45 #define HIF_PHY_INFO_CONF	0xE80F
46 #define HIF_SLEEP_REQ		0xE00E
47 #define HIF_SLEEP_CONF		0xE810
48 #define HIF_PHY_INFO_IND	0xE811
49 #define HIF_SCAN_IND		0xE812
50 #define HIF_INFRA_SET2_REQ	0xE00F
51 #define HIF_INFRA_SET2_CONF	0xE813
52 #define HIF_ADH_SET2_REQ	0xE010
53 #define HIF_ADH_SET2_CONF	0xE814
54 
55 #define HIF_REQ_MAX		0xE010
56 
57 /*
58  * HOST-MAC I/F data structure
59  * Byte alignment Little Endian
60  */
61 
62 struct hostif_hdr {
63 	__le16 size;
64 	__le16 event;
65 } __packed;
66 
67 struct hostif_data_request {
68 	struct hostif_hdr header;
69 	__le16 auth_type;
70 #define TYPE_DATA 0x0000
71 #define TYPE_AUTH 0x0001
72 	__le16 reserved;
73 	u8 data[];
74 } __packed;
75 
76 #define TYPE_PMK1 0x0001
77 #define TYPE_GMK1 0x0002
78 #define TYPE_GMK2 0x0003
79 
80 #define CHANNEL_LIST_MAX_SIZE 14
81 struct channel_list {
82 	u8 size;
83 	u8 body[CHANNEL_LIST_MAX_SIZE];
84 	u8 pad;
85 } __packed;
86 
87 /**
88  * enum mib_attribute - Management Information Base attribute
89  * Attribute value used for accessing and updating MIB
90  *
91  * @DOT11_MAC_ADDRESS: MAC Address (R)
92  * @DOT11_PRODUCT_VERSION: FirmWare Version (R)
93  * @DOT11_RTS_THRESHOLD: RTS Threshold (R/W)
94  * @DOT11_FRAGMENTATION_THRESHOLD: Fragment Threshold (R/W)
95  * @DOT11_PRIVACY_INVOKED: WEP ON/OFF (W)
96  * @DOT11_WEP_DEFAULT_KEY_ID: WEP Index (W)
97  * @DOT11_WEP_DEFAULT_KEY_VALUE1: WEP Key#1(TKIP AES: PairwiseTemporalKey) (W)
98  * @DOT11_WEP_DEFAULT_KEY_VALUE2: WEP Key#2(TKIP AES: GroupKey1) (W)
99  * @DOT11_WEP_DEFAULT_KEY_VALUE3: WEP Key#3(TKIP AES: GroupKey2) (W)
100  * @DOT11_WEP_DEFAULT_KEY_VALUE4: WEP Key#4 (W)
101  * @DOT11_WEP_LIST: WEP LIST
102  * @DOT11_DESIRED_SSID: SSID
103  * @DOT11_CURRENT_CHANNEL: channel set
104  * @DOT11_OPERATION_RATE_SET: rate set
105  * @LOCAL_AP_SEARCH_INTERVAL: AP search interval (R/W)
106  * @LOCAL_CURRENTADDRESS: MAC Address change (W)
107  * @LOCAL_MULTICAST_ADDRESS: Multicast Address (W)
108  * @LOCAL_MULTICAST_FILTER: Multicast Address Filter enable/disable (W)
109  * @LOCAL_SEARCHED_AP_LIST: AP list (R)
110  * @LOCAL_LINK_AP_STATUS: Link AP status (R)
111  * @LOCAL_PACKET_STATISTICS: tx,rx packets statistics
112  * @LOCAL_AP_SCAN_LIST_TYPE_SET: AP_SCAN_LIST_TYPE
113  * @DOT11_RSN_ENABLED: WPA enable/disable (W)
114  * @LOCAL_RSN_MODE: RSN mode WPA/WPA2 (W)
115  * @DOT11_RSN_CONFIG_MULTICAST_CIPHER: GroupKeyCipherSuite (W)
116  * @DOT11_RSN_CONFIG_UNICAST_CIPHER: PairwiseKeyCipherSuite (W)
117  * @DOT11_RSN_CONFIG_AUTH_SUITE: AuthenticationKeyManagementSuite (W)
118  * @DOT11_RSN_CONFIG_VERSION: RSN version (W)
119  * @LOCAL_RSN_CONFIG_ALL: RSN CONFIG ALL (W)
120  * @DOT11_PMK_TSC: PMK_TSC (W)
121  * @DOT11_GMK1_TSC: GMK1_TSC (W)
122  * @DOT11_GMK2_TSC: GMK2_TSC (W)
123  * @DOT11_GMK3_TSC: GMK3_TSC
124  * @LOCAL_PMK: Pairwise Master Key cache (W)
125  * @LOCAL_REGION: Region setting
126  * @LOCAL_WPS_ENABLE: WiFi Protected Setup
127  * @LOCAL_WPS_PROBE_REQ: WPS Probe Request
128  * @LOCAL_GAIN: Carrer sense threshold for demo ato show
129  * @LOCAL_EEPROM_SUM: EEPROM checksum information
130  */
131 enum mib_attribute {
132 	DOT11_MAC_ADDRESS                 = 0x21010100,
133 	DOT11_PRODUCT_VERSION             = 0x31024100,
134 	DOT11_RTS_THRESHOLD               = 0x21020100,
135 	DOT11_FRAGMENTATION_THRESHOLD     = 0x21050100,
136 	DOT11_PRIVACY_INVOKED             = 0x15010100,
137 	DOT11_WEP_DEFAULT_KEY_ID          = 0x15020100,
138 	DOT11_WEP_DEFAULT_KEY_VALUE1      = 0x13020101,
139 	DOT11_WEP_DEFAULT_KEY_VALUE2      = 0x13020102,
140 	DOT11_WEP_DEFAULT_KEY_VALUE3      = 0x13020103,
141 	DOT11_WEP_DEFAULT_KEY_VALUE4      = 0x13020104,
142 	DOT11_WEP_LIST                    = 0x13020100,
143 	DOT11_DESIRED_SSID		  = 0x11090100,
144 	DOT11_CURRENT_CHANNEL		  = 0x45010100,
145 	DOT11_OPERATION_RATE_SET	  = 0x11110100,
146 	LOCAL_AP_SEARCH_INTERVAL          = 0xF1010100,
147 	LOCAL_CURRENTADDRESS              = 0xF1050100,
148 	LOCAL_MULTICAST_ADDRESS           = 0xF1060100,
149 	LOCAL_MULTICAST_FILTER            = 0xF1060200,
150 	LOCAL_SEARCHED_AP_LIST            = 0xF1030100,
151 	LOCAL_LINK_AP_STATUS              = 0xF1040100,
152 	LOCAL_PACKET_STATISTICS		  = 0xF1020100,
153 	LOCAL_AP_SCAN_LIST_TYPE_SET	  = 0xF1030200,
154 	DOT11_RSN_ENABLED                 = 0x15070100,
155 	LOCAL_RSN_MODE                    = 0x56010100,
156 	DOT11_RSN_CONFIG_MULTICAST_CIPHER = 0x51040100,
157 	DOT11_RSN_CONFIG_UNICAST_CIPHER   = 0x52020100,
158 	DOT11_RSN_CONFIG_AUTH_SUITE       = 0x53020100,
159 	DOT11_RSN_CONFIG_VERSION          = 0x51020100,
160 	LOCAL_RSN_CONFIG_ALL              = 0x5F010100,
161 	DOT11_PMK_TSC                     = 0x55010100,
162 	DOT11_GMK1_TSC                    = 0x55010101,
163 	DOT11_GMK2_TSC                    = 0x55010102,
164 	DOT11_GMK3_TSC                    = 0x55010103,
165 	LOCAL_PMK                         = 0x58010100,
166 	LOCAL_REGION                      = 0xF10A0100,
167 	LOCAL_WPS_ENABLE                  = 0xF10B0100,
168 	LOCAL_WPS_PROBE_REQ               = 0xF10C0100,
169 	LOCAL_GAIN                        = 0xF10D0100,
170 	LOCAL_EEPROM_SUM                  = 0xF10E0100
171 };
172 
173 struct hostif_mib_get_request {
174 	struct hostif_hdr header;
175 	__le32 mib_attribute;
176 } __packed;
177 
178 /**
179  * enum mib_data_type - Message Information Base data type.
180  * @MIB_VALUE_TYPE_NULL: NULL type
181  * @MIB_VALUE_TYPE_INT: INTEGER type
182  * @MIB_VALUE_TYPE_BOOL: BOOL type
183  * @MIB_VALUE_TYPE_COUNT32: unused
184  * @MIB_VALUE_TYPE_OSTRING: Chunk of memory
185  */
186 enum mib_data_type {
187 	MIB_VALUE_TYPE_NULL = 0,
188 	MIB_VALUE_TYPE_INT,
189 	MIB_VALUE_TYPE_BOOL,
190 	MIB_VALUE_TYPE_COUNT32,
191 	MIB_VALUE_TYPE_OSTRING
192 };
193 
194 struct hostif_mib_value {
195 	__le16 size;
196 	__le16 type;
197 	u8 body[];
198 } __packed;
199 
200 struct hostif_mib_get_confirm_t {
201 	struct hostif_hdr header;
202 	__le32 mib_status;
203 #define MIB_SUCCESS    0
204 #define MIB_INVALID    1
205 #define MIB_READ_ONLY  2
206 #define MIB_WRITE_ONLY 3
207 	__le32 mib_attribute;
208 	struct hostif_mib_value mib_value;
209 } __packed;
210 
211 struct hostif_mib_set_request_t {
212 	struct hostif_hdr header;
213 	__le32 mib_attribute;
214 	struct hostif_mib_value mib_value;
215 } __packed;
216 
217 struct hostif_power_mgmt_request {
218 	struct hostif_hdr header;
219 	__le32 mode;
220 #define POWER_ACTIVE  1
221 #define POWER_SAVE    2
222 	__le32 wake_up;
223 #define SLEEP_FALSE 0
224 #define SLEEP_TRUE  1	/* not used */
225 	__le32 receive_dtims;
226 #define DTIM_FALSE 0
227 #define DTIM_TRUE  1
228 } __packed;
229 
230 enum power_mgmt_mode_type {
231 	POWER_MGMT_ACTIVE,
232 	POWER_MGMT_SAVE1,
233 	POWER_MGMT_SAVE2
234 };
235 
236 #define	RESULT_SUCCESS            0
237 #define	RESULT_INVALID_PARAMETERS 1
238 #define	RESULT_NOT_SUPPORTED      2
239 /* #define	RESULT_ALREADY_RUNNING    3 */
240 #define	RESULT_ALREADY_RUNNING    7
241 
242 struct hostif_start_request {
243 	struct hostif_hdr header;
244 	__le16 mode;
245 #define MODE_PSEUDO_ADHOC   0
246 #define MODE_INFRASTRUCTURE 1
247 #define MODE_AP             2	/* not used */
248 #define MODE_ADHOC          3
249 } __packed;
250 
251 struct ssid {
252 	u8 size;
253 	u8 body[IEEE80211_MAX_SSID_LEN];
254 	u8 ssid_pad;
255 } __packed;
256 
257 #define RATE_SET_MAX_SIZE 16
258 struct rate_set8 {
259 	u8 size;
260 	u8 body[8];
261 	u8 rate_pad;
262 } __packed;
263 
264 struct fh_parms {
265 	__le16 dwell_time;
266 	u8 hop_set;
267 	u8 hop_pattern;
268 	u8 hop_index;
269 } __packed;
270 
271 struct ds_parms {
272 	u8 channel;
273 } __packed;
274 
275 struct cf_parms {
276 	u8 count;
277 	u8 period;
278 	__le16 max_duration;
279 	__le16 dur_remaining;
280 } __packed;
281 
282 struct ibss_parms {
283 	__le16 atim_window;
284 } __packed;
285 
286 struct rsn_t {
287 	u8 size;
288 #define RSN_BODY_SIZE 64
289 	u8 body[RSN_BODY_SIZE];
290 } __packed;
291 
292 struct erp_params_t {
293 	u8 erp_info;
294 } __packed;
295 
296 struct rate_set16 {
297 	u8 size;
298 	u8 body[16];
299 	u8 rate_pad;
300 } __packed;
301 
302 struct ap_info {
303 	u8 bssid[6];	/* +00 */
304 	u8 rssi;	/* +06 */
305 	u8 sq;	/* +07 */
306 	u8 noise;	/* +08 */
307 	u8 pad0;	/* +09 */
308 	__le16 beacon_period;	/* +10 */
309 	__le16 capability;	/* +12 */
310 	u8 frame_type;	/* +14 */
311 	u8 ch_info;	/* +15 */
312 	__le16 body_size;	/* +16 */
313 	u8 body[1024];	/* +18 */
314 	/* +1032 */
315 } __packed;
316 
317 struct link_ap_info {
318 	u8 bssid[6];	/* +00 */
319 	u8 rssi;	/* +06 */
320 	u8 sq;	/* +07 */
321 	u8 noise;	/* +08 */
322 	u8 pad0;	/* +09 */
323 	__le16 beacon_period;	/* +10 */
324 	__le16 capability;	/* +12 */
325 	struct rate_set8 rate_set;	/* +14 */
326 	struct fh_parms fh_parameter;	/* +24 */
327 	struct ds_parms ds_parameter;	/* +29 */
328 	struct cf_parms cf_parameter;	/* +30 */
329 	struct ibss_parms ibss_parameter;	/* +36 */
330 	struct erp_params_t erp_parameter;	/* +38 */
331 	u8 pad1;	/* +39 */
332 	struct rate_set8 ext_rate_set;	/* +40 */
333 	u8 DTIM_period;	/* +50 */
334 	u8 rsn_mode;	/* +51 */
335 #define RSN_MODE_NONE	0
336 #define RSN_MODE_WPA	1
337 #define RSN_MODE_WPA2	2
338 	struct {
339 		u8 size;	/* +52 */
340 		u8 body[128];	/* +53 */
341 	} __packed rsn;
342 } __packed;
343 
344 #define RESULT_CONNECT    0
345 #define RESULT_DISCONNECT 1
346 
347 struct hostif_stop_request {
348 	struct hostif_hdr header;
349 } __packed;
350 
351 #define D_11B_ONLY_MODE		0
352 #define D_11G_ONLY_MODE		1
353 #define D_11BG_COMPATIBLE_MODE	2
354 #define D_11A_ONLY_MODE		3
355 
356 #define CTS_MODE_FALSE	0
357 #define CTS_MODE_TRUE	1
358 
359 struct hostif_request {
360 	__le16 phy_type;
361 	__le16 cts_mode;
362 	__le16 scan_type;
363 	__le16 capability;
364 	struct rate_set16 rate_set;
365 } __packed;
366 
367 /**
368  * struct hostif_ps_adhoc_set_request - pseudo adhoc mode
369  * @capability: bit5  : preamble
370  *              bit6  : pbcc - Not supported always 0
371  *              bit10 : ShortSlotTime
372  *              bit13 : DSSS-OFDM - Not supported always 0
373  */
374 struct hostif_ps_adhoc_set_request {
375 	struct hostif_hdr header;
376 	struct hostif_request request;
377 	__le16 channel;
378 } __packed;
379 
380 #define AUTH_TYPE_OPEN_SYSTEM 0
381 #define AUTH_TYPE_SHARED_KEY  1
382 
383 /**
384  * struct hostif_infrastructure_set_request
385  * @capability: bit5  : preamble
386  *              bit6  : pbcc - Not supported always 0
387  *              bit10 : ShortSlotTime
388  *              bit13 : DSSS-OFDM - Not supported always 0
389  */
390 struct hostif_infrastructure_set_request {
391 	struct hostif_hdr header;
392 	struct hostif_request request;
393 	struct ssid ssid;
394 	__le16 beacon_lost_count;
395 	__le16 auth_type;
396 	struct channel_list channel_list;
397 	u8 bssid[ETH_ALEN];
398 } __packed;
399 
400 /**
401  * struct hostif_adhoc_set_request
402  * @capability: bit5  : preamble
403  *              bit6  : pbcc - Not supported always 0
404  *              bit10 : ShortSlotTime
405  *              bit13 : DSSS-OFDM - Not supported always 0
406  */
407 struct hostif_adhoc_set_request {
408 	struct hostif_hdr header;
409 	struct hostif_request request;
410 	struct ssid ssid;
411 	__le16 channel;
412 } __packed;
413 
414 /**
415  * struct hostif_adhoc_set2_request
416  * @capability: bit5  : preamble
417  *              bit6  : pbcc - Not supported always 0
418  *              bit10 : ShortSlotTime
419  *              bit13 : DSSS-OFDM - Not supported always 0
420  */
421 struct hostif_adhoc_set2_request {
422 	struct hostif_hdr header;
423 	struct hostif_request request;
424 	__le16 reserved;
425 	struct ssid ssid;
426 	struct channel_list channel_list;
427 	u8 bssid[ETH_ALEN];
428 } __packed;
429 
430 struct association_request {
431 	u8 type;
432 	u8 pad;
433 	__le16 capability;
434 	__le16 listen_interval;
435 	u8 ap_address[6];
436 	__le16 req_ies_size;
437 } __packed;
438 
439 struct association_response {
440 	u8 type;
441 	u8 pad;
442 	__le16 capability;
443 	__le16 status;
444 	__le16 association_id;
445 	__le16 resp_ies_size;
446 } __packed;
447 
448 struct hostif_bss_scan_request {
449 	struct hostif_hdr header;
450 	u8 scan_type;
451 #define ACTIVE_SCAN  0
452 #define PASSIVE_SCAN 1
453 	u8 pad[3];
454 	__le32 ch_time_min;
455 	__le32 ch_time_max;
456 	struct channel_list channel_list;
457 	struct ssid ssid;
458 } __packed;
459 
460 struct hostif_phy_information_request {
461 	struct hostif_hdr header;
462 	__le16 type;
463 #define NORMAL_TYPE	0
464 #define TIME_TYPE	1
465 	__le16 time;	/* unit 100ms */
466 } __packed;
467 
468 enum sleep_mode_type {
469 	SLP_ACTIVE,
470 	SLP_SLEEP
471 };
472 
473 struct hostif_sleep_request {
474 	struct hostif_hdr header;
475 } __packed;
476 
477 struct hostif_mic_failure_request {
478 	struct hostif_hdr header;
479 	__le16 failure_count;
480 	__le16 timer;
481 } __packed;
482 
483 #define BASIC_RATE	0x80
484 #define RATE_MASK	0x7F
485 
486 #define TX_RATE_AUTO      0xff
487 #define TX_RATE_1M_FIXED  0
488 #define TX_RATE_2M_FIXED  1
489 #define TX_RATE_1_2M_AUTO 2
490 #define TX_RATE_5M_FIXED  3
491 #define TX_RATE_11M_FIXED 4
492 
493 #define TX_RATE_FULL_AUTO	0
494 #define TX_RATE_11_AUTO		1
495 #define TX_RATE_11B_AUTO	2
496 #define TX_RATE_11BG_AUTO	3
497 #define TX_RATE_MANUAL_AUTO	4
498 #define TX_RATE_FIXED		5
499 
500 /* 11b rate */
501 #define TX_RATE_1M	((u8)(10 / 5))	/* 11b 11g basic rate */
502 #define TX_RATE_2M	((u8)(20 / 5))	/* 11b 11g basic rate */
503 #define TX_RATE_5M	((u8)(55 / 5))	/* 11g basic rate */
504 #define TX_RATE_11M	((u8)(110 / 5))	/* 11g basic rate */
505 
506 /* 11g rate */
507 #define TX_RATE_6M	((u8)(60 / 5))	/* 11g basic rate */
508 #define TX_RATE_12M	((u8)(120 / 5))	/* 11g basic rate */
509 #define TX_RATE_24M	((u8)(240 / 5))	/* 11g basic rate */
510 #define TX_RATE_9M	((u8)(90 / 5))
511 #define TX_RATE_18M	((u8)(180 / 5))
512 #define TX_RATE_36M	((u8)(360 / 5))
513 #define TX_RATE_48M	((u8)(480 / 5))
514 #define TX_RATE_54M	((u8)(540 / 5))
515 
is_11b_rate(u8 rate)516 static inline bool is_11b_rate(u8 rate)
517 {
518 	return (((rate & RATE_MASK) == TX_RATE_1M) ||
519 		((rate & RATE_MASK) == TX_RATE_2M) ||
520 		((rate & RATE_MASK) == TX_RATE_5M) ||
521 		((rate & RATE_MASK) == TX_RATE_11M));
522 }
523 
is_ofdm_rate(u8 rate)524 static inline bool is_ofdm_rate(u8 rate)
525 {
526 	return (((rate & RATE_MASK) == TX_RATE_6M)  ||
527 		((rate & RATE_MASK) == TX_RATE_12M) ||
528 		((rate & RATE_MASK) == TX_RATE_24M) ||
529 		((rate & RATE_MASK) == TX_RATE_9M)  ||
530 		((rate & RATE_MASK) == TX_RATE_18M) ||
531 		((rate & RATE_MASK) == TX_RATE_36M) ||
532 		((rate & RATE_MASK) == TX_RATE_48M) ||
533 		((rate & RATE_MASK) == TX_RATE_54M));
534 }
535 
is_11bg_rate(u8 rate)536 static inline bool is_11bg_rate(u8 rate)
537 {
538 	return (is_11b_rate(rate) || is_ofdm_rate(rate));
539 }
540 
is_ofdm_ext_rate(u8 rate)541 static inline bool is_ofdm_ext_rate(u8 rate)
542 {
543 	return (((rate & RATE_MASK) == TX_RATE_9M)  ||
544 		((rate & RATE_MASK) == TX_RATE_18M) ||
545 		((rate & RATE_MASK) == TX_RATE_36M) ||
546 		((rate & RATE_MASK) == TX_RATE_48M) ||
547 		((rate & RATE_MASK) == TX_RATE_54M));
548 }
549 
550 enum connect_status_type {
551 	CONNECT_STATUS,
552 	DISCONNECT_STATUS
553 };
554 
555 enum preamble_type {
556 	LONG_PREAMBLE,
557 	SHORT_PREAMBLE
558 };
559 
560 enum multicast_filter_type {
561 	MCAST_FILTER_MCAST,
562 	MCAST_FILTER_MCASTALL,
563 	MCAST_FILTER_PROMISC,
564 };
565 
566 #define NIC_MAX_MCAST_LIST 32
567 
568 #define HIF_EVENT_MASK 0xE800
569 
is_hif_ind(unsigned short event)570 static inline bool is_hif_ind(unsigned short event)
571 {
572 	return (((event & HIF_EVENT_MASK) == HIF_EVENT_MASK) &&
573 		(((event & ~HIF_EVENT_MASK) == 0x0001) ||
574 		 ((event & ~HIF_EVENT_MASK) == 0x0006) ||
575 		 ((event & ~HIF_EVENT_MASK) == 0x000C) ||
576 		 ((event & ~HIF_EVENT_MASK) == 0x0011) ||
577 		 ((event & ~HIF_EVENT_MASK) == 0x0012)));
578 }
579 
is_hif_conf(unsigned short event)580 static inline bool is_hif_conf(unsigned short event)
581 {
582 	return (((event & HIF_EVENT_MASK) == HIF_EVENT_MASK) &&
583 		((event & ~HIF_EVENT_MASK) > 0x0000) &&
584 		((event & ~HIF_EVENT_MASK) < 0x0012) &&
585 		!is_hif_ind(event));
586 }
587 
588 #ifdef __KERNEL__
589 
590 #include "ks_wlan.h"
591 
592 /* function prototype */
593 int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb);
594 void hostif_receive(struct ks_wlan_private *priv, unsigned char *p,
595 		    unsigned int size);
596 void hostif_sme_enqueue(struct ks_wlan_private *priv, u16 event);
597 int hostif_init(struct ks_wlan_private *priv);
598 void hostif_exit(struct ks_wlan_private *priv);
599 int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size,
600 		  void (*complete_handler)(struct ks_wlan_private *priv,
601 					   struct sk_buff *skb),
602 		  struct sk_buff *skb);
603 void send_packet_complete(struct ks_wlan_private *priv, struct sk_buff *skb);
604 
605 void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv);
606 int ks_wlan_hw_power_save(struct ks_wlan_private *priv);
607 
608 #define KS7010_SIZE_ALIGNMENT	32
609 
hif_align_size(size_t size)610 static inline size_t hif_align_size(size_t size)
611 {
612 	return ALIGN(size, KS7010_SIZE_ALIGNMENT);
613 }
614 
615 #endif /* __KERNEL__ */
616 
617 #endif /* _KS_HOSTIF_H_ */
618