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