host_interface.h 35 KB

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