open流程一主要是沿着open的主线一直到sensor open,着一些主要是看看 camera_init_internal 中的其他初始化流程
cmr_int camera_init_internal(cmr_handle oem_handle, cmr_uint is_autotest) {
···
//sensor初始化
ret = camera_sensor_init(oem_handle, is_autotest);
//grab初始化
ret = camera_grab_init(oem_handle);
//res初始化
ret = camera_res_init(oem_handle);
//isp初始化
ret = camera_isp_init(oem_handle);
//初始化完成
ret = camera_res_init_done(oem_handle);
//前置摄像头,lcd屏幕可以作为补光灯
camera_front_lcd_enhance_module_init(oem_handle);
···
return ret;
}
书接上篇我们分析了camera_sensor_init这个函数,下面我们对其他的初始化流程分析。
1、camera_grab_init
这个主要时图形数据的传输
idh.code\vendor\sprd\modules\libcamera\oem2v6\src\cmr_oem.c
cmr_int camera_grab_init(cmr_handle oem_handle) {
struct phySensorInfo *phyPtr = NULL;
cmr_int ret = CMR_CAMERA_SUCCESS;
struct camera_context *cxt = (struct camera_context *)oem_handle;
struct grab_context *grab_cxt = NULL;
struct sensor_context *sn_cxt = NULL;
cmr_handle grab_handle = NULL;
struct grab_init_param grab_param;
struct sensor_exp_info sensor_info;
cmr_bzero(&sensor_info, sizeof(struct sensor_exp_info));
grab_cxt = &cxt->grab_cxt;
sn_cxt = &(cxt->sn_cxt);
ret = cmr_sensor_get_info(sn_cxt->sensor_handle, cxt->camera_id,
&(sn_cxt->sensor_info));
phyPtr = sensorGetPhysicalSnsInfo(cxt->camera_id);
if (0 == grab_cxt->inited) {
grab_param.oem_handle = oem_handle;
grab_param.sensor_id = phyPtr->slotId;
ret = cmr_grab_init(&grab_param, &grab_handle);
if (ret) {
CMR_LOGE("failed to init grab %ld", ret);
ret = -CMR_CAMERA_NO_SUPPORT;
goto exit;
}
cmr_grab_evt_reg(grab_handle, camera_grab_evt_cb);
//p_grab->grab_evt_cb = grab_event_cb;
cmr_grab_stream_cb(grab_handle, camera_sensor_streamctrl);
//p_grab->stream_on_cb = str_on(camera_sensor_streamctrl)
/*only raw sensor should init isp*/
if (CAM_IMG_FMT_BAYER_MIPI_RAW == sn_cxt->sensor_info.image_format) {
cmr_grab_isp_statis_evt_reg(grab_handle, isp_statis_evt_cb);
//p_grab->isp_statis_evt_cb = isp_statis_event_cb;
cmr_grab_isp_irq_proc_evt_reg(grab_handle, isp_irq_proc_evt_cb);
//p_grab->isp_irq_proc_evt_cb = isp_i