示例#1
0
int pt_process::dispatch(int event, unsigned long param) {
    if (event_proc != NULL)
        return event_proc(event_context, event, param);
    return -1;
}
示例#2
0
void app_main(void *data)
{
    EatEvent_st event;
    eat_bool rc;
    EatEntryPara_st *para;


    APP_InitRegions();//Init app RAM
    APP_init_clib(); //C library initialize, second step

    para = (EatEntryPara_st*)data;
    if(para->is_update_app && para->update_app_result)
    {
        //APP update succeed
        LOG_DEBUG("app upgrade success");
        eat_update_app_ok(); //clear update APP flag
    }

    LOG_INFO("booting: version:%s, build_time=%s %s. core(version:%s, buildno=%s, buildtime=%s)",
            VERSION_STR, __DATE__, __TIME__, eat_get_version(), eat_get_buildno(), eat_get_buildtime());

    rc = eat_mem_init(s_memPool, EAT_MEM_MAX_SIZE);
    if (!rc)
    {
    	LOG_ERROR("eat memory initial error:%d!", rc);
        return;
    }

    if (lzo_init() != LZO_E_OK)
    {
        return;
    }

    log_initial();

    setting_restore();

    fs_initial();

    seek_initial();

    startWatchdog();


    while(EAT_TRUE)
    {
    	unsigned int event_num = eat_get_event_num();
    	if (event_num != 0)
    	{
    		int i = 0;
    		for (i = 0; i < event_num; i++)
    		{
    			eat_get_event(&event);

    	        event_proc(&event);
    		}
    	}

    	//poll
    }
}