Skip to content

Commit

Permalink
arch: cxd56: Follow interface change of set_buf() operation
Browse files Browse the repository at this point in the history
set_buf() operation is changed to have the argument about
format. Follow the change.
  • Loading branch information
SPRESENSE committed Mar 4, 2024
1 parent 3f87280 commit e13ad92
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions arch/arm/src/cxd56xx/cxd56_cisif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
{
Expand All @@ -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)
Expand Down

0 comments on commit e13ad92

Please sign in to comment.