From 37e27673fd4231900ef5013eb541b202e5128a61 Mon Sep 17 00:00:00 2001 From: divadiow <62958974+divadiow@users.noreply.github.com> Date: Thu, 18 Sep 2025 19:48:40 +0100 Subject: [PATCH] hi704 driver + print more sensor info (#1) * realign with sdk * hi704 + info print * Update csi.h * Update csi_v2.c * Update Makefile * change sensor match wording --- project/Makefile | 1 + project/project_config.h | 1 + sdk/include/lib/video/dvp/cmos_sensor/csi.h | 9 +- sdk/lib/bus/iic/sensor/sensor_hi704.c | 101 ++++++ sdk/lib/crypto/mbedtls/library/Makefile | 361 ++++++++++++++++++++ sdk/lib/video/dvp/cmos_sensor/csi_v2.c | 135 +++++++- 6 files changed, 599 insertions(+), 9 deletions(-) create mode 100644 sdk/lib/bus/iic/sensor/sensor_hi704.c create mode 100644 sdk/lib/crypto/mbedtls/library/Makefile diff --git a/project/Makefile b/project/Makefile index 32962b5..c231938 100644 --- a/project/Makefile +++ b/project/Makefile @@ -426,6 +426,7 @@ SRC_C += ../sdk/lib/bus/iic/sensor/sensor_sp0a19.c SRC_C += ../sdk/lib/bus/iic/sensor/sensor_sp0718.c SRC_C += ../sdk/lib/bus/iic/sensor/sensor_bf30a2.c SRC_C += ../sdk/lib/bus/iic/sensor/sensor_ov7660.c +SRC_C += ../sdk/lib/bus/iic/sensor/sensor_hi704.c SRC_C += ../sdk/lib/bus/iic/gsensor/da280.c SRC_C += ../sdk/lib/bus/iic/gsensor/qma7981.c SRC_C += ../sdk/lib/bus/iic/gsensor/sc7a20.c diff --git a/project/project_config.h b/project/project_config.h index 2667bf0..4f82300 100644 --- a/project/project_config.h +++ b/project/project_config.h @@ -976,6 +976,7 @@ #define DEV_SENSOR_XC7011_H63 1 #define DEV_SENSOR_XC7016_H63 1 #define DEV_SENSOR_XCG532 1 +#define DEV_SENSOR_HI704 1 /*********************************************************************************************************************** */ diff --git a/sdk/include/lib/video/dvp/cmos_sensor/csi.h b/sdk/include/lib/video/dvp/cmos_sensor/csi.h index f69dd69..794c02b 100644 --- a/sdk/include/lib/video/dvp/cmos_sensor/csi.h +++ b/sdk/include/lib/video/dvp/cmos_sensor/csi.h @@ -302,11 +302,13 @@ void vpp_put_psram(uint32 yuvbuf_addr,uint32 s_w,uint32 s_h); #define DEV_SENSOR_BF30A2 (0||CMOS_AUTO_LOAD) #endif - #ifndef DEV_SENSOR_IOT101 #define DEV_SENSOR_IOT101 0 #endif +#ifndef DEV_SENSOR_HI704 +#define DEV_SENSOR_HI704 (0||CMOS_AUTO_LOAD) +#endif #if DEV_SENSOR_OV7725 extern const _Sensor_Ident_ ov7725_init; @@ -435,4 +437,9 @@ extern const _Sensor_Ident_ sc101iot_init; extern SENSOR_OP_SECTION const _Sensor_Adpt_ sc101iot_cmd; #endif +#if DEV_SENSOR_HI704 +extern const _Sensor_Ident_ hi704_init; +extern SENSOR_OP_SECTION const _Sensor_Adpt_ hi704_cmd; +#endif + #endif diff --git a/sdk/lib/bus/iic/sensor/sensor_hi704.c b/sdk/lib/bus/iic/sensor/sensor_hi704.c new file mode 100644 index 0000000..a01344c --- /dev/null +++ b/sdk/lib/bus/iic/sensor/sensor_hi704.c @@ -0,0 +1,101 @@ +#include "sys_config.h" +#include "typesdef.h" +#include "lib/video/dvp/cmos_sensor/csi.h" +#include "tx_platform.h" +#include "list.h" +#include "dev.h" +#include "hal/i2c.h" + +#if DEV_SENSOR_HI704 + +SENSOR_INIT_SECTION static const unsigned char HI704InitTable[CMOS_INIT_LEN] = +{ + 0x03, 0x00, 0x01, 0xf1, 0x01, 0xf3, 0x01, 0xf1, 0x11, 0x90, 0x12, 0x04, + 0x20, 0x00, 0x21, 0x04, 0x22, 0x00, 0x23, 0x04, 0x24, 0x01, 0x25, 0xe0, + 0x26, 0x02, 0x27, 0x80, 0x40, 0x01, 0x41, 0x58, 0x42, 0x00, 0x43, 0x13, + 0x80, 0x2e, 0x81, 0x7e, 0x82, 0x90, 0x83, 0x30, 0x84, 0x2c, 0x85, 0x4b, + 0x89, 0x48, 0x90, 0x0a, 0x91, 0x0a, 0x92, 0x48, 0x93, 0x40, 0x98, 0x38, + 0x99, 0x40, 0xa0, 0x00, 0xa8, 0x40, 0x03, 0x02, 0x13, 0x40, 0x14, 0x04, + 0x1a, 0x00, 0x1b, 0x08, 0x20, 0x33, 0x21, 0xaa, 0x22, 0xa7, 0x23, 0xb1, + 0x3b, 0x48, 0x50, 0x21, 0x52, 0xa2, 0x53, 0x0a, 0x54, 0x30, 0x55, 0x10, + 0x56, 0x0c, 0x59, 0x0F, 0x60, 0x54, 0x61, 0x5d, 0x62, 0x56, 0x63, 0x5c, + 0x64, 0x56, 0x65, 0x5c, 0x72, 0x57, 0x73, 0x5b, 0x74, 0x57, 0x75, 0x5b, + 0x80, 0x02, 0x81, 0x46, 0x82, 0x07, 0x83, 0x10, 0x84, 0x07, 0x85, 0x10, + 0x92, 0x24, 0x93, 0x30, 0x94, 0x24, 0x95, 0x30, 0xa0, 0x03, 0xa1, 0x45, + 0xa4, 0x45, 0xa5, 0x03, 0xa8, 0x12, 0xa9, 0x20, 0xaa, 0x34, 0xab, 0x40, + 0xb8, 0x55, 0xb9, 0x59, 0xbc, 0x05, 0xbd, 0x09, 0xc0, 0x5f, 0xc1, 0x67, + 0xc2, 0x5f, 0xc3, 0x67, 0xc4, 0x60, 0xc5, 0x66, 0xc6, 0x60, 0xc7, 0x66, + 0xc8, 0x61, 0xc9, 0x65, 0xca, 0x61, 0xcb, 0x65, 0xcc, 0x62, 0xcd, 0x64, + 0xce, 0x62, 0xcf, 0x64, 0xd0, 0x53, 0xd1, 0x68, 0x03, 0x10, 0x10, 0x03, + 0x11, 0x43, 0x12, 0x30, 0x40, 0x80, 0x41, 0x02, 0x48, 0x98, 0x50, 0x48, + 0x60, 0x7f, 0x61, 0x00, 0x62, 0xb0, 0x63, 0xa8, 0x64, 0x48, 0x66, 0x90, + 0x67, 0x42, 0x03, 0x11, 0x10, 0x25, 0x11, 0x1f, 0x20, 0x00, 0x21, 0x38, + 0x23, 0x0a, 0x60, 0x10, 0x61, 0x82, 0x62, 0x00, 0x63, 0x83, 0x64, 0x83, + 0x67, 0xF0, 0x68, 0x30, 0x69, 0x10, 0x03, 0x12, 0x40, 0xe9, 0x41, 0x09, + 0x50, 0x18, 0x51, 0x24, 0x70, 0x1f, 0x71, 0x00, 0x72, 0x00, 0x73, 0x00, + 0x74, 0x10, 0x75, 0x10, 0x76, 0x20, 0x77, 0x80, 0x78, 0x88, 0x79, 0x18, + 0xb0, 0x7d, 0x03, 0x13, 0x10, 0x01, 0x11, 0x89, 0x12, 0x14, 0x13, 0x19, + 0x14, 0x08, 0x20, 0x06, 0x21, 0x03, 0x23, 0x30, 0x24, 0x33, 0x25, 0x08, + 0x26, 0x18, 0x27, 0x00, 0x28, 0x08, 0x29, 0x50, 0x2a, 0xe0, 0x2b, 0x10, + 0x2c, 0x28, 0x2d, 0x40, 0x2e, 0x00, 0x2f, 0x00, 0x30, 0x11, 0x80, 0x03, + 0x81, 0x07, 0x90, 0x04, 0x91, 0x02, 0x92, 0x00, 0x93, 0x20, 0x94, 0x42, + 0x95, 0x60, 0x03, 0x14, 0x10, 0x01, 0x20, 0x80, 0x21, 0x80, 0x22, 0x78, + 0x23, 0x4d, 0x24, 0x46, 0x03, 0x15, 0x10, 0x03, 0x14, 0x3c, 0x16, 0x2c, + 0x17, 0x2f, 0x30, 0xc4, 0x31, 0x5b, 0x32, 0x1f, 0x33, 0x2a, 0x34, 0xce, + 0x35, 0x24, 0x36, 0x0b, 0x37, 0x3f, 0x38, 0x8a, 0x40, 0x87, 0x41, 0x18, + 0x42, 0x91, 0x43, 0x94, 0x44, 0x9f, 0x45, 0x33, 0x46, 0x00, 0x47, 0x94, + 0x48, 0x14, 0x03, 0x16, 0x30, 0x00, 0x31, 0x1c, 0x32, 0x2d, 0x33, 0x4e, + 0x34, 0x6d, 0x35, 0x8b, 0x36, 0xa2, 0x37, 0xb5, 0x38, 0xc4, 0x39, 0xd0, + 0x3a, 0xda, 0x3b, 0xea, 0x3c, 0xf4, 0x3d, 0xfb, 0x3e, 0xff, 0x03, 0x17, + 0xc4, 0x3c, 0xc5, 0x32, 0x03, 0x20, 0x10, 0x0c, 0x11, 0x04, 0x20, 0x01, + 0x28, 0x27, 0x29, 0xa1, 0x2a, 0xf0, 0x2b, 0x34, 0x2c, 0x2b, 0x30, 0xf8, + 0x39, 0x22, 0x3a, 0xde, 0x3b, 0x22, 0x3c, 0xde, 0x60, 0x95, 0x68, 0x3c, + 0x69, 0x64, 0x6A, 0x28, 0x6B, 0xc8, 0x70, 0x42, 0x76, 0x22, 0x77, 0x02, + 0x78, 0x12, 0x79, 0x27, 0x7a, 0x23, 0x7c, 0x1d, 0x7d, 0x22, 0x83, 0x00, + 0x84, 0xbe, 0x85, 0x6e, 0x86, 0x00, 0x87, 0xfa, 0x88, 0x02, 0x89, 0x7a, + 0x8a, 0xc4, 0x8b, 0x3f, 0x8c, 0x7a, 0x8d, 0x34, 0x8e, 0xbc, 0x91, 0x02, + 0x92, 0xdc, 0x93, 0x6c, 0x94, 0x01, 0x95, 0xb7, 0x96, 0x74, 0x98, 0x8C, + 0x99, 0x23, 0x9c, 0x0b, 0x9d, 0xb8, 0x9e, 0x00, 0x9f, 0xfa, 0xb1, 0x14, + 0xb2, 0x50, 0xb4, 0x14, 0xb5, 0x38, 0xb6, 0x26, 0xb7, 0x20, 0xb8, 0x1d, + 0xb9, 0x1b, 0xba, 0x1a, 0xbb, 0x19, 0xbc, 0x19, 0xbd, 0x18, 0xc0, 0x16, + 0xc3, 0x48, 0xc4, 0x48, 0x03, 0x22, 0x10, 0xe2, 0x11, 0x26, 0x21, 0x40, + 0x30, 0x80, 0x31, 0x80, 0x38, 0x12, 0x39, 0x33, 0x40, 0xf0, 0x41, 0x33, + 0x42, 0x33, 0x43, 0xf3, 0x44, 0x55, 0x45, 0x44, 0x46, 0x02, 0x80, 0x45, + 0x81, 0x20, 0x82, 0x48, 0x83, 0x52, 0x84, 0x1b, 0x85, 0x50, 0x86, 0x25, + 0x87, 0x4d, 0x88, 0x38, 0x89, 0x3e, 0x8a, 0x29, 0x8b, 0x02, 0x8d, 0x22, + 0x8e, 0x71, 0x8f, 0x63, 0x90, 0x60, 0x91, 0x5c, 0x92, 0x56, 0x93, 0x52, + 0x94, 0x4c, 0x95, 0x36, 0x96, 0x31, 0x97, 0x2e, 0x98, 0x2a, 0x99, 0x29, + 0x9a, 0x26, 0x9b, 0x09, 0x03, 0x22, 0x10, 0xfb, 0x03, 0x20, 0x10, 0x9c, + 0x01, 0xf0, 0x03, 0x00, 0x01, 0x90, 0xff, 0xff, +}; + + + +SENSOR_OP_SECTION const _Sensor_Adpt_ hi704_cmd= +{ + .typ = 1, //YUV + .pixelw = 640, + .pixelh= 480, + .hsyn = 1, + .vsyn = 0, + .rduline = 0,// + .rawwide = 1,//10bit + .colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_ + .init = (uint8 *)HI704InitTable, + .rotate_adapt = {0}, + .hvb_adapt = {0x80,0x0a,0x80,0x0a}, + . mclk = 24000000, + .p_fun_adapt = {NULL,NULL,NULL}, + .p_xc7016_adapt = {NULL}, +}; + +const _Sensor_Ident_ hi704_init = +{ + /* id , w_cmd, r_cmd, addr_num, data_num, id_reg */ + 0x96,0x60,0x61,0x01,0x01,0x04 +}; + + +#endif + + diff --git a/sdk/lib/crypto/mbedtls/library/Makefile b/sdk/lib/crypto/mbedtls/library/Makefile new file mode 100644 index 0000000..160aa6b --- /dev/null +++ b/sdk/lib/crypto/mbedtls/library/Makefile @@ -0,0 +1,361 @@ + +# Also see "include/mbedtls/mbedtls_config.h" + +CFLAGS ?= -O2 +WARNING_CFLAGS ?= -Wall -Wextra -Wformat=2 -Wno-format-nonliteral +LDFLAGS ?= + +# Include ../include for public headers and . for private headers. +# Note that . needs to be included explicitly for the sake of library +# files that are not in the /library directory (which currently means +# under /3rdparty). +LOCAL_CFLAGS = $(WARNING_CFLAGS) -I. -I../include -D_FILE_OFFSET_BITS=64 +LOCAL_LDFLAGS = + +ifdef DEBUG +LOCAL_CFLAGS += -g3 +endif + +# MicroBlaze specific options: +# CFLAGS += -mno-xl-soft-mul -mxl-barrel-shift + +# To compile on Plan9: +# CFLAGS += -D_BSD_EXTENSION + +PERL ?= perl + +ifdef WINDOWS +PYTHON ?= python +else +PYTHON ?= $(shell if type python3 >/dev/null 2>/dev/null; then echo python3; else echo python; fi) +endif + +# if were running on Windows build for Windows +ifdef WINDOWS +WINDOWS_BUILD=1 +else ifeq ($(shell uname -s),Darwin) +ifeq ($(AR),ar) +APPLE_BUILD ?= 1 +endif +endif + +# To compile as a shared library: +ifdef SHARED +# all code is position-indep with mingw, avoid warning about useless flag +ifndef WINDOWS_BUILD +LOCAL_CFLAGS += -fPIC -fpic +endif +endif + +SOEXT_TLS?=so.19 +SOEXT_X509?=so.5 +SOEXT_CRYPTO?=so.14 + +# Set AR_DASH= (empty string) to use an ar implementation that does not accept +# the - prefix for command line options (e.g. llvm-ar) +AR_DASH ?= - + +ARFLAGS = $(AR_DASH)src +ifdef APPLE_BUILD +ifneq ($(APPLE_BUILD),0) +ARFLAGS = $(AR_DASH)Src +RLFLAGS = -no_warning_for_no_symbols -c +RL ?= ranlib +endif +endif + +DLEXT ?= so +ifdef WINDOWS_BUILD +# Windows shared library extension: +DLEXT = dll +else ifdef APPLE_BUILD +ifneq ($(APPLE_BUILD),0) +# Mac OS X shared library extension: +DLEXT = dylib +endif +endif + +OBJS_CRYPTO= \ + aes.o \ + aesni.o \ + aesce.o \ + aria.o \ + asn1parse.o \ + asn1write.o \ + base64.o \ + bignum.o \ + bignum_core.o \ + bignum_mod.o \ + bignum_mod_raw.o \ + camellia.o \ + ccm.o \ + chacha20.o \ + chachapoly.o \ + cipher.o \ + cipher_wrap.o \ + cmac.o \ + constant_time.o \ + ctr_drbg.o \ + des.o \ + dhm.o \ + ecdh.o \ + ecdsa.o \ + ecjpake.o \ + ecp.o \ + ecp_curves.o \ + entropy.o \ + entropy_poll.o \ + error.o \ + gcm.o \ + hash_info.o \ + hkdf.o \ + hmac_drbg.o \ + lmots.o \ + lms.o \ + md.o \ + md5.o \ + memory_buffer_alloc.o \ + nist_kw.o \ + oid.o \ + padlock.o \ + pem.o \ + pk.o \ + pk_wrap.o \ + pkcs12.o \ + pkcs5.o \ + pkparse.o \ + pkwrite.o \ + platform.o \ + platform_util.o \ + poly1305.o \ + psa_crypto.o \ + psa_crypto_aead.o \ + psa_crypto_cipher.o \ + psa_crypto_client.o \ + psa_crypto_driver_wrappers.o \ + psa_crypto_ecp.o \ + psa_crypto_hash.o \ + psa_crypto_mac.o \ + psa_crypto_pake.o \ + psa_crypto_rsa.o \ + psa_crypto_se.o \ + psa_crypto_slot_management.o \ + psa_crypto_storage.o \ + psa_its_file.o \ + psa_util.o \ + ripemd160.o \ + rsa.o \ + rsa_alt_helpers.o \ + sha1.o \ + sha256.o \ + sha512.o \ + threading.o \ + timing.o \ + version.o \ + version_features.o \ + # This line is intentionally left blank + +include ../3rdparty/Makefile.inc +LOCAL_CFLAGS+=$(THIRDPARTY_INCLUDES) +OBJS_CRYPTO+=$(THIRDPARTY_CRYPTO_OBJECTS) + +OBJS_X509= \ + x509.o \ + x509_create.o \ + x509_crl.o \ + x509_crt.o \ + x509_csr.o \ + x509write_crt.o \ + x509write_csr.o \ + pkcs7.o \ + # This line is intentionally left blank + +OBJS_TLS= \ + debug.o \ + mps_reader.o \ + mps_trace.o \ + net_sockets.o \ + ssl_cache.o \ + ssl_ciphersuites.o \ + ssl_client.o \ + ssl_cookie.o \ + ssl_debug_helpers_generated.o \ + ssl_msg.o \ + ssl_ticket.o \ + ssl_tls.o \ + ssl_tls12_client.o \ + ssl_tls12_server.o \ + ssl_tls13_keys.o \ + ssl_tls13_client.o \ + ssl_tls13_server.o \ + ssl_tls13_generic.o \ + # This line is intentionally left blank + +.SILENT: + +.PHONY: all static shared clean + +ifndef SHARED +all: static +else +all: shared static +endif + +static: libmbedcrypto.a libmbedx509.a libmbedtls.a + cd ../tests && echo "This is a seedfile that contains 64 bytes (65 on Windows)......" > seedfile + +shared: libmbedcrypto.$(DLEXT) libmbedx509.$(DLEXT) libmbedtls.$(DLEXT) + +# Windows builds under Mingw can fail if make tries to create archives in the same +# directory at the same time - see https://bugs.launchpad.net/gcc-arm-embedded/+bug/1848002. +# This forces builds of the .a files to be serialised. +ifdef WINDOWS +libmbedtls.a: | libmbedx509.a +libmbedx509.a: | libmbedcrypto.a +endif + +# tls +libmbedtls.a: $(OBJS_TLS) + echo " AR $@" + $(AR) $(ARFLAGS) $@ $(OBJS_TLS) +ifdef APPLE_BUILD +ifneq ($(APPLE_BUILD),0) + echo " RL $@" + $(RL) $(RLFLAGS) $@ +endif +endif + +libmbedtls.$(SOEXT_TLS): $(OBJS_TLS) libmbedx509.so + echo " LD $@" + $(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS_TLS) -L. -lmbedx509 -lmbedcrypto $(LOCAL_LDFLAGS) $(LDFLAGS) + +ifneq ($(SOEXT_TLS),so) +libmbedtls.so: libmbedtls.$(SOEXT_TLS) + echo " LN $@ -> $<" + ln -sf $< $@ +endif + +libmbedtls.dylib: $(OBJS_TLS) libmbedx509.dylib + echo " LD $@" + $(CC) -dynamiclib -o $@ $(OBJS_TLS) -L. -lmbedx509 -lmbedcrypto $(LOCAL_LDFLAGS) $(LDFLAGS) + +libmbedtls.dll: $(OBJS_TLS) libmbedx509.dll + echo " LD $@" + $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_TLS) -lws2_32 -lwinmm -lgdi32 -L. -lmbedx509 -lmbedcrypto -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS) + +# x509 +libmbedx509.a: $(OBJS_X509) + echo " AR $@" + $(AR) $(ARFLAGS) $@ $(OBJS_X509) +ifdef APPLE_BUILD +ifneq ($(APPLE_BUILD),0) + echo " RL $@" + $(RL) $(RLFLAGS) $@ +endif +endif + +libmbedx509.$(SOEXT_X509): $(OBJS_X509) libmbedcrypto.so + echo " LD $@" + $(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS_X509) -L. -lmbedcrypto $(LOCAL_LDFLAGS) $(LDFLAGS) + +ifneq ($(SOEXT_X509),so) +libmbedx509.so: libmbedx509.$(SOEXT_X509) + echo " LN $@ -> $<" + ln -sf $< $@ +endif + +libmbedx509.dylib: $(OBJS_X509) libmbedcrypto.dylib + echo " LD $@" + $(CC) -dynamiclib -o $@ $(OBJS_X509) -L. -lmbedcrypto $(LOCAL_LDFLAGS) $(LDFLAGS) + +libmbedx509.dll: $(OBJS_X509) libmbedcrypto.dll + echo " LD $@" + $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_X509) -lws2_32 -lwinmm -lgdi32 -L. -lmbedcrypto -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS) + +# crypto +libmbedcrypto.a: $(OBJS_CRYPTO) + echo " AR $@" + $(AR) $(ARFLAGS) $@ $(OBJS_CRYPTO) +ifdef APPLE_BUILD +ifneq ($(APPLE_BUILD),0) + echo " RL $@" + $(RL) $(RLFLAGS) $@ +endif +endif + +libmbedcrypto.$(SOEXT_CRYPTO): $(OBJS_CRYPTO) + echo " LD $@" + $(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS_CRYPTO) $(LOCAL_LDFLAGS) $(LDFLAGS) + +ifneq ($(SOEXT_CRYPTO),so) +libmbedcrypto.so: libmbedcrypto.$(SOEXT_CRYPTO) + echo " LN $@ -> $<" + ln -sf $< $@ +endif + +libmbedcrypto.dylib: $(OBJS_CRYPTO) + echo " LD $@" + $(CC) -dynamiclib -o $@ $(OBJS_CRYPTO) $(LOCAL_LDFLAGS) $(LDFLAGS) + +libmbedcrypto.dll: $(OBJS_CRYPTO) + echo " LD $@" + $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_CRYPTO) -lws2_32 -lwinmm -lgdi32 -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS) + +.c.o: + echo " CC $<" + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -o $@ -c $< + +.PHONY: generated_files +GENERATED_FILES = \ + error.c version_features.c \ + ssl_debug_helpers_generated.c \ + psa_crypto_driver_wrappers.c +generated_files: $(GENERATED_FILES) + +error.c: ../scripts/generate_errors.pl +error.c: ../scripts/data_files/error.fmt +error.c: $(filter-out %config%,$(wildcard ../include/mbedtls/*.h)) +error.c: + echo " Gen $@" + $(PERL) ../scripts/generate_errors.pl + +ssl_debug_helpers_generated.c: ../scripts/generate_ssl_debug_helpers.py +ssl_debug_helpers_generated.c: $(filter-out %config%,$(wildcard ../include/mbedtls/*.h)) +ssl_debug_helpers_generated.c: + echo " Gen $@" + $(PYTHON) ../scripts/generate_ssl_debug_helpers.py --mbedtls-root .. . + +version_features.c: ../scripts/generate_features.pl +version_features.c: ../scripts/data_files/version_features.fmt +## The generated file only depends on the options that are present in mbedtls_config.h, +## not on which options are set. To avoid regenerating this file all the time +## when switching between configurations, don't declare mbedtls_config.h as a +## dependency. Remove this file from your working tree if you've just added or +## removed an option in mbedtls_config.h. +#version_features.c: ../include/mbedtls/mbedtls_config.h +version_features.c: + echo " Gen $@" + $(PERL) ../scripts/generate_features.pl + +psa_crypto_driver_wrappers.c: ../scripts/generate_driver_wrappers.py +psa_crypto_driver_wrappers.c: ../scripts/data_files/driver_templates/psa_crypto_driver_wrappers.c.jinja +psa_crypto_driver_wrappers.c: + echo " Gen $@" + $(PYTHON) ../scripts/generate_driver_wrappers.py + +clean: +ifndef WINDOWS + rm -f *.o libmbed* + rm -f $(THIRDPARTY_CRYPTO_OBJECTS) +else + if exist *.o del /Q /F *.o + if exist libmbed* del /Q /F libmbed* + del /Q /F del_errors_out_if_the_file_list_is_empty_but_not_if_a_file_does_not_exist $(subst /,\,$(THIRDPARTY_CRYPTO_OBJECTS)) +endif + +neat: clean +ifndef WINDOWS + rm -f $(GENERATED_FILES) +else + for %f in ($(subst /,\,$(GENERATED_FILES))) if exist %f del /Q /F %f +endif diff --git a/sdk/lib/video/dvp/cmos_sensor/csi_v2.c b/sdk/lib/video/dvp/cmos_sensor/csi_v2.c index 7cfb7e8..c1e70d3 100644 --- a/sdk/lib/video/dvp/cmos_sensor/csi_v2.c +++ b/sdk/lib/video/dvp/cmos_sensor/csi_v2.c @@ -137,6 +137,10 @@ static const _Sensor_Ident_ *devSensorInitTable[] = { &sc101iot_init, #endif +#if DEV_SENSOR_HI704 + &hi704_init, +#endif + NULL, }; @@ -234,8 +238,111 @@ static const _Sensor_Adpt_ *devSensorOPTable[] = { &sc101iot_cmd, #endif +#if DEV_SENSOR_HI704 + &hi704_cmd, +#endif + }; +// Keep same order as devSensorOPTable - helps ID which driver is used to init sensor +static const char *devSensorNameTable[] = { + +#if DEV_SENSOR_GC0308 + "gc0308", +#endif + +#if DEV_SENSOR_GC0309 + "gc0309", +#endif + +#if DEV_SENSOR_GC0311 + "gc0311", +#endif + +#if DEV_SENSOR_GC0312 + "gc0312", +#endif + +#if DEV_SENSOR_GC0328 + "gc0328", +#endif + +#if DEV_SENSOR_GC0329 + "gc0329", +#endif + +#if DEV_SENSOR_BF3A03 + "bf3a03", +#endif + +#if DEV_SENSOR_BF3703 + "bf3703", +#endif + +#if DEV_SENSOR_OV2640 + "ov2640", +#endif + +#if DEV_SENSOR_OV7725 + "ov7725", +#endif + +#if DEV_SENSOR_OV7670 + "ov7670", +#endif + +#if DEV_SENSOR_OV7660 + "ov7660", +#endif + +#if DEV_SENSOR_BF2013 + "bf2013", +#endif + +#if DEV_SENSOR_XC7016_H63 + "xc7016_h63", +#endif + +#if DEV_SENSOR_XC7011_H63 + "xc7011_h63", +#endif + +#if DEV_SENSOR_XC7011_GC1054 + "xc7011_gc1054", +#endif + +#if DEV_SENSOR_XCG532 + "xcg532", +#endif + +#if DEV_SENSOR_GC2145 + "gc2145", +#endif + +#if DEV_SENSOR_SP0718 + "sp0718", +#endif + +#if DEV_SENSOR_SP0A19 + "sp0a19", +#endif + +#if DEV_SENSOR_BF3720 + "bf3720", +#endif + +#if DEV_SENSOR_NT99230 + "nt99230", +#endif + +#if DEV_SENSOR_IOT101 + "sc101iot", +#endif + +#if DEV_SENSOR_HI704 + "hi704", +#endif +}; #if IPF_EN #if 1 @@ -1006,7 +1113,12 @@ int sensorCheckId(struct i2c_device *p_iic,const _Sensor_Ident_ *p_sensor_ident, i2c_read(p_iic,u8Buf,p_sensor_ident->addr_num,(int8*)&id,p_sensor_ident->data_num); - os_printf("SID: %x, %x, %x, %x,%x\r\n",id,p_sensor_ident->id,u8SensorwriteID,u8SensorreadID,p_sensor_ident->id_reg); + os_printf("SID: id=0x%02x expect=0x%02x addr8={0x%02x,0x%02x} addr7=0x%02x reg=0x%02x\r\n", + id, p_sensor_ident->id, + u8SensorwriteID, u8SensorreadID, + (u8SensorwriteID >> 1), + p_sensor_ident->id_reg); + if(id == p_sensor_ident->id) return 1; else @@ -1032,15 +1144,22 @@ static _Sensor_Adpt_ * sensorAutoCheck(struct i2c_device *p_iic,uint8 *init_buf) sensor_reset(); if(sensorCheckId(p_iic,devSensorInitTable[i],devSensorOPTable[i])>=0) { - os_printf("id =%x num:%d \n",devSensorInitTable[i]->id,i); - devSensorInit = (_Sensor_Ident_ *) devSensorInitTable[i]; -//#if CMOS_AUTO_LOAD -// devSensor_Struct = sensor_adpt_load(devSensorInit->id,devSensorInit->w_cmd,devSensorInit->r_cmd,init_buf); -//#else - devSensor_Struct = (_Sensor_Adpt_ *) devSensorOPTable[i]; -//#endif + devSensorInit = (_Sensor_Ident_ *) devSensorInitTable[i]; + devSensor_Struct= (_Sensor_Adpt_ *) devSensorOPTable[i]; + + // New, more informative line: + os_printf("sensor driver match: name=%s id=0x%02x num=%d addr7=0x%02x mclk=%d pix=%dx%d\r\n", + devSensorNameTable[i], + devSensorInit->id, + i, + (devSensorInit->w_cmd >> 1), // 7-bit I2C address + devSensor_Struct->mclk, + devSensor_Struct->pixelw, + devSensor_Struct->pixelh); + break; } + } if(devSensor_Struct == NULL) {