void _SlDrvFlowContInit(void) { g_pCB->FlowContCB.TxPoolCnt = FLOW_CONT_MIN; OSI_RET_OK_CHECK(sl_LockObjCreate(&g_pCB->FlowContCB.TxLockObj, "TxLockObj")); OSI_RET_OK_CHECK(sl_SyncObjCreate(&g_pCB->FlowContCB.TxSyncObj, "TxSyncObj")); }
void modusocket_pre_init (void) { // create the wlan lock ASSERT(OSI_OK == sl_LockObjCreate(&modusocket_LockObj, "SockLock")); sl_LockObjUnlock (&modusocket_LockObj); }
void updater_pre_init (void) { // create the updater lock ASSERT(OSI_OK == sl_LockObjCreate(&updater_LockObj, "UpdaterLock")); }
void _SlInternalSpawnTaskEntry() { _i16 i; _SlInternalSpawnEntry_t* pEntry; _u8 LastEntry; /* create and lock the locking object. lock in order to avoid race condition on the first creation */ sl_LockObjCreate(&g_SlInternalSpawnCB.LockObj,"SlSpawnProtect"); sl_LockObjLock(&g_SlInternalSpawnCB.LockObj,SL_OS_NO_WAIT); /* create and clear the sync object */ sl_SyncObjCreate(&g_SlInternalSpawnCB.SyncObj,"SlSpawnSync"); sl_SyncObjWait(&g_SlInternalSpawnCB.SyncObj,SL_OS_NO_WAIT); g_SlInternalSpawnCB.pFree = &g_SlInternalSpawnCB.SpawnEntries[0]; g_SlInternalSpawnCB.pWaitForExe = NULL; g_SlInternalSpawnCB.pLastInWaitList = NULL; /* create the link list between the entries */ for (i=0 ; i<_SL_MAX_INTERNAL_SPAWN_ENTRIES - 1 ; i++) { g_SlInternalSpawnCB.SpawnEntries[i].pNext = &g_SlInternalSpawnCB.SpawnEntries[i+1]; g_SlInternalSpawnCB.SpawnEntries[i].pEntry = NULL; } g_SlInternalSpawnCB.SpawnEntries[i].pNext = NULL; sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj); /* here we ready to execute entries */ while (TRUE) { sl_SyncObjWait(&g_SlInternalSpawnCB.SyncObj,SL_OS_WAIT_FOREVER); /* go over all entries that already waiting for execution */ LastEntry = FALSE; do { /* get entry to execute */ sl_LockObjLock(&g_SlInternalSpawnCB.LockObj,SL_OS_WAIT_FOREVER); pEntry = g_SlInternalSpawnCB.pWaitForExe; if ( NULL == pEntry ) { sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj); break; } g_SlInternalSpawnCB.pWaitForExe = pEntry->pNext; if (pEntry == g_SlInternalSpawnCB.pLastInWaitList) { g_SlInternalSpawnCB.pLastInWaitList = NULL; LastEntry = TRUE; } sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj); /* pEntry could be null in case that the sync was already set by some of the entries during execution of earlier entry */ if (NULL != pEntry) { pEntry->pEntry(pEntry->pValue); /* free the entry */ sl_LockObjLock(&g_SlInternalSpawnCB.LockObj,SL_OS_WAIT_FOREVER); pEntry->pNext = g_SlInternalSpawnCB.pFree; g_SlInternalSpawnCB.pFree = pEntry; if (NULL != g_SlInternalSpawnCB.pWaitForExe) { /* new entry received meanwhile */ LastEntry = FALSE; } sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj); } }while (!LastEntry); } }
void wlan_pre_init (void) { // create the wlan lock #ifdef SL_PLATFORM_MULTI_THREADED ASSERT(OSI_OK == sl_LockObjCreate(&wlan_LockObj, "WlanLock")); #endif }