int dpmgr_path_deinit(disp_path_handle dp_handle, int encmdq) { int i=0; int module_name ; ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; int * modules = ddp_get_scenario_list(handle->scenario); int module_num = ddp_get_module_num(handle->scenario); cmdqRecHandle cmdqHandle = encmdq ? handle->cmdqhandle : NULL; DISP_LOG_I("path deinit on scenario %s\n",ddp_get_scenario_name(handle->scenario)); ddp_mutex_Interrupt_disable(handle->hwmutexid,cmdqHandle); ddp_mutex_clear(handle->hwmutexid,cmdqHandle); ddp_disconnect_path(handle->scenario, cmdqHandle); for( i=0; i< module_num;i++) { module_name = modules[i]; if(ddp_modules_driver[module_name] != 0) { if(ddp_modules_driver[module_name]->deinit!= 0) { DISP_LOG_I("scenario %s deinit module %s\n",ddp_get_scenario_name(handle->scenario), ddp_get_module_name(module_name)); ddp_modules_driver[module_name]->deinit(module_name, cmdqHandle); } if(ddp_modules_driver[module_name]->set_listener!= 0) { ddp_modules_driver[module_name]->set_listener(module_name,NULL); } } } handle->power_sate = 0; //close top clock when last path init path_top_clock_off(); return 0; }
disp_path_handle dpmgr_create_path(DDP_SCENARIO_ENUM scenario, cmdqRecHandle cmdq_handle) { int i =0; int module_name ; ddp_path_handle path_handle = NULL; int * modules = ddp_get_scenario_list(scenario); int module_num = ddp_get_module_num(scenario); DDP_MANAGER_CONTEXT * content = _get_context(); path_handle = kzalloc(sizeof(uint8_t*) * sizeof(ddp_path_handle_t), GFP_KERNEL); if (NULL != path_handle) { path_handle->cmdqhandle = cmdq_handle; path_handle->scenario = scenario; path_handle->hwmutexid = acquire_mutex(scenario); assign_default_irqs_table(scenario,path_handle->irq_event_map); DISP_LOG_I("create handle 0x%x on scenario %s\n",path_handle,ddp_get_scenario_name(scenario)); for( i=0; i< module_num;i++) { module_name = modules[i]; DISP_LOG_I(" scenario %s include module %s\n",ddp_get_scenario_name(scenario),ddp_get_module_name(module_name)); content->module_usage_table[module_name]++; content->module_path_table[module_name] = path_handle; } content->handle_cnt ++; content->handle_pool[path_handle->hwmutexid] = path_handle; } else { DISP_LOG_E("Fail to create handle on scenario %s\n",ddp_get_scenario_name(scenario)); } return path_handle; }
int dpmgr_path_reset(disp_path_handle dp_handle, int encmdq) { int i=0; int ret = 0; int error = 0; int module_name ; ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; int * modules = ddp_get_scenario_list(handle->scenario); int module_num = ddp_get_module_num(handle->scenario); cmdqRecHandle cmdqHandle = encmdq ? handle->cmdqhandle : NULL; DISP_LOG_I("path reset on scenario %s\n",ddp_get_scenario_name(handle->scenario)); /* first reset mutex */ ddp_mutex_reset(handle->hwmutexid,cmdqHandle); for( i=0; i< module_num;i++) { module_name = modules[i]; if(ddp_modules_driver[module_name] != 0) { if(ddp_modules_driver[module_name]->reset != 0) { DISP_LOG_I("scenario %s reset module %s \n",ddp_get_scenario_name(handle->scenario), ddp_get_module_name(module_name)); ret = ddp_modules_driver[module_name]->reset(module_name, cmdqHandle); if(ret != 0) { error++; } } } } return error > 0? -1: 0; }
int dpmgr_path_ioctl(disp_path_handle dp_handle, void * cmdq_handle, DDP_IOCTL_NAME ioctl_cmd, unsigned long *params) { int i=0; int ret = 0; int module_name ; ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; int * modules = ddp_get_scenario_list(handle->scenario); int module_num = ddp_get_module_num(handle->scenario); DISP_LOG_I("path IOCTL on scenario %s\n",ddp_get_scenario_name(handle->scenario)); for( i=module_num-1; i >= 0 ;i--) { module_name = modules[i]; if(ddp_modules_driver[module_name] != 0) { if(ddp_modules_driver[module_name]->ioctl!= 0) { printk("scenario %s, module %s ioctl\n",ddp_get_scenario_name(handle->scenario), ddp_get_module_name(module_name)); ret += ddp_modules_driver[module_name]->ioctl(module_name, cmdq_handle, (unsigned int)ioctl_cmd, params); } } } return ret; }
int dpmgr_wait_event_timeout(disp_path_handle dp_handle, DISP_PATH_EVENT event, int timeout) { int ret = -1; ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; DPMGR_WQ_HANDLE *wq_handle = & handle->wq_list[event]; if(wq_handle->init) { DISP_LOG_V("wait event %s on scenario %s\n", path_event_name(event),ddp_get_scenario_name(handle->scenario)); unsigned long long cur_time = sched_clock(); ret = wait_event_interruptible_timeout(wq_handle->wq, cur_time < wq_handle->data,timeout); if(ret == 0) { DISP_LOG_E("wait %s timeout on scenario %s\n", path_event_name(event),ddp_get_scenario_name(handle->scenario)); } else if(ret < 0) { DISP_LOG_E("wait %s interrupt by other timeleft %d on scenario %s\n", path_event_name(event),ret,ddp_get_scenario_name(handle->scenario)); } else { DISP_LOG_V("received event %s timeleft %d on scenario %s\n", path_event_name(event), ret,ddp_get_scenario_name(handle->scenario)); } return ret; } DISP_LOG_E("wait event %s not initialized on scenario %s\n", path_event_name(event),ddp_get_scenario_name(handle->scenario)); return ret; }
int dpmgr_path_config(disp_path_handle dp_handle, disp_ddp_path_config * config, void * cmdq_handle) { int i=0; int module_name ; ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; int * modules = ddp_get_scenario_list(handle->scenario); int module_num = ddp_get_module_num(handle->scenario); DISP_LOG_V("path config ovl %d, rdma %d, wdma %d, dst %d on handle 0x%x scenario %s \n", config->ovl_dirty, config->rdma_dirty, config->wdma_dirty, config->dst_dirty, handle, ddp_get_scenario_name(handle->scenario)); memcpy(&handle->last_config, config, sizeof(disp_ddp_path_config)); for( i=0; i< module_num;i++) { module_name = modules[i]; if(ddp_modules_driver[module_name] != 0) { if(ddp_modules_driver[module_name]->config!= 0) { DISP_LOG_V("scenario %s config module %s \n",ddp_get_scenario_name(handle->scenario), ddp_get_module_name(module_name)); ddp_modules_driver[module_name]->config(module_name, config, cmdq_handle); } } } return 0; }
int dpmgr_path_stop(disp_path_handle dp_handle, int encmdq) { int i=0; int module_name ; ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; int * modules = ddp_get_scenario_list(handle->scenario); int module_num = ddp_get_module_num(handle->scenario); cmdqRecHandle cmdqHandle = encmdq ? handle->cmdqhandle : NULL; DISP_LOG_V("path stop on scenario %s\n",ddp_get_scenario_name(handle->scenario)); for( i=module_num-1; i>=0;i--) { module_name = modules[i]; if(ddp_modules_driver[module_name] != 0) { if(ddp_modules_driver[module_name]->stop!= 0) { DISP_LOG_V("scenario %s stop module %s \n",ddp_get_scenario_name(handle->scenario), ddp_get_module_name(module_name)); ddp_modules_driver[module_name]->stop(module_name, cmdqHandle); } } } return 0; }
int dpmgr_check_status(disp_path_handle dp_handle) { int i =0; int module_name ; ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; int * modules = ddp_get_scenario_list(handle->scenario); int module_num = ddp_get_module_num(handle->scenario); DISP_LOG_I("check status on scenario %s\n", ddp_get_scenario_name(handle->scenario)); ddp_check_path(handle->scenario); ddp_check_mutex(handle->hwmutexid,handle->scenario, handle->mode); for( i=0; i< module_num;i++) { module_name = modules[i]; if(ddp_modules_driver[module_name] != 0 && ddp_modules_driver[module_name]->dump_info!= 0) { ddp_modules_driver[module_name]->dump_info(module_name, 1); } else { ddp_dump_analysis(module_name); ddp_dump_reg(module_name); } } ddp_dump_analysis(DISP_MODULE_CONFIG); ddp_dump_reg(DISP_MODULE_CONFIG); ddp_dump_analysis(DISP_MODULE_MUTEX); ddp_dump_reg(DISP_MODULE_MUTEX); return 0; }
int dpmgr_destroy_path(disp_path_handle dp_handle) { int i =0; int module_name ; ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; int * modules = ddp_get_scenario_list(handle->scenario); int module_num = ddp_get_module_num(handle->scenario); DDP_MANAGER_CONTEXT * content = _get_context(); DISP_LOG_I("destroy path handle 0x%x on scenario %s\n",handle,ddp_get_scenario_name(handle->scenario)); if(handle != NULL) { release_mutex(handle->hwmutexid); ddp_disconnect_path(handle->scenario,handle->cmdqhandle); for( i=0; i< module_num;i++) { module_name = modules[i]; content->module_usage_table[module_name]--; content->module_path_table[module_name] = NULL; } content->handle_cnt --; ASSERT(content->handle_cnt >=0); content->handle_pool[handle->hwmutexid] = NULL; kfree(handle); } return 0; }
void ddp_check_mutex(int mutex_id, DDP_SCENARIO_ENUM scenario, DDP_MODE mode) { DDPDBG("check mutex %d on scenario %s\n",mutex_id, ddp_get_scenario_name(scenario)); ddp_check_mutex_l(mutex_id,module_list_scenario[scenario],mode); return ; }
int dpmgr_path_power_on(disp_path_handle dp_handle, CMDQ_SWITCH encmdq) { int i=0; int module_name ; ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; int * modules = ddp_get_scenario_list(handle->scenario); int module_num = ddp_get_module_num(handle->scenario); DISP_LOG_I("path power on scenario %s\n",ddp_get_scenario_name(handle->scenario)); path_top_clock_on(); for( i=0; i< module_num;i++) { module_name = modules[i]; if(ddp_modules_driver[module_name] != 0) { if(ddp_modules_driver[module_name]->power_on!= 0) { DISP_LOG_I("%s power on\n",ddp_get_module_name(module_name)); ddp_modules_driver[module_name]->power_on(module_name, encmdq?handle->cmdqhandle:NULL); // now just 0; } } } //modules on this path will resume power on; handle->power_sate = 1; return 0; }
int dpmgr_path_trigger(disp_path_handle dp_handle, void *trigger_loop_handle, int encmdq) { ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; DISP_LOG_V("dpmgr_path_trigger on scenario %s\n",ddp_get_scenario_name(handle->scenario)); cmdqRecHandle cmdqHandle = encmdq ? handle->cmdqhandle : NULL; int i=0; int * modules = ddp_get_scenario_list(handle->scenario); int module_num = ddp_get_module_num(handle->scenario); int module_name ; ddp_mutex_enable(handle->hwmutexid,handle->scenario,trigger_loop_handle); for( i=0; i< module_num;i++) { module_name = modules[i]; if(ddp_modules_driver[module_name] != 0) { if(ddp_modules_driver[module_name]->trigger!= 0) { DISP_LOG_V("%s trigger\n",ddp_get_module_name(module_name)); ddp_modules_driver[module_name]->trigger(module_name, trigger_loop_handle); } } } return 0; }
int dpmgr_path_is_busy(disp_path_handle dp_handle) { int i=0; int module_name ; ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; int * modules = ddp_get_scenario_list(handle->scenario); int module_num = ddp_get_module_num(handle->scenario); DISP_LOG_V("path check busy on scenario %s\n",ddp_get_scenario_name(handle->scenario)); for( i=module_num-1; i>=0;i--) { module_name = modules[i]; if(ddp_modules_driver[module_name] != 0) { if(ddp_modules_driver[module_name]->is_busy!= 0) { if(ddp_modules_driver[module_name]->is_busy(module_name)) { DISP_LOG_V("%s is busy\n", ddp_get_module_name(module_name)); return 1; } } } } return 0; }
void ddp_disconnect_path(DDP_SCENARIO_ENUM scenario,void * handle) { DDPDBG("path disconnect on scenario %s\n", ddp_get_scenario_name(scenario)); if(scenario == DDP_SCENARIO_PRIMARY_ALL) { ddp_disconnect_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_DISP], handle); ddp_disconnect_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_OVL_MEMOUT], handle); } else if(scenario == DDP_SCENARIO_SUB_ALL) { ddp_disconnect_path_l(module_list_scenario[DDP_SCENARIO_SUB_DISP], handle); ddp_disconnect_path_l(module_list_scenario[DDP_SCENARIO_SUB_OVL_MEMOUT], handle); } else if(scenario == DDP_SCENARIO_RDMA0_DUAL_DISP) { ddp_set_dst_module(scenario,DISP_MODULE_DSI0); ddp_disconnect_path_l(module_list_scenario[scenario], handle); ddp_set_dst_module(scenario,DISP_MODULE_DSI1); ddp_disconnect_path_l(module_list_scenario[scenario], handle); ddp_set_dst_module(scenario,DISP_MODULE_DSIDUAL); } else { ddp_disconnect_path_l(module_list_scenario[scenario], handle); } return ; }
int dpmgr_path_flush(disp_path_handle dp_handle,int encmdq) { ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; cmdqRecHandle cmdqHandle = encmdq ? handle->cmdqhandle : NULL; DISP_LOG_I("path flush on scenario %s\n",ddp_get_scenario_name(handle->scenario)); return ddp_mutex_enable(handle->hwmutexid,handle->scenario,cmdqHandle); }
int dpmgr_path_init(disp_path_handle dp_handle, int encmdq) { int i=0; int module_name ; ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; int * modules = ddp_get_scenario_list(handle->scenario); int module_num = ddp_get_module_num(handle->scenario); cmdqRecHandle cmdqHandle = encmdq ? handle->cmdqhandle : NULL; DISP_LOG_I("path init on scenario %s\n",ddp_get_scenario_name(handle->scenario)); //open top clock path_top_clock_on(); //seting mutex ddp_mutex_set(handle->hwmutexid, handle->scenario, handle->mode, cmdqHandle); if(handle->hwmutexid != 0) { ddp_mutex_Interrupt_enable(handle->hwmutexid, cmdqHandle); } //connect path; ddp_connect_path(handle->scenario,cmdqHandle); // each module init for( i=0; i< module_num;i++) { module_name = modules[i]; if(ddp_modules_driver[module_name] != 0) { if(ddp_modules_driver[module_name]->init!= 0) { DISP_LOG_I("scenario %s init module %s\n",ddp_get_scenario_name(handle->scenario), ddp_get_module_name(module_name)); ddp_modules_driver[module_name]->init(module_name, cmdqHandle); } if(ddp_modules_driver[module_name]->set_listener!= 0) { ddp_modules_driver[module_name]->set_listener(module_name,dpmgr_module_notify); } } } //after init this path will power on; handle->power_sate = 1; return 0; }
int dpmgr_path_set_dst_module(disp_path_handle dp_handle,DISP_MODULE_ENUM dst_module) { ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; ASSERT((handle->scenario >= 0 && handle->scenario < DDP_SCENARIO_MAX)); DISP_LOG_I("set dst module on scenario %s, module %s\n", ddp_get_scenario_name(handle->scenario),ddp_get_module_name(dst_module)); return ddp_set_dst_module(handle->scenario, dst_module); }
int dpmgr_path_set_video_mode(disp_path_handle dp_handle, int is_vdo_mode) { ddp_path_handle handle = NULL; ASSERT(dp_handle != NULL); handle = (ddp_path_handle)dp_handle; handle->mode = is_vdo_mode ? DDP_VIDEO_MODE : DDP_CMD_MODE; DISP_LOG_I("set scenario %s mode: %s\n",ddp_get_scenario_name(handle->scenario), is_vdo_mode ? "Video_Mode":"Cmd_Mode"); return 0; }
int dpmgr_disable_event(disp_path_handle dp_handle, DISP_PATH_EVENT event) { ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; DISP_LOG_I("disable event %s on scenario %s \n",path_event_name(event),ddp_get_scenario_name(handle->scenario)); DPMGR_WQ_HANDLE *wq_handle = &handle->wq_list[event]; wq_handle->init = 0; wq_handle->data= 0; return 0; }
static void ddp_print_scenario(DDP_SCENARIO_ENUM scenario) { int i =0; char path[512]={'\0'}; int num = ddp_get_module_num(scenario); for(i=0; i< num; i++) { strcat(path,ddp_get_module_name(module_list_scenario[scenario][i])); } DDPMSG("scenario %s have modules: %s\n",ddp_get_scenario_name(scenario),path); }
int dpmgr_path_disconnect(disp_path_handle dp_handle, int encmdq) { ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; cmdqRecHandle cmdqHandle = encmdq ? handle->cmdqhandle : NULL; DISP_LOG_I("dpmgr_path_disconnect on scenario %s\n",ddp_get_scenario_name(handle->scenario)); ddp_mutex_clear(handle->hwmutexid,cmdqHandle); ddp_mutex_Interrupt_disable(handle->hwmutexid,cmdqHandle); ddp_disconnect_path(handle->scenario, cmdqHandle); return 0; }
DISP_MODULE_ENUM ddp_get_dst_module(DDP_SCENARIO_ENUM ddp_scenario) { DISP_MODULE_ENUM module_name = DISP_MODULE_UNKNOWN; int module_num = ddp_get_module_num_l(module_list_scenario[ddp_scenario])-1; if(module_num >=0 ) module_name = module_list_scenario[ddp_scenario][module_num]; DDPMSG("ddp_get_dst_module, scneario=%s, dst_module=%s\n", ddp_get_scenario_name(ddp_scenario), ddp_get_module_name(module_name)); return module_name; }
int dpmgr_signal_event(disp_path_handle dp_handle, DISP_PATH_EVENT event) { ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; DPMGR_WQ_HANDLE *wq_handle = &handle->wq_list[event]; if(handle->wq_list[event].init) { wq_handle->data = sched_clock(); DISP_LOG_V("wake up evnet %s on scenario %s\n", path_event_name(event),ddp_get_scenario_name(handle->scenario)); wake_up_interruptible(&(handle->wq_list[event].wq)); } return 0; }
static int ddp_find_module_index(DDP_SCENARIO_ENUM ddp_scenario, DISP_MODULE_ENUM module) { int i=0; for(i=0; i< DDP_ENING_NUM; i++) { if(module_list_scenario[ddp_scenario][i] == module) { return i; } } DDPDBG("find module: can not find module %s on scenario %s\n",ddp_get_module_name(module), ddp_get_scenario_name(ddp_scenario)); return -1; }
int dpmgr_path_connect(disp_path_handle dp_handle, int encmdq) { ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; cmdqRecHandle cmdqHandle = encmdq ? handle->cmdqhandle : NULL; DISP_LOG_I("dpmgr_path_connect on scenario %s\n",ddp_get_scenario_name(handle->scenario)); ddp_connect_path(handle->scenario,cmdqHandle); ddp_mutex_set(handle->hwmutexid, handle->scenario, handle->mode, cmdqHandle); if(handle->hwmutexid != 0) { ddp_mutex_Interrupt_enable(handle->hwmutexid,cmdqHandle); } return 0; }
int dpmgr_enable_event(disp_path_handle dp_handle, DISP_PATH_EVENT event) { ASSERT(dp_handle != NULL); ddp_path_handle handle = (ddp_path_handle)dp_handle; DPMGR_WQ_HANDLE *wq_handle = &handle->wq_list[event]; DISP_LOG_I("enable event %s on scenario %s, irtbit 0x%x\n", path_event_name(event), ddp_get_scenario_name(handle->scenario), handle->irq_event_map[event].irq_bit); if(!wq_handle->init) { init_waitqueue_head(&(wq_handle->wq)); wq_handle->init = 1; wq_handle->data= 0; wq_handle->event = event; } return 0; }
void ddp_connect_path(DDP_SCENARIO_ENUM scenario, void * handle) { DDPDBG("path connect on scenario %s\n", ddp_get_scenario_name(scenario)); if(scenario == DDP_SCENARIO_PRIMARY_ALL) { ddp_connect_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_DISP], handle); ddp_connect_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_OVL_MEMOUT],handle); } else if(scenario == DDP_SCENARIO_SUB_ALL) { ddp_connect_path_l(module_list_scenario[DDP_SCENARIO_SUB_DISP], handle); ddp_connect_path_l(module_list_scenario[DDP_SCENARIO_SUB_OVL_MEMOUT], handle); } else { ddp_connect_path_l(module_list_scenario[scenario], handle); } return ; }
void ddp_check_path(DDP_SCENARIO_ENUM scenario) { DDPDBG("path check path on scenario %s\n", ddp_get_scenario_name(scenario)); if(scenario == DDP_SCENARIO_PRIMARY_ALL) { ddp_check_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_DISP]); ddp_check_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_OVL_MEMOUT]); } else if(scenario == DDP_SCENARIO_SUB_ALL) { ddp_check_path_l(module_list_scenario[DDP_SCENARIO_SUB_DISP]); ddp_check_path_l(module_list_scenario[DDP_SCENARIO_SUB_OVL_MEMOUT]); } else { ddp_check_path_l(module_list_scenario[scenario]); } return ; }
// set display interface when kernel init int ddp_set_dst_module(DDP_SCENARIO_ENUM scenario, DISP_MODULE_ENUM dst_module) { int i = 0; DDPMSG("ddp_set_dst_module, scenario=%s, dst_module=%s \n", ddp_get_scenario_name(scenario), ddp_get_module_name(dst_module)); if (ddp_find_module_index(scenario,dst_module) > 0) { DDPDBG("%s is already on path\n",ddp_get_module_name(dst_module)); return 0; } i = ddp_get_module_num_l(module_list_scenario[scenario])-1; ASSERT(i>=0); if (dst_module == DISP_MODULE_DSIDUAL) { if (i < (DDP_ENING_NUM -1)) { module_list_scenario[scenario][i++] = DISP_MODULE_SPLIT1; }else{ DDPERR("set dst module over up bound\n"); return -1; } } else { if(ddp_get_dst_module(scenario)==DISP_MODULE_DSIDUAL) { if (i >= 1) { module_list_scenario[scenario][i--] = -1; }else{ DDPERR("set dst module over low bound\n"); return -1; } } } module_list_scenario[scenario][i] = dst_module; if (scenario == DDP_SCENARIO_PRIMARY_ALL) { ddp_set_dst_module(DDP_SCENARIO_PRIMARY_DISP,dst_module); }else if(scenario==DDP_SCENARIO_SUB_ALL) { ddp_set_dst_module(DDP_SCENARIO_SUB_DISP,dst_module); } ddp_print_scenario(scenario); return 0; }
static int acquire_mutex(DDP_SCENARIO_ENUM scenario) { ///: primay use mutex 0 int mutex_id =0 ; DDP_MANAGER_CONTEXT * content = _get_context(); int mutex_idx_free = content->mutex_idx; ASSERT(scenario >= 0 && scenario < DDP_SCENARIO_MAX); while(mutex_idx_free) { if(mutex_idx_free & 0x1) { content->mutex_idx &= (~(0x1<<mutex_id)); mutex_id += DISP_MUTEX_DDP_FIRST; break; } mutex_idx_free>>=1; ++mutex_id; } ASSERT(mutex_id < (DISP_MUTEX_DDP_FIRST+DISP_MUTEX_DDP_COUNT)); DISP_LOG_I("scenario %s acquire mutex %d , left mutex 0x%x!\n", ddp_get_scenario_name(scenario), mutex_id, content->mutex_idx); return mutex_id; }