示例#1
0
文件: wlan.c 项目: ianjuch/ee149
void wlan_start(unsigned short usPatchesAvailableAtHost)
{
    OS_mutex_lock(g_main_mutex, &mtx_key);

    s_thread_params params = {0};
    int index = 0;

    for(index = 0; index < MAX_NUM_OF_SOCKETS; index++){
        g_sockets[index].sd = -1;
        g_sockets[index].status = SOC_NOT_INITED;
        if (NULL == g_sockets[index].sd_semaphore)
            OS_semaphore_create(&g_sockets[index].sd_semaphore, "SockSem", 0);
    }

    if (NULL == g_accept_semaphore)
        OS_semaphore_create(&g_accept_semaphore, "AcceptSem", 0);

    if (NULL == g_select_sleep_semaphore)
        OS_semaphore_create(&g_select_sleep_semaphore, "SelectSleepSem", 0);

    /**/
    c_wlan_start(usPatchesAvailableAtHost);

    g_wlan_stopped = 0;
    g_should_poll_accept = 0;
    g_accept_socket = -1;

    if (NULL == g_select_thread){ /* Thread not created yet */
        /* Fill Thread Params */
        strncpy(params.thread_name, "SelectThread", strlen("SelectThread"));
        params.p_stack_start = NULL; /* TBD - Mandatory in Thread-X */
        params.p_entry_function = SelectThread;
        *(sInt32 *)params.p_func_params = 0;
        params.stack_size = 512;
        params.priority = 3;

        if (e_SUCCESS != OS_thread_create(&g_select_thread, &params))
        {
            OS_mutex_unlock(g_main_mutex, mtx_key); /* Error */
        }
    }

    OS_mutex_unlock(g_main_mutex, mtx_key);
}
示例#2
0
文件: wlan.c 项目: mileat/proj-emb
void wlan_start(unsigned short usPatchesAvailableAtHost)
{
    c_wlan_start(usPatchesAvailableAtHost);
}