From cb5d8b53cb3dedac261dead66ebb57b2c556a570 Mon Sep 17 00:00:00 2001 From: Alin Jerpelea Date: Tue, 26 Jan 2021 09:14:35 +0100 Subject: [PATCH] drivers: video: altair: nxstyle fixes Nxstyle fixes to pass CI Signed-off-by: Alin Jerpelea --- drivers/video/max7456.c | 82 +-- drivers/video/ov2640.c | 924 ++++++++++++++++++++++++++------ drivers/video/video_framebuff.c | 50 +- drivers/video/video_framebuff.h | 10 +- 4 files changed, 851 insertions(+), 215 deletions(-) diff --git a/drivers/video/max7456.c b/drivers/video/max7456.c index 2a5f2afd61..d341c981fd 100644 --- a/drivers/video/max7456.c +++ b/drivers/video/max7456.c @@ -34,16 +34,17 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - *****************************************************************************/ + ****************************************************************************/ -/***************************************************************************** +/**************************************************************************** * Theory of Operation * * The MAX7456 is a single-channel, monochrome, on-screen-display generator * that accepts an NTSC or PAL video input signal, overlays user-defined * character data, and renders the combined stream to CVBS (analog) output. - * The typical use case then forwards that CVBS output to a video transmitter, - * analog display, recording device, and/or other external components. + * The typical use case then forwards that CVBS output to a video + * transmitter, analog display, recording device, and/or other external + * components. * * The chip is fundamentally an SPI slave device with a register bank to * configure the chip's analog components, update values in the display frame @@ -72,8 +73,8 @@ * * Note: Although we use the term "frame buffer", we cannot use the NuttX * standard /dev/fbN interface because our buffer memory is accessible only - * across SPI. This is an inexpensive, slow, simple chip, and you wouldn't use - * it for intensive work, but you WOULD use it on a memory-constrained + * across SPI. This is an inexpensive, slow, simple chip, and you wouldn't + * use it for intensive work, but you WOULD use it on a memory-constrained * device. We keep our RAM footprint small by not keeping a local copy of the * framebuffer data. * @@ -439,10 +440,10 @@ static int regaddr_from_name(FAR const char *name) * * Description: * Reads @len bytes into @buf from @dev, starting at register address - * @addr. This is a low-level function used for reading a sequence of one or - * more register values, and isn't usually called directly unless you REALLY - * know what you are doing. Consider one of the register-specific helper - * functions defined below whenever possible. + * @addr. This is a low-level function used for reading a sequence of one + * or more register values, and isn't usually called directly unless you + * REALLY know what you are doing. Consider one of the register-specific + * helper functions defined below whenever possible. * * Note: The caller must hold @dev->lock before calling this function. * @@ -505,8 +506,8 @@ static int __mx7_read_reg(FAR struct mx7_dev_s *dev, * Writes @len bytes from @buf to @dev, starting at @addr. This is a * low-level function used for updating a sequence of one or more register * values, and it DOES NOT check that the register being requested is - * write-capable. This function isn't called directly unless you REALLY know - * what you are doing. + * write-capable. This function isn't called directly unless you REALLY + * know what you are doing. * * Consider one of the register-specific helper functions defined below * whenever possible. If a helper function for the register you desire to @@ -628,7 +629,8 @@ static inline int __mx7_read_reg__dmm(FAR struct mx7_dev_s *dev) * ****************************************************************************/ -static inline int __mx7_write_reg__vm0(FAR struct mx7_dev_s *dev, uint8_t val) +static inline int __mx7_write_reg__vm0(FAR struct mx7_dev_s *dev, + uint8_t val) { return __mx7_write_reg(dev, VM0, &val, sizeof(val)); } @@ -687,7 +689,8 @@ static inline int __mx7_write_reg__cmah(FAR struct mx7_dev_s *dev, * ****************************************************************************/ -static inline int __mx7_write_reg__cmm(FAR struct mx7_dev_s *dev, uint8_t val) +static inline int __mx7_write_reg__cmm(FAR struct mx7_dev_s *dev, + uint8_t val) { return __mx7_write_reg(dev, CMM, &val, sizeof(val)); } @@ -789,7 +792,8 @@ static inline int __mx7_read_reg__cmdo(FAR struct mx7_dev_s *dev) * ****************************************************************************/ -static inline int __mx7_write_reg__dmm(FAR struct mx7_dev_s *dev, uint8_t val) +static inline int __mx7_write_reg__dmm(FAR struct mx7_dev_s *dev, + uint8_t val) { return __mx7_write_reg(dev, DMM, &val, sizeof(val)); } @@ -966,7 +970,7 @@ static void mx7_reset(FAR struct mx7_dev_s *dev) __unlock(dev); } -/************************************************************************ +/**************************************************************************** * Name: __write_fb * * Description: @@ -1143,7 +1147,8 @@ static ssize_t __write_fb(FAR struct mx7_dev_s *dev, * Each row in the CA EEPROM is 64 bytes wide, but only the first 54 bytes * are used. The rest are marked as "unused memory" in the datasheet. All * 64 bytes of each row are included in the data we return, if the user's - * request spans that area. We assume that the user understands the format. + * request spans that area. We assume that the user understands the + * format. * * In total, the chip has 64 bytes per row x 256 rows of EEPROM. * @@ -1241,6 +1246,7 @@ static ssize_t __read_cm(FAR struct mx7_dev_s *dev, /* The shadow RAM is large enough to hold an entire row, so we don't * need to go back for another until we've read all of this one. */ + do { __mx7_write_reg__cmal(dev, cmal); @@ -1424,14 +1430,14 @@ static ssize_t mx7_write_fb(FAR struct file *filep, FAR const char *buf, * * We use the approach you see here so that we don't have to have one * distinct function (and a separate file_operations structure) for each of - * the many interfaces we're likely to create for interacting with this chip - * in its various useful ways. This schema also lets us re-use the interface - * code internally (see the test-pattern generator at startup.) + * the many interfaces we're likely to create for interacting with this + * chip in its various useful ways. This schema also lets us re-use the + * interface code internally (see the test-pattern generator at startup.) * - * In general, any function we call from here uses the combination of seek() - * and write() to implement a zero-copy frame buffer. The seek() parameter - * sets the current cursor position, and successive write()s provide the - * character data starting at that position. + * In general, any function we call from here uses the combination of + * seek() and write() to implement a zero-copy frame buffer. The seek() + * parameter sets the current cursor position, and successive write()s + * provide the character data starting at that position. * * TODO: At the moment, we have no mechanism for setting the character * attribute (the LBC, BLK, and INV fields in DMM) for the data arriving @@ -1439,9 +1445,9 @@ static ssize_t mx7_write_fb(FAR struct file *filep, FAR const char *buf, * for the basic stuff. * * The above isn't a hard problem to solve, I just don't need to solve it - * right now. And, I don't know what the most convenient solution would look - * like: the obvious choice is ioctl(), but I don't like ioctl() because I - * can't test it from the command line. + * right now. And, I don't know what the most convenient solution would + * look like: the obvious choice is ioctl(), but I don't like ioctl() + * because I can't test it from the command line. * * One idea is to have "fb", "blink", "inv", and other entry points for * writing data with specific attributes. That has a nice feel to it, @@ -1598,18 +1604,18 @@ static int mx7_debug_close(FAR struct file *filep) * "/dev/osd0/VM0", etc., and reads from all of those interfaces arrive * here. * - * Utilities like cat(1) will exit automatically at EOF, which can be tricky - * to deliver at the right time. We achieve this by reading the associated - * register value only once, when filep->f_pos is at the beginning of the - * "file" we're emulating. The value obtained is stored in dev->debug[], and - * we work our way through that and increment the "file position" - * accordingly to keep track (because the user may ask for only one byte - * at a time, and our register values require two bytes to express as - * ascii-hex text). + * Utilities like cat(1) will exit automatically at EOF, which can be + * tricky to deliver at the right time. We achieve this by reading the + * associated register value only once, when filep->f_pos is at the + * beginning of the "file" we're emulating. The value obtained is stored + * in dev->debug[], and we work our way through that and increment the + * "file position" accordingly to keep track (because the user may ask for + * only one byte at a time, and our register values require two bytes to + * express as ascii-hex text). * - * When we reach the end of dev->debug[], we return EOF. If the user wants a - * fresh copy, they can either close and reopen the interface, or move the - * file pointer back to 0 via a seek operation. + * When we reach the end of dev->debug[], we return EOF. If the user wants + * a fresh copy, they can either close and reopen the interface, or move + * the file pointer back to 0 via a seek operation. * ****************************************************************************/ diff --git a/drivers/video/ov2640.c b/drivers/video/ov2640.c index bb3e4f2a96..67bdd9948c 100644 --- a/drivers/video/ov2640.c +++ b/drivers/video/ov2640.c @@ -306,7 +306,12 @@ static int ov2640_reset(FAR struct i2c_master_s *i2c); static const struct ovr2640_reg_s g_ov2640_reset[] = { - {0xff, 0x01}, {0x12, 0x80} + { + 0xff, 0x01 + }, + { + 0x12, 0x80 + } }; #define OV2640_RESET_NENTRIES ARRAY_NENTRIES(g_ov2640_reset) @@ -315,40 +320,176 @@ static const struct ovr2640_reg_s g_ov2640_reset[] = static const struct ovr2640_reg_s g_ov2640_initialregs[] = { - {0xff, 0x00}, {0x2c, 0xff}, {0x2e, 0xdf}, {0xff, 0x01}, {0x3c, 0x32}, - {0x11, 0x00}, {0x09, 0x02}, {0x04, 0x28}, {0x13, 0xe5}, {0x14, 0x48}, - {0x2c, 0x0c}, {0x33, 0x78}, {0x3a, 0x33}, {0x3b, 0xfb}, {0x3e, 0x00}, - {0x43, 0x11}, {0x16, 0x10}, {0x39, 0x02}, {0x35, 0x88}, {0x22, 0x0a}, - {0x37, 0x40}, {0x23, 0x00}, {0x34, 0xa0}, {0x06, 0x02}, {0x06, 0x88}, - {0x07, 0xc0}, {0x0d, 0xb7}, {0x0e, 0x01}, {0x4c, 0x00}, {0x4a, 0x81}, - {0x21, 0x99}, {0x24, 0x40}, {0x25, 0x38}, {0x26, 0x82}, {0x5c, 0x00}, - {0x63, 0x00}, {0x46, 0x22}, {0x0c, 0x3a}, {0x5d, 0x55}, {0x5e, 0x7d}, - {0x5f, 0x7d}, {0x60, 0x55}, {0x61, 0x70}, {0x62, 0x80}, {0x7c, 0x05}, - {0x20, 0x80}, {0x28, 0x30}, {0x6c, 0x00}, {0x6d, 0x80}, {0x6e, 0x00}, - {0x70, 0x02}, {0x71, 0x94}, {0x73, 0xc1}, {0x3d, 0x34}, {0x12, 0x04}, - {0x5a, 0x57}, {0x4f, 0xbb}, {0x50, 0x9c}, {0xff, 0x00}, {0xe5, 0x7f}, - {0xf9, 0xc0}, {0x41, 0x24}, {0xe0, 0x14}, {0x76, 0xff}, {0x33, 0xa0}, - {0x42, 0x20}, {0x43, 0x18}, {0x4c, 0x00}, {0x87, 0xd0}, {0x88, 0x3f}, - {0xd7, 0x03}, {0xd9, 0x10}, {0xd3, 0x82}, {0xc8, 0x08}, {0xc9, 0x80}, - {0x7c, 0x00}, {0x7d, 0x00}, {0x7c, 0x03}, {0x7d, 0x48}, {0x7d, 0x48}, - {0x7c, 0x08}, {0x7d, 0x20}, {0x7d, 0x10}, {0x7d, 0x0e}, {0x90, 0x00}, - {0x91, 0x0e}, {0x91, 0x1a}, {0x91, 0x31}, {0x91, 0x5a}, {0x91, 0x69}, - {0x91, 0x75}, {0x91, 0x7e}, {0x91, 0x88}, {0x91, 0x8f}, {0x91, 0x96}, - {0x91, 0xa3}, {0x91, 0xaf}, {0x91, 0xc4}, {0x91, 0xd7}, {0x91, 0xe8}, - {0x91, 0x20}, {0x92, 0x00}, {0x93, 0x06}, {0x93, 0xe3}, {0x93, 0x03}, - {0x93, 0x03}, {0x93, 0x00}, {0x93, 0x02}, {0x93, 0x00}, {0x93, 0x00}, - {0x93, 0x00}, {0x93, 0x00}, {0x93, 0x00}, {0x93, 0x00}, {0x93, 0x00}, - {0x96, 0x00}, {0x97, 0x08}, {0x97, 0x19}, {0x97, 0x02}, {0x97, 0x0c}, - {0x97, 0x24}, {0x97, 0x30}, {0x97, 0x28}, {0x97, 0x26}, {0x97, 0x02}, - {0x97, 0x98}, {0x97, 0x80}, {0x97, 0x00}, {0x97, 0x00}, {0xa4, 0x00}, - {0xa8, 0x00}, {0xc5, 0x11}, {0xc6, 0x51}, {0xbf, 0x80}, {0xc7, 0x10}, - {0xb6, 0x66}, {0xb8, 0xa5}, {0xb7, 0x64}, {0xb9, 0x7c}, {0xb3, 0xaf}, - {0xb4, 0x97}, {0xb5, 0xff}, {0xb0, 0xc5}, {0xb1, 0x94}, {0xb2, 0x0f}, - {0xc4, 0x5c}, {0xa6, 0x00}, {0xa7, 0x20}, {0xa7, 0xd8}, {0xa7, 0x1b}, - {0xa7, 0x31}, {0xa7, 0x00}, {0xa7, 0x18}, {0xa7, 0x20}, {0xa7, 0xd8}, - {0xa7, 0x19}, {0xa7, 0x31}, {0xa7, 0x00}, {0xa7, 0x18}, {0xa7, 0x20}, - {0xa7, 0xd8}, {0xa7, 0x19}, {0xa7, 0x31}, {0xa7, 0x00}, {0xa7, 0x18}, - {0x7f, 0x00}, {0xe5, 0x1f}, {0xe1, 0x77}, {0xdd, 0x7f}, {0xc2, 0x0e} + {0xff, 0x00}, + {0x2c, 0xff}, + {0x2e, 0xdf}, + {0xff, 0x01}, + {0x3c, 0x32}, + {0x11, 0x00}, + {0x09, 0x02}, + {0x04, 0x28}, + {0x13, 0xe5}, + {0x14, 0x48}, + {0x2c, 0x0c}, + {0x33, 0x78}, + {0x3a, 0x33}, + {0x3b, 0xfb}, + {0x3e, 0x00}, + {0x43, 0x11}, + {0x16, 0x10}, + {0x39, 0x02}, + {0x35, 0x88}, + {0x22, 0x0a}, + {0x37, 0x40}, + {0x23, 0x00}, + {0x34, 0xa0}, + {0x06, 0x02}, + {0x06, 0x88}, + {0x07, 0xc0}, + {0x0d, 0xb7}, + {0x0e, 0x01}, + {0x4c, 0x00}, + {0x4a, 0x81}, + {0x21, 0x99}, + {0x24, 0x40}, + {0x25, 0x38}, + {0x26, 0x82}, + {0x5c, 0x00}, + {0x63, 0x00}, + {0x46, 0x22}, + {0x0c, 0x3a}, + {0x5d, 0x55}, + {0x5e, 0x7d}, + {0x5f, 0x7d}, + {0x60, 0x55}, + {0x61, 0x70}, + {0x62, 0x80}, + {0x7c, 0x05}, + {0x20, 0x80}, + {0x28, 0x30}, + {0x6c, 0x00}, + {0x6d, 0x80}, + {0x6e, 0x00}, + {0x70, 0x02}, + {0x71, 0x94}, + {0x73, 0xc1}, + {0x3d, 0x34}, + {0x12, 0x04}, + {0x5a, 0x57}, + {0x4f, 0xbb}, + {0x50, 0x9c}, + {0xff, 0x00}, + {0xe5, 0x7f}, + {0xf9, 0xc0}, + {0x41, 0x24}, + {0xe0, 0x14}, + {0x76, 0xff}, + {0x33, 0xa0}, + {0x42, 0x20}, + {0x43, 0x18}, + {0x4c, 0x00}, + {0x87, 0xd0}, + {0x88, 0x3f}, + {0xd7, 0x03}, + {0xd9, 0x10}, + {0xd3, 0x82}, + {0xc8, 0x08}, + {0xc9, 0x80}, + {0x7c, 0x00}, + {0x7d, 0x00}, + {0x7c, 0x03}, + {0x7d, 0x48}, + {0x7d, 0x48}, + {0x7c, 0x08}, + {0x7d, 0x20}, + {0x7d, 0x10}, + {0x7d, 0x0e}, + {0x90, 0x00}, + {0x91, 0x0e}, + {0x91, 0x1a}, + {0x91, 0x31}, + {0x91, 0x5a}, + {0x91, 0x69}, + {0x91, 0x75}, + {0x91, 0x7e}, + {0x91, 0x88}, + {0x91, 0x8f}, + {0x91, 0x96}, + {0x91, 0xa3}, + {0x91, 0xaf}, + {0x91, 0xc4}, + {0x91, 0xd7}, + {0x91, 0xe8}, + {0x91, 0x20}, + {0x92, 0x00}, + {0x93, 0x06}, + {0x93, 0xe3}, + {0x93, 0x03}, + {0x93, 0x03}, + {0x93, 0x00}, + {0x93, 0x02}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x96, 0x00}, + {0x97, 0x08}, + {0x97, 0x19}, + {0x97, 0x02}, + {0x97, 0x0c}, + {0x97, 0x24}, + {0x97, 0x30}, + {0x97, 0x28}, + {0x97, 0x26}, + {0x97, 0x02}, + {0x97, 0x98}, + {0x97, 0x80}, + {0x97, 0x00}, + {0x97, 0x00}, + {0xa4, 0x00}, + {0xa8, 0x00}, + {0xc5, 0x11}, + {0xc6, 0x51}, + {0xbf, 0x80}, + {0xc7, 0x10}, + {0xb6, 0x66}, + {0xb8, 0xa5}, + {0xb7, 0x64}, + {0xb9, 0x7c}, + {0xb3, 0xaf}, + {0xb4, 0x97}, + {0xb5, 0xff}, + {0xb0, 0xc5}, + {0xb1, 0x94}, + {0xb2, 0x0f}, + {0xc4, 0x5c}, + {0xa6, 0x00}, + {0xa7, 0x20}, + {0xa7, 0xd8}, + {0xa7, 0x1b}, + {0xa7, 0x31}, + {0xa7, 0x00}, + {0xa7, 0x18}, + {0xa7, 0x20}, + {0xa7, 0xd8}, + {0xa7, 0x19}, + {0xa7, 0x31}, + {0xa7, 0x00}, + {0xa7, 0x18}, + {0xa7, 0x20}, + {0xa7, 0xd8}, + {0xa7, 0x19}, + {0xa7, 0x31}, + {0xa7, 0x00}, + {0xa7, 0x18}, + {0x7f, 0x00}, + {0xe5, 0x1f}, + {0xe1, 0x77}, + {0xdd, 0x7f}, + {0xc2, 0x0e} }; #define OV2640_INITIALREGS_NENTRIES ARRAY_NENTRIES(g_ov2640_initialregs) @@ -356,8 +497,16 @@ static const struct ovr2640_reg_s g_ov2640_initialregs[] = static const struct ovr2640_reg_s g_ov2640_resolution_common[] = { - {0xff, 0x00}, {0xe0, 0x04}, {0xc0, 0xc8}, {0xc1, 0x96}, {0x86, 0x3d}, - {0x51, 0x90}, {0x52, 0x2c}, {0x53, 0x00}, {0x54, 0x00}, {0x55, 0x88}, + {0xff, 0x00}, + {0xe0, 0x04}, + {0xc0, 0xc8}, + {0xc1, 0x96}, + {0x86, 0x3d}, + {0x51, 0x90}, + {0x52, 0x2c}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x88}, {0x57, 0x00} }; #define OV2640_RESOLUTION_COMMON_NENTRIES ARRAY_NENTRIES(g_ov2640_resolution_common) @@ -365,7 +514,11 @@ static const struct ovr2640_reg_s g_ov2640_resolution_common[] = #if defined(CONFIG_OV2640_QCIF_RESOLUTION) static const struct ovr2640_reg_s g_ov2640_qcif_resolution[] = { - {0x50, 0x9b}, {0x5a, 0x2c}, {0x5b, 0x24}, {0x5c, 0x00}, {0xd3, 0x04}, + {0x50, 0x9b}, + {0x5a, 0x2c}, + {0x5b, 0x24}, + {0x5c, 0x00}, + {0xd3, 0x04}, {0xe0, 0x00} }; #define OV2640_QCIF_RESOLUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_qcif_resolution) @@ -373,7 +526,11 @@ static const struct ovr2640_reg_s g_ov2640_qcif_resolution[] = #elif defined(CONFIG_OV2640_QVGA_RESOLUTION) static const struct ovr2640_reg_s g_ov2640_qvga_resolution[] = { - {0x50, 0x92}, {0x5a, 0x50}, {0x5b, 0x3c}, {0x5c, 0x00}, {0xd3, 0x04}, + {0x50, 0x92}, + {0x5a, 0x50}, + {0x5b, 0x3c}, + {0x5c, 0x00}, + {0xd3, 0x04}, {0xe0, 0x00}, }; #define OV2640_QVGA_RESOLUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_qvga_resolution) @@ -381,7 +538,11 @@ static const struct ovr2640_reg_s g_ov2640_qvga_resolution[] = #elif defined(CONFIG_OV2640_CIF_RESOLUTION) static const struct ovr2640_reg_s g_ov2640_cif_resolution[] = { - {0x50, 0x92}, {0x5a, 0x58}, {0x5b, 0x48}, {0x5c, 0x00}, {0xd3, 0x08}, + {0x50, 0x92}, + {0x5a, 0x58}, + {0x5b, 0x48}, + {0x5c, 0x00}, + {0xd3, 0x08}, {0xe0, 0x00} }; #define OV2640_CIF_RESOLUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_cif_resolution) @@ -389,7 +550,11 @@ static const struct ovr2640_reg_s g_ov2640_cif_resolution[] = #elif defined(CONFIG_OV2640_VGA_RESOLUTION) static const struct ovr2640_reg_s g_ov2640_vga_resolution[] = { - {0x50, 0x80}, {0x5a, 0xa0}, {0x5b, 0x78}, {0x5c, 0x00}, {0xd3, 0x02}, + {0x50, 0x80}, + {0x5a, 0xa0}, + {0x5b, 0x78}, + {0x5c, 0x00}, + {0xd3, 0x02}, {0xe0, 0x00} }; #define OV2640_VGA_RESOLUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_vga_resolution) @@ -397,7 +562,11 @@ static const struct ovr2640_reg_s g_ov2640_vga_resolution[] = #elif defined(CONFIG_OV2640_SVGA_RESOLUTION) static const struct ovr2640_reg_s g_ov2640_svga_resolution[] = { - {0x50, 0x89}, {0x5a, 0xc8}, {0x5b, 0x96}, {0x5c, 0x00}, {0xd3, 0x02}, + {0x50, 0x89}, + {0x5a, 0xc8}, + {0x5b, 0x96}, + {0x5c, 0x00}, + {0xd3, 0x02}, {0xe0, 0x00} }; #define OV2640_SVGA_RESOLUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_svga_resolution) @@ -405,24 +574,41 @@ static const struct ovr2640_reg_s g_ov2640_svga_resolution[] = #elif defined(CONFIG_OV2640_XVGA_RESOLUTION) static const struct ovr2640_reg_s g_ov2640_xga_resolution[] = { - {0x50, 0x80}, {0x5a, 0x00}, {0x5b, 0xc0}, {0x5c, 0x01}, {0xd3, 0x02}, - {0xe0, 0x00}, {0x50, 0x00} + {0x50, 0x80}, + {0x5a, 0x00}, + {0x5b, 0xc0}, + {0x5c, 0x01}, + {0xd3, 0x02}, + {0xe0, 0x00}, + {0x50, 0x00} }; #define OV2640_XGA_RESOLUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_xga_resolution) #elif defined(CONFIG_OV2640_SXGA_RESOLUTION) static const struct ovr2640_reg_s g_ov2640_sxga_resolution[] = { - {0x50, 0x80}, {0x5a, 0x40}, {0x5b, 0x00}, {0x5c, 0x05}, {0xd3, 0x02}, - {0xe0, 0x00}, {0x50, 0x00}, {0xd3, 0x82} + {0x50, 0x80}, + {0x5a, 0x40}, + {0x5b, 0x00}, + {0x5c, 0x05}, + {0xd3, 0x02}, + {0xe0, 0x00}, + {0x50, 0x00}, + {0xd3, 0x82} }; #define OV2640_SXGA_RESOLUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_sxga_resolution) #elif defined(CONFIG_OV2640_UXGA_RESOLUTION) static const struct ovr2640_reg_s g_ov2640_uxga_resolution[] = { - {0x50, 0x80}, {0x5a, 0x90}, {0x5b, 0x2c}, {0x5c, 0x05}, {0xd3, 0x00}, - {0xe0, 0x00}, {0x50, 0x00}, {0xd3, 0x80} + {0x50, 0x80}, + {0x5a, 0x90}, + {0x5b, 0x2c}, + {0x5c, 0x05}, + {0xd3, 0x00}, + {0xe0, 0x00}, + {0x50, 0x00}, + {0xd3, 0x80} }; #define OV2640_UXGA_RESOLUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_uxga_resolution) @@ -434,14 +620,19 @@ static const struct ovr2640_reg_s g_ov2640_uxga_resolution[] = static const struct ovr2640_reg_s g_ov2640_colorfmt_common[] = { - {0xff, 0x00}, {0x05, 0x00} + {0xff, 0x00}, + {0x05, 0x00} }; #define OV2640_COLORFMT_COMMON_NENTRIES ARRAY_NENTRIES(g_ov2640_colorfmt_common) #if defined(CONFIG_OV2640_YUV422_COLORFMT) static const struct ovr2640_reg_s g_ov2640_yuv422_colorfmt[] = { - {0xda, 0x01}, {0xd7, 0x01}, {0x33, 0xa0}, {0xe1, 0x67}, {0xe0, 0x00}, + {0xda, 0x01}, + {0xd7, 0x01}, + {0x33, 0xa0}, + {0xe1, 0x67}, + {0xe0, 0x00}, {0x05, 0x00} }; #define OV2640_YUV422_COLORFMT_NENTRIES ARRAY_NENTRIES(g_ov2640_yuv422_colorfmt) @@ -449,7 +640,10 @@ static const struct ovr2640_reg_s g_ov2640_yuv422_colorfmt[] = #elif defined(CONFIG_OV2640_RGB565_COLORFMT) static const struct ovr2640_reg_s g_ov2640_rgb565_colorfmt[] = { - {0xda, 0x09}, {0xd7, 0x03}, {0xe0, 0x00}, {0x05, 0x00} + {0xda, 0x09}, + {0xd7, 0x03}, + {0xe0, 0x00}, + {0x05, 0x00} }; #define OV2640_RGB565_COLORFMT_NENTRIES ARRAY_NENTRIES(g_ov2640_rgb565_colorfmt) @@ -461,44 +655,196 @@ static const struct ovr2640_reg_s g_ov2640_rgb565_colorfmt[] = #ifdef CONFIG_OV2640_JPEG static const struct ovr2640_reg_s g_ov2640_jpeg_init[] = { - {0xff, 0x00}, {0x2c, 0xff}, {0x2e, 0xdf}, {0xff, 0x01}, {0x3c, 0x32}, - {0x11, 0x04}, {0x09, 0x02}, {0x04, 0x28}, {0x13, 0xe5}, {0x14, 0x48}, - {0x2c, 0x0c}, {0x33, 0x78}, {0x3a, 0x33}, {0x3b, 0xfb}, {0x3e, 0x00}, - {0x43, 0x11}, {0x16, 0x10}, {0x39, 0x92}, {0x35, 0xda}, {0x22, 0x1a}, - {0x37, 0xc3}, {0x23, 0x00}, {0x34, 0xc0}, {0x36, 0x1a}, {0x06, 0x88}, - {0x07, 0xc0}, {0x0d, 0x87}, {0x0e, 0x41}, {0x4c, 0x00}, {0x48, 0x00}, - {0x5b, 0x00}, {0x42, 0x03}, {0x4a, 0x81}, {0x21, 0x99}, {0x24, 0x40}, - {0x25, 0x38}, {0x26, 0x82}, {0x5c, 0x00}, {0x63, 0x00}, {0x61, 0x70}, - {0x62, 0x80}, {0x7c, 0x05}, {0x20, 0x80}, {0x28, 0x30}, {0x6c, 0x00}, - {0x6d, 0x80}, {0x6e, 0x00}, {0x70, 0x02}, {0x71, 0x94}, {0x73, 0xc1}, - {0x12, 0x40}, {0x17, 0x11}, {0x18, 0x43}, {0x19, 0x00}, {0x1a, 0x4b}, - {0x32, 0x09}, {0x37, 0xc0}, {0x4f, 0x60}, {0x50, 0xa8}, {0x6d, 0x00}, - {0x3d, 0x38}, {0x46, 0x3f}, {0x4f, 0x60}, {0x0c, 0x3c}, {0xff, 0x00}, - {0xe5, 0x7f}, {0xf9, 0xc0}, {0x41, 0x24}, {0xe0, 0x14}, {0x76, 0xff}, - {0x33, 0xa0}, {0x42, 0x20}, {0x43, 0x18}, {0x4c, 0x00}, {0x87, 0xd5}, - {0x88, 0x3f}, {0xd7, 0x03}, {0xd9, 0x10}, {0xd3, 0x82}, {0xc8, 0x08}, - {0xc9, 0x80}, {0x7c, 0x00}, {0x7d, 0x00}, {0x7c, 0x03}, {0x7d, 0x48}, - {0x7d, 0x48}, {0x7c, 0x08}, {0x7d, 0x20}, {0x7d, 0x10}, {0x7d, 0x0e}, - {0x90, 0x00}, {0x91, 0x0e}, {0x91, 0x1a}, {0x91, 0x31}, {0x91, 0x5a}, - {0x91, 0x69}, {0x91, 0x75}, {0x91, 0x7e}, {0x91, 0x88}, {0x91, 0x8f}, - {0x91, 0x96}, {0x91, 0xa3}, {0x91, 0xaf}, {0x91, 0xc4}, {0x91, 0xd7}, - {0x91, 0xe8}, {0x91, 0x20}, {0x92, 0x00}, {0x93, 0x06}, {0x93, 0xe3}, - {0x93, 0x05}, {0x93, 0x05}, {0x93, 0x00}, {0x93, 0x04}, {0x93, 0x00}, - {0x93, 0x00}, {0x93, 0x00}, {0x93, 0x00}, {0x93, 0x00}, {0x93, 0x00}, - {0x93, 0x00}, {0x96, 0x00}, {0x97, 0x08}, {0x97, 0x19}, {0x97, 0x02}, - {0x97, 0x0c}, {0x97, 0x24}, {0x97, 0x30}, {0x97, 0x28}, {0x97, 0x26}, - {0x97, 0x02}, {0x97, 0x98}, {0x97, 0x80}, {0x97, 0x00}, {0x97, 0x00}, - {0xc3, 0xed}, {0xa4, 0x00}, {0xa8, 0x00}, {0xc5, 0x11}, {0xc6, 0x51}, - {0xbf, 0x80}, {0xc7, 0x10}, {0xb6, 0x66}, {0xb8, 0xa5}, {0xb7, 0x64}, - {0xb9, 0x7c}, {0xb3, 0xaf}, {0xb4, 0x97}, {0xb5, 0xff}, {0xb0, 0xc5}, - {0xb1, 0x94}, {0xb2, 0x0f}, {0xc4, 0x5c}, {0xc0, 0x64}, {0xc1, 0x4b}, - {0x8c, 0x00}, {0x86, 0x3d}, {0x50, 0x00}, {0x51, 0xc8}, {0x52, 0x96}, - {0x53, 0x00}, {0x54, 0x00}, {0x55, 0x00}, {0x5a, 0xc8}, {0x5b, 0x96}, - {0x5c, 0x00}, {0xd3, 0x00}, {0xc3, 0xed}, {0x7f, 0x00}, {0xda, 0x00}, - {0xe5, 0x1f}, {0xe1, 0x67}, {0xe0, 0x00}, {0xdd, 0x7f}, {0x05, 0x00}, - {0x12, 0x40}, {0xd3, 0x04}, {0xc0, 0x16}, {0xc1, 0x12}, {0x8c, 0x00}, - {0x86, 0x3d}, {0x50, 0x00}, {0x51, 0x2c}, {0x52, 0x24}, {0x53, 0x00}, - {0x54, 0x00}, {0x55, 0x00}, {0x5a, 0x2c}, {0x5b, 0x24}, {0x5c, 0x00}, + {0xff, 0x00}, + {0x2c, 0xff}, + {0x2e, 0xdf}, + {0xff, 0x01}, + {0x3c, 0x32}, + {0x11, 0x04}, + {0x09, 0x02}, + {0x04, 0x28}, + {0x13, 0xe5}, + {0x14, 0x48}, + {0x2c, 0x0c}, + {0x33, 0x78}, + {0x3a, 0x33}, + {0x3b, 0xfb}, + {0x3e, 0x00}, + {0x43, 0x11}, + {0x16, 0x10}, + {0x39, 0x92}, + {0x35, 0xda}, + {0x22, 0x1a}, + {0x37, 0xc3}, + {0x23, 0x00}, + {0x34, 0xc0}, + {0x36, 0x1a}, + {0x06, 0x88}, + {0x07, 0xc0}, + {0x0d, 0x87}, + {0x0e, 0x41}, + {0x4c, 0x00}, + {0x48, 0x00}, + {0x5b, 0x00}, + {0x42, 0x03}, + {0x4a, 0x81}, + {0x21, 0x99}, + {0x24, 0x40}, + {0x25, 0x38}, + {0x26, 0x82}, + {0x5c, 0x00}, + {0x63, 0x00}, + {0x61, 0x70}, + {0x62, 0x80}, + {0x7c, 0x05}, + {0x20, 0x80}, + {0x28, 0x30}, + {0x6c, 0x00}, + {0x6d, 0x80}, + {0x6e, 0x00}, + {0x70, 0x02}, + {0x71, 0x94}, + {0x73, 0xc1}, + {0x12, 0x40}, + {0x17, 0x11}, + {0x18, 0x43}, + {0x19, 0x00}, + {0x1a, 0x4b}, + {0x32, 0x09}, + {0x37, 0xc0}, + {0x4f, 0x60}, + {0x50, 0xa8}, + {0x6d, 0x00}, + {0x3d, 0x38}, + {0x46, 0x3f}, + {0x4f, 0x60}, + {0x0c, 0x3c}, + {0xff, 0x00}, + {0xe5, 0x7f}, + {0xf9, 0xc0}, + {0x41, 0x24}, + {0xe0, 0x14}, + {0x76, 0xff}, + {0x33, 0xa0}, + {0x42, 0x20}, + {0x43, 0x18}, + {0x4c, 0x00}, + {0x87, 0xd5}, + {0x88, 0x3f}, + {0xd7, 0x03}, + {0xd9, 0x10}, + {0xd3, 0x82}, + {0xc8, 0x08}, + {0xc9, 0x80}, + {0x7c, 0x00}, + {0x7d, 0x00}, + {0x7c, 0x03}, + {0x7d, 0x48}, + {0x7d, 0x48}, + {0x7c, 0x08}, + {0x7d, 0x20}, + {0x7d, 0x10}, + {0x7d, 0x0e}, + {0x90, 0x00}, + {0x91, 0x0e}, + {0x91, 0x1a}, + {0x91, 0x31}, + {0x91, 0x5a}, + {0x91, 0x69}, + {0x91, 0x75}, + {0x91, 0x7e}, + {0x91, 0x88}, + {0x91, 0x8f}, + {0x91, 0x96}, + {0x91, 0xa3}, + {0x91, 0xaf}, + {0x91, 0xc4}, + {0x91, 0xd7}, + {0x91, 0xe8}, + {0x91, 0x20}, + {0x92, 0x00}, + {0x93, 0x06}, + {0x93, 0xe3}, + {0x93, 0x05}, + {0x93, 0x05}, + {0x93, 0x00}, + {0x93, 0x04}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x93, 0x00}, + {0x96, 0x00}, + {0x97, 0x08}, + {0x97, 0x19}, + {0x97, 0x02}, + {0x97, 0x0c}, + {0x97, 0x24}, + {0x97, 0x30}, + {0x97, 0x28}, + {0x97, 0x26}, + {0x97, 0x02}, + {0x97, 0x98}, + {0x97, 0x80}, + {0x97, 0x00}, + {0x97, 0x00}, + {0xc3, 0xed}, + {0xa4, 0x00}, + {0xa8, 0x00}, + {0xc5, 0x11}, + {0xc6, 0x51}, + {0xbf, 0x80}, + {0xc7, 0x10}, + {0xb6, 0x66}, + {0xb8, 0xa5}, + {0xb7, 0x64}, + {0xb9, 0x7c}, + {0xb3, 0xaf}, + {0xb4, 0x97}, + {0xb5, 0xff}, + {0xb0, 0xc5}, + {0xb1, 0x94}, + {0xb2, 0x0f}, + {0xc4, 0x5c}, + {0xc0, 0x64}, + {0xc1, 0x4b}, + {0x8c, 0x00}, + {0x86, 0x3d}, + {0x50, 0x00}, + {0x51, 0xc8}, + {0x52, 0x96}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x5a, 0xc8}, + {0x5b, 0x96}, + {0x5c, 0x00}, + {0xd3, 0x00}, + {0xc3, 0xed}, + {0x7f, 0x00}, + {0xda, 0x00}, + {0xe5, 0x1f}, + {0xe1, 0x67}, + {0xe0, 0x00}, + {0xdd, 0x7f}, + {0x05, 0x00}, + {0x12, 0x40}, + {0xd3, 0x04}, + {0xc0, 0x16}, + {0xc1, 0x12}, + {0x8c, 0x00}, + {0x86, 0x3d}, + {0x50, 0x00}, + {0x51, 0x2c}, + {0x52, 0x24}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x5a, 0x2c}, + {0x5b, 0x24}, + {0x5c, 0x00}, }; #define OV2640_JPEG_INIT_NENTRIES ARRAY_NENTRIES(g_ov2640_jpeg_init) @@ -507,8 +853,15 @@ static const struct ovr2640_reg_s g_ov2640_jpeg_init[] = #ifdef CONFIG_OV2640_JPEG static const struct ovr2640_reg_s g_ov2640_yuv422[] = { - {0xff, 0x00}, {0x05, 0x00}, {0xda, 0x10}, {0xd7, 0x03}, {0xdf, 0x00}, - {0x33, 0x80}, {0x3c, 0x40}, {0xe1, 0x77}, {0x00, 0x00} + {0xff, 0x00}, + {0x05, 0x00}, + {0xda, 0x10}, + {0xd7, 0x03}, + {0xdf, 0x00}, + {0x33, 0x80}, + {0x3c, 0x40}, + {0xe1, 0x77}, + {0x00, 0x00} }; #define OV2640_YUV422_NENTRIES ARRAY_NENTRIES(g_ov2640_yuv422) @@ -517,8 +870,14 @@ static const struct ovr2640_reg_s g_ov2640_yuv422[] = #ifdef CONFIG_OV2640_JPEG static const struct ovr2640_reg_s g_ov2640_jpeg[] = { - {0xe0, 0x14}, {0xe1, 0x77}, {0xe5, 0x1f}, {0xd7, 0x03}, {0xda, 0x10}, - {0xe0, 0x00}, {0xff, 0x01}, {0x04, 0x08} + {0xe0, 0x14}, + {0xe1, 0x77}, + {0xe5, 0x1f}, + {0xd7, 0x03}, + {0xda, 0x10}, + {0xe0, 0x00}, + {0xff, 0x01}, + {0x04, 0x08} }; #define OV2640_JPEG_NENTRIES ARRAY_NENTRIES(g_ov2640_jpeg) @@ -529,14 +888,45 @@ static const struct ovr2640_reg_s g_ov2640_jpeg[] = #ifdef CONFIG_OV2640_JPEG_QCIF_RESOLUTION static const struct ovr2640_reg_s g_ov2640_jpeg_qcif_resolution[] = { - {0xff, 0x01}, {0x12, 0x40}, {0x17, 0x11}, {0x18, 0x43}, {0x19, 0x00}, - {0x1a, 0x4b}, {0x32, 0x09}, {0x4f, 0xca}, {0x50, 0xa8}, {0x5a, 0x23}, - {0x6d, 0x00}, {0x39, 0x12}, {0x35, 0xda}, {0x22, 0x1a}, {0x37, 0xc3}, - {0x23, 0x00}, {0x34, 0xc0}, {0x36, 0x1a}, {0x06, 0x88}, {0x07, 0xc0}, - {0x0d, 0x87}, {0x0e, 0x41}, {0x4c, 0x00}, {0xff, 0x00}, {0xe0, 0x04}, - {0xc0, 0x64}, {0xc1, 0x4b}, {0x86, 0x35}, {0x50, 0x92}, {0x51, 0xc8}, - {0x52, 0x96}, {0x53, 0x00}, {0x54, 0x00}, {0x55, 0x00}, {0x57, 0x00}, - {0x5a, 0x2c}, {0x5b, 0x24}, {0x5c, 0x00}, {0xe0, 0x00} + {0xff, 0x01}, + {0x12, 0x40}, + {0x17, 0x11}, + {0x18, 0x43}, + {0x19, 0x00}, + {0x1a, 0x4b}, + {0x32, 0x09}, + {0x4f, 0xca}, + {0x50, 0xa8}, + {0x5a, 0x23}, + {0x6d, 0x00}, + {0x39, 0x12}, + {0x35, 0xda}, + {0x22, 0x1a}, + {0x37, 0xc3}, + {0x23, 0x00}, + {0x34, 0xc0}, + {0x36, 0x1a}, + {0x06, 0x88}, + {0x07, 0xc0}, + {0x0d, 0x87}, + {0x0e, 0x41}, + {0x4c, 0x00}, + {0xff, 0x00}, + {0xe0, 0x04}, + {0xc0, 0x64}, + {0xc1, 0x4b}, + {0x86, 0x35}, + {0x50, 0x92}, + {0x51, 0xc8}, + {0x52, 0x96}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x57, 0x00}, + {0x5a, 0x2c}, + {0x5b, 0x24}, + {0x5c, 0x00}, + {0xe0, 0x00} }; #define OV2640_JPEG_QCIF_RESOUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_jpeg_qcif_resolution) @@ -547,14 +937,45 @@ static const struct ovr2640_reg_s g_ov2640_jpeg_qcif_resolution[] = #ifdef CONFIG_OV2640_JPEG_QVGA_RESOLUTION static const struct ovr2640_reg_s g_ov2640_jpeg_qvga_resolution[] = { - {0xff, 0x01}, {0x12, 0x40}, {0x17, 0x11}, {0x18, 0x43}, {0x19, 0x00}, - {0x1a, 0x4b}, {0x32, 0x09}, {0x4f, 0xca}, {0x50, 0xa8}, {0x5a, 0x23}, - {0x6d, 0x00}, {0x39, 0x12}, {0x35, 0xda}, {0x22, 0x1a}, {0x37, 0xc3}, - {0x23, 0x00}, {0x34, 0xc0}, {0x36, 0x1a}, {0x06, 0x88}, {0x07, 0xc0}, - {0x0d, 0x87}, {0x0e, 0x41}, {0x4c, 0x00}, {0xff, 0x00}, {0xe0, 0x04}, - {0xc0, 0x64}, {0xc1, 0x4b}, {0x86, 0x35}, {0x50, 0x89}, {0x51, 0xc8}, - {0x52, 0x96}, {0x53, 0x00}, {0x54, 0x00}, {0x55, 0x00}, {0x57, 0x00}, - {0x5a, 0x50}, {0x5b, 0x3c}, {0x5c, 0x00}, {0xe0, 0x00} + {0xff, 0x01}, + {0x12, 0x40}, + {0x17, 0x11}, + {0x18, 0x43}, + {0x19, 0x00}, + {0x1a, 0x4b}, + {0x32, 0x09}, + {0x4f, 0xca}, + {0x50, 0xa8}, + {0x5a, 0x23}, + {0x6d, 0x00}, + {0x39, 0x12}, + {0x35, 0xda}, + {0x22, 0x1a}, + {0x37, 0xc3}, + {0x23, 0x00}, + {0x34, 0xc0}, + {0x36, 0x1a}, + {0x06, 0x88}, + {0x07, 0xc0}, + {0x0d, 0x87}, + {0x0e, 0x41}, + {0x4c, 0x00}, + {0xff, 0x00}, + {0xe0, 0x04}, + {0xc0, 0x64}, + {0xc1, 0x4b}, + {0x86, 0x35}, + {0x50, 0x89}, + {0x51, 0xc8}, + {0x52, 0x96}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x57, 0x00}, + {0x5a, 0x50}, + {0x5b, 0x3c}, + {0x5c, 0x00}, + {0xe0, 0x00} }; #define OV2640_JPEG_QVGA_RESOUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_jpeg_qvga_resolution) @@ -565,14 +986,45 @@ static const struct ovr2640_reg_s g_ov2640_jpeg_qvga_resolution[] = #ifdef CONFIG_OV2640_JPEG_CIF_RESOLUTION static const struct ovr2640_reg_s g_ov2640_jpeg_cif_resolution[] = { - {0xff, 0x01}, {0x12, 0x40}, {0x17, 0x11}, {0x18, 0x43}, {0x19, 0x00}, - {0x1a, 0x4b}, {0x32, 0x09}, {0x4f, 0xca}, {0x50, 0xa8}, {0x5a, 0x23}, - {0x6d, 0x00}, {0x39, 0x12}, {0x35, 0xda}, {0x22, 0x1a}, {0x37, 0xc3}, - {0x23, 0x00}, {0x34, 0xc0}, {0x36, 0x1a}, {0x06, 0x88}, {0x07, 0xc0}, - {0x0d, 0x87}, {0x0e, 0x41}, {0x4c, 0x00}, {0xff, 0x00}, {0xe0, 0x04}, - {0xc0, 0x64}, {0xc1, 0x4b}, {0x86, 0x35}, {0x50, 0x89}, {0x51, 0xc8}, - {0x52, 0x96}, {0x53, 0x00}, {0x54, 0x00}, {0x55, 0x00}, {0x57, 0x00}, - {0x5a, 0x58}, {0x5b, 0x48}, {0x5c, 0x00}, {0xe0, 0x00} + {0xff, 0x01}, + {0x12, 0x40}, + {0x17, 0x11}, + {0x18, 0x43}, + {0x19, 0x00}, + {0x1a, 0x4b}, + {0x32, 0x09}, + {0x4f, 0xca}, + {0x50, 0xa8}, + {0x5a, 0x23}, + {0x6d, 0x00}, + {0x39, 0x12}, + {0x35, 0xda}, + {0x22, 0x1a}, + {0x37, 0xc3}, + {0x23, 0x00}, + {0x34, 0xc0}, + {0x36, 0x1a}, + {0x06, 0x88}, + {0x07, 0xc0}, + {0x0d, 0x87}, + {0x0e, 0x41}, + {0x4c, 0x00}, + {0xff, 0x00}, + {0xe0, 0x04}, + {0xc0, 0x64}, + {0xc1, 0x4b}, + {0x86, 0x35}, + {0x50, 0x89}, + {0x51, 0xc8}, + {0x52, 0x96}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x57, 0x00}, + {0x5a, 0x58}, + {0x5b, 0x48}, + {0x5c, 0x00}, + {0xe0, 0x00} }; #define OV2640_JPEG_CIF_RESOUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_jpeg_cif_resolution) @@ -583,14 +1035,46 @@ static const struct ovr2640_reg_s g_ov2640_jpeg_cif_resolution[] = #ifdef CONFIG_OV2640_JPEG_VGA_RESOLUTION static const struct ovr2640_reg_s g_ov2640_jpeg_vga_resolution[] = { - {0xff, 0x01}, {0x11, 0x01}, {0x12, 0x00}, {0x17, 0x11}, {0x18, 0x75}, - {0x32, 0x36}, {0x19, 0x01}, {0x1a, 0x97}, {0x03, 0x0f}, {0x37, 0x40}, - {0x4f, 0xbb}, {0x50, 0x9c}, {0x5a, 0x57}, {0x6d, 0x80}, {0x3d, 0x34}, - {0x39, 0x02}, {0x35, 0x88}, {0x22, 0x0a}, {0x37, 0x40}, {0x34, 0xa0}, - {0x06, 0x02}, {0x0d, 0xb7}, {0x0e, 0x01}, {0xff, 0x00}, {0xe0, 0x04}, - {0xc0, 0xc8}, {0xc1, 0x96}, {0x86, 0x3d}, {0x50, 0x89}, {0x51, 0x90}, - {0x52, 0x2c}, {0x53, 0x00}, {0x54, 0x00}, {0x55, 0x88}, {0x57, 0x00}, - {0x5a, 0xa0}, {0x5b, 0x78}, {0x5c, 0x00}, {0xd3, 0x04}, {0xe0, 0x00} + {0xff, 0x01}, + {0x11, 0x01}, + {0x12, 0x00}, + {0x17, 0x11}, + {0x18, 0x75}, + {0x32, 0x36}, + {0x19, 0x01}, + {0x1a, 0x97}, + {0x03, 0x0f}, + {0x37, 0x40}, + {0x4f, 0xbb}, + {0x50, 0x9c}, + {0x5a, 0x57}, + {0x6d, 0x80}, + {0x3d, 0x34}, + {0x39, 0x02}, + {0x35, 0x88}, + {0x22, 0x0a}, + {0x37, 0x40}, + {0x34, 0xa0}, + {0x06, 0x02}, + {0x0d, 0xb7}, + {0x0e, 0x01}, + {0xff, 0x00}, + {0xe0, 0x04}, + {0xc0, 0xc8}, + {0xc1, 0x96}, + {0x86, 0x3d}, + {0x50, 0x89}, + {0x51, 0x90}, + {0x52, 0x2c}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x88}, + {0x57, 0x00}, + {0x5a, 0xa0}, + {0x5b, 0x78}, + {0x5c, 0x00}, + {0xd3, 0x04}, + {0xe0, 0x00} }; #define OV2640_JPEG_VGA_RESOUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_jpeg_vga_resolution) @@ -601,14 +1085,46 @@ static const struct ovr2640_reg_s g_ov2640_jpeg_vga_resolution[] = #ifdef CONFIG_OV2640_JPEG_SVGA_RESOLUTION static const struct ovr2640_reg_s g_ov2640_jpeg_svga_resolution[] = { - {0xff, 0x01}, {0x11, 0x01}, {0x12, 0x00}, {0x17, 0x11}, {0x18, 0x75}, - {0x32, 0x36}, {0x19, 0x01}, {0x1a, 0x97}, {0x03, 0x0f}, {0x37, 0x40}, - {0x4f, 0xbb}, {0x50, 0x9c}, {0x5a, 0x57}, {0x6d, 0x80}, {0x3d, 0x34}, - {0x39, 0x02}, {0x35, 0x88}, {0x22, 0x0a}, {0x37, 0x40}, {0x34, 0xa0}, - {0x06, 0x02}, {0x0d, 0xb7}, {0x0e, 0x01}, {0xff, 0x00}, {0xe0, 0x04}, - {0xc0, 0xc8}, {0xc1, 0x96}, {0x86, 0x35}, {0x50, 0x89}, {0x51, 0x90}, - {0x52, 0x2c}, {0x53, 0x00}, {0x54, 0x00}, {0x55, 0x88}, {0x57, 0x00}, - {0x5a, 0xc8}, {0x5b, 0x96}, {0x5c, 0x00}, {0xd3, 0x02}, {0xe0, 0x00} + {0xff, 0x01}, + {0x11, 0x01}, + {0x12, 0x00}, + {0x17, 0x11}, + {0x18, 0x75}, + {0x32, 0x36}, + {0x19, 0x01}, + {0x1a, 0x97}, + {0x03, 0x0f}, + {0x37, 0x40}, + {0x4f, 0xbb}, + {0x50, 0x9c}, + {0x5a, 0x57}, + {0x6d, 0x80}, + {0x3d, 0x34}, + {0x39, 0x02}, + {0x35, 0x88}, + {0x22, 0x0a}, + {0x37, 0x40}, + {0x34, 0xa0}, + {0x06, 0x02}, + {0x0d, 0xb7}, + {0x0e, 0x01}, + {0xff, 0x00}, + {0xe0, 0x04}, + {0xc0, 0xc8}, + {0xc1, 0x96}, + {0x86, 0x35}, + {0x50, 0x89}, + {0x51, 0x90}, + {0x52, 0x2c}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x88}, + {0x57, 0x00}, + {0x5a, 0xc8}, + {0x5b, 0x96}, + {0x5c, 0x00}, + {0xd3, 0x02}, + {0xe0, 0x00} }; #define OV2640_JPEG_SVGA_RESOUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_jpeg_svga_resolution) @@ -619,14 +1135,44 @@ static const struct ovr2640_reg_s g_ov2640_jpeg_svga_resolution[] = #ifdef CONFIG_OV2640_JPEG_XVGA_RESOLUTION static const struct ovr2640_reg_s g_ov2640_jpeg_xvga_resolution[] = { - {0xff, 0x01}, {0x11, 0x01}, {0x12, 0x00}, {0x17, 0x11}, {0x18, 0x75}, - {0x32, 0x36}, {0x19, 0x01}, {0x1a, 0x97}, {0x03, 0x0f}, {0x37, 0x40}, - {0x4f, 0xbb}, {0x50, 0x9c}, {0x5a, 0x57}, {0x6d, 0x80}, {0x3d, 0x34}, - {0x39, 0x02}, {0x35, 0x88}, {0x22, 0x0a}, {0x37, 0x40}, {0x34, 0xa0}, - {0x06, 0x02}, {0x0d, 0xb7}, {0x0e, 0x01}, {0xff, 0x00}, {0xc0, 0xc8}, - {0xc1, 0x96}, {0x8c, 0x00}, {0x86, 0x3d}, {0x50, 0x00}, {0x51, 0x90}, - {0x52, 0x2c}, {0x53, 0x00}, {0x54, 0x00}, {0x55, 0x88}, {0x5a, 0x00}, - {0x5b, 0xc0}, {0x5c, 0x01}, {0xd3, 0x02} + {0xff, 0x01}, + {0x11, 0x01}, + {0x12, 0x00}, + {0x17, 0x11}, + {0x18, 0x75}, + {0x32, 0x36}, + {0x19, 0x01}, + {0x1a, 0x97}, + {0x03, 0x0f}, + {0x37, 0x40}, + {0x4f, 0xbb}, + {0x50, 0x9c}, + {0x5a, 0x57}, + {0x6d, 0x80}, + {0x3d, 0x34}, + {0x39, 0x02}, + {0x35, 0x88}, + {0x22, 0x0a}, + {0x37, 0x40}, + {0x34, 0xa0}, + {0x06, 0x02}, + {0x0d, 0xb7}, + {0x0e, 0x01}, + {0xff, 0x00}, + {0xc0, 0xc8}, + {0xc1, 0x96}, + {0x8c, 0x00}, + {0x86, 0x3d}, + {0x50, 0x00}, + {0x51, 0x90}, + {0x52, 0x2c}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x88}, + {0x5a, 0x00}, + {0x5b, 0xc0}, + {0x5c, 0x01}, + {0xd3, 0x02} }; #define OV2640_JPEG_XVGA_RESOUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_jpeg_xvga_resolution) @@ -637,14 +1183,46 @@ static const struct ovr2640_reg_s g_ov2640_jpeg_xvga_resolution[] = #ifdef CONFIG_OV2640_JPEG_SXVGA_RESOLUTION static const struct ovr2640_reg_s g_ov2640_jpeg_sxvga_resolution[] = { - {0xff, 0x01}, {0x11, 0x01}, {0x12, 0x00}, {0x17, 0x11}, {0x18, 0x75}, - {0x32, 0x36}, {0x19, 0x01}, {0x1a, 0x97}, {0x03, 0x0f}, {0x37, 0x40}, - {0x4f, 0xbb}, {0x50, 0x9c}, {0x5a, 0x57}, {0x6d, 0x80}, {0x3d, 0x34}, - {0x39, 0x02}, {0x35, 0x88}, {0x22, 0x0a}, {0x37, 0x40}, {0x34, 0xa0}, - {0x06, 0x02}, {0x0d, 0xb7}, {0x0e, 0x01}, {0xff, 0x00}, {0xe0, 0x04}, - {0xc0, 0xc8}, {0xc1, 0x96}, {0x86, 0x3d}, {0x50, 0x00}, {0x51, 0x90}, - {0x52, 0x2c}, {0x53, 0x00}, {0x54, 0x00}, {0x55, 0x88}, {0x57, 0x00}, - {0x5a, 0x40}, {0x5b, 0xf0}, {0x5c, 0x01}, {0xd3, 0x02}, {0xe0, 0x00} + {0xff, 0x01}, + {0x11, 0x01}, + {0x12, 0x00}, + {0x17, 0x11}, + {0x18, 0x75}, + {0x32, 0x36}, + {0x19, 0x01}, + {0x1a, 0x97}, + {0x03, 0x0f}, + {0x37, 0x40}, + {0x4f, 0xbb}, + {0x50, 0x9c}, + {0x5a, 0x57}, + {0x6d, 0x80}, + {0x3d, 0x34}, + {0x39, 0x02}, + {0x35, 0x88}, + {0x22, 0x0a}, + {0x37, 0x40}, + {0x34, 0xa0}, + {0x06, 0x02}, + {0x0d, 0xb7}, + {0x0e, 0x01}, + {0xff, 0x00}, + {0xe0, 0x04}, + {0xc0, 0xc8}, + {0xc1, 0x96}, + {0x86, 0x3d}, + {0x50, 0x00}, + {0x51, 0x90}, + {0x52, 0x2c}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x88}, + {0x57, 0x00}, + {0x5a, 0x40}, + {0x5b, 0xf0}, + {0x5c, 0x01}, + {0xd3, 0x02}, + {0xe0, 0x00} }; #define OV2640_JPEG_SXVGA_RESOUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_jpeg_sxvga_resolution) @@ -655,14 +1233,46 @@ static const struct ovr2640_reg_s g_ov2640_jpeg_sxvga_resolution[] = #ifdef CONFIG_OV2640_JPEG_UXGA_RESOLUTION static const struct ovr2640_reg_s g_ov2640_jpeg_uxga_resolution[] = { - {0xff, 0x01}, {0x11, 0x01}, {0x12, 0x00}, {0x17, 0x11}, {0x18, 0x75}, - {0x32, 0x36}, {0x19, 0x01}, {0x1a, 0x97}, {0x03, 0x0f}, {0x37, 0x40}, - {0x4f, 0xbb}, {0x50, 0x9c}, {0x5a, 0x57}, {0x6d, 0x80}, {0x3d, 0x34}, - {0x39, 0x02}, {0x35, 0x88}, {0x22, 0x0a}, {0x37, 0x40}, {0x34, 0xa0}, - {0x06, 0x02}, {0x0d, 0xb7}, {0x0e, 0x01}, {0xff, 0x00}, {0xe0, 0x04}, - {0xc0, 0xc8}, {0xc1, 0x96}, {0x86, 0x3d}, {0x50, 0x00}, {0x51, 0x90}, - {0x52, 0x2c}, {0x53, 0x00}, {0x54, 0x00}, {0x55, 0x88}, {0x57, 0x00}, - {0x5a, 0x90}, {0x5b, 0x2c}, {0x5c, 0x05}, {0xd3, 0x02}, {0xe0, 0x00} + {0xff, 0x01}, + {0x11, 0x01}, + {0x12, 0x00}, + {0x17, 0x11}, + {0x18, 0x75}, + {0x32, 0x36}, + {0x19, 0x01}, + {0x1a, 0x97}, + {0x03, 0x0f}, + {0x37, 0x40}, + {0x4f, 0xbb}, + {0x50, 0x9c}, + {0x5a, 0x57}, + {0x6d, 0x80}, + {0x3d, 0x34}, + {0x39, 0x02}, + {0x35, 0x88}, + {0x22, 0x0a}, + {0x37, 0x40}, + {0x34, 0xa0}, + {0x06, 0x02}, + {0x0d, 0xb7}, + {0x0e, 0x01}, + {0xff, 0x00}, + {0xe0, 0x04}, + {0xc0, 0xc8}, + {0xc1, 0x96}, + {0x86, 0x3d}, + {0x50, 0x00}, + {0x51, 0x90}, + {0x52, 0x2c}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x88}, + {0x57, 0x00}, + {0x5a, 0x90}, + {0x5b, 0x2c}, + {0x5c, 0x05}, + {0xd3, 0x02}, + {0xe0, 0x00} }; #define OV2640_JPEG_UXGA_RESOUTION_NENTRIES ARRAY_NENTRIES(g_ov2640_jpeg_uxga_resolution) diff --git a/drivers/video/video_framebuff.c b/drivers/video/video_framebuff.c index 02c525bc68..37a5b9e229 100644 --- a/drivers/video/video_framebuff.c +++ b/drivers/video/video_framebuff.c @@ -33,6 +33,7 @@ /**************************************************************************** * Private Functions ****************************************************************************/ + static void init_buf_chain(video_framebuff_t *fbuf) { int i; @@ -83,14 +84,17 @@ static inline vbuf_container_t *dequeue_vbuf_unsafe(video_framebuff_t *fbuf) { 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; @@ -117,25 +121,28 @@ int video_framebuff_realloc_container(video_framebuff_t *fbuf, int sz) 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; + 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); @@ -154,6 +161,7 @@ vbuf_container_t *video_framebuff_get_container(video_framebuff_t *fbuf) fbuf->vbuf_empty = ret->next; ret->next = NULL; } + nxsem_post(&fbuf->lock_empty); return ret; @@ -197,6 +205,7 @@ void video_framebuff_queue_container(video_framebuff_t *fbuf, { fbuf->vbuf_tail->next = NULL; } + leave_critical_section(flags); } @@ -210,6 +219,7 @@ vbuf_container_t *video_framebuff_dq_valid_container(video_framebuff_t *fbuf) { ret = dequeue_vbuf_unsafe(fbuf); } + leave_critical_section(flags); return ret; @@ -262,8 +272,10 @@ void video_framebuff_change_mode(video_framebuff_t *fbuf, fbuf->vbuf_next_dma = fbuf->vbuf_top; } } + fbuf->mode = mode; } + leave_critical_section(flags); } diff --git a/drivers/video/video_framebuff.h b/drivers/video/video_framebuff.h index ba6767fd91..06feff3df9 100644 --- a/drivers/video/video_framebuff.h +++ b/drivers/video/video_framebuff.h @@ -21,12 +21,20 @@ #ifndef __VIDEO_VIDEO_FRAMEBUFF_H__ #define __VIDEO_VIDEO_FRAMEBUFF_H__ +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include #include +/**************************************************************************** + * Public Functions Definistions + ****************************************************************************/ + struct vbuf_container_s { - struct v4l2_buffer buf; /* Buffer information */ + struct v4l2_buffer buf; /* Buffer information */ struct vbuf_container_s *next; /* pointer to next buffer */ };