WILC_Uint32 FIFO_InitBuffer(tHANDLE * hBuffer,WILC_Uint32 u32BufferLength) { WILC_Uint32 u32Error = 0; tstrFifoHandler * pstrFifoHandler = WILC_MALLOC(sizeof(tstrFifoHandler)); if(pstrFifoHandler) { 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); *hBuffer = pstrFifoHandler; } else { *hBuffer = NULL; u32Error = 1; } } else { u32Error = 1; } return u32Error; }
/*! * @author syounan * @date 1 Sep 2010 * @note copied from FLO glue implementatuion * @version 1.0 */ 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; } }