staging: wilc1000: remove typedef from CURRENT_TX_RATE_T
[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 struct host_if_pmkid {
87         u8 bssid[ETH_ALEN];
88         u8 pmkid[PMKID_LEN];
89 };
90
91 struct host_if_pmkid_attr {
92         u8 numpmkid;
93         struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
94 };
95
96 enum CURRENT_TXRATE {
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 };
111
112 struct cfg_param_val {
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         enum SITESURVEY site_survey_enabled;
129         u16 site_survey_scan_time;
130         u8 scan_source;
131         u16 active_scan_time;
132         u16 passive_scan_time;
133         enum CURRENT_TXRATE curr_tx_rate;
134
135 };
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 enum KEY_TYPE {
176         WEP,
177         WPARxGtk,
178         WPAPtk,
179         PMKSA,
180 };
181
182
183 /*Scan callBack function definition*/
184 typedef void (*wilc_scan_result)(tenuScanEvent, tstrNetworkInfo *, void *, void *);
185
186 /*Connect callBack function definition*/
187 typedef void (*wilc_connect_result)(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 struct hidden_network {
223         /* MAX_SSID_LEN */
224         tstrHiddenNetworkInfo *pstrHiddenNetworkInfo;
225         u8 u8ssidnum;
226 };
227
228 typedef struct {
229         /* Scan user call back function */
230         wilc_scan_result pfUserScanResult;
231
232         /* User specific parameter to be delivered through the Scan User Callback function */
233         void *u32UserScanPvoid;
234
235         u32 u32RcvdChCount;
236         tstrFoundNetworkInfo astrFoundNetworkInfo[MAX_NUM_SCANNED_NETWORKS];
237 } tstrWILC_UsrScanReq;
238
239 typedef struct {
240         u8 *pu8bssid;
241         u8 *pu8ssid;
242         u8 u8security;
243         enum AUTHTYPE tenuAuth_type;
244         size_t ssidLen;
245         u8 *pu8ConnReqIEs;
246         size_t ConnReqIEsLen;
247         /* Connect user call back function */
248         wilc_connect_result pfUserConnectResult;
249         bool IsHTCapable;
250         /* User specific parameter to be delivered through the Connect User Callback function */
251         void *u32UserConnectPvoid;
252 } tstrWILC_UsrConnReq;
253
254 struct drv_handler {
255         u32 u32Address;
256 };
257
258 struct op_mode {
259         u32 u32Mode;
260 };
261
262 struct set_mac_addr {
263         u8 u8MacAddress[ETH_ALEN];
264 };
265
266 struct get_mac_addr {
267         u8 *u8MacAddress;
268 };
269
270 struct ba_session_info {
271         u8 au8Bssid[ETH_ALEN];
272         u8 u8Ted;
273         u16 u16BufferSize;
274         u16 u16SessionTimeout;
275 };
276
277 struct remain_ch {
278         u16 u16Channel;
279         u32 u32duration;
280         tWILCpfRemainOnChanExpired pRemainOnChanExpired;
281         tWILCpfRemainOnChanReady pRemainOnChanReady;
282         void *pVoid;
283         u32 u32ListenSessionID;
284 };
285
286 struct reg_frame {
287         bool bReg;
288         u16 u16FrameType;
289         u8 u8Regid;
290 };
291
292
293 #define ACTION                  0xD0
294 #define PROBE_REQ               0x40
295 #define PROBE_RESP              0x50
296 #define ACTION_FRM_IDX          0
297 #define PROBE_REQ_IDX           1
298
299
300 enum p2p_listen_state {
301         P2P_IDLE,
302         P2P_LISTEN,
303         P2P_GRP_FORMATION
304 };
305
306 typedef struct {
307         /* Scan user structure */
308         tstrWILC_UsrScanReq strWILC_UsrScanReq;
309
310         /* Connect User structure */
311         tstrWILC_UsrConnReq strWILC_UsrConnReq;
312
313         /*Remain on channel struvture*/
314         struct remain_ch strHostIfRemainOnChan;
315         u8 u8RemainOnChan_pendingreq;
316         u64 u64P2p_MgmtTimeout;
317         u8 u8P2PConnect;
318
319         tenuHostIFstate enuHostIFstate;
320
321         u8 au8AssociatedBSSID[ETH_ALEN];
322         struct cfg_param_val strCfgValues;
323 /* semaphores */
324         struct semaphore gtOsCfgValuesSem;
325         struct semaphore hSemTestKeyBlock;
326
327         struct semaphore hSemTestDisconnectBlock;
328         struct semaphore hSemGetRSSI;
329         struct semaphore hSemGetLINKSPEED;
330         struct semaphore hSemGetCHNL;
331         struct semaphore hSemInactiveTime;
332 /* timer handlers */
333         struct timer_list hScanTimer;
334         struct timer_list hConnectTimer;
335         struct timer_list hRemainOnChannel;
336
337         bool IFC_UP;
338 } tstrWILC_WFIDrv;
339
340 /*!
341  *  @enum               tenuWILC_StaFlag
342  *  @brief                      Used to decode the station flag set and mask in tstrWILC_AddStaParam
343  *  @details
344  *  @todo
345  *  @sa                 tstrWILC_AddStaParam, enum nl80211_sta_flags
346  *  @author             Enumeraion's creator
347  *  @date                       12 July 2012
348  *  @version            1.0 Description
349  */
350
351 typedef enum {
352         WILC_STA_FLAG_INVALID = 0,
353         WILC_STA_FLAG_AUTHORIZED,                       /*!<  station is authorized (802.1X)*/
354         WILC_STA_FLAG_SHORT_PREAMBLE,   /*!< station is capable of receiving frames     with short barker preamble*/
355         WILC_STA_FLAG_WME,                              /*!< station is WME/QoS capable*/
356         WILC_STA_FLAG_MFP,                                      /*!< station uses management frame protection*/
357         WILC_STA_FLAG_AUTHENTICATED             /*!< station is authenticated*/
358 } tenuWILC_StaFlag;
359
360 struct add_sta_param {
361         u8 au8BSSID[ETH_ALEN];
362         u16 u16AssocID;
363         u8 u8NumRates;
364         const u8 *pu8Rates;
365         bool bIsHTSupported;
366         u16 u16HTCapInfo;
367         u8 u8AmpduParams;
368         u8 au8SuppMCsSet[16];
369         u16 u16HTExtParams;
370         u32 u32TxBeamformingCap;
371         u8 u8ASELCap;
372         u16 u16FlagsMask;               /*<! Determines which of u16FlagsSet were changed>*/
373         u16 u16FlagsSet;                /*<! Decoded according to tenuWILC_StaFlag */
374 };
375
376 /*****************************************************************************/
377 /*                                                                                                                                                       */
378 /*                                                      Host Interface API                                                               */
379 /*                                                                                                                                                       */
380 /*****************************************************************************/
381
382 /**
383  *  @brief              removes wpa/wpa2 keys
384  *  @details    only in BSS STA mode if External Supplicant support is enabled.
385  *                              removes all WPA/WPA2 station key entries from MAC hardware.
386  *  @param[in,out] handle to the wifi driver
387  *  @param[in]  6 bytes of Station Adress in the station entry table
388  *  @return             Error code indicating success/failure
389  *  @note
390  *  @author             zsalah
391  *  @date               8 March 2012
392  *  @version            1.0
393  */
394 s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress);
395 /**
396  *  @brief              removes WEP key
397  *  @details    valid only in BSS STA mode if External Supplicant support is enabled.
398  *                              remove a WEP key entry from MAC HW.
399  *                              The BSS Station automatically finds the index of the entry using its
400  *                              BSS ID and removes that entry from the MAC hardware.
401  *  @param[in,out] handle to the wifi driver
402  *  @param[in]  6 bytes of Station Adress in the station entry table
403  *  @return             Error code indicating success/failure
404  *  @note               NO need for the STA add since it is not used for processing
405  *  @author             zsalah
406  *  @date               8 March 2012
407  *  @version            1.0
408  */
409 s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index);
410 /**
411  *  @brief              sets WEP deafault key
412  *  @details    Sets the index of the WEP encryption key in use,
413  *                              in the key table
414  *  @param[in,out] handle to the wifi driver
415  *  @param[in]  key index ( 0, 1, 2, 3)
416  *  @return             Error code indicating success/failure
417  *  @note
418  *  @author             zsalah
419  *  @date               8 March 2012
420  *  @version            1.0
421  */
422 s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index);
423
424 /**
425  *  @brief              sets WEP deafault key
426  *  @details    valid only in BSS STA mode if External Supplicant support is enabled.
427  *                              sets WEP key entry into MAC hardware when it receives the
428  *                              corresponding request from NDIS.
429  *  @param[in,out] handle to the wifi driver
430  *  @param[in]  message containing WEP Key in the following format
431  *|---------------------------------------|
432  *|Key ID Value | Key Length |  Key             |
433  *|-------------|------------|------------|
434  |      1byte     |             1byte  | Key Length     |
435  ||---------------------------------------|
436  |
437  *  @return             Error code indicating success/failure
438  *  @note
439  *  @author             zsalah
440  *  @date               8 March 2012
441  *  @version            1.0
442  */
443 s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx);
444 /**
445  *  @brief              host_int_add_wep_key_bss_ap
446  *  @details    valid only in AP mode if External Supplicant support is enabled.
447  *                              sets WEP key entry into MAC hardware when it receives the
448  *                              corresponding request from NDIS.
449  *  @param[in,out] handle to the wifi driver
450  *
451  *
452  *  @return             Error code indicating success/failure
453  *  @note
454  *  @author             mdaftedar
455  *  @date               28 Feb 2013
456  *  @version            1.0
457  */
458 s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
459
460 /**
461  *  @brief              adds ptk Key
462  *  @details
463  *  @param[in,out] handle to the wifi driver
464  *  @param[in]  message containing PTK Key in the following format
465  *|-------------------------------------------------------------------------|
466  *|Sta Adress | Key Length |    Temporal Key | Rx Michael Key |Tx Michael Key |
467  *|-----------|------------|---------------|----------------|---------------|
468  |      6 bytes |       1byte    |   16 bytes    |        8 bytes         |        8 bytes        |
469  ||-------------------------------------------------------------------------|
470  *  @return             Error code indicating success/failure
471  *  @note
472  *  @author             zsalah
473  *  @date               8 March 2012
474  *  @version            1.0
475  */
476 s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen,
477                              const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx);
478
479 /**
480  *  @brief              host_int_get_inactive_time
481  *  @details
482  *  @param[in,out] handle to the wifi driver
483  *  @param[in]  message containing inactive time
484  *
485  *  @return             Error code indicating success/failure
486  *  @note
487  *  @author             mdaftedar
488  *  @date               15 April 2013
489  *  @version            1.0
490  */
491 s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime);
492
493 /**
494  *  @brief              adds Rx GTk Key
495  *  @details
496  *  @param[in,out] handle to the wifi driver
497  *  @param[in]  message containing Rx GTK Key in the following format
498  *|----------------------------------------------------------------------------|
499  *|Sta Address | Key RSC | KeyID | Key Length | Temporal Key    | Rx Michael Key |
500  *|------------|---------|-------|------------|---------------|----------------|
501  |      6 bytes  | 8 byte  |1 byte |  1 byte    |   16 bytes    |         8 bytes        |
502  ||----------------------------------------------------------------------------|
503  *  @return             Error code indicating success/failure
504  *  @note
505  *  @author             zsalah
506  *  @date               8 March 2012
507  *  @version            1.0
508  */
509 s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen,
510                                 u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC,
511                                 const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode);
512
513
514 /**
515  *  @brief              adds Tx GTk Key
516  *  @details
517  *  @param[in,out] handle to the wifi driver
518  *  @param[in]  message containing Tx GTK Key in the following format
519  *|----------------------------------------------------|
520  | KeyID | Key Length | Temporal Key    | Tx Michael Key |
521  ||-------|------------|--------------|----------------|
522  ||1 byte |  1 byte      |   16 bytes   |         8 bytes        |
523  ||----------------------------------------------------|
524  *  @return             Error code indicating success/failure
525  *  @note
526  *  @author             zsalah
527  *  @date               8 March 2012
528  *  @version            1.0
529  */
530 s32 host_int_add_tx_gtk(tstrWILC_WFIDrv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx);
531
532 /**
533  *  @brief              caches the pmkid
534  *  @details    valid only in BSS STA mode if External Supplicant
535  *                              support is enabled. This Function sets the PMKID in firmware
536  *                              when host drivr receives the corresponding request from NDIS.
537  *                              The firmware then includes theset PMKID in the appropriate
538  *                              management frames
539  *  @param[in,out] handle to the wifi driver
540  *  @param[in]  message containing PMKID Info in the following format
541  *|-----------------------------------------------------------------|
542  *|NumEntries | BSSID[1] | PMKID[1] |  ...      | BSSID[K] | PMKID[K] |
543  *|-----------|------------|----------|-------|----------|----------|
544  |         1    |               6        |   16         |  ...  |        6         |    16        |
545  ||-----------------------------------------------------------------|
546  *  @return             Error code indicating success/failure
547  *  @note
548  *  @author             zsalah
549  *  @date               8 March 2012
550  *  @version            1.0
551  */
552
553 s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray);
554 /**
555  *  @brief              gets the cached the pmkid info
556  *  @details    valid only in BSS STA mode if External Supplicant
557  *                              support is enabled. This Function sets the PMKID in firmware
558  *                              when host drivr receives the corresponding request from NDIS.
559  *                              The firmware then includes theset PMKID in the appropriate
560  *                              management frames
561  *  @param[in,out] handle to the wifi driver,
562  *
563  *                                message containing PMKID Info in the following format
564  *|-----------------------------------------------------------------|
565  *|NumEntries | BSSID[1] | PMKID[1] |  ...      | BSSID[K] | PMKID[K] |
566  *|-----------|------------|----------|-------|----------|----------|
567  |         1    |               6        |   16         |  ...  |        6         |    16        |
568  ||-----------------------------------------------------------------|
569  *  @param[in]
570  *  @return             Error code indicating success/failure
571  *  @note
572  *  @author             zsalah
573  *  @date               8 March 2012
574  *  @version            1.0
575  */
576
577 s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray,
578                                     u32 u32PmkidInfoLen);
579
580 /**
581  *  @brief              sets the pass phrase
582  *  @details    AP/STA mode. This function gives the pass phrase used to
583  *                              generate the Pre-Shared Key when WPA/WPA2 is enabled
584  *                              The length of the field can vary from 8 to 64 bytes,
585  *                              the lower layer should get the
586  *  @param[in,out] handle to the wifi driver,
587  *  @param[in]   String containing PSK
588  *  @return             Error code indicating success/failure
589  *  @note
590  *  @author             zsalah
591  *  @date               8 March 2012
592  *  @version            1.0
593  */
594 s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase,
595                                                  u8 u8Psklength);
596 /**
597  *  @brief              gets the pass phrase
598  *  @details    AP/STA mode. This function gets the pass phrase used to
599  *                              generate the Pre-Shared Key when WPA/WPA2 is enabled
600  *                              The length of the field can vary from 8 to 64 bytes,
601  *                              the lower layer should get the
602  *  @param[in,out] handle to the wifi driver,
603  *                                String containing PSK
604  *  @return             Error code indicating success/failure
605  *  @note
606  *  @author             zsalah
607  *  @date               8 March 2012
608  *  @version            1.0
609  */
610 s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv,
611                                                  u8 *pu8PassPhrase, u8 u8Psklength);
612
613 /**
614  *  @brief              gets mac address
615  *  @details
616  *  @param[in,out] handle to the wifi driver,
617  *
618  *  @return             Error code indicating success/failure
619  *  @note
620  *  @author             mdaftedar
621  *  @date               19 April 2012
622  *  @version            1.0
623  */
624 s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress);
625
626 /**
627  *  @brief              sets mac address
628  *  @details
629  *  @param[in,out] handle to the wifi driver,
630  *
631  *  @return             Error code indicating success/failure
632  *  @note
633  *  @author             mabubakr
634  *  @date               16 July 2012
635  *  @version            1.0
636  */
637 s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress);
638
639 /**
640  *  @brief              wait until msg q is empty
641  *  @details
642  *  @param[in,out]
643  *
644  *  @return             Error code indicating success/failure
645  *  @note
646  *  @author             asobhy
647  *  @date               19 march 2014
648  *  @version            1.0
649  */
650 int host_int_wait_msg_queue_idle(void);
651
652 /**
653  *  @brief              sets a start scan request
654  *  @details
655  *  @param[in,out] handle to the wifi driver,
656  *  @param[in]  Scan Source one of the following values
657  *                              DEFAULT_SCAN        0
658  *                              USER_SCAN           BIT0
659  *                              OBSS_PERIODIC_SCAN  BIT1
660  *                              OBSS_ONETIME_SCAN   BIT2
661  *  @return             Error code indicating success/failure
662  *  @note
663  *  @author             zsalah
664  *  @date               8 March 2012
665  *  @version            1.0
666  */
667
668 s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource);
669 /**
670  *  @brief              gets scan source of the last scan
671  *  @details
672  *  @param[in,out] handle to the wifi driver,
673  *                              Scan Source one of the following values
674  *                              DEFAULT_SCAN        0
675  *                              USER_SCAN           BIT0
676  *                              OBSS_PERIODIC_SCAN  BIT1
677  *                              OBSS_ONETIME_SCAN   BIT2
678  *  @return             Error code indicating success/failure
679  *  @note
680  *  @author             zsalah
681  *  @date               8 March 2012
682  *  @version            1.0
683  */
684 s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource);
685
686 /**
687  *  @brief              sets a join request
688  *  @details
689  *  @param[in,out] handle to the wifi driver,
690  *  @param[in]  Index of the bss descriptor
691  *  @return             Error code indicating success/failure
692  *  @note
693  *  @author             zsalah
694  *  @date               8 March 2012
695  *  @version            1.0
696  */
697
698 s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid,
699                                   const u8 *pu8ssid, size_t ssidLen,
700                                   const u8 *pu8IEs, size_t IEsLen,
701                                   wilc_connect_result pfConnectResult, void *pvUserArg,
702                                   u8 u8security, enum AUTHTYPE tenuAuth_type,
703                                   u8 u8channel,
704                                   void *pJoinParams);
705
706 /**
707  *  @brief              Flush a join request parameters to FW, but actual connection
708  *  @details    The function is called in situation where WILC is connected to AP and
709  *                      required to switch to hybrid FW for P2P connection
710  *  @param[in] handle to the wifi driver,
711  *  @return             Error code indicating success/failure
712  *  @note
713  *  @author             Amr Abdel-Moghny
714  *  @date               19 DEC 2013
715  *  @version            8.0
716  */
717
718 s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv);
719
720
721 /**
722  *  @brief              disconnects from the currently associated network
723  *  @details
724  *  @param[in,out] handle to the wifi driver,
725  *  @param[in]  Reason Code of the Disconnection
726  *  @return             Error code indicating success/failure
727  *  @note
728  *  @author             zsalah
729  *  @date               8 March 2012
730  *  @version            1.0
731  */
732 s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode);
733
734 /**
735  *  @brief              disconnects a sta
736  *  @details
737  *  @param[in,out] handle to the wifi driver,
738  *  @param[in]  Association Id of the station to be disconnected
739  *  @return             Error code indicating success/failure
740  *  @note
741  *  @author             zsalah
742  *  @date               8 March 2012
743  *  @version            1.0
744  */
745 s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id);
746 /**
747  *  @brief              gets a Association request info
748  *  @details
749  *  @param[in,out] handle to the wifi driver,
750  *                              Message containg assoc. req info in the following format
751  * ------------------------------------------------------------------------
752  |                        Management Frame Format                    |
753  ||-------------------------------------------------------------------|
754  ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS |
755  ||-------------|--------|--|--|-----|----------------|----------|----|
756  | 2           |2       |6 |6 |6    |           2       |0 - 2312  | 4  |
757  ||-------------------------------------------------------------------|
758  |                                                                   |
759  |             Association Request Frame - Frame Body                |
760  ||-------------------------------------------------------------------|
761  | Capability Information | Listen Interval | SSID | Supported Rates |
762  ||------------------------|-----------------|------|-----------------|
763  |                      2            |           2         | 2-34 |             3-10        |
764  | ---------------------------------------------------------------------
765  *  @return             Error code indicating success/failure
766  *  @note
767  *  @author             zsalah
768  *  @date               8 March 2012
769  *  @version            1.0
770  */
771
772 s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo,
773                                         u32 u32AssocReqInfoLen);
774 /**
775  *  @brief              gets a Association Response info
776  *  @details
777  *  @param[in,out] handle to the wifi driver,
778  *                              Message containg assoc. resp info
779  *  @return             Error code indicating success/failure
780  *  @note
781  *  @author             zsalah
782  *  @date               8 March 2012
783  *  @version            1.0
784  */
785
786 s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo,
787                                         u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen);
788 /**
789  *  @brief              gets a Association Response info
790  *  @details    Valid only in STA mode. This function gives the RSSI
791  *                              values observed in all the channels at the time of scanning.
792  *                              The length of the field is 1 greater that the total number of
793  *                              channels supported. Byte 0 contains the number of channels while
794  *                              each of Byte N contains the observed RSSI value for the channel index N.
795  *  @param[in,out] handle to the wifi driver,
796  *                              array of scanned channels' RSSI
797  *  @return             Error code indicating success/failure
798  *  @note
799  *  @author             zsalah
800  *  @date               8 March 2012
801  *  @version            1.0
802  */
803 s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,
804                                         u32 u32RxPowerLevelLen);
805
806 /**
807  *  @brief              sets a channel
808  *  @details
809  *  @param[in,out] handle to the wifi driver,
810  *  @param[in]  Index of the channel to be set
811  *|-------------------------------------------------------------------|
812  |          CHANNEL1      CHANNEL2 ....                      CHANNEL14  |
813  |  Input:         1             2                                                  14  |
814  ||-------------------------------------------------------------------|
815  *  @return             Error code indicating success/failure
816  *  @note
817  *  @author             zsalah
818  *  @date               8 March 2012
819  *  @version            1.0
820  */
821 int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel);
822
823 /**
824  *  @brief              gets the current channel index
825  *  @details
826  *  @param[in,out] handle to the wifi driver,
827  *                              current channel index
828  *|-----------------------------------------------------------------------|
829  |          CHANNEL1      CHANNEL2 ....                     CHANNEL14   |
830  |  Input:         1             2                                 14   |
831  ||-----------------------------------------------------------------------|
832  *  @return             Error code indicating success/failure
833  *  @note
834  *  @author             zsalah
835  *  @date               8 March 2012
836  *  @version            1.0
837  */
838 s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo);
839 /**
840  *  @brief              gets the sta rssi
841  *  @details    gets the currently maintained RSSI value for the station.
842  *                              The received signal strength value in dB.
843  *                              The range of valid values is -128 to 0.
844  *  @param[in,out] handle to the wifi driver,
845  *                              rssi value in dB
846  *  @return             Error code indicating success/failure
847  *  @note
848  *  @author             zsalah
849  *  @date               8 March 2012
850  *  @version            1.0
851  */
852 s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi);
853 s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd);
854 /**
855  *  @brief              scans a set of channels
856  *  @details
857  *  @param[in,out] handle to the wifi driver,
858  *  @param[in]          Scan source
859  *                              Scan Type       PASSIVE_SCAN = 0,
860  *                                                      ACTIVE_SCAN  = 1
861  *                              Channels Array
862  *                              Channels Array length
863  *                              Scan Callback function
864  *                              User Argument to be delivered back through the Scan Cllback function
865  *  @return             Error code indicating success/failure
866  *  @note
867  *  @author             zsalah
868  *  @date               8 March 2012
869  *  @version            1.0
870  */
871 s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource,
872                           u8 u8ScanType, u8 *pu8ChnlFreqList,
873                           u8 u8ChnlListLen, const u8 *pu8IEs,
874                           size_t IEsLen, wilc_scan_result ScanResult,
875                           void *pvUserArg,
876                           struct hidden_network *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, struct cfg_param_val *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