/* OS features supported */
-#define CONFIG_WILC_SEMAPHORE_FEATURE 1
/* #define CONFIG_WILC_SEMAPHORE_TIMEOUT 1 */
#define CONFIG_WILC_SLEEP_FEATURE 1
#define CONFIG_WILC_SLEEP_HI_RES 1
#include "wilc_errorsupport.h"
/* Semaphore support */
-#ifdef CONFIG_WILC_SEMAPHORE_FEATURE
#include "wilc_semaphore.h"
-#endif
/* Sleep support */
#ifdef CONFIG_WILC_SLEEP_FEATURE
#include "wilc_oswrapper.h"
-#ifdef CONFIG_WILC_SEMAPHORE_FEATURE
-
WILC_ErrNo WILC_SemaphoreCreate(WILC_SemaphoreHandle *pHandle,
tstrWILC_SemaphoreAttrs *pstrAttrs)
{
WILC_ErrNo s32RetStatus = WILC_SUCCESS;
- #ifndef CONFIG_WILC_SEMAPHORE_TIMEOUT
while (down_interruptible(pHandle))
;
- #else
- if (pstrAttrs == WILC_NULL) {
- down(pHandle);
- } else {
-
- s32RetStatus = down_timeout(pHandle, msecs_to_jiffies(pstrAttrs->u32TimeOut));
- }
- #endif
-
if (s32RetStatus == 0) {
return WILC_SUCCESS;
} else if (s32RetStatus == -ETIME) {
return WILC_SUCCESS;
}
-
-#endif
* @version 1.0
*/
-
-#ifndef CONFIG_WILC_SEMAPHORE_FEATURE
-#error the feature WILC_OS_FEATURE_SEMAPHORE must be supported to include this file
-#endif
-
/*!
* @struct WILC_SemaphoreAttrs
* @brief Semaphore API options
*/
WILC_Uint32 u32InitCount;
- #ifdef CONFIG_WILC_SEMAPHORE_TIMEOUT
- /*!<
- * Timeout for use with WILC_SemaphoreAcquire, 0 to return immediately and
- * WILC_OS_INFINITY to wait forever. default is WILC_OS_INFINITY
- */
- WILC_Uint32 u32TimeOut;
- #endif
-
} tstrWILC_SemaphoreAttrs;
* @date 10 Aug 2010
* @version 1.0
*/
-static void WILC_SemaphoreFillDefault(tstrWILC_SemaphoreAttrs *pstrAttrs)
+static inline void WILC_SemaphoreFillDefault(tstrWILC_SemaphoreAttrs *pstrAttrs)
{
pstrAttrs->u32InitCount = 1;
- #ifdef CONFIG_WILC_SEMAPHORE_TIMEOUT
- pstrAttrs->u32TimeOut = WILC_OS_INFINITY;
- #endif
}
/*!
* @brief Creates a new Semaphore object