From 277c8e368bb05cd0e8cd65f5f0741e27389b414d Mon Sep 17 00:00:00 2001 From: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> Date: Mon, 24 Oct 2022 21:12:59 +0900 Subject: [PATCH] drivers/video: Update API to dump register for debug --- drivers/video/Kconfig | 24 ++++++++++++++++++++++++ drivers/video/isx012.c | 21 +++++++++++++++++++++ drivers/video/isx019.c | 2 +- include/nuttx/video/isx012.h | 4 +++- 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 1508938ed5..dcd9d17f01 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -150,6 +150,16 @@ config VIDEO_ISX012 default n select I2C +if VIDEO_ISX012 + +config VIDEO_ISX012_REGDEBUG + bool "Enable to read registers of ISX012 for test" + default n + ---help--- + Enable to read registers of ISX012 for test. + +endif + config VIDEO_ISX019 bool "ISX019 Image sensor" default n @@ -183,6 +193,20 @@ config VIDEO_ISX019_INITIAL_JPEG_QUALITY ---help--- The initial JPEG quality. +config VIDEO_ISX019_NAME_WITH_VERSION + bool "ISX019 Image sensor name with version number" + default n + ---help--- + ISX019 Camera board has FPGA for encoding JPEG image. + This FPGA has a version number for the circuit. + This option enables to report FPGA version with driver name. + +config VIDEO_ISX019_REGDEBUG + bool "Enable to read registers of ISX019 for test" + default n + ---help--- + Enable to read registers of ISX019 for test. + endif config VIDEO_OV2640 diff --git a/drivers/video/isx012.c b/drivers/video/isx012.c index 8564df7703..e603d91023 100644 --- a/drivers/video/isx012.c +++ b/drivers/video/isx012.c @@ -2965,3 +2965,24 @@ int isx012_uninitialize(void) return OK; } + +#ifdef CONFIG_VIDEO_ISX012_REGDEBUG +int isx012_read_register(uint16_t addr, FAR uint8_t *buf, uint8_t size) +{ + uint16_t buf16; + + if (buf == NULL) + { + return -EINVAL; + } + + if (size > 2) + { + return -EINVAL; + } + + buf16 = isx012_getreg(&g_isx012_private, addr, size); + memcpy(buf, &buf16, size); + return OK; +} +#endif diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c index 7ef9e15393..64a0b7e8c5 100644 --- a/drivers/video/isx019.c +++ b/drivers/video/isx019.c @@ -1228,7 +1228,7 @@ static int isx019_uninit(void) static FAR const char *isx019_get_driver_name(void) { #ifdef CONFIG_VIDEO_ISX019_NAME_WITH_VERSION - static char name[16]; + static char name[20]; uint8_t f_ver = 0; uint16_t is_ver = 0; diff --git a/include/nuttx/video/isx012.h b/include/nuttx/video/isx012.h index faddc56532..b4f3b797c3 100644 --- a/include/nuttx/video/isx012.h +++ b/include/nuttx/video/isx012.h @@ -53,7 +53,9 @@ extern "C" int isx012_initialize(void); int isx012_uninitialize(void); - +#ifdef CONFIG_VIDEO_ISX012_REGDEBUG +int isx012_read_register(uint16_t addr, FAR uint8_t *buf, uint8_t size); +#endif #undef EXTERN #ifdef __cplusplus }