staging: wilc1000: rename strWILC_UsrScanReq of struct host_if_drv
[firefly-linux-kernel-4.4.55.git] / drivers / staging / wilc1000 / host_interface.h
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 strWILC_UsrConnReq;
297
298         /*Remain on channel struvture*/
299         struct remain_ch strHostIfRemainOnChan;
300         u8 u8RemainOnChan_pendingreq;
301         u64 u64P2p_MgmtTimeout;
302         u8 u8P2PConnect;
303
304         enum host_if_state enuHostIFstate;
305
306         u8 au8AssociatedBSSID[ETH_ALEN];
307         struct cfg_param_val strCfgValues;
308 /* semaphores */
309         struct semaphore gtOsCfgValuesSem;
310         struct semaphore hSemTestKeyBlock;
311
312         struct semaphore hSemTestDisconnectBlock;
313         struct semaphore hSemGetRSSI;
314         struct semaphore hSemGetLINKSPEED;
315         struct semaphore hSemGetCHNL;
316         struct semaphore hSemInactiveTime;
317 /* timer handlers */
318         struct timer_list hScanTimer;
319         struct timer_list hConnectTimer;
320         struct timer_list hRemainOnChannel;
321
322         bool IFC_UP;
323 };
324
325 struct add_sta_param {
326         u8 au8BSSID[ETH_ALEN];
327         u16 u16AssocID;
328         u8 u8NumRates;
329         const u8 *pu8Rates;
330         bool bIsHTSupported;
331         u16 u16HTCapInfo;
332         u8 u8AmpduParams;
333         u8 au8SuppMCsSet[16];
334         u16 u16HTExtParams;
335         u32 u32TxBeamformingCap;
336         u8 u8ASELCap;
337         u16 u16FlagsMask;               /*<! Determines which of u16FlagsSet were changed>*/
338         u16 u16FlagsSet;                /*<! Decoded according to tenuWILC_StaFlag */
339 };
340
341 /*****************************************************************************/
342 /*                                                                                                                                                       */
343 /*                                                      Host Interface API                                                               */
344 /*                                                                                                                                                       */
345 /*****************************************************************************/
346
347 /**
348  *  @brief              removes wpa/wpa2 keys
349  *  @details    only in BSS STA mode if External Supplicant support is enabled.
350  *                              removes all WPA/WPA2 station key entries from MAC hardware.
351  *  @param[in,out] handle to the wifi driver
352  *  @param[in]  6 bytes of Station Adress in the station entry table
353  *  @return             Error code indicating success/failure
354  *  @note
355  *  @author             zsalah
356  *  @date               8 March 2012
357  *  @version            1.0
358  */
359 s32 host_int_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
360 /**
361  *  @brief              removes WEP key
362  *  @details    valid only in BSS STA mode if External Supplicant support is enabled.
363  *                              remove a WEP key entry from MAC HW.
364  *                              The BSS Station automatically finds the index of the entry using its
365  *                              BSS ID and removes that entry from the MAC hardware.
366  *  @param[in,out] handle to the wifi driver
367  *  @param[in]  6 bytes of Station Adress in the station entry table
368  *  @return             Error code indicating success/failure
369  *  @note               NO need for the STA add since it is not used for processing
370  *  @author             zsalah
371  *  @date               8 March 2012
372  *  @version            1.0
373  */
374 int host_int_remove_wep_key(struct host_if_drv *wfi_drv, u8 index);
375 /**
376  *  @brief              sets WEP deafault key
377  *  @details    Sets the index of the WEP encryption key in use,
378  *                              in the key table
379  *  @param[in,out] handle to the wifi driver
380  *  @param[in]  key index ( 0, 1, 2, 3)
381  *  @return             Error code indicating success/failure
382  *  @note
383  *  @author             zsalah
384  *  @date               8 March 2012
385  *  @version            1.0
386  */
387 int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index);
388
389 /**
390  *  @brief              sets WEP deafault key
391  *  @details    valid only in BSS STA mode if External Supplicant support is enabled.
392  *                              sets WEP key entry into MAC hardware when it receives the
393  *                              corresponding request from NDIS.
394  *  @param[in,out] handle to the wifi driver
395  *  @param[in]  message containing WEP Key in the following format
396  *|---------------------------------------|
397  *|Key ID Value | Key Length |  Key             |
398  *|-------------|------------|------------|
399  |      1byte     |             1byte  | Key Length     |
400  ||---------------------------------------|
401  |
402  *  @return             Error code indicating success/failure
403  *  @note
404  *  @author             zsalah
405  *  @date               8 March 2012
406  *  @version            1.0
407  */
408 s32 host_int_add_wep_key_bss_sta(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx);
409 /**
410  *  @brief              host_int_add_wep_key_bss_ap
411  *  @details    valid only in AP mode if External Supplicant support is enabled.
412  *                              sets WEP key entry into MAC hardware when it receives the
413  *                              corresponding request from NDIS.
414  *  @param[in,out] handle to the wifi driver
415  *
416  *
417  *  @return             Error code indicating success/failure
418  *  @note
419  *  @author             mdaftedar
420  *  @date               28 Feb 2013
421  *  @version            1.0
422  */
423 s32 host_int_add_wep_key_bss_ap(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
424
425 /**
426  *  @brief              adds ptk Key
427  *  @details
428  *  @param[in,out] handle to the wifi driver
429  *  @param[in]  message containing PTK Key in the following format
430  *|-------------------------------------------------------------------------|
431  *|Sta Adress | Key Length |    Temporal Key | Rx Michael Key |Tx Michael Key |
432  *|-----------|------------|---------------|----------------|---------------|
433  |      6 bytes |       1byte    |   16 bytes    |        8 bytes         |        8 bytes        |
434  ||-------------------------------------------------------------------------|
435  *  @return             Error code indicating success/failure
436  *  @note
437  *  @author             zsalah
438  *  @date               8 March 2012
439  *  @version            1.0
440  */
441 s32 host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen,
442                              const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx);
443
444 /**
445  *  @brief              host_int_get_inactive_time
446  *  @details
447  *  @param[in,out] handle to the wifi driver
448  *  @param[in]  message containing inactive time
449  *
450  *  @return             Error code indicating success/failure
451  *  @note
452  *  @author             mdaftedar
453  *  @date               15 April 2013
454  *  @version            1.0
455  */
456 s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime);
457
458 /**
459  *  @brief              adds Rx GTk Key
460  *  @details
461  *  @param[in,out] handle to the wifi driver
462  *  @param[in]  message containing Rx GTK Key in the following format
463  *|----------------------------------------------------------------------------|
464  *|Sta Address | Key RSC | KeyID | Key Length | Temporal Key    | Rx Michael Key |
465  *|------------|---------|-------|------------|---------------|----------------|
466  |      6 bytes  | 8 byte  |1 byte |  1 byte    |   16 bytes    |         8 bytes        |
467  ||----------------------------------------------------------------------------|
468  *  @return             Error code indicating success/failure
469  *  @note
470  *  @author             zsalah
471  *  @date               8 March 2012
472  *  @version            1.0
473  */
474 s32 host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen,
475                                 u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC,
476                                 const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode);
477
478
479 /**
480  *  @brief              adds Tx GTk Key
481  *  @details
482  *  @param[in,out] handle to the wifi driver
483  *  @param[in]  message containing Tx GTK Key in the following format
484  *|----------------------------------------------------|
485  | KeyID | Key Length | Temporal Key    | Tx Michael Key |
486  ||-------|------------|--------------|----------------|
487  ||1 byte |  1 byte      |   16 bytes   |         8 bytes        |
488  ||----------------------------------------------------|
489  *  @return             Error code indicating success/failure
490  *  @note
491  *  @author             zsalah
492  *  @date               8 March 2012
493  *  @version            1.0
494  */
495 s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx);
496
497 /**
498  *  @brief              caches the pmkid
499  *  @details    valid only in BSS STA mode if External Supplicant
500  *                              support is enabled. This Function sets the PMKID in firmware
501  *                              when host drivr receives the corresponding request from NDIS.
502  *                              The firmware then includes theset PMKID in the appropriate
503  *                              management frames
504  *  @param[in,out] handle to the wifi driver
505  *  @param[in]  message containing PMKID Info in the following format
506  *|-----------------------------------------------------------------|
507  *|NumEntries | BSSID[1] | PMKID[1] |  ...      | BSSID[K] | PMKID[K] |
508  *|-----------|------------|----------|-------|----------|----------|
509  |         1    |               6        |   16         |  ...  |        6         |    16        |
510  ||-----------------------------------------------------------------|
511  *  @return             Error code indicating success/failure
512  *  @note
513  *  @author             zsalah
514  *  @date               8 March 2012
515  *  @version            1.0
516  */
517
518 s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray);
519 /**
520  *  @brief              gets the cached the pmkid info
521  *  @details    valid only in BSS STA mode if External Supplicant
522  *                              support is enabled. This Function sets the PMKID in firmware
523  *                              when host drivr receives the corresponding request from NDIS.
524  *                              The firmware then includes theset PMKID in the appropriate
525  *                              management frames
526  *  @param[in,out] handle to the wifi driver,
527  *
528  *                                message containing PMKID Info in the following format
529  *|-----------------------------------------------------------------|
530  *|NumEntries | BSSID[1] | PMKID[1] |  ...      | BSSID[K] | PMKID[K] |
531  *|-----------|------------|----------|-------|----------|----------|
532  |         1    |               6        |   16         |  ...  |        6         |    16        |
533  ||-----------------------------------------------------------------|
534  *  @param[in]
535  *  @return             Error code indicating success/failure
536  *  @note
537  *  @author             zsalah
538  *  @date               8 March 2012
539  *  @version            1.0
540  */
541
542 s32 host_int_get_pmkid_info(struct host_if_drv *hWFIDrv, u8 *pu8PmkidInfoArray,
543                                     u32 u32PmkidInfoLen);
544
545 /**
546  *  @brief              sets the pass phrase
547  *  @details    AP/STA mode. This function gives the pass phrase used to
548  *                              generate the Pre-Shared Key when WPA/WPA2 is enabled
549  *                              The length of the field can vary from 8 to 64 bytes,
550  *                              the lower layer should get the
551  *  @param[in,out] handle to the wifi driver,
552  *  @param[in]   String containing PSK
553  *  @return             Error code indicating success/failure
554  *  @note
555  *  @author             zsalah
556  *  @date               8 March 2012
557  *  @version            1.0
558  */
559 s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, u8 *pu8PassPhrase,
560                                                  u8 u8Psklength);
561 /**
562  *  @brief              gets the pass phrase
563  *  @details    AP/STA mode. This function gets the pass phrase used to
564  *                              generate the Pre-Shared Key when WPA/WPA2 is enabled
565  *                              The length of the field can vary from 8 to 64 bytes,
566  *                              the lower layer should get the
567  *  @param[in,out] handle to the wifi driver,
568  *                                String containing PSK
569  *  @return             Error code indicating success/failure
570  *  @note
571  *  @author             zsalah
572  *  @date               8 March 2012
573  *  @version            1.0
574  */
575 s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv,
576                                                  u8 *pu8PassPhrase, u8 u8Psklength);
577
578 /**
579  *  @brief              gets mac address
580  *  @details
581  *  @param[in,out] handle to the wifi driver,
582  *
583  *  @return             Error code indicating success/failure
584  *  @note
585  *  @author             mdaftedar
586  *  @date               19 April 2012
587  *  @version            1.0
588  */
589 s32 host_int_get_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
590
591 /**
592  *  @brief              sets mac address
593  *  @details
594  *  @param[in,out] handle to the wifi driver,
595  *
596  *  @return             Error code indicating success/failure
597  *  @note
598  *  @author             mabubakr
599  *  @date               16 July 2012
600  *  @version            1.0
601  */
602 s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
603
604 /**
605  *  @brief              wait until msg q is empty
606  *  @details
607  *  @param[in,out]
608  *
609  *  @return             Error code indicating success/failure
610  *  @note
611  *  @author             asobhy
612  *  @date               19 march 2014
613  *  @version            1.0
614  */
615 int host_int_wait_msg_queue_idle(void);
616
617 /**
618  *  @brief              sets a start scan request
619  *  @details
620  *  @param[in,out] handle to the wifi driver,
621  *  @param[in]  Scan Source one of the following values
622  *                              DEFAULT_SCAN        0
623  *                              USER_SCAN           BIT0
624  *                              OBSS_PERIODIC_SCAN  BIT1
625  *                              OBSS_ONETIME_SCAN   BIT2
626  *  @return             Error code indicating success/failure
627  *  @note
628  *  @author             zsalah
629  *  @date               8 March 2012
630  *  @version            1.0
631  */
632
633 s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource);
634 /**
635  *  @brief              gets scan source of the last scan
636  *  @details
637  *  @param[in,out] handle to the wifi driver,
638  *                              Scan Source one of the following values
639  *                              DEFAULT_SCAN        0
640  *                              USER_SCAN           BIT0
641  *                              OBSS_PERIODIC_SCAN  BIT1
642  *                              OBSS_ONETIME_SCAN   BIT2
643  *  @return             Error code indicating success/failure
644  *  @note
645  *  @author             zsalah
646  *  @date               8 March 2012
647  *  @version            1.0
648  */
649 s32 host_int_get_start_scan_req(struct host_if_drv *hWFIDrv, u8 *pu8ScanSource);
650
651 /**
652  *  @brief              sets a join request
653  *  @details
654  *  @param[in,out] handle to the wifi driver,
655  *  @param[in]  Index of the bss descriptor
656  *  @return             Error code indicating success/failure
657  *  @note
658  *  @author             zsalah
659  *  @date               8 March 2012
660  *  @version            1.0
661  */
662
663 s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid,
664                                   const u8 *pu8ssid, size_t ssidLen,
665                                   const u8 *pu8IEs, size_t IEsLen,
666                                   wilc_connect_result pfConnectResult, void *pvUserArg,
667                                   u8 u8security, enum AUTHTYPE tenuAuth_type,
668                                   u8 u8channel,
669                                   void *pJoinParams);
670
671 /**
672  *  @brief              Flush a join request parameters to FW, but actual connection
673  *  @details    The function is called in situation where WILC is connected to AP and
674  *                      required to switch to hybrid FW for P2P connection
675  *  @param[in] handle to the wifi driver,
676  *  @return             Error code indicating success/failure
677  *  @note
678  *  @author             Amr Abdel-Moghny
679  *  @date               19 DEC 2013
680  *  @version            8.0
681  */
682
683 s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
684
685
686 /**
687  *  @brief              disconnects from the currently associated network
688  *  @details
689  *  @param[in,out] handle to the wifi driver,
690  *  @param[in]  Reason Code of the Disconnection
691  *  @return             Error code indicating success/failure
692  *  @note
693  *  @author             zsalah
694  *  @date               8 March 2012
695  *  @version            1.0
696  */
697 s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
698
699 /**
700  *  @brief              disconnects a sta
701  *  @details
702  *  @param[in,out] handle to the wifi driver,
703  *  @param[in]  Association Id of the station to be disconnected
704  *  @return             Error code indicating success/failure
705  *  @note
706  *  @author             zsalah
707  *  @date               8 March 2012
708  *  @version            1.0
709  */
710 s32 host_int_disconnect_station(struct host_if_drv *hWFIDrv, u8 assoc_id);
711 /**
712  *  @brief              gets a Association request info
713  *  @details
714  *  @param[in,out] handle to the wifi driver,
715  *                              Message containg assoc. req info in the following format
716  * ------------------------------------------------------------------------
717  |                        Management Frame Format                    |
718  ||-------------------------------------------------------------------|
719  ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS |
720  ||-------------|--------|--|--|-----|----------------|----------|----|
721  | 2           |2       |6 |6 |6    |           2       |0 - 2312  | 4  |
722  ||-------------------------------------------------------------------|
723  |                                                                   |
724  |             Association Request Frame - Frame Body                |
725  ||-------------------------------------------------------------------|
726  | Capability Information | Listen Interval | SSID | Supported Rates |
727  ||------------------------|-----------------|------|-----------------|
728  |                      2            |           2         | 2-34 |             3-10        |
729  | ---------------------------------------------------------------------
730  *  @return             Error code indicating success/failure
731  *  @note
732  *  @author             zsalah
733  *  @date               8 March 2012
734  *  @version            1.0
735  */
736
737 s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocReqInfo,
738                                         u32 u32AssocReqInfoLen);
739 /**
740  *  @brief              gets a Association Response info
741  *  @details
742  *  @param[in,out] handle to the wifi driver,
743  *                              Message containg assoc. resp info
744  *  @return             Error code indicating success/failure
745  *  @note
746  *  @author             zsalah
747  *  @date               8 March 2012
748  *  @version            1.0
749  */
750
751 s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo,
752                                         u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen);
753 /**
754  *  @brief              gets a Association Response info
755  *  @details    Valid only in STA mode. This function gives the RSSI
756  *                              values observed in all the channels at the time of scanning.
757  *                              The length of the field is 1 greater that the total number of
758  *                              channels supported. Byte 0 contains the number of channels while
759  *                              each of Byte N contains the observed RSSI value for the channel index N.
760  *  @param[in,out] handle to the wifi driver,
761  *                              array of scanned channels' RSSI
762  *  @return             Error code indicating success/failure
763  *  @note
764  *  @author             zsalah
765  *  @date               8 March 2012
766  *  @version            1.0
767  */
768 s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, u8 *pu8RxPowerLevel,
769                                         u32 u32RxPowerLevelLen);
770
771 /**
772  *  @brief              sets a channel
773  *  @details
774  *  @param[in,out] handle to the wifi driver,
775  *  @param[in]  Index of the channel to be set
776  *|-------------------------------------------------------------------|
777  |          CHANNEL1      CHANNEL2 ....                      CHANNEL14  |
778  |  Input:         1             2                                                  14  |
779  ||-------------------------------------------------------------------|
780  *  @return             Error code indicating success/failure
781  *  @note
782  *  @author             zsalah
783  *  @date               8 March 2012
784  *  @version            1.0
785  */
786 int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);
787
788 /**
789  *  @brief              gets the current channel index
790  *  @details
791  *  @param[in,out] handle to the wifi driver,
792  *                              current channel index
793  *|-----------------------------------------------------------------------|
794  |          CHANNEL1      CHANNEL2 ....                     CHANNEL14   |
795  |  Input:         1             2                                 14   |
796  ||-----------------------------------------------------------------------|
797  *  @return             Error code indicating success/failure
798  *  @note
799  *  @author             zsalah
800  *  @date               8 March 2012
801  *  @version            1.0
802  */
803 s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo);
804 /**
805  *  @brief              gets the sta rssi
806  *  @details    gets the currently maintained RSSI value for the station.
807  *                              The received signal strength value in dB.
808  *                              The range of valid values is -128 to 0.
809  *  @param[in,out] handle to the wifi driver,
810  *                              rssi value in dB
811  *  @return             Error code indicating success/failure
812  *  @note
813  *  @author             zsalah
814  *  @date               8 March 2012
815  *  @version            1.0
816  */
817 s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
818 s32 host_int_get_link_speed(struct host_if_drv *hWFIDrv, s8 *ps8lnkspd);
819 /**
820  *  @brief              scans a set of channels
821  *  @details
822  *  @param[in,out] handle to the wifi driver,
823  *  @param[in]          Scan source
824  *                              Scan Type       PASSIVE_SCAN = 0,
825  *                                                      ACTIVE_SCAN  = 1
826  *                              Channels Array
827  *                              Channels Array length
828  *                              Scan Callback function
829  *                              User Argument to be delivered back through the Scan Cllback function
830  *  @return             Error code indicating success/failure
831  *  @note
832  *  @author             zsalah
833  *  @date               8 March 2012
834  *  @version            1.0
835  */
836 s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
837                           u8 u8ScanType, u8 *pu8ChnlFreqList,
838                           u8 u8ChnlListLen, const u8 *pu8IEs,
839                           size_t IEsLen, wilc_scan_result ScanResult,
840                           void *pvUserArg,
841                           struct hidden_network *pstrHiddenNetwork);
842 /**
843  *  @brief              sets configuration wids values
844  *  @details
845  *  @param[in,out] handle to the wifi driver,
846  *  @param[in]  WID, WID value
847  *  @return             Error code indicating success/failure
848  *  @note
849  *  @author             zsalah
850  *  @date               8 March 2012
851  *  @version            1.0
852  */
853 s32 hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal);
854
855 /**
856  *  @brief              gets configuration wids values
857  *  @details
858  *  @param[in,out] handle to the wifi driver,
859  *                              WID value
860  *  @param[in]  WID,
861  *  @return             Error code indicating success/failure
862  *  @note
863  *  @author             zsalah
864  *  @date               8 March 2012
865  *  @version            1.0
866  */
867 s32 hif_get_cfg(struct host_if_drv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value);
868 /*****************************************************************************/
869 /*                                                      Notification Functions                                                   */
870 /*****************************************************************************/
871 /**
872  *  @brief              host interface initialization function
873  *  @details
874  *  @param[in,out] handle to the wifi driver,
875  *  @note
876  *  @author             zsalah
877  *  @date               8 March 2012
878  *  @version            1.0
879  */
880 s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
881
882 /**
883  *  @brief              host interface initialization function
884  *  @details
885  *  @param[in,out] handle to the wifi driver,
886  *  @note
887  *  @author             zsalah
888  *  @date               8 March 2012
889  *  @version            1.0
890  */
891 s32 host_int_deinit(struct host_if_drv *hWFIDrv);
892
893
894 /*!
895  *  @fn         s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv,u8 u8Index)
896  *  @brief              Sends a beacon to the firmware to be transmitted over the air
897  *  @details
898  *  @param[in,out]      hWFIDrv         handle to the wifi driver
899  *  @param[in]  u32Interval     Beacon Interval. Period between two successive beacons on air
900  *  @param[in]  u32DTIMPeriod DTIM Period. Indicates how many Beacon frames
901  *              (including the current frame) appear before the next DTIM
902  *  @param[in]  u32Headlen      Length of the head buffer in bytes
903  *  @param[in]  pu8Head         Pointer to the beacon's head buffer. Beacon's head
904  *              is the part from the beacon's start till the TIM element, NOT including the TIM
905  *  @param[in]  u32Taillen      Length of the tail buffer in bytes
906  *  @param[in]  pu8Tail         Pointer to the beacon's tail buffer. Beacon's tail
907  *              starts just after the TIM inormation element
908  *  @return     0 for Success, error otherwise
909  *  @todo
910  *  @sa
911  *  @author             Adham Abozaeid
912  *  @date               10 Julys 2012
913  *  @version            1.0 Description
914  *
915  */
916 s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
917                                 u32 u32DTIMPeriod,
918                                 u32 u32HeadLen, u8 *pu8Head,
919                                 u32 u32TailLen, u8 *pu8tail);
920
921
922 /*!
923  *  @fn         s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv)
924  *  @brief              Removes the beacon and stops trawilctting it over the air
925  *  @details
926  *  @param[in,out]      hWFIDrv         handle to the wifi driver
927  *  @return     0 for Success, error otherwise
928  *  @todo
929  *  @sa
930  *  @author             Adham Abozaeid
931  *  @date               10 Julys 2012
932  *  @version            1.0 Description
933  */
934 s32 host_int_del_beacon(struct host_if_drv *hWFIDrv);
935
936 /*!
937  *  @fn         s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv,
938  *                                       struct add_sta_param *pstrStaParams)
939  *  @brief              Notifies the firmware with a new associated stations
940  *  @details
941  *  @param[in,out]      hWFIDrv         handle to the wifi driver
942  *  @param[in]  pstrStaParams   Station's parameters
943  *  @return     0 for Success, error otherwise
944  *  @todo
945  *  @sa
946  *  @author             Adham Abozaeid
947  *  @date               12 July 2012
948  *  @version            1.0 Description
949  */
950 s32 host_int_add_station(struct host_if_drv *hWFIDrv,
951                          struct add_sta_param *pstrStaParams);
952
953 /*!
954  *  @fn         s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr)
955  *  @brief              Deauthenticates clients when group is terminating
956  *  @details
957  *  @param[in,out]      hWFIDrv         handle to the wifi driver
958  *  @param[in]  pu8MacAddr      Station's mac address
959  *  @return     0 for Success, error otherwise
960  *  @todo
961  *  @sa
962  *  @author             Mai Daftedar
963  *  @date               09 April 2014
964  *  @version            1.0 Description
965  */
966 s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]);
967
968 /*!
969  *  @fn         s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr)
970  *  @brief              Notifies the firmware with a new deleted station
971  *  @details
972  *  @param[in,out]      hWFIDrv         handle to the wifi driver
973  *  @param[in]  pu8MacAddr      Station's mac address
974  *  @return     0 for Success, error otherwise
975  *  @todo
976  *  @sa
977  *  @author             Adham Abozaeid
978  *  @date               15 July 2012
979  *  @version            1.0 Description
980  */
981 s32 host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr);
982
983 /*!
984  *  @fn         s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv,
985  *                                        struct add_sta_param *pstrStaParams)
986  *  @brief              Notifies the firmware with new parameters of an already associated station
987  *  @details
988  *  @param[in,out]      hWFIDrv         handle to the wifi driver
989  *  @param[in]  pstrStaParams   Station's parameters
990  *  @return     0 for Success, error otherwise
991  *  @todo
992  *  @sa
993  *  @author             Adham Abozaeid
994  *  @date               15 July 2012
995  *  @version            1.0 Description
996  */
997 s32 host_int_edit_station(struct host_if_drv *hWFIDrv,
998                           struct add_sta_param *pstrStaParams);
999
1000 /*!
1001  *  @fn         s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout)
1002  *  @brief              Set the power management mode to enabled or disabled
1003  *  @details
1004  *  @param[in,out]      hWFIDrv         handle to the wifi driver
1005  *  @param[in]  bIsEnabled      TRUE if enabled, FALSE otherwise
1006  *  @param[in]  u32Timeout      A timeout value of -1 allows the driver to adjust
1007  *                                                      the dynamic ps timeout value
1008  *  @return     0 for Success, error otherwise
1009  *  @todo
1010  *  @sa
1011  *  @author             Adham Abozaeid
1012  *  @date               24 November 2012
1013  *  @version            1.0 Description
1014  */
1015 s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32Timeout);
1016 /*  @param[in,out]      hWFIDrv         handle to the wifi driver
1017  *  @param[in]  bIsEnabled      TRUE if enabled, FALSE otherwise
1018  *  @param[in]  u8count         count of mac address entries in the filter table
1019  *
1020  *  @return     0 for Success, error otherwise
1021  *  @todo
1022  *  @sa
1023  *  @author             Adham Abozaeid
1024  *  @date               24 November 2012
1025  *  @version            1.0 Description
1026  */
1027 s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32count);
1028 /**
1029  *  @brief           host_int_setup_ipaddress
1030  *  @details       set IP address on firmware
1031  *  @param[in]
1032  *  @return         Error code.
1033  *  @author             Abdelrahman Sobhy
1034  *  @date
1035  *  @version    1.0
1036  */
1037 s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
1038
1039
1040 /**
1041  *  @brief           host_int_delBASession
1042  *  @details       Delete single Rx BA session
1043  *  @param[in]
1044  *  @return         Error code.
1045  *  @author             Abdelrahman Sobhy
1046  *  @date
1047  *  @version    1.0
1048  */
1049 s32 host_int_delBASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
1050
1051 /**
1052  *  @brief           host_int_delBASession
1053  *  @details       Delete all Rx BA session
1054  *  @param[in]
1055  *  @return         Error code.
1056  *  @author             Abdelrahman Sobhy
1057  *  @date
1058  *  @version    1.0
1059  */
1060 s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
1061
1062
1063 /**
1064  *  @brief           host_int_get_ipaddress
1065  *  @details       get IP address on firmware
1066  *  @param[in]
1067  *  @return         Error code.
1068  *  @author             Abdelrahman Sobhy
1069  *  @date
1070  *  @version    1.0
1071  */
1072 s32 host_int_get_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
1073
1074 /**
1075  *  @brief           host_int_remain_on_channel
1076  *  @details
1077  *  @param[in]
1078  *  @return         Error code.
1079  *  @author
1080  *  @date
1081  *  @version    1.0
1082  */
1083 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);
1084
1085 /**
1086  *  @brief              host_int_ListenStateExpired
1087  *  @details
1088  *  @param[in]          Handle to wifi driver
1089  *                              Duration to remain on channel
1090  *                              Channel to remain on
1091  *                              Pointer to fn to be called on receive frames in listen state
1092  *                              Pointer to remain-on-channel expired fn
1093  *                              Priv
1094  *  @return             Error code.
1095  *  @author
1096  *  @date
1097  *  @version            1.0
1098  */
1099 s32 host_int_ListenStateExpired(struct host_if_drv *hWFIDrv, u32 u32SessionID);
1100
1101 /**
1102  *  @brief           host_int_frame_register
1103  *  @details
1104  *  @param[in]
1105  *  @return         Error code.
1106  *  @author
1107  *  @date
1108  *  @version    1.0
1109  */
1110 s32 host_int_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool bReg);
1111 /**
1112  *  @brief           host_int_set_wfi_drv_handler
1113  *  @details
1114  *  @param[in]
1115  *  @return         Error code.
1116  *  @author
1117  *  @date
1118  *  @version    1.0
1119  */
1120 int host_int_set_wfi_drv_handler(struct host_if_drv *address);
1121 int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);
1122
1123 static s32 Handle_ScanDone(struct host_if_drv *drvHandler, enum scan_event enuEvent);
1124
1125 void host_int_freeJoinParams(void *pJoinParams);
1126
1127 s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);
1128
1129 #endif