/***************************************************************************** Prototype : OS_mem_init Input : void Output : None Return Value : OS_RET_CODE Description : Memory management initialization Calls : *****************************************************************************/ OS_RET_CODE OS_mem_init(void) { OS_ISR_STATE cpu_sr; OS_RET_CODE ret; ULONG32 ulIdx; (void)ret; /* neutralize compiler warning */ OS_ENTER_CRITICAL(); ret = OS_mutex_create("MemMngMutexId", 0, &OS_mem_mutex_id); __AFFIRM(OS_RET_SUCCESS == ret); for (ulIdx = 0; ulIdx < OS_MEM_CTRL_CNT; ulIdx++) { OS_mem_ctrl[ulIdx].state = MEM_INIT; OS_mem_ctrl[ulIdx].type = MEM_TYPE_INIT; OS_mem_ctrl[ulIdx].prev = OS_mem_ctrl[ulIdx].next = NULL; OS_mem_ctrl[ulIdx].addr = 0; OS_mem_ctrl[ulIdx].owner = OS_TASK_ID_INVALID; } for (ulIdx = 0; ulIdx < OS_MEM_CTRL_CNT; ulIdx++) { OS_mem_list[ulIdx].head = NULL; OS_mem_list[ulIdx].cnt = 0; } ret = __mem_partiion((ULONG32)(&OS_mem_pool[0]), sizeof(OS_mem_pool)); __AFFIRM(OS_RET_SUCCESS == ret); OS_EXIT_CRITICAL(); return OS_RET_SUCCESS; }
void wlan_init(tWlanCB sWlanCB, tFWPatches sFWPatches, tDriverPatches sDriverPatches, tBootLoaderPatches sBootLoaderPatches, tWlanReadInteruptPin sReadWlanInterruptPin, tWlanInterruptEnable sWlanInterruptEnable, tWlanInterruptDisable sWlanInterruptDisable, tWriteWlanPin sWriteWlanPin) { OS_mutex_create(&g_main_mutex, "MainMutex"); OS_semaphore_create(&g_spi_semaphore, "SpiSemaphore", 0); OS_mutex_lock(g_main_mutex, &mtx_key); g_select_thread = NULL; c_wlan_init(sWlanCB, sFWPatches, sDriverPatches,\ sBootLoaderPatches, sReadWlanInterruptPin,\ sWlanInterruptEnable, sWlanInterruptDisable, sWriteWlanPin); OS_mutex_unlock(g_main_mutex, mtx_key); }