1 #include "host_interface.h"
2 #include "wilc_oswrapper.h"
4 #include "coreconfigurator.h"
6 extern WILC_Sint32
TransportInit(void);
7 extern WILC_Sint32
TransportDeInit(void);
10 #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
11 extern WILC_TimerHandle hDuringIpTimer
;
14 extern WILC_Bool bEnablePS
;
16 extern u8 g_wilc_initialized
;
17 /*****************************************************************************/
19 /*****************************************************************************/
21 /* Message types of the Host IF Message Queue*/
22 #define HOST_IF_MSG_SCAN ((u16)0)
23 #define HOST_IF_MSG_CONNECT ((u16)1)
24 #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO ((u16)2)
25 #define HOST_IF_MSG_KEY ((u16)3)
26 #define HOST_IF_MSG_RCVD_NTWRK_INFO ((u16)4)
27 #define HOST_IF_MSG_RCVD_SCAN_COMPLETE ((u16)5)
28 #define HOST_IF_MSG_CFG_PARAMS ((u16)6)
29 #define HOST_IF_MSG_SET_CHANNEL ((u16)7)
30 #define HOST_IF_MSG_DISCONNECT ((u16)8)
31 #define HOST_IF_MSG_GET_RSSI ((u16)9)
32 #define HOST_IF_MSG_GET_CHNL ((u16)10)
33 #define HOST_IF_MSG_ADD_BEACON ((u16)11)
34 #define HOST_IF_MSG_DEL_BEACON ((u16)12)
35 #define HOST_IF_MSG_ADD_STATION ((u16)13)
36 #define HOST_IF_MSG_DEL_STATION ((u16)14)
37 #define HOST_IF_MSG_EDIT_STATION ((u16)15)
38 #define HOST_IF_MSG_SCAN_TIMER_FIRED ((u16)16)
39 #define HOST_IF_MSG_CONNECT_TIMER_FIRED ((u16)17)
40 #define HOST_IF_MSG_POWER_MGMT ((u16)18)
41 #define HOST_IF_MSG_GET_INACTIVETIME ((u16)19)
42 #define HOST_IF_MSG_REMAIN_ON_CHAN ((u16)20)
43 #define HOST_IF_MSG_REGISTER_FRAME ((u16)21)
44 #define HOST_IF_MSG_LISTEN_TIMER_FIRED ((u16)22)
45 #define HOST_IF_MSG_GET_LINKSPEED ((u16)23)
46 #define HOST_IF_MSG_SET_WFIDRV_HANDLER ((u16)24)
47 #define HOST_IF_MSG_SET_MAC_ADDRESS ((u16)25)
48 #define HOST_IF_MSG_GET_MAC_ADDRESS ((u16)26)
49 #define HOST_IF_MSG_SET_OPERATION_MODE ((u16)27)
50 #define HOST_IF_MSG_SET_IPADDRESS ((u16)28)
51 #define HOST_IF_MSG_GET_IPADDRESS ((u16)29)
52 #define HOST_IF_MSG_FLUSH_CONNECT ((u16)30)
53 #define HOST_IF_MSG_GET_STATISTICS ((u16)31)
54 #define HOST_IF_MSG_SET_MULTICAST_FILTER ((u16)32)
55 #define HOST_IF_MSG_ADD_BA_SESSION ((u16)33)
56 #define HOST_IF_MSG_DEL_BA_SESSION ((u16)34)
57 #define HOST_IF_MSG_Q_IDLE ((u16)35)
58 #define HOST_IF_MSG_DEL_ALL_STA ((u16)36)
59 #define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS ((u16)34)
61 #define HOST_IF_MSG_EXIT ((u16)100)
63 #define HOST_IF_SCAN_TIMEOUT 4000
64 #define HOST_IF_CONNECT_TIMEOUT 9500
66 #define BA_SESSION_DEFAULT_BUFFER_SIZE 16
67 #define BA_SESSION_DEFAULT_TIMEOUT 1000
68 #define BLOCK_ACK_REQ_SIZE 0x14
69 /*****************************************************************************/
70 /* Type Definitions */
71 /*****************************************************************************/
74 * @struct tstrHostIFCfgParamAttr
75 * @brief Structure to hold Host IF CFG Params Attributes
79 * @author Mai Daftedar
83 typedef struct _tstrHostIFCfgParamAttr
{
84 tstrCfgParamVal pstrCfgParamVal
;
86 } tstrHostIFCfgParamAttr
;
89 * @struct tstrHostIFwpaAttr
90 * @brief Structure to hold Host IF Scan Attributes
94 * @author Mai Daftedar
98 typedef struct _tstrHostIFwpaAttr
{
100 const u8
*pu8macaddr
;
110 * @struct tstrHostIFwepAttr
111 * @brief Structure to hold Host IF Scan Attributes
115 * @author Mai Daftedar
116 * @date 25 March 2012
119 typedef struct _tstrHostIFwepAttr
{
124 AUTHTYPE_T tenuAuth_type
;
129 * @struct tuniHostIFkeyAttr
130 * @brief Structure to hold Host IF Scan Attributes
134 * @author Mai Daftedar
135 * @date 25 March 2012
138 typedef union _tuniHostIFkeyAttr
{
139 tstrHostIFwepAttr strHostIFwepAttr
;
140 tstrHostIFwpaAttr strHostIFwpaAttr
;
141 tstrHostIFpmkidAttr strHostIFpmkidAttr
;
145 * @struct tstrHostIFkeyAttr
146 * @brief Structure to hold Host IF Scan Attributes
150 * @author Mai Daftedar
151 * @date 25 March 2012
154 typedef struct _tstrHostIFkeyAttr
{
155 tenuKeyType enuKeyType
;
157 tuniHostIFkeyAttr uniHostIFkeyAttr
;
164 * @struct tstrHostIFscanAttr
165 * @brief Structure to hold Host IF Scan Attributes
169 * @author Mostafa Abu Bakr
170 * @date 25 March 2012
173 typedef struct _tstrHostIFscanAttr
{
180 tWILCpfScanResult pfScanResult
;
183 tstrHiddenNetwork strHiddenNetwork
;
185 } tstrHostIFscanAttr
;
188 * @struct tstrHostIFconnectAttr
189 * @brief Structure to hold Host IF Connect Attributes
193 * @author Mostafa Abu Bakr
194 * @date 25 March 2012
197 typedef struct _tstrHostIFconnectAttr
{
204 tWILCpfConnectResult pfConnectResult
;
206 AUTHTYPE_T tenuAuth_type
;
209 } tstrHostIFconnectAttr
;
212 * @struct tstrRcvdGnrlAsyncInfo
213 * @brief Structure to hold Received General Asynchronous info
217 * @author Mostafa Abu Bakr
218 * @date 25 March 2012
221 typedef struct _tstrRcvdGnrlAsyncInfo
{
223 WILC_Uint32 u32Length
;
224 } tstrRcvdGnrlAsyncInfo
;
227 * @struct tstrHostIFSetChan
228 * @brief Set Channel message body
232 * @author Mai Daftedar
233 * @date 25 March 2012
236 typedef struct _tstrHostIFSetChan
{
241 * @struct tstrHostIFSetChan
242 * @brief Get Channel message body
246 * @author Mai Daftedar
250 typedef struct _tstrHostIFGetChan
{
254 /*bug3819: Add Scan acomplete notification to host*/
256 * @struct tstrScanComplete
257 * @brief hold received Async. Scan Complete message body
262 * @date 25 March 2012
265 /*typedef struct _tstrScanComplete
268 * WILC_Uint32 u32Length;
269 * } tstrScanComplete;*/
272 * @struct tstrHostIFSetBeacon
273 * @brief Set Beacon message body
277 * @author Adham Abozaeid
281 typedef struct _tstrHostIFSetBeacon
{
282 WILC_Uint32 u32Interval
; /*!< Beacon Interval. Period between two successive beacons on air */
283 WILC_Uint32 u32DTIMPeriod
; /*!< DTIM Period. Indicates how many Beacon frames
284 * (including the current frame) appear before the next DTIM */
285 WILC_Uint32 u32HeadLen
; /*!< Length of the head buffer in bytes */
286 u8
*pu8Head
; /*!< Pointer to the beacon's head buffer. Beacon's head is the part
287 * from the beacon's start till the TIM element, NOT including the TIM */
288 WILC_Uint32 u32TailLen
; /*!< Length of the tail buffer in bytes */
289 u8
*pu8Tail
; /*!< Pointer to the beacon's tail buffer. Beacon's tail starts just
290 * after the TIM inormation element */
291 } tstrHostIFSetBeacon
;
296 * @struct tstrHostIFDelBeacon
297 * @brief Del Beacon message body
301 * @author Adham Abozaeid
305 typedef struct _tstrHostIFDelBeacon
{
307 } tstrHostIFDelBeacon
;
310 * @struct tstrHostIFSetMulti
311 * @brief set Multicast filter Address
315 * @author Abdelrahman Sobhy
316 * @date 30 August 2013
317 * @version 1.0 Description
321 WILC_Bool bIsEnabled
;
322 WILC_Uint32 u32count
;
323 } tstrHostIFSetMulti
;
326 * @struct tstrHostIFDelAllSta
327 * @brief Deauth station message body
331 * @author Mai Daftedar
332 * @date 09 April 2014
333 * @version 1.0 Description
337 u8 au8Sta_DelAllSta
[MAX_NUM_STA
][ETH_ALEN
];
339 } tstrHostIFDelAllSta
;
342 * @struct tstrHostIFDelSta
343 * @brief Delete station message body
347 * @author Adham Abozaeid
349 * @version 1.0 Description
353 u8 au8MacAddr
[ETH_ALEN
];
357 * @struct tstrTimerCb
358 * @brief Timer callback message body
362 * @author Mostafa Abu Bakr
363 * @date 25 March 2012
366 typedef struct _tstrTimerCb
{
367 void *pvUsrArg
; /*!< Private data passed at timer start */
371 * @struct tstrHostIfPowerMgmtParam
372 * @brief Power management message body
376 * @author Adham Abozaeid
377 * @date 24 November 2012
382 WILC_Bool bIsEnabled
;
383 WILC_Uint32 u32Timeout
;
384 } tstrHostIfPowerMgmtParam
;
387 * @struct tstrHostIFSetIPAddr
388 * @brief set IP Address message body
392 * @author Abdelrahman Sobhy
393 * @date 30 August 2013
394 * @version 1.0 Description
400 } tstrHostIFSetIPAddr
;
403 * @struct tstrHostIfStaInactiveT
404 * @brief Get station message body
408 * @author Mai Daftedar
409 * @date 16 April 2013
415 } tstrHostIfStaInactiveT
;
418 * @union tuniHostIFmsgBody
419 * @brief Message body for the Host Interface message_q
423 * @author Mostafa Abu Bakr
424 * @date 25 March 2012
427 typedef union _tuniHostIFmsgBody
{
428 tstrHostIFscanAttr strHostIFscanAttr
; /*!< Host IF Scan Request Attributes message body */
429 tstrHostIFconnectAttr strHostIFconnectAttr
; /*!< Host IF Connect Request Attributes message body */
430 tstrRcvdNetworkInfo strRcvdNetworkInfo
; /*!< Received Asynchronous Network Info message body */
431 tstrRcvdGnrlAsyncInfo strRcvdGnrlAsyncInfo
; /*!< Received General Asynchronous Info message body */
432 tstrHostIFkeyAttr strHostIFkeyAttr
; /*!<>*/
433 tstrHostIFCfgParamAttr strHostIFCfgParamAttr
; /*! <CFG Parameter message Body> */
434 tstrHostIFSetChan strHostIFSetChan
;
435 tstrHostIFGetChan strHostIFGetChan
;
436 tstrHostIFSetBeacon strHostIFSetBeacon
; /*!< Set beacon message body */
437 tstrHostIFDelBeacon strHostIFDelBeacon
; /*!< Del beacon message body */
438 tstrWILC_AddStaParam strAddStaParam
; /*!< Add station message body */
439 tstrHostIFDelSta strDelStaParam
; /*!< Del Station message body */
440 tstrWILC_AddStaParam strEditStaParam
; /*!< Edit station message body */
441 /* tstrScanComplete strScanComplete; / *Received Async. Scan Complete message body* / */
442 tstrTimerCb strTimerCb
; /*!< Timer callback message body */
443 tstrHostIfPowerMgmtParam strPowerMgmtparam
; /*!< Power Management message body */
444 tstrHostIfStaInactiveT strHostIfStaInactiveT
;
445 tstrHostIFSetIPAddr strHostIfSetIP
;
446 tstrHostIfSetDrvHandler strHostIfSetDrvHandler
;
447 tstrHostIFSetMulti strHostIfSetMulti
;
448 tstrHostIfSetOperationMode strHostIfSetOperationMode
;
449 tstrHostIfSetMacAddress strHostIfSetMacAddress
;
450 tstrHostIfGetMacAddress strHostIfGetMacAddress
;
451 tstrHostIfBASessionInfo strHostIfBASessionInfo
;
453 tstrHostIfRemainOnChan strHostIfRemainOnChan
;
454 tstrHostIfRegisterFrame strHostIfRegisterFrame
;
456 WILC_Char
*pUserData
;
457 tstrHostIFDelAllSta strHostIFDelAllSta
;
461 * @struct tstrHostIFmsg
462 * @brief Host Interface message
466 * @author Mostafa Abu Bakr
467 * @date 25 March 2012
470 typedef struct _tstrHostIFmsg
{
471 u16 u16MsgId
; /*!< Message ID */
472 tuniHostIFmsgBody uniHostIFmsgBody
; /*!< Message body */
476 #ifdef CONNECT_DIRECT
477 typedef struct _tstrWidJoinReqExt
{
478 WILC_Char SSID
[MAX_SSID_LEN
];
484 /*Bug4218: Parsing Join Param*/
485 #ifdef WILC_PARSE_SCAN_IN_HOST
486 /*Struct containg joinParam of each AP*/
487 typedef struct _tstrJoinBssParam
{
493 WILC_Char ssid
[MAX_SSID_LEN
];
495 u8 supp_rates
[MAX_RATES_SUPPORTED
+ 1];
502 u8 rsn_pcip_policy
[3];
503 u8 rsn_auth_policy
[3];
505 struct _tstrJoinParam
*nextJoinBss
;
518 /*Bug4218: Parsing Join Param*/
519 /*a linked list table containing needed join parameters entries for each AP found in most recent scan*/
520 typedef struct _tstrBssTable
{
522 tstrJoinBssParam
*head
;
523 tstrJoinBssParam
*tail
;
525 #endif /*WILC_PARSE_SCAN_IN_HOST*/
530 SCAN_CONNECT_TIMER_FORCE_32BIT
= 0xFFFFFFFF
533 /*****************************************************************************/
535 /* Global Variabls */
537 /*****************************************************************************/
540 tstrWILC_WFIDrv
*terminated_handle
= NULL
;
541 tstrWILC_WFIDrv
*gWFiDrvHandle
= NULL
;
542 #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
543 WILC_Bool g_obtainingIP
= WILC_FALSE
;
546 static struct task_struct
*HostIFthreadHandler
;
547 static WILC_MsgQueueHandle gMsgQHostIF
;
548 static struct semaphore hSemHostIFthrdEnd
;
550 struct semaphore hSemDeinitDrvHandle
;
551 static struct semaphore hWaitResponse
;
552 struct semaphore hSemHostIntDeinit
;
553 WILC_TimerHandle g_hPeriodicRSSI
;
557 u8 gau8MulticastMacAddrList
[WILC_MULTICAST_TABLE_SIZE
][ETH_ALEN
];
559 #ifndef CONNECT_DIRECT
560 static u8 gapu8RcvdSurveyResults
[2][MAX_SURVEY_RESULT_FRAG_SIZE
];
563 static u8 gapu8RcvdAssocResp
[MAX_ASSOC_RESP_FRAME_SIZE
];
565 WILC_Bool gbScanWhileConnected
= WILC_FALSE
;
567 static WILC_Sint8 gs8Rssi
;
568 static WILC_Sint8 gs8lnkspd
;
570 static u8 gs8SetIP
[2][4];
571 static u8 gs8GetIP
[2][4];
572 #ifdef WILC_AP_EXTERNAL_MLME
573 static WILC_Uint32 gu32InactiveTime
;
577 static WILC_Uint32 gu32WidConnRstHack
;
581 u8
*gu8FlushedJoinReq
;
582 u8
*gu8FlushedInfoElemAsoc
;
583 u8 gu8Flushed11iMode
;
584 u8 gu8FlushedAuthType
;
585 WILC_Uint32 gu32FlushedJoinReqSize
;
586 WILC_Uint32 gu32FlushedInfoElemAsocSize
;
587 WILC_Uint32 gu8FlushedJoinReqDrvHandler
;
588 #define REAL_JOIN_REQ 0
589 #define FLUSHED_JOIN_REQ 1
590 #define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */
592 /*Bug4218: Parsing Join Param*/
593 #ifdef WILC_PARSE_SCAN_IN_HOST
594 /*Bug4218: Parsing Join Param*/
595 static void *host_int_ParseJoinBssParam(tstrNetworkInfo
*ptstrNetworkInfo
);
596 #endif /*WILC_PARSE_SCAN_IN_HOST*/
598 extern void chip_sleep_manually(WILC_Uint32 u32SleepTime
);
599 extern int linux_wlan_get_num_conn_ifcs(void);
602 * @brief Handle_SetChannel
603 * @details Sending config packet to firmware to set channel
604 * @param[in] tstrHostIFSetChan* pstrHostIFSetChan
605 * @return Error code.
610 static WILC_Sint32
Handle_SetChannel(void *drvHandler
, tstrHostIFSetChan
*pstrHostIFSetChan
)
613 WILC_Sint32 s32Error
= WILC_SUCCESS
;
615 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
617 /*prepare configuration packet*/
618 strWID
.u16WIDid
= (u16
)WID_CURRENT_CHANNEL
;
619 strWID
.enuWIDtype
= WID_CHAR
;
620 strWID
.ps8WidVal
= (WILC_Char
*)&(pstrHostIFSetChan
->u8SetChan
);
621 strWID
.s32ValueSize
= sizeof(WILC_Char
);
623 PRINT_D(HOSTINF_DBG
, "Setting channel\n");
625 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
627 PRINT_ER("Failed to set channel\n");
628 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
638 * @brief Handle_SetWfiDrvHandler
639 * @details Sending config packet to firmware to set driver handler
640 * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler
641 * @return Error code.
646 static WILC_Sint32
Handle_SetWfiDrvHandler(tstrHostIfSetDrvHandler
*pstrHostIfSetDrvHandler
)
649 WILC_Sint32 s32Error
= WILC_SUCCESS
;
651 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)((pstrHostIfSetDrvHandler
->u32Address
));
654 /*prepare configuration packet*/
655 strWID
.u16WIDid
= (u16
)WID_SET_DRV_HANDLER
;
656 strWID
.enuWIDtype
= WID_INT
;
657 strWID
.ps8WidVal
= (WILC_Sint8
*)&(pstrHostIfSetDrvHandler
->u32Address
);
658 strWID
.s32ValueSize
= sizeof(WILC_Uint32
);
662 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
665 if ((pstrHostIfSetDrvHandler
->u32Address
) == (WILC_Uint32
)NULL
) {
666 up(&hSemDeinitDrvHandle
);
671 PRINT_ER("Failed to set driver handler\n");
672 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
683 * @brief Handle_SetWfiAPDrvHandler
684 * @details Sending config packet to firmware to set driver handler
685 * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler
686 * @return Error code.
691 static WILC_Sint32
Handle_SetOperationMode(void *drvHandler
, tstrHostIfSetOperationMode
*pstrHostIfSetOperationMode
)
694 WILC_Sint32 s32Error
= WILC_SUCCESS
;
696 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
699 /*prepare configuration packet*/
700 strWID
.u16WIDid
= (u16
)WID_SET_OPERATION_MODE
;
701 strWID
.enuWIDtype
= WID_INT
;
702 strWID
.ps8WidVal
= (WILC_Sint8
*)&(pstrHostIfSetOperationMode
->u32Mode
);
703 strWID
.s32ValueSize
= sizeof(WILC_Uint32
);
706 PRINT_INFO(HOSTINF_DBG
, "(size_t)pstrWFIDrv= %p \n", pstrWFIDrv
);
708 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
711 if ((pstrHostIfSetOperationMode
->u32Mode
) == (WILC_Uint32
)NULL
) {
712 up(&hSemDeinitDrvHandle
);
717 PRINT_ER("Failed to set driver handler\n");
718 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
729 * @brief host_int_set_IPAddress
730 * @details Setting IP address params in message queue
731 * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr
732 * @return Error code.
737 WILC_Sint32
Handle_set_IPAddress(void *drvHandler
, u8
*pu8IPAddr
, u8 idx
)
740 WILC_Sint32 s32Error
= WILC_SUCCESS
;
742 char firmwareIPAddress
[4] = {0};
743 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
745 if (pu8IPAddr
[0] < 192)
748 PRINT_INFO(HOSTINF_DBG
, "Indx = %d, Handling set IP = %d.%d.%d.%d \n", idx
, pu8IPAddr
[0], pu8IPAddr
[1], pu8IPAddr
[2], pu8IPAddr
[3]);
750 WILC_memcpy(gs8SetIP
[idx
], pu8IPAddr
, IP_ALEN
);
752 /*prepare configuration packet*/
753 strWID
.u16WIDid
= (u16
)WID_IP_ADDRESS
;
754 strWID
.enuWIDtype
= WID_STR
;
755 strWID
.ps8WidVal
= (u8
*)pu8IPAddr
;
756 strWID
.s32ValueSize
= IP_ALEN
;
758 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
762 host_int_get_ipaddress((WILC_WFIDrvHandle
)drvHandler
, firmwareIPAddress
, idx
);
765 PRINT_D(HOSTINF_DBG
, "Failed to set IP address\n");
766 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
768 PRINT_INFO(HOSTINF_DBG
, "IP address set\n");
781 * @brief Handle_get_IPAddress
782 * @details Setting IP address params in message queue
783 * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr
784 * @return Error code.
789 WILC_Sint32
Handle_get_IPAddress(void *drvHandler
, u8
*pu8IPAddr
, u8 idx
)
792 WILC_Sint32 s32Error
= WILC_SUCCESS
;
794 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
796 /*prepare configuration packet*/
797 strWID
.u16WIDid
= (u16
)WID_IP_ADDRESS
;
798 strWID
.enuWIDtype
= WID_STR
;
799 strWID
.ps8WidVal
= (u8
*)WILC_MALLOC(IP_ALEN
);
800 strWID
.s32ValueSize
= IP_ALEN
;
802 s32Error
= SendConfigPkt(GET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
804 PRINT_INFO(HOSTINF_DBG
, "%d.%d.%d.%d\n", (u8
)(strWID
.ps8WidVal
[0]), (u8
)(strWID
.ps8WidVal
[1]), (u8
)(strWID
.ps8WidVal
[2]), (u8
)(strWID
.ps8WidVal
[3]));
806 WILC_memcpy(gs8GetIP
[idx
], strWID
.ps8WidVal
, IP_ALEN
);
808 /*get the value by searching the local copy*/
809 WILC_FREE(strWID
.ps8WidVal
);
811 if (WILC_memcmp(gs8GetIP
[idx
], gs8SetIP
[idx
], IP_ALEN
) != 0)
812 host_int_setup_ipaddress((WILC_WFIDrvHandle
)pstrWFIDrv
, gs8SetIP
[idx
], idx
);
814 if (s32Error
!= WILC_SUCCESS
) {
815 PRINT_ER("Failed to get IP address\n");
816 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
818 PRINT_INFO(HOSTINF_DBG
, "IP address retrieved:: u8IfIdx = %d \n", idx
);
819 PRINT_INFO(HOSTINF_DBG
, "%d.%d.%d.%d\n", gs8GetIP
[idx
][0], gs8GetIP
[idx
][1], gs8GetIP
[idx
][2], gs8GetIP
[idx
][3]);
820 PRINT_INFO(HOSTINF_DBG
, "\n");
834 * @brief Handle_SetMacAddress
835 * @details Setting mac address
836 * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler
837 * @return Error code.
838 * @author Amr Abdel-Moghny
839 * @date November 2013
842 static WILC_Sint32
Handle_SetMacAddress(void *drvHandler
, tstrHostIfSetMacAddress
*pstrHostIfSetMacAddress
)
845 WILC_Sint32 s32Error
= WILC_SUCCESS
;
847 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
848 u8
*mac_buf
= (u8
*)WILC_MALLOC(ETH_ALEN
);
849 if (mac_buf
== NULL
) {
850 PRINT_ER("No buffer to send mac address\n");
853 WILC_memcpy(mac_buf
, pstrHostIfSetMacAddress
->u8MacAddress
, ETH_ALEN
);
855 /*prepare configuration packet*/
856 strWID
.u16WIDid
= (u16
)WID_MAC_ADDR
;
857 strWID
.enuWIDtype
= WID_STR
;
858 strWID
.ps8WidVal
= mac_buf
;
859 strWID
.s32ValueSize
= ETH_ALEN
;
860 PRINT_D(GENERIC_DBG
, "mac addr = :%x:%x:%x:%x:%x:%x\n", strWID
.ps8WidVal
[0], strWID
.ps8WidVal
[1], strWID
.ps8WidVal
[2], strWID
.ps8WidVal
[3], strWID
.ps8WidVal
[4], strWID
.ps8WidVal
[5]);
862 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
864 PRINT_ER("Failed to set mac address\n");
865 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
879 * @brief Handle_GetMacAddress
880 * @details Getting mac address
881 * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler
882 * @return Error code.
883 * @author Amr Abdel-Moghny
887 static WILC_Sint32
Handle_GetMacAddress(void *drvHandler
, tstrHostIfGetMacAddress
*pstrHostIfGetMacAddress
)
890 WILC_Sint32 s32Error
= WILC_SUCCESS
;
893 /*prepare configuration packet*/
894 strWID
.u16WIDid
= (u16
)WID_MAC_ADDR
;
895 strWID
.enuWIDtype
= WID_STR
;
896 strWID
.ps8WidVal
= pstrHostIfGetMacAddress
->u8MacAddress
;
897 strWID
.s32ValueSize
= ETH_ALEN
;
900 s32Error
= SendConfigPkt(GET_CFG
, &strWID
, 1, WILC_FALSE
, (WILC_Uint32
)drvHandler
);
902 PRINT_ER("Failed to get mac address\n");
903 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
916 * @brief Handle_CfgParam
917 * @details Sending config packet to firmware to set CFG params
918 * @param[in] tstrHostIFCfgParamAttr* strHostIFCfgParamAttr
919 * @return Error code.
924 static WILC_Sint32
Handle_CfgParam(void *drvHandler
, tstrHostIFCfgParamAttr
*strHostIFCfgParamAttr
)
926 WILC_Sint32 s32Error
= WILC_SUCCESS
;
927 tstrWID strWIDList
[32];
929 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
932 down(&(pstrWFIDrv
->gtOsCfgValuesSem
));
935 PRINT_D(HOSTINF_DBG
, "Setting CFG params\n");
937 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& BSS_TYPE
) {
938 /*----------------------------------------------------------*/
939 /*Input Value: INFRASTRUCTURE = 1, */
940 /* INDEPENDENT= 2, */
942 /*----------------------------------------------------------*/
943 /* validate input then copy>> need to check value 4 and 5 */
944 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.bss_type
< 6) {
945 strWIDList
[u8WidCnt
].u16WIDid
= WID_BSS_TYPE
;
946 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.bss_type
;
947 strWIDList
[u8WidCnt
].enuWIDtype
= WID_CHAR
;
948 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(WILC_Char
);
949 pstrWFIDrv
->strCfgValues
.bss_type
= (u8
)strHostIFCfgParamAttr
->pstrCfgParamVal
.bss_type
;
951 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
955 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& AUTH_TYPE
) {
956 /*------------------------------------------------------*/
957 /*Input Values: OPEN_SYSTEM = 0, */
958 /* SHARED_KEY = 1, */
960 /*------------------------------------------------------*/
961 /*validate Possible values*/
962 if ((strHostIFCfgParamAttr
->pstrCfgParamVal
.auth_type
) == 1 || (strHostIFCfgParamAttr
->pstrCfgParamVal
.auth_type
) == 2 || (strHostIFCfgParamAttr
->pstrCfgParamVal
.auth_type
) == 5) {
963 strWIDList
[u8WidCnt
].u16WIDid
= WID_AUTH_TYPE
;
964 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.auth_type
;
965 strWIDList
[u8WidCnt
].enuWIDtype
= WID_CHAR
;
966 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(WILC_Char
);
967 pstrWFIDrv
->strCfgValues
.auth_type
= (u8
)strHostIFCfgParamAttr
->pstrCfgParamVal
.auth_type
;
969 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
973 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& AUTHEN_TIMEOUT
) {
974 /* range is 1 to 65535. */
975 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.auth_timeout
> 0 && strHostIFCfgParamAttr
->pstrCfgParamVal
.auth_timeout
< 65536) {
976 strWIDList
[u8WidCnt
].u16WIDid
= WID_AUTH_TIMEOUT
;
977 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.auth_timeout
;
978 strWIDList
[u8WidCnt
].enuWIDtype
= WID_SHORT
;
979 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(u16
);
980 pstrWFIDrv
->strCfgValues
.auth_timeout
= strHostIFCfgParamAttr
->pstrCfgParamVal
.auth_timeout
;
982 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
986 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& POWER_MANAGEMENT
) {
987 /*-----------------------------------------------------------*/
988 /*Input Values: NO_POWERSAVE = 0, */
989 /* MIN_FAST_PS = 1, */
990 /* MAX_FAST_PS = 2, */
991 /* MIN_PSPOLL_PS = 3, */
992 /* MAX_PSPOLL_PS = 4 */
993 /*----------------------------------------------------------*/
994 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.power_mgmt_mode
< 5) {
995 strWIDList
[u8WidCnt
].u16WIDid
= WID_POWER_MANAGEMENT
;
996 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.power_mgmt_mode
;
997 strWIDList
[u8WidCnt
].enuWIDtype
= WID_CHAR
;
998 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(WILC_Char
);
999 pstrWFIDrv
->strCfgValues
.power_mgmt_mode
= (u8
)strHostIFCfgParamAttr
->pstrCfgParamVal
.power_mgmt_mode
;
1001 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1005 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& RETRY_SHORT
) {
1006 /* range from 1 to 256 */
1007 if ((strHostIFCfgParamAttr
->pstrCfgParamVal
.short_retry_limit
> 0) && (strHostIFCfgParamAttr
->pstrCfgParamVal
.short_retry_limit
< 256)) {
1008 strWIDList
[u8WidCnt
].u16WIDid
= WID_SHORT_RETRY_LIMIT
;
1009 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.short_retry_limit
;
1010 strWIDList
[u8WidCnt
].enuWIDtype
= WID_SHORT
;
1011 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(u16
);
1012 pstrWFIDrv
->strCfgValues
.short_retry_limit
= strHostIFCfgParamAttr
->pstrCfgParamVal
.short_retry_limit
;
1014 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1018 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& RETRY_LONG
) {
1019 /* range from 1 to 256 */
1020 if ((strHostIFCfgParamAttr
->pstrCfgParamVal
.long_retry_limit
> 0) && (strHostIFCfgParamAttr
->pstrCfgParamVal
.long_retry_limit
< 256)) {
1021 strWIDList
[u8WidCnt
].u16WIDid
= WID_LONG_RETRY_LIMIT
;
1022 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.long_retry_limit
;
1024 strWIDList
[u8WidCnt
].enuWIDtype
= WID_SHORT
;
1025 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(u16
);
1026 pstrWFIDrv
->strCfgValues
.long_retry_limit
= strHostIFCfgParamAttr
->pstrCfgParamVal
.long_retry_limit
;
1028 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1032 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& FRAG_THRESHOLD
) {
1034 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.frag_threshold
> 255 && strHostIFCfgParamAttr
->pstrCfgParamVal
.frag_threshold
< 7937) {
1035 strWIDList
[u8WidCnt
].u16WIDid
= WID_FRAG_THRESHOLD
;
1036 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.frag_threshold
;
1037 strWIDList
[u8WidCnt
].enuWIDtype
= WID_SHORT
;
1038 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(u16
);
1039 pstrWFIDrv
->strCfgValues
.frag_threshold
= strHostIFCfgParamAttr
->pstrCfgParamVal
.frag_threshold
;
1041 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1045 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& RTS_THRESHOLD
) {
1046 /* range 256 to 65535 */
1047 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.rts_threshold
> 255 && strHostIFCfgParamAttr
->pstrCfgParamVal
.rts_threshold
< 65536) {
1048 strWIDList
[u8WidCnt
].u16WIDid
= WID_RTS_THRESHOLD
;
1049 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.rts_threshold
;
1050 strWIDList
[u8WidCnt
].enuWIDtype
= WID_SHORT
;
1051 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(u16
);
1052 pstrWFIDrv
->strCfgValues
.rts_threshold
= strHostIFCfgParamAttr
->pstrCfgParamVal
.rts_threshold
;
1054 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1058 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& PREAMBLE
) {
1059 /*-----------------------------------------------------*/
1060 /*Input Values: Short= 0, */
1063 /*------------------------------------------------------*/
1064 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.preamble_type
< 3) {
1065 strWIDList
[u8WidCnt
].u16WIDid
= WID_PREAMBLE
;
1066 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.preamble_type
;
1067 strWIDList
[u8WidCnt
].enuWIDtype
= WID_CHAR
;
1068 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(WILC_Char
);
1069 pstrWFIDrv
->strCfgValues
.preamble_type
= strHostIFCfgParamAttr
->pstrCfgParamVal
.preamble_type
;
1071 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1075 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& SHORT_SLOT_ALLOWED
) {
1076 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.short_slot_allowed
< 2) {
1077 strWIDList
[u8WidCnt
].u16WIDid
= WID_SHORT_SLOT_ALLOWED
;
1078 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.short_slot_allowed
;
1079 strWIDList
[u8WidCnt
].enuWIDtype
= WID_CHAR
;
1080 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(WILC_Char
);
1081 pstrWFIDrv
->strCfgValues
.short_slot_allowed
= (u8
)strHostIFCfgParamAttr
->pstrCfgParamVal
.short_slot_allowed
;
1083 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1087 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& TXOP_PROT_DISABLE
) {
1088 /*Description: used to Disable RTS-CTS protection for TXOP burst*/
1089 /*transmission when the acknowledgement policy is No-Ack or Block-Ack */
1090 /* this information is useful for external supplicant */
1091 /*Input Values: 1 for enable and 0 for disable. */
1092 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.txop_prot_disabled
< 2) {
1093 strWIDList
[u8WidCnt
].u16WIDid
= WID_11N_TXOP_PROT_DISABLE
;
1094 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.txop_prot_disabled
;
1095 strWIDList
[u8WidCnt
].enuWIDtype
= WID_CHAR
;
1096 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(WILC_Char
);
1097 pstrWFIDrv
->strCfgValues
.txop_prot_disabled
= (u8
)strHostIFCfgParamAttr
->pstrCfgParamVal
.txop_prot_disabled
;
1099 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1103 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& BEACON_INTERVAL
) {
1104 /* range is 1 to 65535. */
1105 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.beacon_interval
> 0 && strHostIFCfgParamAttr
->pstrCfgParamVal
.beacon_interval
< 65536) {
1106 strWIDList
[u8WidCnt
].u16WIDid
= WID_BEACON_INTERVAL
;
1107 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.beacon_interval
;
1108 strWIDList
[u8WidCnt
].enuWIDtype
= WID_SHORT
;
1109 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(u16
);
1110 pstrWFIDrv
->strCfgValues
.beacon_interval
= strHostIFCfgParamAttr
->pstrCfgParamVal
.beacon_interval
;
1112 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1116 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& DTIM_PERIOD
) {
1117 /* range is 1 to 255. */
1118 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.dtim_period
> 0 && strHostIFCfgParamAttr
->pstrCfgParamVal
.dtim_period
< 256) {
1119 strWIDList
[u8WidCnt
].u16WIDid
= WID_DTIM_PERIOD
;
1120 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.dtim_period
;
1121 strWIDList
[u8WidCnt
].enuWIDtype
= WID_CHAR
;
1122 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(WILC_Char
);
1123 pstrWFIDrv
->strCfgValues
.dtim_period
= strHostIFCfgParamAttr
->pstrCfgParamVal
.dtim_period
;
1125 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1129 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& SITE_SURVEY
) {
1130 /*----------------------------------------------------------------------*/
1131 /*Input Values: SITE_SURVEY_1CH = 0, i.e.: currently set channel */
1132 /* SITE_SURVEY_ALL_CH = 1, */
1133 /* SITE_SURVEY_OFF = 2 */
1134 /*----------------------------------------------------------------------*/
1135 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.site_survey_enabled
< 3) {
1136 strWIDList
[u8WidCnt
].u16WIDid
= WID_SITE_SURVEY
;
1137 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.site_survey_enabled
;
1138 strWIDList
[u8WidCnt
].enuWIDtype
= WID_CHAR
;
1139 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(WILC_Char
);
1140 pstrWFIDrv
->strCfgValues
.site_survey_enabled
= (u8
)strHostIFCfgParamAttr
->pstrCfgParamVal
.site_survey_enabled
;
1142 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1146 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& SITE_SURVEY_SCAN_TIME
) {
1147 /* range is 1 to 65535. */
1148 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.site_survey_scan_time
> 0 && strHostIFCfgParamAttr
->pstrCfgParamVal
.site_survey_scan_time
< 65536) {
1149 strWIDList
[u8WidCnt
].u16WIDid
= WID_SITE_SURVEY_SCAN_TIME
;
1150 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.site_survey_scan_time
;
1151 strWIDList
[u8WidCnt
].enuWIDtype
= WID_SHORT
;
1152 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(u16
);
1153 pstrWFIDrv
->strCfgValues
.site_survey_scan_time
= strHostIFCfgParamAttr
->pstrCfgParamVal
.site_survey_scan_time
;
1155 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1159 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& ACTIVE_SCANTIME
) {
1160 /* range is 1 to 65535. */
1161 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.active_scan_time
> 0 && strHostIFCfgParamAttr
->pstrCfgParamVal
.active_scan_time
< 65536) {
1162 strWIDList
[u8WidCnt
].u16WIDid
= WID_ACTIVE_SCAN_TIME
;
1163 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.active_scan_time
;
1164 strWIDList
[u8WidCnt
].enuWIDtype
= WID_SHORT
;
1165 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(u16
);
1166 pstrWFIDrv
->strCfgValues
.active_scan_time
= strHostIFCfgParamAttr
->pstrCfgParamVal
.active_scan_time
;
1168 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1172 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& PASSIVE_SCANTIME
) {
1173 /* range is 1 to 65535. */
1174 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.passive_scan_time
> 0 && strHostIFCfgParamAttr
->pstrCfgParamVal
.passive_scan_time
< 65536) {
1175 strWIDList
[u8WidCnt
].u16WIDid
= WID_PASSIVE_SCAN_TIME
;
1176 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&strHostIFCfgParamAttr
->pstrCfgParamVal
.passive_scan_time
;
1177 strWIDList
[u8WidCnt
].enuWIDtype
= WID_SHORT
;
1178 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(u16
);
1179 pstrWFIDrv
->strCfgValues
.passive_scan_time
= strHostIFCfgParamAttr
->pstrCfgParamVal
.passive_scan_time
;
1181 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1185 if (strHostIFCfgParamAttr
->pstrCfgParamVal
.u32SetCfgFlag
& CURRENT_TX_RATE
) {
1186 CURRENT_TX_RATE_T curr_tx_rate
= strHostIFCfgParamAttr
->pstrCfgParamVal
.curr_tx_rate
;
1187 /*----------------------------------------------------------------------*/
1188 /*Rates: 1 2 5.5 11 6 9 12 18 24 36 48 54 Auto */
1189 /*InputValues: 1 2 3 4 5 6 7 8 9 10 11 12 0 */
1190 /*----------------------------------------------------------------------*/
1192 if (curr_tx_rate
== AUTORATE
|| curr_tx_rate
== MBPS_1
1193 || curr_tx_rate
== MBPS_2
|| curr_tx_rate
== MBPS_5_5
1194 || curr_tx_rate
== MBPS_11
|| curr_tx_rate
== MBPS_6
1195 || curr_tx_rate
== MBPS_9
|| curr_tx_rate
== MBPS_12
1196 || curr_tx_rate
== MBPS_18
|| curr_tx_rate
== MBPS_24
1197 || curr_tx_rate
== MBPS_36
|| curr_tx_rate
== MBPS_48
|| curr_tx_rate
== MBPS_54
) {
1198 strWIDList
[u8WidCnt
].u16WIDid
= WID_CURRENT_TX_RATE
;
1199 strWIDList
[u8WidCnt
].ps8WidVal
= (WILC_Sint8
*)&curr_tx_rate
;
1200 strWIDList
[u8WidCnt
].enuWIDtype
= WID_SHORT
;
1201 strWIDList
[u8WidCnt
].s32ValueSize
= sizeof(u16
);
1202 pstrWFIDrv
->strCfgValues
.curr_tx_rate
= (u8
)curr_tx_rate
;
1204 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
1208 s32Error
= SendConfigPkt(SET_CFG
, strWIDList
, u8WidCnt
, WILC_FALSE
, (WILC_Uint32
)pstrWFIDrv
);
1211 PRINT_ER("Error in setting CFG params\n");
1214 WILC_CATCH(s32Error
)
1217 up(&(pstrWFIDrv
->gtOsCfgValuesSem
));
1223 * @brief Handle_wait_msg_q_empty
1224 * @details this should be the last msg and then the msg Q becomes idle
1225 * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr
1226 * @return Error code.
1231 static WILC_Sint32
Handle_wait_msg_q_empty(void)
1233 WILC_Sint32 s32Error
= WILC_SUCCESS
;
1234 g_wilc_initialized
= 0;
1240 * @brief Handle_Scan
1241 * @details Sending config packet to firmware to set the scan params
1242 * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr
1243 * @return Error code.
1248 static WILC_Sint32
Handle_Scan(void *drvHandler
, tstrHostIFscanAttr
*pstrHostIFscanAttr
)
1250 WILC_Sint32 s32Error
= WILC_SUCCESS
;
1251 tstrWID strWIDList
[5];
1252 WILC_Uint32 u32WidsCount
= 0;
1256 u8
*pu8HdnNtwrksWidVal
= NULL
;
1257 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*) drvHandler
;
1259 PRINT_D(HOSTINF_DBG
, "Setting SCAN params\n");
1260 PRINT_D(HOSTINF_DBG
, "Scanning: In [%d] state \n", pstrWFIDrv
->enuHostIFstate
);
1262 pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
= pstrHostIFscanAttr
->pfScanResult
;
1263 pstrWFIDrv
->strWILC_UsrScanReq
.u32UserScanPvoid
= pstrHostIFscanAttr
->pvUserArg
;
1267 if (pstrWFIDrv
->enuHostIFstate
== HOST_IF_P2P_LISTEN
|| (pstrWFIDrv
->enuHostIFstate
== HOST_IF_CONNECTED
&& pstrWFIDrv
->u8P2PConnect
)) {
1268 PRINT_INFO(GENERIC_DBG
, "Busy: State: %d\n", pstrWFIDrv
->enuHostIFstate
);
1269 PRINT_INFO(GENERIC_DBG
, "Current Jiffies: %lu Timeout:%llu\n", jiffies
, pstrWFIDrv
->u64P2p_MgmtTimeout
);
1270 WILC_ERRORREPORT(s32Error
, WILC_BUSY
);
1275 if ((pstrWFIDrv
->enuHostIFstate
>= HOST_IF_SCANNING
) && (pstrWFIDrv
->enuHostIFstate
< HOST_IF_CONNECTED
)) {
1276 /* here we either in HOST_IF_SCANNING, HOST_IF_WAITING_CONN_REQ or HOST_IF_WAITING_CONN_RESP */
1277 PRINT_D(GENERIC_DBG
, "Don't scan we are already in [%d] state\n", pstrWFIDrv
->enuHostIFstate
);
1278 WILC_ERRORREPORT(s32Error
, WILC_BUSY
);
1281 #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
1282 if (g_obtainingIP
|| connecting
) {
1283 PRINT_D(GENERIC_DBG
, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
1284 WILC_ERRORREPORT(s32Error
, WILC_BUSY
);
1288 PRINT_D(HOSTINF_DBG
, "Setting SCAN params\n");
1291 pstrWFIDrv
->strWILC_UsrScanReq
.u32RcvdChCount
= 0;
1294 strWIDList
[u32WidsCount
].u16WIDid
= (u16
)WID_SSID_PROBE_REQ
;
1295 strWIDList
[u32WidsCount
].enuWIDtype
= WID_STR
;
1297 for (i
= 0; i
< pstrHostIFscanAttr
->strHiddenNetwork
.u8ssidnum
; i
++) {
1298 valuesize
+= ((pstrHostIFscanAttr
->strHiddenNetwork
.pstrHiddenNetworkInfo
[i
].u8ssidlen
) + 1);
1300 pu8HdnNtwrksWidVal
= WILC_MALLOC(valuesize
+ 1);
1301 strWIDList
[u32WidsCount
].ps8WidVal
= pu8HdnNtwrksWidVal
;
1302 if (strWIDList
[u32WidsCount
].ps8WidVal
!= NULL
) {
1303 pu8Buffer
= strWIDList
[u32WidsCount
].ps8WidVal
;
1305 *pu8Buffer
++ = pstrHostIFscanAttr
->strHiddenNetwork
.u8ssidnum
;
1307 PRINT_D(HOSTINF_DBG
, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr
->strHiddenNetwork
.u8ssidnum
);
1309 for (i
= 0; i
< pstrHostIFscanAttr
->strHiddenNetwork
.u8ssidnum
; i
++) {
1310 *pu8Buffer
++ = pstrHostIFscanAttr
->strHiddenNetwork
.pstrHiddenNetworkInfo
[i
].u8ssidlen
;
1311 WILC_memcpy(pu8Buffer
, pstrHostIFscanAttr
->strHiddenNetwork
.pstrHiddenNetworkInfo
[i
].pu8ssid
, pstrHostIFscanAttr
->strHiddenNetwork
.pstrHiddenNetworkInfo
[i
].u8ssidlen
);
1312 pu8Buffer
+= pstrHostIFscanAttr
->strHiddenNetwork
.pstrHiddenNetworkInfo
[i
].u8ssidlen
;
1317 strWIDList
[u32WidsCount
].s32ValueSize
= (WILC_Sint32
)(valuesize
+ 1);
1321 /*filling cfg param array*/
1323 /* if((pstrHostIFscanAttr->pu8IEs != NULL) && (pstrHostIFscanAttr->IEsLen != 0)) */
1325 /* IEs to be inserted in Probe Request */
1326 strWIDList
[u32WidsCount
].u16WIDid
= WID_INFO_ELEMENT_PROBE
;
1327 strWIDList
[u32WidsCount
].enuWIDtype
= WID_BIN_DATA
;
1328 strWIDList
[u32WidsCount
].ps8WidVal
= pstrHostIFscanAttr
->pu8IEs
;
1329 strWIDList
[u32WidsCount
].s32ValueSize
= pstrHostIFscanAttr
->IEsLen
;
1334 strWIDList
[u32WidsCount
].u16WIDid
= WID_SCAN_TYPE
;
1335 strWIDList
[u32WidsCount
].enuWIDtype
= WID_CHAR
;
1336 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Char
);
1337 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(pstrHostIFscanAttr
->u8ScanType
));
1340 /*list of channels to be scanned*/
1341 strWIDList
[u32WidsCount
].u16WIDid
= WID_SCAN_CHANNEL_LIST
;
1342 strWIDList
[u32WidsCount
].enuWIDtype
= WID_BIN_DATA
;
1344 /* Bug 4648: Convert channel numbers to start from 0 not 1. */
1345 if (pstrHostIFscanAttr
->pu8ChnlFreqList
!= NULL
&& pstrHostIFscanAttr
->u8ChnlListLen
> 0) {
1348 for (i
= 0; i
< pstrHostIFscanAttr
->u8ChnlListLen
; i
++) {
1349 if (pstrHostIFscanAttr
->pu8ChnlFreqList
[i
] > 0) {
1350 pstrHostIFscanAttr
->pu8ChnlFreqList
[i
] = pstrHostIFscanAttr
->pu8ChnlFreqList
[i
] - 1;
1355 strWIDList
[u32WidsCount
].ps8WidVal
= pstrHostIFscanAttr
->pu8ChnlFreqList
;
1356 strWIDList
[u32WidsCount
].s32ValueSize
= pstrHostIFscanAttr
->u8ChnlListLen
;
1360 strWIDList
[u32WidsCount
].u16WIDid
= WID_START_SCAN_REQ
;
1361 strWIDList
[u32WidsCount
].enuWIDtype
= WID_CHAR
;
1362 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Char
);
1363 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(pstrHostIFscanAttr
->u8ScanSource
));
1366 /*keep the state as is , no need to change it*/
1367 /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */
1369 if (pstrWFIDrv
->enuHostIFstate
== HOST_IF_CONNECTED
) {
1370 gbScanWhileConnected
= WILC_TRUE
;
1371 } else if (pstrWFIDrv
->enuHostIFstate
== HOST_IF_IDLE
) {
1372 gbScanWhileConnected
= WILC_FALSE
;
1375 s32Error
= SendConfigPkt(SET_CFG
, strWIDList
, u32WidsCount
, WILC_FALSE
, (WILC_Uint32
)pstrWFIDrv
);
1378 PRINT_ER("Failed to send scan paramters config packet\n");
1379 WILC_ERRORREPORT(s32Error
, s32Error
);
1381 PRINT_D(HOSTINF_DBG
, "Successfully sent SCAN params config packet\n");
1384 WILC_CATCH(s32Error
)
1386 WILC_TimerStop(&(pstrWFIDrv
->hScanTimer
), NULL
);
1387 /*if there is an ongoing scan request*/
1388 Handle_ScanDone(drvHandler
, SCAN_EVENT_ABORTED
);
1391 /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */
1392 if (pstrHostIFscanAttr
->pu8ChnlFreqList
!= NULL
) {
1393 WILC_FREE(pstrHostIFscanAttr
->pu8ChnlFreqList
);
1394 pstrHostIFscanAttr
->pu8ChnlFreqList
= NULL
;
1397 /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */
1398 if (pstrHostIFscanAttr
->pu8IEs
!= NULL
) {
1399 WILC_FREE(pstrHostIFscanAttr
->pu8IEs
);
1400 pstrHostIFscanAttr
->pu8IEs
= NULL
;
1402 if (pstrHostIFscanAttr
->strHiddenNetwork
.pstrHiddenNetworkInfo
!= NULL
) {
1403 WILC_FREE(pstrHostIFscanAttr
->strHiddenNetwork
.pstrHiddenNetworkInfo
);
1404 pstrHostIFscanAttr
->strHiddenNetwork
.pstrHiddenNetworkInfo
= NULL
;
1407 /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */
1408 if (pstrHostIFscanAttr
->pu8ChnlFreqList
!= NULL
) {
1409 WILC_FREE(pstrHostIFscanAttr
->pu8ChnlFreqList
);
1410 pstrHostIFscanAttr
->pu8ChnlFreqList
= NULL
;
1413 if (pu8HdnNtwrksWidVal
!= NULL
) {
1414 WILC_FREE(pu8HdnNtwrksWidVal
);
1421 * @brief Handle_ScanDone
1422 * @details Call scan notification callback function
1424 * @return Error code.
1429 static WILC_Sint32
Handle_ScanDone(void *drvHandler
, tenuScanEvent enuEvent
)
1431 WILC_Sint32 s32Error
= WILC_SUCCESS
;
1433 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
1436 u8 u8abort_running_scan
;
1440 PRINT_D(HOSTINF_DBG
, "in Handle_ScanDone()\n");
1443 /*Ask FW to abort the running scan, if any*/
1444 if (enuEvent
== SCAN_EVENT_ABORTED
) {
1445 PRINT_D(GENERIC_DBG
, "Abort running scan\n");
1446 u8abort_running_scan
= 1;
1447 strWID
.u16WIDid
= (u16
)WID_ABORT_RUNNING_SCAN
;
1448 strWID
.enuWIDtype
= WID_CHAR
;
1449 strWID
.ps8WidVal
= (WILC_Sint8
*)&u8abort_running_scan
;
1450 strWID
.s32ValueSize
= sizeof(WILC_Char
);
1453 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
1454 if (s32Error
!= WILC_SUCCESS
) {
1455 PRINT_ER("Failed to set abort running scan\n");
1456 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
1458 WILC_CATCH(s32Error
)
1463 if (pstrWFIDrv
== NULL
) {
1464 PRINT_ER("Driver handler is NULL\n");
1468 /*if there is an ongoing scan request*/
1469 if (pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
) {
1470 pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult(enuEvent
, NULL
,
1471 pstrWFIDrv
->strWILC_UsrScanReq
.u32UserScanPvoid
, NULL
);
1472 /*delete current scan request*/
1473 pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
= NULL
;
1480 * @brief Handle_Connect
1481 * @details Sending config packet to firmware to starting connection
1482 * @param[in] tstrHostIFconnectAttr* pstrHostIFconnectAttr
1483 * @return Error code.
1488 u8 u8ConnectedSSID
[6] = {0};
1489 static WILC_Sint32
Handle_Connect(void *drvHandler
, tstrHostIFconnectAttr
*pstrHostIFconnectAttr
)
1491 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*) drvHandler
;
1492 WILC_Sint32 s32Error
= WILC_SUCCESS
;
1493 tstrWID strWIDList
[8];
1494 WILC_Uint32 u32WidsCount
= 0, dummyval
= 0;
1495 /* char passphrase[] = "12345678"; */
1496 #ifndef CONNECT_DIRECT
1497 WILC_Sint32 s32Err
= WILC_SUCCESS
;
1499 u8 u8bssDscListIndex
;
1500 wid_site_survey_reslts_s
*pstrSurveyResults
= NULL
;
1502 u8
*pu8CurrByte
= NULL
;
1503 /*Bug4218: Parsing Join Param*/
1504 #ifdef WILC_PARSE_SCAN_IN_HOST
1505 tstrJoinBssParam
*ptstrJoinBssParam
;
1506 #endif /*WILC_PARSE_SCAN_IN_HOST*/
1510 PRINT_D(GENERIC_DBG
, "Handling connect request\n");
1512 #ifndef CONNECT_DIRECT
1513 WILC_memset(gapu8RcvdSurveyResults
[0], 0, MAX_SURVEY_RESULT_FRAG_SIZE
);
1514 WILC_memset(gapu8RcvdSurveyResults
[1], 0, MAX_SURVEY_RESULT_FRAG_SIZE
);
1517 PRINT_D(HOSTINF_DBG
, "Getting site survey results\n");
1518 s32Err
= host_int_get_site_survey_results((WILC_WFIDrvHandle
)pstrWFIDrv
,
1519 gapu8RcvdSurveyResults
,
1520 MAX_SURVEY_RESULT_FRAG_SIZE
);
1522 PRINT_ER("Failed to get site survey results\n");
1523 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
1526 s32Err
= ParseSurveyResults(gapu8RcvdSurveyResults
, &pstrSurveyResults
,
1527 &pstrWFIDrv
->u32SurveyResultsCount
);
1530 if (s32Err
== WILC_SUCCESS
) {
1531 /* use the parsed info in pstrSurveyResults, then deallocate it */
1532 PRINT_D(HOSTINF_DBG
, "Copying site survey results in global structure, then deallocate\n");
1533 for (i
= 0; i
< pstrWFIDrv
->u32SurveyResultsCount
; i
++) {
1534 WILC_memcpy(&pstrWFIDrv
->astrSurveyResults
[i
], &pstrSurveyResults
[i
],
1535 sizeof(wid_site_survey_reslts_s
));
1538 DeallocateSurveyResults(pstrSurveyResults
);
1540 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
1541 PRINT_ER("ParseSurveyResults() Error(%d) \n", s32Err
);
1545 for (i
= 0; i
< pstrWFIDrv
->u32SurveyResultsCount
; i
++) {
1546 if (WILC_memcmp(pstrWFIDrv
->astrSurveyResults
[i
].SSID
,
1547 pstrHostIFconnectAttr
->pu8ssid
,
1548 pstrHostIFconnectAttr
->ssidLen
) == 0) {
1549 PRINT_INFO(HOSTINF_DBG
, "Network with required SSID is found %s\n", pstrHostIFconnectAttr
->pu8ssid
);
1550 if (pstrHostIFconnectAttr
->pu8bssid
== NULL
) {
1551 /* BSSID is not passed from the user, so decision of matching
1552 * is done by SSID only */
1553 PRINT_INFO(HOSTINF_DBG
, "BSSID is not passed from the user\n");
1556 /* BSSID is also passed from the user, so decision of matching
1557 * should consider also this passed BSSID */
1559 if (WILC_memcmp(pstrWFIDrv
->astrSurveyResults
[i
].BSSID
,
1560 pstrHostIFconnectAttr
->pu8bssid
,
1562 PRINT_INFO(HOSTINF_DBG
, "BSSID is passed from the user and matched\n");
1569 if (i
< pstrWFIDrv
->u32SurveyResultsCount
) {
1570 u8bssDscListIndex
= i
;
1572 PRINT_INFO(HOSTINF_DBG
, "Connecting to network of Bss Idx %d and SSID %s and channel %d \n",
1573 u8bssDscListIndex
, pstrWFIDrv
->astrSurveyResults
[u8bssDscListIndex
].SSID
,
1574 pstrWFIDrv
->astrSurveyResults
[u8bssDscListIndex
].Channel
);
1576 PRINT_INFO(HOSTINF_DBG
, "Saving connection parameters in global structure\n");
1578 if (pstrHostIFconnectAttr
->pu8bssid
!= NULL
) {
1579 pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
= (u8
*)WILC_MALLOC(6);
1580 WILC_memcpy(pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
, pstrHostIFconnectAttr
->pu8bssid
, 6);
1583 pstrWFIDrv
->strWILC_UsrConnReq
.ssidLen
= pstrHostIFconnectAttr
->ssidLen
;
1584 if (pstrHostIFconnectAttr
->pu8ssid
!= NULL
) {
1585 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
= (u8
*)WILC_MALLOC(pstrHostIFconnectAttr
->ssidLen
+ 1);
1586 WILC_memcpy(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
, pstrHostIFconnectAttr
->pu8ssid
,
1587 pstrHostIFconnectAttr
->ssidLen
);
1588 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
[pstrHostIFconnectAttr
->ssidLen
] = '\0';
1591 pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
= pstrHostIFconnectAttr
->IEsLen
;
1592 if (pstrHostIFconnectAttr
->pu8IEs
!= NULL
) {
1593 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
= (u8
*)WILC_MALLOC(pstrHostIFconnectAttr
->IEsLen
);
1594 WILC_memcpy(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
, pstrHostIFconnectAttr
->pu8IEs
,
1595 pstrHostIFconnectAttr
->IEsLen
);
1598 pstrWFIDrv
->strWILC_UsrConnReq
.u8security
= pstrHostIFconnectAttr
->u8security
;
1599 pstrWFIDrv
->strWILC_UsrConnReq
.tenuAuth_type
= pstrHostIFconnectAttr
->tenuAuth_type
;
1600 pstrWFIDrv
->strWILC_UsrConnReq
.pfUserConnectResult
= pstrHostIFconnectAttr
->pfConnectResult
;
1601 pstrWFIDrv
->strWILC_UsrConnReq
.u32UserConnectPvoid
= pstrHostIFconnectAttr
->pvUserArg
;
1604 /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */
1605 /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */
1607 /* IEs to be inserted in Association Request */
1608 strWIDList
[u32WidsCount
].u16WIDid
= WID_INFO_ELEMENT_ASSOCIATE
;
1609 strWIDList
[u32WidsCount
].enuWIDtype
= WID_BIN_DATA
;
1610 strWIDList
[u32WidsCount
].ps8WidVal
= pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
;
1611 strWIDList
[u32WidsCount
].s32ValueSize
= pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
;
1614 strWIDList
[u32WidsCount
].u16WIDid
= (u16
)WID_11I_MODE
;
1615 strWIDList
[u32WidsCount
].enuWIDtype
= WID_CHAR
;
1616 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Char
);
1617 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(pstrWFIDrv
->strWILC_UsrConnReq
.u8security
));
1620 PRINT_INFO(HOSTINF_DBG
, "Encrypt Mode = %x\n", pstrWFIDrv
->strWILC_UsrConnReq
.u8security
);
1622 strWIDList
[u32WidsCount
].u16WIDid
= (u16
)WID_AUTH_TYPE
;
1623 strWIDList
[u32WidsCount
].enuWIDtype
= WID_CHAR
;
1624 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Char
);
1625 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&pstrWFIDrv
->strWILC_UsrConnReq
.tenuAuth_type
);
1628 PRINT_INFO(HOSTINF_DBG
, "Authentication Type = %x\n", pstrWFIDrv
->strWILC_UsrConnReq
.tenuAuth_type
);
1630 * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK;
1631 * strWIDList[u32WidsCount].enuWIDtype = WID_STR;
1632 * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase);
1633 * strWIDList[u32WidsCount].ps8WidVal = (WILC_Sint8*)(passphrase);
1637 strWIDList
[u32WidsCount
].u16WIDid
= (u16
)WID_JOIN_REQ
;
1638 strWIDList
[u32WidsCount
].enuWIDtype
= WID_CHAR
;
1639 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Char
);
1640 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)&u8bssDscListIndex
;
1644 /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the
1645 * firmware at chip reset when processing the WIDs of the Connect Request.
1646 * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */
1647 /* ////////////////////// */
1648 gu32WidConnRstHack
= 0;
1649 /* ////////////////////// */
1652 s32Error
= SendConfigPkt(SET_CFG
, strWIDList
, u32WidsCount
, WILC_FALSE
, (WILC_Uint32
)pstrWFIDrv
);
1654 PRINT_ER("Handle_Connect()] failed to send config packet\n");
1655 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
1657 pstrWFIDrv
->enuHostIFstate
= HOST_IF_WAITING_CONN_RESP
;
1661 PRINT_ER("Required BSSID not found\n");
1662 WILC_ERRORREPORT(s32Error
, WILC_NOT_FOUND
);
1667 /* if we try to connect to an already connected AP then discard the request */
1669 if (WILC_memcmp(pstrHostIFconnectAttr
->pu8bssid
, u8ConnectedSSID
, ETH_ALEN
) == 0) {
1671 s32Error
= WILC_SUCCESS
;
1672 PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n");
1676 PRINT_INFO(HOSTINF_DBG
, "Saving connection parameters in global structure\n");
1678 /*Bug4218: Parsing Join Param*/
1679 #ifdef WILC_PARSE_SCAN_IN_HOST
1680 ptstrJoinBssParam
= (tstrJoinBssParam
*)pstrHostIFconnectAttr
->pJoinParams
;
1681 if (ptstrJoinBssParam
== NULL
) {
1682 PRINT_ER("Required BSSID not found\n");
1683 WILC_ERRORREPORT(s32Error
, WILC_NOT_FOUND
);
1685 #endif /*WILC_PARSE_SCAN_IN_HOST*/
1688 /* if we try to connect to an already connected AP then discard the request */
1689 PRINT_D(GENERIC_DBG
, "Bssid = %x:%x:%x:%x:%x:%x\n", (pstrHostIFconnectAttr
->pu8bssid
[0]), (pstrHostIFconnectAttr
->pu8bssid
[1]), (pstrHostIFconnectAttr
->pu8bssid
[2]), (pstrHostIFconnectAttr
->pu8bssid
[3]), (pstrHostIFconnectAttr
->pu8bssid
[4]), (pstrHostIFconnectAttr
->pu8bssid
[5]));
1690 PRINT_D(GENERIC_DBG
, "bssid = %x:%x:%x:%x:%x:%x\n", (u8ConnectedSSID
[0]), (u8ConnectedSSID
[1]), (u8ConnectedSSID
[2]), (u8ConnectedSSID
[3]), (u8ConnectedSSID
[4]), (u8ConnectedSSID
[5]));
1691 if (WILC_memcmp(pstrHostIFconnectAttr
->pu8bssid
, u8ConnectedSSID
, ETH_ALEN
) == 0) {
1692 PRINT_ER("Discard connect request\n");
1693 s32Error
= WILC_FAIL
;
1698 if (pstrHostIFconnectAttr
->pu8bssid
!= NULL
) {
1699 pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
= (u8
*)WILC_MALLOC(6);
1700 WILC_memcpy(pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
, pstrHostIFconnectAttr
->pu8bssid
, 6);
1703 pstrWFIDrv
->strWILC_UsrConnReq
.ssidLen
= pstrHostIFconnectAttr
->ssidLen
;
1704 if (pstrHostIFconnectAttr
->pu8ssid
!= NULL
) {
1705 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
= (u8
*)WILC_MALLOC(pstrHostIFconnectAttr
->ssidLen
+ 1);
1706 WILC_memcpy(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
, pstrHostIFconnectAttr
->pu8ssid
,
1707 pstrHostIFconnectAttr
->ssidLen
);
1708 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
[pstrHostIFconnectAttr
->ssidLen
] = '\0';
1711 pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
= pstrHostIFconnectAttr
->IEsLen
;
1712 if (pstrHostIFconnectAttr
->pu8IEs
!= NULL
) {
1713 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
= (u8
*)WILC_MALLOC(pstrHostIFconnectAttr
->IEsLen
);
1714 WILC_memcpy(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
, pstrHostIFconnectAttr
->pu8IEs
,
1715 pstrHostIFconnectAttr
->IEsLen
);
1718 pstrWFIDrv
->strWILC_UsrConnReq
.u8security
= pstrHostIFconnectAttr
->u8security
;
1719 pstrWFIDrv
->strWILC_UsrConnReq
.tenuAuth_type
= pstrHostIFconnectAttr
->tenuAuth_type
;
1720 pstrWFIDrv
->strWILC_UsrConnReq
.pfUserConnectResult
= pstrHostIFconnectAttr
->pfConnectResult
;
1721 pstrWFIDrv
->strWILC_UsrConnReq
.u32UserConnectPvoid
= pstrHostIFconnectAttr
->pvUserArg
;
1723 strWIDList
[u32WidsCount
].u16WIDid
= WID_SUCCESS_FRAME_COUNT
;
1724 strWIDList
[u32WidsCount
].enuWIDtype
= WID_INT
;
1725 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Uint32
);
1726 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(dummyval
));
1729 strWIDList
[u32WidsCount
].u16WIDid
= WID_RECEIVED_FRAGMENT_COUNT
;
1730 strWIDList
[u32WidsCount
].enuWIDtype
= WID_INT
;
1731 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Uint32
);
1732 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(dummyval
));
1735 strWIDList
[u32WidsCount
].u16WIDid
= WID_FAILED_COUNT
;
1736 strWIDList
[u32WidsCount
].enuWIDtype
= WID_INT
;
1737 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Uint32
);
1738 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(dummyval
));
1741 /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */
1742 /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */
1744 /* IEs to be inserted in Association Request */
1745 strWIDList
[u32WidsCount
].u16WIDid
= WID_INFO_ELEMENT_ASSOCIATE
;
1746 strWIDList
[u32WidsCount
].enuWIDtype
= WID_BIN_DATA
;
1747 strWIDList
[u32WidsCount
].ps8WidVal
= pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
;
1748 strWIDList
[u32WidsCount
].s32ValueSize
= pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
;
1752 if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr
->pu8ssid
, 7)) {
1754 gu32FlushedInfoElemAsocSize
= pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
;
1755 gu8FlushedInfoElemAsoc
= WILC_MALLOC(gu32FlushedInfoElemAsocSize
);
1756 memcpy(gu8FlushedInfoElemAsoc
, pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
,
1757 gu32FlushedInfoElemAsocSize
);
1760 strWIDList
[u32WidsCount
].u16WIDid
= (u16
)WID_11I_MODE
;
1761 strWIDList
[u32WidsCount
].enuWIDtype
= WID_CHAR
;
1762 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Char
);
1763 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(pstrWFIDrv
->strWILC_UsrConnReq
.u8security
));
1767 if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr
->pu8ssid
, 7))
1768 gu8Flushed11iMode
= pstrWFIDrv
->strWILC_UsrConnReq
.u8security
;
1770 PRINT_INFO(HOSTINF_DBG
, "Encrypt Mode = %x\n", pstrWFIDrv
->strWILC_UsrConnReq
.u8security
);
1773 strWIDList
[u32WidsCount
].u16WIDid
= (u16
)WID_AUTH_TYPE
;
1774 strWIDList
[u32WidsCount
].enuWIDtype
= WID_CHAR
;
1775 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Char
);
1776 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&pstrWFIDrv
->strWILC_UsrConnReq
.tenuAuth_type
);
1780 if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr
->pu8ssid
, 7))
1781 gu8FlushedAuthType
= (u8
)pstrWFIDrv
->strWILC_UsrConnReq
.tenuAuth_type
;
1783 PRINT_INFO(HOSTINF_DBG
, "Authentication Type = %x\n", pstrWFIDrv
->strWILC_UsrConnReq
.tenuAuth_type
);
1785 * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK;
1786 * strWIDList[u32WidsCount].enuWIDtype = WID_STR;
1787 * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase);
1788 * strWIDList[u32WidsCount].ps8WidVal = (WILC_Sint8*)(passphrase);
1792 PRINT_D(HOSTINF_DBG
, "Connecting to network of SSID %s on channel %d\n",
1793 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
, pstrHostIFconnectAttr
->u8channel
);
1796 #ifndef WILC_PARSE_SCAN_IN_HOST
1797 strWIDList
[u32WidsCount
].u16WIDid
= (u16
)WID_JOIN_REQ_EXTENDED
;
1798 strWIDList
[u32WidsCount
].enuWIDtype
= WID_STR
;
1799 strWIDList
[u32WidsCount
].s32ValueSize
= MAX_SSID_LEN
+ 7;
1800 strWIDList
[u32WidsCount
].ps8WidVal
= WILC_MALLOC(strWIDList
[u32WidsCount
].s32ValueSize
);
1802 if (strWIDList
[u32WidsCount
].ps8WidVal
== NULL
) {
1803 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
1806 pu8CurrByte
= strWIDList
[u32WidsCount
].ps8WidVal
;
1808 if (pstrHostIFconnectAttr
->pu8ssid
!= NULL
) {
1809 WILC_memcpy(pu8CurrByte
, pstrHostIFconnectAttr
->pu8ssid
, pstrHostIFconnectAttr
->ssidLen
);
1810 pu8CurrByte
[pstrHostIFconnectAttr
->ssidLen
] = '\0';
1812 pu8CurrByte
+= MAX_SSID_LEN
;
1813 if ((pstrHostIFconnectAttr
->u8channel
>= 1) && (pstrHostIFconnectAttr
->u8channel
<= 14)) {
1814 *(pu8CurrByte
++) = pstrHostIFconnectAttr
->u8channel
;
1816 PRINT_ER("Channel out of range\n");
1817 *(pu8CurrByte
++) = 0xFF;
1819 if (pstrHostIFconnectAttr
->pu8bssid
!= NULL
) {
1820 WILC_memcpy(pu8CurrByte
, pstrHostIFconnectAttr
->pu8bssid
, 6);
1824 /* keep the buffer at the start of the allocated pointer to use it with the free*/
1825 pu8CurrByte
= strWIDList
[u32WidsCount
].ps8WidVal
;
1829 strWIDList
[u32WidsCount
].u16WIDid
= (u16
)WID_JOIN_REQ_EXTENDED
;
1830 strWIDList
[u32WidsCount
].enuWIDtype
= WID_STR
;
1832 /*Sending NoA attributes during connection*/
1833 strWIDList
[u32WidsCount
].s32ValueSize
= 112; /* 79; */
1834 strWIDList
[u32WidsCount
].ps8WidVal
= WILC_MALLOC(strWIDList
[u32WidsCount
].s32ValueSize
);
1837 if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr
->pu8ssid
, 7)) {
1838 gu32FlushedJoinReqSize
= strWIDList
[u32WidsCount
].s32ValueSize
;
1839 gu8FlushedJoinReq
= WILC_MALLOC(gu32FlushedJoinReqSize
);
1841 if (strWIDList
[u32WidsCount
].ps8WidVal
== NULL
) {
1842 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
1845 pu8CurrByte
= strWIDList
[u32WidsCount
].ps8WidVal
;
1848 if (pstrHostIFconnectAttr
->pu8ssid
!= NULL
) {
1849 WILC_memcpy(pu8CurrByte
, pstrHostIFconnectAttr
->pu8ssid
, pstrHostIFconnectAttr
->ssidLen
);
1850 pu8CurrByte
[pstrHostIFconnectAttr
->ssidLen
] = '\0';
1852 pu8CurrByte
+= MAX_SSID_LEN
;
1855 *(pu8CurrByte
++) = INFRASTRUCTURE
;
1857 if ((pstrHostIFconnectAttr
->u8channel
>= 1) && (pstrHostIFconnectAttr
->u8channel
<= 14)) {
1858 *(pu8CurrByte
++) = pstrHostIFconnectAttr
->u8channel
;
1860 PRINT_ER("Channel out of range\n");
1861 *(pu8CurrByte
++) = 0xFF;
1864 *(pu8CurrByte
++) = (ptstrJoinBssParam
->cap_info
) & 0xFF;
1865 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->cap_info
) >> 8) & 0xFF;
1866 PRINT_D(HOSTINF_DBG
, "* Cap Info %0x*\n", (*(pu8CurrByte
- 2) | ((*(pu8CurrByte
- 1)) << 8)));
1869 if (pstrHostIFconnectAttr
->pu8bssid
!= NULL
) {
1870 WILC_memcpy(pu8CurrByte
, pstrHostIFconnectAttr
->pu8bssid
, 6);
1875 if (pstrHostIFconnectAttr
->pu8bssid
!= NULL
) {
1876 WILC_memcpy(pu8CurrByte
, pstrHostIFconnectAttr
->pu8bssid
, 6);
1881 *(pu8CurrByte
++) = (ptstrJoinBssParam
->beacon_period
) & 0xFF;
1882 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->beacon_period
) >> 8) & 0xFF;
1883 PRINT_D(HOSTINF_DBG
, "* Beacon Period %d*\n", (*(pu8CurrByte
- 2) | ((*(pu8CurrByte
- 1)) << 8)));
1885 *(pu8CurrByte
++) = ptstrJoinBssParam
->dtim_period
;
1886 PRINT_D(HOSTINF_DBG
, "* DTIM Period %d*\n", (*(pu8CurrByte
- 1)));
1887 /* Supported rates*/
1888 WILC_memcpy(pu8CurrByte
, ptstrJoinBssParam
->supp_rates
, MAX_RATES_SUPPORTED
+ 1);
1889 pu8CurrByte
+= (MAX_RATES_SUPPORTED
+ 1);
1892 *(pu8CurrByte
++) = ptstrJoinBssParam
->wmm_cap
;
1893 PRINT_D(HOSTINF_DBG
, "* wmm cap%d*\n", (*(pu8CurrByte
- 1)));
1895 *(pu8CurrByte
++) = ptstrJoinBssParam
->uapsd_cap
;
1898 *(pu8CurrByte
++) = ptstrJoinBssParam
->ht_capable
;
1899 /* copy this information to the user request */
1900 pstrWFIDrv
->strWILC_UsrConnReq
.IsHTCapable
= ptstrJoinBssParam
->ht_capable
;
1903 *(pu8CurrByte
++) = ptstrJoinBssParam
->rsn_found
;
1904 PRINT_D(HOSTINF_DBG
, "* rsn found %d*\n", *(pu8CurrByte
- 1));
1905 /* rsn group policy*/
1906 *(pu8CurrByte
++) = ptstrJoinBssParam
->rsn_grp_policy
;
1907 PRINT_D(HOSTINF_DBG
, "* rsn group policy %0x*\n", (*(pu8CurrByte
- 1)));
1909 *(pu8CurrByte
++) = ptstrJoinBssParam
->mode_802_11i
;
1910 PRINT_D(HOSTINF_DBG
, "* mode_802_11i %d*\n", (*(pu8CurrByte
- 1)));
1911 /* rsn pcip policy*/
1912 WILC_memcpy(pu8CurrByte
, ptstrJoinBssParam
->rsn_pcip_policy
, sizeof(ptstrJoinBssParam
->rsn_pcip_policy
));
1913 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->rsn_pcip_policy
);
1915 /* rsn auth policy*/
1916 WILC_memcpy(pu8CurrByte
, ptstrJoinBssParam
->rsn_auth_policy
, sizeof(ptstrJoinBssParam
->rsn_auth_policy
));
1917 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->rsn_auth_policy
);
1919 /* rsn auth policy*/
1920 WILC_memcpy(pu8CurrByte
, ptstrJoinBssParam
->rsn_cap
, sizeof(ptstrJoinBssParam
->rsn_cap
));
1921 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->rsn_cap
);
1924 *(pu8CurrByte
++) = REAL_JOIN_REQ
;
1927 *(pu8CurrByte
++) = ptstrJoinBssParam
->u8NoaEnbaled
;
1928 if (ptstrJoinBssParam
->u8NoaEnbaled
) {
1929 PRINT_D(HOSTINF_DBG
, "NOA present\n");
1931 *(pu8CurrByte
++) = (ptstrJoinBssParam
->tsf
) & 0xFF;
1932 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->tsf
) >> 8) & 0xFF;
1933 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->tsf
) >> 16) & 0xFF;
1934 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->tsf
) >> 24) & 0xFF;
1936 *(pu8CurrByte
++) = ptstrJoinBssParam
->u8Index
;
1938 *(pu8CurrByte
++) = ptstrJoinBssParam
->u8OppEnable
;
1940 if (ptstrJoinBssParam
->u8OppEnable
)
1941 *(pu8CurrByte
++) = ptstrJoinBssParam
->u8CtWindow
;
1943 *(pu8CurrByte
++) = ptstrJoinBssParam
->u8Count
;
1945 WILC_memcpy(pu8CurrByte
, ptstrJoinBssParam
->au8Duration
, sizeof(ptstrJoinBssParam
->au8Duration
));
1947 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->au8Duration
);
1949 WILC_memcpy(pu8CurrByte
, ptstrJoinBssParam
->au8Interval
, sizeof(ptstrJoinBssParam
->au8Interval
));
1951 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->au8Interval
);
1953 WILC_memcpy(pu8CurrByte
, ptstrJoinBssParam
->au8StartTime
, sizeof(ptstrJoinBssParam
->au8StartTime
));
1955 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->au8StartTime
);
1958 PRINT_D(HOSTINF_DBG
, "NOA not present\n");
1962 /* keep the buffer at the start of the allocated pointer to use it with the free*/
1963 pu8CurrByte
= strWIDList
[u32WidsCount
].ps8WidVal
;
1966 #endif /* #ifdef WILC_PARSE_SCAN_IN_HOST*/
1970 /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the
1971 * firmware at chip reset when processing the WIDs of the Connect Request.
1972 * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */
1973 /* ////////////////////// */
1974 gu32WidConnRstHack
= 0;
1975 /* ////////////////////// */
1979 if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr
->pu8ssid
, 7)) {
1980 memcpy(gu8FlushedJoinReq
, pu8CurrByte
, gu32FlushedJoinReqSize
);
1981 gu8FlushedJoinReqDrvHandler
= (WILC_Uint32
)pstrWFIDrv
;
1984 PRINT_D(GENERIC_DBG
, "send HOST_IF_WAITING_CONN_RESP\n");
1986 if (pstrHostIFconnectAttr
->pu8bssid
!= NULL
) {
1987 WILC_memcpy(u8ConnectedSSID
, pstrHostIFconnectAttr
->pu8bssid
, ETH_ALEN
);
1989 PRINT_D(GENERIC_DBG
, "save Bssid = %x:%x:%x:%x:%x:%x\n", (pstrHostIFconnectAttr
->pu8bssid
[0]), (pstrHostIFconnectAttr
->pu8bssid
[1]), (pstrHostIFconnectAttr
->pu8bssid
[2]), (pstrHostIFconnectAttr
->pu8bssid
[3]), (pstrHostIFconnectAttr
->pu8bssid
[4]), (pstrHostIFconnectAttr
->pu8bssid
[5]));
1990 PRINT_D(GENERIC_DBG
, "save bssid = %x:%x:%x:%x:%x:%x\n", (u8ConnectedSSID
[0]), (u8ConnectedSSID
[1]), (u8ConnectedSSID
[2]), (u8ConnectedSSID
[3]), (u8ConnectedSSID
[4]), (u8ConnectedSSID
[5]));
1993 s32Error
= SendConfigPkt(SET_CFG
, strWIDList
, u32WidsCount
, WILC_FALSE
, (WILC_Uint32
)pstrWFIDrv
);
1995 PRINT_ER("Handle_Connect()] failed to send config packet\n");
1996 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
1998 PRINT_D(GENERIC_DBG
, "set HOST_IF_WAITING_CONN_RESP\n");
1999 pstrWFIDrv
->enuHostIFstate
= HOST_IF_WAITING_CONN_RESP
;
2003 WILC_CATCH(s32Error
)
2005 tstrConnectInfo strConnectInfo
;
2007 WILC_TimerStop(&(pstrWFIDrv
->hConnectTimer
), NULL
);
2009 PRINT_D(HOSTINF_DBG
, "could not start connecting to the required network\n");
2011 WILC_memset(&strConnectInfo
, 0, sizeof(tstrConnectInfo
));
2013 if (pstrHostIFconnectAttr
->pfConnectResult
!= NULL
) {
2014 if (pstrHostIFconnectAttr
->pu8bssid
!= NULL
) {
2015 WILC_memcpy(strConnectInfo
.au8bssid
, pstrHostIFconnectAttr
->pu8bssid
, 6);
2018 if (pstrHostIFconnectAttr
->pu8IEs
!= NULL
) {
2019 strConnectInfo
.ReqIEsLen
= pstrHostIFconnectAttr
->IEsLen
;
2020 strConnectInfo
.pu8ReqIEs
= (u8
*)WILC_MALLOC(pstrHostIFconnectAttr
->IEsLen
);
2021 WILC_memcpy(strConnectInfo
.pu8ReqIEs
,
2022 pstrHostIFconnectAttr
->pu8IEs
,
2023 pstrHostIFconnectAttr
->IEsLen
);
2026 pstrHostIFconnectAttr
->pfConnectResult(CONN_DISCONN_EVENT_CONN_RESP
,
2030 pstrHostIFconnectAttr
->pvUserArg
);
2031 /*Change state to idle*/
2032 pstrWFIDrv
->enuHostIFstate
= HOST_IF_IDLE
;
2034 if (strConnectInfo
.pu8ReqIEs
!= NULL
) {
2035 WILC_FREE(strConnectInfo
.pu8ReqIEs
);
2036 strConnectInfo
.pu8ReqIEs
= NULL
;
2040 PRINT_ER("Connect callback function pointer is NULL \n");
2044 PRINT_D(HOSTINF_DBG
, "Deallocating connection parameters\n");
2045 /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */
2046 if (pstrHostIFconnectAttr
->pu8bssid
!= NULL
) {
2047 WILC_FREE(pstrHostIFconnectAttr
->pu8bssid
);
2048 pstrHostIFconnectAttr
->pu8bssid
= NULL
;
2051 /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */
2052 if (pstrHostIFconnectAttr
->pu8ssid
!= NULL
) {
2053 WILC_FREE(pstrHostIFconnectAttr
->pu8ssid
);
2054 pstrHostIFconnectAttr
->pu8ssid
= NULL
;
2057 /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */
2058 if (pstrHostIFconnectAttr
->pu8IEs
!= NULL
) {
2059 WILC_FREE(pstrHostIFconnectAttr
->pu8IEs
);
2060 pstrHostIFconnectAttr
->pu8IEs
= NULL
;
2063 if (pu8CurrByte
!= NULL
) {
2064 WILC_FREE(pu8CurrByte
);
2070 * @brief Handle_FlushConnect
2071 * @details Sending config packet to firmware to flush an old connection
2072 * after switching FW from station one to hybrid one
2073 * @param[in] void * drvHandler
2074 * @return Error code.
2075 * @author Amr Abdel-Moghny
2080 static WILC_Sint32
Handle_FlushConnect(void *drvHandler
)
2082 WILC_Sint32 s32Error
= WILC_SUCCESS
;
2083 tstrWID strWIDList
[5];
2084 WILC_Uint32 u32WidsCount
= 0;
2085 u8
*pu8CurrByte
= NULL
;
2088 /* IEs to be inserted in Association Request */
2089 strWIDList
[u32WidsCount
].u16WIDid
= WID_INFO_ELEMENT_ASSOCIATE
;
2090 strWIDList
[u32WidsCount
].enuWIDtype
= WID_BIN_DATA
;
2091 strWIDList
[u32WidsCount
].ps8WidVal
= gu8FlushedInfoElemAsoc
;
2092 strWIDList
[u32WidsCount
].s32ValueSize
= gu32FlushedInfoElemAsocSize
;
2095 strWIDList
[u32WidsCount
].u16WIDid
= (u16
)WID_11I_MODE
;
2096 strWIDList
[u32WidsCount
].enuWIDtype
= WID_CHAR
;
2097 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Char
);
2098 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(gu8Flushed11iMode
));
2103 strWIDList
[u32WidsCount
].u16WIDid
= (u16
)WID_AUTH_TYPE
;
2104 strWIDList
[u32WidsCount
].enuWIDtype
= WID_CHAR
;
2105 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Char
);
2106 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&gu8FlushedAuthType
);
2110 #ifdef WILC_PARSE_SCAN_IN_HOST
2111 strWIDList
[u32WidsCount
].u16WIDid
= (u16
)WID_JOIN_REQ_EXTENDED
;
2112 strWIDList
[u32WidsCount
].enuWIDtype
= WID_STR
;
2113 strWIDList
[u32WidsCount
].s32ValueSize
= gu32FlushedJoinReqSize
;
2114 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)gu8FlushedJoinReq
;
2115 pu8CurrByte
= strWIDList
[u32WidsCount
].ps8WidVal
;
2117 pu8CurrByte
+= FLUSHED_BYTE_POS
;
2118 *(pu8CurrByte
) = FLUSHED_JOIN_REQ
;
2124 s32Error
= SendConfigPkt(SET_CFG
, strWIDList
, u32WidsCount
, WILC_FALSE
, gu8FlushedJoinReqDrvHandler
);
2126 PRINT_ER("Handle_Flush_Connect()] failed to send config packet\n");
2127 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
2130 WILC_CATCH(s32Error
)
2139 * @brief Handle_ConnectTimeout
2140 * @details Call connect notification callback function indicating connection failure
2142 * @return Error code.
2147 static WILC_Sint32
Handle_ConnectTimeout(void *drvHandler
)
2149 WILC_Sint32 s32Error
= WILC_SUCCESS
;
2150 tstrConnectInfo strConnectInfo
;
2152 u16 u16DummyReasonCode
= 0;
2153 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*) drvHandler
;
2155 if (pstrWFIDrv
== NULL
) {
2156 PRINT_ER("Driver handler is NULL\n");
2160 pstrWFIDrv
->enuHostIFstate
= HOST_IF_IDLE
;
2162 gbScanWhileConnected
= WILC_FALSE
;
2165 WILC_memset(&strConnectInfo
, 0, sizeof(tstrConnectInfo
));
2168 /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function},
2169 * then we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying
2170 * WID_DISCONNECT} */
2171 if (pstrWFIDrv
->strWILC_UsrConnReq
.pfUserConnectResult
!= NULL
) {
2172 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
!= NULL
) {
2173 WILC_memcpy(strConnectInfo
.au8bssid
,
2174 pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
, 6);
2177 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
!= NULL
) {
2178 strConnectInfo
.ReqIEsLen
= pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
;
2179 strConnectInfo
.pu8ReqIEs
= (u8
*)WILC_MALLOC(pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
);
2180 WILC_memcpy(strConnectInfo
.pu8ReqIEs
,
2181 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
,
2182 pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
);
2185 pstrWFIDrv
->strWILC_UsrConnReq
.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP
,
2189 pstrWFIDrv
->strWILC_UsrConnReq
.u32UserConnectPvoid
);
2191 /* Deallocation of strConnectInfo.pu8ReqIEs */
2192 if (strConnectInfo
.pu8ReqIEs
!= NULL
) {
2193 WILC_FREE(strConnectInfo
.pu8ReqIEs
);
2194 strConnectInfo
.pu8ReqIEs
= NULL
;
2197 PRINT_ER("Connect callback function pointer is NULL \n");
2200 /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying
2201 * WID_DISCONNECT} */
2202 strWID
.u16WIDid
= (u16
)WID_DISCONNECT
;
2203 strWID
.enuWIDtype
= WID_CHAR
;
2204 strWID
.ps8WidVal
= (WILC_Sint8
*)&u16DummyReasonCode
;
2205 strWID
.s32ValueSize
= sizeof(WILC_Char
);
2207 PRINT_D(HOSTINF_DBG
, "Sending disconnect request\n");
2209 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_FALSE
, (WILC_Uint32
)pstrWFIDrv
);
2211 PRINT_ER("Failed to send dissconect config packet\n");
2214 /* Deallocation of the Saved Connect Request in the global Handle */
2215 pstrWFIDrv
->strWILC_UsrConnReq
.ssidLen
= 0;
2216 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
!= NULL
) {
2217 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
);
2218 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
= NULL
;
2221 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
!= NULL
) {
2222 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
);
2223 pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
= NULL
;
2226 pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
= 0;
2227 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
!= NULL
) {
2228 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
);
2229 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
= NULL
;
2232 WILC_memset(u8ConnectedSSID
, 0, ETH_ALEN
);
2234 /*Freeing flushed join request params on connect timeout*/
2235 if (gu8FlushedJoinReq
!= NULL
&& gu8FlushedJoinReqDrvHandler
== (WILC_Uint32
)drvHandler
) {
2236 WILC_FREE(gu8FlushedJoinReq
);
2237 gu8FlushedJoinReq
= NULL
;
2239 if (gu8FlushedInfoElemAsoc
!= NULL
&& gu8FlushedJoinReqDrvHandler
== (WILC_Uint32
)drvHandler
) {
2240 WILC_FREE(gu8FlushedInfoElemAsoc
);
2241 gu8FlushedInfoElemAsoc
= NULL
;
2248 * @brief Handle_RcvdNtwrkInfo
2249 * @details Handling received network information
2250 * @param[in] tstrRcvdNetworkInfo* pstrRcvdNetworkInfo
2251 * @return Error code.
2256 static WILC_Sint32
Handle_RcvdNtwrkInfo(void *drvHandler
, tstrRcvdNetworkInfo
*pstrRcvdNetworkInfo
)
2259 WILC_Bool bNewNtwrkFound
;
2263 WILC_Sint32 s32Error
= WILC_SUCCESS
;
2264 tstrNetworkInfo
*pstrNetworkInfo
= NULL
;
2265 void *pJoinParams
= NULL
;
2267 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
2271 bNewNtwrkFound
= WILC_TRUE
;
2272 PRINT_INFO(HOSTINF_DBG
, "Handling received network info\n");
2274 /*if there is a an ongoing scan request*/
2275 if (pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
) {
2276 PRINT_D(HOSTINF_DBG
, "State: Scanning, parsing network information received\n");
2277 ParseNetworkInfo(pstrRcvdNetworkInfo
->pu8Buffer
, &pstrNetworkInfo
);
2278 if ((pstrNetworkInfo
== NULL
)
2279 || (pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
== NULL
)) {
2280 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
2283 /* check whether this network is discovered before */
2284 for (i
= 0; i
< pstrWFIDrv
->strWILC_UsrScanReq
.u32RcvdChCount
; i
++) {
2286 if ((pstrWFIDrv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[i
].au8bssid
!= NULL
) &&
2287 (pstrNetworkInfo
->au8bssid
!= NULL
)) {
2288 if (WILC_memcmp(pstrWFIDrv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[i
].au8bssid
,
2289 pstrNetworkInfo
->au8bssid
, 6) == 0) {
2290 if (pstrNetworkInfo
->s8rssi
<= pstrWFIDrv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[i
].s8rssi
) {
2291 /*we have already found this network with better rssi, so keep the old cached one and don't
2292 * send anything to the upper layer */
2293 PRINT_D(HOSTINF_DBG
, "Network previously discovered\n");
2296 /* here the same already found network is found again but with a better rssi, so just update
2297 * the rssi for this cached network and send this updated network to the upper layer but
2298 * don't add a new record for it */
2299 pstrWFIDrv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[i
].s8rssi
= pstrNetworkInfo
->s8rssi
;
2300 bNewNtwrkFound
= WILC_FALSE
;
2307 if (bNewNtwrkFound
== WILC_TRUE
) {
2308 /* here it is confirmed that it is a new discovered network,
2309 * so add its record then call the User CallBack function */
2311 PRINT_D(HOSTINF_DBG
, "New network found\n");
2313 if (pstrWFIDrv
->strWILC_UsrScanReq
.u32RcvdChCount
< MAX_NUM_SCANNED_NETWORKS
) {
2314 pstrWFIDrv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[pstrWFIDrv
->strWILC_UsrScanReq
.u32RcvdChCount
].s8rssi
= pstrNetworkInfo
->s8rssi
;
2316 if ((pstrWFIDrv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[pstrWFIDrv
->strWILC_UsrScanReq
.u32RcvdChCount
].au8bssid
!= NULL
)
2317 && (pstrNetworkInfo
->au8bssid
!= NULL
)) {
2318 WILC_memcpy(pstrWFIDrv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[pstrWFIDrv
->strWILC_UsrScanReq
.u32RcvdChCount
].au8bssid
,
2319 pstrNetworkInfo
->au8bssid
, 6);
2321 pstrWFIDrv
->strWILC_UsrScanReq
.u32RcvdChCount
++;
2323 pstrNetworkInfo
->bNewNetwork
= WILC_TRUE
;
2324 /*Bug4218: Parsing Join Param*/
2325 /* add new BSS to JoinBssTable */
2326 #ifdef WILC_PARSE_SCAN_IN_HOST
2327 pJoinParams
= host_int_ParseJoinBssParam(pstrNetworkInfo
);
2328 #endif /*WILC_PARSE_SCAN_IN_HOST*/
2330 pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND
, pstrNetworkInfo
,
2331 pstrWFIDrv
->strWILC_UsrScanReq
.u32UserScanPvoid
,
2337 PRINT_WRN(HOSTINF_DBG
, "Discovered networks exceeded max. limit \n");
2340 pstrNetworkInfo
->bNewNetwork
= WILC_FALSE
;
2341 /* just call the User CallBack function to send the same discovered network with its updated RSSI */
2342 pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND
, pstrNetworkInfo
,
2343 pstrWFIDrv
->strWILC_UsrScanReq
.u32UserScanPvoid
, NULL
);
2348 WILC_CATCH(s32Error
)
2354 /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */
2355 if (pstrRcvdNetworkInfo
->pu8Buffer
!= NULL
) {
2356 WILC_FREE(pstrRcvdNetworkInfo
->pu8Buffer
);
2357 pstrRcvdNetworkInfo
->pu8Buffer
= NULL
;
2360 /*free structure allocated*/
2361 if (pstrNetworkInfo
!= NULL
) {
2362 DeallocateNetworkInfo(pstrNetworkInfo
);
2363 pstrNetworkInfo
= NULL
;
2370 * @brief Handle_RcvdGnrlAsyncInfo
2371 * @details Handling received asynchrous general network information
2372 * @param[in] tstrRcvdGnrlAsyncInfo* pstrRcvdGnrlAsyncInfo
2373 * @return Error code.
2378 static WILC_Sint32
Handle_RcvdGnrlAsyncInfo(void *drvHandler
, tstrRcvdGnrlAsyncInfo
*pstrRcvdGnrlAsyncInfo
)
2380 /* TODO: mostafa: till now, this function just handles only the received mac status msg, */
2381 /* which carries only 1 WID which have WID ID = WID_STATUS */
2382 WILC_Sint32 s32Error
= WILC_SUCCESS
;
2386 u16 u16WidID
= (u16
)WID_NIL
;
2389 u8 u8MacStatusReasonCode
;
2390 u8 u8MacStatusAdditionalInfo
;
2391 tstrConnectInfo strConnectInfo
;
2392 tstrDisconnectNotifInfo strDisconnectNotifInfo
;
2393 WILC_Sint32 s32Err
= WILC_SUCCESS
;
2394 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*) drvHandler
;
2395 if (pstrWFIDrv
== NULL
) {
2396 PRINT_ER("Driver handler is NULL\n");
2398 PRINT_D(GENERIC_DBG
, "Current State = %d,Received state = %d\n", pstrWFIDrv
->enuHostIFstate
,
2399 pstrRcvdGnrlAsyncInfo
->pu8Buffer
[7]);
2401 if ((pstrWFIDrv
->enuHostIFstate
== HOST_IF_WAITING_CONN_RESP
) ||
2402 (pstrWFIDrv
->enuHostIFstate
== HOST_IF_CONNECTED
) ||
2403 pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
) {
2404 if ((pstrRcvdGnrlAsyncInfo
->pu8Buffer
== NULL
) ||
2405 (pstrWFIDrv
->strWILC_UsrConnReq
.pfUserConnectResult
== NULL
)) {
2406 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
2409 u8MsgType
= pstrRcvdGnrlAsyncInfo
->pu8Buffer
[0];
2411 /* Check whether the received message type is 'I' */
2412 if ('I' != u8MsgType
) {
2413 PRINT_ER("Received Message format incorrect.\n");
2414 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
2417 /* Extract message ID */
2418 u8MsgID
= pstrRcvdGnrlAsyncInfo
->pu8Buffer
[1];
2420 /* Extract message Length */
2421 u16MsgLen
= MAKE_WORD16(pstrRcvdGnrlAsyncInfo
->pu8Buffer
[2], pstrRcvdGnrlAsyncInfo
->pu8Buffer
[3]);
2423 /* Extract WID ID [expected to be = WID_STATUS] */
2424 u16WidID
= MAKE_WORD16(pstrRcvdGnrlAsyncInfo
->pu8Buffer
[4], pstrRcvdGnrlAsyncInfo
->pu8Buffer
[5]);
2426 /* Extract WID Length [expected to be = 1] */
2427 u8WidLen
= pstrRcvdGnrlAsyncInfo
->pu8Buffer
[6];
2429 /* get the WID value [expected to be one of two values: either MAC_CONNECTED = (1) or MAC_DISCONNECTED = (0)] */
2430 u8MacStatus
= pstrRcvdGnrlAsyncInfo
->pu8Buffer
[7];
2431 u8MacStatusReasonCode
= pstrRcvdGnrlAsyncInfo
->pu8Buffer
[8];
2432 u8MacStatusAdditionalInfo
= pstrRcvdGnrlAsyncInfo
->pu8Buffer
[9];
2433 PRINT_INFO(HOSTINF_DBG
, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus
, u8MacStatusReasonCode
, u8MacStatusAdditionalInfo
);
2434 if (pstrWFIDrv
->enuHostIFstate
== HOST_IF_WAITING_CONN_RESP
) {
2435 /* our station had sent Association Request frame, so here it will get the Association Response frame then parse it */
2436 WILC_Uint32 u32RcvdAssocRespInfoLen
;
2437 tstrConnectRespInfo
*pstrConnectRespInfo
= NULL
;
2439 PRINT_D(HOSTINF_DBG
, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus
, u8MacStatusReasonCode
, u8MacStatusAdditionalInfo
);
2441 WILC_memset(&strConnectInfo
, 0, sizeof(tstrConnectInfo
));
2443 if (u8MacStatus
== MAC_CONNECTED
) {
2444 WILC_memset(gapu8RcvdAssocResp
, 0, MAX_ASSOC_RESP_FRAME_SIZE
);
2446 host_int_get_assoc_res_info((WILC_WFIDrvHandle
)pstrWFIDrv
,
2448 MAX_ASSOC_RESP_FRAME_SIZE
,
2449 &u32RcvdAssocRespInfoLen
);
2451 PRINT_INFO(HOSTINF_DBG
, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen
);
2453 if (u32RcvdAssocRespInfoLen
!= 0) {
2455 PRINT_D(HOSTINF_DBG
, "Parsing association response\n");
2456 s32Err
= ParseAssocRespInfo(gapu8RcvdAssocResp
, u32RcvdAssocRespInfoLen
,
2457 &pstrConnectRespInfo
);
2459 PRINT_ER("ParseAssocRespInfo() returned error %d \n", s32Err
);
2461 /* use the necessary parsed Info from the Received Association Response */
2462 strConnectInfo
.u16ConnectStatus
= pstrConnectRespInfo
->u16ConnectStatus
;
2464 if (strConnectInfo
.u16ConnectStatus
== SUCCESSFUL_STATUSCODE
) {
2465 PRINT_INFO(HOSTINF_DBG
, "Association response received : Successful connection status\n");
2466 if (pstrConnectRespInfo
->pu8RespIEs
!= NULL
) {
2467 strConnectInfo
.u16RespIEsLen
= pstrConnectRespInfo
->u16RespIEsLen
;
2470 strConnectInfo
.pu8RespIEs
= (u8
*)WILC_MALLOC(pstrConnectRespInfo
->u16RespIEsLen
);
2471 WILC_memcpy(strConnectInfo
.pu8RespIEs
, pstrConnectRespInfo
->pu8RespIEs
,
2472 pstrConnectRespInfo
->u16RespIEsLen
);
2476 /* deallocate the Assoc. Resp. parsed structure as it is not needed anymore */
2477 if (pstrConnectRespInfo
!= NULL
) {
2478 DeallocateAssocRespInfo(pstrConnectRespInfo
);
2479 pstrConnectRespInfo
= NULL
;
2485 /* The station has just received mac status and it also received assoc. response which
2486 * it was waiting for.
2487 * So check first the matching between the received mac status and the received status code in Asoc Resp */
2488 if ((u8MacStatus
== MAC_CONNECTED
) &&
2489 (strConnectInfo
.u16ConnectStatus
!= SUCCESSFUL_STATUSCODE
)) {
2490 PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE \n");
2491 WILC_memset(u8ConnectedSSID
, 0, ETH_ALEN
);
2493 } else if (u8MacStatus
== MAC_DISCONNECTED
) {
2494 PRINT_ER("Received MAC status is MAC_DISCONNECTED\n");
2495 WILC_memset(u8ConnectedSSID
, 0, ETH_ALEN
);
2498 /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */
2499 /* through a structure of type tstrConnectRespInfo */
2500 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
!= NULL
) {
2501 PRINT_D(HOSTINF_DBG
, "Retrieving actual BSSID from AP\n");
2502 WILC_memcpy(strConnectInfo
.au8bssid
, pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
, 6);
2504 if ((u8MacStatus
== MAC_CONNECTED
) &&
2505 (strConnectInfo
.u16ConnectStatus
== SUCCESSFUL_STATUSCODE
)) {
2506 WILC_memcpy(pstrWFIDrv
->au8AssociatedBSSID
,
2507 pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
, ETH_ALEN
);
2512 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
!= NULL
) {
2513 strConnectInfo
.ReqIEsLen
= pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
;
2514 strConnectInfo
.pu8ReqIEs
= (u8
*)WILC_MALLOC(pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
);
2515 WILC_memcpy(strConnectInfo
.pu8ReqIEs
,
2516 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
,
2517 pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
);
2521 WILC_TimerStop(&(pstrWFIDrv
->hConnectTimer
), NULL
);
2522 pstrWFIDrv
->strWILC_UsrConnReq
.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP
,
2526 pstrWFIDrv
->strWILC_UsrConnReq
.u32UserConnectPvoid
);
2529 /* if received mac status is MAC_CONNECTED and
2530 * received status code in Asoc Resp is SUCCESSFUL_STATUSCODE, change state to CONNECTED
2531 * else change state to IDLE */
2532 if ((u8MacStatus
== MAC_CONNECTED
) &&
2533 (strConnectInfo
.u16ConnectStatus
== SUCCESSFUL_STATUSCODE
)) {
2534 #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
2536 host_int_set_power_mgmt((WILC_WFIDrvHandle
)pstrWFIDrv
, 0, 0);
2539 PRINT_D(HOSTINF_DBG
, "MAC status : CONNECTED and Connect Status : Successful\n");
2540 pstrWFIDrv
->enuHostIFstate
= HOST_IF_CONNECTED
;
2542 #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
2543 PRINT_D(GENERIC_DBG
, "Obtaining an IP, Disable Scan\n");
2544 g_obtainingIP
= WILC_TRUE
;
2545 WILC_TimerStart(&hDuringIpTimer
, 10000, NULL
, NULL
);
2548 #ifdef WILC_PARSE_SCAN_IN_HOST
2549 /* open a BA session if possible */
2550 /* if(pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable) */
2554 /* host_int_addBASession(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid,0, */
2555 /* BA_SESSION_DEFAULT_BUFFER_SIZE,BA_SESSION_DEFAULT_TIMEOUT); */
2557 PRINT_D(HOSTINF_DBG
, "MAC status : %d and Connect Status : %d\n", u8MacStatus
, strConnectInfo
.u16ConnectStatus
);
2558 pstrWFIDrv
->enuHostIFstate
= HOST_IF_IDLE
;
2559 gbScanWhileConnected
= WILC_FALSE
;
2563 if (strConnectInfo
.pu8RespIEs
!= NULL
) {
2564 WILC_FREE(strConnectInfo
.pu8RespIEs
);
2565 strConnectInfo
.pu8RespIEs
= NULL
;
2568 if (strConnectInfo
.pu8ReqIEs
!= NULL
) {
2569 WILC_FREE(strConnectInfo
.pu8ReqIEs
);
2570 strConnectInfo
.pu8ReqIEs
= NULL
;
2574 pstrWFIDrv
->strWILC_UsrConnReq
.ssidLen
= 0;
2575 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
!= NULL
) {
2576 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
);
2577 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
= NULL
;
2580 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
!= NULL
) {
2581 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
);
2582 pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
= NULL
;
2585 pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
= 0;
2586 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
!= NULL
) {
2587 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
);
2588 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
= NULL
;
2591 } else if ((u8MacStatus
== MAC_DISCONNECTED
) &&
2592 (pstrWFIDrv
->enuHostIFstate
== HOST_IF_CONNECTED
)) {
2593 /* Disassociation or Deauthentication frame has been received */
2594 PRINT_D(HOSTINF_DBG
, "Received MAC_DISCONNECTED from the FW\n");
2596 WILC_memset(&strDisconnectNotifInfo
, 0, sizeof(tstrDisconnectNotifInfo
));
2598 if (pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
) {
2599 PRINT_D(HOSTINF_DBG
, "\n\n<< Abort the running OBSS Scan >> \n\n");
2600 WILC_TimerStop(&(pstrWFIDrv
->hScanTimer
), NULL
);
2601 Handle_ScanDone((void *)pstrWFIDrv
, SCAN_EVENT_ABORTED
);
2604 strDisconnectNotifInfo
.u16reason
= 0;
2605 strDisconnectNotifInfo
.ie
= NULL
;
2606 strDisconnectNotifInfo
.ie_len
= 0;
2608 if (pstrWFIDrv
->strWILC_UsrConnReq
.pfUserConnectResult
!= NULL
) {
2609 #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
2611 g_obtainingIP
= WILC_FALSE
;
2612 host_int_set_power_mgmt((WILC_WFIDrvHandle
)pstrWFIDrv
, 0, 0);
2615 pstrWFIDrv
->strWILC_UsrConnReq
.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF
,
2618 &strDisconnectNotifInfo
,
2619 pstrWFIDrv
->strWILC_UsrConnReq
.u32UserConnectPvoid
);
2622 PRINT_ER("Connect result callback function is NULL \n");
2625 WILC_memset(pstrWFIDrv
->au8AssociatedBSSID
, 0, ETH_ALEN
);
2630 /* if Information Elements were retrieved from the Received deauth/disassoc frame, then they
2631 * should be deallocated here */
2633 * if(strDisconnectNotifInfo.ie != NULL)
2635 * WILC_FREE(strDisconnectNotifInfo.ie);
2636 * strDisconnectNotifInfo.ie = NULL;
2640 pstrWFIDrv
->strWILC_UsrConnReq
.ssidLen
= 0;
2641 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
!= NULL
) {
2642 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
);
2643 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
= NULL
;
2646 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
!= NULL
) {
2647 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
);
2648 pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
= NULL
;
2651 pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
= 0;
2652 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
!= NULL
) {
2653 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
);
2654 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
= NULL
;
2658 /*Freeing flushed join request params on receiving*/
2659 /*MAC_DISCONNECTED while connected*/
2660 if (gu8FlushedJoinReq
!= NULL
&& gu8FlushedJoinReqDrvHandler
== (WILC_Uint32
)drvHandler
) {
2661 WILC_FREE(gu8FlushedJoinReq
);
2662 gu8FlushedJoinReq
= NULL
;
2664 if (gu8FlushedInfoElemAsoc
!= NULL
&& gu8FlushedJoinReqDrvHandler
== (WILC_Uint32
)drvHandler
) {
2665 WILC_FREE(gu8FlushedInfoElemAsoc
);
2666 gu8FlushedInfoElemAsoc
= NULL
;
2669 pstrWFIDrv
->enuHostIFstate
= HOST_IF_IDLE
;
2670 gbScanWhileConnected
= WILC_FALSE
;
2672 } else if ((u8MacStatus
== MAC_DISCONNECTED
) &&
2673 (pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
!= NULL
)) {
2674 PRINT_D(HOSTINF_DBG
, "Received MAC_DISCONNECTED from the FW while scanning\n");
2675 PRINT_D(HOSTINF_DBG
, "\n\n<< Abort the running Scan >> \n\n");
2676 /*Abort the running scan*/
2677 WILC_TimerStop(&(pstrWFIDrv
->hScanTimer
), NULL
);
2678 if (pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
) {
2679 Handle_ScanDone((void *)pstrWFIDrv
, SCAN_EVENT_ABORTED
);
2686 WILC_CATCH(s32Error
)
2691 /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */
2692 if (pstrRcvdGnrlAsyncInfo
->pu8Buffer
!= NULL
) {
2693 WILC_FREE(pstrRcvdGnrlAsyncInfo
->pu8Buffer
);
2694 pstrRcvdGnrlAsyncInfo
->pu8Buffer
= NULL
;
2702 * @details Sending config packet to firmware to set key
2703 * @param[in] tstrHostIFkeyAttr* pstrHostIFkeyAttr
2704 * @return Error code.
2709 static int Handle_Key(void *drvHandler
, tstrHostIFkeyAttr
*pstrHostIFkeyAttr
)
2711 WILC_Sint32 s32Error
= WILC_SUCCESS
;
2713 #ifdef WILC_AP_EXTERNAL_MLME
2714 tstrWID strWIDList
[5];
2718 WILC_Sint8 s8idxarray
[1];
2720 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
2723 switch (pstrHostIFkeyAttr
->enuKeyType
) {
2728 #ifdef WILC_AP_EXTERNAL_MLME
2729 if (pstrHostIFkeyAttr
->u8KeyAction
& ADDKEY_AP
) {
2731 PRINT_D(HOSTINF_DBG
, "Handling WEP key\n");
2732 PRINT_D(GENERIC_DBG
, "ID Hostint is %d\n", (pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8Wepidx
));
2733 strWIDList
[0].u16WIDid
= (u16
)WID_11I_MODE
;
2734 strWIDList
[0].enuWIDtype
= WID_CHAR
;
2735 strWIDList
[0].s32ValueSize
= sizeof(WILC_Char
);
2736 strWIDList
[0].ps8WidVal
= (WILC_Sint8
*)(&(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8mode
));
2738 strWIDList
[1].u16WIDid
= WID_AUTH_TYPE
;
2739 strWIDList
[1].enuWIDtype
= WID_CHAR
;
2740 strWIDList
[1].s32ValueSize
= sizeof(WILC_Char
);
2741 strWIDList
[1].ps8WidVal
= (WILC_Sint8
*)(&(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.tenuAuth_type
));
2743 strWIDList
[2].u16WIDid
= (u16
)WID_KEY_ID
;
2744 strWIDList
[2].enuWIDtype
= WID_CHAR
;
2746 strWIDList
[2].ps8WidVal
= (WILC_Sint8
*)(&(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8Wepidx
));
2747 strWIDList
[2].s32ValueSize
= sizeof(WILC_Char
);
2750 pu8keybuf
= (u8
*)WILC_MALLOC(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8WepKeylen
);
2753 if (pu8keybuf
== NULL
) {
2754 PRINT_ER("No buffer to send Key\n");
2758 WILC_memcpy(pu8keybuf
, pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.pu8WepKey
,
2759 pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8WepKeylen
);
2762 WILC_FREE(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.pu8WepKey
);
2764 strWIDList
[3].u16WIDid
= (u16
)WID_WEP_KEY_VALUE
;
2765 strWIDList
[3].enuWIDtype
= WID_STR
;
2766 strWIDList
[3].s32ValueSize
= pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8WepKeylen
;
2767 strWIDList
[3].ps8WidVal
= (WILC_Sint8
*)pu8keybuf
;
2770 s32Error
= SendConfigPkt(SET_CFG
, strWIDList
, 4, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
2771 WILC_FREE(pu8keybuf
);
2777 if (pstrHostIFkeyAttr
->u8KeyAction
& ADDKEY
) {
2778 PRINT_D(HOSTINF_DBG
, "Handling WEP key\n");
2779 pu8keybuf
= (u8
*)WILC_MALLOC(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8WepKeylen
+ 2);
2780 if (pu8keybuf
== NULL
) {
2781 PRINT_ER("No buffer to send Key\n");
2784 pu8keybuf
[0] = pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8Wepidx
;
2786 WILC_memcpy(pu8keybuf
+ 1, &pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8WepKeylen
, 1);
2788 WILC_memcpy(pu8keybuf
+ 2, pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.pu8WepKey
,
2789 pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8WepKeylen
);
2791 WILC_FREE(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.pu8WepKey
);
2793 strWID
.u16WIDid
= (u16
)WID_ADD_WEP_KEY
;
2794 strWID
.enuWIDtype
= WID_STR
;
2795 strWID
.ps8WidVal
= (WILC_Sint8
*)pu8keybuf
;
2796 strWID
.s32ValueSize
= pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8WepKeylen
+ 2;
2798 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
2799 WILC_FREE(pu8keybuf
);
2800 } else if (pstrHostIFkeyAttr
->u8KeyAction
& REMOVEKEY
) {
2802 PRINT_D(HOSTINF_DBG
, "Removing key\n");
2803 strWID
.u16WIDid
= (u16
)WID_REMOVE_WEP_KEY
;
2804 strWID
.enuWIDtype
= WID_STR
;
2806 s8idxarray
[0] = (WILC_Sint8
)pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8Wepidx
;
2807 strWID
.ps8WidVal
= s8idxarray
;
2808 strWID
.s32ValueSize
= 1;
2810 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
2812 strWID
.u16WIDid
= (u16
)WID_KEY_ID
;
2813 strWID
.enuWIDtype
= WID_CHAR
;
2814 strWID
.ps8WidVal
= (WILC_Sint8
*)(&(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwepAttr
.u8Wepidx
));
2815 strWID
.s32ValueSize
= sizeof(WILC_Char
);
2817 PRINT_D(HOSTINF_DBG
, "Setting default key index\n");
2819 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
2821 up(&(pstrWFIDrv
->hSemTestKeyBlock
));
2825 #ifdef WILC_AP_EXTERNAL_MLME
2826 if (pstrHostIFkeyAttr
->u8KeyAction
& ADDKEY_AP
) {
2827 pu8keybuf
= (u8
*)WILC_MALLOC(RX_MIC_KEY_MSG_LEN
);
2828 if (pu8keybuf
== NULL
) {
2829 PRINT_ER("No buffer to send RxGTK Key\n");
2831 goto _WPARxGtk_end_case_
;
2834 WILC_memset(pu8keybuf
, 0, RX_MIC_KEY_MSG_LEN
);
2837 /*|----------------------------------------------------------------------------|
2838 * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key |
2839 * |------------|---------|-------|------------|---------------|----------------|
2840 | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/
2844 if (pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8seq
!= NULL
)
2845 WILC_memcpy(pu8keybuf
+ 6, pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8seq
, 8);
2848 WILC_memcpy(pu8keybuf
+ 14, &pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8keyidx
, 1);
2850 WILC_memcpy(pu8keybuf
+ 15, &pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Keylen
, 1);
2852 WILC_memcpy(pu8keybuf
+ 16, pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
,
2853 pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Keylen
);
2854 /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */
2855 strWIDList
[0].u16WIDid
= (u16
)WID_11I_MODE
;
2856 strWIDList
[0].enuWIDtype
= WID_CHAR
;
2857 strWIDList
[0].s32ValueSize
= sizeof(WILC_Char
);
2858 strWIDList
[0].ps8WidVal
= (WILC_Sint8
*)(&(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Ciphermode
));
2860 strWIDList
[1].u16WIDid
= (u16
)WID_ADD_RX_GTK
;
2861 strWIDList
[1].enuWIDtype
= WID_STR
;
2862 strWIDList
[1].ps8WidVal
= (WILC_Sint8
*)pu8keybuf
;
2863 strWIDList
[1].s32ValueSize
= RX_MIC_KEY_MSG_LEN
;
2865 s32Error
= SendConfigPkt(SET_CFG
, strWIDList
, 2, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
2867 WILC_FREE(pu8keybuf
);
2869 /* ////////////////////////// */
2870 up(&(pstrWFIDrv
->hSemTestKeyBlock
));
2871 /* ///////////////////////// */
2875 if (pstrHostIFkeyAttr
->u8KeyAction
& ADDKEY
) {
2876 PRINT_D(HOSTINF_DBG
, "Handling group key(Rx) function\n");
2878 pu8keybuf
= (u8
*)WILC_MALLOC(RX_MIC_KEY_MSG_LEN
);
2879 if (pu8keybuf
== NULL
) {
2880 PRINT_ER("No buffer to send RxGTK Key\n");
2882 goto _WPARxGtk_end_case_
;
2885 WILC_memset(pu8keybuf
, 0, RX_MIC_KEY_MSG_LEN
);
2888 /*|----------------------------------------------------------------------------|
2889 * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key |
2890 * |------------|---------|-------|------------|---------------|----------------|
2891 | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/
2893 if (pstrWFIDrv
->enuHostIFstate
== HOST_IF_CONNECTED
) {
2894 WILC_memcpy(pu8keybuf
, pstrWFIDrv
->au8AssociatedBSSID
, ETH_ALEN
);
2896 PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED \n");
2899 WILC_memcpy(pu8keybuf
+ 6, pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8seq
, 8);
2901 WILC_memcpy(pu8keybuf
+ 14, &pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8keyidx
, 1);
2903 WILC_memcpy(pu8keybuf
+ 15, &pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Keylen
, 1);
2904 WILC_memcpy(pu8keybuf
+ 16, pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
,
2905 pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Keylen
);
2907 strWID
.u16WIDid
= (u16
)WID_ADD_RX_GTK
;
2908 strWID
.enuWIDtype
= WID_STR
;
2909 strWID
.ps8WidVal
= (WILC_Sint8
*)pu8keybuf
;
2910 strWID
.s32ValueSize
= RX_MIC_KEY_MSG_LEN
;
2912 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
2914 WILC_FREE(pu8keybuf
);
2916 /* ////////////////////////// */
2917 up(&(pstrWFIDrv
->hSemTestKeyBlock
));
2918 /* ///////////////////////// */
2920 _WPARxGtk_end_case_
:
2921 WILC_FREE(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
);
2922 WILC_FREE(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8seq
);
2929 #ifdef WILC_AP_EXTERNAL_MLME
2930 if (pstrHostIFkeyAttr
->u8KeyAction
& ADDKEY_AP
) {
2933 pu8keybuf
= (u8
*)WILC_MALLOC(PTK_KEY_MSG_LEN
+ 1);
2937 if (pu8keybuf
== NULL
) {
2938 PRINT_ER("No buffer to send PTK Key\n");
2940 goto _WPAPtk_end_case_
;
2944 /*|-----------------------------------------------------------------------------|
2945 * |Station address | keyidx |Key Length |Temporal Key | Rx Michael Key |Tx Michael Key |
2946 * |----------------|------------ |--------------|----------------|---------------|
2947 | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes |
2948 |-----------------------------------------------------------------------------|*/
2950 WILC_memcpy(pu8keybuf
, pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8macaddr
, 6); /*1 bytes Key Length */
2952 WILC_memcpy(pu8keybuf
+ 6, &pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8keyidx
, 1);
2953 WILC_memcpy(pu8keybuf
+ 7, &pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Keylen
, 1);
2955 WILC_memcpy(pu8keybuf
+ 8, pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
,
2956 pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Keylen
);
2959 strWIDList
[0].u16WIDid
= (u16
)WID_11I_MODE
;
2960 strWIDList
[0].enuWIDtype
= WID_CHAR
;
2961 strWIDList
[0].s32ValueSize
= sizeof(WILC_Char
);
2962 strWIDList
[0].ps8WidVal
= (WILC_Sint8
*)(&(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Ciphermode
));
2964 strWIDList
[1].u16WIDid
= (u16
)WID_ADD_PTK
;
2965 strWIDList
[1].enuWIDtype
= WID_STR
;
2966 strWIDList
[1].ps8WidVal
= (WILC_Sint8
*)pu8keybuf
;
2967 strWIDList
[1].s32ValueSize
= PTK_KEY_MSG_LEN
+ 1;
2969 s32Error
= SendConfigPkt(SET_CFG
, strWIDList
, 2, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
2970 WILC_FREE(pu8keybuf
);
2972 /* ////////////////////////// */
2973 up(&(pstrWFIDrv
->hSemTestKeyBlock
));
2974 /* ///////////////////////// */
2977 if (pstrHostIFkeyAttr
->u8KeyAction
& ADDKEY
) {
2980 pu8keybuf
= (u8
*)WILC_MALLOC(PTK_KEY_MSG_LEN
);
2984 if (pu8keybuf
== NULL
) {
2985 PRINT_ER("No buffer to send PTK Key\n");
2987 goto _WPAPtk_end_case_
;
2991 /*|-----------------------------------------------------------------------------|
2992 * |Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key |
2993 * |----------------|------------|--------------|----------------|---------------|
2994 | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes |
2995 |-----------------------------------------------------------------------------|*/
2997 WILC_memcpy(pu8keybuf
, pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8macaddr
, 6); /*1 bytes Key Length */
2999 WILC_memcpy(pu8keybuf
+ 6, &pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Keylen
, 1);
3001 WILC_memcpy(pu8keybuf
+ 7, pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
,
3002 pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Keylen
);
3005 strWID
.u16WIDid
= (u16
)WID_ADD_PTK
;
3006 strWID
.enuWIDtype
= WID_STR
;
3007 strWID
.ps8WidVal
= (WILC_Sint8
*)pu8keybuf
;
3008 strWID
.s32ValueSize
= PTK_KEY_MSG_LEN
;
3010 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
3011 WILC_FREE(pu8keybuf
);
3013 /* ////////////////////////// */
3014 up(&(pstrWFIDrv
->hSemTestKeyBlock
));
3015 /* ///////////////////////// */
3019 WILC_FREE(pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
);
3028 PRINT_D(HOSTINF_DBG
, "Handling PMKSA key\n");
3030 pu8keybuf
= (u8
*)WILC_MALLOC((pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFpmkidAttr
.numpmkid
* PMKSA_KEY_LEN
) + 1);
3031 if (pu8keybuf
== NULL
) {
3032 PRINT_ER("No buffer to send PMKSA Key\n");
3036 pu8keybuf
[0] = pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFpmkidAttr
.numpmkid
;
3038 for (i
= 0; i
< pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFpmkidAttr
.numpmkid
; i
++) {
3040 WILC_memcpy(pu8keybuf
+ ((PMKSA_KEY_LEN
* i
) + 1), pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFpmkidAttr
.pmkidlist
[i
].bssid
, ETH_ALEN
);
3041 WILC_memcpy(pu8keybuf
+ ((PMKSA_KEY_LEN
* i
) + ETH_ALEN
+ 1), pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFpmkidAttr
.pmkidlist
[i
].pmkid
, PMKID_LEN
);
3044 strWID
.u16WIDid
= (u16
)WID_PMKID_INFO
;
3045 strWID
.enuWIDtype
= WID_STR
;
3046 strWID
.ps8WidVal
= (WILC_Sint8
*)pu8keybuf
;
3047 strWID
.s32ValueSize
= (pstrHostIFkeyAttr
->uniHostIFkeyAttr
.strHostIFpmkidAttr
.numpmkid
* PMKSA_KEY_LEN
) + 1;
3049 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
3051 WILC_FREE(pu8keybuf
);
3056 PRINT_ER("Failed to send key config packet\n");
3064 * @brief Handle_Disconnect
3065 * @details Sending config packet to firmware to disconnect
3072 static void Handle_Disconnect(void *drvHandler
)
3076 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3077 u16 u16DummyReasonCode
= 0;
3078 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3081 strWID
.u16WIDid
= (u16
)WID_DISCONNECT
;
3082 strWID
.enuWIDtype
= WID_CHAR
;
3083 strWID
.ps8WidVal
= (WILC_Sint8
*)&u16DummyReasonCode
;
3084 strWID
.s32ValueSize
= sizeof(WILC_Char
);
3088 PRINT_D(HOSTINF_DBG
, "Sending disconnect request\n");
3090 #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
3092 g_obtainingIP
= WILC_FALSE
;
3093 host_int_set_power_mgmt((WILC_WFIDrvHandle
)pstrWFIDrv
, 0, 0);
3096 WILC_memset(u8ConnectedSSID
, 0, ETH_ALEN
);
3098 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_FALSE
, (WILC_Uint32
)pstrWFIDrv
);
3101 PRINT_ER("Failed to send dissconect config packet\n");
3102 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3104 tstrDisconnectNotifInfo strDisconnectNotifInfo
;
3106 WILC_memset(&strDisconnectNotifInfo
, 0, sizeof(tstrDisconnectNotifInfo
));
3108 strDisconnectNotifInfo
.u16reason
= 0;
3109 strDisconnectNotifInfo
.ie
= NULL
;
3110 strDisconnectNotifInfo
.ie_len
= 0;
3112 if (pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
) {
3113 WILC_TimerStop(&(pstrWFIDrv
->hScanTimer
), NULL
);
3114 pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult(SCAN_EVENT_ABORTED
, NULL
,
3115 pstrWFIDrv
->strWILC_UsrScanReq
.u32UserScanPvoid
, NULL
);
3117 pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
= NULL
;
3120 if (pstrWFIDrv
->strWILC_UsrConnReq
.pfUserConnectResult
!= NULL
) {
3123 /*Stop connect timer, if connection in progress*/
3124 if (pstrWFIDrv
->enuHostIFstate
== HOST_IF_WAITING_CONN_RESP
) {
3125 PRINT_D(HOSTINF_DBG
, "Upper layer requested termination of connection\n");
3126 WILC_TimerStop(&(pstrWFIDrv
->hConnectTimer
), NULL
);
3129 pstrWFIDrv
->strWILC_UsrConnReq
.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF
, NULL
,
3130 0, &strDisconnectNotifInfo
, pstrWFIDrv
->strWILC_UsrConnReq
.u32UserConnectPvoid
);
3132 PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL \n");
3135 gbScanWhileConnected
= WILC_FALSE
;
3137 pstrWFIDrv
->enuHostIFstate
= HOST_IF_IDLE
;
3139 WILC_memset(pstrWFIDrv
->au8AssociatedBSSID
, 0, ETH_ALEN
);
3143 pstrWFIDrv
->strWILC_UsrConnReq
.ssidLen
= 0;
3144 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
!= NULL
) {
3145 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
);
3146 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ssid
= NULL
;
3149 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
!= NULL
) {
3150 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
);
3151 pstrWFIDrv
->strWILC_UsrConnReq
.pu8bssid
= NULL
;
3154 pstrWFIDrv
->strWILC_UsrConnReq
.ConnReqIEsLen
= 0;
3155 if (pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
!= NULL
) {
3156 WILC_FREE(pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
);
3157 pstrWFIDrv
->strWILC_UsrConnReq
.pu8ConnReqIEs
= NULL
;
3162 if (gu8FlushedJoinReq
!= NULL
&& gu8FlushedJoinReqDrvHandler
== (WILC_Uint32
)drvHandler
) {
3163 WILC_FREE(gu8FlushedJoinReq
);
3164 gu8FlushedJoinReq
= NULL
;
3166 if (gu8FlushedInfoElemAsoc
!= NULL
&& gu8FlushedJoinReqDrvHandler
== (WILC_Uint32
)drvHandler
) {
3167 WILC_FREE(gu8FlushedInfoElemAsoc
);
3168 gu8FlushedInfoElemAsoc
= NULL
;
3173 WILC_CATCH(s32Error
)
3178 /* ////////////////////////// */
3179 up(&(pstrWFIDrv
->hSemTestDisconnectBlock
));
3180 /* ///////////////////////// */
3185 void resolve_disconnect_aberration(void *drvHandler
)
3187 tstrWILC_WFIDrv
*pstrWFIDrv
;
3189 pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3190 if (pstrWFIDrv
== NULL
)
3192 if ((pstrWFIDrv
->enuHostIFstate
== HOST_IF_WAITING_CONN_RESP
) || (pstrWFIDrv
->enuHostIFstate
== HOST_IF_CONNECTING
)) {
3193 PRINT_D(HOSTINF_DBG
, "\n\n<< correcting Supplicant state machine >>\n\n");
3194 host_int_disconnect((WILC_WFIDrvHandle
)pstrWFIDrv
, 1);
3197 static WILC_Sint32
Switch_Log_Terminal(void *drvHandler
)
3201 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3203 static char dummy
= 9;
3204 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3206 strWID
.u16WIDid
= (u16
)WID_LOGTerminal_Switch
;
3207 strWID
.enuWIDtype
= WID_CHAR
;
3208 strWID
.ps8WidVal
= &dummy
;
3209 strWID
.s32ValueSize
= sizeof(WILC_Char
);
3211 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
3215 PRINT_D(HOSTINF_DBG
, "Failed to switch log terminal\n");
3216 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
3218 PRINT_INFO(HOSTINF_DBG
, "MAC address set :: \n");
3223 WILC_CATCH(s32Error
)
3232 * @brief Handle_GetChnl
3233 * @details Sending config packet to get channel
3241 static WILC_Sint32
Handle_GetChnl(void *drvHandler
)
3244 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3246 /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
3247 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3248 strWID
.u16WIDid
= (u16
)WID_CURRENT_CHANNEL
;
3249 strWID
.enuWIDtype
= WID_CHAR
;
3250 strWID
.ps8WidVal
= (WILC_Sint8
*)&gu8Chnl
;
3251 strWID
.s32ValueSize
= sizeof(WILC_Char
);
3253 PRINT_D(HOSTINF_DBG
, "Getting channel value\n");
3255 s32Error
= SendConfigPkt(GET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
3256 /*get the value by searching the local copy*/
3258 PRINT_ER("Failed to get channel number\n");
3259 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3263 WILC_CATCH(s32Error
)
3267 up(&(pstrWFIDrv
->hSemGetCHNL
));
3277 * @brief Handle_GetRssi
3278 * @details Sending config packet to get RSSI
3285 static void Handle_GetRssi(void *drvHandler
)
3287 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3289 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3291 strWID
.u16WIDid
= (u16
)WID_RSSI
;
3292 strWID
.enuWIDtype
= WID_CHAR
;
3293 strWID
.ps8WidVal
= &gs8Rssi
;
3294 strWID
.s32ValueSize
= sizeof(WILC_Char
);
3297 PRINT_D(HOSTINF_DBG
, "Getting RSSI value\n");
3299 s32Error
= SendConfigPkt(GET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
3301 PRINT_ER("Failed to get RSSI value\n");
3302 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3305 WILC_CATCH(s32Error
)
3309 up(&(pstrWFIDrv
->hSemGetRSSI
));
3315 static void Handle_GetLinkspeed(void *drvHandler
)
3317 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3319 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3323 strWID
.u16WIDid
= (u16
)WID_LINKSPEED
;
3324 strWID
.enuWIDtype
= WID_CHAR
;
3325 strWID
.ps8WidVal
= &gs8lnkspd
;
3326 strWID
.s32ValueSize
= sizeof(WILC_Char
);
3328 PRINT_D(HOSTINF_DBG
, "Getting LINKSPEED value\n");
3330 s32Error
= SendConfigPkt(GET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
3332 PRINT_ER("Failed to get LINKSPEED value\n");
3333 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3336 WILC_CATCH(s32Error
)
3340 up(&(pstrWFIDrv
->hSemGetLINKSPEED
));
3345 WILC_Sint32
Handle_GetStatistics(void *drvHandler
, tstrStatistics
*pstrStatistics
)
3347 tstrWID strWIDList
[5];
3348 uint32_t u32WidsCount
= 0, s32Error
= 0;
3350 strWIDList
[u32WidsCount
].u16WIDid
= WID_LINKSPEED
;
3351 strWIDList
[u32WidsCount
].enuWIDtype
= WID_CHAR
;
3352 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Char
);
3353 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(pstrStatistics
->u8LinkSpeed
));
3356 strWIDList
[u32WidsCount
].u16WIDid
= WID_RSSI
;
3357 strWIDList
[u32WidsCount
].enuWIDtype
= WID_CHAR
;
3358 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Char
);
3359 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(pstrStatistics
->s8RSSI
));
3362 strWIDList
[u32WidsCount
].u16WIDid
= WID_SUCCESS_FRAME_COUNT
;
3363 strWIDList
[u32WidsCount
].enuWIDtype
= WID_INT
;
3364 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Uint32
);
3365 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(pstrStatistics
->u32TxCount
));
3368 strWIDList
[u32WidsCount
].u16WIDid
= WID_RECEIVED_FRAGMENT_COUNT
;
3369 strWIDList
[u32WidsCount
].enuWIDtype
= WID_INT
;
3370 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Uint32
);
3371 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(pstrStatistics
->u32RxCount
));
3374 strWIDList
[u32WidsCount
].u16WIDid
= WID_FAILED_COUNT
;
3375 strWIDList
[u32WidsCount
].enuWIDtype
= WID_INT
;
3376 strWIDList
[u32WidsCount
].s32ValueSize
= sizeof(WILC_Uint32
);
3377 strWIDList
[u32WidsCount
].ps8WidVal
= (WILC_Sint8
*)(&(pstrStatistics
->u32TxFailureCount
));
3380 s32Error
= SendConfigPkt(GET_CFG
, strWIDList
, u32WidsCount
, WILC_FALSE
, (WILC_Uint32
)drvHandler
);
3383 PRINT_ER("Failed to send scan paramters config packet\n");
3384 /* WILC_ERRORREPORT(s32Error, s32Error); */
3392 #ifdef WILC_AP_EXTERNAL_MLME
3396 * @brief Handle_Get_InActiveTime
3397 * @details Sending config packet to set mac adddress for station and
3406 static WILC_Sint32
Handle_Get_InActiveTime(void *drvHandler
, tstrHostIfStaInactiveT
*strHostIfStaInactiveT
)
3409 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3412 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3415 strWID
.u16WIDid
= (u16
)WID_SET_STA_MAC_INACTIVE_TIME
;
3416 strWID
.enuWIDtype
= WID_STR
;
3417 strWID
.s32ValueSize
= ETH_ALEN
;
3418 strWID
.ps8WidVal
= (u8
*)WILC_MALLOC(strWID
.s32ValueSize
);
3421 stamac
= strWID
.ps8WidVal
;
3422 WILC_memcpy(stamac
, strHostIfStaInactiveT
->mac
, ETH_ALEN
);
3425 PRINT_D(CFG80211_DBG
, "SETING STA inactive time\n");
3428 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
3429 /*get the value by searching the local copy*/
3431 PRINT_ER("Failed to SET incative time\n");
3432 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3436 strWID
.u16WIDid
= (u16
)WID_GET_INACTIVE_TIME
;
3437 strWID
.enuWIDtype
= WID_INT
;
3438 strWID
.ps8WidVal
= (WILC_Sint8
*)&gu32InactiveTime
;
3439 strWID
.s32ValueSize
= sizeof(WILC_Uint32
);
3442 s32Error
= SendConfigPkt(GET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
3443 /*get the value by searching the local copy*/
3445 PRINT_ER("Failed to get incative time\n");
3446 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3450 PRINT_D(CFG80211_DBG
, "Getting inactive time : %d\n", gu32InactiveTime
);
3452 up(&(pstrWFIDrv
->hSemInactiveTime
));
3453 WILC_CATCH(s32Error
)
3467 * @brief Handle_AddBeacon
3468 * @details Sending config packet to add beacon
3469 * @param[in] tstrHostIFSetBeacon* pstrSetBeaconParam
3475 static void Handle_AddBeacon(void *drvHandler
, tstrHostIFSetBeacon
*pstrSetBeaconParam
)
3477 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3480 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3481 PRINT_D(HOSTINF_DBG
, "Adding BEACON\n");
3483 strWID
.u16WIDid
= (u16
)WID_ADD_BEACON
;
3484 strWID
.enuWIDtype
= WID_BIN
;
3485 strWID
.s32ValueSize
= pstrSetBeaconParam
->u32HeadLen
+ pstrSetBeaconParam
->u32TailLen
+ 16;
3486 strWID
.ps8WidVal
= WILC_MALLOC(strWID
.s32ValueSize
);
3487 if (strWID
.ps8WidVal
== NULL
) {
3488 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
3491 pu8CurrByte
= strWID
.ps8WidVal
;
3492 *pu8CurrByte
++ = (pstrSetBeaconParam
->u32Interval
& 0xFF);
3493 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32Interval
>> 8) & 0xFF);
3494 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32Interval
>> 16) & 0xFF);
3495 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32Interval
>> 24) & 0xFF);
3497 *pu8CurrByte
++ = (pstrSetBeaconParam
->u32DTIMPeriod
& 0xFF);
3498 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32DTIMPeriod
>> 8) & 0xFF);
3499 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32DTIMPeriod
>> 16) & 0xFF);
3500 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32DTIMPeriod
>> 24) & 0xFF);
3502 *pu8CurrByte
++ = (pstrSetBeaconParam
->u32HeadLen
& 0xFF);
3503 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32HeadLen
>> 8) & 0xFF);
3504 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32HeadLen
>> 16) & 0xFF);
3505 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32HeadLen
>> 24) & 0xFF);
3507 memcpy(pu8CurrByte
, pstrSetBeaconParam
->pu8Head
, pstrSetBeaconParam
->u32HeadLen
);
3508 pu8CurrByte
+= pstrSetBeaconParam
->u32HeadLen
;
3510 *pu8CurrByte
++ = (pstrSetBeaconParam
->u32TailLen
& 0xFF);
3511 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32TailLen
>> 8) & 0xFF);
3512 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32TailLen
>> 16) & 0xFF);
3513 *pu8CurrByte
++ = ((pstrSetBeaconParam
->u32TailLen
>> 24) & 0xFF);
3515 /* Bug 4599 : if tail length = 0 skip copying */
3516 if (pstrSetBeaconParam
->pu8Tail
> 0)
3517 memcpy(pu8CurrByte
, pstrSetBeaconParam
->pu8Tail
, pstrSetBeaconParam
->u32TailLen
);
3518 pu8CurrByte
+= pstrSetBeaconParam
->u32TailLen
;
3523 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_FALSE
, (WILC_Uint32
)pstrWFIDrv
);
3525 PRINT_ER("Failed to send add beacon config packet\n");
3526 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3529 WILC_CATCH(s32Error
)
3532 WILC_FREE_IF_TRUE(strWID
.ps8WidVal
);
3533 WILC_FREE_IF_TRUE(pstrSetBeaconParam
->pu8Head
);
3534 WILC_FREE_IF_TRUE(pstrSetBeaconParam
->pu8Tail
);
3539 * @brief Handle_AddBeacon
3540 * @details Sending config packet to delete beacon
3541 * @param[in] tstrHostIFDelBeacon* pstrDelBeacon
3547 static void Handle_DelBeacon(void *drvHandler
, tstrHostIFDelBeacon
*pstrDelBeacon
)
3549 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3552 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3553 strWID
.u16WIDid
= (u16
)WID_DEL_BEACON
;
3554 strWID
.enuWIDtype
= WID_CHAR
;
3555 strWID
.s32ValueSize
= sizeof(WILC_Char
);
3556 strWID
.ps8WidVal
= &gu8DelBcn
;
3558 if (strWID
.ps8WidVal
== NULL
) {
3559 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
3562 pu8CurrByte
= strWID
.ps8WidVal
;
3564 PRINT_D(HOSTINF_DBG
, "Deleting BEACON\n");
3565 /* TODO: build del beacon message*/
3568 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_FALSE
, (WILC_Uint32
)pstrWFIDrv
);
3571 PRINT_ER("Failed to send delete beacon config packet\n");
3572 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3575 WILC_CATCH(s32Error
)
3582 * @brief WILC_HostIf_PackStaParam
3583 * @details Handling packing of the station params in a buffer
3584 * @param[in] u8* pu8Buffer, tstrWILC_AddStaParam* pstrStationParam
3590 static WILC_Uint32
WILC_HostIf_PackStaParam(u8
*pu8Buffer
, tstrWILC_AddStaParam
*pstrStationParam
)
3594 pu8CurrByte
= pu8Buffer
;
3596 PRINT_D(HOSTINF_DBG
, "Packing STA params\n");
3597 WILC_memcpy(pu8CurrByte
, pstrStationParam
->au8BSSID
, ETH_ALEN
);
3598 pu8CurrByte
+= ETH_ALEN
;
3600 *pu8CurrByte
++ = pstrStationParam
->u16AssocID
& 0xFF;
3601 *pu8CurrByte
++ = (pstrStationParam
->u16AssocID
>> 8) & 0xFF;
3603 *pu8CurrByte
++ = pstrStationParam
->u8NumRates
;
3604 if (pstrStationParam
->u8NumRates
> 0) {
3605 WILC_memcpy(pu8CurrByte
, pstrStationParam
->pu8Rates
, pstrStationParam
->u8NumRates
);
3607 pu8CurrByte
+= pstrStationParam
->u8NumRates
;
3609 *pu8CurrByte
++ = pstrStationParam
->bIsHTSupported
;
3610 *pu8CurrByte
++ = pstrStationParam
->u16HTCapInfo
& 0xFF;
3611 *pu8CurrByte
++ = (pstrStationParam
->u16HTCapInfo
>> 8) & 0xFF;
3613 *pu8CurrByte
++ = pstrStationParam
->u8AmpduParams
;
3614 WILC_memcpy(pu8CurrByte
, pstrStationParam
->au8SuppMCsSet
, WILC_SUPP_MCS_SET_SIZE
);
3615 pu8CurrByte
+= WILC_SUPP_MCS_SET_SIZE
;
3617 *pu8CurrByte
++ = pstrStationParam
->u16HTExtParams
& 0xFF;
3618 *pu8CurrByte
++ = (pstrStationParam
->u16HTExtParams
>> 8) & 0xFF;
3620 *pu8CurrByte
++ = pstrStationParam
->u32TxBeamformingCap
& 0xFF;
3621 *pu8CurrByte
++ = (pstrStationParam
->u32TxBeamformingCap
>> 8) & 0xFF;
3622 *pu8CurrByte
++ = (pstrStationParam
->u32TxBeamformingCap
>> 16) & 0xFF;
3623 *pu8CurrByte
++ = (pstrStationParam
->u32TxBeamformingCap
>> 24) & 0xFF;
3625 *pu8CurrByte
++ = pstrStationParam
->u8ASELCap
;
3627 *pu8CurrByte
++ = pstrStationParam
->u16FlagsMask
& 0xFF;
3628 *pu8CurrByte
++ = (pstrStationParam
->u16FlagsMask
>> 8) & 0xFF;
3630 *pu8CurrByte
++ = pstrStationParam
->u16FlagsSet
& 0xFF;
3631 *pu8CurrByte
++ = (pstrStationParam
->u16FlagsSet
>> 8) & 0xFF;
3633 return pu8CurrByte
- pu8Buffer
;
3637 * @brief Handle_AddStation
3638 * @details Sending config packet to add station
3639 * @param[in] tstrWILC_AddStaParam* pstrStationParam
3645 static void Handle_AddStation(void *drvHandler
, tstrWILC_AddStaParam
*pstrStationParam
)
3647 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3650 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3651 PRINT_D(HOSTINF_DBG
, "Handling add station\n");
3652 strWID
.u16WIDid
= (u16
)WID_ADD_STA
;
3653 strWID
.enuWIDtype
= WID_BIN
;
3654 strWID
.s32ValueSize
= WILC_ADD_STA_LENGTH
+ pstrStationParam
->u8NumRates
;
3656 strWID
.ps8WidVal
= WILC_MALLOC(strWID
.s32ValueSize
);
3657 if (strWID
.ps8WidVal
== NULL
) {
3658 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
3661 pu8CurrByte
= strWID
.ps8WidVal
;
3662 pu8CurrByte
+= WILC_HostIf_PackStaParam(pu8CurrByte
, pstrStationParam
);
3665 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_FALSE
, (WILC_Uint32
)pstrWFIDrv
);
3666 if (s32Error
!= WILC_SUCCESS
) {
3668 PRINT_ER("Failed to send add station config packet\n");
3669 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3672 WILC_CATCH(s32Error
)
3675 WILC_FREE_IF_TRUE(pstrStationParam
->pu8Rates
);
3676 WILC_FREE_IF_TRUE(strWID
.ps8WidVal
);
3680 * @brief Handle_DelAllSta
3681 * @details Sending config packet to delete station
3682 * @param[in] tstrHostIFDelSta* pstrDelStaParam
3688 static void Handle_DelAllSta(void *drvHandler
, tstrHostIFDelAllSta
*pstrDelAllStaParam
)
3690 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3693 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3695 u8 au8Zero_Buff
[6] = {0};
3696 strWID
.u16WIDid
= (u16
)WID_DEL_ALL_STA
;
3697 strWID
.enuWIDtype
= WID_STR
;
3698 strWID
.s32ValueSize
= (pstrDelAllStaParam
->u8Num_AssocSta
* ETH_ALEN
) + 1;
3700 PRINT_D(HOSTINF_DBG
, "Handling delete station \n");
3702 strWID
.ps8WidVal
= WILC_MALLOC((pstrDelAllStaParam
->u8Num_AssocSta
* ETH_ALEN
) + 1);
3703 if (strWID
.ps8WidVal
== NULL
) {
3704 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
3707 pu8CurrByte
= strWID
.ps8WidVal
;
3709 *(pu8CurrByte
++) = pstrDelAllStaParam
->u8Num_AssocSta
;
3711 for (i
= 0; i
< MAX_NUM_STA
; i
++) {
3712 if (memcmp(pstrDelAllStaParam
->au8Sta_DelAllSta
[i
], au8Zero_Buff
, ETH_ALEN
))
3713 WILC_memcpy(pu8CurrByte
, pstrDelAllStaParam
->au8Sta_DelAllSta
[i
], ETH_ALEN
);
3717 pu8CurrByte
+= ETH_ALEN
;
3721 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
3724 PRINT_ER("Failed to send add station config packe\n");
3725 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3728 WILC_CATCH(s32Error
)
3731 WILC_FREE_IF_TRUE(strWID
.ps8WidVal
);
3738 * @brief Handle_DelStation
3739 * @details Sending config packet to delete station
3740 * @param[in] tstrHostIFDelSta* pstrDelStaParam
3746 static void Handle_DelStation(void *drvHandler
, tstrHostIFDelSta
*pstrDelStaParam
)
3748 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3751 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3753 strWID
.u16WIDid
= (u16
)WID_REMOVE_STA
;
3754 strWID
.enuWIDtype
= WID_BIN
;
3755 strWID
.s32ValueSize
= ETH_ALEN
;
3757 PRINT_D(HOSTINF_DBG
, "Handling delete station \n");
3759 strWID
.ps8WidVal
= WILC_MALLOC(strWID
.s32ValueSize
);
3760 if (strWID
.ps8WidVal
== NULL
) {
3761 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
3764 pu8CurrByte
= strWID
.ps8WidVal
;
3766 WILC_memcpy(pu8CurrByte
, pstrDelStaParam
->au8MacAddr
, ETH_ALEN
);
3769 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_FALSE
, (WILC_Uint32
)pstrWFIDrv
);
3772 PRINT_ER("Failed to send add station config packe\n");
3773 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3776 WILC_CATCH(s32Error
)
3779 WILC_FREE_IF_TRUE(strWID
.ps8WidVal
);
3784 * @brief Handle_EditStation
3785 * @details Sending config packet to edit station
3786 * @param[in] tstrWILC_AddStaParam* pstrStationParam
3792 static void Handle_EditStation(void *drvHandler
, tstrWILC_AddStaParam
*pstrStationParam
)
3794 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3797 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3799 strWID
.u16WIDid
= (u16
)WID_EDIT_STA
;
3800 strWID
.enuWIDtype
= WID_BIN
;
3801 strWID
.s32ValueSize
= WILC_ADD_STA_LENGTH
+ pstrStationParam
->u8NumRates
;
3803 PRINT_D(HOSTINF_DBG
, "Handling edit station\n");
3804 strWID
.ps8WidVal
= WILC_MALLOC(strWID
.s32ValueSize
);
3805 if (strWID
.ps8WidVal
== NULL
) {
3806 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
3809 pu8CurrByte
= strWID
.ps8WidVal
;
3810 pu8CurrByte
+= WILC_HostIf_PackStaParam(pu8CurrByte
, pstrStationParam
);
3813 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_FALSE
, (WILC_Uint32
)pstrWFIDrv
);
3816 PRINT_ER("Failed to send edit station config packet\n");
3817 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
3820 WILC_CATCH(s32Error
)
3823 WILC_FREE_IF_TRUE(pstrStationParam
->pu8Rates
);
3824 WILC_FREE_IF_TRUE(strWID
.ps8WidVal
);
3826 #endif /*WILC_AP_EXTERNAL_MLME*/
3830 * @brief Handle_RemainOnChan
3831 * @details Sending config packet to edit station
3832 * @param[in] tstrWILC_AddStaParam* pstrStationParam
3838 static int Handle_RemainOnChan(void *drvHandler
, tstrHostIfRemainOnChan
*pstrHostIfRemainOnChan
)
3840 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3841 u8 u8remain_on_chan_flag
;
3843 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*) drvHandler
;
3845 /*If it's a pendig remain-on-channel, don't overwrite gWFiDrvHandle values (since incoming msg is garbbage)*/
3846 if (!pstrWFIDrv
->u8RemainOnChan_pendingreq
) {
3847 pstrWFIDrv
->strHostIfRemainOnChan
.pVoid
= pstrHostIfRemainOnChan
->pVoid
;
3848 pstrWFIDrv
->strHostIfRemainOnChan
.pRemainOnChanExpired
= pstrHostIfRemainOnChan
->pRemainOnChanExpired
;
3849 pstrWFIDrv
->strHostIfRemainOnChan
.pRemainOnChanReady
= pstrHostIfRemainOnChan
->pRemainOnChanReady
;
3850 pstrWFIDrv
->strHostIfRemainOnChan
.u16Channel
= pstrHostIfRemainOnChan
->u16Channel
;
3851 pstrWFIDrv
->strHostIfRemainOnChan
.u32ListenSessionID
= pstrHostIfRemainOnChan
->u32ListenSessionID
;
3853 /*Set the channel to use it as a wid val*/
3854 pstrHostIfRemainOnChan
->u16Channel
= pstrWFIDrv
->strHostIfRemainOnChan
.u16Channel
;
3857 if (pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
!= NULL
) {
3858 PRINT_INFO(GENERIC_DBG
, "Required to remain on chan while scanning return\n");
3859 pstrWFIDrv
->u8RemainOnChan_pendingreq
= 1;
3860 WILC_ERRORREPORT(s32Error
, WILC_BUSY
);
3862 if (pstrWFIDrv
->enuHostIFstate
== HOST_IF_WAITING_CONN_RESP
) {
3863 PRINT_INFO(GENERIC_DBG
, "Required to remain on chan while connecting return\n");
3864 WILC_ERRORREPORT(s32Error
, WILC_BUSY
);
3867 #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
3868 if (g_obtainingIP
|| connecting
) {
3869 PRINT_D(GENERIC_DBG
, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
3870 WILC_ERRORREPORT(s32Error
, WILC_BUSY
);
3874 PRINT_D(HOSTINF_DBG
, "Setting channel :%d\n", pstrHostIfRemainOnChan
->u16Channel
);
3876 u8remain_on_chan_flag
= WILC_TRUE
;
3877 strWID
.u16WIDid
= (u16
)WID_REMAIN_ON_CHAN
;
3878 strWID
.enuWIDtype
= WID_STR
;
3879 strWID
.s32ValueSize
= 2;
3880 strWID
.ps8WidVal
= (WILC_Sint8
*)WILC_MALLOC(strWID
.s32ValueSize
);
3882 if (strWID
.ps8WidVal
== NULL
) {
3883 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
3886 strWID
.ps8WidVal
[0] = u8remain_on_chan_flag
;
3887 strWID
.ps8WidVal
[1] = (WILC_Sint8
)pstrHostIfRemainOnChan
->u16Channel
;
3890 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
3891 if (s32Error
!= WILC_SUCCESS
) {
3892 PRINT_ER("Failed to set remain on channel\n");
3897 P2P_LISTEN_STATE
= 1;
3898 WILC_TimerStart(&(pstrWFIDrv
->hRemainOnChannel
), pstrHostIfRemainOnChan
->u32duration
, (void *)pstrWFIDrv
, NULL
);
3900 /*Calling CFG ready_on_channel*/
3901 if (pstrWFIDrv
->strHostIfRemainOnChan
.pRemainOnChanReady
) {
3902 pstrWFIDrv
->strHostIfRemainOnChan
.pRemainOnChanReady(pstrWFIDrv
->strHostIfRemainOnChan
.pVoid
);
3905 if (pstrWFIDrv
->u8RemainOnChan_pendingreq
)
3906 pstrWFIDrv
->u8RemainOnChan_pendingreq
= 0;
3912 * @brief Handle_RegisterFrame
3920 static int Handle_RegisterFrame(void *drvHandler
, tstrHostIfRegisterFrame
*pstrHostIfRegisterFrame
)
3922 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3925 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
3927 PRINT_D(HOSTINF_DBG
, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame
->bReg
, pstrHostIfRegisterFrame
->u16FrameType
);
3929 /*prepare configuration packet*/
3930 strWID
.u16WIDid
= (u16
)WID_REGISTER_FRAME
;
3931 strWID
.enuWIDtype
= WID_STR
;
3932 strWID
.ps8WidVal
= WILC_MALLOC(sizeof(u16
) + 2);
3933 if (strWID
.ps8WidVal
== NULL
) {
3934 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
3937 pu8CurrByte
= strWID
.ps8WidVal
;
3939 *pu8CurrByte
++ = pstrHostIfRegisterFrame
->bReg
;
3940 *pu8CurrByte
++ = pstrHostIfRegisterFrame
->u8Regid
;
3941 WILC_memcpy(pu8CurrByte
, &(pstrHostIfRegisterFrame
->u16FrameType
), sizeof(u16
));
3944 strWID
.s32ValueSize
= sizeof(u16
) + 2;
3948 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
3950 PRINT_ER("Failed to frame register config packet\n");
3951 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
3955 WILC_CATCH(s32Error
)
3964 * @brief Handle_ListenStateExpired
3965 * @details Handle of listen state expiration
3967 * @return Error code.
3972 #define FALSE_FRMWR_CHANNEL 100
3973 static WILC_Uint32
Handle_ListenStateExpired(void *drvHandler
, tstrHostIfRemainOnChan
*pstrHostIfRemainOnChan
)
3975 u8 u8remain_on_chan_flag
;
3977 WILC_Sint32 s32Error
= WILC_SUCCESS
;
3978 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*) drvHandler
;
3980 PRINT_D(HOSTINF_DBG
, "CANCEL REMAIN ON CHAN\n");
3983 /*Make sure we are already in listen state*/
3984 /*This is to handle duplicate expiry messages (listen timer fired and supplicant called cancel_remain_on_channel())*/
3985 if (P2P_LISTEN_STATE
) {
3986 u8remain_on_chan_flag
= WILC_FALSE
;
3987 strWID
.u16WIDid
= (u16
)WID_REMAIN_ON_CHAN
;
3988 strWID
.enuWIDtype
= WID_STR
;
3989 strWID
.s32ValueSize
= 2;
3990 strWID
.ps8WidVal
= WILC_MALLOC(strWID
.s32ValueSize
);
3992 if (strWID
.ps8WidVal
== NULL
) {
3993 PRINT_ER("Failed to allocate memory\n");
3996 strWID
.ps8WidVal
[0] = u8remain_on_chan_flag
;
3997 strWID
.ps8WidVal
[1] = FALSE_FRMWR_CHANNEL
;
4000 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
4001 if (s32Error
!= WILC_SUCCESS
) {
4002 PRINT_ER("Failed to set remain on channel\n");
4006 if (pstrWFIDrv
->strHostIfRemainOnChan
.pRemainOnChanExpired
) {
4007 pstrWFIDrv
->strHostIfRemainOnChan
.pRemainOnChanExpired(pstrWFIDrv
->strHostIfRemainOnChan
.pVoid
4008 , pstrHostIfRemainOnChan
->u32ListenSessionID
);
4010 P2P_LISTEN_STATE
= 0;
4012 PRINT_D(GENERIC_DBG
, "Not in listen state\n");
4013 s32Error
= WILC_FAIL
;
4022 * @brief ListenTimerCB
4023 * @details Callback function of remain-on-channel timer
4025 * @return Error code.
4030 static void ListenTimerCB(void *pvArg
)
4032 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4033 tstrHostIFmsg strHostIFmsg
;
4034 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)pvArg
;
4035 /*Stopping remain-on-channel timer*/
4036 WILC_TimerStop(&(pstrWFIDrv
->hRemainOnChannel
), NULL
);
4038 /* prepare the Timer Callback message */
4039 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
4040 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_LISTEN_TIMER_FIRED
;
4041 strHostIFmsg
.drvHandler
= pstrWFIDrv
;
4042 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRemainOnChan
.u32ListenSessionID
= pstrWFIDrv
->strHostIfRemainOnChan
.u32ListenSessionID
;
4044 /* send the message */
4045 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
4047 WILC_ERRORREPORT(s32Error
, s32Error
);
4049 WILC_CATCH(s32Error
)
4058 * @brief Handle_EditStation
4059 * @details Sending config packet to edit station
4060 * @param[in] tstrWILC_AddStaParam* pstrStationParam
4066 static void Handle_PowerManagement(void *drvHandler
, tstrHostIfPowerMgmtParam
*strPowerMgmtParam
)
4068 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4070 WILC_Sint8 s8PowerMode
;
4071 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
4072 strWID
.u16WIDid
= (u16
)WID_POWER_MANAGEMENT
;
4074 if (strPowerMgmtParam
->bIsEnabled
== WILC_TRUE
) {
4075 s8PowerMode
= MIN_FAST_PS
;
4077 s8PowerMode
= NO_POWERSAVE
;
4079 PRINT_D(HOSTINF_DBG
, "Handling power mgmt to %d\n", s8PowerMode
);
4080 strWID
.ps8WidVal
= &s8PowerMode
;
4081 strWID
.s32ValueSize
= sizeof(WILC_Char
);
4083 PRINT_D(HOSTINF_DBG
, "Handling Power Management\n");
4086 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
4088 PRINT_ER("Failed to send power management config packet\n");
4089 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
4092 WILC_CATCH(s32Error
)
4099 * @brief Handle_SetMulticastFilter
4100 * @details Set Multicast filter in firmware
4101 * @param[in] tstrHostIFSetMulti* strHostIfSetMulti
4107 static void Handle_SetMulticastFilter(void *drvHandler
, tstrHostIFSetMulti
*strHostIfSetMulti
)
4109 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4113 PRINT_D(HOSTINF_DBG
, "Setup Multicast Filter\n");
4115 strWID
.u16WIDid
= (u16
)WID_SETUP_MULTICAST_FILTER
;
4116 strWID
.enuWIDtype
= WID_BIN
;
4117 strWID
.s32ValueSize
= sizeof(tstrHostIFSetMulti
) + ((strHostIfSetMulti
->u32count
) * ETH_ALEN
);
4118 strWID
.ps8WidVal
= WILC_MALLOC(strWID
.s32ValueSize
);
4119 if (strWID
.ps8WidVal
== NULL
) {
4120 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
4123 pu8CurrByte
= strWID
.ps8WidVal
;
4124 *pu8CurrByte
++ = (strHostIfSetMulti
->bIsEnabled
& 0xFF);
4125 *pu8CurrByte
++ = ((strHostIfSetMulti
->bIsEnabled
>> 8) & 0xFF);
4126 *pu8CurrByte
++ = ((strHostIfSetMulti
->bIsEnabled
>> 16) & 0xFF);
4127 *pu8CurrByte
++ = ((strHostIfSetMulti
->bIsEnabled
>> 24) & 0xFF);
4129 *pu8CurrByte
++ = (strHostIfSetMulti
->u32count
& 0xFF);
4130 *pu8CurrByte
++ = ((strHostIfSetMulti
->u32count
>> 8) & 0xFF);
4131 *pu8CurrByte
++ = ((strHostIfSetMulti
->u32count
>> 16) & 0xFF);
4132 *pu8CurrByte
++ = ((strHostIfSetMulti
->u32count
>> 24) & 0xFF);
4134 if ((strHostIfSetMulti
->u32count
) > 0)
4135 memcpy(pu8CurrByte
, gau8MulticastMacAddrList
, ((strHostIfSetMulti
->u32count
) * ETH_ALEN
));
4138 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_FALSE
, (WILC_Uint32
)drvHandler
);
4140 PRINT_ER("Failed to send setup multicast config packet\n");
4141 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
4144 WILC_CATCH(s32Error
)
4147 WILC_FREE_IF_TRUE(strWID
.ps8WidVal
);
4154 * @brief Handle_AddBASession
4155 * @details Add block ack session
4156 * @param[in] tstrHostIFSetMulti* strHostIfSetMulti
4158 * @author Amr Abdel-Moghny
4162 static WILC_Sint32
Handle_AddBASession(void *drvHandler
, tstrHostIfBASessionInfo
*strHostIfBASessionInfo
)
4164 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4166 int AddbaTimeout
= 100;
4168 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
4170 PRINT_D(HOSTINF_DBG
, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x \nTID=%d \nBufferSize == %d \nSessionTimeOut = %d\n",
4171 strHostIfBASessionInfo
->au8Bssid
[0],
4172 strHostIfBASessionInfo
->au8Bssid
[1],
4173 strHostIfBASessionInfo
->au8Bssid
[2],
4174 strHostIfBASessionInfo
->u16BufferSize
,
4175 strHostIfBASessionInfo
->u16SessionTimeout
,
4176 strHostIfBASessionInfo
->u8Ted
);
4178 strWID
.u16WIDid
= (u16
)WID_11E_P_ACTION_REQ
;
4179 strWID
.enuWIDtype
= WID_STR
;
4180 strWID
.ps8WidVal
= (u8
*)WILC_MALLOC(BLOCK_ACK_REQ_SIZE
);
4181 strWID
.s32ValueSize
= BLOCK_ACK_REQ_SIZE
;
4182 ptr
= strWID
.ps8WidVal
;
4183 /* *ptr++ = 0x14; */
4187 WILC_memcpy(ptr
, strHostIfBASessionInfo
->au8Bssid
, ETH_ALEN
);
4189 *ptr
++ = strHostIfBASessionInfo
->u8Ted
;
4193 *ptr
++ = (strHostIfBASessionInfo
->u16BufferSize
& 0xFF);
4194 *ptr
++ = ((strHostIfBASessionInfo
->u16BufferSize
>> 16) & 0xFF);
4196 *ptr
++ = (strHostIfBASessionInfo
->u16SessionTimeout
& 0xFF);
4197 *ptr
++ = ((strHostIfBASessionInfo
->u16SessionTimeout
>> 16) & 0xFF);
4199 *ptr
++ = (AddbaTimeout
& 0xFF);
4200 *ptr
++ = ((AddbaTimeout
>> 16) & 0xFF);
4201 /* Group Buffer Max Frames*/
4203 /* Group Buffer Timeout */
4206 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
4208 PRINT_D(HOSTINF_DBG
, "Couldn't open BA Session\n");
4211 strWID
.u16WIDid
= (u16
)WID_11E_P_ACTION_REQ
;
4212 strWID
.enuWIDtype
= WID_STR
;
4213 strWID
.s32ValueSize
= 15;
4214 ptr
= strWID
.ps8WidVal
;
4215 /* *ptr++ = 0x14; */
4219 WILC_memcpy(ptr
, strHostIfBASessionInfo
->au8Bssid
, ETH_ALEN
);
4222 *ptr
++ = strHostIfBASessionInfo
->u8Ted
;
4226 *ptr
++ = (strHostIfBASessionInfo
->u16BufferSize
& 0xFF);
4227 *ptr
++ = ((strHostIfBASessionInfo
->u16SessionTimeout
>> 16) & 0xFF);
4230 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
4232 if (strWID
.ps8WidVal
!= NULL
)
4233 WILC_FREE(strWID
.ps8WidVal
);
4242 * @brief Handle_DelBASession
4243 * @details Delete block ack session
4244 * @param[in] tstrHostIFSetMulti* strHostIfSetMulti
4246 * @author Amr Abdel-Moghny
4250 static WILC_Sint32
Handle_DelBASession(void *drvHandler
, tstrHostIfBASessionInfo
*strHostIfBASessionInfo
)
4252 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4255 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
4257 PRINT_D(GENERIC_DBG
, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x \nTID=%d\n",
4258 strHostIfBASessionInfo
->au8Bssid
[0],
4259 strHostIfBASessionInfo
->au8Bssid
[1],
4260 strHostIfBASessionInfo
->au8Bssid
[2],
4261 strHostIfBASessionInfo
->u8Ted
);
4263 strWID
.u16WIDid
= (u16
)WID_11E_P_ACTION_REQ
;
4264 strWID
.enuWIDtype
= WID_STR
;
4265 strWID
.ps8WidVal
= (u8
*)WILC_MALLOC(BLOCK_ACK_REQ_SIZE
);
4266 strWID
.s32ValueSize
= BLOCK_ACK_REQ_SIZE
;
4267 ptr
= strWID
.ps8WidVal
;
4268 /* *ptr++ = 0x14; */
4272 WILC_memcpy(ptr
, strHostIfBASessionInfo
->au8Bssid
, ETH_ALEN
);
4274 *ptr
++ = strHostIfBASessionInfo
->u8Ted
;
4275 /* BA direction = recipent*/
4278 *ptr
++ = 32; /* Unspecific QOS reason */
4280 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
4282 PRINT_D(HOSTINF_DBG
, "Couldn't delete BA Session\n");
4285 strWID
.u16WIDid
= (u16
)WID_11E_P_ACTION_REQ
;
4286 strWID
.enuWIDtype
= WID_STR
;
4287 strWID
.s32ValueSize
= 15;
4288 ptr
= strWID
.ps8WidVal
;
4289 /* *ptr++ = 0x14; */
4293 WILC_memcpy(ptr
, strHostIfBASessionInfo
->au8Bssid
, ETH_ALEN
);
4296 *ptr
++ = strHostIfBASessionInfo
->u8Ted
;
4298 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
4300 if (strWID
.ps8WidVal
!= NULL
)
4301 WILC_FREE(strWID
.ps8WidVal
);
4312 * @brief Handle_DelAllRxBASessions
4313 * @details Delete all Rx BA sessions
4314 * @param[in] tstrHostIFSetMulti* strHostIfSetMulti
4316 * @author Abdelrahman Sobhy
4320 static WILC_Sint32
Handle_DelAllRxBASessions(void *drvHandler
, tstrHostIfBASessionInfo
*strHostIfBASessionInfo
)
4322 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4325 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
4327 PRINT_D(GENERIC_DBG
, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x \nTID=%d\n",
4328 strHostIfBASessionInfo
->au8Bssid
[0],
4329 strHostIfBASessionInfo
->au8Bssid
[1],
4330 strHostIfBASessionInfo
->au8Bssid
[2],
4331 strHostIfBASessionInfo
->u8Ted
);
4333 strWID
.u16WIDid
= (u16
)WID_DEL_ALL_RX_BA
;
4334 strWID
.enuWIDtype
= WID_STR
;
4335 strWID
.ps8WidVal
= (u8
*)WILC_MALLOC(BLOCK_ACK_REQ_SIZE
);
4336 strWID
.s32ValueSize
= BLOCK_ACK_REQ_SIZE
;
4337 ptr
= strWID
.ps8WidVal
;
4341 WILC_memcpy(ptr
, strHostIfBASessionInfo
->au8Bssid
, ETH_ALEN
);
4343 *ptr
++ = strHostIfBASessionInfo
->u8Ted
;
4344 /* BA direction = recipent*/
4347 *ptr
++ = 32; /* Unspecific QOS reason */
4349 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
4351 PRINT_D(HOSTINF_DBG
, "Couldn't delete BA Session\n");
4354 if (strWID
.ps8WidVal
!= NULL
)
4355 WILC_FREE(strWID
.ps8WidVal
);
4365 * @brief hostIFthread
4366 * @details Main thread to handle message queue requests
4367 * @param[in] void* pvArg
4373 static int hostIFthread(void *pvArg
)
4376 tstrHostIFmsg strHostIFmsg
;
4377 tstrWILC_WFIDrv
*pstrWFIDrv
;
4379 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
4382 WILC_MsgQueueRecv(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), &u32Ret
, NULL
);
4383 pstrWFIDrv
= (tstrWILC_WFIDrv
*)strHostIFmsg
.drvHandler
;
4384 if (strHostIFmsg
.u16MsgId
== HOST_IF_MSG_EXIT
) {
4385 PRINT_D(GENERIC_DBG
, "THREAD: Exiting HostIfThread\n");
4390 /*Re-Queue HIF message*/
4391 if ((!g_wilc_initialized
)) {
4392 PRINT_D(GENERIC_DBG
, "--WAIT--");
4394 WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
4398 if (strHostIFmsg
.u16MsgId
== HOST_IF_MSG_CONNECT
&& pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
!= NULL
) {
4399 PRINT_D(HOSTINF_DBG
, "Requeue connect request till scan done received\n");
4400 WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
4405 switch (strHostIFmsg
.u16MsgId
) {
4406 case HOST_IF_MSG_Q_IDLE
:
4407 Handle_wait_msg_q_empty();
4410 case HOST_IF_MSG_SCAN
:
4411 Handle_Scan(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
);
4414 case HOST_IF_MSG_CONNECT
:
4415 Handle_Connect(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
);
4419 case HOST_IF_MSG_FLUSH_CONNECT
:
4420 Handle_FlushConnect(strHostIFmsg
.drvHandler
);
4423 case HOST_IF_MSG_RCVD_NTWRK_INFO
:
4424 Handle_RcvdNtwrkInfo(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strRcvdNetworkInfo
);
4427 case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO
:
4428 Handle_RcvdGnrlAsyncInfo(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strRcvdGnrlAsyncInfo
);
4431 case HOST_IF_MSG_KEY
:
4432 Handle_Key(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
);
4435 case HOST_IF_MSG_CFG_PARAMS
:
4437 Handle_CfgParam(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIFCfgParamAttr
);
4440 case HOST_IF_MSG_SET_CHANNEL
:
4441 Handle_SetChannel(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIFSetChan
);
4444 case HOST_IF_MSG_DISCONNECT
:
4445 Handle_Disconnect(strHostIFmsg
.drvHandler
);
4448 case HOST_IF_MSG_RCVD_SCAN_COMPLETE
:
4449 WILC_TimerStop(&(pstrWFIDrv
->hScanTimer
), NULL
);
4450 PRINT_D(HOSTINF_DBG
, "scan completed successfully\n");
4453 /*Allow chip sleep, only if both interfaces are not connected*/
4454 if (!linux_wlan_get_num_conn_ifcs()) {
4455 chip_sleep_manually(INFINITE_SLEEP_TIME
);
4458 Handle_ScanDone(strHostIFmsg
.drvHandler
, SCAN_EVENT_DONE
);
4461 if (pstrWFIDrv
->u8RemainOnChan_pendingreq
)
4462 Handle_RemainOnChan(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIfRemainOnChan
);
4467 case HOST_IF_MSG_GET_RSSI
:
4468 Handle_GetRssi(strHostIFmsg
.drvHandler
);
4471 case HOST_IF_MSG_GET_LINKSPEED
:
4472 Handle_GetLinkspeed(strHostIFmsg
.drvHandler
);
4475 case HOST_IF_MSG_GET_STATISTICS
:
4476 Handle_GetStatistics(strHostIFmsg
.drvHandler
, (tstrStatistics
*)strHostIFmsg
.uniHostIFmsgBody
.pUserData
);
4479 case HOST_IF_MSG_GET_CHNL
:
4480 Handle_GetChnl(strHostIFmsg
.drvHandler
);
4483 #ifdef WILC_AP_EXTERNAL_MLME
4484 case HOST_IF_MSG_ADD_BEACON
:
4485 Handle_AddBeacon(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIFSetBeacon
);
4488 case HOST_IF_MSG_DEL_BEACON
:
4489 Handle_DelBeacon(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIFDelBeacon
);
4492 case HOST_IF_MSG_ADD_STATION
:
4493 Handle_AddStation(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strAddStaParam
);
4496 case HOST_IF_MSG_DEL_STATION
:
4497 Handle_DelStation(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strDelStaParam
);
4500 case HOST_IF_MSG_EDIT_STATION
:
4501 Handle_EditStation(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strEditStaParam
);
4504 case HOST_IF_MSG_GET_INACTIVETIME
:
4505 Handle_Get_InActiveTime(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIfStaInactiveT
);
4508 #endif /*WILC_AP_EXTERNAL_MLME*/
4509 case HOST_IF_MSG_SCAN_TIMER_FIRED
:
4510 PRINT_D(HOSTINF_DBG
, "Scan Timeout\n");
4512 Handle_ScanDone(strHostIFmsg
.drvHandler
, SCAN_EVENT_ABORTED
);
4515 case HOST_IF_MSG_CONNECT_TIMER_FIRED
:
4516 PRINT_D(HOSTINF_DBG
, "Connect Timeout \n");
4517 Handle_ConnectTimeout(strHostIFmsg
.drvHandler
);
4520 case HOST_IF_MSG_POWER_MGMT
:
4521 Handle_PowerManagement(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strPowerMgmtparam
);
4524 case HOST_IF_MSG_SET_WFIDRV_HANDLER
:
4525 Handle_SetWfiDrvHandler(&strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetDrvHandler
);
4528 case HOST_IF_MSG_SET_OPERATION_MODE
:
4529 Handle_SetOperationMode(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetOperationMode
);
4532 case HOST_IF_MSG_SET_IPADDRESS
:
4533 PRINT_D(HOSTINF_DBG
, "HOST_IF_MSG_SET_IPADDRESS\n");
4534 Handle_set_IPAddress(strHostIFmsg
.drvHandler
, strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetIP
.au8IPAddr
, strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetIP
.idx
);
4537 case HOST_IF_MSG_GET_IPADDRESS
:
4538 PRINT_D(HOSTINF_DBG
, "HOST_IF_MSG_SET_IPADDRESS\n");
4539 Handle_get_IPAddress(strHostIFmsg
.drvHandler
, strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetIP
.au8IPAddr
, strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetIP
.idx
);
4543 case HOST_IF_MSG_SET_MAC_ADDRESS
:
4544 Handle_SetMacAddress(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetMacAddress
);
4548 case HOST_IF_MSG_GET_MAC_ADDRESS
:
4549 Handle_GetMacAddress(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIfGetMacAddress
);
4553 case HOST_IF_MSG_REMAIN_ON_CHAN
:
4554 PRINT_D(HOSTINF_DBG
, "HOST_IF_MSG_REMAIN_ON_CHAN\n");
4555 Handle_RemainOnChan(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIfRemainOnChan
);
4558 case HOST_IF_MSG_REGISTER_FRAME
:
4559 PRINT_D(HOSTINF_DBG
, "HOST_IF_MSG_REGISTER_FRAME\n");
4560 Handle_RegisterFrame(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIfRegisterFrame
);
4563 case HOST_IF_MSG_LISTEN_TIMER_FIRED
:
4564 Handle_ListenStateExpired(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIfRemainOnChan
);
4568 case HOST_IF_MSG_SET_MULTICAST_FILTER
:
4569 PRINT_D(HOSTINF_DBG
, "HOST_IF_MSG_SET_MULTICAST_FILTER\n");
4570 Handle_SetMulticastFilter(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetMulti
);
4574 case HOST_IF_MSG_ADD_BA_SESSION
:
4575 Handle_AddBASession(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIfBASessionInfo
);
4578 case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS
:
4579 Handle_DelAllRxBASessions(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIfBASessionInfo
);
4582 case HOST_IF_MSG_DEL_ALL_STA
:
4583 Handle_DelAllSta(strHostIFmsg
.drvHandler
, &strHostIFmsg
.uniHostIFmsgBody
.strHostIFDelAllSta
);
4587 PRINT_ER("[Host Interface] undefined Received Msg ID \n");
4592 PRINT_D(HOSTINF_DBG
, "Releasing thread exit semaphore\n");
4593 up(&hSemHostIFthrdEnd
);
4597 static void TimerCB_Scan(void *pvArg
)
4599 tstrHostIFmsg strHostIFmsg
;
4601 /* prepare the Timer Callback message */
4602 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
4603 strHostIFmsg
.drvHandler
= pvArg
;
4604 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_SCAN_TIMER_FIRED
;
4606 /* send the message */
4607 WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
4610 static void TimerCB_Connect(void *pvArg
)
4612 tstrHostIFmsg strHostIFmsg
;
4614 /* prepare the Timer Callback message */
4615 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
4616 strHostIFmsg
.drvHandler
= pvArg
;
4617 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_CONNECT_TIMER_FIRED
;
4619 /* send the message */
4620 WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
4625 * @brief removes wpa/wpa2 keys
4626 * @details only in BSS STA mode if External Supplicant support is enabled.
4627 * removes all WPA/WPA2 station key entries from MAC hardware.
4628 * @param[in,out] handle to the wifi driver
4629 * @param[in] 6 bytes of Station Adress in the station entry table
4630 * @return Error code indicating success/failure
4633 * @date 8 March 2012
4636 /* Check implementation in core adding 9 bytes to the input! */
4637 WILC_Sint32
host_int_remove_key(WILC_WFIDrvHandle hWFIDrv
, const u8
*pu8StaAddress
)
4639 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4641 /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
4643 strWID
.u16WIDid
= (u16
)WID_REMOVE_KEY
;
4644 strWID
.enuWIDtype
= WID_STR
;
4645 strWID
.ps8WidVal
= (WILC_Sint8
*)pu8StaAddress
;
4646 strWID
.s32ValueSize
= 6;
4653 * @brief removes WEP key
4654 * @details valid only in BSS STA mode if External Supplicant support is enabled.
4655 * remove a WEP key entry from MAC HW.
4656 * The BSS Station automatically finds the index of the entry using its
4657 * BSS ID and removes that entry from the MAC hardware.
4658 * @param[in,out] handle to the wifi driver
4659 * @param[in] 6 bytes of Station Adress in the station entry table
4660 * @return Error code indicating success/failure
4661 * @note NO need for the STA add since it is not used for processing
4663 * @date 8 March 2012
4666 WILC_Sint32
host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv
, u8 u8keyIdx
)
4668 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4669 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
4670 tstrHostIFmsg strHostIFmsg
;
4673 if (pstrWFIDrv
== NULL
) {
4674 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
4677 /* prepare the Remove Wep Key Message */
4678 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
4681 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_KEY
;
4682 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.enuKeyType
= WEP
;
4683 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.u8KeyAction
= REMOVEKEY
;
4684 strHostIFmsg
.drvHandler
= hWFIDrv
;
4688 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4689 uniHostIFkeyAttr
.strHostIFwepAttr
.u8Wepidx
= u8keyIdx
;
4691 /* send the message */
4692 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
4694 PRINT_ER("Error in sending message queue : Request to remove WEP key \n");
4695 down(&(pstrWFIDrv
->hSemTestKeyBlock
));
4697 WILC_CATCH(s32Error
)
4705 * @brief sets WEP default key
4706 * @details Sets the index of the WEP encryption key in use,
4708 * @param[in,out] handle to the wifi driver
4709 * @param[in] key index ( 0, 1, 2, 3)
4710 * @return Error code indicating success/failure
4713 * @date 8 March 2012
4716 WILC_Sint32
host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv
, u8 u8Index
)
4718 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4719 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
4720 tstrHostIFmsg strHostIFmsg
;
4723 if (pstrWFIDrv
== NULL
) {
4724 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
4727 /* prepare the Key Message */
4728 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
4731 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_KEY
;
4732 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.enuKeyType
= WEP
;
4733 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.u8KeyAction
= DEFAULTKEY
;
4734 strHostIFmsg
.drvHandler
= hWFIDrv
;
4737 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4738 uniHostIFkeyAttr
.strHostIFwepAttr
.u8Wepidx
= u8Index
;
4740 /* send the message */
4741 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
4743 PRINT_ER("Error in sending message queue : Default key index\n");
4744 down(&(pstrWFIDrv
->hSemTestKeyBlock
));
4746 WILC_CATCH(s32Error
)
4755 * @brief sets WEP deafault key
4756 * @details valid only in BSS STA mode if External Supplicant support is enabled.
4757 * sets WEP key entry into MAC hardware when it receives the
4758 * corresponding request from NDIS.
4759 * @param[in,out] handle to the wifi driver
4760 * @param[in] message containing WEP Key in the following format
4761 *|---------------------------------------|
4762 *|Key ID Value | Key Length | Key |
4763 *|-------------|------------|------------|
4764 | 1byte | 1byte | Key Length |
4765 ||---------------------------------------|
4767 * @return Error code indicating success/failure
4770 * @date 8 March 2012
4773 WILC_Sint32
host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv
, const u8
*pu8WepKey
, u8 u8WepKeylen
, u8 u8Keyidx
)
4776 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4777 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
4778 tstrHostIFmsg strHostIFmsg
;
4780 if (pstrWFIDrv
== NULL
) {
4781 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
4785 /* prepare the Key Message */
4786 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
4789 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_KEY
;
4790 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.enuKeyType
= WEP
;
4791 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.u8KeyAction
= ADDKEY
;
4792 strHostIFmsg
.drvHandler
= hWFIDrv
;
4795 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4796 uniHostIFkeyAttr
.strHostIFwepAttr
.pu8WepKey
= (u8
*)WILC_MALLOC(u8WepKeylen
);
4798 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwepAttr
.pu8WepKey
,
4799 pu8WepKey
, u8WepKeylen
);
4802 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4803 uniHostIFkeyAttr
.strHostIFwepAttr
.u8WepKeylen
= (u8WepKeylen
);
4805 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4806 uniHostIFkeyAttr
.strHostIFwepAttr
.u8Wepidx
= u8Keyidx
;
4808 /* send the message */
4809 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
4811 PRINT_ER("Error in sending message queue :WEP Key\n");
4812 down(&(pstrWFIDrv
->hSemTestKeyBlock
));
4814 WILC_CATCH(s32Error
)
4822 #ifdef WILC_AP_EXTERNAL_MLME
4825 * @brief host_int_add_wep_key_bss_ap
4826 * @details valid only in BSS AP mode if External Supplicant support is enabled.
4827 * sets WEP key entry into MAC hardware when it receives the
4829 * corresponding request from NDIS.
4830 * @param[in,out] handle to the wifi driver
4833 * @return Error code indicating success/failure
4839 WILC_Sint32
host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv
, const u8
*pu8WepKey
, u8 u8WepKeylen
, u8 u8Keyidx
, u8 u8mode
, AUTHTYPE_T tenuAuth_type
)
4842 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4843 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
4844 tstrHostIFmsg strHostIFmsg
;
4847 if (pstrWFIDrv
== NULL
) {
4848 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
4852 /* prepare the Key Message */
4853 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
4856 for (i
= 0; i
< u8WepKeylen
; i
++)
4857 PRINT_INFO(HOSTAPD_DBG
, "KEY is %x\n", pu8WepKey
[i
]);
4859 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_KEY
;
4860 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.enuKeyType
= WEP
;
4861 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.u8KeyAction
= ADDKEY_AP
;
4862 strHostIFmsg
.drvHandler
= hWFIDrv
;
4865 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4866 uniHostIFkeyAttr
.strHostIFwepAttr
.pu8WepKey
= (u8
*)WILC_MALLOC((u8WepKeylen
));
4869 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwepAttr
.pu8WepKey
,
4870 pu8WepKey
, (u8WepKeylen
));
4873 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4874 uniHostIFkeyAttr
.strHostIFwepAttr
.u8WepKeylen
= (u8WepKeylen
);
4876 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4877 uniHostIFkeyAttr
.strHostIFwepAttr
.u8Wepidx
= u8Keyidx
;
4879 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4880 uniHostIFkeyAttr
.strHostIFwepAttr
.u8mode
= u8mode
;
4882 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4883 uniHostIFkeyAttr
.strHostIFwepAttr
.tenuAuth_type
= tenuAuth_type
;
4884 /* send the message */
4885 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
4888 PRINT_ER("Error in sending message queue :WEP Key\n");
4889 down(&(pstrWFIDrv
->hSemTestKeyBlock
));
4891 WILC_CATCH(s32Error
)
4900 * @brief adds ptk Key
4902 * @param[in,out] handle to the wifi driver
4903 * @param[in] message containing PTK Key in the following format
4904 *|-----------------------------------------------------------------------------|
4905 *|Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key |
4906 *|----------------|------------|--------------|----------------|---------------|
4907 | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes |
4908 ||-----------------------------------------------------------------------------|
4909 * @return Error code indicating success/failure
4912 * @date 8 March 2012
4915 WILC_Sint32
host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv
, const u8
*pu8Ptk
, u8 u8PtkKeylen
,
4916 const u8
*mac_addr
, const u8
*pu8RxMic
, const u8
*pu8TxMic
, u8 mode
, u8 u8Ciphermode
, u8 u8Idx
)
4918 WILC_Sint32 s32Error
= WILC_SUCCESS
;
4919 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
4920 tstrHostIFmsg strHostIFmsg
;
4921 u8 u8KeyLen
= u8PtkKeylen
;
4923 if (pstrWFIDrv
== NULL
) {
4924 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
4926 if (pu8RxMic
!= NULL
) {
4927 u8KeyLen
+= RX_MIC_KEY_LEN
;
4929 if (pu8TxMic
!= NULL
) {
4930 u8KeyLen
+= TX_MIC_KEY_LEN
;
4933 /* prepare the Key Message */
4934 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
4937 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_KEY
;
4938 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.enuKeyType
= WPAPtk
;
4939 #ifdef WILC_AP_EXTERNAL_MLME
4940 if (mode
== AP_MODE
) {
4941 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.u8KeyAction
= ADDKEY_AP
;
4942 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4943 uniHostIFkeyAttr
.strHostIFwpaAttr
.u8keyidx
= u8Idx
;
4946 if (mode
== STATION_MODE
)
4947 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.u8KeyAction
= ADDKEY
;
4950 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4951 uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
= (u8
*)WILC_MALLOC(u8PtkKeylen
);
4954 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
,
4955 pu8Ptk
, u8PtkKeylen
);
4957 if (pu8RxMic
!= NULL
) {
4959 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
+ 16,
4960 pu8RxMic
, RX_MIC_KEY_LEN
);
4962 for (i
= 0; i
< RX_MIC_KEY_LEN
; i
++)
4963 PRINT_INFO(CFG80211_DBG
, "PairwiseRx[%d] = %x\n", i
, pu8RxMic
[i
]);
4966 if (pu8TxMic
!= NULL
) {
4968 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
+ 24,
4969 pu8TxMic
, TX_MIC_KEY_LEN
);
4971 for (i
= 0; i
< TX_MIC_KEY_LEN
; i
++)
4972 PRINT_INFO(CFG80211_DBG
, "PairwiseTx[%d] = %x\n", i
, pu8TxMic
[i
]);
4976 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4977 uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Keylen
= u8KeyLen
;
4979 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4980 uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Ciphermode
= u8Ciphermode
;
4981 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
4982 uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8macaddr
= mac_addr
;
4983 strHostIFmsg
.drvHandler
= hWFIDrv
;
4985 /* send the message */
4986 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
4989 PRINT_ER("Error in sending message queue: PTK Key\n");
4991 /* ////////////// */
4992 down(&(pstrWFIDrv
->hSemTestKeyBlock
));
4993 /* WILC_Sleep(100); */
4996 WILC_CATCH(s32Error
)
5005 * @brief adds Rx GTk Key
5007 * @param[in,out] handle to the wifi driver
5008 * @param[in] pu8RxGtk : contains temporal key | Rx Mic | Tx Mic
5009 * u8GtkKeylen :The total key length
5011 * @return Error code indicating success/failure
5014 * @date 8 March 2012
5017 WILC_Sint32
host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv
, const u8
*pu8RxGtk
, u8 u8GtkKeylen
,
5018 u8 u8KeyIdx
, WILC_Uint32 u32KeyRSClen
, const u8
*KeyRSC
,
5019 const u8
*pu8RxMic
, const u8
*pu8TxMic
, u8 mode
, u8 u8Ciphermode
)
5021 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5022 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
5023 tstrHostIFmsg strHostIFmsg
;
5024 u8 u8KeyLen
= u8GtkKeylen
;
5026 if (pstrWFIDrv
== NULL
) {
5027 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
5029 /* prepare the Key Message */
5030 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
5033 if (pu8RxMic
!= NULL
) {
5034 u8KeyLen
+= RX_MIC_KEY_LEN
;
5036 if (pu8TxMic
!= NULL
) {
5037 u8KeyLen
+= TX_MIC_KEY_LEN
;
5039 if (KeyRSC
!= NULL
) {
5040 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
5041 uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8seq
= (u8
*)WILC_MALLOC(u32KeyRSClen
);
5043 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8seq
,
5044 KeyRSC
, u32KeyRSClen
);
5048 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_KEY
;
5049 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.enuKeyType
= WPARxGtk
;
5050 strHostIFmsg
.drvHandler
= hWFIDrv
;
5052 #ifdef WILC_AP_EXTERNAL_MLME
5053 if (mode
== AP_MODE
) {
5054 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.u8KeyAction
= ADDKEY_AP
;
5055 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Ciphermode
= u8Ciphermode
;
5058 if (mode
== STATION_MODE
)
5059 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.u8KeyAction
= ADDKEY
;
5062 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
5063 uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
= (u8
*)WILC_MALLOC(u8KeyLen
);
5065 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
,
5066 pu8RxGtk
, u8GtkKeylen
);
5068 if (pu8RxMic
!= NULL
) {
5070 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
+ 16,
5071 pu8RxMic
, RX_MIC_KEY_LEN
);
5074 if (pu8TxMic
!= NULL
) {
5076 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
+ 24,
5077 pu8TxMic
, TX_MIC_KEY_LEN
);
5081 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
5082 uniHostIFkeyAttr
.strHostIFwpaAttr
.u8keyidx
= u8KeyIdx
;
5083 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
5084 uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Keylen
= u8KeyLen
;
5086 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
5087 uniHostIFkeyAttr
.strHostIFwpaAttr
.u8seqlen
= u32KeyRSClen
;
5091 /* send the message */
5092 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5094 PRINT_ER("Error in sending message queue: RX GTK\n");
5095 /* ////////////// */
5096 down(&(pstrWFIDrv
->hSemTestKeyBlock
));
5097 /* WILC_Sleep(100); */
5100 WILC_CATCH(s32Error
)
5108 * @brief host_int_add_tx_gtk
5109 * @details adds Tx GTk Key
5110 * @param[in,out] handle to the wifi driver
5111 * @param[in] message containing Tx GTK Key in the following format
5112 *|----------------------------------------------------|
5113 | KeyID | Key Length | Temporal Key | Tx Michael Key |
5114 ||-------|------------|--------------|----------------|
5115 ||1 byte | 1 byte | 16 bytes | 8 bytes |
5116 ||----------------------------------------------------|
5117 * @return Error code indicating success/failure
5120 * @date 8 March 2012
5123 WILC_Sint32
host_int_add_tx_gtk(WILC_WFIDrvHandle hWFIDrv
, u8 u8KeyLen
, u8
*pu8TxGtk
, u8 u8KeyIdx
)
5125 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5126 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
5127 tstrHostIFmsg strHostIFmsg
;
5129 if (pstrWFIDrv
== NULL
) {
5130 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
5133 /* prepare the Key Message */
5134 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
5136 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_KEY
;
5137 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.enuKeyType
= WPATxGtk
;
5138 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.u8KeyAction
= ADDKEY
;
5140 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.
5141 uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
= (u8
*)WILC_MALLOC(u8KeyLen
);
5143 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwpaAttr
.pu8key
,
5144 pu8TxGtk
, u8KeyLen
);
5146 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFwpaAttr
.u8Keylen
= u8KeyLen
;
5148 /* send the message */
5149 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5151 PRINT_ER("Error in sending message queue: TX GTK\n");
5153 /* ////////////// */
5154 down(&hSemTestKeyBlock
);
5158 WILC_CATCH(s32Error
)
5166 * @brief host_int_set_pmkid_info
5167 * @details caches the pmkid valid only in BSS STA mode if External Supplicant
5168 * support is enabled. This Function sets the PMKID in firmware
5169 * when host drivr receives the corresponding request from NDIS.
5170 * The firmware then includes theset PMKID in the appropriate
5172 * @param[in,out] handle to the wifi driver
5173 * @param[in] message containing PMKID Info in the following format
5174 *|-----------------------------------------------------------------|
5175 *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] |
5176 *|-----------|------------|----------|-------|----------|----------|
5177 | 1 | 6 | 16 | ... | 6 | 16 |
5178 ||-----------------------------------------------------------------|
5179 * @return Error code indicating success/failure
5182 * @date 8 March 2012
5185 WILC_Sint32
host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv
, tstrHostIFpmkidAttr
*pu8PmkidInfoArray
)
5187 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5188 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
5189 tstrHostIFmsg strHostIFmsg
;
5193 if (pstrWFIDrv
== NULL
) {
5194 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
5197 /* prepare the Key Message */
5198 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
5200 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_KEY
;
5201 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.enuKeyType
= PMKSA
;
5202 strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.u8KeyAction
= ADDKEY
;
5203 strHostIFmsg
.drvHandler
= hWFIDrv
;
5205 for (i
= 0; i
< pu8PmkidInfoArray
->numpmkid
; i
++) {
5207 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFpmkidAttr
.pmkidlist
[i
].bssid
, &pu8PmkidInfoArray
->pmkidlist
[i
].bssid
,
5210 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFkeyAttr
.uniHostIFkeyAttr
.strHostIFpmkidAttr
.pmkidlist
[i
].pmkid
, &pu8PmkidInfoArray
->pmkidlist
[i
].pmkid
,
5214 /* send the message */
5215 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5217 PRINT_ER(" Error in sending messagequeue: PMKID Info\n");
5219 WILC_CATCH(s32Error
)
5228 * @brief gets the cached the pmkid info
5229 * @details valid only in BSS STA mode if External Supplicant
5230 * support is enabled. This Function sets the PMKID in firmware
5231 * when host drivr receives the corresponding request from NDIS.
5232 * The firmware then includes theset PMKID in the appropriate
5234 * @param[in,out] handle to the wifi driver,
5235 * message containing PMKID Info in the following format
5236 *|-----------------------------------------------------------------|
5237 *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] |
5238 *|-----------|------------|----------|-------|----------|----------|
5239 | 1 | 6 | 16 | ... | 6 | 16 |
5240 ||-----------------------------------------------------------------|
5242 * @return Error code indicating success/failure
5245 * @date 8 March 2012
5248 WILC_Sint32
host_int_get_pmkid_info(WILC_WFIDrvHandle hWFIDrv
, u8
*pu8PmkidInfoArray
,
5249 WILC_Uint32 u32PmkidInfoLen
)
5251 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5253 /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
5255 strWID
.u16WIDid
= (u16
)WID_PMKID_INFO
;
5256 strWID
.enuWIDtype
= WID_STR
;
5257 strWID
.s32ValueSize
= u32PmkidInfoLen
;
5258 strWID
.ps8WidVal
= pu8PmkidInfoArray
;
5264 * @brief sets the pass phrase
5265 * @details AP/STA mode. This function gives the pass phrase used to
5266 * generate the Pre-Shared Key when WPA/WPA2 is enabled
5267 * The length of the field can vary from 8 to 64 bytes,
5268 * the lower layer should get the
5269 * @param[in,out] handle to the wifi driver,
5270 * @param[in] String containing PSK
5271 * @return Error code indicating success/failure
5274 * @date 8 March 2012
5277 WILC_Sint32
host_int_set_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv
, u8
*pu8PassPhrase
,
5280 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5282 /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
5284 /* u8 u8Psklength = WILC_strlen(pu8PassPhrase); */
5285 /*validating psk length*/
5286 if ((u8Psklength
> 7) && (u8Psklength
< 65)) {
5287 strWID
.u16WIDid
= (u16
)WID_11I_PSK
;
5288 strWID
.enuWIDtype
= WID_STR
;
5289 strWID
.ps8WidVal
= pu8PassPhrase
;
5290 strWID
.s32ValueSize
= u8Psklength
;
5296 * @brief host_int_get_MacAddress
5297 * @details gets mac address
5298 * @param[in,out] handle to the wifi driver,
5300 * @return Error code indicating success/failure
5303 * @date 19 April 2012
5306 WILC_Sint32
host_int_get_MacAddress(WILC_WFIDrvHandle hWFIDrv
, u8
*pu8MacAddress
)
5308 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5309 tstrHostIFmsg strHostIFmsg
;
5312 /* prepare the Message */
5313 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
5315 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_GET_MAC_ADDRESS
;
5316 strHostIFmsg
.uniHostIFmsgBody
.strHostIfGetMacAddress
.u8MacAddress
= pu8MacAddress
;
5317 strHostIFmsg
.drvHandler
= hWFIDrv
;
5318 /* send the message */
5319 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5321 PRINT_ER("Failed to send get mac address\n");
5325 down(&hWaitResponse
);
5330 * @brief host_int_set_MacAddress
5331 * @details sets mac address
5332 * @param[in,out] handle to the wifi driver,
5334 * @return Error code indicating success/failure
5337 * @date 16 July 2012
5340 WILC_Sint32
host_int_set_MacAddress(WILC_WFIDrvHandle hWFIDrv
, u8
*pu8MacAddress
)
5342 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5343 tstrHostIFmsg strHostIFmsg
;
5345 PRINT_D(GENERIC_DBG
, "mac addr = %x:%x:%x\n", pu8MacAddress
[0], pu8MacAddress
[1], pu8MacAddress
[2]);
5347 /* prepare setting mac address message */
5348 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
5349 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_SET_MAC_ADDRESS
;
5350 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetMacAddress
.u8MacAddress
, pu8MacAddress
, ETH_ALEN
);
5351 strHostIFmsg
.drvHandler
= hWFIDrv
;
5353 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5355 PRINT_ER("Failed to send message queue: Set mac address\n");
5356 WILC_ERRORREPORT(s32Error
, s32Error
);
5358 WILC_CATCH(s32Error
)
5368 * @brief host_int_get_RSNAConfigPSKPassPhrase
5369 * @details gets the pass phrase:AP/STA mode. This function gets the pass phrase used to
5370 * generate the Pre-Shared Key when WPA/WPA2 is enabled
5371 * The length of the field can vary from 8 to 64 bytes,
5372 * the lower layer should get the
5373 * @param[in,out] handle to the wifi driver,
5374 * String containing PSK
5375 * @return Error code indicating success/failure
5378 * @date 8 March 2012
5381 WILC_Sint32
host_int_get_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv
,
5382 u8
*pu8PassPhrase
, u8 u8Psklength
)
5384 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5386 /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
5388 strWID
.u16WIDid
= (u16
)WID_11I_PSK
;
5389 strWID
.enuWIDtype
= WID_STR
;
5390 strWID
.s32ValueSize
= u8Psklength
;
5391 strWID
.ps8WidVal
= pu8PassPhrase
;
5397 * @brief host_int_get_site_survey_results
5398 * @details gets the site survey results
5399 * @param[in,out] handle to the wifi driver,
5400 * Message containing site survey results in the
5402 *|---------------------------------------------------|
5403 | MsgLength | fragNo. | MsgBodyLength | MsgBody |
5404 ||-----------|-----------|---------------|-----------|
5406 | ----------------------------------------- | ----------------
5408 ||---------------------------------------|
5409 | Network1 | Netweork2 | ... | Network5 |
5410 ||---------------------------------------|
5411 | 44 | 44 | ... | 44 |
5412 | -------------------------- | ---------------------------------------
5414 ||---------------------------------------------------------------------|
5415 | SSID | BSS Type | Channel | Security Status| BSSID | RSSI |Reserved |
5418 ||------|----------|---------|----------------|-------|------|---------|
5419 | 33 | 1 | 1 | 1 | 6 | 1 | 1 |
5420 ||---------------------------------------------------------------------|
5421 * @return Error code indicating success/failure
5424 * @date 8 March 2012
5427 #ifndef CONNECT_DIRECT
5428 WILC_Sint32
host_int_get_site_survey_results(WILC_WFIDrvHandle hWFIDrv
,
5429 u8 ppu8RcvdSiteSurveyResults
[][MAX_SURVEY_RESULT_FRAG_SIZE
],
5430 WILC_Uint32 u32MaxSiteSrvyFragLen
)
5432 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5433 tstrWID astrWIDList
[2];
5434 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
5436 astrWIDList
[0].u16WIDid
= (u16
)WID_SITE_SURVEY_RESULTS
;
5437 astrWIDList
[0].enuWIDtype
= WID_STR
;
5438 astrWIDList
[0].ps8WidVal
= ppu8RcvdSiteSurveyResults
[0];
5439 astrWIDList
[0].s32ValueSize
= u32MaxSiteSrvyFragLen
;
5441 astrWIDList
[1].u16WIDid
= (u16
)WID_SITE_SURVEY_RESULTS
;
5442 astrWIDList
[1].enuWIDtype
= WID_STR
;
5443 astrWIDList
[1].ps8WidVal
= ppu8RcvdSiteSurveyResults
[1];
5444 astrWIDList
[1].s32ValueSize
= u32MaxSiteSrvyFragLen
;
5446 s32Error
= SendConfigPkt(GET_CFG
, astrWIDList
, 2, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
5448 /*get the value by searching the local copy*/
5450 PRINT_ER("Failed to send config packet to get survey results\n");
5451 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
5454 WILC_CATCH(s32Error
)
5464 * @brief sets a start scan request
5466 * @param[in,out] handle to the wifi driver,
5467 * @param[in] Scan Source one of the following values
5470 * OBSS_PERIODIC_SCAN BIT1
5471 * OBSS_ONETIME_SCAN BIT2
5472 * @return Error code indicating success/failure
5475 * @date 8 March 2012
5478 WILC_Sint32
host_int_set_start_scan_req(WILC_WFIDrvHandle hWFIDrv
, u8 scanSource
)
5480 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5482 /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
5484 strWID
.u16WIDid
= (u16
)WID_START_SCAN_REQ
;
5485 strWID
.enuWIDtype
= WID_CHAR
;
5486 strWID
.ps8WidVal
= (WILC_Sint8
*)&scanSource
;
5487 strWID
.s32ValueSize
= sizeof(WILC_Char
);
5493 * @brief host_int_get_start_scan_req
5494 * @details gets a start scan request
5495 * @param[in,out] handle to the wifi driver,
5496 * @param[in] Scan Source one of the following values
5499 * OBSS_PERIODIC_SCAN BIT1
5500 * OBSS_ONETIME_SCAN BIT2
5501 * @return Error code indicating success/failure
5504 * @date 8 March 2012
5508 WILC_Sint32
host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv
, u8
*pu8ScanSource
)
5510 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5512 /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
5514 strWID
.u16WIDid
= (u16
)WID_START_SCAN_REQ
;
5515 strWID
.enuWIDtype
= WID_CHAR
;
5516 strWID
.ps8WidVal
= (WILC_Sint8
*)pu8ScanSource
;
5517 strWID
.s32ValueSize
= sizeof(WILC_Char
);
5523 * @brief host_int_set_join_req
5524 * @details sets a join request
5525 * @param[in,out] handle to the wifi driver,
5526 * @param[in] Index of the bss descriptor
5527 * @return Error code indicating success/failure
5530 * @date 8 March 2012
5533 WILC_Sint32
host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv
, u8
*pu8bssid
,
5534 const u8
*pu8ssid
, size_t ssidLen
,
5535 const u8
*pu8IEs
, size_t IEsLen
,
5536 tWILCpfConnectResult pfConnectResult
, void *pvUserArg
,
5537 u8 u8security
, AUTHTYPE_T tenuAuth_type
,
5541 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5542 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
5543 tstrHostIFmsg strHostIFmsg
;
5544 tenuScanConnTimer enuScanConnTimer
;
5546 if (pstrWFIDrv
== NULL
|| pfConnectResult
== NULL
) {
5547 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
5550 if (hWFIDrv
== NULL
) {
5551 PRINT_ER("Driver not initialized: gWFiDrvHandle = NULL\n");
5552 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
5555 if (pJoinParams
== NULL
) {
5556 PRINT_ER("Unable to Join - JoinParams is NULL\n");
5557 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
5561 * if(gWFiDrvHandle->strWILC_UsrScanReq.u32RcvdChCount == 0)
5563 * PRINT_ER("No scan results exist: Scanning should be done\n");
5564 * WILC_ERRORREPORT(s32Error, WILC_FAIL);
5567 /* prepare the Connect Message */
5568 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
5570 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_CONNECT
;
5572 strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.u8security
= u8security
;
5573 strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.tenuAuth_type
= tenuAuth_type
;
5574 strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.u8channel
= u8channel
;
5575 strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.pfConnectResult
= pfConnectResult
;
5576 strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.pvUserArg
= pvUserArg
;
5577 strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.pJoinParams
= pJoinParams
;
5578 strHostIFmsg
.drvHandler
= hWFIDrv
;
5580 if (pu8bssid
!= NULL
) {
5581 strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.pu8bssid
= (u8
*)WILC_MALLOC(6); /* will be deallocated by the receiving thread */
5582 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.pu8bssid
,
5586 if (pu8ssid
!= NULL
) {
5587 strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.ssidLen
= ssidLen
;
5588 strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.pu8ssid
= (u8
*)WILC_MALLOC(ssidLen
); /* will be deallocated by the receiving thread */
5589 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.pu8ssid
,
5594 if (pu8IEs
!= NULL
) {
5595 strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.IEsLen
= IEsLen
;
5596 strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.pu8IEs
= (u8
*)WILC_MALLOC(IEsLen
); /* will be deallocated by the receiving thread */
5597 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFconnectAttr
.pu8IEs
,
5600 if (pstrWFIDrv
->enuHostIFstate
< HOST_IF_CONNECTING
) {
5601 pstrWFIDrv
->enuHostIFstate
= HOST_IF_CONNECTING
;
5603 PRINT_D(GENERIC_DBG
, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv
->enuHostIFstate
);
5605 /* send the message */
5606 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5608 PRINT_ER("Failed to send message queue: Set join request\n");
5609 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
5612 enuScanConnTimer
= CONNECT_TIMER
;
5613 WILC_TimerStart(&(pstrWFIDrv
->hConnectTimer
), HOST_IF_CONNECT_TIMEOUT
, (void *) hWFIDrv
, NULL
);
5615 WILC_CATCH(s32Error
)
5624 * @brief Flush a join request parameters to FW, but actual connection
5625 * @details The function is called in situation where WILC is connected to AP and
5626 * required to switch to hybrid FW for P2P connection
5627 * @param[in] handle to the wifi driver,
5628 * @return Error code indicating success/failure
5630 * @author Amr Abdel-Moghny
5635 WILC_Sint32
host_int_flush_join_req(WILC_WFIDrvHandle hWFIDrv
)
5637 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5638 tstrHostIFmsg strHostIFmsg
;
5640 if (!gu8FlushedJoinReq
) {
5641 s32Error
= WILC_FAIL
;
5646 if (hWFIDrv
== NULL
) {
5647 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
5651 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_FLUSH_CONNECT
;
5652 strHostIFmsg
.drvHandler
= hWFIDrv
;
5654 /* send the message */
5655 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5657 PRINT_ER("Failed to send message queue: Flush join request\n");
5658 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
5661 WILC_CATCH(s32Error
)
5669 * @brief host_int_disconnect
5670 * @details disconnects from the currently associated network
5671 * @param[in,out] handle to the wifi driver,
5672 * @param[in] Reason Code of the Disconnection
5673 * @return Error code indicating success/failure
5676 * @date 8 March 2012
5679 WILC_Sint32
host_int_disconnect(WILC_WFIDrvHandle hWFIDrv
, u16 u16ReasonCode
)
5681 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5682 tstrHostIFmsg strHostIFmsg
;
5683 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
5685 if (pstrWFIDrv
== NULL
) {
5686 PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n");
5687 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
5690 if (pstrWFIDrv
== NULL
) {
5691 PRINT_ER("gWFiDrvHandle = NULL\n");
5692 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
5695 /* prepare the Disconnect Message */
5696 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
5698 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_DISCONNECT
;
5699 strHostIFmsg
.drvHandler
= hWFIDrv
;
5701 /* send the message */
5702 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5704 PRINT_ER("Failed to send message queue: disconnect\n");
5705 /* ////////////// */
5706 down(&(pstrWFIDrv
->hSemTestDisconnectBlock
));
5709 WILC_CATCH(s32Error
)
5718 * @brief host_int_disconnect_station
5719 * @details disconnects a sta
5720 * @param[in,out] handle to the wifi driver,
5721 * @param[in] Association Id of the station to be disconnected
5722 * @return Error code indicating success/failure
5725 * @date 8 March 2012
5728 WILC_Sint32
host_int_disconnect_station(WILC_WFIDrvHandle hWFIDrv
, u8 assoc_id
)
5730 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5732 /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
5734 strWID
.u16WIDid
= (u16
)WID_DISCONNECT
;
5735 strWID
.enuWIDtype
= WID_CHAR
;
5736 strWID
.ps8WidVal
= (WILC_Sint8
*)&assoc_id
;
5737 strWID
.s32ValueSize
= sizeof(WILC_Char
);
5743 * @brief host_int_get_assoc_req_info
5744 * @details gets a Association request info
5745 * @param[in,out] handle to the wifi driver,
5746 * Message containg assoc. req info in the following format
5747 * ------------------------------------------------------------------------
5748 | Management Frame Format |
5749 ||-------------------------------------------------------------------|
5750 ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS |
5751 ||-------------|--------|--|--|-----|----------------|----------|----|
5752 | 2 |2 |6 |6 |6 | 2 |0 - 2312 | 4 |
5753 ||-------------------------------------------------------------------|
5755 | Association Request Frame - Frame Body |
5756 ||-------------------------------------------------------------------|
5757 | Capability Information | Listen Interval | SSID | Supported Rates |
5758 ||------------------------|-----------------|------|-----------------|
5759 | 2 | 2 | 2-34 | 3-10 |
5760 | ---------------------------------------------------------------------
5761 * @return Error code indicating success/failure
5764 * @date 8 March 2012
5768 WILC_Sint32
host_int_get_assoc_req_info(WILC_WFIDrvHandle hWFIDrv
, u8
*pu8AssocReqInfo
,
5769 WILC_Uint32 u32AssocReqInfoLen
)
5771 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5773 /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
5775 strWID
.u16WIDid
= (u16
)WID_ASSOC_REQ_INFO
;
5776 strWID
.enuWIDtype
= WID_STR
;
5777 strWID
.ps8WidVal
= pu8AssocReqInfo
;
5778 strWID
.s32ValueSize
= u32AssocReqInfoLen
;
5785 * @brief gets a Association Response info
5787 * @param[in,out] handle to the wifi driver,
5788 * Message containg assoc. resp info
5789 * @return Error code indicating success/failure
5792 * @date 8 March 2012
5795 WILC_Sint32
host_int_get_assoc_res_info(WILC_WFIDrvHandle hWFIDrv
, u8
*pu8AssocRespInfo
,
5796 WILC_Uint32 u32MaxAssocRespInfoLen
, WILC_Uint32
*pu32RcvdAssocRespInfoLen
)
5798 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5800 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
5802 if (pstrWFIDrv
== NULL
) {
5803 PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n");
5804 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
5807 strWID
.u16WIDid
= (u16
)WID_ASSOC_RES_INFO
;
5808 strWID
.enuWIDtype
= WID_STR
;
5809 strWID
.ps8WidVal
= pu8AssocRespInfo
;
5810 strWID
.s32ValueSize
= u32MaxAssocRespInfoLen
;
5813 /* Sending Configuration packet */
5814 s32Error
= SendConfigPkt(GET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
5816 PRINT_ER("Failed to send association response config packet\n");
5817 *pu32RcvdAssocRespInfoLen
= 0;
5818 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
5820 *pu32RcvdAssocRespInfoLen
= strWID
.s32ValueSize
;
5823 WILC_CATCH(s32Error
)
5831 * @brief gets a Association Response info
5832 * @details Valid only in STA mode. This function gives the RSSI
5833 * values observed in all the channels at the time of scanning.
5834 * The length of the field is 1 greater that the total number of
5835 * channels supported. Byte 0 contains the number of channels while
5836 * each of Byte N contains the observed RSSI value for the channel index N.
5837 * @param[in,out] handle to the wifi driver,
5838 * array of scanned channels' RSSI
5839 * @return Error code indicating success/failure
5842 * @date 8 March 2012
5845 WILC_Sint32
host_int_get_rx_power_level(WILC_WFIDrvHandle hWFIDrv
, u8
*pu8RxPowerLevel
,
5846 WILC_Uint32 u32RxPowerLevelLen
)
5848 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5850 /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
5852 strWID
.u16WIDid
= (u16
)WID_RX_POWER_LEVEL
;
5853 strWID
.enuWIDtype
= WID_STR
;
5854 strWID
.ps8WidVal
= pu8RxPowerLevel
;
5855 strWID
.s32ValueSize
= u32RxPowerLevelLen
;
5862 * @brief sets a channel
5864 * @param[in,out] handle to the wifi driver,
5865 * @param[in] Index of the channel to be set
5866 *|-------------------------------------------------------------------|
5867 | CHANNEL1 CHANNEL2 .... CHANNEL14 |
5869 ||-------------------------------------------------------------------|
5870 * @return Error code indicating success/failure
5873 * @date 8 March 2012
5876 WILC_Sint32
host_int_set_mac_chnl_num(WILC_WFIDrvHandle hWFIDrv
, u8 u8ChNum
)
5878 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5879 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
5880 tstrHostIFmsg strHostIFmsg
;
5882 if (pstrWFIDrv
== NULL
) {
5883 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
5886 /* prepare the set channel message */
5887 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
5888 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_SET_CHANNEL
;
5889 strHostIFmsg
.uniHostIFmsgBody
.strHostIFSetChan
.u8SetChan
= u8ChNum
;
5890 strHostIFmsg
.drvHandler
= hWFIDrv
;
5892 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5894 WILC_ERRORREPORT(s32Error
, s32Error
);
5896 WILC_CATCH(s32Error
)
5905 WILC_Sint32
host_int_wait_msg_queue_idle(void)
5907 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5909 tstrHostIFmsg strHostIFmsg
;
5911 /* prepare the set driver handler message */
5913 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
5914 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_Q_IDLE
;
5915 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5917 WILC_ERRORREPORT(s32Error
, s32Error
);
5919 WILC_CATCH(s32Error
)
5924 /* wait untill MSG Q is empty */
5925 down(&hWaitResponse
);
5931 WILC_Sint32
host_int_set_wfi_drv_handler(WILC_Uint32 u32address
)
5933 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5935 tstrHostIFmsg strHostIFmsg
;
5938 /* prepare the set driver handler message */
5940 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
5941 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_SET_WFIDRV_HANDLER
;
5942 strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetDrvHandler
.u32Address
= u32address
;
5943 /* strHostIFmsg.drvHandler=hWFIDrv; */
5945 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5947 WILC_ERRORREPORT(s32Error
, s32Error
);
5949 WILC_CATCH(s32Error
)
5959 WILC_Sint32
host_int_set_operation_mode(WILC_WFIDrvHandle hWFIDrv
, WILC_Uint32 u32mode
)
5961 WILC_Sint32 s32Error
= WILC_SUCCESS
;
5963 tstrHostIFmsg strHostIFmsg
;
5966 /* prepare the set driver handler message */
5968 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
5969 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_SET_OPERATION_MODE
;
5970 strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetOperationMode
.u32Mode
= u32mode
;
5971 strHostIFmsg
.drvHandler
= hWFIDrv
;
5973 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
5975 WILC_ERRORREPORT(s32Error
, s32Error
);
5977 WILC_CATCH(s32Error
)
5986 * @brief gets the current channel index
5988 * @param[in,out] handle to the wifi driver,
5989 * current channel index
5990 *|-----------------------------------------------------------------------|
5991 | CHANNEL1 CHANNEL2 .... CHANNEL14 |
5993 ||-----------------------------------------------------------------------|
5994 * @return Error code indicating success/failure
5997 * @date 8 March 2012
6000 WILC_Sint32
host_int_get_host_chnl_num(WILC_WFIDrvHandle hWFIDrv
, u8
*pu8ChNo
)
6002 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6003 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
6004 tstrHostIFmsg strHostIFmsg
;
6006 if (pstrWFIDrv
== NULL
) {
6007 PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n");
6008 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
6011 /* prepare the Get Channel Message */
6012 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
6014 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_GET_CHNL
;
6015 strHostIFmsg
.drvHandler
= hWFIDrv
;
6017 /* send the message */
6018 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
6020 PRINT_ER("Failed to send get host channel param's message queue ");
6021 down(&(pstrWFIDrv
->hSemGetCHNL
));
6026 WILC_CATCH(s32Error
)
6037 * @brief host_int_test_set_int_wid
6038 * @details Test function for setting wids
6039 * @param[in,out] WILC_WFIDrvHandle hWFIDrv, WILC_Uint32 u32TestMemAddr
6040 * @return Error code indicating success/failure
6043 * @date 8 March 2012
6046 WILC_Sint32
host_int_test_set_int_wid(WILC_WFIDrvHandle hWFIDrv
, WILC_Uint32 u32TestMemAddr
)
6048 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6050 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
6053 if (pstrWFIDrv
== NULL
) {
6054 PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n");
6055 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
6058 /*prepare configuration packet*/
6059 strWID
.u16WIDid
= (u16
)WID_MEMORY_ADDRESS
;
6060 strWID
.enuWIDtype
= WID_INT
;
6061 strWID
.ps8WidVal
= (WILC_Char
*)&u32TestMemAddr
;
6062 strWID
.s32ValueSize
= sizeof(WILC_Uint32
);
6065 s32Error
= SendConfigPkt(SET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
6067 PRINT_ER("Test Function: Failed to set wid value\n");
6068 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
6070 PRINT_D(HOSTINF_DBG
, "Successfully set wid value\n");
6074 WILC_CATCH(s32Error
)
6081 #ifdef WILC_AP_EXTERNAL_MLME
6083 * @brief host_int_get_inactive_time
6085 * @param[in,out] handle to the wifi driver,
6086 * current sta macaddress, inactive_time
6093 WILC_Sint32
host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv
, const u8
*mac
, WILC_Uint32
*pu32InactiveTime
)
6095 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6096 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
6097 tstrHostIFmsg strHostIFmsg
;
6099 if (pstrWFIDrv
== NULL
) {
6100 PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n");
6101 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
6104 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
6107 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIfStaInactiveT
.mac
,
6110 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_GET_INACTIVETIME
;
6111 strHostIFmsg
.drvHandler
= hWFIDrv
;
6113 /* send the message */
6114 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
6116 PRINT_ER("Failed to send get host channel param's message queue ");
6118 down(&(pstrWFIDrv
->hSemInactiveTime
));
6120 *pu32InactiveTime
= gu32InactiveTime
;
6122 WILC_CATCH(s32Error
)
6130 * @brief host_int_test_get_int_wid
6131 * @details Test function for getting wids
6132 * @param[in,out] WILC_WFIDrvHandle hWFIDrv, WILC_Uint32* pu32TestMemAddr
6133 * @return Error code indicating success/failure
6136 * @date 8 March 2012
6139 WILC_Sint32
host_int_test_get_int_wid(WILC_WFIDrvHandle hWFIDrv
, WILC_Uint32
*pu32TestMemAddr
)
6142 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6144 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
6147 if (pstrWFIDrv
== NULL
) {
6148 PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n");
6149 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
6152 strWID
.u16WIDid
= (u16
)WID_MEMORY_ADDRESS
;
6153 strWID
.enuWIDtype
= WID_INT
;
6154 strWID
.ps8WidVal
= (WILC_Sint8
*)pu32TestMemAddr
;
6155 strWID
.s32ValueSize
= sizeof(WILC_Uint32
);
6157 s32Error
= SendConfigPkt(GET_CFG
, &strWID
, 1, WILC_TRUE
, (WILC_Uint32
)pstrWFIDrv
);
6158 /*get the value by searching the local copy*/
6160 PRINT_ER("Test Function: Failed to get wid value\n");
6161 WILC_ERRORREPORT(s32Error
, WILC_INVALID_STATE
);
6163 PRINT_D(HOSTINF_DBG
, "Successfully got wid value\n");
6167 WILC_CATCH(s32Error
)
6176 * @brief host_int_get_rssi
6177 * @details gets the currently maintained RSSI value for the station.
6178 * The received signal strength value in dB.
6179 * The range of valid values is -128 to 0.
6180 * @param[in,out] handle to the wifi driver,
6182 * @return Error code indicating success/failure
6185 * @date 8 March 2012
6188 WILC_Sint32
host_int_get_rssi(WILC_WFIDrvHandle hWFIDrv
, WILC_Sint8
*ps8Rssi
)
6190 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6191 tstrHostIFmsg strHostIFmsg
;
6192 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
6195 /* prepare the Get RSSI Message */
6196 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
6198 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_GET_RSSI
;
6199 strHostIFmsg
.drvHandler
= hWFIDrv
;
6201 /* send the message */
6202 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
6204 PRINT_ER("Failed to send get host channel param's message queue ");
6208 down(&(pstrWFIDrv
->hSemGetRSSI
));
6211 if (ps8Rssi
== NULL
) {
6212 PRINT_ER("RSS pointer value is null");
6223 WILC_Sint32
host_int_get_link_speed(WILC_WFIDrvHandle hWFIDrv
, WILC_Sint8
*ps8lnkspd
)
6225 tstrHostIFmsg strHostIFmsg
;
6226 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6228 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
6232 /* prepare the Get LINKSPEED Message */
6233 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
6235 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_GET_LINKSPEED
;
6236 strHostIFmsg
.drvHandler
= hWFIDrv
;
6238 /* send the message */
6239 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
6241 PRINT_ER("Failed to send GET_LINKSPEED to message queue ");
6245 down(&(pstrWFIDrv
->hSemGetLINKSPEED
));
6248 if (ps8lnkspd
== NULL
) {
6249 PRINT_ER("LINKSPEED pointer value is null");
6254 *ps8lnkspd
= gs8lnkspd
;
6260 WILC_Sint32
host_int_get_statistics(WILC_WFIDrvHandle hWFIDrv
, tstrStatistics
*pstrStatistics
)
6262 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6263 tstrHostIFmsg strHostIFmsg
;
6266 /* prepare the Get RSSI Message */
6267 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
6269 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_GET_STATISTICS
;
6270 strHostIFmsg
.uniHostIFmsgBody
.pUserData
= (WILC_Char
*)pstrStatistics
;
6271 strHostIFmsg
.drvHandler
= hWFIDrv
;
6272 /* send the message */
6273 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
6275 PRINT_ER("Failed to send get host channel param's message queue ");
6279 down(&hWaitResponse
);
6285 * @brief host_int_scan
6286 * @details scans a set of channels
6287 * @param[in,out] handle to the wifi driver,
6288 * @param[in] Scan source
6289 * Scan Type PASSIVE_SCAN = 0,
6292 * Channels Array length
6293 * Scan Callback function
6294 * @return Error code indicating success/failure
6297 * @date 8 March 2012
6300 WILC_Sint32
host_int_scan(WILC_WFIDrvHandle hWFIDrv
, u8 u8ScanSource
,
6301 u8 u8ScanType
, u8
*pu8ChnlFreqList
,
6302 u8 u8ChnlListLen
, const u8
*pu8IEs
,
6303 size_t IEsLen
, tWILCpfScanResult ScanResult
,
6304 void *pvUserArg
, tstrHiddenNetwork
*pstrHiddenNetwork
)
6306 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6307 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
6308 tstrHostIFmsg strHostIFmsg
;
6309 tenuScanConnTimer enuScanConnTimer
;
6311 if (pstrWFIDrv
== NULL
|| ScanResult
== NULL
) {
6312 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
6316 /* prepare the Scan Message */
6317 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
6319 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_SCAN
;
6321 if (pstrHiddenNetwork
!= NULL
) {
6322 strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.strHiddenNetwork
.pstrHiddenNetworkInfo
= pstrHiddenNetwork
->pstrHiddenNetworkInfo
;
6323 strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.strHiddenNetwork
.u8ssidnum
= pstrHiddenNetwork
->u8ssidnum
;
6326 PRINT_D(HOSTINF_DBG
, "pstrHiddenNetwork IS EQUAL TO NULL\n");
6328 strHostIFmsg
.drvHandler
= hWFIDrv
;
6329 strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.u8ScanSource
= u8ScanSource
;
6330 strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.u8ScanType
= u8ScanType
;
6331 strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.pfScanResult
= ScanResult
;
6332 strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.pvUserArg
= pvUserArg
;
6334 strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.u8ChnlListLen
= u8ChnlListLen
;
6335 strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.pu8ChnlFreqList
= (u8
*)WILC_MALLOC(u8ChnlListLen
); /* will be deallocated by the receiving thread */
6336 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.pu8ChnlFreqList
,
6337 pu8ChnlFreqList
, u8ChnlListLen
);
6339 strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.IEsLen
= IEsLen
;
6340 strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.pu8IEs
= (u8
*)WILC_MALLOC(IEsLen
); /* will be deallocated by the receiving thread */
6341 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strHostIFscanAttr
.pu8IEs
,
6344 /* send the message */
6345 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
6347 PRINT_ER("Error in sending message queue scanning parameters: Error(%d)\n", s32Error
);
6348 WILC_ERRORREPORT(s32Error
, WILC_FAIL
);
6351 enuScanConnTimer
= SCAN_TIMER
;
6352 PRINT_D(HOSTINF_DBG
, ">> Starting the SCAN timer\n");
6353 WILC_TimerStart(&(pstrWFIDrv
->hScanTimer
), HOST_IF_SCAN_TIMEOUT
, (void *) hWFIDrv
, NULL
);
6356 WILC_CATCH(s32Error
)
6364 * @brief hif_set_cfg
6365 * @details sets configuration wids values
6366 * @param[in,out] handle to the wifi driver,
6367 * @param[in] WID, WID value
6368 * @return Error code indicating success/failure
6371 * @date 8 March 2012
6374 WILC_Sint32
hif_set_cfg(WILC_WFIDrvHandle hWFIDrv
, tstrCfgParamVal
*pstrCfgParamVal
)
6377 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6378 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
6380 tstrHostIFmsg strHostIFmsg
;
6383 if (pstrWFIDrv
== NULL
) {
6384 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
6386 /* prepare the WiphyParams Message */
6387 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
6388 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_CFG_PARAMS
;
6389 strHostIFmsg
.uniHostIFmsgBody
.strHostIFCfgParamAttr
.pstrCfgParamVal
= *pstrCfgParamVal
;
6390 strHostIFmsg
.drvHandler
= hWFIDrv
;
6392 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
6394 WILC_CATCH(s32Error
)
6404 * @brief hif_get_cfg
6405 * @details gets configuration wids values
6406 * @param[in,out] handle to the wifi driver,
6409 * @return Error code indicating success/failure
6413 * @date 8 March 2012
6416 WILC_Sint32
hif_get_cfg(WILC_WFIDrvHandle hWFIDrv
, u16 u16WID
, u16
*pu16WID_Value
)
6418 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6419 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
6421 down(&(pstrWFIDrv
->gtOsCfgValuesSem
));
6423 if (pstrWFIDrv
== NULL
) {
6424 PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n");
6425 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
6427 PRINT_D(HOSTINF_DBG
, "Getting configuration parameters\n");
6431 *pu16WID_Value
= (u16
)pstrWFIDrv
->strCfgValues
.bss_type
;
6435 *pu16WID_Value
= (u16
)pstrWFIDrv
->strCfgValues
.auth_type
;
6438 case WID_AUTH_TIMEOUT
:
6439 *pu16WID_Value
= pstrWFIDrv
->strCfgValues
.auth_timeout
;
6442 case WID_POWER_MANAGEMENT
:
6443 *pu16WID_Value
= (u16
)pstrWFIDrv
->strCfgValues
.power_mgmt_mode
;
6446 case WID_SHORT_RETRY_LIMIT
:
6447 *pu16WID_Value
= pstrWFIDrv
->strCfgValues
.short_retry_limit
;
6450 case WID_LONG_RETRY_LIMIT
:
6451 *pu16WID_Value
= pstrWFIDrv
->strCfgValues
.long_retry_limit
;
6454 case WID_FRAG_THRESHOLD
:
6455 *pu16WID_Value
= pstrWFIDrv
->strCfgValues
.frag_threshold
;
6458 case WID_RTS_THRESHOLD
:
6459 *pu16WID_Value
= pstrWFIDrv
->strCfgValues
.rts_threshold
;
6463 *pu16WID_Value
= (u16
)pstrWFIDrv
->strCfgValues
.preamble_type
;
6466 case WID_SHORT_SLOT_ALLOWED
:
6467 *pu16WID_Value
= (u16
) pstrWFIDrv
->strCfgValues
.short_slot_allowed
;
6470 case WID_11N_TXOP_PROT_DISABLE
:
6471 *pu16WID_Value
= (u16
)pstrWFIDrv
->strCfgValues
.txop_prot_disabled
;
6474 case WID_BEACON_INTERVAL
:
6475 *pu16WID_Value
= pstrWFIDrv
->strCfgValues
.beacon_interval
;
6478 case WID_DTIM_PERIOD
:
6479 *pu16WID_Value
= (u16
)pstrWFIDrv
->strCfgValues
.dtim_period
;
6482 case WID_SITE_SURVEY
:
6483 *pu16WID_Value
= (u16
)pstrWFIDrv
->strCfgValues
.site_survey_enabled
;
6486 case WID_SITE_SURVEY_SCAN_TIME
:
6487 *pu16WID_Value
= pstrWFIDrv
->strCfgValues
.site_survey_scan_time
;
6490 case WID_ACTIVE_SCAN_TIME
:
6491 *pu16WID_Value
= pstrWFIDrv
->strCfgValues
.active_scan_time
;
6494 case WID_PASSIVE_SCAN_TIME
:
6495 *pu16WID_Value
= pstrWFIDrv
->strCfgValues
.passive_scan_time
;
6498 case WID_CURRENT_TX_RATE
:
6499 *pu16WID_Value
= pstrWFIDrv
->strCfgValues
.curr_tx_rate
;
6506 up(&(pstrWFIDrv
->gtOsCfgValuesSem
));
6508 WILC_CATCH(s32Error
)
6515 /*****************************************************************************/
6516 /* Notification Functions */
6517 /*****************************************************************************/
6519 * @brief notifies host with join and leave requests
6520 * @details This function prepares an Information frame having the
6521 * information about a joining/leaving station.
6522 * @param[in,out] handle to the wifi driver,
6523 * @param[in] 6 byte Sta Adress
6524 * Join or leave flag:
6527 * @return Error code indicating success/failure
6530 * @date 8 March 2012
6533 void host_int_send_join_leave_info_to_host
6534 (u16 assocId
, u8
*stationAddr
, WILC_Bool joining
)
6538 * @brief notifies host with stations found in scan
6539 * @details sends the beacon/probe response from scan
6540 * @param[in,out] handle to the wifi driver,
6541 * @param[in] Sta Address,
6543 * Rssi of the Station found
6544 * @return Error code indicating success/failure
6547 * @date 8 March 2012
6551 void GetPeriodicRSSI(void *pvArg
)
6553 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)pvArg
;
6554 if (pstrWFIDrv
== NULL
) {
6555 PRINT_ER("Driver handler is NULL\n");
6559 if (pstrWFIDrv
->enuHostIFstate
== HOST_IF_CONNECTED
) {
6560 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6561 tstrHostIFmsg strHostIFmsg
;
6563 /* prepare the Get RSSI Message */
6564 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
6566 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_GET_RSSI
;
6567 strHostIFmsg
.drvHandler
= pstrWFIDrv
;
6569 /* send the message */
6570 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
6572 PRINT_ER("Failed to send get host channel param's message queue ");
6576 WILC_TimerStart(&(g_hPeriodicRSSI
), 5000, (void *)pstrWFIDrv
, NULL
);
6580 void host_int_send_network_info_to_host
6581 (u8
*macStartAddress
, u16 u16RxFrameLen
, WILC_Sint8 s8Rssi
)
6585 * @brief host_int_init
6586 * @details host interface initialization function
6587 * @param[in,out] handle to the wifi driver,
6590 * @date 8 March 2012
6593 static WILC_Uint32 u32Intialized
;
6594 static WILC_Uint32 msgQ_created
;
6595 static WILC_Uint32 clients_count
;
6597 WILC_Sint32
host_int_init(WILC_WFIDrvHandle
*phWFIDrv
)
6599 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6600 tstrWILC_WFIDrv
*pstrWFIDrv
;
6602 /*if(u32Intialized == 1)
6604 * PRINT_D(HOSTINF_DBG,"Host interface is previously initialized\n");
6605 * *phWFIDrv = (WILC_WFIDrvHandle)gWFiDrvHandle; //Will be adjusted later for P2P
6608 PRINT_D(HOSTINF_DBG
, "Initializing host interface for client %d\n", clients_count
+ 1);
6610 gbScanWhileConnected
= WILC_FALSE
;
6612 sema_init(&hWaitResponse
, 0);
6616 /*Allocate host interface private structure*/
6617 pstrWFIDrv
= (tstrWILC_WFIDrv
*)WILC_MALLOC(sizeof(tstrWILC_WFIDrv
));
6618 if (pstrWFIDrv
== NULL
) {
6619 /* WILC_ERRORREPORT(s32Error,WILC_NO_MEM); */
6620 s32Error
= WILC_NO_MEM
;
6621 PRINT_ER("Failed to allocate memory\n");
6624 WILC_memset(pstrWFIDrv
, 0, sizeof(tstrWILC_WFIDrv
));
6625 /*return driver handle to user*/
6626 *phWFIDrv
= (WILC_WFIDrvHandle
)pstrWFIDrv
;
6627 /*save into globl handle*/
6629 #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
6631 g_obtainingIP
= WILC_FALSE
;
6634 PRINT_D(HOSTINF_DBG
, "Global handle pointer value=%p\n", pstrWFIDrv
);
6635 /* /////////////////////////////////////// */
6636 if (clients_count
== 0) {
6637 sema_init(&hSemHostIFthrdEnd
, 0);
6638 sema_init(&hSemDeinitDrvHandle
, 0);
6640 sema_init(&hSemHostIntDeinit
, 1);
6643 sema_init(&(pstrWFIDrv
->hSemTestKeyBlock
), 0);
6644 sema_init(&(pstrWFIDrv
->hSemTestDisconnectBlock
), 0);
6645 sema_init(&(pstrWFIDrv
->hSemGetRSSI
), 0);
6646 sema_init(&(pstrWFIDrv
->hSemGetLINKSPEED
), 0);
6647 sema_init(&(pstrWFIDrv
->hSemGetCHNL
), 0);
6648 sema_init(&(pstrWFIDrv
->hSemInactiveTime
), 0);
6650 /* /////////////////////////////////////// */
6654 PRINT_D(HOSTINF_DBG
, "INIT: CLIENT COUNT %d\n", clients_count
);
6656 if (clients_count
== 0) {
6658 s32Error
= WILC_MsgQueueCreate(&gMsgQHostIF
, NULL
);
6662 PRINT_ER("Failed to creat MQ\n");
6666 HostIFthreadHandler
= kthread_run(hostIFthread
, NULL
, "WILC_kthread");
6667 if (IS_ERR(HostIFthreadHandler
)) {
6668 PRINT_ER("Failed to creat Thread\n");
6669 s32Error
= WILC_FAIL
;
6672 s32Error
= WILC_TimerCreate(&(g_hPeriodicRSSI
), GetPeriodicRSSI
, NULL
);
6674 PRINT_ER("Failed to creat Timer\n");
6677 WILC_TimerStart(&(g_hPeriodicRSSI
), 5000, (void *)pstrWFIDrv
, NULL
);
6682 s32Error
= WILC_TimerCreate(&(pstrWFIDrv
->hScanTimer
), TimerCB_Scan
, NULL
);
6684 PRINT_ER("Failed to creat Timer\n");
6688 s32Error
= WILC_TimerCreate(&(pstrWFIDrv
->hConnectTimer
), TimerCB_Connect
, NULL
);
6690 PRINT_ER("Failed to creat Timer\n");
6696 /*Remain on channel timer*/
6697 s32Error
= WILC_TimerCreate(&(pstrWFIDrv
->hRemainOnChannel
), ListenTimerCB
, NULL
);
6699 PRINT_ER("Failed to creat Remain-on-channel Timer\n");
6704 sema_init(&(pstrWFIDrv
->gtOsCfgValuesSem
), 1);
6705 down(&(pstrWFIDrv
->gtOsCfgValuesSem
));
6713 pstrWFIDrv
->enuHostIFstate
= HOST_IF_IDLE
;
6714 /* gWFiDrvHandle->bPendingConnRequest = WILC_FALSE; */
6716 /*Initialize CFG WIDS Defualt Values*/
6718 pstrWFIDrv
->strCfgValues
.site_survey_enabled
= SITE_SURVEY_OFF
;
6719 pstrWFIDrv
->strCfgValues
.scan_source
= DEFAULT_SCAN
;
6720 pstrWFIDrv
->strCfgValues
.active_scan_time
= ACTIVE_SCAN_TIME
;
6721 pstrWFIDrv
->strCfgValues
.passive_scan_time
= PASSIVE_SCAN_TIME
;
6722 pstrWFIDrv
->strCfgValues
.curr_tx_rate
= AUTORATE
;
6727 pstrWFIDrv
->u64P2p_MgmtTimeout
= 0;
6731 PRINT_INFO(HOSTINF_DBG
, "Initialization values, Site survey value: %d\n Scan source: %d\n Active scan time: %d\n Passive scan time: %d\nCurrent tx Rate = %d\n",
6733 pstrWFIDrv
->strCfgValues
.site_survey_enabled
, pstrWFIDrv
->strCfgValues
.scan_source
,
6734 pstrWFIDrv
->strCfgValues
.active_scan_time
, pstrWFIDrv
->strCfgValues
.passive_scan_time
,
6735 pstrWFIDrv
->strCfgValues
.curr_tx_rate
);
6738 up(&(pstrWFIDrv
->gtOsCfgValuesSem
));
6740 /*TODO Code to setup simulation to be removed later*/
6741 /*Intialize configurator module*/
6742 s32Error
= CoreConfiguratorInit();
6744 PRINT_ER("Failed to initialize core configurator\n");
6749 /*Initialize Simulaor*/
6750 CoreConfigSimulatorInit();
6754 clients_count
++; /* increase number of created entities */
6760 if (pstrWFIDrv
!= NULL
)
6761 WILC_FREE(pstrWFIDrv
);
6764 WILC_TimerDestroy(&(pstrWFIDrv
->hRemainOnChannel
), NULL
);
6767 up(&(pstrWFIDrv
->gtOsCfgValuesSem
));
6768 WILC_TimerDestroy(&(pstrWFIDrv
->hConnectTimer
), NULL
);
6770 WILC_TimerDestroy(&(pstrWFIDrv
->hScanTimer
), NULL
);
6772 kthread_stop(HostIFthreadHandler
);
6774 WILC_MsgQueueDestroy(&gMsgQHostIF
, NULL
);
6781 * @brief host_int_deinit
6782 * @details host interface initialization function
6783 * @param[in,out] handle to the wifi driver,
6786 * @date 8 March 2012
6790 WILC_Sint32
host_int_deinit(WILC_WFIDrvHandle hWFIDrv
)
6792 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6793 tstrHostIFmsg strHostIFmsg
;
6796 /*obtain driver handle*/
6797 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
6798 /*if(u32Intialized == 0)
6800 * PRINT_ER("Host Interface is not initialized\n");
6806 if (pstrWFIDrv
== NULL
) {
6807 PRINT_ER("pstrWFIDrv = NULL\n");
6811 down(&hSemHostIntDeinit
);
6813 terminated_handle
= pstrWFIDrv
;
6814 PRINT_D(HOSTINF_DBG
, "De-initializing host interface for client %d\n", clients_count
);
6817 /*Destroy all timers before acquiring hSemDeinitDrvHandle*/
6818 /*to guarantee handling all messages befor proceeding*/
6819 if (WILC_TimerDestroy(&(pstrWFIDrv
->hScanTimer
), NULL
)) {
6820 PRINT_D(HOSTINF_DBG
, ">> Scan timer is active \n");
6821 /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */
6824 if (WILC_TimerDestroy(&(pstrWFIDrv
->hConnectTimer
), NULL
)) {
6825 PRINT_D(HOSTINF_DBG
, ">> Connect timer is active \n");
6826 /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */
6830 if (WILC_TimerDestroy(&(g_hPeriodicRSSI
), NULL
)) {
6831 PRINT_D(HOSTINF_DBG
, ">> Connect timer is active \n");
6832 /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */
6836 /*Destroy Remain-onchannel Timer*/
6837 WILC_TimerDestroy(&(pstrWFIDrv
->hRemainOnChannel
), NULL
);
6840 host_int_set_wfi_drv_handler((WILC_Uint32
)NULL
);
6841 down(&hSemDeinitDrvHandle
);
6844 /*Calling the CFG80211 scan done function with the abort flag set to true*/
6845 if (pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
) {
6846 pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult(SCAN_EVENT_ABORTED
, NULL
,
6847 pstrWFIDrv
->strWILC_UsrScanReq
.u32UserScanPvoid
, NULL
);
6849 pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
= NULL
;
6851 /*deinit configurator and simulator*/
6853 CoreConfigSimulatorDeInit();
6855 CoreConfiguratorDeInit();
6860 pstrWFIDrv
->enuHostIFstate
= HOST_IF_IDLE
;
6862 gbScanWhileConnected
= WILC_FALSE
;
6864 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
6866 if (clients_count
== 1) {
6867 if (WILC_TimerDestroy(&g_hPeriodicRSSI
, NULL
)) {
6868 PRINT_D(HOSTINF_DBG
, ">> Connect timer is active \n");
6869 /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */
6871 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_EXIT
;
6872 strHostIFmsg
.drvHandler
= hWFIDrv
;
6875 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
6876 if (s32Error
!= WILC_SUCCESS
) {
6877 PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", s32Error
);
6880 down(&hSemHostIFthrdEnd
);
6884 WILC_MsgQueueDestroy(&gMsgQHostIF
, NULL
);
6888 down(&(pstrWFIDrv
->gtOsCfgValuesSem
));
6890 /*Setting the gloabl driver handler with NULL*/
6892 /* gWFiDrvHandle = NULL; */
6893 if (pstrWFIDrv
!= NULL
) {
6894 WILC_FREE(pstrWFIDrv
);
6895 /* pstrWFIDrv=NULL; */
6899 clients_count
--; /* Decrease number of created entities */
6900 terminated_handle
= NULL
;
6901 up(&hSemHostIntDeinit
);
6907 * @brief NetworkInfoReceived
6908 * @details function to to be called when network info packet is received
6909 * @param[in] pu8Buffer the received packet
6910 * @param[in] u32Length length of the received packet
6917 void NetworkInfoReceived(u8
*pu8Buffer
, WILC_Uint32 u32Length
)
6919 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6920 tstrHostIFmsg strHostIFmsg
;
6921 WILC_Uint32 drvHandler
;
6922 tstrWILC_WFIDrv
*pstrWFIDrv
= NULL
;
6924 drvHandler
= ((pu8Buffer
[u32Length
- 4]) | (pu8Buffer
[u32Length
- 3] << 8) | (pu8Buffer
[u32Length
- 2] << 16) | (pu8Buffer
[u32Length
- 1] << 24));
6925 pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
6930 if (pstrWFIDrv
== NULL
|| pstrWFIDrv
== terminated_handle
) {
6931 PRINT_ER("NetworkInfo received but driver not init[%p]\n", pstrWFIDrv
);
6935 /* prepare the Asynchronous Network Info message */
6936 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
6938 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_RCVD_NTWRK_INFO
;
6939 strHostIFmsg
.drvHandler
= pstrWFIDrv
;
6941 strHostIFmsg
.uniHostIFmsgBody
.strRcvdNetworkInfo
.u32Length
= u32Length
;
6942 strHostIFmsg
.uniHostIFmsgBody
.strRcvdNetworkInfo
.pu8Buffer
= (u8
*)WILC_MALLOC(u32Length
); /* will be deallocated by the receiving thread */
6943 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strRcvdNetworkInfo
.pu8Buffer
,
6944 pu8Buffer
, u32Length
);
6946 /* send the message */
6947 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
6949 PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error
);
6957 * @brief GnrlAsyncInfoReceived
6958 * @details function to be called when general Asynchronous info packet is received
6959 * @param[in] pu8Buffer the received packet
6960 * @param[in] u32Length length of the received packet
6967 void GnrlAsyncInfoReceived(u8
*pu8Buffer
, WILC_Uint32 u32Length
)
6969 WILC_Sint32 s32Error
= WILC_SUCCESS
;
6970 tstrHostIFmsg strHostIFmsg
;
6971 WILC_Uint32 drvHandler
;
6972 tstrWILC_WFIDrv
*pstrWFIDrv
= NULL
;
6975 down(&hSemHostIntDeinit
);
6977 drvHandler
= ((pu8Buffer
[u32Length
- 4]) | (pu8Buffer
[u32Length
- 3] << 8) | (pu8Buffer
[u32Length
- 2] << 16) | (pu8Buffer
[u32Length
- 1] << 24));
6978 pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
6979 PRINT_D(HOSTINF_DBG
, "General asynchronous info packet received \n");
6982 if (pstrWFIDrv
== NULL
|| pstrWFIDrv
== terminated_handle
) {
6983 PRINT_D(HOSTINF_DBG
, "Wifi driver handler is equal to NULL\n");
6985 up(&hSemHostIntDeinit
);
6989 if (pstrWFIDrv
->strWILC_UsrConnReq
.pfUserConnectResult
== NULL
) {
6990 /* received mac status is not needed when there is no current Connect Request */
6991 PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n");
6993 up(&hSemHostIntDeinit
);
6997 /* prepare the General Asynchronous Info message */
6998 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7001 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO
;
7002 strHostIFmsg
.drvHandler
= pstrWFIDrv
;
7005 strHostIFmsg
.uniHostIFmsgBody
.strRcvdGnrlAsyncInfo
.u32Length
= u32Length
;
7006 strHostIFmsg
.uniHostIFmsgBody
.strRcvdGnrlAsyncInfo
.pu8Buffer
= (u8
*)WILC_MALLOC(u32Length
); /* will be deallocated by the receiving thread */
7007 WILC_memcpy(strHostIFmsg
.uniHostIFmsgBody
.strRcvdGnrlAsyncInfo
.pu8Buffer
,
7008 pu8Buffer
, u32Length
);
7010 /* send the message */
7011 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7013 PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", s32Error
);
7017 up(&hSemHostIntDeinit
);
7022 * @brief host_int_ScanCompleteReceived
7023 * @details Setting scan complete received notifcation in message queue
7024 * @param[in] u8* pu8Buffer, WILC_Uint32 u32Length
7025 * @return Error code.
7030 void host_int_ScanCompleteReceived(u8
*pu8Buffer
, WILC_Uint32 u32Length
)
7032 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7033 tstrHostIFmsg strHostIFmsg
;
7034 WILC_Uint32 drvHandler
;
7035 tstrWILC_WFIDrv
*pstrWFIDrv
= NULL
;
7036 drvHandler
= ((pu8Buffer
[u32Length
- 4]) | (pu8Buffer
[u32Length
- 3] << 8) | (pu8Buffer
[u32Length
- 2] << 16) | (pu8Buffer
[u32Length
- 1] << 24));
7037 pstrWFIDrv
= (tstrWILC_WFIDrv
*)drvHandler
;
7040 PRINT_D(GENERIC_DBG
, "Scan notification received %p\n", pstrWFIDrv
);
7042 if (pstrWFIDrv
== NULL
|| pstrWFIDrv
== terminated_handle
) {
7046 /*if there is an ongoing scan request*/
7047 if (pstrWFIDrv
->strWILC_UsrScanReq
.pfUserScanResult
) {
7048 /* prepare theScan Done message */
7049 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7051 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_RCVD_SCAN_COMPLETE
;
7052 strHostIFmsg
.drvHandler
= pstrWFIDrv
;
7055 /* will be deallocated by the receiving thread */
7056 /*no need to send message body*/
7058 /*strHostIFmsg.uniHostIFmsgBody.strScanComplete.u32Length = u32Length;
7059 * strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length);
7060 * WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer,
7061 * pu8Buffer, u32Length); */
7063 /* send the message */
7064 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7066 PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", s32Error
);
7077 * @brief host_int_remain_on_channel
7079 * @param[in] Handle to wifi driver
7080 * Duration to remain on channel
7081 * Channel to remain on
7082 * Pointer to fn to be called on receive frames in listen state
7083 * Pointer to remain-on-channel expired fn
7085 * @return Error code.
7090 WILC_Sint32
host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv
, WILC_Uint32 u32SessionID
, WILC_Uint32 u32duration
, u16 chan
, tWILCpfRemainOnChanExpired RemainOnChanExpired
, tWILCpfRemainOnChanReady RemainOnChanReady
, void *pvUserArg
)
7092 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7093 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7094 tstrHostIFmsg strHostIFmsg
;
7096 if (pstrWFIDrv
== NULL
) {
7097 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7100 /* prepare the remainonchan Message */
7101 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7103 /* prepare the WiphyParams Message */
7104 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_REMAIN_ON_CHAN
;
7105 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRemainOnChan
.u16Channel
= chan
;
7106 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRemainOnChan
.pRemainOnChanExpired
= RemainOnChanExpired
;
7107 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRemainOnChan
.pRemainOnChanReady
= RemainOnChanReady
;
7108 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRemainOnChan
.pVoid
= pvUserArg
;
7109 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRemainOnChan
.u32duration
= u32duration
;
7110 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRemainOnChan
.u32ListenSessionID
= u32SessionID
;
7111 strHostIFmsg
.drvHandler
= hWFIDrv
;
7113 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7115 WILC_ERRORREPORT(s32Error
, s32Error
);
7117 WILC_CATCH(s32Error
)
7126 * @brief host_int_ListenStateExpired
7128 * @param[in] Handle to wifi driver
7129 * Duration to remain on channel
7130 * Channel to remain on
7131 * Pointer to fn to be called on receive frames in listen state
7132 * Pointer to remain-on-channel expired fn
7134 * @return Error code.
7139 WILC_Sint32
host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv
, WILC_Uint32 u32SessionID
)
7141 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7142 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7143 tstrHostIFmsg strHostIFmsg
;
7145 if (pstrWFIDrv
== NULL
) {
7146 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7149 /*Stopping remain-on-channel timer*/
7150 WILC_TimerStop(&(pstrWFIDrv
->hRemainOnChannel
), NULL
);
7152 /* prepare the timer fire Message */
7153 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7154 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_LISTEN_TIMER_FIRED
;
7155 strHostIFmsg
.drvHandler
= hWFIDrv
;
7156 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRemainOnChan
.u32ListenSessionID
= u32SessionID
;
7158 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7160 WILC_ERRORREPORT(s32Error
, s32Error
);
7162 WILC_CATCH(s32Error
)
7170 * @brief host_int_frame_register
7172 * @param[in] Handle to wifi driver
7173 * @return Error code.
7177 WILC_Sint32
host_int_frame_register(WILC_WFIDrvHandle hWFIDrv
, u16 u16FrameType
, WILC_Bool bReg
)
7179 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7180 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7181 tstrHostIFmsg strHostIFmsg
;
7183 if (pstrWFIDrv
== NULL
) {
7184 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7187 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7189 /* prepare the WiphyParams Message */
7190 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_REGISTER_FRAME
;
7191 switch (u16FrameType
) {
7193 PRINT_D(HOSTINF_DBG
, "ACTION\n");
7194 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRegisterFrame
.u8Regid
= ACTION_FRM_IDX
;
7198 PRINT_D(HOSTINF_DBG
, "PROBE REQ\n");
7199 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRegisterFrame
.u8Regid
= PROBE_REQ_IDX
;
7203 PRINT_D(HOSTINF_DBG
, "Not valid frame type\n");
7206 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRegisterFrame
.u16FrameType
= u16FrameType
;
7207 strHostIFmsg
.uniHostIFmsgBody
.strHostIfRegisterFrame
.bReg
= bReg
;
7208 strHostIFmsg
.drvHandler
= hWFIDrv
;
7210 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7212 WILC_ERRORREPORT(s32Error
, s32Error
);
7214 WILC_CATCH(s32Error
)
7225 #ifdef WILC_AP_EXTERNAL_MLME
7227 * @brief host_int_add_beacon
7228 * @details Setting add beacon params in message queue
7229 * @param[in] WILC_WFIDrvHandle hWFIDrv, WILC_Uint32 u32Interval,
7230 * WILC_Uint32 u32DTIMPeriod,WILC_Uint32 u32HeadLen, u8* pu8Head,
7231 * WILC_Uint32 u32TailLen, u8* pu8Tail
7232 * @return Error code.
7237 WILC_Sint32
host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv
, WILC_Uint32 u32Interval
,
7238 WILC_Uint32 u32DTIMPeriod
,
7239 WILC_Uint32 u32HeadLen
, u8
*pu8Head
,
7240 WILC_Uint32 u32TailLen
, u8
*pu8Tail
)
7242 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7243 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7244 tstrHostIFmsg strHostIFmsg
;
7245 tstrHostIFSetBeacon
*pstrSetBeaconParam
= &strHostIFmsg
.uniHostIFmsgBody
.strHostIFSetBeacon
;
7247 if (pstrWFIDrv
== NULL
) {
7248 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7251 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7253 PRINT_D(HOSTINF_DBG
, "Setting adding beacon message queue params\n");
7256 /* prepare the WiphyParams Message */
7257 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_ADD_BEACON
;
7258 strHostIFmsg
.drvHandler
= hWFIDrv
;
7259 pstrSetBeaconParam
->u32Interval
= u32Interval
;
7260 pstrSetBeaconParam
->u32DTIMPeriod
= u32DTIMPeriod
;
7261 pstrSetBeaconParam
->u32HeadLen
= u32HeadLen
;
7262 pstrSetBeaconParam
->pu8Head
= (u8
*)WILC_MALLOC(u32HeadLen
);
7263 if (pstrSetBeaconParam
->pu8Head
== NULL
) {
7264 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
7266 WILC_memcpy(pstrSetBeaconParam
->pu8Head
, pu8Head
, u32HeadLen
);
7267 pstrSetBeaconParam
->u32TailLen
= u32TailLen
;
7269 /* Bug 4599 : if tail length = 0 skip allocating & copying */
7270 if (u32TailLen
> 0) {
7271 pstrSetBeaconParam
->pu8Tail
= (u8
*)WILC_MALLOC(u32TailLen
);
7272 if (pstrSetBeaconParam
->pu8Tail
== NULL
) {
7273 WILC_ERRORREPORT(s32Error
, WILC_NO_MEM
);
7275 WILC_memcpy(pstrSetBeaconParam
->pu8Tail
, pu8Tail
, u32TailLen
);
7277 pstrSetBeaconParam
->pu8Tail
= NULL
;
7280 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7282 WILC_ERRORREPORT(s32Error
, s32Error
);
7285 WILC_CATCH(s32Error
)
7287 if (pstrSetBeaconParam
->pu8Head
!= NULL
) {
7288 WILC_FREE(pstrSetBeaconParam
->pu8Head
);
7291 if (pstrSetBeaconParam
->pu8Tail
!= NULL
) {
7292 WILC_FREE(pstrSetBeaconParam
->pu8Tail
);
7302 * @brief host_int_del_beacon
7303 * @details Setting add beacon params in message queue
7304 * @param[in] WILC_WFIDrvHandle hWFIDrv
7305 * @return Error code.
7310 WILC_Sint32
host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv
)
7312 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7313 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7314 tstrHostIFmsg strHostIFmsg
;
7316 if (pstrWFIDrv
== NULL
) {
7317 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7320 /* prepare the WiphyParams Message */
7321 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_DEL_BEACON
;
7322 strHostIFmsg
.drvHandler
= hWFIDrv
;
7323 PRINT_D(HOSTINF_DBG
, "Setting deleting beacon message queue params\n");
7325 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7326 WILC_ERRORCHECK(s32Error
);
7328 WILC_CATCH(s32Error
)
7336 * @brief host_int_add_station
7337 * @details Setting add station params in message queue
7338 * @param[in] WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam* pstrStaParams
7339 * @return Error code.
7344 WILC_Sint32
host_int_add_station(WILC_WFIDrvHandle hWFIDrv
, tstrWILC_AddStaParam
*pstrStaParams
)
7346 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7347 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7348 tstrHostIFmsg strHostIFmsg
;
7349 tstrWILC_AddStaParam
*pstrAddStationMsg
= &strHostIFmsg
.uniHostIFmsgBody
.strAddStaParam
;
7352 if (pstrWFIDrv
== NULL
) {
7353 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7356 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7358 PRINT_D(HOSTINF_DBG
, "Setting adding station message queue params\n");
7361 /* prepare the WiphyParams Message */
7362 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_ADD_STATION
;
7363 strHostIFmsg
.drvHandler
= hWFIDrv
;
7365 WILC_memcpy(pstrAddStationMsg
, pstrStaParams
, sizeof(tstrWILC_AddStaParam
));
7366 if (pstrAddStationMsg
->u8NumRates
> 0) {
7367 u8
*rates
= WILC_MALLOC(pstrAddStationMsg
->u8NumRates
);
7368 WILC_NULLCHECK(s32Error
, rates
);
7370 WILC_memcpy(rates
, pstrStaParams
->pu8Rates
, pstrAddStationMsg
->u8NumRates
);
7371 pstrAddStationMsg
->pu8Rates
= rates
;
7375 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7377 WILC_ERRORREPORT(s32Error
, s32Error
);
7380 WILC_CATCH(s32Error
)
7387 * @brief host_int_del_station
7388 * @details Setting delete station params in message queue
7389 * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr
7390 * @return Error code.
7395 WILC_Sint32
host_int_del_station(WILC_WFIDrvHandle hWFIDrv
, const u8
*pu8MacAddr
)
7397 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7398 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7399 tstrHostIFmsg strHostIFmsg
;
7400 tstrHostIFDelSta
*pstrDelStationMsg
= &strHostIFmsg
.uniHostIFmsgBody
.strDelStaParam
;
7402 if (pstrWFIDrv
== NULL
) {
7403 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7406 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7408 PRINT_D(HOSTINF_DBG
, "Setting deleting station message queue params\n");
7412 /* prepare the WiphyParams Message */
7413 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_DEL_STATION
;
7414 strHostIFmsg
.drvHandler
= hWFIDrv
;
7416 /*BugID_4795: Handling situation of deleting all stations*/
7417 if (pu8MacAddr
== NULL
)
7418 WILC_memset(pstrDelStationMsg
->au8MacAddr
, 255, ETH_ALEN
);
7420 WILC_memcpy(pstrDelStationMsg
->au8MacAddr
, pu8MacAddr
, ETH_ALEN
);
7422 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7424 WILC_ERRORREPORT(s32Error
, s32Error
);
7427 WILC_CATCH(s32Error
)
7433 * @brief host_int_del_allstation
7434 * @details Setting del station params in message queue
7435 * @param[in] WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]s
7436 * @return Error code.
7441 WILC_Sint32
host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv
, u8 pu8MacAddr
[][ETH_ALEN
])
7443 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7444 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7445 tstrHostIFmsg strHostIFmsg
;
7446 tstrHostIFDelAllSta
*pstrDelAllStationMsg
= &strHostIFmsg
.uniHostIFmsgBody
.strHostIFDelAllSta
;
7447 u8 au8Zero_Buff
[ETH_ALEN
] = {0};
7452 if (pstrWFIDrv
== NULL
) {
7453 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7456 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7458 PRINT_D(HOSTINF_DBG
, "Setting deauthenticating station message queue params\n");
7460 /* prepare the WiphyParams Message */
7461 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_DEL_ALL_STA
;
7462 strHostIFmsg
.drvHandler
= hWFIDrv
;
7464 /* Handling situation of deauthenticing all associated stations*/
7465 for (i
= 0; i
< MAX_NUM_STA
; i
++) {
7466 if (memcmp(pu8MacAddr
[i
], au8Zero_Buff
, ETH_ALEN
)) {
7467 WILC_memcpy(pstrDelAllStationMsg
->au8Sta_DelAllSta
[i
], pu8MacAddr
[i
], ETH_ALEN
);
7468 PRINT_D(CFG80211_DBG
, "BSSID = %x%x%x%x%x%x\n", pstrDelAllStationMsg
->au8Sta_DelAllSta
[i
][0], pstrDelAllStationMsg
->au8Sta_DelAllSta
[i
][1], pstrDelAllStationMsg
->au8Sta_DelAllSta
[i
][2], pstrDelAllStationMsg
->au8Sta_DelAllSta
[i
][3], pstrDelAllStationMsg
->au8Sta_DelAllSta
[i
][4],
7469 pstrDelAllStationMsg
->au8Sta_DelAllSta
[i
][5]);
7474 PRINT_D(CFG80211_DBG
, "NO ASSOCIATED STAS\n");
7478 pstrDelAllStationMsg
->u8Num_AssocSta
= u8AssocNumb
;
7479 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7483 WILC_ERRORREPORT(s32Error
, s32Error
);
7486 WILC_CATCH(s32Error
)
7490 down(&hWaitResponse
);
7497 * @brief host_int_edit_station
7498 * @details Setting edit station params in message queue
7499 * @param[in] WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam* pstrStaParams
7500 * @return Error code.
7505 WILC_Sint32
host_int_edit_station(WILC_WFIDrvHandle hWFIDrv
, tstrWILC_AddStaParam
*pstrStaParams
)
7507 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7508 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7509 tstrHostIFmsg strHostIFmsg
;
7510 tstrWILC_AddStaParam
*pstrAddStationMsg
= &strHostIFmsg
.uniHostIFmsgBody
.strAddStaParam
;
7512 if (pstrWFIDrv
== NULL
) {
7513 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7516 PRINT_D(HOSTINF_DBG
, "Setting editing station message queue params\n");
7518 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7521 /* prepare the WiphyParams Message */
7522 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_EDIT_STATION
;
7523 strHostIFmsg
.drvHandler
= hWFIDrv
;
7525 WILC_memcpy(pstrAddStationMsg
, pstrStaParams
, sizeof(tstrWILC_AddStaParam
));
7526 if (pstrAddStationMsg
->u8NumRates
> 0) {
7527 u8
*rates
= WILC_MALLOC(pstrAddStationMsg
->u8NumRates
);
7528 WILC_NULLCHECK(s32Error
, rates
);
7529 WILC_memcpy(rates
, pstrStaParams
->pu8Rates
, pstrAddStationMsg
->u8NumRates
);
7530 pstrAddStationMsg
->pu8Rates
= rates
;
7533 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7535 WILC_ERRORREPORT(s32Error
, s32Error
);
7537 WILC_CATCH(s32Error
)
7542 #endif /*WILC_AP_EXTERNAL_MLME*/
7543 uint32_t wilc_get_chipid(uint8_t);
7545 WILC_Sint32
host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv
, WILC_Bool bIsEnabled
, WILC_Uint32 u32Timeout
)
7547 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7548 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7549 tstrHostIFmsg strHostIFmsg
;
7550 tstrHostIfPowerMgmtParam
*pstrPowerMgmtParam
= &strHostIFmsg
.uniHostIFmsgBody
.strPowerMgmtparam
;
7552 PRINT_INFO(HOSTINF_DBG
, "\n\n>> Setting PS to %d << \n\n", bIsEnabled
);
7554 if (pstrWFIDrv
== NULL
) {
7555 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7558 PRINT_D(HOSTINF_DBG
, "Setting Power management message queue params\n");
7560 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7563 /* prepare the WiphyParams Message */
7564 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_POWER_MGMT
;
7565 strHostIFmsg
.drvHandler
= hWFIDrv
;
7567 pstrPowerMgmtParam
->bIsEnabled
= bIsEnabled
;
7568 pstrPowerMgmtParam
->u32Timeout
= u32Timeout
;
7571 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7573 WILC_ERRORREPORT(s32Error
, s32Error
);
7575 WILC_CATCH(s32Error
)
7581 WILC_Sint32
host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv
, WILC_Bool bIsEnabled
, WILC_Uint32 u32count
)
7583 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7585 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7586 tstrHostIFmsg strHostIFmsg
;
7587 tstrHostIFSetMulti
*pstrMulticastFilterParam
= &strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetMulti
;
7590 if (pstrWFIDrv
== NULL
) {
7591 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7594 PRINT_D(HOSTINF_DBG
, "Setting Multicast Filter params\n");
7596 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7599 /* prepare the WiphyParams Message */
7600 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_SET_MULTICAST_FILTER
;
7601 strHostIFmsg
.drvHandler
= hWFIDrv
;
7603 pstrMulticastFilterParam
->bIsEnabled
= bIsEnabled
;
7604 pstrMulticastFilterParam
->u32count
= u32count
;
7606 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7608 WILC_ERRORREPORT(s32Error
, s32Error
);
7610 WILC_CATCH(s32Error
)
7618 /*Bug4218: Parsing Join Param*/
7619 #ifdef WILC_PARSE_SCAN_IN_HOST
7621 /*Bug4218: Parsing Join Param*/
7623 * @brief host_int_ParseJoinBssParam
7624 * @details Parse Needed Join Parameters and save it in a new JoinBssParam entry
7625 * @param[in] tstrNetworkInfo* ptstrNetworkInfo
7630 static void *host_int_ParseJoinBssParam(tstrNetworkInfo
*ptstrNetworkInfo
)
7632 tstrJoinBssParam
*pNewJoinBssParam
= NULL
;
7641 u8 pcipherTotalCount
= 0;
7642 u8 authTotalCount
= 0;
7645 pu8IEs
= ptstrNetworkInfo
->pu8IEs
;
7646 u16IEsLen
= ptstrNetworkInfo
->u16IEsLen
;
7648 pNewJoinBssParam
= WILC_MALLOC(sizeof(tstrJoinBssParam
));
7649 if (pNewJoinBssParam
!= NULL
) {
7650 WILC_memset(pNewJoinBssParam
, 0, sizeof(tstrJoinBssParam
));
7651 pNewJoinBssParam
->dtim_period
= ptstrNetworkInfo
->u8DtimPeriod
;
7652 pNewJoinBssParam
->beacon_period
= ptstrNetworkInfo
->u16BeaconPeriod
;
7653 pNewJoinBssParam
->cap_info
= ptstrNetworkInfo
->u16CapInfo
;
7654 WILC_memcpy(pNewJoinBssParam
->au8bssid
, ptstrNetworkInfo
->au8bssid
, 6);
7656 * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/
7657 WILC_memcpy((u8
*)pNewJoinBssParam
->ssid
, ptstrNetworkInfo
->au8ssid
, ptstrNetworkInfo
->u8SsidLen
+ 1);
7658 pNewJoinBssParam
->ssidLen
= ptstrNetworkInfo
->u8SsidLen
;
7659 WILC_memset(pNewJoinBssParam
->rsn_pcip_policy
, 0xFF, 3);
7660 WILC_memset(pNewJoinBssParam
->rsn_auth_policy
, 0xFF, 3);
7661 /*for(i=0; i<pNewJoinBssParam->ssidLen;i++)
7662 * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/
7664 /* parse supported rates: */
7665 while (index
< u16IEsLen
) {
7666 /* supportedRates IE */
7667 if (pu8IEs
[index
] == SUPP_RATES_IE
) {
7668 /* PRINT_D(HOSTINF_DBG, "Supported Rates\n"); */
7669 suppRatesNo
= pu8IEs
[index
+ 1];
7670 pNewJoinBssParam
->supp_rates
[0] = suppRatesNo
;
7671 index
+= 2; /* skipping ID and length bytes; */
7673 for (i
= 0; i
< suppRatesNo
; i
++) {
7674 pNewJoinBssParam
->supp_rates
[i
+ 1] = pu8IEs
[index
+ i
];
7675 /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[i+1]); */
7677 index
+= suppRatesNo
;
7680 /* Ext SupportedRates IE */
7681 else if (pu8IEs
[index
] == EXT_SUPP_RATES_IE
) {
7682 /* PRINT_D(HOSTINF_DBG, "Extended Supported Rates\n"); */
7683 /* checking if no of ext. supp and supp rates < max limit */
7684 extSuppRatesNo
= pu8IEs
[index
+ 1];
7685 if (extSuppRatesNo
> (MAX_RATES_SUPPORTED
- suppRatesNo
))
7686 pNewJoinBssParam
->supp_rates
[0] = MAX_RATES_SUPPORTED
;
7688 pNewJoinBssParam
->supp_rates
[0] += extSuppRatesNo
;
7690 /* pNewJoinBssParam.supp_rates[0] contains now old number not the ext. no */
7691 for (i
= 0; i
< (pNewJoinBssParam
->supp_rates
[0] - suppRatesNo
); i
++) {
7692 pNewJoinBssParam
->supp_rates
[suppRatesNo
+ i
+ 1] = pu8IEs
[index
+ i
];
7693 /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[suppRatesNo+i+1]); */
7695 index
+= extSuppRatesNo
;
7699 else if (pu8IEs
[index
] == HT_CAPABILITY_IE
) {
7700 /* if IE found set the flag */
7701 pNewJoinBssParam
->ht_capable
= BTRUE
;
7702 index
+= pu8IEs
[index
+ 1] + 2; /* ID,Length bytes and IE body */
7703 /* PRINT_D(HOSTINF_DBG,"HT_CAPABALE\n"); */
7705 } else if ((pu8IEs
[index
] == WMM_IE
) && /* WMM Element ID */
7706 (pu8IEs
[index
+ 2] == 0x00) && (pu8IEs
[index
+ 3] == 0x50) &&
7707 (pu8IEs
[index
+ 4] == 0xF2) && /* OUI */
7708 (pu8IEs
[index
+ 5] == 0x02) && /* OUI Type */
7709 ((pu8IEs
[index
+ 6] == 0x00) || (pu8IEs
[index
+ 6] == 0x01)) && /* OUI Sub Type */
7710 (pu8IEs
[index
+ 7] == 0x01)) {
7711 /* Presence of WMM Info/Param element indicates WMM capability */
7712 pNewJoinBssParam
->wmm_cap
= BTRUE
;
7714 /* Check if Bit 7 is set indicating U-APSD capability */
7715 if (pu8IEs
[index
+ 8] & (1 << 7)) {
7716 pNewJoinBssParam
->uapsd_cap
= BTRUE
;
7718 index
+= pu8IEs
[index
+ 1] + 2;
7722 else if ((pu8IEs
[index
] == P2P_IE
) && /* P2P Element ID */
7723 (pu8IEs
[index
+ 2] == 0x50) && (pu8IEs
[index
+ 3] == 0x6f) &&
7724 (pu8IEs
[index
+ 4] == 0x9a) && /* OUI */
7725 (pu8IEs
[index
+ 5] == 0x09) && (pu8IEs
[index
+ 6] == 0x0c)) { /* OUI Type */
7727 pNewJoinBssParam
->tsf
= ptstrNetworkInfo
->u32Tsf
;
7728 pNewJoinBssParam
->u8NoaEnbaled
= 1;
7729 pNewJoinBssParam
->u8Index
= pu8IEs
[index
+ 9];
7731 /* Check if Bit 7 is set indicating Opss capability */
7732 if (pu8IEs
[index
+ 10] & (1 << 7)) {
7733 pNewJoinBssParam
->u8OppEnable
= 1;
7734 pNewJoinBssParam
->u8CtWindow
= pu8IEs
[index
+ 10];
7736 pNewJoinBssParam
->u8OppEnable
= 0;
7738 PRINT_D(GENERIC_DBG
, "P2P Dump \n");
7739 for (i
= 0; i
< pu8IEs
[index
+ 7]; i
++)
7740 PRINT_D(GENERIC_DBG
, " %x \n", pu8IEs
[index
+ 9 + i
]);
7742 pNewJoinBssParam
->u8Count
= pu8IEs
[index
+ 11];
7743 u16P2P_count
= index
+ 12;
7745 WILC_memcpy(pNewJoinBssParam
->au8Duration
, pu8IEs
+ u16P2P_count
, 4);
7748 WILC_memcpy(pNewJoinBssParam
->au8Interval
, pu8IEs
+ u16P2P_count
, 4);
7751 WILC_memcpy(pNewJoinBssParam
->au8StartTime
, pu8IEs
+ u16P2P_count
, 4);
7753 index
+= pu8IEs
[index
+ 1] + 2;
7758 else if ((pu8IEs
[index
] == RSN_IE
) ||
7759 ((pu8IEs
[index
] == WPA_IE
) && (pu8IEs
[index
+ 2] == 0x00) &&
7760 (pu8IEs
[index
+ 3] == 0x50) && (pu8IEs
[index
+ 4] == 0xF2) &&
7761 (pu8IEs
[index
+ 5] == 0x01))) {
7762 u16 rsnIndex
= index
;
7763 /*PRINT_D(HOSTINF_DBG,"RSN IE Length:%d\n",pu8IEs[rsnIndex+1]);
7764 * for(i=0; i<pu8IEs[rsnIndex+1]; i++)
7766 * PRINT_D(HOSTINF_DBG,"%0x ",pu8IEs[rsnIndex+2+i]);
7768 if (pu8IEs
[rsnIndex
] == RSN_IE
) {
7769 pNewJoinBssParam
->mode_802_11i
= 2;
7770 /* PRINT_D(HOSTINF_DBG,"\nRSN_IE\n"); */
7771 } else { /* check if rsn was previously parsed */
7772 if (pNewJoinBssParam
->mode_802_11i
== 0)
7773 pNewJoinBssParam
->mode_802_11i
= 1;
7774 /* PRINT_D(HOSTINF_DBG,"\nWPA_IE\n"); */
7777 rsnIndex
+= 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */
7778 pNewJoinBssParam
->rsn_grp_policy
= pu8IEs
[rsnIndex
];
7780 /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x \n",pNewJoinBssParam->rsn_grp_policy); */
7781 /* initialize policies with invalid values */
7783 jumpOffset
= pu8IEs
[rsnIndex
] * 4; /* total no.of bytes of pcipher field (count*4) */
7785 /*parsing pairwise cipher*/
7787 /* saving 3 pcipher max. */
7788 pcipherCount
= (pu8IEs
[rsnIndex
] > 3) ? 3 : pu8IEs
[rsnIndex
];
7789 rsnIndex
+= 2; /* jump 2 bytes of pcipher count */
7791 /* PRINT_D(HOSTINF_DBG,"\npcipher:%d \n",pcipherCount); */
7792 for (i
= pcipherTotalCount
, j
= 0; i
< pcipherCount
+ pcipherTotalCount
&& i
< 3; i
++, j
++) {
7793 /* each count corresponds to 4 bytes, only last byte is saved */
7794 pNewJoinBssParam
->rsn_pcip_policy
[i
] = pu8IEs
[rsnIndex
+ ((j
+ 1) * 4) - 1];
7795 /* PRINT_D(HOSTINF_DBG,"PAIR policy = [%0x,%0x]\n",pNewJoinBssParam->rsn_pcip_policy[i],i); */
7797 pcipherTotalCount
+= pcipherCount
;
7798 rsnIndex
+= jumpOffset
;
7800 jumpOffset
= pu8IEs
[rsnIndex
] * 4;
7802 /*parsing AKM suite (auth_policy)*/
7803 /* saving 3 auth policies max. */
7804 authCount
= (pu8IEs
[rsnIndex
] > 3) ? 3 : pu8IEs
[rsnIndex
];
7805 rsnIndex
+= 2; /* jump 2 bytes of pcipher count */
7807 for (i
= authTotalCount
, j
= 0; i
< authTotalCount
+ authCount
; i
++, j
++) {
7808 /* each count corresponds to 4 bytes, only last byte is saved */
7809 pNewJoinBssParam
->rsn_auth_policy
[i
] = pu8IEs
[rsnIndex
+ ((j
+ 1) * 4) - 1];
7811 authTotalCount
+= authCount
;
7812 rsnIndex
+= jumpOffset
;
7813 /*pasring rsn cap. only if rsn IE*/
7814 if (pu8IEs
[index
] == RSN_IE
) {
7815 pNewJoinBssParam
->rsn_cap
[0] = pu8IEs
[rsnIndex
];
7816 pNewJoinBssParam
->rsn_cap
[1] = pu8IEs
[rsnIndex
+ 1];
7819 pNewJoinBssParam
->rsn_found
= 1;
7820 index
+= pu8IEs
[index
+ 1] + 2; /* ID,Length bytes and IE body */
7823 index
+= pu8IEs
[index
+ 1] + 2; /* ID,Length bytes and IE body */
7830 return (void *)pNewJoinBssParam
;
7834 void host_int_freeJoinParams(void *pJoinParams
)
7836 if ((tstrJoinBssParam
*)pJoinParams
!= NULL
)
7837 WILC_FREE((tstrJoinBssParam
*)pJoinParams
);
7839 PRINT_ER("Unable to FREE null pointer\n");
7841 #endif /*WILC_PARSE_SCAN_IN_HOST*/
7845 * @brief host_int_addBASession
7846 * @details Open a block Ack session with the given parameters
7847 * @param[in] tstrNetworkInfo* ptstrNetworkInfo
7849 * @author anoureldin
7853 static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv
, char *pBSSID
, char TID
, short int BufferSize
,
7854 short int SessionTimeout
, void *drvHandler
)
7856 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7857 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7858 tstrHostIFmsg strHostIFmsg
;
7859 tstrHostIfBASessionInfo
*pBASessionInfo
= &strHostIFmsg
.uniHostIFmsgBody
.strHostIfBASessionInfo
;
7861 if (pstrWFIDrv
== NULL
) {
7862 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7865 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7867 /* prepare the WiphyParams Message */
7868 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_ADD_BA_SESSION
;
7870 memcpy(pBASessionInfo
->au8Bssid
, pBSSID
, ETH_ALEN
);
7871 pBASessionInfo
->u8Ted
= TID
;
7872 pBASessionInfo
->u16BufferSize
= BufferSize
;
7873 pBASessionInfo
->u16SessionTimeout
= SessionTimeout
;
7874 strHostIFmsg
.drvHandler
= hWFIDrv
;
7876 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7878 WILC_ERRORREPORT(s32Error
, s32Error
);
7880 WILC_CATCH(s32Error
)
7889 WILC_Sint32
host_int_delBASession(WILC_WFIDrvHandle hWFIDrv
, char *pBSSID
, char TID
)
7891 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7892 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7893 tstrHostIFmsg strHostIFmsg
;
7894 tstrHostIfBASessionInfo
*pBASessionInfo
= &strHostIFmsg
.uniHostIFmsgBody
.strHostIfBASessionInfo
;
7896 if (pstrWFIDrv
== NULL
) {
7897 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7900 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7902 /* prepare the WiphyParams Message */
7903 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_DEL_BA_SESSION
;
7905 memcpy(pBASessionInfo
->au8Bssid
, pBSSID
, ETH_ALEN
);
7906 pBASessionInfo
->u8Ted
= TID
;
7907 strHostIFmsg
.drvHandler
= hWFIDrv
;
7909 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7911 WILC_ERRORREPORT(s32Error
, s32Error
);
7913 WILC_CATCH(s32Error
)
7919 down(&hWaitResponse
);
7924 WILC_Sint32
host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv
, char *pBSSID
, char TID
)
7926 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7927 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7928 tstrHostIFmsg strHostIFmsg
;
7929 tstrHostIfBASessionInfo
*pBASessionInfo
= &strHostIFmsg
.uniHostIFmsgBody
.strHostIfBASessionInfo
;
7931 if (pstrWFIDrv
== NULL
) {
7932 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7935 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7937 /* prepare the WiphyParams Message */
7938 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS
;
7940 memcpy(pBASessionInfo
->au8Bssid
, pBSSID
, ETH_ALEN
);
7941 pBASessionInfo
->u8Ted
= TID
;
7942 strHostIFmsg
.drvHandler
= hWFIDrv
;
7944 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7946 WILC_ERRORREPORT(s32Error
, s32Error
);
7948 WILC_CATCH(s32Error
)
7954 down(&hWaitResponse
);
7960 * @brief host_int_setup_ipaddress
7961 * @details setup IP in firmware
7962 * @param[in] Handle to wifi driver
7963 * @return Error code.
7964 * @author Abdelrahman Sobhy
7967 WILC_Sint32
host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv
, u8
*u16ipadd
, u8 idx
)
7969 WILC_Sint32 s32Error
= WILC_SUCCESS
;
7970 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
7971 tstrHostIFmsg strHostIFmsg
;
7973 /* TODO: Enable This feature on softap firmware */
7976 if (pstrWFIDrv
== NULL
) {
7977 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
7980 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
7982 /* prepare the WiphyParams Message */
7983 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_SET_IPADDRESS
;
7985 strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetIP
.au8IPAddr
= u16ipadd
;
7986 strHostIFmsg
.drvHandler
= hWFIDrv
;
7987 strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetIP
.idx
= idx
;
7989 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
7991 WILC_ERRORREPORT(s32Error
, s32Error
);
7993 WILC_CATCH(s32Error
)
8004 * @brief host_int_get_ipaddress
8005 * @details Get IP from firmware
8006 * @param[in] Handle to wifi driver
8007 * @return Error code.
8008 * @author Abdelrahman Sobhy
8011 WILC_Sint32
host_int_get_ipaddress(WILC_WFIDrvHandle hWFIDrv
, u8
*u16ipadd
, u8 idx
)
8013 WILC_Sint32 s32Error
= WILC_SUCCESS
;
8014 tstrWILC_WFIDrv
*pstrWFIDrv
= (tstrWILC_WFIDrv
*)hWFIDrv
;
8015 tstrHostIFmsg strHostIFmsg
;
8017 if (pstrWFIDrv
== NULL
) {
8018 WILC_ERRORREPORT(s32Error
, WILC_INVALID_ARGUMENT
);
8021 WILC_memset(&strHostIFmsg
, 0, sizeof(tstrHostIFmsg
));
8023 /* prepare the WiphyParams Message */
8024 strHostIFmsg
.u16MsgId
= HOST_IF_MSG_GET_IPADDRESS
;
8026 strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetIP
.au8IPAddr
= u16ipadd
;
8027 strHostIFmsg
.drvHandler
=hWFIDrv
;
8028 strHostIFmsg
.uniHostIFmsgBody
.strHostIfSetIP
.idx
= idx
;
8030 s32Error
= WILC_MsgQueueSend(&gMsgQHostIF
, &strHostIFmsg
, sizeof(tstrHostIFmsg
), NULL
);
8032 WILC_ERRORREPORT(s32Error
, s32Error
);
8034 WILC_CATCH(s32Error
)