• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*!
2  *  @file	host_interface.h
3  *  @brief	File containg host interface APIs
4  *  @author	zsalah
5  *  @sa		host_interface.c
6  *  @date	8 March 2012
7  *  @version	1.0
8  */
9 
10 #ifndef HOST_INT_H
11 #define HOST_INT_H
12 
13 #include "coreconfigurator.h"
14 
15 #define IP_ALEN  4
16 
17 #define IDLE_MODE	0x00
18 #define AP_MODE		0x01
19 #define STATION_MODE	0x02
20 #define GO_MODE		0x03
21 #define CLIENT_MODE	0x04
22 
23 
24 #define MAX_NUM_STA				9
25 #define ACTIVE_SCAN_TIME			10
26 #define PASSIVE_SCAN_TIME			1200
27 #define MIN_SCAN_TIME				10
28 #define MAX_SCAN_TIME				1200
29 #define DEFAULT_SCAN				0
30 #define USER_SCAN				BIT(0)
31 #define OBSS_PERIODIC_SCAN			BIT(1)
32 #define OBSS_ONETIME_SCAN			BIT(2)
33 #define GTK_RX_KEY_BUFF_LEN			24
34 #define ADDKEY					0x1
35 #define REMOVEKEY				0x2
36 #define DEFAULTKEY				0x4
37 #define ADDKEY_AP				0x8
38 #define MAX_NUM_SCANNED_NETWORKS		100
39 #define MAX_NUM_SCANNED_NETWORKS_SHADOW		130
40 #define MAX_NUM_PROBED_SSID			10
41 #define CHANNEL_SCAN_TIME			250
42 
43 #define TX_MIC_KEY_LEN				8
44 #define RX_MIC_KEY_LEN				8
45 #define PTK_KEY_LEN				16
46 
47 #define TX_MIC_KEY_MSG_LEN			26
48 #define RX_MIC_KEY_MSG_LEN			48
49 #define PTK_KEY_MSG_LEN				39
50 
51 #define PMKSA_KEY_LEN				22
52 #define ETH_ALEN				6
53 #define PMKID_LEN				16
54 #define WILC_MAX_NUM_PMKIDS			16
55 #define WILC_SUPP_MCS_SET_SIZE			16
56 #define WILC_ADD_STA_LENGTH			40
57 #define SCAN_EVENT_DONE_ABORTED
58 #define NUM_CONCURRENT_IFC			2
59 
60 struct rf_info {
61 	u8 u8LinkSpeed;
62 	s8 s8RSSI;
63 	u32 u32TxCount;
64 	u32 u32RxCount;
65 	u32 u32TxFailureCount;
66 };
67 
68 enum host_if_state {
69 	HOST_IF_IDLE			= 0,
70 	HOST_IF_SCANNING		= 1,
71 	HOST_IF_CONNECTING		= 2,
72 	HOST_IF_WAITING_CONN_RESP	= 3,
73 	HOST_IF_CONNECTED		= 4,
74 	HOST_IF_P2P_LISTEN		= 5,
75 	HOST_IF_FORCE_32BIT		= 0xFFFFFFFF
76 };
77 
78 struct host_if_pmkid {
79 	u8 bssid[ETH_ALEN];
80 	u8 pmkid[PMKID_LEN];
81 };
82 
83 struct host_if_pmkid_attr {
84 	u8 numpmkid;
85 	struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
86 };
87 
88 enum CURRENT_TXRATE {
89 	AUTORATE	= 0,
90 	MBPS_1		= 1,
91 	MBPS_2		= 2,
92 	MBPS_5_5	= 5,
93 	MBPS_11		= 11,
94 	MBPS_6		= 6,
95 	MBPS_9		= 9,
96 	MBPS_12		= 12,
97 	MBPS_18		= 18,
98 	MBPS_24		= 24,
99 	MBPS_36		= 36,
100 	MBPS_48		= 48,
101 	MBPS_54		= 54
102 };
103 
104 struct cfg_param_val {
105 	u32 flag;
106 	u8 ht_enable;
107 	u8 bss_type;
108 	u8 auth_type;
109 	u16 auth_timeout;
110 	u8 power_mgmt_mode;
111 	u16 short_retry_limit;
112 	u16 long_retry_limit;
113 	u16 frag_threshold;
114 	u16 rts_threshold;
115 	u16 preamble_type;
116 	u8 short_slot_allowed;
117 	u8 txop_prot_disabled;
118 	u16 beacon_interval;
119 	u16 dtim_period;
120 	enum SITESURVEY site_survey_enabled;
121 	u16 site_survey_scan_time;
122 	u8 scan_source;
123 	u16 active_scan_time;
124 	u16 passive_scan_time;
125 	enum CURRENT_TXRATE curr_tx_rate;
126 
127 };
128 
129 enum cfg_param {
130 	RETRY_SHORT		= BIT(0),
131 	RETRY_LONG		= BIT(1),
132 	FRAG_THRESHOLD		= BIT(2),
133 	RTS_THRESHOLD		= BIT(3),
134 	BSS_TYPE		= BIT(4),
135 	AUTH_TYPE		= BIT(5),
136 	AUTHEN_TIMEOUT		= BIT(6),
137 	POWER_MANAGEMENT	= BIT(7),
138 	PREAMBLE		= BIT(8),
139 	SHORT_SLOT_ALLOWED	= BIT(9),
140 	TXOP_PROT_DISABLE	= BIT(10),
141 	BEACON_INTERVAL		= BIT(11),
142 	DTIM_PERIOD		= BIT(12),
143 	SITE_SURVEY		= BIT(13),
144 	SITE_SURVEY_SCAN_TIME	= BIT(14),
145 	ACTIVE_SCANTIME		= BIT(15),
146 	PASSIVE_SCANTIME	= BIT(16),
147 	CURRENT_TX_RATE		= BIT(17),
148 	HT_ENABLE		= BIT(18),
149 };
150 
151 struct found_net_info {
152 	u8 au8bssid[6];
153 	s8 s8rssi;
154 };
155 
156 enum scan_event {
157 	SCAN_EVENT_NETWORK_FOUND	= 0,
158 	SCAN_EVENT_DONE			= 1,
159 	SCAN_EVENT_ABORTED		= 2,
160 	SCAN_EVENT_FORCE_32BIT		= 0xFFFFFFFF
161 };
162 
163 enum conn_event {
164 	CONN_DISCONN_EVENT_CONN_RESP		= 0,
165 	CONN_DISCONN_EVENT_DISCONN_NOTIF	= 1,
166 	CONN_DISCONN_EVENT_FORCE_32BIT		= 0xFFFFFFFF
167 };
168 
169 enum KEY_TYPE {
170 	WEP,
171 	WPARxGtk,
172 	WPAPtk,
173 	PMKSA,
174 };
175 
176 
177 /*Scan callBack function definition*/
178 typedef void (*wilc_scan_result)(enum scan_event, tstrNetworkInfo *,
179 				  void *, void *);
180 
181 /*Connect callBack function definition*/
182 typedef void (*wilc_connect_result)(enum conn_event,
183 				     tstrConnectInfo *,
184 				     u8,
185 				     tstrDisconnectNotifInfo *,
186 				     void *);
187 
188 typedef void (*wilc_remain_on_chan_expired)(void *, u32);  /*Remain on channel expiration callback function*/
189 typedef void (*wilc_remain_on_chan_ready)(void *); /*Remain on channel callback function*/
190 
191 /*!
192  *  @struct             rcvd_net_info
193  *  @brief		Structure to hold Received Asynchronous Network info
194  *  @details
195  *  @todo
196  *  @sa
197  *  @author		Mostafa Abu Bakr
198  *  @date		25 March 2012
199  *  @version		1.0
200  */
201 struct rcvd_net_info {
202 	u8 *buffer;
203 	u32 len;
204 };
205 
206 struct hidden_net_info {
207 	u8  *pu8ssid;
208 	u8 u8ssidlen;
209 };
210 
211 struct hidden_network {
212 	struct hidden_net_info *pstrHiddenNetworkInfo;
213 	u8 u8ssidnum;
214 };
215 
216 struct user_scan_req {
217 	/* Scan user call back function */
218 	wilc_scan_result pfUserScanResult;
219 
220 	/* User specific parameter to be delivered through the Scan User Callback function */
221 	void *u32UserScanPvoid;
222 
223 	u32 u32RcvdChCount;
224 	struct found_net_info astrFoundNetworkInfo[MAX_NUM_SCANNED_NETWORKS];
225 };
226 
227 struct user_conn_req {
228 	u8 *pu8bssid;
229 	u8 *pu8ssid;
230 	u8 u8security;
231 	enum AUTHTYPE tenuAuth_type;
232 	size_t ssidLen;
233 	u8 *pu8ConnReqIEs;
234 	size_t ConnReqIEsLen;
235 	/* Connect user call back function */
236 	wilc_connect_result pfUserConnectResult;
237 	bool IsHTCapable;
238 	/* User specific parameter to be delivered through the Connect User Callback function */
239 	void *u32UserConnectPvoid;
240 };
241 
242 struct drv_handler {
243 	u32 handler;
244 };
245 
246 struct op_mode {
247 	u32 mode;
248 };
249 
250 struct set_mac_addr {
251 	u8 mac_addr[ETH_ALEN];
252 };
253 
254 struct get_mac_addr {
255 	u8 *mac_addr;
256 };
257 
258 struct ba_session_info {
259 	u8 au8Bssid[ETH_ALEN];
260 	u8 u8Ted;
261 	u16 u16BufferSize;
262 	u16 u16SessionTimeout;
263 };
264 
265 struct remain_ch {
266 	u16 u16Channel;
267 	u32 u32duration;
268 	wilc_remain_on_chan_expired pRemainOnChanExpired;
269 	wilc_remain_on_chan_ready pRemainOnChanReady;
270 	void *pVoid;
271 	u32 u32ListenSessionID;
272 };
273 
274 struct reg_frame {
275 	bool bReg;
276 	u16 u16FrameType;
277 	u8 u8Regid;
278 };
279 
280 
281 #define ACTION			0xD0
282 #define PROBE_REQ		0x40
283 #define PROBE_RESP		0x50
284 #define ACTION_FRM_IDX		0
285 #define PROBE_REQ_IDX		1
286 
287 
288 enum p2p_listen_state {
289 	P2P_IDLE,
290 	P2P_LISTEN,
291 	P2P_GRP_FORMATION
292 };
293 
294 struct host_if_drv {
295 	struct user_scan_req usr_scan_req;
296 	struct user_conn_req usr_conn_req;
297 	struct remain_ch remain_on_ch;
298 	u8 remain_on_ch_pending;
299 	u64 u64P2p_MgmtTimeout;
300 	u8 u8P2PConnect;
301 
302 	enum host_if_state enuHostIFstate;
303 
304 	u8 au8AssociatedBSSID[ETH_ALEN];
305 	struct cfg_param_val strCfgValues;
306 /* semaphores */
307 	struct semaphore gtOsCfgValuesSem;
308 	struct semaphore hSemTestKeyBlock;
309 
310 	struct semaphore hSemTestDisconnectBlock;
311 	struct semaphore hSemGetRSSI;
312 	struct semaphore hSemGetLINKSPEED;
313 	struct semaphore hSemGetCHNL;
314 	struct semaphore hSemInactiveTime;
315 /* timer handlers */
316 	struct timer_list hScanTimer;
317 	struct timer_list hConnectTimer;
318 	struct timer_list hRemainOnChannel;
319 
320 	bool IFC_UP;
321 };
322 
323 struct add_sta_param {
324 	u8 au8BSSID[ETH_ALEN];
325 	u16 u16AssocID;
326 	u8 u8NumRates;
327 	const u8 *pu8Rates;
328 	bool bIsHTSupported;
329 	u16 u16HTCapInfo;
330 	u8 u8AmpduParams;
331 	u8 au8SuppMCsSet[16];
332 	u16 u16HTExtParams;
333 	u32 u32TxBeamformingCap;
334 	u8 u8ASELCap;
335 	u16 u16FlagsMask;               /*<! Determines which of u16FlagsSet were changed>*/
336 	u16 u16FlagsSet;                /*<! Decoded according to tenuWILC_StaFlag */
337 };
338 
339 /*****************************************************************************/
340 /*																			 */
341 /*							Host Interface API								 */
342 /*																			 */
343 /*****************************************************************************/
344 
345 /**
346  *  @brief              removes wpa/wpa2 keys
347  *  @details    only in BSS STA mode if External Supplicant support is enabled.
348  *                              removes all WPA/WPA2 station key entries from MAC hardware.
349  *  @param[in,out] handle to the wifi driver
350  *  @param[in]  6 bytes of Station Adress in the station entry table
351  *  @return             Error code indicating success/failure
352  *  @note
353  *  @author		zsalah
354  *  @date		8 March 2012
355  *  @version		1.0
356  */
357 s32 host_int_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
358 /**
359  *  @brief              removes WEP key
360  *  @details    valid only in BSS STA mode if External Supplicant support is enabled.
361  *                              remove a WEP key entry from MAC HW.
362  *                              The BSS Station automatically finds the index of the entry using its
363  *                              BSS ID and removes that entry from the MAC hardware.
364  *  @param[in,out] handle to the wifi driver
365  *  @param[in]  6 bytes of Station Adress in the station entry table
366  *  @return             Error code indicating success/failure
367  *  @note               NO need for the STA add since it is not used for processing
368  *  @author		zsalah
369  *  @date		8 March 2012
370  *  @version		1.0
371  */
372 int host_int_remove_wep_key(struct host_if_drv *wfi_drv, u8 index);
373 /**
374  *  @brief              sets WEP deafault key
375  *  @details    Sets the index of the WEP encryption key in use,
376  *                              in the key table
377  *  @param[in,out] handle to the wifi driver
378  *  @param[in]  key index ( 0, 1, 2, 3)
379  *  @return             Error code indicating success/failure
380  *  @note
381  *  @author		zsalah
382  *  @date		8 March 2012
383  *  @version		1.0
384  */
385 int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index);
386 
387 /**
388  *  @brief              sets WEP deafault key
389  *  @details    valid only in BSS STA mode if External Supplicant support is enabled.
390  *                              sets WEP key entry into MAC hardware when it receives the
391  *                              corresponding request from NDIS.
392  *  @param[in,out] handle to the wifi driver
393  *  @param[in]  message containing WEP Key in the following format
394  *|---------------------------------------|
395  *|Key ID Value | Key Length |	Key		|
396  *|-------------|------------|------------|
397  |	1byte	  |		1byte  | Key Length	|
398  ||---------------------------------------|
399  |
400  *  @return             Error code indicating success/failure
401  *  @note
402  *  @author		zsalah
403  *  @date		8 March 2012
404  *  @version		1.0
405  */
406 int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
407 				 const u8 *key, u8 len, u8 index);
408 /**
409  *  @brief              host_int_add_wep_key_bss_ap
410  *  @details    valid only in AP mode if External Supplicant support is enabled.
411  *                              sets WEP key entry into MAC hardware when it receives the
412  *                              corresponding request from NDIS.
413  *  @param[in,out] handle to the wifi driver
414  *
415  *
416  *  @return             Error code indicating success/failure
417  *  @note
418  *  @author		mdaftedar
419  *  @date		28 Feb 2013
420  *  @version		1.0
421  */
422 int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
423 				const u8 *key, u8 len, u8 index, u8 mode,
424 				enum AUTHTYPE auth_type);
425 
426 /**
427  *  @brief              adds ptk Key
428  *  @details
429  *  @param[in,out] handle to the wifi driver
430  *  @param[in]  message containing PTK Key in the following format
431  *|-------------------------------------------------------------------------|
432  *|Sta Adress | Key Length |	Temporal Key | Rx Michael Key |Tx Michael Key |
433  *|-----------|------------|---------------|----------------|---------------|
434  |	6 bytes |	1byte	 |   16 bytes	 |	  8 bytes	  |	   8 bytes	  |
435  ||-------------------------------------------------------------------------|
436  *  @return             Error code indicating success/failure
437  *  @note
438  *  @author		zsalah
439  *  @date		8 March 2012
440  *  @version		1.0
441  */
442 s32 host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen,
443 			     const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx);
444 
445 /**
446  *  @brief              host_int_get_inactive_time
447  *  @details
448  *  @param[in,out] handle to the wifi driver
449  *  @param[in]  message containing inactive time
450  *
451  *  @return             Error code indicating success/failure
452  *  @note
453  *  @author		mdaftedar
454  *  @date		15 April 2013
455  *  @version		1.0
456  */
457 s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime);
458 
459 /**
460  *  @brief              adds Rx GTk Key
461  *  @details
462  *  @param[in,out] handle to the wifi driver
463  *  @param[in]  message containing Rx GTK Key in the following format
464  *|----------------------------------------------------------------------------|
465  *|Sta Address | Key RSC | KeyID | Key Length | Temporal Key	| Rx Michael Key |
466  *|------------|---------|-------|------------|---------------|----------------|
467  |	6 bytes	 | 8 byte  |1 byte |  1 byte	|   16 bytes	|	  8 bytes	 |
468  ||----------------------------------------------------------------------------|
469  *  @return             Error code indicating success/failure
470  *  @note
471  *  @author		zsalah
472  *  @date		8 March 2012
473  *  @version		1.0
474  */
475 s32 host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen,
476 				u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC,
477 				const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode);
478 
479 
480 /**
481  *  @brief              adds Tx GTk Key
482  *  @details
483  *  @param[in,out] handle to the wifi driver
484  *  @param[in]  message containing Tx GTK Key in the following format
485  *|----------------------------------------------------|
486  | KeyID | Key Length | Temporal Key	| Tx Michael Key |
487  ||-------|------------|--------------|----------------|
488  ||1 byte |  1 byte	 |   16 bytes	|	  8 bytes	 |
489  ||----------------------------------------------------|
490  *  @return             Error code indicating success/failure
491  *  @note
492  *  @author		zsalah
493  *  @date		8 March 2012
494  *  @version		1.0
495  */
496 s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx);
497 
498 /**
499  *  @brief              caches the pmkid
500  *  @details    valid only in BSS STA mode if External Supplicant
501  *                              support is enabled. This Function sets the PMKID in firmware
502  *                              when host drivr receives the corresponding request from NDIS.
503  *                              The firmware then includes theset PMKID in the appropriate
504  *                              management frames
505  *  @param[in,out] handle to the wifi driver
506  *  @param[in]  message containing PMKID Info in the following format
507  *|-----------------------------------------------------------------|
508  *|NumEntries |	BSSID[1] | PMKID[1] |  ...	| BSSID[K] | PMKID[K] |
509  *|-----------|------------|----------|-------|----------|----------|
510  |	   1	|		6	 |   16		|  ...	|	 6	   |	16	  |
511  ||-----------------------------------------------------------------|
512  *  @return             Error code indicating success/failure
513  *  @note
514  *  @author		zsalah
515  *  @date		8 March 2012
516  *  @version		1.0
517  */
518 
519 s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray);
520 /**
521  *  @brief              gets the cached the pmkid info
522  *  @details    valid only in BSS STA mode if External Supplicant
523  *                              support is enabled. This Function sets the PMKID in firmware
524  *                              when host drivr receives the corresponding request from NDIS.
525  *                              The firmware then includes theset PMKID in the appropriate
526  *                              management frames
527  *  @param[in,out] handle to the wifi driver,
528  *
529  *                                message containing PMKID Info in the following format
530  *|-----------------------------------------------------------------|
531  *|NumEntries |	BSSID[1] | PMKID[1] |  ...	| BSSID[K] | PMKID[K] |
532  *|-----------|------------|----------|-------|----------|----------|
533  |	   1	|		6	 |   16		|  ...	|	 6	   |	16	  |
534  ||-----------------------------------------------------------------|
535  *  @param[in]
536  *  @return             Error code indicating success/failure
537  *  @note
538  *  @author		zsalah
539  *  @date		8 March 2012
540  *  @version		1.0
541  */
542 
543 s32 host_int_get_pmkid_info(struct host_if_drv *hWFIDrv, u8 *pu8PmkidInfoArray,
544 				    u32 u32PmkidInfoLen);
545 
546 /**
547  *  @brief              sets the pass phrase
548  *  @details    AP/STA mode. This function gives the pass phrase used to
549  *                              generate the Pre-Shared Key when WPA/WPA2 is enabled
550  *                              The length of the field can vary from 8 to 64 bytes,
551  *                              the lower layer should get the
552  *  @param[in,out] handle to the wifi driver,
553  *  @param[in]   String containing PSK
554  *  @return             Error code indicating success/failure
555  *  @note
556  *  @author		zsalah
557  *  @date		8 March 2012
558  *  @version		1.0
559  */
560 s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, u8 *pu8PassPhrase,
561 						 u8 u8Psklength);
562 /**
563  *  @brief              gets the pass phrase
564  *  @details    AP/STA mode. This function gets the pass phrase used to
565  *                              generate the Pre-Shared Key when WPA/WPA2 is enabled
566  *                              The length of the field can vary from 8 to 64 bytes,
567  *                              the lower layer should get the
568  *  @param[in,out] handle to the wifi driver,
569  *                                String containing PSK
570  *  @return             Error code indicating success/failure
571  *  @note
572  *  @author		zsalah
573  *  @date		8 March 2012
574  *  @version		1.0
575  */
576 s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv,
577 						 u8 *pu8PassPhrase, u8 u8Psklength);
578 
579 /**
580  *  @brief              gets mac address
581  *  @details
582  *  @param[in,out] handle to the wifi driver,
583  *
584  *  @return             Error code indicating success/failure
585  *  @note
586  *  @author		mdaftedar
587  *  @date		19 April 2012
588  *  @version		1.0
589  */
590 s32 host_int_get_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
591 
592 /**
593  *  @brief              sets mac address
594  *  @details
595  *  @param[in,out] handle to the wifi driver,
596  *
597  *  @return             Error code indicating success/failure
598  *  @note
599  *  @author		mabubakr
600  *  @date		16 July 2012
601  *  @version		1.0
602  */
603 s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
604 
605 /**
606  *  @brief              wait until msg q is empty
607  *  @details
608  *  @param[in,out]
609  *
610  *  @return             Error code indicating success/failure
611  *  @note
612  *  @author		asobhy
613  *  @date		19 march 2014
614  *  @version		1.0
615  */
616 int host_int_wait_msg_queue_idle(void);
617 
618 /**
619  *  @brief              sets a start scan request
620  *  @details
621  *  @param[in,out] handle to the wifi driver,
622  *  @param[in]	Scan Source one of the following values
623  *                              DEFAULT_SCAN        0
624  *                              USER_SCAN           BIT0
625  *                              OBSS_PERIODIC_SCAN  BIT1
626  *                              OBSS_ONETIME_SCAN   BIT2
627  *  @return             Error code indicating success/failure
628  *  @note
629  *  @author		zsalah
630  *  @date		8 March 2012
631  *  @version		1.0
632  */
633 
634 s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource);
635 /**
636  *  @brief              gets scan source of the last scan
637  *  @details
638  *  @param[in,out] handle to the wifi driver,
639  *                              Scan Source one of the following values
640  *                              DEFAULT_SCAN        0
641  *                              USER_SCAN           BIT0
642  *                              OBSS_PERIODIC_SCAN  BIT1
643  *                              OBSS_ONETIME_SCAN   BIT2
644  *  @return             Error code indicating success/failure
645  *  @note
646  *  @author		zsalah
647  *  @date		8 March 2012
648  *  @version		1.0
649  */
650 s32 host_int_get_start_scan_req(struct host_if_drv *hWFIDrv, u8 *pu8ScanSource);
651 
652 /**
653  *  @brief              sets a join request
654  *  @details
655  *  @param[in,out] handle to the wifi driver,
656  *  @param[in]	Index of the bss descriptor
657  *  @return             Error code indicating success/failure
658  *  @note
659  *  @author		zsalah
660  *  @date		8 March 2012
661  *  @version		1.0
662  */
663 
664 s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid,
665 				  const u8 *pu8ssid, size_t ssidLen,
666 				  const u8 *pu8IEs, size_t IEsLen,
667 				  wilc_connect_result pfConnectResult, void *pvUserArg,
668 				  u8 u8security, enum AUTHTYPE tenuAuth_type,
669 				  u8 u8channel,
670 				  void *pJoinParams);
671 
672 /**
673  *  @brief              Flush a join request parameters to FW, but actual connection
674  *  @details    The function is called in situation where WILC is connected to AP and
675  *                      required to switch to hybrid FW for P2P connection
676  *  @param[in] handle to the wifi driver,
677  *  @return             Error code indicating success/failure
678  *  @note
679  *  @author		Amr Abdel-Moghny
680  *  @date		19 DEC 2013
681  *  @version		8.0
682  */
683 
684 s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
685 
686 
687 /**
688  *  @brief              disconnects from the currently associated network
689  *  @details
690  *  @param[in,out] handle to the wifi driver,
691  *  @param[in]	Reason Code of the Disconnection
692  *  @return             Error code indicating success/failure
693  *  @note
694  *  @author		zsalah
695  *  @date		8 March 2012
696  *  @version		1.0
697  */
698 s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
699 
700 /**
701  *  @brief              disconnects a sta
702  *  @details
703  *  @param[in,out] handle to the wifi driver,
704  *  @param[in]	Association Id of the station to be disconnected
705  *  @return             Error code indicating success/failure
706  *  @note
707  *  @author		zsalah
708  *  @date		8 March 2012
709  *  @version		1.0
710  */
711 s32 host_int_disconnect_station(struct host_if_drv *hWFIDrv, u8 assoc_id);
712 /**
713  *  @brief              gets a Association request info
714  *  @details
715  *  @param[in,out] handle to the wifi driver,
716  *                              Message containg assoc. req info in the following format
717  * ------------------------------------------------------------------------
718  |                        Management Frame Format                    |
719  ||-------------------------------------------------------------------|
720  ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS |
721  ||-------------|--------|--|--|-----|----------------|----------|----|
722  | 2           |2       |6 |6 |6    |		2       |0 - 2312  | 4  |
723  ||-------------------------------------------------------------------|
724  |                                                                   |
725  |             Association Request Frame - Frame Body                |
726  ||-------------------------------------------------------------------|
727  | Capability Information | Listen Interval | SSID | Supported Rates |
728  ||------------------------|-----------------|------|-----------------|
729  |			2            |		 2         | 2-34 |		3-10        |
730  | ---------------------------------------------------------------------
731  *  @return             Error code indicating success/failure
732  *  @note
733  *  @author		zsalah
734  *  @date		8 March 2012
735  *  @version		1.0
736  */
737 
738 s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocReqInfo,
739 					u32 u32AssocReqInfoLen);
740 /**
741  *  @brief              gets a Association Response info
742  *  @details
743  *  @param[in,out] handle to the wifi driver,
744  *                              Message containg assoc. resp info
745  *  @return             Error code indicating success/failure
746  *  @note
747  *  @author		zsalah
748  *  @date		8 March 2012
749  *  @version		1.0
750  */
751 
752 s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo,
753 					u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen);
754 /**
755  *  @brief              gets a Association Response info
756  *  @details    Valid only in STA mode. This function gives the RSSI
757  *                              values observed in all the channels at the time of scanning.
758  *                              The length of the field is 1 greater that the total number of
759  *                              channels supported. Byte 0 contains the number of channels while
760  *                              each of Byte N contains	the observed RSSI value for the channel index N.
761  *  @param[in,out] handle to the wifi driver,
762  *                              array of scanned channels' RSSI
763  *  @return             Error code indicating success/failure
764  *  @note
765  *  @author		zsalah
766  *  @date		8 March 2012
767  *  @version		1.0
768  */
769 s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, u8 *pu8RxPowerLevel,
770 					u32 u32RxPowerLevelLen);
771 
772 /**
773  *  @brief              sets a channel
774  *  @details
775  *  @param[in,out] handle to the wifi driver,
776  *  @param[in]	Index of the channel to be set
777  *|-------------------------------------------------------------------|
778  |          CHANNEL1      CHANNEL2 ....		             CHANNEL14	|
779  |  Input:         1             2					            14	|
780  ||-------------------------------------------------------------------|
781  *  @return             Error code indicating success/failure
782  *  @note
783  *  @author		zsalah
784  *  @date		8 March 2012
785  *  @version		1.0
786  */
787 int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);
788 
789 /**
790  *  @brief              gets the current channel index
791  *  @details
792  *  @param[in,out] handle to the wifi driver,
793  *                              current channel index
794  *|-----------------------------------------------------------------------|
795  |          CHANNEL1      CHANNEL2 ....                     CHANNEL14	|
796  |  Input:         1             2                                 14	|
797  ||-----------------------------------------------------------------------|
798  *  @return             Error code indicating success/failure
799  *  @note
800  *  @author		zsalah
801  *  @date		8 March 2012
802  *  @version		1.0
803  */
804 s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo);
805 /**
806  *  @brief              gets the sta rssi
807  *  @details    gets the currently maintained RSSI value for the station.
808  *                              The received signal strength value in dB.
809  *                              The range of valid values is -128 to 0.
810  *  @param[in,out] handle to the wifi driver,
811  *                              rssi value in dB
812  *  @return             Error code indicating success/failure
813  *  @note
814  *  @author		zsalah
815  *  @date		8 March 2012
816  *  @version		1.0
817  */
818 s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
819 s32 host_int_get_link_speed(struct host_if_drv *hWFIDrv, s8 *ps8lnkspd);
820 /**
821  *  @brief              scans a set of channels
822  *  @details
823  *  @param[in,out] handle to the wifi driver,
824  *  @param[in]		Scan source
825  *                              Scan Type	PASSIVE_SCAN = 0,
826  *                                                      ACTIVE_SCAN  = 1
827  *                              Channels Array
828  *                              Channels Array length
829  *                              Scan Callback function
830  *                              User Argument to be delivered back through the Scan Cllback function
831  *  @return             Error code indicating success/failure
832  *  @note
833  *  @author		zsalah
834  *  @date		8 March 2012
835  *  @version		1.0
836  */
837 s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
838 			  u8 u8ScanType, u8 *pu8ChnlFreqList,
839 			  u8 u8ChnlListLen, const u8 *pu8IEs,
840 			  size_t IEsLen, wilc_scan_result ScanResult,
841 			  void *pvUserArg,
842 			  struct hidden_network *pstrHiddenNetwork);
843 /**
844  *  @brief              sets configuration wids values
845  *  @details
846  *  @param[in,out] handle to the wifi driver,
847  *  @param[in]	WID, WID value
848  *  @return             Error code indicating success/failure
849  *  @note
850  *  @author		zsalah
851  *  @date		8 March 2012
852  *  @version		1.0
853  */
854 s32 hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal);
855 
856 /**
857  *  @brief              gets configuration wids values
858  *  @details
859  *  @param[in,out] handle to the wifi driver,
860  *                              WID value
861  *  @param[in]	WID,
862  *  @return             Error code indicating success/failure
863  *  @note
864  *  @author		zsalah
865  *  @date		8 March 2012
866  *  @version		1.0
867  */
868 s32 hif_get_cfg(struct host_if_drv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value);
869 /*****************************************************************************/
870 /*							Notification Functions							 */
871 /*****************************************************************************/
872 /**
873  *  @brief              host interface initialization function
874  *  @details
875  *  @param[in,out] handle to the wifi driver,
876  *  @note
877  *  @author		zsalah
878  *  @date		8 March 2012
879  *  @version		1.0
880  */
881 s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
882 
883 /**
884  *  @brief              host interface initialization function
885  *  @details
886  *  @param[in,out] handle to the wifi driver,
887  *  @note
888  *  @author		zsalah
889  *  @date		8 March 2012
890  *  @version		1.0
891  */
892 s32 host_int_deinit(struct host_if_drv *hWFIDrv);
893 
894 
895 /*!
896  *  @fn		s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv,u8 u8Index)
897  *  @brief		Sends a beacon to the firmware to be transmitted over the air
898  *  @details
899  *  @param[in,out]	hWFIDrv		handle to the wifi driver
900  *  @param[in]	u32Interval	Beacon Interval. Period between two successive beacons on air
901  *  @param[in]	u32DTIMPeriod DTIM Period. Indicates how many Beacon frames
902  *              (including the current frame) appear before the next DTIM
903  *  @param[in]	u32Headlen	Length of the head buffer in bytes
904  *  @param[in]	pu8Head		Pointer to the beacon's head buffer. Beacon's head
905  *		is the part from the beacon's start till the TIM element, NOT including the TIM
906  *  @param[in]	u32Taillen	Length of the tail buffer in bytes
907  *  @param[in]	pu8Tail		Pointer to the beacon's tail buffer. Beacon's tail
908  *		starts just after the TIM inormation element
909  *  @return	0 for Success, error otherwise
910  *  @todo
911  *  @sa
912  *  @author		Adham Abozaeid
913  *  @date		10 Julys 2012
914  *  @version		1.0 Description
915  *
916  */
917 s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
918 				u32 u32DTIMPeriod,
919 				u32 u32HeadLen, u8 *pu8Head,
920 				u32 u32TailLen, u8 *pu8tail);
921 
922 
923 /*!
924  *  @fn		s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv)
925  *  @brief		Removes the beacon and stops trawilctting it over the air
926  *  @details
927  *  @param[in,out]	hWFIDrv		handle to the wifi driver
928  *  @return	0 for Success, error otherwise
929  *  @todo
930  *  @sa
931  *  @author		Adham Abozaeid
932  *  @date		10 Julys 2012
933  *  @version		1.0 Description
934  */
935 s32 host_int_del_beacon(struct host_if_drv *hWFIDrv);
936 
937 /*!
938  *  @fn		s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv,
939  *					 struct add_sta_param *pstrStaParams)
940  *  @brief		Notifies the firmware with a new associated stations
941  *  @details
942  *  @param[in,out]	hWFIDrv		handle to the wifi driver
943  *  @param[in]	pstrStaParams	Station's parameters
944  *  @return	0 for Success, error otherwise
945  *  @todo
946  *  @sa
947  *  @author		Adham Abozaeid
948  *  @date		12 July 2012
949  *  @version		1.0 Description
950  */
951 s32 host_int_add_station(struct host_if_drv *hWFIDrv,
952 			 struct add_sta_param *pstrStaParams);
953 
954 /*!
955  *  @fn		s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr)
956  *  @brief		Deauthenticates clients when group is terminating
957  *  @details
958  *  @param[in,out]	hWFIDrv		handle to the wifi driver
959  *  @param[in]	pu8MacAddr	Station's mac address
960  *  @return	0 for Success, error otherwise
961  *  @todo
962  *  @sa
963  *  @author		Mai Daftedar
964  *  @date		09 April 2014
965  *  @version		1.0 Description
966  */
967 s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]);
968 
969 /*!
970  *  @fn		s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr)
971  *  @brief		Notifies the firmware with a new deleted station
972  *  @details
973  *  @param[in,out]	hWFIDrv		handle to the wifi driver
974  *  @param[in]	pu8MacAddr	Station's mac address
975  *  @return	0 for Success, error otherwise
976  *  @todo
977  *  @sa
978  *  @author		Adham Abozaeid
979  *  @date		15 July 2012
980  *  @version		1.0 Description
981  */
982 s32 host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr);
983 
984 /*!
985  *  @fn		s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv,
986  *					  struct add_sta_param *pstrStaParams)
987  *  @brief		Notifies the firmware with new parameters of an already associated station
988  *  @details
989  *  @param[in,out]	hWFIDrv		handle to the wifi driver
990  *  @param[in]	pstrStaParams	Station's parameters
991  *  @return	0 for Success, error otherwise
992  *  @todo
993  *  @sa
994  *  @author		Adham Abozaeid
995  *  @date		15 July 2012
996  *  @version		1.0 Description
997  */
998 s32 host_int_edit_station(struct host_if_drv *hWFIDrv,
999 			  struct add_sta_param *pstrStaParams);
1000 
1001 /*!
1002  *  @fn		s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout)
1003  *  @brief		Set the power management mode to enabled or disabled
1004  *  @details
1005  *  @param[in,out]	hWFIDrv		handle to the wifi driver
1006  *  @param[in]	bIsEnabled	TRUE if enabled, FALSE otherwise
1007  *  @param[in]	u32Timeout	A timeout value of -1 allows the driver to adjust
1008  *							the dynamic ps timeout value
1009  *  @return	0 for Success, error otherwise
1010  *  @todo
1011  *  @sa
1012  *  @author		Adham Abozaeid
1013  *  @date		24 November 2012
1014  *  @version		1.0 Description
1015  */
1016 s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32Timeout);
1017 /*  @param[in,out]	hWFIDrv		handle to the wifi driver
1018  *  @param[in]	bIsEnabled	TRUE if enabled, FALSE otherwise
1019  *  @param[in]	u8count		count of mac address entries in the filter table
1020  *
1021  *  @return	0 for Success, error otherwise
1022  *  @todo
1023  *  @sa
1024  *  @author		Adham Abozaeid
1025  *  @date		24 November 2012
1026  *  @version		1.0 Description
1027  */
1028 s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32count);
1029 /**
1030  *  @brief           host_int_setup_ipaddress
1031  *  @details       set IP address on firmware
1032  *  @param[in]
1033  *  @return         Error code.
1034  *  @author		Abdelrahman Sobhy
1035  *  @date
1036  *  @version	1.0
1037  */
1038 s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
1039 
1040 
1041 /**
1042  *  @brief           host_int_delBASession
1043  *  @details       Delete single Rx BA session
1044  *  @param[in]
1045  *  @return         Error code.
1046  *  @author		Abdelrahman Sobhy
1047  *  @date
1048  *  @version	1.0
1049  */
1050 s32 host_int_delBASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
1051 
1052 /**
1053  *  @brief           host_int_delBASession
1054  *  @details       Delete all Rx BA session
1055  *  @param[in]
1056  *  @return         Error code.
1057  *  @author		Abdelrahman Sobhy
1058  *  @date
1059  *  @version	1.0
1060  */
1061 s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
1062 
1063 
1064 /**
1065  *  @brief           host_int_get_ipaddress
1066  *  @details       get IP address on firmware
1067  *  @param[in]
1068  *  @return         Error code.
1069  *  @author		Abdelrahman Sobhy
1070  *  @date
1071  *  @version	1.0
1072  */
1073 s32 host_int_get_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
1074 
1075 /**
1076  *  @brief           host_int_remain_on_channel
1077  *  @details
1078  *  @param[in]
1079  *  @return         Error code.
1080  *  @author
1081  *  @date
1082  *  @version	1.0
1083  */
1084 s32 host_int_remain_on_channel(struct host_if_drv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, wilc_remain_on_chan_ready RemainOnChanReady, void *pvUserArg);
1085 
1086 /**
1087  *  @brief              host_int_ListenStateExpired
1088  *  @details
1089  *  @param[in]          Handle to wifi driver
1090  *                              Duration to remain on channel
1091  *                              Channel to remain on
1092  *                              Pointer to fn to be called on receive frames in listen state
1093  *                              Pointer to remain-on-channel expired fn
1094  *                              Priv
1095  *  @return             Error code.
1096  *  @author
1097  *  @date
1098  *  @version		1.0
1099  */
1100 s32 host_int_ListenStateExpired(struct host_if_drv *hWFIDrv, u32 u32SessionID);
1101 
1102 /**
1103  *  @brief           host_int_frame_register
1104  *  @details
1105  *  @param[in]
1106  *  @return         Error code.
1107  *  @author
1108  *  @date
1109  *  @version	1.0
1110  */
1111 s32 host_int_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool bReg);
1112 /**
1113  *  @brief           host_int_set_wfi_drv_handler
1114  *  @details
1115  *  @param[in]
1116  *  @return         Error code.
1117  *  @author
1118  *  @date
1119  *  @version	1.0
1120  */
1121 int host_int_set_wfi_drv_handler(struct host_if_drv *address);
1122 int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);
1123 
1124 static s32 Handle_ScanDone(struct host_if_drv *drvHandler, enum scan_event enuEvent);
1125 
1126 void host_int_freeJoinParams(void *pJoinParams);
1127 
1128 s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);
1129 
1130 #endif
1131