This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 3b3f2d97e9 arch: cxd56: Follow interface change of set_buf() operation
3b3f2d97e9 is described below
commit 3b3f2d97e9746739b87554146a511aba8191f12d
Author: SPRESENSE <[email protected]>
AuthorDate: Fri Mar 1 19:59:16 2024 +0900
arch: cxd56: Follow interface change of set_buf() operation
set_buf() operation is changed to have the argument about
format. Follow the change.
---
arch/arm/src/cxd56xx/cxd56_cisif.c | 43 +++++++++++++++++++++++++++++---------
1 file changed, 33 insertions(+), 10 deletions(-)
diff --git a/arch/arm/src/cxd56xx/cxd56_cisif.c
b/arch/arm/src/cxd56xx/cxd56_cisif.c
index 651e625bf0..dcb30fa2b3 100644
--- a/arch/arm/src/cxd56xx/cxd56_cisif.c
+++ b/arch/arm/src/cxd56xx/cxd56_cisif.c
@@ -978,14 +978,36 @@ static int cxd56_cisif_validate_buf(struct imgdata_s
*data,
return OK;
}
+static int32_t cisif_get_mode(uint8_t nr_datafmts,
+ imgdata_format_t *datafmts)
+{
+ switch (datafmts[IMGDATA_FMT_MAIN].pixelformat)
+ {
+ case IMGDATA_PIX_FMT_UYVY: /* YUV 4:2:2 */
+ case IMGDATA_PIX_FMT_RGB565: /* RGB565 */
+
+ /* CISIF does not distinguish between YUV and RGB */
+
+ return MODE_YUV_TRS_EN;
+
+ case IMGDATA_PIX_FMT_JPEG: /* JPEG */
+ return MODE_JPG_TRS_EN;
+
+ case IMGDATA_PIX_FMT_JPEG_WITH_SUBIMG: /* JPEG + YUV 4:2:2 */
+ return MODE_INTLEV_TRS_EN;
+
+ default:
+ return -EINVAL;
+ }
+}
+
static int cxd56_cisif_set_buf(struct imgdata_s *data,
uint8_t nr_datafmts,
- FAR imgdata_format_t *datafmts,
+ imgdata_format_t *datafmts,
uint8_t *addr, uint32_t size)
{
int ret;
- uint32_t mode;
- uint32_t regval;
+ int32_t mode;
uint16_t w;
uint16_t h;
@@ -995,7 +1017,7 @@ static int cxd56_cisif_set_buf(struct imgdata_s *data,
return ret;
}
- mode = cisif_reg_read(CISIF_MODE);
+ mode = cisif_get_mode(nr_datafmts, datafmts);
switch (mode)
{
@@ -1007,18 +1029,19 @@ static int cxd56_cisif_set_buf(struct imgdata_s *data,
ret = cisif_set_jpg_sarea(addr, size);
break;
- default: /* MODE_INTLEV_TRS_EN */
-
- /* Get YUV frame size information */
+ case MODE_INTLEV_TRS_EN:
- regval = cisif_reg_read(CISIF_ACT_SIZE);
- h = (regval >> 16) & 0x1ff;
- w = regval & 0x01ff;
+ w = datafmts[IMGDATA_FMT_SUB].width;
+ h = datafmts[IMGDATA_FMT_SUB].height;
ret = cisif_set_intlev_sarea(addr,
size,
YUV_SIZE(w, h));
break;
+
+ default:
+ ret = -EINVAL;
+ break;
}
if (ret != OK)