arch: cxd56: Follow interface change of set_buf() operation

set_buf() operation is changed to have the argument about
format. Follow the change.
This commit is contained in:
SPRESENSE 2024-03-01 19:59:16 +09:00 committed by Xiang Xiao
parent 8de922186e
commit 3b3f2d97e9

View File

@ -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 */
case MODE_INTLEV_TRS_EN:
/* Get YUV frame size information */
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)