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