Merged in alinjerpelea/nuttx (pull request #934)

drivers: video: add basic Video Stream support

basic video stream and capture implementation based on the
spresense SDK code release

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Alin Jerpelea
2019-07-04 13:30:50 +00:00
committed by Gregory Nutt
parent d9767b74cd
commit 128c1f1430
8 changed files with 2983 additions and 0 deletions

View File

@@ -22,6 +22,12 @@ config FB_OVERLAY_BLIT
depends on FB_OVERLAY
default n
config VIDEO_STREAM
bool "Video Stream Support"
default n
---help---
Enable video Stream support
config VIDEO_MAX7456
bool "Maxim 7456 Monochrome OSD"
default n

View File

@@ -41,6 +41,10 @@ ifeq ($(CONFIG_VIDEO_FB),y)
CSRCS += fb.c
endif
ifeq ($(CONFIG_VIDEO_STREAM),y)
CSRCS += video.c video_framebuff.c
endif
# These video drivers depend on I2C support
ifeq ($(CONFIG_I2C),y)

1609
drivers/video/video.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,299 @@
/****************************************************************************
* drivers/video/video_framebuff.c
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name of Sony Semiconductor Solutions Corporation nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include "video_framebuff.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <nuttx/irq.h>
#include <nuttx/kmalloc.h>
/****************************************************************************
* Private Functions
****************************************************************************/
static void init_buf_chain(video_framebuff_t *fbuf)
{
int i;
vbuf_container_t *tmp;
fbuf->vbuf_empty = fbuf->vbuf_alloced;
fbuf->vbuf_next_dma = NULL;
fbuf->vbuf_dma = NULL;
fbuf->vbuf_top = NULL;
fbuf->vbuf_tail = NULL;
tmp = fbuf->vbuf_alloced;
for (i = 0; i < fbuf->container_size - 1; i++)
{
tmp->next = &tmp[1];
tmp++;
}
}
static void cleanup_container(video_framebuff_t *fbuf)
{
if (fbuf->vbuf_alloced)
{
memset(fbuf->vbuf_alloced,
0,
sizeof(vbuf_container_t)*fbuf->container_size);
init_buf_chain(fbuf);
}
}
static inline int is_last_one(video_framebuff_t *fbuf)
{
return fbuf->vbuf_top == fbuf->vbuf_tail ? 1 : 0;
}
static inline vbuf_container_t *dequeue_vbuf_unsafe(video_framebuff_t *fbuf)
{
vbuf_container_t *ret = fbuf->vbuf_top;
if (is_last_one(fbuf))
{
fbuf->vbuf_top = NULL;
fbuf->vbuf_tail = NULL;
fbuf->vbuf_next_dma = NULL;
}
else
{
if (fbuf->mode == V4L2_BUF_MODE_RING)
{
fbuf->vbuf_tail->next = fbuf->vbuf_top->next;
}
fbuf->vbuf_top = fbuf->vbuf_top->next;
}
return ret;
}
/****************************************************************************
* Public Functions
****************************************************************************/
void video_framebuff_init(video_framebuff_t *fbuf)
{
fbuf->mode = V4L2_BUF_MODE_RING;
fbuf->vbuf_empty = NULL;
fbuf->vbuf_top = NULL;
fbuf->vbuf_tail = NULL;
fbuf->vbuf_next_dma = NULL;
sem_init(&fbuf->lock_empty, 0, 1);
}
void video_framebuff_uninit(video_framebuff_t *fbuf)
{
video_framebuff_realloc_container(fbuf, 0);
sem_destroy(&fbuf->lock_empty);
}
int video_framebuff_realloc_container(video_framebuff_t *fbuf, int sz)
{
if (sz > V4L2_REQBUFS_COUNT_MAX)
{
return -EINVAL;
}
if (fbuf->vbuf_alloced == NULL || fbuf->container_size != sz)
{
if (fbuf->container_size != sz)
{
if (fbuf->vbuf_alloced != NULL)
{
kmm_free(fbuf->vbuf_alloced);
}
fbuf->vbuf_alloced = NULL;
fbuf->container_size = 0;
}
if (sz > 0)
{
fbuf->vbuf_alloced
= (vbuf_container_t *)kmm_malloc(sizeof(vbuf_container_t)*sz);
if (fbuf->vbuf_alloced == NULL)
{
return -ENOMEM;
}
}
fbuf->container_size = sz;
}
cleanup_container(fbuf);
return OK;
}
vbuf_container_t *video_framebuff_get_container(video_framebuff_t *fbuf)
{
vbuf_container_t *ret;
sem_wait(&fbuf->lock_empty);
ret = fbuf->vbuf_empty;
if (ret)
{
fbuf->vbuf_empty = ret->next;
ret->next = NULL;
}
sem_post(&fbuf->lock_empty);
return ret;
}
void video_framebuff_free_container(video_framebuff_t *fbuf,
vbuf_container_t *cnt)
{
sem_wait(&fbuf->lock_empty);
cnt->next = fbuf->vbuf_empty;
fbuf->vbuf_empty = cnt;
sem_post(&fbuf->lock_empty);
}
void video_framebuff_queue_container(video_framebuff_t *fbuf,
vbuf_container_t *tgt)
{
irqstate_t flags;
flags = enter_critical_section();
if (fbuf->vbuf_top)
{
fbuf->vbuf_tail->next = tgt;
fbuf->vbuf_tail = tgt;
if (fbuf->vbuf_next_dma == NULL)
{
fbuf->vbuf_next_dma = tgt;
}
}
else
{
fbuf->vbuf_top = fbuf->vbuf_tail = tgt;
fbuf->vbuf_next_dma = tgt;
}
if (fbuf->mode == V4L2_BUF_MODE_RING)
{
fbuf->vbuf_tail->next = fbuf->vbuf_top;
}
else /* Case of V4L2_BUF_MODE_FIFO */
{
fbuf->vbuf_tail->next = NULL;
}
leave_critical_section(flags);
}
vbuf_container_t *video_framebuff_dq_valid_container(video_framebuff_t *fbuf)
{
irqstate_t flags;
vbuf_container_t *ret = NULL;
flags = enter_critical_section();
if (fbuf->vbuf_top != NULL && fbuf->vbuf_top != fbuf->vbuf_next_dma)
{
ret = dequeue_vbuf_unsafe(fbuf);
}
leave_critical_section(flags);
return ret;
}
vbuf_container_t *video_framebuff_get_dma_container(video_framebuff_t *fbuf)
{
irqstate_t flags;
vbuf_container_t *ret;
flags = enter_critical_section();
ret = fbuf->vbuf_dma = fbuf->vbuf_next_dma;
leave_critical_section(flags);
return ret;
}
void video_framebuff_dma_done(video_framebuff_t *fbuf)
{
fbuf->vbuf_dma = NULL;
if (fbuf->vbuf_next_dma)
{
fbuf->vbuf_next_dma = fbuf->vbuf_next_dma->next;
if (fbuf->vbuf_next_dma == fbuf->vbuf_top) /* RING mode case. */
{
fbuf->vbuf_top = fbuf->vbuf_top->next;
fbuf->vbuf_tail = fbuf->vbuf_tail->next;
}
}
}
void video_framebuff_change_mode(video_framebuff_t *fbuf,
enum v4l2_buf_mode mode)
{
irqstate_t flags;
flags = enter_critical_section();
if (fbuf->mode != mode)
{
if (fbuf->vbuf_tail)
{
if (mode == V4L2_BUF_MODE_RING)
{
fbuf->vbuf_tail->next = fbuf->vbuf_top;
fbuf->vbuf_next_dma = fbuf->vbuf_top;
}
else
{
fbuf->vbuf_tail->next = NULL;
fbuf->vbuf_next_dma = fbuf->vbuf_top;
}
}
fbuf->mode = mode;
}
leave_critical_section(flags);
}
vbuf_container_t *video_framebuff_pop_curr_container(video_framebuff_t *fbuf)
{
irqstate_t flags;
vbuf_container_t *ret = NULL;
flags = enter_critical_section();
if (fbuf->vbuf_top != NULL)
{
ret = dequeue_vbuf_unsafe(fbuf);
}
leave_critical_section(flags);
return ret;
}

View File

@@ -0,0 +1,90 @@
/****************************************************************************
* drivers/video/video_framebuff.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name of Sony Semiconductor Solutions Corporation nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __VIDEO_VIDEO_FRAMEBUFF_H__
#define __VIDEO_VIDEO_FRAMEBUFF_H__
#include <nuttx/video/video.h>
#include <semaphore.h>
struct vbuf_container_s
{
struct v4l2_buffer buf; /* Buffer information */
struct vbuf_container_s *next; /* pointer to next buffer */
};
typedef struct vbuf_container_s vbuf_container_t;
struct video_framebuff_s
{
enum v4l2_buf_mode mode;
sem_t lock_empty;
int container_size;
vbuf_container_t *vbuf_alloced;
vbuf_container_t *vbuf_empty;
vbuf_container_t *vbuf_top;
vbuf_container_t *vbuf_tail;
vbuf_container_t *vbuf_dma;
vbuf_container_t *vbuf_next_dma;
};
typedef struct video_framebuff_s video_framebuff_t;
/* Buffer access interface. */
void video_framebuff_init
(video_framebuff_t *fbuf);
void video_framebuff_uninit
(video_framebuff_t *fbuf);
int video_framebuff_realloc_container
(video_framebuff_t *fbuf, int sz);
vbuf_container_t *video_framebuff_get_container
(video_framebuff_t *fbuf);
void video_framebuff_free_container
(video_framebuff_t *fbuf, vbuf_container_t *cnt);
void video_framebuff_queue_container
(video_framebuff_t *fbuf, vbuf_container_t *tgt);
vbuf_container_t *video_framebuff_dq_valid_container
(video_framebuff_t *fbuf);
vbuf_container_t *video_framebuff_get_dma_container
(video_framebuff_t *fbuf);
vbuf_container_t *video_framebuff_pop_curr_container
(video_framebuff_t *fbuf);
void video_framebuff_dma_done
(video_framebuff_t *fbuf);
void video_framebuff_change_mode
(video_framebuff_t *fbuf, enum v4l2_buf_mode mode);
#endif // __VIDEO_VIDEO_FRAMEBUFF_H__

646
include/nuttx/video/video.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,230 @@
/****************************************************************************
* modules/include/video/video.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name of Sony Semiconductor Solutions Corporation nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_VIDEO_CONTROLS_H
#define __INCLUDE_NUTTX_VIDEO_CONTROLS_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Control classes */
#define V4L2_CTRL_CLASS_USER (0x0000) /**< Old-style 'user' controls */
#define V4L2_CTRL_CLASS_CAMERA (0x0001) /**< Camera class controls */
#define V4L2_CTRL_CLASS_FLASH (0x0002) /**< Camera flash controls */
#define V4L2_CTRL_CLASS_JPEG (0x0003) /**< JPEG-compression controls */
/* User-class control IDs */
#define V4L2_CID_BRIGHTNESS (0) /**< Brightness */
#define V4L2_CID_CONTRAST (1) /**< Contrast */
#define V4L2_CID_SATURATION (2) /**< Saturation */
#define V4L2_CID_HUE (3) /**< Hue */
#define V4L2_CID_AUTO_WHITE_BALANCE (4) /**< AWB */
#define V4L2_CID_RED_BALANCE (5) /**< Red balance */
#define V4L2_CID_BLUE_BALANCE (6) /**< Blue balance */
#define V4L2_CID_GAMMA (7) /**< Gamma value adjustment */
#define V4L2_CID_GAMMA_CURVE (8) /**< Gamma curve adjustment */
#define V4L2_CID_EXPOSURE (9) /**< Exposure value */
#define V4L2_CID_HFLIP (10) /**< Mirror horizontally(VIDEO) */
#define V4L2_CID_VFLIP (11) /**< Mirror vertically(VIDEO) */
#define V4L2_CID_HFLIP_STILL (12) /**< Mirror horizontally(STILL) */
#define V4L2_CID_VFLIP_STILL (13) /**< Mirror vertically(STILL) */
#define V4L2_CID_SHARPNESS (14) /**< Sharpness */
#define V4L2_CID_COLOR_KILLER (15) /**< Color killer */
#define V4L2_CID_COLORFX (16) /**< Color effect */
/** enumeration for V4L2_CID_COLORFX */
enum v4l2_colorfx
{
V4L2_COLORFX_NONE = 0, /**< no effect */
V4L2_COLORFX_BW = 1, /**< Black/white */
V4L2_COLORFX_SEPIA = 2, /**< Sepia */
V4L2_COLORFX_NEGATIVE = 3, /**< positive/negative inversion */
V4L2_COLORFX_EMBOSS = 4, /**< Emboss */
V4L2_COLORFX_SKETCH = 5, /**< Sketch */
V4L2_COLORFX_SKY_BLUE = 6, /**< Sky blue */
V4L2_COLORFX_GRASS_GREEN = 7, /**< Grass green */
V4L2_COLORFX_SKIN_WHITEN = 8, /**< Skin whiten */
V4L2_COLORFX_VIVID = 9, /**< Vivid */
V4L2_COLORFX_AQUA = 10, /**< Aqua */
V4L2_COLORFX_ART_FREEZE = 11, /**< Art freeze */
V4L2_COLORFX_SILHOUETTE = 12, /**< Silhouette */
V4L2_COLORFX_SOLARIZATION = 13, /**< Solarization */
V4L2_COLORFX_ANTIQUE = 14, /**< Antique */
V4L2_COLORFX_SET_CBCR = 15, /**< Set CbCr */
V4L2_COLORFX_PASTEL = 16 /**< Pastel */
};
#define V4L2_CID_AUTOBRIGHTNESS (17) /**< Auto brightness */
#define V4L2_CID_ROTATE (18) /**< Rotation */
/** Camera class control IDs */
#define V4L2_CID_EXPOSURE_AUTO (0) /**< Auto exposure */
/** enumeration for V4L2_CID_EXPOSURE_AUTO */
enum v4l2_exposure_auto_type
{
/** exposure time:auto, iris aperture:auto */
V4L2_EXPOSURE_AUTO = 0,
/** exposure time:manual, iris aperture:manual */
V4L2_EXPOSURE_MANUAL = 1,
/** exposure time:manual, iris aperture:auto */
V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
/** exposure time:auto, iris aperture:manual */
V4L2_EXPOSURE_APERTURE_PRIORITY = 3
};
#define V4L2_CID_EXPOSURE_ABSOLUTE (1) /**< Exposure time */
#define V4L2_CID_FOCUS_ABSOLUTE (2) /** Focus */
#define V4L2_CID_FOCUS_RELATIVE (3) /** Focus */
#define V4L2_CID_FOCUS_AUTO (4) /** Auto focus */
#define V4L2_CID_ZOOM_ABSOLUTE (5) /** Zoom(absolute) */
#define V4L2_CID_ZOOM_RELATIVE (6) /** Zoom(relative) */
#define V4L2_CID_ZOOM_CONTINUOUS (7) /** Continuous zoom */
#define V4L2_CID_IRIS_ABSOLUTE (8) /** Iris(absolute) */
#define V4L2_CID_IRIS_RELATIVE (9) /** Iris(relative) */
#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (10) /**< Preset white balance */
/** enumeration for V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE */
enum v4l2_auto_n_preset_white_balance
{
V4L2_WHITE_BALANCE_MANUAL = 0, /**< Manual */
V4L2_WHITE_BALANCE_AUTO = 1, /**< Automatic */
V4L2_WHITE_BALANCE_INCANDESCENT = 2, /**< Incandescent */
V4L2_WHITE_BALANCE_FLUORESCENT = 3, /**< Fluorescent */
V4L2_WHITE_BALANCE_FLUORESCENT_H = 4, /**< Fluorescent H */
V4L2_WHITE_BALANCE_HORIZON = 5, /**< Horizon */
V4L2_WHITE_BALANCE_DAYLIGHT = 6, /**< Daylight */
V4L2_WHITE_BALANCE_FLASH = 7, /**< Flash */
V4L2_WHITE_BALANCE_CLOUDY = 8, /**< Cloudy */
V4L2_WHITE_BALANCE_SHADE = 9, /**< Shade */
};
#define V4L2_CID_WIDE_DYNAMIC_RANGE (11) /**< Wide dynamic range */
#define V4L2_CID_IMAGE_STABILIZATION (12) /**< Image stabilization */
#define V4L2_CID_ISO_SENSITIVITY (13) /**< ISO sensitivity */
#define V4L2_CID_ISO_SENSITIVITY_AUTO (14) /**< Auto ISO sensitivity */
/** enumeration for V4L2_CID_ISO_SENSITIVITY_AUTO */
enum v4l2_iso_sensitivity_auto_type
{
V4L2_ISO_SENSITIVITY_MANUAL = 0, /**< Manual */
V4L2_ISO_SENSITIVITY_AUTO = 1, /**< Automatic */
};
#define V4L2_CID_EXPOSURE_METERING (15) /**< Exposure metering */
/** enumeration for V4L2_CID_EXPOSURE_METERING */
enum v4l2_exposure_metering
{
V4L2_EXPOSURE_METERING_AVERAGE = 0, /**< Average */
V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1, /**< Center weighted */
V4L2_EXPOSURE_METERING_SPOT = 2, /**< Spot */
V4L2_EXPOSURE_METERING_MATRIX = 3, /**< Matrix */
};
#define V4L2_CID_SCENE_MODE (16) /**< Scene selection */
/** enumeration for V4L2_CID_SCENE_MODE */
enum v4l2_scene_mode
{
V4L2_SCENE_MODE_NONE = 0, /**< No scene */
V4L2_SCENE_MODE_BACKLIGHT = 1, /**< Backlight */
V4L2_SCENE_MODE_BEACH_SNOW = 2, /**< Beach snow */
V4L2_SCENE_MODE_CANDLE_LIGHT = 3, /**< Candle light */
V4L2_SCENE_MODE_DAWN_DUSK = 4, /**< Dawn dask */
V4L2_SCENE_MODE_FALL_COLORS = 5, /**< Fall colors */
V4L2_SCENE_MODE_FIREWORKS = 6, /**< Fire works */
V4L2_SCENE_MODE_LANDSCAPE = 7, /**< Landscape */
V4L2_SCENE_MODE_NIGHT = 8, /**< Night */
V4L2_SCENE_MODE_PARTY_INDOOR = 9, /**< Indoor party */
V4L2_SCENE_MODE_PORTRAIT = 10, /**< Portrait */
V4L2_SCENE_MODE_SPORTS = 11, /**< Sports */
V4L2_SCENE_MODE_SUNSET = 12, /**< Sunset */
V4L2_SCENE_MODE_TEXT = 13 /**< Text */
};
#define V4L2_CID_3A_LOCK (17) /**< Lock 3A */
#define V4L2_LOCK_EXPOSURE (1 << 0) /**< Exposure bit for
V4L2_CID_3A_LOCK */
#define V4L2_LOCK_WHITE_BALANCE (1 << 1) /**< White balance bit for
V4L2_CID_3A_LOCK */
#define V4L2_LOCK_FOCUS (1 << 2) /**< Focus bit for
V4L2_CID_3A_LOCK */
#define V4L2_CID_AUTO_FOCUS_START (18) /**< Start single AF */
#define V4L2_CID_AUTO_FOCUS_STOP (19) /**< Stop single AF */
/** Flash and privacy (indicator) light controls */
#define V4L2_CID_FLASH_LED_MODE (0)
/** enumeration for V4L2_CID_FLASH_LED_MODE */
enum v4l2_flash_led_mode
{
V4L2_FLASH_LED_MODE_NONE, /**< Not use LED */
V4L2_FLASH_LED_MODE_FLASH, /**< Flash mode */
V4L2_FLASH_LED_MODE_TORCH, /**< Torch mode */
};
/* JPEG-class control IDs */
#define V4L2_CID_JPEG_COMPRESSION_QUALITY (0) /**< JPEG quality */
#endif /* __INCLUDE_NUTTX_VIDEO_CONTROLS_H */

View File

@@ -0,0 +1,99 @@
/****************************************************************************
* modules/include/video/video_halif.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name of Sony Semiconductor Solutions Corporation nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_VIDEO_HALIF_H
#define __INCLUDE_NUTTX_VIDEO_HALIF_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/video/video.h>
/****************************************************************************
* Public Types
****************************************************************************/
struct video_devops_s
{
CODE int (*open)(FAR void *video_priv);
CODE int (*close)(void);
CODE int (*do_halfpush)(bool enable);
CODE int (*set_buftype)(enum v4l2_buf_type type);
CODE int (*set_buf)(uint32_t bufaddr, uint32_t bufsize);
CODE int (*cancel_dma)(void);
CODE int (*get_range_of_fmt)(FAR struct v4l2_fmtdesc *format);
CODE int (*get_range_of_framesize)(FAR struct v4l2_frmsizeenum *frmsize);
CODE int (*try_format)(FAR struct v4l2_format *format);
CODE int (*set_format)(FAR struct v4l2_format *format);
CODE int (*get_range_of_frameinterval)
(FAR struct v4l2_frmivalenum *frmival);
CODE int (*set_frameinterval)(FAR struct v4l2_streamparm *parm);
CODE int (*get_range_of_ctrlvalue)(FAR struct v4l2_query_ext_ctrl *range);
CODE int (*get_menu_of_ctrlvalue)(FAR struct v4l2_querymenu *menu);
CODE int (*get_ctrlvalue)(uint16_t ctrl_class,
FAR struct v4l2_ext_control *control);
CODE int (*set_ctrlvalue)(uint16_t ctrl_class,
FAR struct v4l2_ext_control *control);
CODE int (*refresh)(void);
};
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
int video_common_notify_dma_done(uint8_t err_code,
uint32_t buf_type,
uint32_t datasize,
FAR void *priv);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_NUTTX_VIDEO_HALIF_H */