diff --git a/.github/workflows/sync_issues.yml b/.github/workflows/sync_issues.yml new file mode 100644 index 00000000..dcf637fc --- /dev/null +++ b/.github/workflows/sync_issues.yml @@ -0,0 +1,24 @@ +name: Automate Issue Management + +on: + issues: + types: + - opened + - edited + - assigned + - unassigned + - labeled + - unlabeled + - reopened + +jobs: + add_issue_to_project: + runs-on: ubuntu-latest + steps: + - name: Add issue to GitHub Project + uses: actions/add-to-project@v1.0.2 + with: + project-url: https://github.com/orgs/Seeed-Studio/projects/17 + github-token: ${{ secrets.ISSUE_ASSEMBLE }} + labeled: bug + label-operator: NOT \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 05fb4b80..ee40532a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ +## 0.0.6 (2024-10-12) + +### sg2002_recamera_emmc + +- New features: + - sensor auto detection (ov5647/sc530ai) + - supports restore to factory + - get mac & sn from efuse + - add sscma-node program + - supervisor + - support https service + - add service status detection + - add a feature for file management + - add wifi password verification operation + +- Fix bugs: + - solve some compilation issues + - solve some supervisor bugs + ## 0.0.5 (2024-09-25) ### sg2002_recamera_emmc diff --git a/README.md b/README.md index e2ab4066..f5a3c2f9 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ - Install dependencies ```bash - sudo apt-get update - sudo apt-get install libbz2-dev - sudo apt-get install -y build-essential ninja-build automake autoconf libtool wget curl git gcc \ + sudo apt update + sudo apt install -y libbz2-dev build-essential ninja-build automake autoconf libtool wget curl git gcc \ libssl-dev bc slib squashfs-tools android-sdk-libsparse-utils android-sdk-ext4-utils jq \ - cmake python3-distutils tclsh scons parallel ssh-client tree python3-dev python3-pip \ - device-tree-compiler libssl-dev ssh cpio squashfs-tools fakeroot libncurses5 flex bison mtools + python3-distutils tclsh scons parallel ssh-client tree python3-dev python3-pip \ + device-tree-compiler libssl-dev ssh cpio squashfs-tools fakeroot libncurses5 flex bison mtools python-is-python3 + pip install cmake jinja2 ``` Note: The minimum required cmake version is 3.16.5 @@ -36,7 +36,8 @@ ```bash git clone https://github.com/Seeed-Studio/reCamera.git -b sg200x-reCamera cd reCamera - git submodule update --init --recursive + git submodule init + git submodule update --depth 1 ``` - Update Submodules (optional) diff --git a/external/SensorSupportList/sensor.mk b/external/SensorSupportList/sensor.mk new file mode 100644 index 00000000..92c4ea3d --- /dev/null +++ b/external/SensorSupportList/sensor.mk @@ -0,0 +1,106 @@ +ifeq ($(CHIP_ARCH), $(filter $(CHIP_ARCH), CV180X CV181X SG200X)) +sensor-$(CONFIG_SENSOR_BRIGATES_BG0808) += brigates_bg0808 +sensor-$(CONFIG_SENSOR_CHIPUP_XS9922B) += chipup_xs9922b +sensor-$(CONFIG_SENSOR_CVSENS_CV2003) += cvsens_cv2003 +sensor-$(CONFIG_SENSOR_CVSENS_CV2003_1L) += cvsens_cv2003_1L +sensor-$(CONFIG_SENSOR_CVSENS_CV2003_1L_SLAVE) += cvsens_cv2003_1L_slave +sensor-$(CONFIG_SENSOR_CVSENS_CV2003_1L_SLAVE1) += cvsens_cv2003_1L_slave1 +sensor-$(CONFIG_SENSOR_CVSENS_CV4001) += cvsens_cv4001 +sensor-$(CONFIG_SENSOR_BYD_BF2253L) += byd_bf2253l +sensor-$(CONFIG_SENSOR_GCORE_GC02M1) += gcore_gc02m1 +sensor-$(CONFIG_SENSOR_GCORE_GC0312) += gcore_gc0312 +sensor-$(CONFIG_SENSOR_GCORE_GC0329) += gcore_gc0329 +sensor-$(CONFIG_SENSOR_GCORE_GC1054) += gcore_gc1054 +sensor-$(CONFIG_SENSOR_GCORE_GC1084) += gcore_gc1084 +sensor-$(CONFIG_SENSOR_GCORE_GC1084_SLAVE) += gcore_gc1084_slave +sensor-$(CONFIG_SENSOR_GCORE_GC1084_SLAVE1) += gcore_gc1084_slave1 +sensor-$(CONFIG_SENSOR_GCORE_GC1084_SLAVE2) += gcore_gc1084_slave2 +sensor-$(CONFIG_SENSOR_GCORE_GC2053) += gcore_gc2053 +sensor-$(CONFIG_SENSOR_GCORE_GC2053_SLAVE) += gcore_gc2053_slave +sensor-$(CONFIG_SENSOR_GCORE_GC2053_1L) += gcore_gc2053_1L +sensor-$(CONFIG_SENSOR_GCORE_GC2083) += gcore_gc2083 +sensor-$(CONFIG_SENSOR_GCORE_GC2093) += gcore_gc2093 +sensor-$(CONFIG_SENSOR_GCORE_GC2145) += gcore_gc2145 +sensor-$(CONFIG_SENSOR_GCORE_GC2385_1L) += gcore_gc2385_1L +sensor-$(CONFIG_SENSOR_GCORE_GC4023) += gcore_gc4023 +sensor-$(CONFIG_SENSOR_GCORE_GC4653) += gcore_gc4653 +sensor-$(CONFIG_SENSOR_GCORE_GC4653_SLAVE) += gcore_gc4653_slave +sensor-$(CONFIG_SENSOR_IMGDS_MIS2008) += imgds_mis2008 +sensor-$(CONFIG_SENSOR_IMGDS_MIS2008_1L) += imgds_mis2008_1L +sensor-$(CONFIG_SENSOR_NEXTCHIP_N5) += nextchip_n5 +sensor-$(CONFIG_SENSOR_NEXTCHIP_N6) += nextchip_n6 +sensor-$(CONFIG_SENSOR_OV_OS02N10_1L) += ov_os02n10_1L +sensor-$(CONFIG_SENSOR_OV_OS04A10) += ov_os04a10 +sensor-$(CONFIG_SENSOR_OV_OS04C10) += ov_os04c10 +sensor-$(CONFIG_SENSOR_OV_OS08A20) += ov_os08a20 +sensor-$(CONFIG_SENSOR_OV_OV4689) += ov_ov4689 +sensor-$(CONFIG_SENSOR_OV_OV5647) += ov_ov5647 +sensor-$(CONFIG_SENSOR_OV_OV6211) += ov_ov6211 +sensor-$(CONFIG_SENSOR_OV_OV7251) += ov_ov7251 +sensor-$(CONFIG_SENSOR_PIXELPLUS_PR2000) += pixelplus_pr2000 +sensor-$(CONFIG_SENSOR_PIXELPLUS_PR2020) += pixelplus_pr2020 +sensor-$(CONFIG_SENSOR_PIXELPLUS_PR2100) += pixelplus_pr2100 +sensor-$(CONFIG_SENSOR_SMS_SC035GS) += sms_sc035gs +sensor-$(CONFIG_SENSOR_SMS_SC035GS_1L) += sms_sc035gs_1L +sensor-$(CONFIG_SENSOR_SMS_SC035HGS) += sms_sc035hgs +sensor-$(CONFIG_SENSOR_SMS_SC035HGS_1L) += sms_sc035hgs_1L +sensor-$(CONFIG_SENSOR_SMS_SC132GS) += sms_sc132gs +sensor-$(CONFIG_SENSOR_SMS_SC132GS_SLAVE) += sms_sc132gs_slave +sensor-$(CONFIG_SENSOR_SMS_SC1336_1L) += sms_sc1336_1L +sensor-$(CONFIG_SENSOR_SMS_SC1346_1L) += sms_sc1346_1L +sensor-$(CONFIG_SENSOR_SMS_SC1346_1L_SLAVE) += sms_sc1346_1L_slave +sensor-$(CONFIG_SENSOR_SMS_SC200AI) += sms_sc200ai +sensor-$(CONFIG_SENSOR_SMS_SC200AI_1L) += sms_sc200ai_1L +sensor-$(CONFIG_SENSOR_SMS_SC230AI_2L) += sms_sc230ai_2L +sensor-$(CONFIG_SENSOR_SMS_SC230AI_2L_SLAVE) += sms_sc230ai_2L_slave +sensor-$(CONFIG_SENSOR_SMS_SC301IOT) += sms_sc301iot +sensor-$(CONFIG_SENSOR_SMS_SC401AI) += sms_sc401ai +sensor-$(CONFIG_SENSOR_SMS_SC500AI) += sms_sc500ai +sensor-$(CONFIG_SENSOR_SMS_SC501AI_2L) += sms_sc501ai_2L +sensor-$(CONFIG_SENSOR_SMS_SC530AI_2L) += sms_sc530ai_2L +sensor-$(CONFIG_SENSOR_SMS_SC531AI_2L) += sms_sc531ai_2L +sensor-$(CONFIG_SENSOR_SMS_SC3332) += sms_sc3332 +sensor-$(CONFIG_SENSOR_SMS_SC3335) += sms_sc3335 +sensor-$(CONFIG_SENSOR_SMS_SC3336) += sms_sc3336 +sensor-$(CONFIG_SENSOR_SMS_SC3336_1L) += sms_sc3336_1L +sensor-$(CONFIG_SENSOR_SMS_SC3336P) += sms_sc3336p +sensor-$(CONFIG_SENSOR_SMS_SC2331_1L) += sms_sc2331_1L +sensor-$(CONFIG_SENSOR_SMS_SC2331_1L_SLAVE) += sms_sc2331_1L_slave +sensor-$(CONFIG_SENSOR_SMS_SC2331_1L_SLAVE1) += sms_sc2331_1L_slave1 +sensor-$(CONFIG_SENSOR_SMS_SC2335) += sms_sc2335 +sensor-$(CONFIG_SENSOR_SMS_SC2336) += sms_sc2336 +sensor-$(CONFIG_SENSOR_SMS_SC2336_SLAVE) += sms_sc2336_slave +sensor-$(CONFIG_SENSOR_SMS_SC2336_SLAVE1) += sms_sc2336_slave1 +sensor-$(CONFIG_SENSOR_SMS_SC2336_1L) += sms_sc2336_1L +sensor-$(CONFIG_SENSOR_SMS_SC2336P) += sms_sc2336p +sensor-$(CONFIG_SENSOR_SMS_SC2336P_1L) += sms_sc2336p_1L +sensor-$(CONFIG_SENSOR_SMS_SC223A_1L) += sms_sc223a_1L +sensor-$(CONFIG_SENSOR_SMS_SC4336) += sms_sc4336 +sensor-$(CONFIG_SENSOR_SMS_SC4336P) += sms_sc4336p +sensor-$(CONFIG_SENSOR_SMS_SC5336_2L) += sms_sc5336_2L +sensor-$(CONFIG_SENSOR_SOI_F23) += soi_f23 +sensor-$(CONFIG_SENSOR_SOI_F35) += soi_f35 +sensor-$(CONFIG_SENSOR_SOI_F37P) += soi_f37p +sensor-$(CONFIG_SENSOR_SOI_Q03) += soi_q03 +sensor-$(CONFIG_SENSOR_SOI_Q03P) += soi_q03p +sensor-$(CONFIG_SENSOR_SOI_K06) += soi_k06 +sensor-$(CONFIG_SENSOR_SOI_F53) += soi_f53 +sensor-$(CONFIG_SENSOR_SOI_F352) += soi_f352 +sensor-$(CONFIG_SENSOR_SOI_K306) += soi_k306 +sensor-$(CONFIG_SENSOR_SONY_IMX307) += sony_imx307 +sensor-$(CONFIG_SENSOR_SONY_IMX307_SLAVE) += sony_imx307_slave +sensor-$(CONFIG_SENSOR_SONY_IMX307_2L) += sony_imx307_2L +sensor-$(CONFIG_SENSOR_SONY_IMX327) += sony_imx327 +sensor-$(CONFIG_SENSOR_SONY_IMX327_SLAVE) += sony_imx327_slave +sensor-$(CONFIG_SENSOR_SONY_IMX327_2L) += sony_imx327_2L +sensor-$(CONFIG_SENSOR_SONY_IMX327_FPGA) += sony_imx327_fpga +sensor-$(CONFIG_SENSOR_SONY_IMX327_SUBLVDS) += sony_imx327_sublvds +sensor-$(CONFIG_SENSOR_SONY_IMX335) += sony_imx335 +sensor-$(CONFIG_SENSOR_SONY_IMX675) += sony_imx675 +sensor-$(CONFIG_SENSOR_TECHPOINT_TP2825) += techpoint_tp2825 +sensor-$(CONFIG_SENSOR_TECHPOINT_TP2863) += techpoint_tp2863 +sensor-$(CONFIG_SENSOR_LONTIUM_LT6911) += lontium_lt6911 +sensor-$(CONFIG_SENSOR_LONTIUM_LT7911) += lontium_lt7911 +else +$(error not supported chip arch cv180x/cv181x) +endif diff --git a/external/SensorSupportList/sensor.mk.orig b/external/SensorSupportList/sensor.mk.orig new file mode 100644 index 00000000..a2ebed3a --- /dev/null +++ b/external/SensorSupportList/sensor.mk.orig @@ -0,0 +1,155 @@ +ifeq ($(CHIP_ARCH),CV183X) +sensor-$(CONFIG_SENSOR_GCORE_GC2053) += gcore_gc2053 +sensor-$(CONFIG_SENSOR_GCORE_GC2053_SLAVE) += gcore_gc2053_slave +sensor-$(CONFIG_SENSOR_GCORE_GC2053_1L) += gcore_gc2053_1L +sensor-$(CONFIG_SENSOR_GCORE_GC2093) += gcore_gc2093 +sensor-$(CONFIG_SENSOR_GCORE_GC2093_SLAVE) += gcore_gc2093_slave +sensor-$(CONFIG_SENSOR_GCORE_GC4653) += gcore_gc4653 +sensor-$(CONFIG_SENSOR_GCORE_GC4653_SLAVE) += gcore_gc4653_slave +sensor-$(CONFIG_SENSOR_NEXTCHIP_N5) += nextchip_n5 +sensor-$(CONFIG_SENSOR_OV_OS02D10) += ov_os02d10 +sensor-$(CONFIG_SENSOR_OV_OS02D10_SLAVE) += ov_os02d10_slave +sensor-$(CONFIG_SENSOR_OV_OS02K10_SLAVE) += ov_os02k10_slave +sensor-$(CONFIG_SENSOR_OV_OS04C10) += ov_os04c10 +sensor-$(CONFIG_SENSOR_OV_OS04C10_SLAVE) += ov_os04c10_slave +sensor-$(CONFIG_SENSOR_OV_OS08A20) += ov_os08a20 +sensor-$(CONFIG_SENSOR_OV_OS08A20_SLAVE) += ov_os08a20_slave +sensor-$(CONFIG_SENSOR_PICO_384) += pico_384 +sensor-$(CONFIG_SENSOR_PICO_640) += pico_640 +sensor-$(CONFIG_SENSOR_PIXELPLUS_PR2020) += pixelplus_pr2020 +sensor-$(CONFIG_SENSOR_PIXELPLUS_PR2100) += pixelplus_pr2100 +sensor-$(CONFIG_SENSOR_SMS_SC035HGS) += sms_sc035hgs +sensor-$(CONFIG_SENSOR_SMS_SC200AI) += sms_sc200ai +sensor-$(CONFIG_SENSOR_SMS_SC401AI) += sms_sc401ai +sensor-$(CONFIG_SENSOR_SMS_SC850SL) += sms_sc850sl +sensor-$(CONFIG_SENSOR_SMS_SC3335) += sms_sc3335 +sensor-$(CONFIG_SENSOR_SMS_SC3335_SLAVE) += sms_sc3335_slave +sensor-$(CONFIG_SENSOR_SMS_SC3336) += sms_sc3336 +sensor-$(CONFIG_SENSOR_SMS_SC3336P) += sms_sc3336p +sensor-$(CONFIG_SENSOR_SMS_SC4210) += sms_sc4210 +sensor-$(CONFIG_SENSOR_SMS_SC8238) += sms_sc8238 +sensor-$(CONFIG_SENSOR_SOI_F23) += soi_f23 +sensor-$(CONFIG_SENSOR_SOI_F35) += soi_f35 +sensor-$(CONFIG_SENSOR_SOI_F35_SLAVE) += soi_f35_slave +sensor-$(CONFIG_SENSOR_SOI_H65) += soi_h65 +sensor-$(CONFIG_SENSOR_SONY_IMX290_2L) += sony_imx290_2L +sensor-$(CONFIG_SENSOR_SONY_IMX307) += sony_imx307 +sensor-$(CONFIG_SENSOR_SONY_IMX307_SLAVE) += sony_imx307_slave +sensor-$(CONFIG_SENSOR_SONY_IMX307_2L) += sony_imx307_2L +sensor-$(CONFIG_SENSOR_SONY_IMX307_SUBLVDS) += sony_imx307_sublvds +sensor-$(CONFIG_SENSOR_SONY_IMX327) += sony_imx327 +sensor-$(CONFIG_SENSOR_SONY_IMX327_SLAVE) += sony_imx327_slave +sensor-$(CONFIG_SENSOR_SONY_IMX327_2L) += sony_imx327_2L +sensor-$(CONFIG_SENSOR_SONY_IMX327_SUBLVDS) += sony_imx327_sublvds +sensor-$(CONFIG_SENSOR_SONY_IMX334) += sony_imx334 +sensor-$(CONFIG_SENSOR_SONY_IMX335) += sony_imx335 +sensor-$(CONFIG_SENSOR_SONY_IMX347) += sony_imx347 +sensor-$(CONFIG_SENSOR_SONY_IMX385) += sony_imx385 +sensor-$(CONFIG_SENSOR_TECHPOINT_TP2850) += techpoint_tp2850 +sensor-$(CONFIG_SENSOR_TECHPOINT_TP2825) += techpoint_tp2825 +sensor-$(CONFIG_SENSOR_TECHPOINT_TP2863) += techpoint_tp2863 +sensor-$(CONFIG_SENSOR_VIVO_MCS369) += vivo_mcs369 +sensor-$(CONFIG_SENSOR_VIVO_MCS369Q) += vivo_mcs369q +sensor-$(CONFIG_SENSOR_VIVO_MM308M2) += vivo_mm308m2 +else ifeq ($(CHIP_ARCH), $(filter $(CHIP_ARCH), CV180X CV181X CV182X SG200X)) +sensor-$(CONFIG_SENSOR_BRIGATES_BG0808) += brigates_bg0808 +sensor-$(CONFIG_SENSOR_CHIPUP_XS9922B) += chipup_xs9922b +sensor-$(CONFIG_SENSOR_CVSENS_CV2003) += cvsens_cv2003 +sensor-$(CONFIG_SENSOR_CVSENS_CV2003_1L) += cvsens_cv2003_1L +sensor-$(CONFIG_SENSOR_CVSENS_CV2003_1L_SLAVE) += cvsens_cv2003_1L_slave +sensor-$(CONFIG_SENSOR_CVSENS_CV2003_1L_SLAVE1) += cvsens_cv2003_1L_slave1 +sensor-$(CONFIG_SENSOR_CVSENS_CV4001) += cvsens_cv4001 +sensor-$(CONFIG_SENSOR_BYD_BF2253L) += byd_bf2253l +sensor-$(CONFIG_SENSOR_GCORE_GC02M1) += gcore_gc02m1 +sensor-$(CONFIG_SENSOR_GCORE_GC0312) += gcore_gc0312 +sensor-$(CONFIG_SENSOR_GCORE_GC0329) += gcore_gc0329 +sensor-$(CONFIG_SENSOR_GCORE_GC1054) += gcore_gc1054 +sensor-$(CONFIG_SENSOR_GCORE_GC1084) += gcore_gc1084 +sensor-$(CONFIG_SENSOR_GCORE_GC1084_SLAVE) += gcore_gc1084_slave +sensor-$(CONFIG_SENSOR_GCORE_GC1084_SLAVE1) += gcore_gc1084_slave1 +sensor-$(CONFIG_SENSOR_GCORE_GC1084_SLAVE2) += gcore_gc1084_slave2 +sensor-$(CONFIG_SENSOR_GCORE_GC2053) += gcore_gc2053 +sensor-$(CONFIG_SENSOR_GCORE_GC2053_SLAVE) += gcore_gc2053_slave +sensor-$(CONFIG_SENSOR_GCORE_GC2053_1L) += gcore_gc2053_1L +sensor-$(CONFIG_SENSOR_GCORE_GC2083) += gcore_gc2083 +sensor-$(CONFIG_SENSOR_GCORE_GC2093) += gcore_gc2093 +sensor-$(CONFIG_SENSOR_GCORE_GC2145) += gcore_gc2145 +sensor-$(CONFIG_SENSOR_GCORE_GC2385_1L) += gcore_gc2385_1L +sensor-$(CONFIG_SENSOR_GCORE_GC4023) += gcore_gc4023 +sensor-$(CONFIG_SENSOR_GCORE_GC4653) += gcore_gc4653 +sensor-$(CONFIG_SENSOR_GCORE_GC4653_SLAVE) += gcore_gc4653_slave +sensor-$(CONFIG_SENSOR_IMGDS_MIS2008) += imgds_mis2008 +sensor-$(CONFIG_SENSOR_IMGDS_MIS2008_1L) += imgds_mis2008_1L +sensor-$(CONFIG_SENSOR_NEXTCHIP_N5) += nextchip_n5 +sensor-$(CONFIG_SENSOR_NEXTCHIP_N6) += nextchip_n6 +sensor-$(CONFIG_SENSOR_OV_OS04A10) += ov_os04a10 +sensor-$(CONFIG_SENSOR_OV_OS04C10) += ov_os04c10 +sensor-$(CONFIG_SENSOR_OV_OS08A20) += ov_os08a20 +sensor-$(CONFIG_SENSOR_OV_OV4689) += ov_ov4689 +sensor-$(CONFIG_SENSOR_OV_OV5647) += ov_ov5647 +sensor-$(CONFIG_SENSOR_OV_OV6211) += ov_ov6211 +sensor-$(CONFIG_SENSOR_OV_OV7251) += ov_ov7251 +sensor-$(CONFIG_SENSOR_PIXELPLUS_PR2020) += pixelplus_pr2020 +sensor-$(CONFIG_SENSOR_PIXELPLUS_PR2100) += pixelplus_pr2100 +sensor-$(CONFIG_SENSOR_SMS_SC035GS) += sms_sc035gs +sensor-$(CONFIG_SENSOR_SMS_SC035GS_1L) += sms_sc035gs_1L +sensor-$(CONFIG_SENSOR_SMS_SC035HGS) += sms_sc035hgs +sensor-$(CONFIG_SENSOR_SMS_SC035HGS_1L) += sms_sc035hgs_1L +sensor-$(CONFIG_SENSOR_SMS_SC132GS) += sms_sc132gs +sensor-$(CONFIG_SENSOR_SMS_SC132GS_SLAVE) += sms_sc132gs_slave +sensor-$(CONFIG_SENSOR_SMS_SC1336_1L) += sms_sc1336_1L +sensor-$(CONFIG_SENSOR_SMS_SC1346_1L) += sms_sc1346_1L +sensor-$(CONFIG_SENSOR_SMS_SC1346_1L_SLAVE) += sms_sc1346_1L_slave +sensor-$(CONFIG_SENSOR_SMS_SC200AI) += sms_sc200ai +sensor-$(CONFIG_SENSOR_SMS_SC200AI_1L) += sms_sc200ai_1L +sensor-$(CONFIG_SENSOR_SMS_SC301IOT) += sms_sc301iot +sensor-$(CONFIG_SENSOR_SMS_SC401AI) += sms_sc401ai +sensor-$(CONFIG_SENSOR_SMS_SC500AI) += sms_sc500ai +sensor-$(CONFIG_SENSOR_SMS_SC501AI_2L) += sms_sc501ai_2L +sensor-$(CONFIG_SENSOR_SMS_SC530AI_2L) += sms_sc530ai_2L +sensor-$(CONFIG_SENSOR_SMS_SC531AI_2L) += sms_sc531ai_2L +sensor-$(CONFIG_SENSOR_SMS_SC3332) += sms_sc3332 +sensor-$(CONFIG_SENSOR_SMS_SC3335) += sms_sc3335 +sensor-$(CONFIG_SENSOR_SMS_SC3336) += sms_sc3336 +sensor-$(CONFIG_SENSOR_SMS_SC3336_1L) += sms_sc3336_1L +sensor-$(CONFIG_SENSOR_SMS_SC3336P) += sms_sc3336p +sensor-$(CONFIG_SENSOR_SMS_SC2331_1L) += sms_sc2331_1L +sensor-$(CONFIG_SENSOR_SMS_SC2331_1L_SLAVE) += sms_sc2331_1L_slave +sensor-$(CONFIG_SENSOR_SMS_SC2331_1L_SLAVE1) += sms_sc2331_1L_slave1 +sensor-$(CONFIG_SENSOR_SMS_SC2335) += sms_sc2335 +sensor-$(CONFIG_SENSOR_SMS_SC2336) += sms_sc2336 +sensor-$(CONFIG_SENSOR_SMS_SC2336_SLAVE) += sms_sc2336_slave +sensor-$(CONFIG_SENSOR_SMS_SC2336_SLAVE1) += sms_sc2336_slave1 +sensor-$(CONFIG_SENSOR_SMS_SC2336_1L) += sms_sc2336_1L +sensor-$(CONFIG_SENSOR_SMS_SC2336P) += sms_sc2336p +sensor-$(CONFIG_SENSOR_SMS_SC2336P_1L) += sms_sc2336p_1L +sensor-$(CONFIG_SENSOR_SMS_SC223A_1L) += sms_sc223a_1L +sensor-$(CONFIG_SENSOR_SMS_SC4336) += sms_sc4336 +sensor-$(CONFIG_SENSOR_SMS_SC4336P) += sms_sc4336p +sensor-$(CONFIG_SENSOR_SMS_SC5336_2L) += sms_sc5336_2L +sensor-$(CONFIG_SENSOR_SOI_F23) += soi_f23 +sensor-$(CONFIG_SENSOR_SOI_F35) += soi_f35 +sensor-$(CONFIG_SENSOR_SOI_F37P) += soi_f37p +sensor-$(CONFIG_SENSOR_SOI_Q03) += soi_q03 +sensor-$(CONFIG_SENSOR_SOI_Q03P) += soi_q03p +sensor-$(CONFIG_SENSOR_SOI_K06) += soi_k06 +sensor-$(CONFIG_SENSOR_SOI_F53) += soi_f53 +sensor-$(CONFIG_SENSOR_SOI_F352) += soi_f352 +sensor-$(CONFIG_SENSOR_SOI_K306) += soi_k306 +sensor-$(CONFIG_SENSOR_SONY_IMX307) += sony_imx307 +sensor-$(CONFIG_SENSOR_SONY_IMX307_SLAVE) += sony_imx307_slave +sensor-$(CONFIG_SENSOR_SONY_IMX307_2L) += sony_imx307_2L +sensor-$(CONFIG_SENSOR_SONY_IMX327) += sony_imx327 +sensor-$(CONFIG_SENSOR_SONY_IMX327_SLAVE) += sony_imx327_slave +sensor-$(CONFIG_SENSOR_SONY_IMX327_2L) += sony_imx327_2L +sensor-$(CONFIG_SENSOR_SONY_IMX327_FPGA) += sony_imx327_fpga +sensor-$(CONFIG_SENSOR_SONY_IMX327_SUBLVDS) += sony_imx327_sublvds +sensor-$(CONFIG_SENSOR_SONY_IMX335) += sony_imx335 +sensor-$(CONFIG_SENSOR_SONY_IMX675) += sony_imx675 +sensor-$(CONFIG_SENSOR_TECHPOINT_TP2825) += techpoint_tp2825 +sensor-$(CONFIG_SENSOR_TECHPOINT_TP2863) += techpoint_tp2863 +sensor-$(CONFIG_SENSOR_LONTIUM_LT6911) += lontium_lt6911 +sensor-$(CONFIG_SENSOR_LONTIUM_LT7911) += lontium_lt7911 +else +$(error not supported chip arch cv180x/cv181x/cv182x/cv183x) +endif diff --git a/external/SensorSupportList/sensor/cv182x/Makefile b/external/SensorSupportList/sensor/cv182x/Makefile new file mode 100644 index 00000000..a33dd7a0 --- /dev/null +++ b/external/SensorSupportList/sensor/cv182x/Makefile @@ -0,0 +1,340 @@ +SHELL = /bin/bash + +ifeq ($(PARAM_FILE), ) +PARAM_FILE=../../../../Makefile.param +include $(PARAM_FILE) +endif + +include ../../../../component/isp/sensor.mk + +define MAKE_SENSOR + pushd $(1) && \ + $(MAKE) all && \ + popd +endef + +.PHONY : prepare clean $(sensor-y) +all: prepare $(sensor-y) all_sensor + +prepare: + @echo "#################################################" + @echo "#" + @echo "# Compiling 'component libs' Configs as below..." + @echo "# SENSOR_LIST=$(sensor-y)" + @echo "#" + @echo "#################################################" + +brigates_bg0808: + $(call MAKE_SENSOR, ${@}) + +byd_bf2253l: + $(call MAKE_SENSOR, ${@}) + +chipup_xs9922b: + $(call MAKE_SENSOR, ${@}) + +cvsens_cv2003: + $(call MAKE_SENSOR, ${@}) + +cvsens_cv2003_1L: + $(call MAKE_SENSOR, ${@}) + +cvsens_cv2003_1L_slave: + $(call MAKE_SENSOR, ${@}) + +cvsens_cv2003_1L_slave1: + $(call MAKE_SENSOR, ${@}) + +cvsens_cv4001: + $(call MAKE_SENSOR, ${@}) + +gcore_gc02m1: + $(call MAKE_SENSOR, ${@}) + +gcore_gc0312: + $(call MAKE_SENSOR, ${@}) + +gcore_gc0329: + $(call MAKE_SENSOR, ${@}) + +gcore_gc1054: + $(call MAKE_SENSOR, ${@}) + +gcore_gc1084: + $(call MAKE_SENSOR, ${@}) + +gcore_gc1084_slave: + $(call MAKE_SENSOR, ${@}) + +gcore_gc1084_slave1: + $(call MAKE_SENSOR, ${@}) + +gcore_gc1084_slave2: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2053: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2053_slave: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2053_1L: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2083: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2093: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2145: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2385_1L: + $(call MAKE_SENSOR, ${@}) + +gcore_gc4023: + $(call MAKE_SENSOR, ${@}) + +gcore_gc4653: + $(call MAKE_SENSOR, ${@}) + +gcore_gc4653_slave: + $(call MAKE_SENSOR, ${@}) + +imgds_mis2008: + $(call MAKE_SENSOR, ${@}) + +imgds_mis2008_1L: + $(call MAKE_SENSOR, ${@}) + +nextchip_n5: + $(call MAKE_SENSOR, ${@}) + +nextchip_n6: + $(call MAKE_SENSOR, ${@}) + +ov_os02n10_1L: + $(call MAKE_SENSOR, ${@}) + +ov_os04a10: + $(call MAKE_SENSOR, ${@}) + +ov_os04c10: + $(call MAKE_SENSOR, ${@}) + +ov_os08a20: + $(call MAKE_SENSOR, ${@}) + +ov_ov4689: + $(call MAKE_SENSOR, ${@}) + +ov_ov5647: + $(call MAKE_SENSOR, ${@}) + +ov_ov6211: + $(call MAKE_SENSOR, ${@}) + +ov_ov7251: + $(call MAKE_SENSOR, ${@}) + +pixelplus_pr2000: + $(call MAKE_SENSOR, ${@}) + +pixelplus_pr2020: + $(call MAKE_SENSOR, ${@}) + +pixelplus_pr2100: + $(call MAKE_SENSOR, ${@}) + +sms_sc035gs: + $(call MAKE_SENSOR, ${@}) + +sms_sc035gs_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc035hgs: + $(call MAKE_SENSOR, ${@}) + +sms_sc035hgs_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc132gs: + $(call MAKE_SENSOR, ${@}) + +sms_sc132gs_slave: + $(call MAKE_SENSOR, ${@}) + +sms_sc1336_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc1346_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc1346_1L_slave: + $(call MAKE_SENSOR, ${@}) + +sms_sc200ai: + $(call MAKE_SENSOR, ${@}) + +sms_sc200ai_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc230ai_2L: + $(call MAKE_SENSOR, ${@}) + +sms_sc230ai_2L_slave: + $(call MAKE_SENSOR, ${@}) + +sms_sc301iot: + $(call MAKE_SENSOR, ${@}) + +sms_sc401ai: + $(call MAKE_SENSOR, ${@}) + +sms_sc500ai: + $(call MAKE_SENSOR, ${@}) + +sms_sc501ai_2L: + $(call MAKE_SENSOR, ${@}) + +sms_sc3332: + $(call MAKE_SENSOR, ${@}) + +sms_sc530ai_2L: + $(call MAKE_SENSOR, ${@}) + +sms_sc531ai_2L: + $(call MAKE_SENSOR, ${@}) + +sms_sc3335: + $(call MAKE_SENSOR, ${@}) + +sms_sc3336: + $(call MAKE_SENSOR, ${@}) + +sms_sc3336_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc3336p: + $(call MAKE_SENSOR, ${@}) + +sms_sc2331_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc2331_1L_slave: + $(call MAKE_SENSOR, ${@}) + +sms_sc2331_1L_slave1: + $(call MAKE_SENSOR, ${@}) + +sms_sc2335: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336_slave: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336_slave1: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336p: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336p_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc223a_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc4336: + $(call MAKE_SENSOR, ${@}) + +sms_sc4336p: + $(call MAKE_SENSOR, ${@}) + +sms_sc5336_2L: + $(call MAKE_SENSOR, ${@}) + +soi_f23: + $(call MAKE_SENSOR, ${@}) + +soi_f35: + $(call MAKE_SENSOR, ${@}) + +soi_f37p: + $(call MAKE_SENSOR, ${@}) + +soi_q03: + $(call MAKE_SENSOR, ${@}) + +soi_q03p: + $(call MAKE_SENSOR, ${@}) + +soi_k06: + $(call MAKE_SENSOR, ${@}) + +soi_f53: + $(call MAKE_SENSOR, ${@}) + +soi_f352: + $(call MAKE_SENSOR, ${@}) + +soi_k306: + $(call MAKE_SENSOR, ${@}) + +sony_imx307: + $(call MAKE_SENSOR, ${@}) + +sony_imx307_slave: + $(call MAKE_SENSOR, ${@}) + +sony_imx307_2L: + $(call MAKE_SENSOR, ${@}) + +sony_imx327: + $(call MAKE_SENSOR, ${@}) + +sony_imx327_slave: + $(call MAKE_SENSOR, ${@}) + +sony_imx327_2L: + $(call MAKE_SENSOR, ${@}) + +sony_imx327_fpga: + $(call MAKE_SENSOR, ${@}) + +sony_imx327_sublvds: + $(call MAKE_SENSOR, ${@}) + +sony_imx335: + $(call MAKE_SENSOR, ${@}) + +sony_imx675: + $(call MAKE_SENSOR, ${@}) + +techpoint_tp2825: + $(call MAKE_SENSOR, ${@}) + +techpoint_tp2863: + $(call MAKE_SENSOR, ${@}) + +lontium_lt6911: + $(call MAKE_SENSOR, ${@}) + +lontium_lt7911: + $(call MAKE_SENSOR, ${@}) + +all_sensor: + @$(MAKE) -f Makefile_full || exit 1; + +clean: + @for x in `find ./ -maxdepth 2 -mindepth 2 -name "Makefile" `; \ + do cd `dirname $$x`; if [ $$? ]; then $(MAKE) clean; cd -; fi; done + @echo "#" + @$(MAKE) clean -f Makefile_full || exit 1; diff --git a/external/SensorSupportList/sensor/cv182x/Makefile.orig b/external/SensorSupportList/sensor/cv182x/Makefile.orig new file mode 100644 index 00000000..d048f643 --- /dev/null +++ b/external/SensorSupportList/sensor/cv182x/Makefile.orig @@ -0,0 +1,327 @@ +SHELL = /bin/bash + +ifeq ($(PARAM_FILE), ) +PARAM_FILE=../../../../../$(shell echo $(MW_VER))/Makefile.param +include $(PARAM_FILE) +endif +include ../../../../../$(shell echo $(MW_VER))/component/isp/sensor.mk + +define MAKE_SENSOR + pushd $(1) && \ + $(MAKE) all && \ + popd +endef + +.PHONY : prepare clean $(sensor-y) +all: prepare $(sensor-y) all_sensor + +prepare: + @echo "#################################################" + @echo "#" + @echo "# Compiling 'component libs' Configs as below..." + @echo "# SENSOR_LIST=$(sensor-y)" + @echo "#" + @echo "#################################################" + +brigates_bg0808: + $(call MAKE_SENSOR, ${@}) + +byd_bf2253l: + $(call MAKE_SENSOR, ${@}) + +chipup_xs9922b: + $(call MAKE_SENSOR, ${@}) + +cvsens_cv2003: + $(call MAKE_SENSOR, ${@}) + +cvsens_cv2003_1L: + $(call MAKE_SENSOR, ${@}) + +cvsens_cv2003_1L_slave: + $(call MAKE_SENSOR, ${@}) + +cvsens_cv2003_1L_slave1: + $(call MAKE_SENSOR, ${@}) + +cvsens_cv4001: + $(call MAKE_SENSOR, ${@}) + +gcore_gc02m1: + $(call MAKE_SENSOR, ${@}) + +gcore_gc0312: + $(call MAKE_SENSOR, ${@}) + +gcore_gc0329: + $(call MAKE_SENSOR, ${@}) + +gcore_gc1054: + $(call MAKE_SENSOR, ${@}) + +gcore_gc1084: + $(call MAKE_SENSOR, ${@}) + +gcore_gc1084_slave: + $(call MAKE_SENSOR, ${@}) + +gcore_gc1084_slave1: + $(call MAKE_SENSOR, ${@}) + +gcore_gc1084_slave2: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2053: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2053_slave: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2053_1L: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2083: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2093: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2145: + $(call MAKE_SENSOR, ${@}) + +gcore_gc2385_1L: + $(call MAKE_SENSOR, ${@}) + +gcore_gc4023: + $(call MAKE_SENSOR, ${@}) + +gcore_gc4653: + $(call MAKE_SENSOR, ${@}) + +gcore_gc4653_slave: + $(call MAKE_SENSOR, ${@}) + +imgds_mis2008: + $(call MAKE_SENSOR, ${@}) + +imgds_mis2008_1L: + $(call MAKE_SENSOR, ${@}) + +nextchip_n5: + $(call MAKE_SENSOR, ${@}) + +nextchip_n6: + $(call MAKE_SENSOR, ${@}) + +ov_os04a10: + $(call MAKE_SENSOR, ${@}) + +ov_os04c10: + $(call MAKE_SENSOR, ${@}) + +ov_os08a20: + $(call MAKE_SENSOR, ${@}) + +ov_ov4689: + $(call MAKE_SENSOR, ${@}) + +ov_ov5647: + $(call MAKE_SENSOR, ${@}) + +ov_ov6211: + $(call MAKE_SENSOR, ${@}) + +ov_ov7251: + $(call MAKE_SENSOR, ${@}) + +pixelplus_pr2020: + $(call MAKE_SENSOR, ${@}) + +pixelplus_pr2100: + $(call MAKE_SENSOR, ${@}) + +sms_sc035gs: + $(call MAKE_SENSOR, ${@}) + +sms_sc035gs_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc035hgs: + $(call MAKE_SENSOR, ${@}) + +sms_sc035hgs_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc132gs: + $(call MAKE_SENSOR, ${@}) + +sms_sc132gs_slave: + $(call MAKE_SENSOR, ${@}) + +sms_sc1336_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc1346_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc1346_1L_slave: + $(call MAKE_SENSOR, ${@}) + +sms_sc200ai: + $(call MAKE_SENSOR, ${@}) + +sms_sc200ai_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc301iot: + $(call MAKE_SENSOR, ${@}) + +sms_sc401ai: + $(call MAKE_SENSOR, ${@}) + +sms_sc500ai: + $(call MAKE_SENSOR, ${@}) + +sms_sc501ai_2L: + $(call MAKE_SENSOR, ${@}) + +sms_sc3332: + $(call MAKE_SENSOR, ${@}) + +sms_sc530ai_2L: + $(call MAKE_SENSOR, ${@}) + +sms_sc531ai_2L: + $(call MAKE_SENSOR, ${@}) + +sms_sc3335: + $(call MAKE_SENSOR, ${@}) + +sms_sc3336: + $(call MAKE_SENSOR, ${@}) + +sms_sc3336_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc3336p: + $(call MAKE_SENSOR, ${@}) + +sms_sc2331_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc2331_1L_slave: + $(call MAKE_SENSOR, ${@}) + +sms_sc2331_1L_slave1: + $(call MAKE_SENSOR, ${@}) + +sms_sc2335: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336_slave: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336_slave1: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336p: + $(call MAKE_SENSOR, ${@}) + +sms_sc2336p_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc223a_1L: + $(call MAKE_SENSOR, ${@}) + +sms_sc4336: + $(call MAKE_SENSOR, ${@}) + +sms_sc4336p: + $(call MAKE_SENSOR, ${@}) + +sms_sc5336_2L: + $(call MAKE_SENSOR, ${@}) + +soi_f23: + $(call MAKE_SENSOR, ${@}) + +soi_f35: + $(call MAKE_SENSOR, ${@}) + +soi_f37p: + $(call MAKE_SENSOR, ${@}) + +soi_q03: + $(call MAKE_SENSOR, ${@}) + +soi_q03p: + $(call MAKE_SENSOR, ${@}) + +soi_k06: + $(call MAKE_SENSOR, ${@}) + +soi_f53: + $(call MAKE_SENSOR, ${@}) + +soi_f352: + $(call MAKE_SENSOR, ${@}) + +soi_k306: + $(call MAKE_SENSOR, ${@}) + +sony_imx307: + $(call MAKE_SENSOR, ${@}) + +sony_imx307_slave: + $(call MAKE_SENSOR, ${@}) + +sony_imx307_2L: + $(call MAKE_SENSOR, ${@}) + +sony_imx327: + $(call MAKE_SENSOR, ${@}) + +sony_imx327_slave: + $(call MAKE_SENSOR, ${@}) + +sony_imx327_2L: + $(call MAKE_SENSOR, ${@}) + +sony_imx327_fpga: + $(call MAKE_SENSOR, ${@}) + +sony_imx327_sublvds: + $(call MAKE_SENSOR, ${@}) + +sony_imx335: + $(call MAKE_SENSOR, ${@}) + +sony_imx675: + $(call MAKE_SENSOR, ${@}) + +techpoint_tp2825: + $(call MAKE_SENSOR, ${@}) + +techpoint_tp2863: + $(call MAKE_SENSOR, ${@}) + +lontium_lt6911: + $(call MAKE_SENSOR, ${@}) + +lontium_lt7911: + $(call MAKE_SENSOR, ${@}) + +all_sensor: + @$(MAKE) -f Makefile_full || exit 1; + +clean: + @for x in `find ./ -maxdepth 2 -mindepth 2 -name "Makefile" `; \ + do cd `dirname $$x`; if [ $$? ]; then $(MAKE) clean; cd -; fi; done + @echo "#" + @$(MAKE) clean -f Makefile_full || exit 1; diff --git a/external/SensorSupportList/sensor/sg200x/ov_ov5647/Makefile b/external/SensorSupportList/sensor/cv182x/ov_ov5647/Makefile similarity index 100% rename from external/SensorSupportList/sensor/sg200x/ov_ov5647/Makefile rename to external/SensorSupportList/sensor/cv182x/ov_ov5647/Makefile diff --git a/external/SensorSupportList/sensor/sg200x/ov_ov5647/ov5647_cmos.c b/external/SensorSupportList/sensor/cv182x/ov_ov5647/ov5647_cmos.c similarity index 100% rename from external/SensorSupportList/sensor/sg200x/ov_ov5647/ov5647_cmos.c rename to external/SensorSupportList/sensor/cv182x/ov_ov5647/ov5647_cmos.c diff --git a/external/SensorSupportList/sensor/sg200x/ov_ov5647/ov5647_cmos_ex.h b/external/SensorSupportList/sensor/cv182x/ov_ov5647/ov5647_cmos_ex.h similarity index 100% rename from external/SensorSupportList/sensor/sg200x/ov_ov5647/ov5647_cmos_ex.h rename to external/SensorSupportList/sensor/cv182x/ov_ov5647/ov5647_cmos_ex.h diff --git a/external/SensorSupportList/sensor/sg200x/ov_ov5647/ov5647_cmos_param.h b/external/SensorSupportList/sensor/cv182x/ov_ov5647/ov5647_cmos_param.h similarity index 100% rename from external/SensorSupportList/sensor/sg200x/ov_ov5647/ov5647_cmos_param.h rename to external/SensorSupportList/sensor/cv182x/ov_ov5647/ov5647_cmos_param.h diff --git a/external/SensorSupportList/sensor/sg200x/ov_ov5647/ov5647_sensor_ctl.c b/external/SensorSupportList/sensor/cv182x/ov_ov5647/ov5647_sensor_ctl.c similarity index 98% rename from external/SensorSupportList/sensor/sg200x/ov_ov5647/ov5647_sensor_ctl.c rename to external/SensorSupportList/sensor/cv182x/ov_ov5647/ov5647_sensor_ctl.c index 8e2c2892..7e27b7c1 100644 --- a/external/SensorSupportList/sensor/sg200x/ov_ov5647/ov5647_sensor_ctl.c +++ b/external/SensorSupportList/sensor/cv182x/ov_ov5647/ov5647_sensor_ctl.c @@ -102,7 +102,7 @@ int ov5647_read_register(VI_PIPE ViPipe, int addr) data = buf[0]; } - syslog(LOG_DEBUG, "i2c r 0x%x = 0x%x\n", addr, data); + // syslog(LOG_DEBUG, "i2c r 0x%x = 0x%x\n", addr, data); return data; } @@ -133,7 +133,7 @@ int ov5647_write_register(VI_PIPE ViPipe, int addr, int data) CVI_TRACE_SNS(CVI_DBG_ERR, "I2C_WRITE error!\n"); return CVI_FAILURE; } - syslog(LOG_DEBUG, "i2c w 0x%x 0x%x\n", addr, data); + // syslog(LOG_DEBUG, "i2c w 0x%x 0x%x\n", addr, data); return CVI_SUCCESS; } diff --git a/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/Makefile b/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/Makefile new file mode 100644 index 00000000..e721b4de --- /dev/null +++ b/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/Makefile @@ -0,0 +1,36 @@ +SHELL = /bin/bash +ifeq ($(PARAM_FILE), ) + PARAM_FILE=../../../../../Makefile.param + include $(PARAM_FILE) +endif + +SDIR = $(PWD) +SRCS = $(wildcard $(SDIR)/*.c) +INCS = -I$(MW_INC) -I$(ISP_INC) -I$(KERNEL_INC) -I./include +OBJS = $(SRCS:.c=.o) +DEPS = $(SRCS:.c=.d) +TARGET_A = $(MW_LIB)/libsns_sc530ai_2l.a +TARGET_SO = $(MW_LIB)/libsns_sc530ai_2l.so + +EXTRA_CFLAGS = $(INCS) +EXTRA_LDFLAGS = + +.PHONY : clean all +all : $(TARGET_A) $(TARGET_SO) + +$(SDIR)/%.o: $(SDIR)/%.c + @$(CC) $(DEPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ + @echo [$(notdir $(CC))] $(notdir $@) + +$(TARGET_A): $(OBJS) + @$(AR) $(ARFLAGS) $@ $(OBJS) + @echo -e $(YELLOW)[LINK]$(END)[$(notdir $(AR))] $(notdir $(TARGET_A)) + +$(TARGET_SO): $(OBJS) + @$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ --start-group $(OBJS) --end-group + @echo -e $(GREEN)[LINK]$(END)[$(notdir $(LD))] $(notdir $(TARGET_SO)) + +clean: + @rm -f $(OBJS) $(DEPS) $(TARGET_A) $(TARGET_SO) + +-include $(DEPS) diff --git a/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_cmos.c b/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_cmos.c new file mode 100644 index 00000000..bc77a2ba --- /dev/null +++ b/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_cmos.c @@ -0,0 +1,981 @@ +#include +#include +#include +#include +#include +#include +#ifdef ARCH_CV182X +#include "cvi_type.h" +#include "cvi_comm_video.h" +#include +#else +#include +#include +#include +#endif +#include "cvi_debug.h" +#include "cvi_comm_sns.h" +#include "cvi_sns_ctrl.h" +#include "cvi_ae_comm.h" +#include "cvi_awb_comm.h" +#include "cvi_ae.h" +#include "cvi_awb.h" +#include "cvi_isp.h" + +#include "sc530ai_2L_cmos_ex.h" +#include "sc530ai_2L_cmos_param.h" + +#define DIV_0_TO_1(a) ((0 == (a)) ? 1 : (a)) +#define DIV_0_TO_1_FLOAT(a) ((((a) < 1E-10) && ((a) > -1E-10)) ? 1 : (a)) +#define sc530AI_2L_ID 500 +#define SENSOR_sc530AI_2L_WIDTH 2880 +#define SENSOR_sc530AI_2L_HEIGHT 1620 +/**************************************************************************** + * global variables * + ****************************************************************************/ + +ISP_SNS_STATE_S *g_pastsc530AI_2L[VI_MAX_PIPE_NUM] = {CVI_NULL}; + +#define sc530AI_2L_SENSOR_GET_CTX(dev, pstCtx) (pstCtx = g_pastsc530AI_2L[dev]) +#define sc530AI_2L_SENSOR_SET_CTX(dev, pstCtx) (g_pastsc530AI_2L[dev] = pstCtx) +#define sc530AI_2L_SENSOR_RESET_CTX(dev) (g_pastsc530AI_2L[dev] = CVI_NULL) + +ISP_SNS_COMMBUS_U g_aunsc530AI_2L_BusInfo[VI_MAX_PIPE_NUM] = { + [0] = { .s8I2cDev = 0}, + [1 ... VI_MAX_PIPE_NUM - 1] = { .s8I2cDev = -1} +}; + +CVI_U16 g_au16sc530AI_2L_GainMode[VI_MAX_PIPE_NUM] = {0}; +CVI_U16 g_au16sc530AI_2L_L2SMode[VI_MAX_PIPE_NUM] = {0}; + +sc530AI_2L_STATE_S g_astsc530AI_2L_State[VI_MAX_PIPE_NUM] = {{0} }; +ISP_SNS_MIRRORFLIP_TYPE_E g_aesc530ai_MirrorFip[VI_MAX_PIPE_NUM] = {0}; + +/**************************************************************************** + * local variables and functions * + ****************************************************************************/ +static ISP_FSWDR_MODE_E genFSWDRMode[VI_MAX_PIPE_NUM] = { + [0 ... VI_MAX_PIPE_NUM - 1] = ISP_FSWDR_NORMAL_MODE +}; + +static CVI_U32 gu32MaxTimeGetCnt[VI_MAX_PIPE_NUM] = {0}; +static CVI_U32 g_au32InitExposure[VI_MAX_PIPE_NUM] = {0}; +static CVI_U32 g_au32LinesPer500ms[VI_MAX_PIPE_NUM] = {0}; +static CVI_U16 g_au16InitWBGain[VI_MAX_PIPE_NUM][3] = {{0} }; +static CVI_U16 g_au16SampleRgain[VI_MAX_PIPE_NUM] = {0}; +static CVI_U16 g_au16SampleBgain[VI_MAX_PIPE_NUM] = {0}; +static CVI_S32 cmos_get_wdr_size(VI_PIPE ViPipe, ISP_SNS_ISP_INFO_S *pstIspCfg); +/*****sc530AI_2L Lines Range*****/ +#define sc530AI_2L_FULL_LINES_MAX (0x7FFF) + +/*****sc530AI_2L Register Address*****/ +#define sc530AI_2L_SHS1_0_ADDR 0x3E00 +#define sc530AI_2L_SHS1_1_ADDR 0x3E01 +#define sc530AI_2L_SHS1_2_ADDR 0x3E02 +#define sc530AI_2L_AGAIN_ADDR 0x3E09 +#define sc530AI_2L_DGAIN_ADDR 0x3E06 +#define sc530AI_2L_DGAIN_FINEADDR 0x3E07 +#define sc530AI_2L_FLIP_MIRROR_ADDR 0x3221 +#define sc530AI_2L_VMAX_ADDR 0x320E +#define sc530AI_2L_TABLE_END 0xFFFF + +#define sc530AI_2L_RES_IS_1620P(w, h) ((w) <= 2880 && (h) <= 1620) + +static CVI_S32 cmos_get_ae_default(VI_PIPE ViPipe, AE_SENSOR_DEFAULT_S *pstAeSnsDft) +{ + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + + CMOS_CHECK_POINTER(pstAeSnsDft); + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + pstAeSnsDft->u32FullLinesStd = pstSnsState->u32FLStd; + pstAeSnsDft->u32FlickerFreq = 50 * 256; + pstAeSnsDft->u32FullLinesMax = sc530AI_2L_FULL_LINES_MAX; + pstAeSnsDft->u32HmaxTimes = (1000000) / (pstSnsState->u32FLStd * 30); + + pstAeSnsDft->stIntTimeAccu.enAccuType = AE_ACCURACY_LINEAR; + pstAeSnsDft->stIntTimeAccu.f32Accuracy = 0.5; + pstAeSnsDft->stIntTimeAccu.f32Offset = 0; + + pstAeSnsDft->stAgainAccu.enAccuType = AE_ACCURACY_TABLE; + pstAeSnsDft->stAgainAccu.f32Accuracy = 1; + + pstAeSnsDft->stDgainAccu.enAccuType = AE_ACCURACY_TABLE; + pstAeSnsDft->stDgainAccu.f32Accuracy = 1; + + pstAeSnsDft->u32ISPDgainShift = 8; + pstAeSnsDft->u32MinISPDgainTarget = 1 << pstAeSnsDft->u32ISPDgainShift; + pstAeSnsDft->u32MaxISPDgainTarget = 2 << pstAeSnsDft->u32ISPDgainShift; + + if (g_au32LinesPer500ms[ViPipe] == 0) + pstAeSnsDft->u32LinesPer500ms = pstSnsState->u32FLStd * 30 / 2; + else + pstAeSnsDft->u32LinesPer500ms = g_au32LinesPer500ms[ViPipe]; + pstAeSnsDft->u32SnsStableFrame = 0; + + switch (pstSnsState->enWDRMode) { + default: + case WDR_MODE_NONE: /*linear mode*/ + pstAeSnsDft->f32Fps = g_astsc530AI_2L_mode[sc530AI_2L_MODE_1620P30].f32MaxFps; + pstAeSnsDft->f32MinFps = g_astsc530AI_2L_mode[sc530AI_2L_MODE_1620P30].f32MinFps; + pstAeSnsDft->au8HistThresh[0] = 0xd; + pstAeSnsDft->au8HistThresh[1] = 0x28; + pstAeSnsDft->au8HistThresh[2] = 0x60; + pstAeSnsDft->au8HistThresh[3] = 0x80; + + pstAeSnsDft->u32MaxAgain = g_astsc530AI_2L_mode[sc530AI_2L_MODE_1620P30].stAgain[0].u32Max; + pstAeSnsDft->u32MinAgain = g_astsc530AI_2L_mode[sc530AI_2L_MODE_1620P30].stAgain[0].u32Min; + pstAeSnsDft->u32MaxAgainTarget = pstAeSnsDft->u32MaxAgain; + pstAeSnsDft->u32MinAgainTarget = pstAeSnsDft->u32MinAgain; + + pstAeSnsDft->u32MaxDgain = g_astsc530AI_2L_mode[sc530AI_2L_MODE_1620P30].stDgain[0].u32Max; + pstAeSnsDft->u32MinDgain = g_astsc530AI_2L_mode[sc530AI_2L_MODE_1620P30].stDgain[0].u32Min; + pstAeSnsDft->u32MaxDgainTarget = pstAeSnsDft->u32MaxDgain; + pstAeSnsDft->u32MinDgainTarget = pstAeSnsDft->u32MinDgain; + + pstAeSnsDft->u8AeCompensation = 40; + pstAeSnsDft->u32InitAESpeed = 64; + pstAeSnsDft->u32InitAETolerance = 5; + pstAeSnsDft->u32AEResponseFrame = 4; + pstAeSnsDft->enAeExpMode = AE_EXP_HIGHLIGHT_PRIOR; + pstAeSnsDft->u32InitExposure = g_au32InitExposure[ViPipe] ? g_au32InitExposure[ViPipe] : 76151; + + pstAeSnsDft->u32MaxIntTime = 2 * (pstSnsState->u32FLStd - 5); + pstAeSnsDft->u32MinIntTime = 3; + pstAeSnsDft->u32MaxIntTimeTarget = 65535; + pstAeSnsDft->u32MinIntTimeTarget = 1; + break; + case WDR_MODE_2To1_LINE: + break; + } + return CVI_SUCCESS; +} + +/* the function of sensor set fps */ +static CVI_S32 cmos_fps_set(VI_PIPE ViPipe, CVI_FLOAT f32Fps, AE_SENSOR_DEFAULT_S *pstAeSnsDft) +{ + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + CVI_U32 u32VMAX; + CVI_FLOAT f32MaxFps = 0; + CVI_FLOAT f32MinFps = 0; + CVI_U32 u32Vts = 0; + ISP_SNS_REGS_INFO_S *pstSnsRegsInfo = CVI_NULL; + + CMOS_CHECK_POINTER(pstAeSnsDft); + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + u32Vts = g_astsc530AI_2L_mode[pstSnsState->u8ImgMode].u32VtsDef; + pstSnsRegsInfo = &pstSnsState->astSyncInfo[0].snsCfg; + f32MaxFps = g_astsc530AI_2L_mode[pstSnsState->u8ImgMode].f32MaxFps; + f32MinFps = g_astsc530AI_2L_mode[pstSnsState->u8ImgMode].f32MinFps; + + switch (pstSnsState->u8ImgMode) { + case sc530AI_2L_MODE_1620P30: + if ((f32Fps <= f32MaxFps) && (f32Fps >= f32MinFps)) { + u32VMAX = u32Vts * f32MaxFps / DIV_0_TO_1_FLOAT(f32Fps); + } else { + CVI_TRACE_SNS(CVI_DBG_ERR, "Not support Fps: %f\n", f32Fps); + return CVI_FAILURE; + } + u32VMAX = (u32VMAX > sc530AI_2L_FULL_LINES_MAX) ? sc530AI_2L_FULL_LINES_MAX : u32VMAX; + break; + default: + CVI_TRACE_SNS(CVI_DBG_ERR, "Not support sensor mode: %d\n", pstSnsState->u8ImgMode); + return CVI_FAILURE; + } + + pstSnsState->u32FLStd = u32VMAX; + + if (pstSnsState->enWDRMode == WDR_MODE_NONE) { + pstSnsRegsInfo->astI2cData[LINEAR_VMAX_H_ADDR].u32Data = ((u32VMAX & 0xFF00) >> 8); + pstSnsRegsInfo->astI2cData[LINEAR_VMAX_L_ADDR].u32Data = (u32VMAX & 0xFF); + } + + pstAeSnsDft->f32Fps = f32Fps; + pstAeSnsDft->u32LinesPer500ms = pstSnsState->u32FLStd * f32Fps / 2; + pstAeSnsDft->u32FullLinesStd = pstSnsState->u32FLStd; + pstAeSnsDft->u32MaxIntTime = 2 * (pstSnsState->u32FLStd - 5); + pstSnsState->au32FL[0] = pstSnsState->u32FLStd; + pstAeSnsDft->u32FullLines = pstSnsState->au32FL[0]; + pstAeSnsDft->u32HmaxTimes = (1000000) / (pstSnsState->u32FLStd * DIV_0_TO_1_FLOAT(f32Fps)); + + return CVI_SUCCESS; +} + +/* while isp notify ae to update sensor regs, ae call these funcs. */ +static CVI_S32 cmos_inttime_update(VI_PIPE ViPipe, CVI_U32 *u32IntTime) +{ + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + ISP_SNS_REGS_INFO_S *pstSnsRegsInfo = CVI_NULL; + + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + CMOS_CHECK_POINTER(u32IntTime); + pstSnsRegsInfo = &pstSnsState->astSyncInfo[0].snsCfg; + + CVI_U32 u32TmpIntTime = u32IntTime[0]; + CVI_U32 maxExp = 2 * pstSnsState->au32FL[0] - 10; + + /* linear exposure reg range: + * min : 3 + * max : 2 * vts - 10 + * step : 1 + */ + u32TmpIntTime = (u32TmpIntTime > maxExp) ? maxExp : u32TmpIntTime; + if (u32TmpIntTime < 3) + u32TmpIntTime = 3; + u32IntTime[0] = u32TmpIntTime; + + pstSnsRegsInfo->astI2cData[LINEAR_SHS1_0_ADDR].u32Data = ((u32TmpIntTime & 0xF000) >> 12); + pstSnsRegsInfo->astI2cData[LINEAR_SHS1_1_ADDR].u32Data = ((u32TmpIntTime & 0x0FF0) >> 4); + pstSnsRegsInfo->astI2cData[LINEAR_SHS1_2_ADDR].u32Data = (u32TmpIntTime & 0xF) << 4; + + return CVI_SUCCESS; + +} + +static CVI_U32 Again_table[] = { + 1024, 2048, 2447, 4894, 9789, 19578, 39157, 78315 +}; + +static CVI_U32 AgainReg[] = { + 0x00, 0x01, 0x40, 0x48, 0x49, 0x4B, 0x4F, 0x5F +}; + +struct gain_tbl_info_s { + CVI_U16 gainMax; + CVI_U16 idxBase; + CVI_U8 regGain; + CVI_U8 regGainFineBase; + CVI_U8 regGainFineStep; +}; + +static struct gain_tbl_info_s DgainInfo[2] = { + { + .gainMax = 2016, + .idxBase = 0, + .regGain = 0x00, + .regGainFineBase = 0x80, + .regGainFineStep = 4, + }, + { + .gainMax = 4032, + .idxBase = 32, + .regGain = 0x01, + .regGainFineBase = 0x80, + .regGainFineStep = 4, + }, +}; + +static CVI_U32 Dgain_table[64] = { + 1024, 1055, 1088, 1120, 1152, 1183, 1216, 1248, 1280, 1311, 1344, 1376, 1408, 1439, 1472, 1504, + 1536, 1567, 1600, 1632, 1664, 1695, 1728, 1760, 1792, 1823, 1856, 1888, 1920, 1951, 1984, 2016, + 2048, 2112, 2176, 2240, 2304, 2368, 2432, 2496, 2560, 2624, 2688, 2752, 2816, 2880, 2944, 3008, + 3072, 3136, 3200, 3264, 3328, 3392, 3456, 3520, 3584, 3648, 3712, 3776, 3840, 3904, 3968, 4032, +}; + +static CVI_U32 Again_tableSize = sizeof(Again_table) / sizeof(CVI_U32); +static CVI_U32 Dgain_tableSize = sizeof(Dgain_table) / sizeof(CVI_U32); + +static CVI_S32 cmos_again_calc_table(VI_PIPE ViPipe, CVI_U32 *pu32AgainLin, CVI_U32 *pu32AgainDb) +{ + CVI_U32 i; + (void)ViPipe; + + CMOS_CHECK_POINTER(pu32AgainLin); + CMOS_CHECK_POINTER(pu32AgainDb); + + if (*pu32AgainLin >= Again_table[Again_tableSize-1]) { + *pu32AgainLin = Again_table[Again_tableSize-1]; + *pu32AgainDb = AgainReg[Again_tableSize-1]; + return CVI_SUCCESS; + } + + for (i = 1; i < Again_tableSize; i++) { + if (*pu32AgainLin < Again_table[i]) { + *pu32AgainLin = Again_table[i - 1]; + *pu32AgainDb = AgainReg[i - 1]; + break; + } + } + return CVI_SUCCESS; +} + +static CVI_S32 cmos_dgain_calc_table(VI_PIPE ViPipe, CVI_U32 *pu32DgainLin, CVI_U32 *pu32DgainDb) +{ + (void)ViPipe; + CMOS_CHECK_POINTER(pu32DgainLin); + CMOS_CHECK_POINTER(pu32DgainDb); + + if (*pu32DgainLin >= Dgain_table[Dgain_tableSize - 1]) { + *pu32DgainLin = Dgain_table[Dgain_tableSize - 1]; + *pu32DgainDb = Dgain_tableSize - 1; + return CVI_SUCCESS; + } + + for (CVI_U32 i = 1; i < Dgain_tableSize; i++) { + if (*pu32DgainLin < Dgain_table[i]) { + *pu32DgainLin = Dgain_table[i - 1]; + *pu32DgainDb = i - 1; + break; + } + } + return CVI_SUCCESS; +} + +static CVI_S32 cmos_gains_update(VI_PIPE ViPipe, CVI_U32 *pu32Again, CVI_U32 *pu32Dgain) +{ + + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + ISP_SNS_REGS_INFO_S *pstSnsRegsInfo = CVI_NULL; + CVI_U32 u32Again; + CVI_U32 u32Dgain; + struct gain_tbl_info_s *info; + int i, tbl_num; + + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + CMOS_CHECK_POINTER(pu32Again); + CMOS_CHECK_POINTER(pu32Dgain); + pstSnsRegsInfo = &pstSnsState->astSyncInfo[0].snsCfg; + + u32Again = pu32Again[0]; + u32Dgain = pu32Dgain[0]; + + if (pstSnsState->enWDRMode == WDR_MODE_NONE) { + /* linear mode */ + + /* find Again register setting. */ + pstSnsRegsInfo->astI2cData[LINEAR_AGAIN_ADDR].u32Data = (u32Again & 0xFF); + + /* find Dgain register setting. */ + tbl_num = sizeof(DgainInfo)/sizeof(struct gain_tbl_info_s); + for (i = tbl_num - 1; i >= 0; i--) { + info = &DgainInfo[i]; + if (u32Dgain >= info->idxBase) + break; + } + + pstSnsRegsInfo->astI2cData[LINEAR_DGAIN_ADDR].u32Data = (info->regGain & 0xFF); + u32Dgain = info->regGainFineBase + (u32Dgain - info->idxBase) * info->regGainFineStep; + pstSnsRegsInfo->astI2cData[LINEAR_DGAIN_FINE_ADDR].u32Data = (u32Dgain & 0xFF); + } + + return CVI_SUCCESS; +} + +static CVI_S32 cmos_get_inttime_max(VI_PIPE ViPipe, CVI_U16 u16ManRatioEnable, CVI_U32 *au32Ratio, + CVI_U32 *au32IntTimeMax, CVI_U32 *au32IntTimeMin, CVI_U32 *pu32LFMaxIntTime) +{ + CVI_U32 u32IntTimeMaxTmp = 0; + CVI_U32 u32ShortTimeMinLimit = 5; + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + CVI_U32 u32MaxSexp = 2 * g_astsc530AI_2L_State[ViPipe].u32Sexp_MAX - 14; + + (void) u16ManRatioEnable; + + CMOS_CHECK_POINTER(au32Ratio); + CMOS_CHECK_POINTER(au32IntTimeMax); + CMOS_CHECK_POINTER(au32IntTimeMin); + CMOS_CHECK_POINTER(pu32LFMaxIntTime); + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + /* short exposure reg range: + * min : 5 + * max : 2 * (max sexp - 7) + * step : 4 + * long exposure reg range: + * min : 5 + * max : 2 * (vts - max sexp - 9) + * step : 4 + */ + u32IntTimeMaxTmp = ((2 * pstSnsState->au32FL[0] - 16) * 0x40) / (au32Ratio[0] + 0x40); + u32IntTimeMaxTmp = (u32IntTimeMaxTmp > u32MaxSexp) ? u32MaxSexp : u32IntTimeMaxTmp; + u32IntTimeMaxTmp = (u32IntTimeMaxTmp < u32ShortTimeMinLimit) ? u32ShortTimeMinLimit : u32IntTimeMaxTmp; + + if (pstSnsState->enWDRMode == WDR_MODE_2To1_LINE) { + au32IntTimeMax[0] = u32IntTimeMaxTmp; + au32IntTimeMax[1] = au32IntTimeMax[0] * au32Ratio[0] >> 6; + au32IntTimeMax[2] = au32IntTimeMax[1] * au32Ratio[1] >> 6; + au32IntTimeMax[3] = au32IntTimeMax[2] * au32Ratio[2] >> 6; + au32IntTimeMin[0] = u32ShortTimeMinLimit; + au32IntTimeMin[1] = au32IntTimeMin[0] * au32Ratio[0] >> 6; + au32IntTimeMin[2] = au32IntTimeMin[1] * au32Ratio[1] >> 6; + au32IntTimeMin[3] = au32IntTimeMin[2] * au32Ratio[2] >> 6; + syslog(LOG_DEBUG, "ViPipe = %d ratio = %d, (%d, %d)\n", ViPipe, au32Ratio[0], + u32IntTimeMaxTmp, u32ShortTimeMinLimit); + } + + return CVI_SUCCESS; +} + +/* Only used in LINE_WDR mode */ +static CVI_S32 cmos_ae_fswdr_attr_set(VI_PIPE ViPipe, AE_FSWDR_ATTR_S *pstAeFSWDRAttr) +{ + CMOS_CHECK_POINTER(pstAeFSWDRAttr); + + genFSWDRMode[ViPipe] = pstAeFSWDRAttr->enFSWDRMode; + gu32MaxTimeGetCnt[ViPipe] = 0; + + return CVI_SUCCESS; +} + +static CVI_S32 cmos_init_ae_exp_function(AE_SENSOR_EXP_FUNC_S *pstExpFuncs) +{ + CMOS_CHECK_POINTER(pstExpFuncs); + + memset(pstExpFuncs, 0, sizeof(AE_SENSOR_EXP_FUNC_S)); + + pstExpFuncs->pfn_cmos_get_ae_default = cmos_get_ae_default; + pstExpFuncs->pfn_cmos_fps_set = cmos_fps_set; + //pstExpFuncs->pfn_cmos_slow_framerate_set = cmos_slow_framerate_set; + pstExpFuncs->pfn_cmos_inttime_update = cmos_inttime_update; + pstExpFuncs->pfn_cmos_gains_update = cmos_gains_update; + pstExpFuncs->pfn_cmos_again_calc_table = cmos_again_calc_table; + pstExpFuncs->pfn_cmos_dgain_calc_table = cmos_dgain_calc_table; + pstExpFuncs->pfn_cmos_get_inttime_max = cmos_get_inttime_max; + pstExpFuncs->pfn_cmos_ae_fswdr_attr_set = cmos_ae_fswdr_attr_set; + + return CVI_SUCCESS; +} + +static CVI_S32 cmos_get_awb_default(VI_PIPE ViPipe, AWB_SENSOR_DEFAULT_S *pstAwbSnsDft) +{ + (void) ViPipe; + + CMOS_CHECK_POINTER(pstAwbSnsDft); + + memset(pstAwbSnsDft, 0, sizeof(AWB_SENSOR_DEFAULT_S)); + + pstAwbSnsDft->u16InitGgain = 1024; + pstAwbSnsDft->u8AWBRunInterval = 1; + + return CVI_SUCCESS; +} + +static CVI_S32 cmos_init_awb_exp_function(AWB_SENSOR_EXP_FUNC_S *pstExpFuncs) +{ + CMOS_CHECK_POINTER(pstExpFuncs); + + memset(pstExpFuncs, 0, sizeof(AWB_SENSOR_EXP_FUNC_S)); + + pstExpFuncs->pfn_cmos_get_awb_default = cmos_get_awb_default; + + return CVI_SUCCESS; +} + +static CVI_S32 cmos_get_isp_default(VI_PIPE ViPipe, ISP_CMOS_DEFAULT_S *pstDef) +{ + (void) ViPipe; + + memset(pstDef, 0, sizeof(ISP_CMOS_DEFAULT_S)); + + memcpy(pstDef->stNoiseCalibration.CalibrationCoef, + &g_stIspNoiseCalibratio, sizeof(ISP_CMOS_NOISE_CALIBRATION_S)); + return CVI_SUCCESS; +} + +static CVI_S32 cmos_get_blc_default(VI_PIPE ViPipe, ISP_CMOS_BLACK_LEVEL_S *pstBlc) +{ + (void) ViPipe; + + CMOS_CHECK_POINTER(pstBlc); + + memset(pstBlc, 0, sizeof(ISP_CMOS_BLACK_LEVEL_S)); + + memcpy(pstBlc, + &g_stIspBlcCalibratio, sizeof(ISP_CMOS_BLACK_LEVEL_S)); + return CVI_SUCCESS; +} + +static CVI_S32 cmos_get_wdr_size(VI_PIPE ViPipe, ISP_SNS_ISP_INFO_S *pstIspCfg) +{ + const sc530AI_2L_MODE_S *pstMode = CVI_NULL; + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + pstMode = &g_astsc530AI_2L_mode[pstSnsState->u8ImgMode]; + + if (pstSnsState->enWDRMode != WDR_MODE_NONE) { + pstIspCfg->frm_num = 2; + memcpy(&pstIspCfg->img_size[0], &pstMode->astImg[0], sizeof(ISP_WDR_SIZE_S)); + memcpy(&pstIspCfg->img_size[1], &pstMode->astImg[1], sizeof(ISP_WDR_SIZE_S)); + } else { + pstIspCfg->frm_num = 1; + memcpy(&pstIspCfg->img_size[0], &pstMode->astImg[0], sizeof(ISP_WDR_SIZE_S)); + } + + return CVI_SUCCESS; +} + +static CVI_S32 cmos_set_wdr_mode(VI_PIPE ViPipe, CVI_U8 u8Mode) +{ + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + pstSnsState->bSyncInit = CVI_FALSE; + + switch (u8Mode) { + case WDR_MODE_NONE: + pstSnsState->enWDRMode = WDR_MODE_NONE; + pstSnsState->u32FLStd = g_astsc530AI_2L_mode[pstSnsState->u8ImgMode].u32VtsDef; + syslog(LOG_INFO, "linear mode\n"); + break; + + case WDR_MODE_2To1_LINE: + default: + CVI_TRACE_SNS(CVI_DBG_ERR, "NOT support this mode!\n"); + return CVI_FAILURE; + } + + pstSnsState->au32FL[0] = pstSnsState->u32FLStd; + pstSnsState->au32FL[1] = pstSnsState->au32FL[0]; + memset(pstSnsState->au32WDRIntTime, 0, sizeof(pstSnsState->au32WDRIntTime)); + + return CVI_SUCCESS; +} + +static CVI_U32 sensor_cmp_wdr_size(ISP_SNS_ISP_INFO_S *pstWdr1, ISP_SNS_ISP_INFO_S *pstWdr2) +{ + CVI_U32 i; + + if (pstWdr1->frm_num != pstWdr2->frm_num) + goto _mismatch; + for (i = 0; i < 2; i++) { + if (pstWdr1->img_size[i].stSnsSize.u32Width != pstWdr2->img_size[i].stSnsSize.u32Width) + goto _mismatch; + if (pstWdr1->img_size[i].stSnsSize.u32Height != pstWdr2->img_size[i].stSnsSize.u32Height) + goto _mismatch; + if (pstWdr1->img_size[i].stWndRect.s32X != pstWdr2->img_size[i].stWndRect.s32X) + goto _mismatch; + if (pstWdr1->img_size[i].stWndRect.s32Y != pstWdr2->img_size[i].stWndRect.s32Y) + goto _mismatch; + if (pstWdr1->img_size[i].stWndRect.u32Width != pstWdr2->img_size[i].stWndRect.u32Width) + goto _mismatch; + if (pstWdr1->img_size[i].stWndRect.u32Height != pstWdr2->img_size[i].stWndRect.u32Height) + goto _mismatch; + } + + return 0; +_mismatch: + return 1; +} + +static CVI_U32 sensor_cmp_cif_wdr(ISP_SNS_CIF_INFO_S *pstWdr1, ISP_SNS_CIF_INFO_S *pstWdr2) +{ + if (pstWdr1->wdr_manual.l2s_distance != pstWdr2->wdr_manual.l2s_distance) + goto _mismatch; + if (pstWdr1->wdr_manual.lsef_length != pstWdr2->wdr_manual.lsef_length) + goto _mismatch; + + return 0; +_mismatch: + return 1; +} + +static CVI_S32 cmos_get_sns_regs_info(VI_PIPE ViPipe, ISP_SNS_SYNC_INFO_S *pstSnsSyncInfo) +{ + CVI_U32 i; + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + ISP_SNS_REGS_INFO_S *pstSnsRegsInfo = CVI_NULL; + ISP_SNS_SYNC_INFO_S *pstCfg0 = CVI_NULL; + ISP_SNS_SYNC_INFO_S *pstCfg1 = CVI_NULL; + ISP_I2C_DATA_S *pstI2c_data = CVI_NULL; + + CMOS_CHECK_POINTER(pstSnsSyncInfo); + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + pstSnsRegsInfo = &pstSnsSyncInfo->snsCfg; + pstCfg0 = &pstSnsState->astSyncInfo[0]; + pstCfg1 = &pstSnsState->astSyncInfo[1]; + pstI2c_data = pstCfg0->snsCfg.astI2cData; + + if ((pstSnsState->bSyncInit == CVI_FALSE) || (pstSnsRegsInfo->bConfig == CVI_FALSE)) { + pstCfg0->snsCfg.enSnsType = SNS_I2C_TYPE; + pstCfg0->snsCfg.unComBus.s8I2cDev = g_aunsc530AI_2L_BusInfo[ViPipe].s8I2cDev; + pstCfg0->snsCfg.u8Cfg2ValidDelayMax = 0; + pstCfg0->snsCfg.use_snsr_sram = CVI_TRUE; + pstCfg0->snsCfg.u32RegNum = LINEAR_REGS_NUM; + + for (i = 0; i < pstCfg0->snsCfg.u32RegNum; i++) { + pstI2c_data[i].bUpdate = CVI_TRUE; + pstI2c_data[i].u8DevAddr = sc530ai_2l_i2c_addr; + pstI2c_data[i].u32AddrByteNum = sc530ai_2l_addr_byte; + pstI2c_data[i].u32DataByteNum = sc530ai_2l_data_byte; + } + + //Linear Mode Regs + pstI2c_data[LINEAR_SHS1_0_ADDR].u32RegAddr = sc530AI_2L_SHS1_0_ADDR; + pstI2c_data[LINEAR_SHS1_1_ADDR].u32RegAddr = sc530AI_2L_SHS1_1_ADDR; + pstI2c_data[LINEAR_SHS1_2_ADDR].u32RegAddr = sc530AI_2L_SHS1_2_ADDR; + pstI2c_data[LINEAR_AGAIN_ADDR].u32RegAddr = sc530AI_2L_AGAIN_ADDR; + pstI2c_data[LINEAR_DGAIN_ADDR].u32RegAddr = sc530AI_2L_DGAIN_ADDR; + pstI2c_data[LINEAR_DGAIN_FINE_ADDR].u32RegAddr = sc530AI_2L_DGAIN_FINEADDR; + pstI2c_data[LINEAR_FLIP_MIRROR].u32RegAddr = sc530AI_2L_FLIP_MIRROR_ADDR; + pstI2c_data[LINEAR_VMAX_H_ADDR].u32RegAddr = sc530AI_2L_VMAX_ADDR; + pstI2c_data[LINEAR_VMAX_L_ADDR].u32RegAddr = sc530AI_2L_VMAX_ADDR + 1; + + pstSnsState->bSyncInit = CVI_TRUE; + pstCfg0->snsCfg.need_update = CVI_TRUE; + /* recalcualte WDR size */ + cmos_get_wdr_size(ViPipe, &pstCfg0->ispCfg); + pstCfg0->ispCfg.need_update = CVI_TRUE; + } else { + pstCfg0->snsCfg.need_update = CVI_FALSE; + for (i = 0; i < pstCfg0->snsCfg.u32RegNum; i++) { + if (pstCfg0->snsCfg.astI2cData[i].u32Data == pstCfg1->snsCfg.astI2cData[i].u32Data) { + pstCfg0->snsCfg.astI2cData[i].bUpdate = CVI_FALSE; + } else { + pstCfg0->snsCfg.astI2cData[i].bUpdate = CVI_TRUE; + pstCfg0->snsCfg.need_update = CVI_TRUE; + } + } + /* check update isp crop or not */ + pstCfg0->ispCfg.need_update = (sensor_cmp_wdr_size(&pstCfg0->ispCfg, &pstCfg1->ispCfg) ? + CVI_TRUE : CVI_FALSE); + + /* check update cif wdr manual or not */ + pstCfg0->cifCfg.need_update = (sensor_cmp_cif_wdr(&pstCfg0->cifCfg, &pstCfg1->cifCfg) ? + CVI_TRUE : CVI_FALSE); + } + + pstSnsRegsInfo->bConfig = CVI_FALSE; + memcpy(pstSnsSyncInfo, &pstSnsState->astSyncInfo[0], sizeof(ISP_SNS_SYNC_INFO_S)); + memcpy(&pstSnsState->astSyncInfo[1], &pstSnsState->astSyncInfo[0], sizeof(ISP_SNS_SYNC_INFO_S)); + pstSnsState->au32FL[1] = pstSnsState->au32FL[0]; + pstCfg0->snsCfg.astI2cData[LINEAR_FLIP_MIRROR].bDropFrm = CVI_FALSE; + + return CVI_SUCCESS; +} + +static CVI_S32 cmos_set_image_mode(VI_PIPE ViPipe, ISP_CMOS_SENSOR_IMAGE_MODE_S *pstSensorImageMode) +{ + CVI_U8 u8SensorImageMode = 0; + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + + CMOS_CHECK_POINTER(pstSensorImageMode); + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + u8SensorImageMode = pstSnsState->u8ImgMode; + pstSnsState->bSyncInit = CVI_FALSE; + + if (pstSensorImageMode->f32Fps <= 30) { + if (pstSnsState->enWDRMode == WDR_MODE_NONE) { + if (sc530AI_2L_RES_IS_1620P(pstSensorImageMode->u16Width, pstSensorImageMode->u16Height)) { + u8SensorImageMode = sc530AI_2L_MODE_1620P30; + } else { + CVI_TRACE_SNS(CVI_DBG_ERR, "Not support! Width:%d, Height:%d, Fps:%f, WDRMode:%d\n", + pstSensorImageMode->u16Width, + pstSensorImageMode->u16Height, + pstSensorImageMode->f32Fps, + pstSnsState->enWDRMode); + return CVI_FAILURE; + } + } else { + CVI_TRACE_SNS(CVI_DBG_ERR, "Not support! Width:%d, Height:%d, Fps:%f, WDRMode:%d\n", + pstSensorImageMode->u16Width, + pstSensorImageMode->u16Height, + pstSensorImageMode->f32Fps, + pstSnsState->enWDRMode); + return CVI_FAILURE; + } + } else { + } + + if ((pstSnsState->bInit == CVI_TRUE) && (u8SensorImageMode == pstSnsState->u8ImgMode)) { + /* Don't need to switch SensorImageMode */ + return CVI_FAILURE; + } + + pstSnsState->u8ImgMode = u8SensorImageMode; + + return CVI_SUCCESS; +} + +static CVI_VOID sc530ai_2l_mirror_flip(VI_PIPE ViPipe, ISP_SNS_MIRRORFLIP_TYPE_E eSnsMirrorFlip) +{ + + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + ISP_SNS_REGS_INFO_S *pstSnsRegsInfo = CVI_NULL; + CVI_U8 value = 0; + + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + pstSnsRegsInfo = &pstSnsState->astSyncInfo[0].snsCfg; + if (pstSnsState->bInit == CVI_TRUE && g_aesc530ai_MirrorFip[ViPipe] != eSnsMirrorFlip) { + switch (eSnsMirrorFlip) { + case ISP_SNS_NORMAL: + value |= 0; + break; + case ISP_SNS_MIRROR: + value |= 0x6; + break; + case ISP_SNS_FLIP: + value |= 0x60; + break; + case ISP_SNS_MIRROR_FLIP: + value |= 0x66; + break; + default: + return; + } + + pstSnsRegsInfo->astI2cData[LINEAR_FLIP_MIRROR].u32Data = value; + pstSnsRegsInfo->astI2cData[LINEAR_FLIP_MIRROR].bDropFrm = 1; + pstSnsRegsInfo->astI2cData[LINEAR_FLIP_MIRROR].u8DropFrmNum = 1; + g_aesc530ai_MirrorFip[ViPipe] = eSnsMirrorFlip; + } + +} + +static CVI_VOID sensor_global_init(VI_PIPE ViPipe) +{ + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + const sc530AI_2L_MODE_S *pstMode = CVI_NULL; + + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + pstSnsState->bInit = CVI_FALSE; + pstSnsState->bSyncInit = CVI_FALSE; + pstSnsState->u8ImgMode = sc530AI_2L_MODE_1620P30; + pstSnsState->enWDRMode = WDR_MODE_NONE; + pstMode = &g_astsc530AI_2L_mode[pstSnsState->u8ImgMode]; + pstSnsState->u32FLStd = pstMode->u32VtsDef; + pstSnsState->au32FL[0] = pstMode->u32VtsDef; + pstSnsState->au32FL[1] = pstMode->u32VtsDef; + + memset(&pstSnsState->astSyncInfo[0], 0, sizeof(ISP_SNS_SYNC_INFO_S)); + memset(&pstSnsState->astSyncInfo[1], 0, sizeof(ISP_SNS_SYNC_INFO_S)); +} + +static CVI_S32 sensor_rx_attr(VI_PIPE ViPipe, SNS_COMBO_DEV_ATTR_S *pstRxAttr) +{ + ISP_SNS_STATE_S *pstSnsState = CVI_NULL; + + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + CMOS_CHECK_POINTER(pstRxAttr); + + memcpy(pstRxAttr, &sc530ai_2l_rx_attr, sizeof(*pstRxAttr)); + + pstRxAttr->img_size.width = g_astsc530AI_2L_mode[pstSnsState->u8ImgMode].astImg[0].stSnsSize.u32Width; + pstRxAttr->img_size.height = g_astsc530AI_2L_mode[pstSnsState->u8ImgMode].astImg[0].stSnsSize.u32Height; + if (pstSnsState->enWDRMode == WDR_MODE_NONE) { + pstRxAttr->mipi_attr.wdr_mode = CVI_MIPI_WDR_MODE_NONE; + } + + return CVI_SUCCESS; +} + +static CVI_S32 sensor_patch_rx_attr(RX_INIT_ATTR_S *pstRxInitAttr) +{ + SNS_COMBO_DEV_ATTR_S *pstRxAttr = &sc530ai_2l_rx_attr; + int i; + + CMOS_CHECK_POINTER(pstRxInitAttr); + + if (pstRxInitAttr->stMclkAttr.bMclkEn) + pstRxAttr->mclk.cam = pstRxInitAttr->stMclkAttr.u8Mclk; + + if (pstRxInitAttr->MipiDev >= VI_MAX_DEV_NUM) + return CVI_SUCCESS; + + pstRxAttr->devno = pstRxInitAttr->MipiDev; + + if (pstRxAttr->input_mode == INPUT_MODE_MIPI) { + struct mipi_dev_attr_s *attr = &pstRxAttr->mipi_attr; + + for (i = 0; i < MIPI_LANE_NUM + 1; i++) { + attr->lane_id[i] = pstRxInitAttr->as16LaneId[i]; + attr->pn_swap[i] = pstRxInitAttr->as8PNSwap[i]; + } + } else { + struct lvds_dev_attr_s *attr = &pstRxAttr->lvds_attr; + + for (i = 0; i < MIPI_LANE_NUM + 1; i++) { + attr->lane_id[i] = pstRxInitAttr->as16LaneId[i]; + attr->pn_swap[i] = pstRxInitAttr->as8PNSwap[i]; + } + } + return CVI_SUCCESS; +} + +static CVI_S32 cmos_init_sensor_exp_function(ISP_SENSOR_EXP_FUNC_S *pstSensorExpFunc) +{ + CMOS_CHECK_POINTER(pstSensorExpFunc); + + memset(pstSensorExpFunc, 0, sizeof(ISP_SENSOR_EXP_FUNC_S)); + + pstSensorExpFunc->pfn_cmos_sensor_init = sc530ai_2l_init; + pstSensorExpFunc->pfn_cmos_sensor_exit = sc530ai_2l_exit; + pstSensorExpFunc->pfn_cmos_sensor_global_init = sensor_global_init; + pstSensorExpFunc->pfn_cmos_set_image_mode = cmos_set_image_mode; + pstSensorExpFunc->pfn_cmos_set_wdr_mode = cmos_set_wdr_mode; + + pstSensorExpFunc->pfn_cmos_get_isp_default = cmos_get_isp_default; + pstSensorExpFunc->pfn_cmos_get_isp_black_level = cmos_get_blc_default; + pstSensorExpFunc->pfn_cmos_get_sns_reg_info = cmos_get_sns_regs_info; + + return CVI_SUCCESS; +} + +/**************************************************************************** + * callback structure * + ****************************************************************************/ + +static CVI_S32 sc530ai_set_bus_info(VI_PIPE ViPipe, ISP_SNS_COMMBUS_U unSNSBusInfo) +{ + g_aunsc530AI_2L_BusInfo[ViPipe].s8I2cDev = unSNSBusInfo.s8I2cDev; + + return CVI_SUCCESS; +} + +static CVI_S32 sensor_ctx_init(VI_PIPE ViPipe) +{ + ISP_SNS_STATE_S *pastSnsStateCtx = CVI_NULL; + + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pastSnsStateCtx); + + if (pastSnsStateCtx == CVI_NULL) { + pastSnsStateCtx = (ISP_SNS_STATE_S *)malloc(sizeof(ISP_SNS_STATE_S)); + if (pastSnsStateCtx == CVI_NULL) { + CVI_TRACE_SNS(CVI_DBG_ERR, "Isp[%d] SnsCtx malloc memory failed!\n", ViPipe); + return -ENOMEM; + } + } + + memset(pastSnsStateCtx, 0, sizeof(ISP_SNS_STATE_S)); + + sc530AI_2L_SENSOR_SET_CTX(ViPipe, pastSnsStateCtx); + + return CVI_SUCCESS; +} + +static CVI_VOID sensor_ctx_exit(VI_PIPE ViPipe) +{ + ISP_SNS_STATE_S *pastSnsStateCtx = CVI_NULL; + + sc530AI_2L_SENSOR_GET_CTX(ViPipe, pastSnsStateCtx); + SENSOR_FREE(pastSnsStateCtx); + sc530AI_2L_SENSOR_RESET_CTX(ViPipe); +} + +static CVI_S32 sensor_register_callback(VI_PIPE ViPipe, ALG_LIB_S *pstAeLib, ALG_LIB_S *pstAwbLib) +{ + CVI_S32 s32Ret; + ISP_SENSOR_REGISTER_S stIspRegister; + AE_SENSOR_REGISTER_S stAeRegister; + AWB_SENSOR_REGISTER_S stAwbRegister; + ISP_SNS_ATTR_INFO_S stSnsAttrInfo; + + CMOS_CHECK_POINTER(pstAeLib); + CMOS_CHECK_POINTER(pstAwbLib); + + s32Ret = sensor_ctx_init(ViPipe); + + if (s32Ret != CVI_SUCCESS) + return CVI_FAILURE; + + stSnsAttrInfo.eSensorId = sc530AI_2L_ID; + + s32Ret = cmos_init_sensor_exp_function(&stIspRegister.stSnsExp); + s32Ret |= CVI_ISP_SensorRegCallBack(ViPipe, &stSnsAttrInfo, &stIspRegister); + + if (s32Ret != CVI_SUCCESS) { + CVI_TRACE_SNS(CVI_DBG_ERR, "sensor register callback function failed!\n"); + return s32Ret; + } + + s32Ret = cmos_init_ae_exp_function(&stAeRegister.stAeExp); + s32Ret |= CVI_AE_SensorRegCallBack(ViPipe, pstAeLib, &stSnsAttrInfo, &stAeRegister); + + if (s32Ret != CVI_SUCCESS) { + CVI_TRACE_SNS(CVI_DBG_ERR, "sensor register callback function to ae lib failed!\n"); + return s32Ret; + } + + s32Ret = cmos_init_awb_exp_function(&stAwbRegister.stAwbExp); + s32Ret |= CVI_AWB_SensorRegCallBack(ViPipe, pstAwbLib, &stSnsAttrInfo, &stAwbRegister); + + if (s32Ret != CVI_SUCCESS) { + CVI_TRACE_SNS(CVI_DBG_ERR, "sensor register callback function to awb lib failed!\n"); + return s32Ret; + } + + return CVI_SUCCESS; +} + +static CVI_S32 sensor_unregister_callback(VI_PIPE ViPipe, ALG_LIB_S *pstAeLib, ALG_LIB_S *pstAwbLib) +{ + CVI_S32 s32Ret; + + CMOS_CHECK_POINTER(pstAeLib); + CMOS_CHECK_POINTER(pstAwbLib); + + s32Ret = CVI_ISP_SensorUnRegCallBack(ViPipe, sc530AI_2L_ID); + if (s32Ret != CVI_SUCCESS) { + CVI_TRACE_SNS(CVI_DBG_ERR, "sensor unregister callback function failed!\n"); + return s32Ret; + } + + s32Ret = CVI_AE_SensorUnRegCallBack(ViPipe, pstAeLib, sc530AI_2L_ID); + if (s32Ret != CVI_SUCCESS) { + CVI_TRACE_SNS(CVI_DBG_ERR, "sensor unregister callback function to ae lib failed!\n"); + return s32Ret; + } + + s32Ret = CVI_AWB_SensorUnRegCallBack(ViPipe, pstAwbLib, sc530AI_2L_ID); + if (s32Ret != CVI_SUCCESS) { + CVI_TRACE_SNS(CVI_DBG_ERR, "sensor unregister callback function to awb lib failed!\n"); + return s32Ret; + } + + sensor_ctx_exit(ViPipe); + + return CVI_SUCCESS; +} + +static CVI_S32 sensor_set_init(VI_PIPE ViPipe, ISP_INIT_ATTR_S *pstInitAttr) +{ + CMOS_CHECK_POINTER(pstInitAttr); + + g_au32InitExposure[ViPipe] = pstInitAttr->u32Exposure; + g_au32LinesPer500ms[ViPipe] = pstInitAttr->u32LinesPer500ms; + g_au16InitWBGain[ViPipe][0] = pstInitAttr->u16WBRgain; + g_au16InitWBGain[ViPipe][1] = pstInitAttr->u16WBGgain; + g_au16InitWBGain[ViPipe][2] = pstInitAttr->u16WBBgain; + g_au16SampleRgain[ViPipe] = pstInitAttr->u16SampleRgain; + g_au16SampleBgain[ViPipe] = pstInitAttr->u16SampleBgain; + g_au16sc530AI_2L_GainMode[ViPipe] = pstInitAttr->enGainMode; + g_au16sc530AI_2L_L2SMode[ViPipe] = pstInitAttr->enL2SMode; + + return CVI_SUCCESS; +} + +ISP_SNS_OBJ_S stSnsSC530AI_2L_Obj = { + .pfnRegisterCallback = sensor_register_callback, + .pfnUnRegisterCallback = sensor_unregister_callback, + .pfnStandby = sc530ai_2l_standby, + .pfnRestart = sc530ai_2l_restart, + .pfnMirrorFlip = sc530ai_2l_mirror_flip, + .pfnWriteReg = sc530ai_2l_write_register, + .pfnReadReg = sc530ai_2l_read_register, + .pfnSetBusInfo = sc530ai_set_bus_info, + .pfnSetInit = sensor_set_init, + .pfnPatchRxAttr = sensor_patch_rx_attr, + .pfnPatchI2cAddr = CVI_NULL, + .pfnGetRxAttr = sensor_rx_attr, + .pfnExpSensorCb = cmos_init_sensor_exp_function, + .pfnExpAeCb = cmos_init_ae_exp_function, + .pfnSnsProbe = sc530ai_2l_probe, +}; + diff --git a/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_cmos_ex.h b/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_cmos_ex.h new file mode 100644 index 00000000..fce9ab67 --- /dev/null +++ b/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_cmos_ex.h @@ -0,0 +1,84 @@ +#ifndef __SC530AI_2L_CMOS_EX_H_ +#define __SC530AI_2L_CMOS_EX_H_ + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +#ifdef ARCH_CV182X +#include +#include +#include "cvi_type.h" +#else +#include +#include +#include +#endif +#include "cvi_sns_ctrl.h" + + +enum sc530ai_2l_linear_regs_e { + LINEAR_SHS1_0_ADDR, + LINEAR_SHS1_1_ADDR, + LINEAR_SHS1_2_ADDR, + LINEAR_AGAIN_ADDR, + LINEAR_DGAIN_ADDR, + LINEAR_DGAIN_FINE_ADDR, + LINEAR_FLIP_MIRROR, + LINEAR_VMAX_H_ADDR, + LINEAR_VMAX_L_ADDR, + LINEAR_REGS_NUM +}; + +typedef enum _sc530AI_2L_MODE_E { + sc530AI_2L_MODE_1620P30 = 0, + sc530AI_2L_MODE_LINEAR_NUM, + sc530AI_2L_MODE_NUM +} sc530AI_2L_MODE_E; + +typedef struct _sc530AI_2L_STATE_S { + CVI_U32 u32Sexp_MAX; +} sc530AI_2L_STATE_S; + +typedef struct _sc530AI_2L_MODE_S { + ISP_WDR_SIZE_S astImg[2]; + CVI_FLOAT f32MaxFps; + CVI_FLOAT f32MinFps; + CVI_U32 u32HtsDef; + CVI_U32 u32VtsDef; + SNS_ATTR_S stExp[2]; + SNS_ATTR_LARGE_S stAgain[2]; + SNS_ATTR_LARGE_S stDgain[2]; + CVI_U16 u16SexpMaxReg; + char name[64]; +} sc530AI_2L_MODE_S; + +/**************************************************************************** + * external variables and functions * + ****************************************************************************/ + +extern ISP_SNS_STATE_S *g_pastsc530AI_2L[VI_MAX_PIPE_NUM]; +extern ISP_SNS_COMMBUS_U g_aunsc530AI_2L_BusInfo[]; +extern CVI_U16 g_au16sc530AI_2L_GainMode[]; +extern CVI_U16 g_au16sc530AI_2L_L2SMode[]; +extern const CVI_U8 sc530ai_2l_i2c_addr; +extern const CVI_U32 sc530ai_2l_addr_byte; +extern const CVI_U32 sc530ai_2l_data_byte; +extern void sc530ai_2l_init(VI_PIPE ViPipe); +extern void sc530ai_2l_exit(VI_PIPE ViPipe); +extern void sc530ai_2l_standby(VI_PIPE ViPipe); +extern void sc530ai_2l_restart(VI_PIPE ViPipe); +extern int sc530ai_2l_write_register(VI_PIPE ViPipe, int addr, int data); +extern int sc530ai_2l_read_register(VI_PIPE ViPipe, int addr); +extern int sc530ai_2l_probe(VI_PIPE ViPipe); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ + + +#endif /* __sc530AI_2L_CMOS_EX_H_ */ diff --git a/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_cmos_param.h b/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_cmos_param.h new file mode 100644 index 00000000..a0e31855 --- /dev/null +++ b/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_cmos_param.h @@ -0,0 +1,225 @@ +#ifndef __SC530AI_2L_CMOS_PARAM_H_ +#define __SC530AI_2L_CMOS_PARAM_H_ + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +#ifdef ARCH_CV182X +#include +#include +#include "cvi_type.h" +#else +#include +#include +#include +#endif +#include "cvi_sns_ctrl.h" +#include "sc530ai_2L_cmos_ex.h" + +static const sc530AI_2L_MODE_S g_astsc530AI_2L_mode[sc530AI_2L_MODE_NUM] = { + [sc530AI_2L_MODE_1620P30] = { + .name = "1620p30", + .astImg[0] = { + .stSnsSize = { + .u32Width = 2880, + .u32Height = 1620, + }, + .stWndRect = { + .s32X = 0, + .s32Y = 0, + .u32Width = 2880, + .u32Height = 1620, + }, + .stMaxSize = { + .u32Width = 2880, + .u32Height = 1620, + }, + }, + .f32MaxFps = 30, + .f32MinFps = 1.52, /* 1650 * 30 / 0x7FFF*/ + .u32HtsDef = 2560, /* NA */ + .u32VtsDef = 1650, + .stExp[0] = { + .u16Min = 3, + .u16Max = 3290,/* 2*vts-10 */ + .u16Def = 400, + .u16Step = 1, + }, + .stAgain[0] = { + .u32Min = 1024, + .u32Max = 78315, + .u32Def = 1024, + .u32Step = 1, + }, + .stDgain[0] = { + .u32Min = 1024, + .u32Max = 4032, + .u32Def = 1024, + .u32Step = 1, + }, + }, +}; + +static ISP_CMOS_NOISE_CALIBRATION_S g_stIspNoiseCalibratio = {.CalibrationCoef = { + { //iso 100 + {0.02792946062982082367, 3.36534714698791503906}, //B: slope, intercept + {0.02071751467883586884, 5.34583568572998046875}, //Gb: slope, intercept + {0.02110148966312408447, 5.02954530715942382813}, //Gr: slope, intercept + {0.02168512716889381409, 4.89776754379272460938}, //R: slope, intercept + }, + { //iso 200 + {0.03194080293178558350, 5.61192893981933593750}, //B: slope, intercept + {0.02428408525884151459, 7.94834280014038085938}, //Gb: slope, intercept + {0.02499442733824253082, 7.72430133819580078125}, //Gr: slope, intercept + {0.02584112435579299927, 7.20574426651000976563}, //R: slope, intercept + }, + { //iso 400 + {0.04612467437982559204, 6.88752269744873046875}, //B: slope, intercept + {0.03022909909486770630, 11.05101776123046875000}, //Gb: slope, intercept + {0.03175539523363113403, 10.60332489013671875000}, //Gr: slope, intercept + {0.03522306308150291443, 9.36425399780273437500}, //R: slope, intercept + }, + { //iso 800 + {0.06092500314116477966, 9.79670524597167968750}, //B: slope, intercept + {0.03984217345714569092, 15.30182266235351562500}, //Gb: slope, intercept + {0.04019560664892196655, 14.93132972717285156250}, //Gr: slope, intercept + {0.04470816254615783691, 13.26843166351318359375}, //R: slope, intercept + }, + { //iso 1600 + {0.08295634388923645020, 14.20334625244140625000}, //B: slope, intercept + {0.05075264349579811096, 20.99221038818359375000}, //Gb: slope, intercept + {0.05426201224327087402, 20.08068656921386718750}, //Gr: slope, intercept + {0.05945669487118721008, 19.02898788452148437500}, //R: slope, intercept + }, + { //iso 3200 + {0.09782519936561584473, 21.84967994689941406250}, //B: slope, intercept + {0.06690908223390579224, 26.53993988037109375000}, //Gb: slope, intercept + {0.06954573839902877808, 25.74129104614257812500}, //Gr: slope, intercept + {0.09061723947525024414, 22.98998260498046875000}, //R: slope, intercept + }, + { //iso 6400 + {0.14311420917510986328, 28.96467971801757812500}, //B: slope, intercept + {0.08148498833179473877, 37.93062591552734375000}, //Gb: slope, intercept + {0.08273542672395706177, 38.37096405029296875000}, //Gr: slope, intercept + {0.12093253433704376221, 33.31475067138671875000}, //R: slope, intercept + }, + { //iso 12800 + {0.17958122491836547852, 43.49506759643554687500}, //B: slope, intercept + {0.09839969873428344727, 55.43268966674804687500}, //Gb: slope, intercept + {0.10201884806156158447, 52.97607040405273437500}, //Gr: slope, intercept + {0.15302789211273193359, 47.54779434204101562500}, //R: slope, intercept + }, + { //iso 25600 + {0.25833165645599365234, 56.96470642089843750000}, //B: slope, intercept + {0.13260601460933685303, 74.69016265869140625000}, //Gb: slope, intercept + {0.14035490155220031738, 75.44366455078125000000}, //Gr: slope, intercept + {0.23465165495872497559, 60.52228164672851562500}, //R: slope, intercept + }, + { //iso 51200 + {0.37595292925834655762, 78.54853057861328125000}, //B: slope, intercept + {0.21475413441658020020, 102.12300872802734375000}, //Gb: slope, intercept + {0.20840260386466979980, 103.65763854980468750000}, //Gr: slope, intercept + {0.34428051114082336426, 87.83551025390625000000}, //R: slope, intercept + }, + { //iso 102400 + {0.51122575998306274414, 113.49224090576171875000}, //B: slope, intercept + {0.29245173931121826172, 154.26939392089843750000}, //Gb: slope, intercept + {0.31501635909080505371, 148.29017639160156250000}, //Gr: slope, intercept + {0.47034618258476257324, 124.06208038330078125000}, //R: slope, intercept + }, + { //iso 204800 + {0.67213481664657592773, 134.71751403808593750000}, //B: slope, intercept + {0.40368056297302246094, 189.80801391601562500000}, //Gb: slope, intercept + {0.43581819534301757813, 186.44682312011718750000}, //Gr: slope, intercept + {0.60127359628677368164, 160.66384887695312500000}, //R: slope, intercept + }, + { //iso 409600 + {0.81907004117965698242, 103.53753662109375000000}, //B: slope, intercept + {0.56758689880371093750, 134.64016723632812500000}, //Gb: slope, intercept + {0.60227775573730468750, 125.39395904541015625000}, //Gr: slope, intercept + {0.76318585872650146484, 111.18676757812500000000}, //R: slope, intercept + }, + { //iso 819200 + {0.81907004117965698242, 103.53753662109375000000}, //B: slope, intercept + {0.56758689880371093750, 134.64016723632812500000}, //Gb: slope, intercept + {0.60227775573730468750, 125.39395904541015625000}, //Gr: slope, intercept + {0.76318585872650146484, 111.18676757812500000000}, //R: slope, intercept + }, + { //iso 1638400 + {0.81907004117965698242, 103.53753662109375000000}, //B: slope, intercept + {0.56758689880371093750, 134.64016723632812500000}, //Gb: slope, intercept + {0.60227775573730468750, 125.39395904541015625000}, //Gr: slope, intercept + {0.76318585872650146484, 111.18676757812500000000}, //R: slope, intercept + }, + { //iso 3276800 + {0.81907004117965698242, 103.53753662109375000000}, //B: slope, intercept + {0.56758689880371093750, 134.64016723632812500000}, //Gb: slope, intercept + {0.60227775573730468750, 125.39395904541015625000}, //Gr: slope, intercept + {0.76318585872650146484, 111.18676757812500000000}, //R: slope, intercept + }, +} }; + +static ISP_CMOS_BLACK_LEVEL_S g_stIspBlcCalibratio = { + .bUpdate = CVI_TRUE, + .blcAttr = { + .Enable = 1, + .enOpType = OP_TYPE_AUTO, + .stManual = {260, 260, 260, 260, 0, 0, 0, 0 +#ifdef ARCH_CV182X + , 1093, 1093, 1093, 1093 +#endif + }, + .stAuto = { + {260, 260, 260, 260, 260, 260, 260, 260, /*8*/260, 260, 260, 260, 260, 260, 260, 260}, + {260, 260, 260, 260, 260, 260, 260, 260, /*8*/260, 260, 260, 260, 260, 260, 260, 260}, + {260, 260, 260, 260, 260, 260, 260, 260, /*8*/260, 260, 260, 260, 260, 260, 260, 260}, + {260, 260, 260, 260, 260, 260, 260, 260, /*8*/260, 260, 260, 260, 260, 260, 260, 260}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, +#ifdef ARCH_CV182X + {1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, + /*8*/1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093}, + {1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, + /*8*/1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093}, + {1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, + /*8*/1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093}, + {1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, + /*8*/1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093}, +#endif + }, + }, +}; + +struct combo_dev_attr_s sc530ai_2l_rx_attr = { + .input_mode = INPUT_MODE_MIPI, + .mac_clk = RX_MAC_CLK_200M, + .mipi_attr = { + .raw_data_type = RAW_DATA_10BIT, + .lane_id = {1, 2, 0, -1, -1}, + .pn_swap = {1, 1, 1, 0, 0}, + .wdr_mode = CVI_MIPI_WDR_MODE_VC, + .dphy = { + .enable = 1, + .hs_settle = 14, + }, + }, + .mclk = { + .cam = 0, + .freq = CAMPLL_FREQ_27M, + }, + .devno = 0, +}; + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ + + +#endif /* __sc530AI_2L_CMOS_PARAM_H_ */ diff --git a/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_sensor_ctl.c b/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_sensor_ctl.c new file mode 100644 index 00000000..662b56f2 --- /dev/null +++ b/external/SensorSupportList/sensor/cv182x/sms_sc530ai_2L/sc530ai_2L_sensor_ctl.c @@ -0,0 +1,377 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef ARCH_CV182X +#include +#include "cvi_comm_video.h" +#else +#include +#include +#endif +#include "cvi_sns_ctrl.h" +#include "sc530ai_2L_cmos_ex.h" + +static void sc530ai_2l_linear_1620p30_init(VI_PIPE ViPipe); + +const CVI_U8 sc530ai_2l_i2c_addr = 0x30; /* I2C Address of sc530AI_2L */ +const CVI_U32 sc530ai_2l_addr_byte = 2; +const CVI_U32 sc530ai_2l_data_byte = 1; +static int g_fd[VI_MAX_PIPE_NUM] = {[0 ... (VI_MAX_PIPE_NUM - 1)] = -1}; + +int sc530ai_2l_i2c_init(VI_PIPE ViPipe) +{ + char acDevFile[16] = {0}; + CVI_U8 u8DevNum; + + if (g_fd[ViPipe] >= 0) + return CVI_SUCCESS; + int ret; + + u8DevNum = g_aunsc530AI_2L_BusInfo[ViPipe].s8I2cDev; + snprintf(acDevFile, sizeof(acDevFile), "/dev/i2c-%u", u8DevNum); + + g_fd[ViPipe] = open(acDevFile, O_RDWR, 0600); + + if (g_fd[ViPipe] < 0) { + CVI_TRACE_SNS(CVI_DBG_ERR, "Open /dev/cvi_i2c_drv-%u error!\n", u8DevNum); + return CVI_FAILURE; + } + + ret = ioctl(g_fd[ViPipe], I2C_SLAVE_FORCE, sc530ai_2l_i2c_addr); + if (ret < 0) { + CVI_TRACE_SNS(CVI_DBG_ERR, "I2C_SLAVE_FORCE error!\n"); + close(g_fd[ViPipe]); + g_fd[ViPipe] = -1; + return ret; + } + + return CVI_SUCCESS; +} + +int sc530ai_2l_i2c_exit(VI_PIPE ViPipe) +{ + if (g_fd[ViPipe] >= 0) { + close(g_fd[ViPipe]); + g_fd[ViPipe] = -1; + return CVI_SUCCESS; + } + return CVI_FAILURE; +} + +int sc530ai_2l_read_register(VI_PIPE ViPipe, int addr) +{ + int ret, data; + CVI_U8 buf[8]; + CVI_U8 idx = 0; + + if (g_fd[ViPipe] < 0) + return CVI_FAILURE; + + if (sc530ai_2l_addr_byte == 2) + buf[idx++] = (addr >> 8) & 0xff; + + // add address byte 0 + buf[idx++] = addr & 0xff; + + ret = write(g_fd[ViPipe], buf, sc530ai_2l_addr_byte); + if (ret < 0) { + CVI_TRACE_SNS(CVI_DBG_ERR, "I2C_WRITE error!\n"); + return ret; + } + + buf[0] = 0; + buf[1] = 0; + ret = read(g_fd[ViPipe], buf, sc530ai_2l_data_byte); + if (ret < 0) { + CVI_TRACE_SNS(CVI_DBG_ERR, "I2C_READ error!\n"); + return ret; + } + + // pack read back data + data = 0; + if (sc530ai_2l_data_byte == 2) { + data = buf[0] << 8; + data += buf[1]; + } else { + data = buf[0]; + } + + // syslog(LOG_DEBUG, "i2c r 0x%x = 0x%x\n", addr, data); + return data; +} + +int sc530ai_2l_write_register(VI_PIPE ViPipe, int addr, int data) +{ + int idx = 0; + int ret; + char buf[8]; + + if (g_fd[ViPipe] < 0) + return CVI_SUCCESS; + + if (sc530ai_2l_addr_byte == 2) { + buf[idx] = (addr >> 8) & 0xff; + idx++; + buf[idx] = addr & 0xff; + idx++; + } + + if (sc530ai_2l_data_byte == 1) { + buf[idx] = data & 0xff; + idx++; + } + + ret = write(g_fd[ViPipe], buf, sc530ai_2l_addr_byte + sc530ai_2l_data_byte); + if (ret < 0) { + CVI_TRACE_SNS(CVI_DBG_ERR, "I2C_WRITE error!\n"); + return CVI_FAILURE; + } + // syslog(LOG_DEBUG, "i2c w 0x%x 0x%x\n", addr, data); + return CVI_SUCCESS; +} + +static void delay_ms(int ms) +{ + usleep(ms * 1000); +} + +void sc530ai_2l_standby(VI_PIPE ViPipe) +{ + sc530ai_2l_write_register(ViPipe, 0x0100, 0x00); +} + +void sc530ai_2l_restart(VI_PIPE ViPipe) +{ + sc530ai_2l_write_register(ViPipe, 0x0100, 0x00); + delay_ms(20); + sc530ai_2l_write_register(ViPipe, 0x0100, 0x01); +} + +void sc530ai_2l_default_reg_init(VI_PIPE ViPipe) +{ + CVI_U32 i; + + for (i = 0; i < g_pastsc530AI_2L[ViPipe]->astSyncInfo[0].snsCfg.u32RegNum; i++) { + sc530ai_2l_write_register(ViPipe, + g_pastsc530AI_2L[ViPipe]->astSyncInfo[0].snsCfg.astI2cData[i].u32RegAddr, + g_pastsc530AI_2L[ViPipe]->astSyncInfo[0].snsCfg.astI2cData[i].u32Data); + } +} + +#define sc530AI_2L_CHIP_ID_HI_ADDR 0x3107 +#define sc530AI_2L_CHIP_ID_LO_ADDR 0x3108 +#define sc530AI_2L_CHIP_ID 0x8e39 + +int sc530ai_2l_probe(VI_PIPE ViPipe) +{ + int nVal; + CVI_U16 chip_id; + + usleep(4*1000); + if (sc530ai_2l_i2c_init(ViPipe) != CVI_SUCCESS) + return CVI_FAILURE; + + nVal = sc530ai_2l_read_register(ViPipe, sc530AI_2L_CHIP_ID_HI_ADDR); + if (nVal < 0) { + CVI_TRACE_SNS(CVI_DBG_ERR, "read sensor id error.\n"); + return nVal; + } + chip_id = (nVal & 0xFF) << 8; + nVal = sc530ai_2l_read_register(ViPipe, sc530AI_2L_CHIP_ID_LO_ADDR); + if (nVal < 0) { + CVI_TRACE_SNS(CVI_DBG_ERR, "read sensor id error.\n"); + return nVal; + } + chip_id |= (nVal & 0xFF); + + if (chip_id != sc530AI_2L_CHIP_ID) { + CVI_TRACE_SNS(CVI_DBG_ERR, "Sensor ID Mismatch! Use the wrong sensor??\n"); + return CVI_FAILURE; + } + + return CVI_SUCCESS; +} + + +void sc530ai_2l_init(VI_PIPE ViPipe) +{ + sc530ai_2l_i2c_init(ViPipe); + + sc530ai_2l_linear_1620p30_init(ViPipe); + + g_pastsc530AI_2L[ViPipe]->bInit = CVI_TRUE; +} + +void sc530ai_2l_exit(VI_PIPE ViPipe) +{ + sc530ai_2l_i2c_exit(ViPipe); +} + +/* 1620P30 */ +static void sc530ai_2l_linear_1620p30_init(VI_PIPE ViPipe) +{ + sc530ai_2l_write_register(ViPipe, 0x0103, 0x01); + sc530ai_2l_write_register(ViPipe, 0x0100, 0x00); + sc530ai_2l_write_register(ViPipe, 0x36e9, 0x80); + sc530ai_2l_write_register(ViPipe, 0x37f9, 0x80); + sc530ai_2l_write_register(ViPipe, 0x3018, 0x32); + sc530ai_2l_write_register(ViPipe, 0x3019, 0x0c); + sc530ai_2l_write_register(ViPipe, 0x301f, 0x69); + sc530ai_2l_write_register(ViPipe, 0x3250, 0x40); + sc530ai_2l_write_register(ViPipe, 0x3251, 0x98); + sc530ai_2l_write_register(ViPipe, 0x3253, 0x0c); + sc530ai_2l_write_register(ViPipe, 0x325f, 0x20); + sc530ai_2l_write_register(ViPipe, 0x3301, 0x08); + sc530ai_2l_write_register(ViPipe, 0x3304, 0x50); + sc530ai_2l_write_register(ViPipe, 0x3306, 0x88); + sc530ai_2l_write_register(ViPipe, 0x3308, 0x14); + sc530ai_2l_write_register(ViPipe, 0x3309, 0x70); + sc530ai_2l_write_register(ViPipe, 0x330a, 0x00); + sc530ai_2l_write_register(ViPipe, 0x330b, 0xf8); + sc530ai_2l_write_register(ViPipe, 0x330d, 0x10); + sc530ai_2l_write_register(ViPipe, 0x330e, 0x42); + sc530ai_2l_write_register(ViPipe, 0x331e, 0x41); + sc530ai_2l_write_register(ViPipe, 0x331f, 0x61); + sc530ai_2l_write_register(ViPipe, 0x3333, 0x10); + sc530ai_2l_write_register(ViPipe, 0x335d, 0x60); + sc530ai_2l_write_register(ViPipe, 0x335e, 0x06); + sc530ai_2l_write_register(ViPipe, 0x335f, 0x08); + sc530ai_2l_write_register(ViPipe, 0x3364, 0x56); + sc530ai_2l_write_register(ViPipe, 0x3366, 0x01); + sc530ai_2l_write_register(ViPipe, 0x337c, 0x02); + sc530ai_2l_write_register(ViPipe, 0x337d, 0x0a); + sc530ai_2l_write_register(ViPipe, 0x3390, 0x01); + sc530ai_2l_write_register(ViPipe, 0x3391, 0x03); + sc530ai_2l_write_register(ViPipe, 0x3392, 0x07); + sc530ai_2l_write_register(ViPipe, 0x3393, 0x08); + sc530ai_2l_write_register(ViPipe, 0x3394, 0x08); + sc530ai_2l_write_register(ViPipe, 0x3395, 0x08); + sc530ai_2l_write_register(ViPipe, 0x3396, 0x40); + sc530ai_2l_write_register(ViPipe, 0x3397, 0x48); + sc530ai_2l_write_register(ViPipe, 0x3398, 0x4b); + sc530ai_2l_write_register(ViPipe, 0x3399, 0x08); + sc530ai_2l_write_register(ViPipe, 0x339a, 0x08); + sc530ai_2l_write_register(ViPipe, 0x339b, 0x08); + sc530ai_2l_write_register(ViPipe, 0x339c, 0x1d); + sc530ai_2l_write_register(ViPipe, 0x33a2, 0x04); + sc530ai_2l_write_register(ViPipe, 0x33ae, 0x30); + sc530ai_2l_write_register(ViPipe, 0x33af, 0x50); + sc530ai_2l_write_register(ViPipe, 0x33b1, 0x80); + sc530ai_2l_write_register(ViPipe, 0x33b2, 0x48); + sc530ai_2l_write_register(ViPipe, 0x33b3, 0x30); + sc530ai_2l_write_register(ViPipe, 0x349f, 0x02); + sc530ai_2l_write_register(ViPipe, 0x34a6, 0x48); + sc530ai_2l_write_register(ViPipe, 0x34a7, 0x4b); + sc530ai_2l_write_register(ViPipe, 0x34a8, 0x30); + sc530ai_2l_write_register(ViPipe, 0x34a9, 0x18); + sc530ai_2l_write_register(ViPipe, 0x34f8, 0x5f); + sc530ai_2l_write_register(ViPipe, 0x34f9, 0x08); + sc530ai_2l_write_register(ViPipe, 0x3632, 0x48); + sc530ai_2l_write_register(ViPipe, 0x3633, 0x32); + sc530ai_2l_write_register(ViPipe, 0x3637, 0x27); + sc530ai_2l_write_register(ViPipe, 0x3638, 0xc1); + sc530ai_2l_write_register(ViPipe, 0x363b, 0x20); + sc530ai_2l_write_register(ViPipe, 0x363d, 0x02); + sc530ai_2l_write_register(ViPipe, 0x3670, 0x09); + sc530ai_2l_write_register(ViPipe, 0x3674, 0x8b); + sc530ai_2l_write_register(ViPipe, 0x3675, 0xc6); + sc530ai_2l_write_register(ViPipe, 0x3676, 0x8b); + sc530ai_2l_write_register(ViPipe, 0x367c, 0x40); + sc530ai_2l_write_register(ViPipe, 0x367d, 0x48); + sc530ai_2l_write_register(ViPipe, 0x3690, 0x32); + sc530ai_2l_write_register(ViPipe, 0x3691, 0x43); + sc530ai_2l_write_register(ViPipe, 0x3692, 0x33); + sc530ai_2l_write_register(ViPipe, 0x3693, 0x40); + sc530ai_2l_write_register(ViPipe, 0x3694, 0x4b); + sc530ai_2l_write_register(ViPipe, 0x3698, 0x85); + sc530ai_2l_write_register(ViPipe, 0x3699, 0x8f); + sc530ai_2l_write_register(ViPipe, 0x369a, 0xa0); + sc530ai_2l_write_register(ViPipe, 0x369b, 0xc3); + sc530ai_2l_write_register(ViPipe, 0x36a2, 0x49); + sc530ai_2l_write_register(ViPipe, 0x36a3, 0x4b); + sc530ai_2l_write_register(ViPipe, 0x36a4, 0x4f); + sc530ai_2l_write_register(ViPipe, 0x36d0, 0x01); + sc530ai_2l_write_register(ViPipe, 0x36ea, 0x0b); + sc530ai_2l_write_register(ViPipe, 0x36eb, 0x04); + sc530ai_2l_write_register(ViPipe, 0x36ec, 0x03); + sc530ai_2l_write_register(ViPipe, 0x36ed, 0x14); + sc530ai_2l_write_register(ViPipe, 0x370f, 0x01); + sc530ai_2l_write_register(ViPipe, 0x3722, 0x00); + sc530ai_2l_write_register(ViPipe, 0x3728, 0x10); + sc530ai_2l_write_register(ViPipe, 0x37b0, 0x03); + sc530ai_2l_write_register(ViPipe, 0x37b1, 0x03); + sc530ai_2l_write_register(ViPipe, 0x37b2, 0x83); + sc530ai_2l_write_register(ViPipe, 0x37b3, 0x48); + sc530ai_2l_write_register(ViPipe, 0x37b4, 0x49); + sc530ai_2l_write_register(ViPipe, 0x37fa, 0x0b); + sc530ai_2l_write_register(ViPipe, 0x37fb, 0x24); + sc530ai_2l_write_register(ViPipe, 0x37fc, 0x01); + sc530ai_2l_write_register(ViPipe, 0x37fd, 0x14); + sc530ai_2l_write_register(ViPipe, 0x3901, 0x00); + sc530ai_2l_write_register(ViPipe, 0x3902, 0xc5); + sc530ai_2l_write_register(ViPipe, 0x3904, 0x08); + sc530ai_2l_write_register(ViPipe, 0x3905, 0x8c); + sc530ai_2l_write_register(ViPipe, 0x3909, 0x00); + sc530ai_2l_write_register(ViPipe, 0x391d, 0x04); + sc530ai_2l_write_register(ViPipe, 0x391f, 0x44); + sc530ai_2l_write_register(ViPipe, 0x3926, 0x21); + sc530ai_2l_write_register(ViPipe, 0x3929, 0x18); + sc530ai_2l_write_register(ViPipe, 0x3933, 0x82); + sc530ai_2l_write_register(ViPipe, 0x3934, 0x0a); + sc530ai_2l_write_register(ViPipe, 0x3937, 0x5f); + sc530ai_2l_write_register(ViPipe, 0x3939, 0x00); + sc530ai_2l_write_register(ViPipe, 0x393a, 0x00); + sc530ai_2l_write_register(ViPipe, 0x39dc, 0x02); + sc530ai_2l_write_register(ViPipe, 0x3e01, 0xcd); + sc530ai_2l_write_register(ViPipe, 0x3e02, 0xa0); + sc530ai_2l_write_register(ViPipe, 0x440e, 0x02); + sc530ai_2l_write_register(ViPipe, 0x4509, 0x20); + sc530ai_2l_write_register(ViPipe, 0x4837, 0x14); + sc530ai_2l_write_register(ViPipe, 0x5010, 0x10); + sc530ai_2l_write_register(ViPipe, 0x5780, 0x66); + sc530ai_2l_write_register(ViPipe, 0x578d, 0x40); + sc530ai_2l_write_register(ViPipe, 0x5799, 0x06); + sc530ai_2l_write_register(ViPipe, 0x57ad, 0x00); + sc530ai_2l_write_register(ViPipe, 0x5ae0, 0xfe); + sc530ai_2l_write_register(ViPipe, 0x5ae1, 0x40); + sc530ai_2l_write_register(ViPipe, 0x5ae2, 0x30); + sc530ai_2l_write_register(ViPipe, 0x5ae3, 0x2a); + sc530ai_2l_write_register(ViPipe, 0x5ae4, 0x24); + sc530ai_2l_write_register(ViPipe, 0x5ae5, 0x30); + sc530ai_2l_write_register(ViPipe, 0x5ae6, 0x2a); + sc530ai_2l_write_register(ViPipe, 0x5ae7, 0x24); + sc530ai_2l_write_register(ViPipe, 0x5ae8, 0x3c); + sc530ai_2l_write_register(ViPipe, 0x5ae9, 0x30); + sc530ai_2l_write_register(ViPipe, 0x5aea, 0x28); + sc530ai_2l_write_register(ViPipe, 0x5aeb, 0x3c); + sc530ai_2l_write_register(ViPipe, 0x5aec, 0x30); + sc530ai_2l_write_register(ViPipe, 0x5aed, 0x28); + sc530ai_2l_write_register(ViPipe, 0x5aee, 0xfe); + sc530ai_2l_write_register(ViPipe, 0x5aef, 0x40); + sc530ai_2l_write_register(ViPipe, 0x5af4, 0x30); + sc530ai_2l_write_register(ViPipe, 0x5af5, 0x2a); + sc530ai_2l_write_register(ViPipe, 0x5af6, 0x24); + sc530ai_2l_write_register(ViPipe, 0x5af7, 0x30); + sc530ai_2l_write_register(ViPipe, 0x5af8, 0x2a); + sc530ai_2l_write_register(ViPipe, 0x5af9, 0x24); + sc530ai_2l_write_register(ViPipe, 0x5afa, 0x3c); + sc530ai_2l_write_register(ViPipe, 0x5afb, 0x30); + sc530ai_2l_write_register(ViPipe, 0x5afc, 0x28); + sc530ai_2l_write_register(ViPipe, 0x5afd, 0x3c); + sc530ai_2l_write_register(ViPipe, 0x5afe, 0x30); + sc530ai_2l_write_register(ViPipe, 0x5aff, 0x28); + sc530ai_2l_write_register(ViPipe, 0x36e9, 0x44); + sc530ai_2l_write_register(ViPipe, 0x37f9, 0x44); + + sc530ai_2l_default_reg_init(ViPipe); + + sc530ai_2l_write_register(ViPipe, 0x0100, 0x01); + + printf("ViPipe:%d,===sc530AI_2L 1620P 30fps 10bit LINE Init OK!===\n", ViPipe); +} diff --git a/external/br2-external/libhv/Config.in b/external/br2-external/libhv/Config.in index c38b2981..65e35de7 100644 --- a/external/br2-external/libhv/Config.in +++ b/external/br2-external/libhv/Config.in @@ -1,6 +1,6 @@ config BR2_PACKAGE_LIBHV - bool "libhv" - default y - help - This is the help text for the libhv package. - It will be displayed in the Buildroot configuration menu. + bool "libhv" + default y + help + This is the help text for the libhv package. + It will be displayed in the Buildroot configuration menu. diff --git a/external/br2-external/libhv/libhv.mk b/external/br2-external/libhv/libhv.mk index 5ea59494..36a6dcc4 100644 --- a/external/br2-external/libhv/libhv.mk +++ b/external/br2-external/libhv/libhv.mk @@ -4,18 +4,18 @@ # ################################################################################ - LIBHV_VERSION = v1.3.3 LIBHV_SOURCE = $(LIBHV_VERSION).tar.gz LIBHV_SITE = https://github.com/ithewei/libhv/archive/refs/tags +LIBHV_DEPENDENCIES = openssl LIBHV_INSTALL_STAGING = YES define LIBHV_CONFIGURE_CMDS - (cd $(@D); $(TARGET_CONFIGURE_OPTS) ./configure --with-mqtt) + (cd $(@D); $(TARGET_CONFIGURE_OPTS) ./configure --with-mqtt --with-openssl) endef define LIBHV_BUILD_CMDS - $(TARGET_CONFIGURE_OPTS) $(MAKE) libhv -C $(@D) + $(TARGET_CONFIGURE_OPTS) $(MAKE) libhv -C $(@D) endef define LIBHV_INSTALL_TARGET_CMDS diff --git a/external/br2-external/sscma-app/Config.in b/external/br2-external/sscma-app/Config.in new file mode 100644 index 00000000..6daf7e9f --- /dev/null +++ b/external/br2-external/sscma-app/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_SSCMA_APP + bool "sscma-app" + default y + help + This is the help text for the supervisor and sscma-node package. + It will be displayed in the Buildroot configuration menu. diff --git a/external/br2-external/sscma-app/sscma-app.mk b/external/br2-external/sscma-app/sscma-app.mk new file mode 100644 index 00000000..9f9edc9e --- /dev/null +++ b/external/br2-external/sscma-app/sscma-app.mk @@ -0,0 +1,28 @@ +################################################################################ +# +# sscma-app +# +################################################################################ + +SSCMA_APP_VERSION = 0.0.1 +SSCMA_APP_SITE = https://github.com/Seeed-Studio/sscma-example-sg200x.git +SSCMA_APP_SITE_METHOD = git +SSCMA_APP_GIT_SUBMODULES = YES +SSCMA_APP_LICENSE = Apache-2.0 +SSCMA_APP_DEPENDENCIES = mosquitto host-nodejs + +define SSCMA_APP_BUILD_CMDS + (cd $(@D); \ + $(TARGET_CONFIGURE_OPTS) \ + SG200X_SDK_PATH=$(BASE_DIR)/../../../ \ + ./build.sh \ + ) +endef + +define SSCMA_APP_INSTALL_TARGET_CMDS + @cp -rf $(@D)/install/* $(TARGET_DIR)/ + mkdir -p $(TARGET_DIR)/home/recamera/.node-red/node_modules + $(NPM) install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict --prefix $(TARGET_DIR)/home/recamera/.node-red node-red-contrib-sscma@0.0.5 +endef + +$(eval $(generic-package)) diff --git a/external/br2-external/sscma-supervisor/Config.in b/external/br2-external/sscma-supervisor/Config.in index 1e18fa2a..c06eac6c 100644 --- a/external/br2-external/sscma-supervisor/Config.in +++ b/external/br2-external/sscma-supervisor/Config.in @@ -1,6 +1,6 @@ config BR2_PACKAGE_SSCMA_SUPERVISOR bool "supervisor" - default y + default n help This is the help text for the supervisor package. It will be displayed in the Buildroot configuration menu. diff --git a/external/br2-external/sscma-supervisor/sscma-supervisor.mk b/external/br2-external/sscma-supervisor/sscma-supervisor.mk index e0711637..1f25477f 100644 --- a/external/br2-external/sscma-supervisor/sscma-supervisor.mk +++ b/external/br2-external/sscma-supervisor/sscma-supervisor.mk @@ -10,15 +10,19 @@ BR_NO_CHECK_HASH_FOR += $(SSCMA_SUPERVISOR_SOURCE) define SSCMA_SUPERVISOR_EXTRACT_CMDS $(UNZIP) -d $(@D) $(SSCMA_SUPERVISOR_DL_DIR)/$(SSCMA_SUPERVISOR_SOURCE) - @mv -fv $(@D)/* $(@D)/source + @mv -fv $(@D)/* $(@D)/source endef define SSCMA_SUPERVISOR_BUILD_CMDS - cd $(@D)/source && ./build.sh + (cd $(@D)/source; \ + $(TARGET_CONFIGURE_OPTS) \ + SG200X_SDK_PATH=$(BASE_DIR)/../../../ \ + ./build.sh \ + ) endef define SSCMA_SUPERVISOR_INSTALL_TARGET_CMDS - @cp -rf $(@D)/source/install/* $(TARGET_DIR)/ + @cp -rf $(@D)/source/install/* $(TARGET_DIR)/ endef $(eval $(generic-package)) diff --git a/external/build/boards/cv181x/sg2002_recamera_emmc/sg2002_recamera_emmc_defconfig b/external/build/boards/cv181x/sg2002_recamera_emmc/sg2002_recamera_emmc_defconfig index 965416d1..e9b2ebb0 100644 --- a/external/build/boards/cv181x/sg2002_recamera_emmc/sg2002_recamera_emmc_defconfig +++ b/external/build/boards/cv181x/sg2002_recamera_emmc/sg2002_recamera_emmc_defconfig @@ -11,6 +11,7 @@ CONFIG_FLASH_SIZE_SHRINK=y CONFIG_BOOT_IMAGE_SINGLE_DTB=y CONFIG_STORAGE_TYPE_emmc=y CONFIG_SENSOR_OV_OV5647=y +CONFIG_SENSOR_SMS_SC530AI_2L=y CONFIG_SENSOR_TUNING_PARAM_cv181x_src_ov_ov5647=y CONFIG_UBOOT_2021_10=y CONFIG_KERNEL_SRC_5.10=y diff --git a/external/build/boards/cv181x/sg2002_recamera_emmc/u-boot/cvi_board_init.c b/external/build/boards/cv181x/sg2002_recamera_emmc/u-boot/cvi_board_init.c index 58ce1527..78cfe88c 100644 --- a/external/build/boards/cv181x/sg2002_recamera_emmc/u-boot/cvi_board_init.c +++ b/external/build/boards/cv181x/sg2002_recamera_emmc/u-boot/cvi_board_init.c @@ -20,3 +20,59 @@ int cvi_board_init(void) return 0; } + + +#include +#include + +static int do_cvi_otp(struct cmd_tbl* cmdtp, int flag, int argc, + char* const argv[]) +{ + extern int64_t cvi_efuse_read_from_shadow(uint32_t addr); + + int i = 0; + uint32_t buf[5]; + unsigned char* pu8 = NULL; + char str[32] = ""; + char* str_get; + unsigned char save_flag = 0; + + for (i = 0; i < ARRAY_SIZE(buf); i++) { + buf[i] = cvi_efuse_read_from_shadow(0x40 + i * sizeof(uint32_t)); + } + + str_get = env_get("ethaddr"); + if ((buf[0] != 0x0) && (buf[0] != 0xffffffff)) { + pu8 = (char*)buf; + sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x", pu8[0], pu8[1], pu8[2], pu8[3], pu8[4], pu8[5]); + printf("mac: %s\n", str); + if ((NULL == str_get) || strcmp(str, str_get)) { + save_flag = 1; + env_set("ethaddr", str); + } + } else { + printf("random mac: %s\n", (NULL == str_get) ? "null" : str_get); + } + + str_get = env_get("sn"); + pu8 = (char*)&buf[2]; + sprintf(str, "%02X%02X%02X%02X%02X%02X%02X%02X%02X", + pu8[0], pu8[1], pu8[2], pu8[3], pu8[4], pu8[5], pu8[6], pu8[7], pu8[8]); + printf("sn: %s\n", str); + if ((NULL == str_get) || strcmp(str, str_get)) { + save_flag = 1; + env_set("sn", str); + } + + if (save_flag) { + env_save(); + } + + return 0; +} + +U_BOOT_CMD_COMPLETE( + cvi_otp, CONFIG_SYS_MAXARGS, 1, do_cvi_otp, + "load efuse info to env", + " - load efuse info to env", + var_complete); diff --git a/external/build/sensors/sensor_list.json b/external/build/sensors/sensor_list.json new file mode 100644 index 00000000..0b0bb3ad --- /dev/null +++ b/external/build/sensors/sensor_list.json @@ -0,0 +1,132 @@ +{ + "sensor_list": [ + "BRIGATES_BG0808", + "BYD_BF2253L", + "CHIPUP_XS9922B", + "CVSENS_CV2003", + "CVSENS_CV2003_1L", + "CVSENS_CV2003_1L_SLAVE", + "CVSENS_CV2003_1L_SLAVE1", + "CVSENS_CV4001", + "GCORE_GC02M1", + "GCORE_GC0312", + "GCORE_GC0329", + "GCORE_GC1054", + "GCORE_GC1084", + "GCORE_GC1084_SLAVE", + "GCORE_GC1084_SLAVE1", + "GCORE_GC1084_SLAVE2", + "GCORE_GC2053", + "GCORE_GC2053_1L", + "GCORE_GC2053_SLAVE", + "GCORE_GC2083", + "GCORE_GC2093", + "GCORE_GC2093_SLAVE", + "GCORE_GC2145", + "GCORE_GC2385_1L", + "GCORE_GC4023", + "GCORE_GC4653", + "GCORE_GC4653_SLAVE", + "IMGDS_MIS2008", + "IMGDS_MIS2008_1L", + "NEXTCHIP_N5", + "NEXTCHIP_N6", + "OV_OS02D10", + "OV_OS02D10_SLAVE", + "OV_OS02N10_1L", + "OV_OS02K10_SLAVE", + "OV_OS04A10", + "OV_OS04C10", + "OV_OS04C10_SLAVE", + "OV_OS08A20", + "OV_OS08A20_SLAVE", + "OV_OV4689", + "OV_OV5647", + "OV_OV6211", + "OV_OV7251", + "PICO_384", + "PICO_640", + "PIXELPLUS_PR2020", + "PIXELPLUS_PR2100", + "SMS_SC035GS", + "SMS_SC035GS_1L", + "SMS_SC035HGS", + "SMS_SC035HGS_1L", + "SMS_SC132GS", + "SMS_SC132GS_SLAVE", + "SMS_SC1336_1L", + "SMS_SC1346_1L", + "SMS_SC1346_1L_SLAVE", + "SMS_SC200AI", + "SMS_SC200AI_1L", + "SMS_SC230AI_2L", + "SMS_SC230AI_2L_SLAVE", + "SMS_SC301IOT", + "SMS_SC401AI", + "SMS_SC500AI", + "SMS_SC501AI_2L", + "SMS_SC530AI_2L", + "SMS_SC531AI_2L", + "SMS_SC850SL", + "SMS_SC3332", + "SMS_SC3335", + "SMS_SC3335_SLAVE", + "SMS_SC3336", + "SMS_SC3336_1L", + "SMS_SC2331_1L", + "SMS_SC2331_1L_SLAVE", + "SMS_SC2331_1L_SLAVE1", + "SMS_SC2335", + "SMS_SC2336", + "SMS_SC2336_SLAVE", + "SMS_SC2336_SLAVE1", + "SMS_SC2336_1L", + "SMS_SC2336P", + "SMS_SC2336P_1L", + "SMS_SC223A_1L", + "SMS_SC4210", + "SMS_SC4336", + "SMS_SC4336P", + "SMS_SC5336_2L", + "SMS_SC8238", + "SOI_F23", + "SOI_F35", + "SOI_F35_SLAVE", + "SOI_F37P", + "SOI_F38P", + "SOI_H65", + "SOI_K06", + "SOI_Q03", + "SOI_Q03P", + "SOI_F53", + "SOI_F352", + "SOI_K306", + "SONY_IMX290_2L", + "SONY_IMX307", + "SONY_IMX307_2L", + "SONY_IMX307_SLAVE", + "SONY_IMX307_SUBLVDS", + "SONY_IMX327", + "SONY_IMX327_2L", + "SONY_IMX327_FPGA", + "SONY_IMX327_SLAVE", + "SONY_IMX327_SUBLVDS", + "SONY_IMX334", + "SONY_IMX335", + "SONY_IMX347", + "SONY_IMX385", + "SONY_IMX675", + "TECHPOINT_TP2850", + "TECHPOINT_TP2863", + "VIVO_MCS369", + "VIVO_MCS369Q", + "VIVO_MCS308M2", + "LONTIUM_LT6911", + "LONTIUM_LT7911" + ], + + "lens_list" : [ + "f10", + "f18" + ] +} diff --git a/external/ramdisk/rootfs/overlay/cv181x_musl_riscv64/system/rootfs_overlay.sh b/external/ramdisk/rootfs/overlay/cv181x_musl_riscv64/system/rootfs_overlay.sh index 19fea023..7d9bec37 100755 --- a/external/ramdisk/rootfs/overlay/cv181x_musl_riscv64/system/rootfs_overlay.sh +++ b/external/ramdisk/rootfs/overlay/cv181x_musl_riscv64/system/rootfs_overlay.sh @@ -3,6 +3,11 @@ OVERLAY_PATH="" OVERLAY_WORK_PATH="" +# file permissions +if [ -f /usr/bin/fw_setenv ]; then + chmod 500 /usr/bin/fw_setenv +fi + # rootfs_overlay function mount_dir() { local lower=$1 @@ -37,8 +42,37 @@ function rootfs_overlay() { mount -a } -# mount userdata partition USERDATA_PARTITION="/dev/mmcblk0p6" + +# reset factory +if [ ! -d /sys/class/gpio/gpio510 ]; then + echo "510" > /sys/class/gpio/export +fi +if [ -d /sys/class/gpio/gpio510 ]; then + echo "in" > /sys/class/gpio/gpio510/direction + if [ $(cat /sys/class/gpio/gpio510/value) == "0" ]; then + sleep 1 + if [ $(cat /sys/class/gpio/gpio510/value) == "0" ]; then + /mnt/system/upgrade.sh recovery + fi + fi +fi + +if [ $(fw_printenv factory_reset) == "factory_reset=1" ]; then + echo "factory reset" + echo none > /sys/devices/platform/leds/leds/red/trigger + echo 255 > /sys/devices/platform/leds/leds/red/brightness + + # step1: recovery rootfs + /mnt/system/upgrade.sh start . + # step2: erase userdata partition + dd if=/dev/zero of=$USERDATA_PARTITION bs=1M count=5 + # step3: clear flag + fw_setenv factory_reset + reboot +fi + +# mount userdata partition if [ -e $USERDATA_PARTITION ]; then USERDATA_MOUNTPOINT="/userdata" MKFS_FLAG="N" @@ -55,7 +89,7 @@ if [ "$fs_type" != "" ]; then fi mp=$(mountpoint -n $USERDATA_MOUNTPOINT | awk '{print $1}') - echo "mp=$mp" + echo "mountpoint=$mp" if [ $mp != $USERDATA_PARTITION ]; then mount $USERDATA_PARTITION $USERDATA_MOUNTPOINT fi diff --git a/external/ramdisk/rootfs/overlay/cv181x_musl_riscv64/system/upgrade.sh b/external/ramdisk/rootfs/overlay/cv181x_musl_riscv64/system/upgrade.sh index 1caa8780..1400c9ba 100755 --- a/external/ramdisk/rootfs/overlay/cv181x_musl_riscv64/system/upgrade.sh +++ b/external/ramdisk/rootfs/overlay/cv181x_musl_riscv64/system/upgrade.sh @@ -376,8 +376,8 @@ query) ;; recovery) - echo "Start recovery" - /mnt/system/upgrade.sh start . + echo "Set recovery flag ok." + fw_setenv factory_reset 1 ;; *) diff --git a/external/setenv.sh b/external/setenv.sh index ee33aa58..b92b1528 100755 --- a/external/setenv.sh +++ b/external/setenv.sh @@ -57,7 +57,7 @@ rsync_dir $EXTERNAL/ramdisk/ ramdisk/ rsync_dir $EXTERNAL/u-boot/ $UBOOT_DIR/ # driver: sg200x is soft link to cv182x -rsync -av $EXTERNAL/SensorSupportList/sensor/sg200x/ $PROJECT_OUT/cvi_mpi/component/isp/sensor/cv182x/ +rsync -av $EXTERNAL/SensorSupportList/ $PROJECT_OUT/cvi_mpi/component/isp/ # patch buildroot packages for subdir in $EXTERNAL/buildroot/package/*; do diff --git a/external/u-boot/include/configs/cv181x-asic.h b/external/u-boot/include/configs/cv181x-asic.h index 789caed6..c3532cc2 100644 --- a/external/u-boot/include/configs/cv181x-asic.h +++ b/external/u-boot/include/configs/cv181x-asic.h @@ -339,7 +339,7 @@ #ifdef CONFIG_ENABLE_ALIOS_UPDATE #define CONFIG_BOOTCOMMAND "cvi_update_rtos" #else - #define CONFIG_BOOTCOMMAND SHOWLOGOCMD "run sdboot || cvi_update || run boot_record; run is_use_part_b; run emmcboot" + #define CONFIG_BOOTCOMMAND SHOWLOGOCMD "run sdboot || cvi_update || cvi_otp; run boot_record; run is_use_part_b; run emmcboot" #endif #else #define CONFIG_BOOTCOMMAND SHOWLOGOCMD "run sdboot"