From f9f40910bb84f5043139318155528b3a9a4297b1 Mon Sep 17 00:00:00 2001 From: lxowalle Date: Mon, 6 Jan 2025 16:13:18 +0800 Subject: [PATCH] * support gcore_gc02m1 --- .../sophgo-middleware/CMakeLists.txt | 2 ++ .../v2/include/cvi_sns_ctrl.h | 2 +- .../vision/port/maixcam/maix_camera_mmf.cpp | 24 +++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/components/3rd_party/sophgo-middleware/CMakeLists.txt b/components/3rd_party/sophgo-middleware/CMakeLists.txt index c9fb87e5..44eabee1 100644 --- a/components/3rd_party/sophgo-middleware/CMakeLists.txt +++ b/components/3rd_party/sophgo-middleware/CMakeLists.txt @@ -19,6 +19,7 @@ append_srcs_dir(middleware_src_dir ${middleware_src_path}/v2/sample/common ${middleware_src_path}/v2/component/isp/sensor/sg200x/ov_ov2685 ${middleware_src_path}/v2/component/isp/sensor/sg200x/lontium_lt6911 ${middleware_src_path}/v2/component/isp/sensor/sg200x/ov_os04a10 + ${middleware_src_path}/v2/component/isp/sensor/sg200x/gcore_gc02m1 ) list(APPEND ADD_SRCS ${middleware_src_dir}) set_property(SOURCE ${middleware_src_dir} PROPERTY GENERATED 1) @@ -70,4 +71,5 @@ list(APPEND ADD_DEFINITIONS_PRIVATE -DSENSOR_SMS_SC035GS list(APPEND ADD_DEFINITIONS_PRIVATE -DSENSOR_OV_OV2685) list(APPEND ADD_DEFINITIONS_PRIVATE -DSENSOR_LONTIUM_LT6911) list(APPEND ADD_DEFINITIONS_PRIVATE -DSENSOR_OV_OS04A10) +list(APPEND ADD_DEFINITIONS_PRIVATE -DSENSOR_GCORE_GC02M1) register_component(DYNAMIC) \ No newline at end of file diff --git a/components/3rd_party/sophgo-middleware/sophgo-middleware/v2/include/cvi_sns_ctrl.h b/components/3rd_party/sophgo-middleware/sophgo-middleware/v2/include/cvi_sns_ctrl.h index 6cd3a807..a9585f4b 100644 --- a/components/3rd_party/sophgo-middleware/sophgo-middleware/v2/include/cvi_sns_ctrl.h +++ b/components/3rd_party/sophgo-middleware/sophgo-middleware/v2/include/cvi_sns_ctrl.h @@ -118,7 +118,7 @@ typedef struct _ISP_SNS_OBJ_S { extern ISP_SNS_OBJ_S stSnsBG0808_Obj; extern ISP_SNS_OBJ_S stSnsBF2253L_Obj; extern ISP_SNS_OBJ_S stSnsCV4001_Obj; -extern ISP_SNS_OBJ_S stSnsGc02m1b_Obj; +extern ISP_SNS_OBJ_S stSnsGc02m1_Obj; extern ISP_SNS_OBJ_S stSnsGc0312_Obj; extern ISP_SNS_OBJ_S stSnsGc0329_Obj; extern ISP_SNS_OBJ_S stSnsGc1054_Obj; diff --git a/components/vision/port/maixcam/maix_camera_mmf.cpp b/components/vision/port/maixcam/maix_camera_mmf.cpp index 059843ed..c60d098e 100644 --- a/components/vision/port/maixcam/maix_camera_mmf.cpp +++ b/components/vision/port/maixcam/maix_camera_mmf.cpp @@ -324,6 +324,10 @@ namespace maix::camera // log::info("find ov_os04a10, addr %#x", addr_list[i]); snprintf(name, sizeof(name), "ov_os04a10"); return {true, name}; + case 0x37: + // log::info("find ov_os04a10, addr %#x", addr_list[i]); + snprintf(name, sizeof(name), "gcore_gc02m1"); + return {true, name}; case 0x48:// fall through case 0x3c: // log::info("find ov_ov2685, addr %#x", addr_list[i]); @@ -516,6 +520,16 @@ namespace maix::camera vi_format = PIXEL_FORMAT_NV21; vi_vpss_format = PIXEL_FORMAT_NV21; err::check_bool_raise(!CVI_BIN_SetBinName(WDR_MODE_NONE, "/mnt/cfg/param/cvi_sdr_bin.os04a10"), "set config path failed!"); + } else if (!strcmp(sensor_name, "gcore_gc02m1")) { + sensor_cfg.sns_type = GCORE_GC02M1_MIPI_2M_30FPS_10BIT; + sensor_cfg.lane_id = {0, 1, -1, -1, -1}; + sensor_cfg.pn_swap = {1, 1, 0, 0, 0}; + sensor_cfg.mclk_en = 1; + sensor_cfg.i2c_addr = 0x37; + sensor_cfg.exptime_max = 363636; + sensor_cfg.exptime_min = 33333; + vi_format = PIXEL_FORMAT_NV21; + vi_vpss_format = PIXEL_FORMAT_NV21; } else { // default is gcore_gc4653 if (width <= 1280 && height <= 720 && fps > 30) { sensor_cfg.sns_type = GCORE_GC4653_MIPI_720P_60FPS_10BIT; @@ -575,6 +589,16 @@ namespace maix::camera vi_format = PIXEL_FORMAT_NV21; vi_vpss_format = PIXEL_FORMAT_NV21; err::check_bool_raise(!CVI_BIN_SetBinName(WDR_MODE_NONE, "/mnt/cfg/param/cvi_sdr_bin.os04a10"), "set config path failed!"); + } else if (!strcmp(sensor_name, "gcore_gc02m1")) { + sensor_cfg.sns_type = GCORE_GC02M1_MIPI_2M_30FPS_10BIT; + sensor_cfg.lane_id = {4, 3, -1, -1, -1}; + sensor_cfg.pn_swap = {0, 0, 0, 0, 0}; + sensor_cfg.mclk_en = 1; + sensor_cfg.i2c_addr = 0x37; + sensor_cfg.exptime_max = 363636; + sensor_cfg.exptime_min = 33333; + vi_format = PIXEL_FORMAT_NV21; + vi_vpss_format = PIXEL_FORMAT_NV21; } else { // default is gcore_gc4653 if (width <= 1280 && height <= 720 && fps > 30) { sensor_cfg.sns_type = GCORE_GC4653_MIPI_720P_60FPS_10BIT;