📄 camera_sensor_if.h
字号:
/*
* linux/drivers/media/video/omap/camera_sensor_if.h
*
* Copyright (C) 2004 Texas Instruments Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CAMERA_SENSOR_IF_H
#define CAMERA_SENSOR_IF_H
#include <linux/videodev2.h>
struct camera_device;
#if 0
struct camera_sensor {
unsigned char version;
int imageWidth; /*width of the image */
int imageHeight; /* height of the image */
int bytes_per_pixel; /* number of bytes per pixel. */
int (*detect)(void); /* detect this camera */
int (*init)(struct camera_device *cam); /* initialisation */
void (*cleanup)(void);
int (*open)(void);
int (*close)(void);
int (*setup)(struct v4l2_pix_format* fmt); // called when image format changes
int (*set_frame_period)(int fp);
int (*get_frame_period)(void);
int (*query_control)(struct v4l2_queryctrl *qc);
int (*get_control)(struct v4l2_control *vc);
int (*set_control)(struct v4l2_control *vc);
int (*configure) (struct camera_device *);
int (*ioctl)(struct omap24xxcam_fh *fh, unsigned long cmd, void *arg);
};
#endif
struct camera_sensor {
unsigned char version;
int (*detect)(void); /* detect this camera */
int (*init)(struct v4l2_pix_format *pix); /* initialisation */
void (*cleanup)(void);
int (*open)(void);
int (*close)(void);
int (*enum_pixformat)(struct v4l2_fmtdesc *);
int (*try_format)(struct v4l2_pix_format* fmt);
int (*set_format)( struct v4l2_pix_format* fmt, unsigned long xclk, struct v4l2_fract *fper);
int (*query_control)(struct v4l2_queryctrl *qc);
int (*get_control)(struct v4l2_control *vc);
int (*set_control)(struct v4l2_control *vc);
};
enum image_size { QQCIF, QQVGA, QCIF, QVGA, CIF, VGA, SXGA };
enum pixel_format { YUV, RGB565, RGB555 };
#define NUM_IMAGE_SIZES 7
#define NUM_PIXEL_FORMATS 3
struct capture_size {
unsigned long width;
unsigned long height;
};
/* Array of image sizes supported by OV9640. These must be ordered from
* smallest image size to largest.
*/
const static struct capture_size image_sizes[] = {
{ 88, 72 }, /* QQCIF */
{ 160, 120 }, /* QQVGA */
{ 176, 144 }, /* QCIF */
{ 320, 240 }, /* QVGA */
{ 352, 288 }, /* CIF */
{ 640, 480 }, /* VGA */
{ 1280, 960 }, /* SXGA */
};
/* list of image formats supported by the sensor */
const static struct v4l2_fmtdesc image_formats[] = {
/* The image formats below here are supported for both capture and
* overlay (preview).
*/
{
.description = "YUYV (YUV 4:2:2), packed",
.pixelformat = V4L2_PIX_FMT_YUYV,
},{
.description = "UYVY, packed",
.pixelformat = V4L2_PIX_FMT_UYVY,
},{
/* Note: V4L2 defines RGB565 as:
*
* Byte 0 Byte 1
* g2 g1 g0 r4 r3 r2 r1 r0 b4 b3 b2 b1 b0 g5 g4 g3
*
* We interpret RGB565 as:
*
* Byte 0 Byte 1
* g2 g1 g0 b4 b3 b2 b1 b0 r4 r3 r2 r1 r0 g5 g4 g3
*/
.description = "RGB565, le",
.pixelformat = V4L2_PIX_FMT_RGB565,
},{
/* Note: V4L2 defines RGB565X as:
*
* Byte 0 Byte 1
* b4 b3 b2 b1 b0 g5 g4 g3 g2 g1 g0 r4 r3 r2 r1 r0
*
* We interpret RGB565X as:
*
* Byte 0 Byte 1
* r4 r3 r2 r1 r0 g5 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0
*/
.description = "RGB565, be",
.pixelformat = V4L2_PIX_FMT_RGB565X,
},
/* The image formats below here are supported for capture only,
* not overlay (preview).
*/
{
/* Note: V4L2 defines RGB555 as:
*
* Byte 0 Byte 1
* g2 g1 g0 r4 r3 r2 r1 r0 x b4 b3 b2 b1 b0 g4 g3
*
* We interpret RGB555 as:
*
* Byte 0 Byte 1
* g2 g1 g0 b4 b3 b2 b1 b0 x r4 r3 r2 r1 r0 g4 g3
*/
.description = "RGB555, le",
.pixelformat = V4L2_PIX_FMT_RGB555,
},{
/* Note: V4L2 defines RGB555X as:
*
* Byte 0 Byte 1
* x b4 b3 b2 b1 b0 g4 g3 g2 g1 g0 r4 r3 r2 r1 r0
*
* We interpret RGB555X as:
*
* Byte 0 Byte 1
* x r4 r3 r2 r1 r0 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0
*/
.description = "RGB555, be",
.pixelformat = V4L2_PIX_FMT_RGB555X,
}
};
#define NUM_CAPTURE_FORMATS (sizeof(image_formats)/sizeof(image_formats[0]))
#define NUM_OVERLAY_FORMATS 4
#endif /* CAMERA_SENSOR_IF_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -