wilc1000-objs := wilc_wfi_netdevice.o wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
- wilc_memory.o wilc_msgqueue.o wilc_semaphore.o wilc_sleep.o wilc_strutils.o \
+ wilc_memory.o wilc_msgqueue.o wilc_sleep.o wilc_strutils.o \
wilc_timer.o coreconfigurator.o host_interface.o \
fifo_buffer.o wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o
/*****************************************************************************/
/* Global Variables */
/*****************************************************************************/
-static WILC_SemaphoreHandle SemHandleSendPkt;
-static WILC_SemaphoreHandle SemHandlePktResp;
+static struct semaphore SemHandleSendPkt;
+static struct semaphore SemHandlePktResp;
static WILC_Sint8 *gps8ConfigPacket;
WILC_Sint32 CoreConfiguratorInit(void)
{
WILC_Sint32 s32Error = WILC_SUCCESS;
- tstrWILC_SemaphoreAttrs strSemSendPktAttrs;
- tstrWILC_SemaphoreAttrs strSemPktRespAttrs;
-
PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit() \n");
- WILC_SemaphoreFillDefault(&strSemSendPktAttrs);
- strSemSendPktAttrs.u32InitCount = 1;
- WILC_SemaphoreCreate(&SemHandleSendPkt, &strSemSendPktAttrs);
-
- WILC_SemaphoreFillDefault(&strSemPktRespAttrs);
- strSemPktRespAttrs.u32InitCount = 0;
- WILC_SemaphoreCreate(&SemHandlePktResp, &strSemPktRespAttrs);
+ sema_init(&SemHandleSendPkt, 1);
+ sema_init(&SemHandlePktResp, 0);
gps8ConfigPacket = (WILC_Sint8 *)WILC_MALLOC(MAX_PACKET_BUFF_SIZE);
if (gps8ConfigPacket == NULL) {
if (gstrConfigPktInfo.bRespRequired == WILC_TRUE) {
- WILC_SemaphoreAcquire(&SemHandlePktResp, WILC_NULL);
+ down(&SemHandlePktResp);
*ps32BytesRead = gstrConfigPktInfo.s32BytesRead;
}
WILC_Sint32 s32ConfigPacketLen = 0;
WILC_Sint32 s32RcvdRespLen = 0;
- WILC_SemaphoreAcquire(&SemHandleSendPkt, WILC_NULL);
+ down(&SemHandleSendPkt);
/*set the packet mode*/
g_oper_mode = u8Mode;
End_ConfigPkt:
- WILC_SemaphoreRelease(&SemHandleSendPkt, WILC_NULL);
+ up(&SemHandleSendPkt);
return s32Error;
}
PRINT_ER("BusProvideResponse() Response greater than the prepared Buffer Size \n");
}
- WILC_SemaphoreRelease(&SemHandlePktResp, WILC_NULL);
+ up(&SemHandlePktResp);
}
return s32Error;
PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit() \n");
-
- WILC_SemaphoreDestroy(&SemHandleSendPkt, WILC_NULL);
- WILC_SemaphoreDestroy(&SemHandlePktResp, WILC_NULL);
-
-
if (gps8ConfigPacket != NULL) {
WILC_FREE(gps8ConfigPacket);
WILC_memset (pstrFifoHandler, 0, sizeof (tstrFifoHandler));
pstrFifoHandler->pu8Buffer = WILC_MALLOC (u32BufferLength);
if (pstrFifoHandler->pu8Buffer) {
- tstrWILC_SemaphoreAttrs strSemBufferAttrs;
pstrFifoHandler->u32BufferLength = u32BufferLength;
WILC_memset (pstrFifoHandler->pu8Buffer, 0, u32BufferLength);
/* create semaphore */
- WILC_SemaphoreFillDefault (&strSemBufferAttrs);
- strSemBufferAttrs.u32InitCount = 1;
- WILC_SemaphoreCreate(&pstrFifoHandler->SemBuffer, &strSemBufferAttrs);
+ sema_init(&pstrFifoHandler->SemBuffer, 1);
*hBuffer = pstrFifoHandler;
} else {
*hBuffer = NULL;
u32Error = 1;
}
- WILC_SemaphoreDestroy (&pstrFifoHandler->SemBuffer, WILC_NULL);
-
WILC_FREE (pstrFifoHandler);
} else {
u32Error = 1;
tstrFifoHandler *pstrFifoHandler = (tstrFifoHandler *) hFifo;
if (pstrFifoHandler && pu32BytesRead) {
if (pstrFifoHandler->u32TotalBytes) {
- if (WILC_SemaphoreAcquire(&pstrFifoHandler->SemBuffer, WILC_NULL) == WILC_SUCCESS) {
- if (u32BytesToRead > pstrFifoHandler->u32TotalBytes) {
- *pu32BytesRead = pstrFifoHandler->u32TotalBytes;
- } else {
- *pu32BytesRead = u32BytesToRead;
- }
- if ((pstrFifoHandler->u32ReadOffset + u32BytesToRead) <= pstrFifoHandler->u32BufferLength) {
- WILC_memcpy(pu8Buffer, pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32ReadOffset,
- *pu32BytesRead);
- /* update read offset and total bytes */
- pstrFifoHandler->u32ReadOffset += u32BytesToRead;
- pstrFifoHandler->u32TotalBytes -= u32BytesToRead;
+ down(&pstrFifoHandler->SemBuffer);
- } else {
- WILC_Uint32 u32FirstPart =
- pstrFifoHandler->u32BufferLength - pstrFifoHandler->u32ReadOffset;
- WILC_memcpy(pu8Buffer, pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32ReadOffset,
- u32FirstPart);
- WILC_memcpy(pu8Buffer + u32FirstPart, pstrFifoHandler->pu8Buffer,
- u32BytesToRead - u32FirstPart);
- /* update read offset and total bytes */
- pstrFifoHandler->u32ReadOffset = u32BytesToRead - u32FirstPart;
- pstrFifoHandler->u32TotalBytes -= u32BytesToRead;
- }
- WILC_SemaphoreRelease (&pstrFifoHandler->SemBuffer, WILC_NULL);
+ if (u32BytesToRead > pstrFifoHandler->u32TotalBytes) {
+ *pu32BytesRead = pstrFifoHandler->u32TotalBytes;
} else {
- u32Error = 1;
+ *pu32BytesRead = u32BytesToRead;
}
+ if ((pstrFifoHandler->u32ReadOffset + u32BytesToRead) <= pstrFifoHandler->u32BufferLength) {
+ WILC_memcpy(pu8Buffer, pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32ReadOffset,
+ *pu32BytesRead);
+ /* update read offset and total bytes */
+ pstrFifoHandler->u32ReadOffset += u32BytesToRead;
+ pstrFifoHandler->u32TotalBytes -= u32BytesToRead;
+
+ } else {
+ WILC_Uint32 u32FirstPart =
+ pstrFifoHandler->u32BufferLength - pstrFifoHandler->u32ReadOffset;
+ WILC_memcpy(pu8Buffer, pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32ReadOffset,
+ u32FirstPart);
+ WILC_memcpy(pu8Buffer + u32FirstPart, pstrFifoHandler->pu8Buffer,
+ u32BytesToRead - u32FirstPart);
+ /* update read offset and total bytes */
+ pstrFifoHandler->u32ReadOffset = u32BytesToRead - u32FirstPart;
+ pstrFifoHandler->u32TotalBytes -= u32BytesToRead;
+ }
+ up(&pstrFifoHandler->SemBuffer);
} else {
u32Error = 1;
}
if (u32BytesToWrite < pstrFifoHandler->u32BufferLength) {
if ((pstrFifoHandler->u32TotalBytes + u32BytesToWrite) <= pstrFifoHandler->u32BufferLength ||
bForceOverWrite) {
- if (WILC_SemaphoreAcquire(&pstrFifoHandler->SemBuffer, WILC_NULL) == WILC_SUCCESS) {
- if ((pstrFifoHandler->u32WriteOffset + u32BytesToWrite) <= pstrFifoHandler->u32BufferLength) {
- WILC_memcpy(pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32WriteOffset, pu8Buffer,
- u32BytesToWrite);
- /* update read offset and total bytes */
- pstrFifoHandler->u32WriteOffset += u32BytesToWrite;
- pstrFifoHandler->u32TotalBytes += u32BytesToWrite;
+ down(&pstrFifoHandler->SemBuffer);
+ if ((pstrFifoHandler->u32WriteOffset + u32BytesToWrite) <= pstrFifoHandler->u32BufferLength) {
+ WILC_memcpy(pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32WriteOffset, pu8Buffer,
+ u32BytesToWrite);
+ /* update read offset and total bytes */
+ pstrFifoHandler->u32WriteOffset += u32BytesToWrite;
+ pstrFifoHandler->u32TotalBytes += u32BytesToWrite;
- } else {
- WILC_Uint32 u32FirstPart =
- pstrFifoHandler->u32BufferLength - pstrFifoHandler->u32WriteOffset;
- WILC_memcpy(pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32WriteOffset, pu8Buffer,
- u32FirstPart);
- WILC_memcpy(pstrFifoHandler->pu8Buffer, pu8Buffer + u32FirstPart,
- u32BytesToWrite - u32FirstPart);
- /* update read offset and total bytes */
- pstrFifoHandler->u32WriteOffset = u32BytesToWrite - u32FirstPart;
- pstrFifoHandler->u32TotalBytes += u32BytesToWrite;
- }
- /* if data overwriten */
- if (pstrFifoHandler->u32TotalBytes > pstrFifoHandler->u32BufferLength) {
- /* adjust read offset to the oldest data available */
- pstrFifoHandler->u32ReadOffset = pstrFifoHandler->u32WriteOffset;
- /* data availabe is the buffer length */
- pstrFifoHandler->u32TotalBytes = pstrFifoHandler->u32BufferLength;
- }
- WILC_SemaphoreRelease(&pstrFifoHandler->SemBuffer, WILC_NULL);
+ } else {
+ WILC_Uint32 u32FirstPart =
+ pstrFifoHandler->u32BufferLength - pstrFifoHandler->u32WriteOffset;
+ WILC_memcpy(pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32WriteOffset, pu8Buffer,
+ u32FirstPart);
+ WILC_memcpy(pstrFifoHandler->pu8Buffer, pu8Buffer + u32FirstPart,
+ u32BytesToWrite - u32FirstPart);
+ /* update read offset and total bytes */
+ pstrFifoHandler->u32WriteOffset = u32BytesToWrite - u32FirstPart;
+ pstrFifoHandler->u32TotalBytes += u32BytesToWrite;
}
+ /* if data overwriten */
+ if (pstrFifoHandler->u32TotalBytes > pstrFifoHandler->u32BufferLength) {
+ /* adjust read offset to the oldest data available */
+ pstrFifoHandler->u32ReadOffset = pstrFifoHandler->u32WriteOffset;
+ /* data availabe is the buffer length */
+ pstrFifoHandler->u32TotalBytes = pstrFifoHandler->u32BufferLength;
+ }
+ up(&pstrFifoHandler->SemBuffer);
} else {
u32Error = 1;
}
u32Error = 1;
}
return u32Error;
-}
\ No newline at end of file
+}
WILC_Uint32 u32WriteOffset;
WILC_Uint32 u32ReadOffset;
WILC_Uint32 u32TotalBytes;
- WILC_SemaphoreHandle SemBuffer;
+ struct semaphore SemBuffer;
} tstrFifoHandler;
WILC_Uint8 P2P_LISTEN_STATE;
static struct task_struct *HostIFthreadHandler;
static WILC_MsgQueueHandle gMsgQHostIF;
-static WILC_SemaphoreHandle hSemHostIFthrdEnd;
+static struct semaphore hSemHostIFthrdEnd;
-WILC_SemaphoreHandle hSemDeinitDrvHandle;
-static WILC_SemaphoreHandle hWaitResponse;
-WILC_SemaphoreHandle hSemHostIntDeinit;
+struct semaphore hSemDeinitDrvHandle;
+static struct semaphore hWaitResponse;
+struct semaphore hSemHostIntDeinit;
WILC_TimerHandle g_hPeriodicRSSI;
if ((pstrHostIfSetDrvHandler->u32Address) == (WILC_Uint32)NULL) {
- WILC_SemaphoreRelease(&hSemDeinitDrvHandle, WILC_NULL);
+ up(&hSemDeinitDrvHandle);
}
if ((pstrHostIfSetOperationMode->u32Mode) == (WILC_Uint32)NULL) {
- WILC_SemaphoreRelease(&hSemDeinitDrvHandle, WILC_NULL);
+ up(&hSemDeinitDrvHandle);
}
{
}
- WILC_SemaphoreRelease(&hWaitResponse, NULL);
+ up(&hWaitResponse);
return s32Error;
}
tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
- WILC_SemaphoreAcquire(&(pstrWFIDrv->gtOsCfgValuesSem), NULL);
+ down(&(pstrWFIDrv->gtOsCfgValuesSem));
PRINT_D(HOSTINF_DBG, "Setting CFG params\n");
WILC_CATCH(s32Error)
{
}
- WILC_SemaphoreRelease(&(pstrWFIDrv->gtOsCfgValuesSem), NULL);
+ up(&(pstrWFIDrv->gtOsCfgValuesSem));
return s32Error;
}
{
WILC_Sint32 s32Error = WILC_SUCCESS;
g_wilc_initialized = 0;
- WILC_SemaphoreRelease(&hWaitResponse, NULL);
+ up(&hWaitResponse);
return s32Error;
}
s32Error = SendConfigPkt(SET_CFG, &strWID, 1, WILC_TRUE, (WILC_Uint32)pstrWFIDrv);
}
- WILC_SemaphoreRelease(&(pstrWFIDrv->hSemTestKeyBlock), WILC_NULL);
+ up(&(pstrWFIDrv->hSemTestKeyBlock));
break;
case WPARxGtk:
WILC_FREE(pu8keybuf);
/* ////////////////////////// */
- WILC_SemaphoreRelease(&(pstrWFIDrv->hSemTestKeyBlock), WILC_NULL);
+ up(&(pstrWFIDrv->hSemTestKeyBlock));
/* ///////////////////////// */
}
WILC_FREE(pu8keybuf);
/* ////////////////////////// */
- WILC_SemaphoreRelease(&(pstrWFIDrv->hSemTestKeyBlock), WILC_NULL);
+ up(&(pstrWFIDrv->hSemTestKeyBlock));
/* ///////////////////////// */
}
_WPARxGtk_end_case_:
WILC_FREE(pu8keybuf);
/* ////////////////////////// */
- WILC_SemaphoreRelease(&(pstrWFIDrv->hSemTestKeyBlock), WILC_NULL);
+ up(&(pstrWFIDrv->hSemTestKeyBlock));
/* ///////////////////////// */
}
#endif
WILC_FREE(pu8keybuf);
/* ////////////////////////// */
- WILC_SemaphoreRelease(&(pstrWFIDrv->hSemTestKeyBlock), WILC_NULL);
+ up(&(pstrWFIDrv->hSemTestKeyBlock));
/* ///////////////////////// */
}
}
/* ////////////////////////// */
- WILC_SemaphoreRelease(&(pstrWFIDrv->hSemTestDisconnectBlock), WILC_NULL);
+ up(&(pstrWFIDrv->hSemTestDisconnectBlock));
/* ///////////////////////// */
}
{
}
- WILC_SemaphoreRelease(&(pstrWFIDrv->hSemGetCHNL), WILC_NULL);
+ up(&(pstrWFIDrv->hSemGetCHNL));
return s32Error;
{
}
- WILC_SemaphoreRelease(&(pstrWFIDrv->hSemGetRSSI), WILC_NULL);
+ up(&(pstrWFIDrv->hSemGetRSSI));
}
{
}
- WILC_SemaphoreRelease(&(pstrWFIDrv->hSemGetLINKSPEED), WILC_NULL);
+ up(&(pstrWFIDrv->hSemGetLINKSPEED));
}
PRINT_ER("Failed to send scan paramters config packet\n");
/* WILC_ERRORREPORT(s32Error, s32Error); */
}
- WILC_SemaphoreRelease(&hWaitResponse, NULL);
+ up(&hWaitResponse);
return 0;
}
PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime);
- WILC_SemaphoreRelease(&(pstrWFIDrv->hSemInactiveTime), WILC_NULL);
+ up(&(pstrWFIDrv->hSemInactiveTime));
WILC_CATCH(s32Error)
{
}
WILC_FREE_IF_TRUE(strWID.ps8WidVal);
- WILC_SemaphoreRelease(&hWaitResponse, NULL);
+ up(&hWaitResponse);
}
WILC_FREE(strWID.ps8WidVal);
/*BugID_5222*/
- WILC_SemaphoreRelease(&hWaitResponse, NULL);
+ up(&hWaitResponse);
return s32Error;
WILC_FREE(strWID.ps8WidVal);
/*BugID_5222*/
- WILC_SemaphoreRelease(&hWaitResponse, NULL);
+ up(&hWaitResponse);
return s32Error;
}
PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n");
- WILC_SemaphoreRelease(&hSemHostIFthrdEnd, WILC_NULL);
+ up(&hSemHostIFthrdEnd);
return 0;
}
s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), WILC_NULL);
if (s32Error)
PRINT_ER("Error in sending message queue : Request to remove WEP key \n");
- WILC_SemaphoreAcquire(&(pstrWFIDrv->hSemTestKeyBlock), NULL);
+ down(&(pstrWFIDrv->hSemTestKeyBlock));
WILC_CATCH(s32Error)
{
s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), WILC_NULL);
if (s32Error)
PRINT_ER("Error in sending message queue : Default key index\n");
- WILC_SemaphoreAcquire(&(pstrWFIDrv->hSemTestKeyBlock), NULL);
+ down(&(pstrWFIDrv->hSemTestKeyBlock));
WILC_CATCH(s32Error)
{
s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), WILC_NULL);
if (s32Error)
PRINT_ER("Error in sending message queue :WEP Key\n");
- WILC_SemaphoreAcquire(&(pstrWFIDrv->hSemTestKeyBlock), NULL);
+ down(&(pstrWFIDrv->hSemTestKeyBlock));
WILC_CATCH(s32Error)
{
if (s32Error)
PRINT_ER("Error in sending message queue :WEP Key\n");
- WILC_SemaphoreAcquire(&(pstrWFIDrv->hSemTestKeyBlock), NULL);
+ down(&(pstrWFIDrv->hSemTestKeyBlock));
WILC_CATCH(s32Error)
{
PRINT_ER("Error in sending message queue: PTK Key\n");
/* ////////////// */
- WILC_SemaphoreAcquire(&(pstrWFIDrv->hSemTestKeyBlock), NULL);
+ down(&(pstrWFIDrv->hSemTestKeyBlock));
/* WILC_Sleep(100); */
/* /////// */
if (s32Error)
PRINT_ER("Error in sending message queue: RX GTK\n");
/* ////////////// */
- WILC_SemaphoreAcquire(&(pstrWFIDrv->hSemTestKeyBlock), NULL);
+ down(&(pstrWFIDrv->hSemTestKeyBlock));
/* WILC_Sleep(100); */
/* /////// */
PRINT_ER("Error in sending message queue: TX GTK\n");
/* ////////////// */
- WILC_SemaphoreAcquire(&hSemTestKeyBlock, NULL);
+ down(&hSemTestKeyBlock);
WILC_Sleep(100);
/* /////// */
return WILC_FAIL;
}
- WILC_SemaphoreAcquire(&hWaitResponse, NULL);
+ down(&hWaitResponse);
return s32Error;
}
if (s32Error)
PRINT_ER("Failed to send message queue: disconnect\n");
/* ////////////// */
- WILC_SemaphoreAcquire(&(pstrWFIDrv->hSemTestDisconnectBlock), NULL);
+ down(&(pstrWFIDrv->hSemTestDisconnectBlock));
/* /////// */
WILC_CATCH(s32Error)
}
/* wait untill MSG Q is empty */
- WILC_SemaphoreAcquire(&hWaitResponse, NULL);
+ down(&hWaitResponse);
return s32Error;
s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), WILC_NULL);
if (s32Error)
PRINT_ER("Failed to send get host channel param's message queue ");
- WILC_SemaphoreAcquire(&(pstrWFIDrv->hSemGetCHNL), NULL);
+ down(&(pstrWFIDrv->hSemGetCHNL));
/* gu8Chnl = 11; */
*pu8ChNo = gu8Chnl;
if (s32Error)
PRINT_ER("Failed to send get host channel param's message queue ");
- WILC_SemaphoreAcquire(&(pstrWFIDrv->hSemInactiveTime), NULL);
+ down(&(pstrWFIDrv->hSemInactiveTime));
*pu32InactiveTime = gu32InactiveTime;
return WILC_FAIL;
}
- WILC_SemaphoreAcquire(&(pstrWFIDrv->hSemGetRSSI), NULL);
+ down(&(pstrWFIDrv->hSemGetRSSI));
if (ps8Rssi == NULL) {
return WILC_FAIL;
}
- WILC_SemaphoreAcquire(&(pstrWFIDrv->hSemGetLINKSPEED), NULL);
+ down(&(pstrWFIDrv->hSemGetLINKSPEED));
if (ps8lnkspd == NULL) {
return WILC_FAIL;
}
- WILC_SemaphoreAcquire(&hWaitResponse, NULL);
+ down(&hWaitResponse);
return s32Error;
}
WILC_Sint32 s32Error = WILC_SUCCESS;
tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- WILC_SemaphoreAcquire(&(pstrWFIDrv->gtOsCfgValuesSem), NULL);
+ down(&(pstrWFIDrv->gtOsCfgValuesSem));
if (pstrWFIDrv == WILC_NULL) {
PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n");
break;
}
- WILC_SemaphoreRelease(&(pstrWFIDrv->gtOsCfgValuesSem), NULL);
+ up(&(pstrWFIDrv->gtOsCfgValuesSem));
WILC_CATCH(s32Error)
{
{
WILC_Sint32 s32Error = WILC_SUCCESS;
tstrWILC_WFIDrv *pstrWFIDrv;
- tstrWILC_SemaphoreAttrs strSemaphoreAttrs;
-
/*if(u32Intialized == 1)
* {
gbScanWhileConnected = WILC_FALSE;
- WILC_SemaphoreFillDefault(&strSemaphoreAttrs);
-
-
- strSemaphoreAttrs.u32InitCount = 0;
- WILC_SemaphoreCreate(&hWaitResponse, &strSemaphoreAttrs);
+ sema_init(&hWaitResponse, 0);
PRINT_D(HOSTINF_DBG, "Global handle pointer value=%x\n", (WILC_Uint32)pstrWFIDrv);
/* /////////////////////////////////////// */
if (clients_count == 0) {
- strSemaphoreAttrs.u32InitCount = 0;
- WILC_SemaphoreCreate(&hSemHostIFthrdEnd, &strSemaphoreAttrs);
-
- strSemaphoreAttrs.u32InitCount = 0;
- WILC_SemaphoreCreate(&hSemDeinitDrvHandle, &strSemaphoreAttrs);
-
+ sema_init(&hSemHostIFthrdEnd, 0);
+ sema_init(&hSemDeinitDrvHandle, 0);
/*BugID_5348*/
- strSemaphoreAttrs.u32InitCount = 1;
- WILC_SemaphoreCreate(&hSemHostIntDeinit, &strSemaphoreAttrs);
- }
-
- strSemaphoreAttrs.u32InitCount = 0;
- WILC_SemaphoreCreate(&(pstrWFIDrv->hSemTestKeyBlock), &strSemaphoreAttrs);
- strSemaphoreAttrs.u32InitCount = 0;
- WILC_SemaphoreCreate(&(pstrWFIDrv->hSemTestDisconnectBlock), &strSemaphoreAttrs);
- strSemaphoreAttrs.u32InitCount = 0;
- WILC_SemaphoreCreate(&(pstrWFIDrv->hSemGetRSSI), &strSemaphoreAttrs);
- strSemaphoreAttrs.u32InitCount = 0;
- WILC_SemaphoreCreate(&(pstrWFIDrv->hSemGetLINKSPEED), &strSemaphoreAttrs);
- strSemaphoreAttrs.u32InitCount = 0;
- WILC_SemaphoreCreate(&(pstrWFIDrv->hSemGetCHNL), &strSemaphoreAttrs);
- strSemaphoreAttrs.u32InitCount = 0;
- WILC_SemaphoreCreate(&(pstrWFIDrv->hSemInactiveTime), &strSemaphoreAttrs);
+ sema_init(&hSemHostIntDeinit, 1);
+ }
+
+ sema_init(&(pstrWFIDrv->hSemTestKeyBlock), 0);
+ sema_init(&(pstrWFIDrv->hSemTestDisconnectBlock), 0);
+ sema_init(&(pstrWFIDrv->hSemGetRSSI), 0);
+ sema_init(&(pstrWFIDrv->hSemGetLINKSPEED), 0);
+ sema_init(&(pstrWFIDrv->hSemGetCHNL), 0);
+ sema_init(&(pstrWFIDrv->hSemInactiveTime), 0);
/* /////////////////////////////////////// */
}
#endif
- WILC_SemaphoreCreate(&(pstrWFIDrv->gtOsCfgValuesSem), NULL);
- WILC_SemaphoreAcquire(&(pstrWFIDrv->gtOsCfgValuesSem), NULL);
+ sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1);
+ down(&(pstrWFIDrv->gtOsCfgValuesSem));
pstrWFIDrv->strCfgValues.curr_tx_rate);
- WILC_SemaphoreRelease(&(pstrWFIDrv->gtOsCfgValuesSem), NULL);
+ up(&(pstrWFIDrv->gtOsCfgValuesSem));
/*TODO Code to setup simulation to be removed later*/
/*Intialize configurator module*/
WILC_TimerDestroy(&(pstrWFIDrv->hRemainOnChannel), WILC_NULL);
#endif
_fail_timer_2:
- WILC_SemaphoreRelease(&(pstrWFIDrv->gtOsCfgValuesSem), NULL);
+ up(&(pstrWFIDrv->gtOsCfgValuesSem));
WILC_TimerDestroy(&(pstrWFIDrv->hConnectTimer), WILC_NULL);
_fail_timer_1:
WILC_TimerDestroy(&(pstrWFIDrv->hScanTimer), WILC_NULL);
return 0;
}
- WILC_SemaphoreAcquire(&hSemHostIntDeinit, NULL);
+ down(&hSemHostIntDeinit);
terminated_handle = pstrWFIDrv;
PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count);
#endif
host_int_set_wfi_drv_handler((WILC_Uint32)WILC_NULL);
- WILC_SemaphoreAcquire(&hSemDeinitDrvHandle, NULL);
+ down(&hSemDeinitDrvHandle);
/*Calling the CFG80211 scan done function with the abort flag set to true*/
PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", s32Error);
}
- WILC_SemaphoreAcquire(&hSemHostIFthrdEnd, NULL);
+ down(&hSemHostIFthrdEnd);
WILC_MsgQueueDestroy(&gMsgQHostIF, WILC_NULL);
msgQ_created = 0;
-
-
- WILC_SemaphoreDestroy(&hSemHostIFthrdEnd, NULL);
- WILC_SemaphoreDestroy(&hSemDeinitDrvHandle, NULL);
-
}
- WILC_SemaphoreDestroy(&(pstrWFIDrv->hSemTestKeyBlock), NULL);
- WILC_SemaphoreDestroy(&(pstrWFIDrv->hSemTestDisconnectBlock), NULL);
- WILC_SemaphoreDestroy(&(pstrWFIDrv->hSemGetRSSI), NULL);
- WILC_SemaphoreDestroy(&(pstrWFIDrv->hSemGetLINKSPEED), NULL);
- WILC_SemaphoreDestroy(&(pstrWFIDrv->hSemGetCHNL), NULL);
- WILC_SemaphoreDestroy(&(pstrWFIDrv->hSemInactiveTime), NULL);
- WILC_SemaphoreDestroy(&hWaitResponse, NULL);
-
- WILC_SemaphoreAcquire(&(pstrWFIDrv->gtOsCfgValuesSem), NULL);
- WILC_SemaphoreDestroy(&(pstrWFIDrv->gtOsCfgValuesSem), NULL);
+ down(&(pstrWFIDrv->gtOsCfgValuesSem));
/*Setting the gloabl driver handler with NULL*/
u32Intialized = 0;
clients_count--; /* Decrease number of created entities */
terminated_handle = WILC_NULL;
- WILC_SemaphoreRelease(&hSemHostIntDeinit, NULL);
+ up(&hSemHostIntDeinit);
return s32Error;
}
tstrWILC_WFIDrv *pstrWFIDrv = WILC_NULL;
/*BugID_5348*/
- WILC_SemaphoreAcquire(&hSemHostIntDeinit, NULL);
+ down(&hSemHostIntDeinit);
drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) {
PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n");
/*BugID_5348*/
- WILC_SemaphoreRelease(&hSemHostIntDeinit, NULL);
+ up(&hSemHostIntDeinit);
return;
}
/* received mac status is not needed when there is no current Connect Request */
PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n");
/*BugID_5348*/
- WILC_SemaphoreRelease(&hSemHostIntDeinit, NULL);
+ up(&hSemHostIntDeinit);
return;
}
}
/*BugID_5348*/
- WILC_SemaphoreRelease(&hSemHostIntDeinit, NULL);
+ up(&hSemHostIntDeinit);
return;
}
{
}
- WILC_SemaphoreAcquire(&hWaitResponse, NULL);
+ down(&hWaitResponse);
return s32Error;
}
/*BugID_5222*/
- WILC_SemaphoreAcquire(&hWaitResponse, NULL);
+ down(&hWaitResponse);
return s32Error;
}
}
/*BugID_5222*/
- WILC_SemaphoreAcquire(&hWaitResponse, NULL);
+ down(&hWaitResponse);
return s32Error;
}
WILC_Uint8 au8AssociatedBSSID[ETH_ALEN];
tstrCfgParamVal strCfgValues;
/* semaphores */
- WILC_SemaphoreHandle gtOsCfgValuesSem;
- WILC_SemaphoreHandle hSemTestKeyBlock;
-
- WILC_SemaphoreHandle hSemTestDisconnectBlock;
- WILC_SemaphoreHandle hSemGetRSSI;
- WILC_SemaphoreHandle hSemGetLINKSPEED;
- WILC_SemaphoreHandle hSemGetCHNL;
- WILC_SemaphoreHandle hSemInactiveTime;
+ struct semaphore gtOsCfgValuesSem;
+ struct semaphore hSemTestKeyBlock;
+
+ struct semaphore hSemTestDisconnectBlock;
+ struct semaphore hSemGetRSSI;
+ struct semaphore hSemGetLINKSPEED;
+ struct semaphore hSemGetCHNL;
+ struct semaphore hSemInactiveTime;
/* timer handlers */
WILC_TimerHandle hScanTimer;
WILC_TimerHandle hConnectTimer;
WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle,
tstrWILC_MsgQueueAttrs *pstrAttrs)
{
- tstrWILC_SemaphoreAttrs strSemAttrs;
- WILC_SemaphoreFillDefault(&strSemAttrs);
- strSemAttrs.u32InitCount = 0;
-
spin_lock_init(&pHandle->strCriticalSection);
- if ((WILC_SemaphoreCreate(&pHandle->hSem, &strSemAttrs) == WILC_SUCCESS)) {
-
- pHandle->pstrMessageList = NULL;
- pHandle->u32ReceiversCount = 0;
- pHandle->bExiting = WILC_FALSE;
-
- return WILC_SUCCESS;
- } else {
- return WILC_FAIL;
- }
+ sema_init(&pHandle->hSem, 0);
+ pHandle->pstrMessageList = NULL;
+ pHandle->u32ReceiversCount = 0;
+ pHandle->bExiting = WILC_FALSE;
+ return WILC_SUCCESS;
}
/*!
/* Release any waiting receiver thread. */
while (pHandle->u32ReceiversCount > 0) {
- WILC_SemaphoreRelease(&(pHandle->hSem), WILC_NULL);
+ up(&(pHandle->hSem));
pHandle->u32ReceiversCount--;
}
- WILC_SemaphoreDestroy(&pHandle->hSem, WILC_NULL);
-
while (pHandle->pstrMessageList != NULL) {
Message *pstrMessge = pHandle->pstrMessageList->pstrNext;
WILC_FREE(pHandle->pstrMessageList);
spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
- WILC_SemaphoreRelease(&pHandle->hSem, WILC_NULL);
+ up(&pHandle->hSem);
WILC_CATCH(s32RetStatus)
{
Message *pstrMessage;
WILC_ErrNo s32RetStatus = WILC_SUCCESS;
- tstrWILC_SemaphoreAttrs strSemAttrs;
unsigned long flags;
if ((pHandle == NULL) || (u32RecvBufferSize == 0)
|| (pvRecvBuffer == NULL) || (pu32ReceivedLength == NULL)) {
pHandle->u32ReceiversCount++;
spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
- WILC_SemaphoreFillDefault(&strSemAttrs);
- s32RetStatus = WILC_SemaphoreAcquire(&(pHandle->hSem), &strSemAttrs);
+ down(&(pHandle->hSem));
+
if (s32RetStatus == WILC_TIMEOUT) {
/* timed out, just exit without consumeing the message */
spin_lock_irqsave(&pHandle->strCriticalSection, flags);
/* check buffer size */
if (u32RecvBufferSize < pstrMessage->u32Length) {
spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
- WILC_SemaphoreRelease(&pHandle->hSem, WILC_NULL);
+ up(&pHandle->hSem);
WILC_ERRORREPORT(s32RetStatus, WILC_BUFFER_OVERFLOW);
}
/* Error reporting and handling support */
#include "wilc_errorsupport.h"
-/* Semaphore support */
-#include "wilc_semaphore.h"
-
/* Sleep support */
#include "wilc_sleep.h"
* OS specific types
*******************************************************************/
-typedef struct semaphore WILC_SemaphoreHandle;
-
typedef struct timer_list WILC_TimerHandle;
} Message;
typedef struct __MessageQueue_struct {
- WILC_SemaphoreHandle hSem;
+ struct semaphore hSem;
spinlock_t strCriticalSection;
WILC_Bool bExiting;
WILC_Uint32 u32ReceiversCount;
+++ /dev/null
-
-#include "wilc_oswrapper.h"
-
-WILC_ErrNo WILC_SemaphoreCreate(WILC_SemaphoreHandle *pHandle,
- tstrWILC_SemaphoreAttrs *pstrAttrs)
-{
- tstrWILC_SemaphoreAttrs strDefaultAttrs;
- if (pstrAttrs == WILC_NULL) {
- WILC_SemaphoreFillDefault(&strDefaultAttrs);
- pstrAttrs = &strDefaultAttrs;
- }
-
- sema_init(pHandle, pstrAttrs->u32InitCount);
- return WILC_SUCCESS;
-
-}
-
-
-WILC_ErrNo WILC_SemaphoreDestroy(WILC_SemaphoreHandle *pHandle,
- tstrWILC_SemaphoreAttrs *pstrAttrs)
-{
- /* nothing to be done ! */
-
- return WILC_SUCCESS;
-
-}
-
-
-WILC_ErrNo WILC_SemaphoreAcquire(WILC_SemaphoreHandle *pHandle,
- tstrWILC_SemaphoreAttrs *pstrAttrs)
-{
- WILC_ErrNo s32RetStatus = WILC_SUCCESS;
-
- while (down_interruptible(pHandle))
- ;
-
- if (s32RetStatus == 0) {
- return WILC_SUCCESS;
- } else if (s32RetStatus == -ETIME) {
- return WILC_TIMEOUT;
- } else {
- return WILC_FAIL;
- }
-
- return WILC_SUCCESS;
-
-}
-
-WILC_ErrNo WILC_SemaphoreRelease(WILC_SemaphoreHandle *pHandle,
- tstrWILC_SemaphoreAttrs *pstrAttrs)
-{
-
- up(pHandle);
- return WILC_SUCCESS;
-
-}
+++ /dev/null
-#ifndef __WILC_SEMAPHORE_H__
-#define __WILC_SEMAPHORE_H__
-
-/*!
- * @file wilc_semaphore.h
- * @brief Semaphore OS Wrapper functionality
- * @author syounan
- * @sa wilc_oswrapper.h top level OS wrapper file
- * @date 10 Aug 2010
- * @version 1.0
- */
-
-/*!
- * @struct WILC_SemaphoreAttrs
- * @brief Semaphore API options
- * @author syounan
- * @date 10 Aug 2010
- * @version 1.0
- */
-typedef struct {
- /*!<
- * Initial count when the semaphore is created. default is 1
- */
- WILC_Uint32 u32InitCount;
-
-} tstrWILC_SemaphoreAttrs;
-
-
-/*!
- * @brief Fills the WILC_SemaphoreAttrs with default parameters
- * @param[out] pstrAttrs structure to be filled
- * @sa WILC_SemaphoreAttrs
- * @author syounan
- * @date 10 Aug 2010
- * @version 1.0
- */
-static inline void WILC_SemaphoreFillDefault(tstrWILC_SemaphoreAttrs *pstrAttrs)
-{
- pstrAttrs->u32InitCount = 1;
-}
-/*!
- * @brief Creates a new Semaphore object
- * @param[out] pHandle handle to the newly created semaphore
- * @param[in] pstrAttrs Optional attributes, NULL for defaults
- * pstrAttrs->u32InitCount controls the initial count
- * @return Error code indicating success/failure
- * @sa WILC_SemaphoreAttrs
- * @author syounan
- * @date 10 Aug 2010
- * @version 1.0
- */
-WILC_ErrNo WILC_SemaphoreCreate(WILC_SemaphoreHandle *pHandle,
- tstrWILC_SemaphoreAttrs *pstrAttrs);
-
-/*!
- * @brief Destroyes an existing Semaphore, releasing any resources
- * @param[in] pHandle handle to the semaphore object
- * @param[in] pstrAttrs Optional attributes, NULL for defaults
- * @return Error code indicating success/failure
- * @sa WILC_SemaphoreAttrs
- * @todo need to define behaviour if the semaphore delayed while it is pending
- * @author syounan
- * @date 10 Aug 2010
- * @version 1.0
- */
-WILC_ErrNo WILC_SemaphoreDestroy(WILC_SemaphoreHandle *pHandle,
- tstrWILC_SemaphoreAttrs *pstrAttrs);
-
-/*!
- * @brief Acquire the Semaphore object
- * @details This function will block until it can Acquire the given
- * semaphore, if the feature WILC_OS_FEATURE_SEMAPHORE_TIMEOUT is
- * eanbled a timeout value can be passed in pstrAttrs
- * @param[in] pHandle handle to the semaphore object
- * @param[in] pstrAttrs Optional attributes, NULL for default
- * @return Error code indicating success/failure
- * @sa WILC_SemaphoreAttrs
- * @author syounan
- * @date 10 Aug 2010
- * @version 1.0
- */
-WILC_ErrNo WILC_SemaphoreAcquire(WILC_SemaphoreHandle *pHandle,
- tstrWILC_SemaphoreAttrs *pstrAttrs);
-
-/*!
- * @brief Release the Semaphore object
- * @param[in] pHandle handle to the semaphore object
- * @param[in] pstrAttrs Optional attributes, NULL for default
- * @return Error code indicating sucess/failure
- * @sa WILC_SemaphoreAttrs
- * @author syounan
- * @date 10 Aug 2010
- * @version 1.0
- */
-WILC_ErrNo WILC_SemaphoreRelease(WILC_SemaphoreHandle *pHandle,
- tstrWILC_SemaphoreAttrs *pstrAttrs);
-
-
-#endif
PRINT_D(CFG80211_DBG, "No networks found \n");
}
- WILC_SemaphoreAcquire(&(priv->hSemScanReq), NULL);
+ down(&(priv->hSemScanReq));
if (priv->pstrScanReq != WILC_NULL) {
cfg80211_scan_done(priv->pstrScanReq, WILC_FALSE);
priv->bCfgScanning = WILC_FALSE;
priv->pstrScanReq = WILC_NULL;
}
- WILC_SemaphoreRelease(&(priv->hSemScanReq), NULL);
+ up(&(priv->hSemScanReq));
}
/*Aborting any scan operation during mac close*/
else if (enuScanEvent == SCAN_EVENT_ABORTED) {
- WILC_SemaphoreAcquire(&(priv->hSemScanReq), NULL);
+ down(&(priv->hSemScanReq));
PRINT_D(CFG80211_DBG, "Scan Aborted \n");
if (priv->pstrScanReq != WILC_NULL) {
priv->bCfgScanning = WILC_FALSE;
priv->pstrScanReq = WILC_NULL;
}
- WILC_SemaphoreRelease(&(priv->hSemScanReq), NULL);
+ up(&(priv->hSemScanReq));
}
}
STATION_INFO_RX_BYTES |
STATION_INFO_RX_PACKETS | STATION_INFO_SIGNAL | STATION_INFO_INACTIVE_TIME;
- WILC_SemaphoreAcquire(&SemHandleUpdateStats, NULL);
+ down(&SemHandleUpdateStats);
sinfo->inactive_time = priv->netstats.rx_time > priv->netstats.tx_time ? jiffies_to_msecs(jiffies - priv->netstats.tx_time) : jiffies_to_msecs(jiffies - priv->netstats.rx_time);
sinfo->rx_bytes = priv->netstats.rx_bytes;
sinfo->tx_bytes = priv->netstats.tx_bytes;
sinfo->rx_packets = priv->netstats.rx_packets;
sinfo->tx_packets = priv->netstats.tx_packets;
- WILC_SemaphoreRelease(&SemHandleUpdateStats, NULL);
+ up(&SemHandleUpdateStats);
#endif
return 0;
struct WILC_WFI_priv *priv;
priv = wiphy_priv(wiphy);
- /* WILC_SemaphoreAcquire(&SemHandleUpdateStats,NULL); */
+ /* down(&SemHandleUpdateStats); */
#if 1
switch (changed) {
default:
break;
}
- /* WILC_SemaphoreRelease(&SemHandleUpdateStats,NULL); */
+ /* down(&SemHandleUpdateStats); */
#endif
return 0;
}
/*Return hardware description structure (wiphy)'s priv*/
priv = wdev_priv(wdev);
- WILC_SemaphoreCreate(&(priv->SemHandleUpdateStats), NULL);
+ sema_init(&(priv->SemHandleUpdateStats), 1);
/*Link the wiphy with wireless structure*/
priv->wdev = wdev;
struct WILC_WFI_priv *priv;
- tstrWILC_SemaphoreAttrs strSemaphoreAttrs;
-
PRINT_D(INIT_DBG, "Host[%p][%p]\n", net, net->ieee80211_ptr);
priv = wdev_priv(net->ieee80211_ptr);
if (op_ifcs == 0) {
return s32Error;
}
- WILC_SemaphoreFillDefault(&strSemaphoreAttrs);
-
- /* /////////////////////////////////////// */
- /* strSemaphoreAttrs.u32InitCount = 0; */
-
-
priv->gbAutoRateAdjusted = WILC_FALSE;
priv->bInP2PlistenState = WILC_FALSE;
- WILC_SemaphoreCreate(&(priv->hSemScanReq), &strSemaphoreAttrs);
+ sema_init(&(priv->hSemScanReq), 1);
s32Error = host_int_init(&priv->hWILCWFIDrv);
/* s32Error = host_int_init(&priv->hWILCWFIDrv_2); */
if (s32Error) {
struct WILC_WFI_priv *priv;
priv = wdev_priv(net->ieee80211_ptr);
-
-
-
-
-
- WILC_SemaphoreDestroy(&(priv->hSemScanReq), NULL);
-
priv->gbAutoRateAdjusted = WILC_FALSE;
priv->bInP2PlistenState = WILC_FALSE;
struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA];
WILC_Uint8 wilc_groupkey;
/* semaphores */
- WILC_SemaphoreHandle SemHandleUpdateStats;
- WILC_SemaphoreHandle hSemScanReq;
+ struct semaphore SemHandleUpdateStats;
+ struct semaphore hSemScanReq;
/* */
WILC_Bool gbAutoRateAdjusted;