From 044ad7c3987460ede48ff27afd6bdb0ca05a0432 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 4 Jul 2011 20:52:54 +0200 Subject: import at91lib from at91lib_20100901_softpack_1_9_v_1_0_svn_v15011 it's sad to see that atmel doesn't publish their svn repo or has a centralized location or even puts proper version/release info into the library itself --- components/omnivision/omnivision.c | 326 ++++++++++++++++++++++++++ components/omnivision/omnivision.dir | 43 ++++ components/omnivision/omnivision.h | 82 +++++++ components/omnivision/ov2640/2640_yuv_cif.h | 239 +++++++++++++++++++ components/omnivision/ov2640/2640_yuv_qvga.h | 243 +++++++++++++++++++ components/omnivision/ov2640/2640_yuv_sxga.h | 204 ++++++++++++++++ components/omnivision/ov2640/2640_yuv_vga.h | 238 +++++++++++++++++++ components/omnivision/ov2640/ov2640.c | 143 +++++++++++ components/omnivision/ov2640/ov2640.dir | 46 ++++ components/omnivision/ov9655/9655_yuv_cif.h | 165 +++++++++++++ components/omnivision/ov9655/9655_yuv_qcif.h | 162 +++++++++++++ components/omnivision/ov9655/9655_yuv_qqcif.h | 163 +++++++++++++ components/omnivision/ov9655/9655_yuv_qqvga.h | 169 +++++++++++++ components/omnivision/ov9655/9655_yuv_qvga.h | 166 +++++++++++++ components/omnivision/ov9655/9655_yuv_sxga.h | 164 +++++++++++++ components/omnivision/ov9655/9655_yuv_vga.h | 168 +++++++++++++ components/omnivision/ov9655/ov9655.c | 163 +++++++++++++ components/omnivision/ov9655/ov9655.dir | 46 ++++ 18 files changed, 2930 insertions(+) create mode 100644 components/omnivision/omnivision.c create mode 100644 components/omnivision/omnivision.dir create mode 100644 components/omnivision/omnivision.h create mode 100644 components/omnivision/ov2640/2640_yuv_cif.h create mode 100644 components/omnivision/ov2640/2640_yuv_qvga.h create mode 100644 components/omnivision/ov2640/2640_yuv_sxga.h create mode 100644 components/omnivision/ov2640/2640_yuv_vga.h create mode 100644 components/omnivision/ov2640/ov2640.c create mode 100644 components/omnivision/ov2640/ov2640.dir create mode 100644 components/omnivision/ov9655/9655_yuv_cif.h create mode 100644 components/omnivision/ov9655/9655_yuv_qcif.h create mode 100644 components/omnivision/ov9655/9655_yuv_qqcif.h create mode 100644 components/omnivision/ov9655/9655_yuv_qqvga.h create mode 100644 components/omnivision/ov9655/9655_yuv_qvga.h create mode 100644 components/omnivision/ov9655/9655_yuv_sxga.h create mode 100644 components/omnivision/ov9655/9655_yuv_vga.h create mode 100644 components/omnivision/ov9655/ov9655.c create mode 100644 components/omnivision/ov9655/ov9655.dir (limited to 'components/omnivision') diff --git a/components/omnivision/omnivision.c b/components/omnivision/omnivision.c new file mode 100644 index 0000000..4216169 --- /dev/null +++ b/components/omnivision/omnivision.c @@ -0,0 +1,326 @@ +/* ---------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support + * ---------------------------------------------------------------------------- + * Copyright (c) 2008, Atmel Corporation + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * ---------------------------------------------------------------------------- + */ + +//----------------------------------------------------------------------------- +// Headers +//----------------------------------------------------------------------------- +#include +#include +#include +#include + +/// Slave address of OMNIVISION chips. +#define OV_CAPTOR_ADDRESS (0x60>>1) + + +/// terminating list entry for register in configuration file +#define OV_REG_TERM 0xFF +/// terminating list entry for value in configuration file +#define OV_VAL_TERM 0xFF + +//----------------------------------------------------------------------------- +// Local Functions +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +/// Reset using ctrl signal +/// \param pCtrl1 PIO interface +//----------------------------------------------------------------------------- +static void ov_reset(const Pin *pCtrl1) +{ + volatile unsigned int i; + + if(pCtrl1->id == 0) + return; + + pCtrl1->pio->PIO_CODR = pCtrl1->mask; + for(i=0; i<6000; i++ ); + pCtrl1->pio->PIO_SODR = pCtrl1->mask; + for(i=0; i<6000; i++ ); +} + +//----------------------------------------------------------------------------- +/// Read PID and VER +/// \param pTwid TWI interface +/// \return VER | (PID<<8) +//----------------------------------------------------------------------------- +static unsigned short ov_id(Twid *pTwid) +{ + unsigned char id=0; + unsigned char ver=0; + + // OV_PID + ov_read_reg(pTwid, 0x0A, &id); + TRACE_INFO("PID = 0x%X\n\r", id); + + // OV_VER + ov_read_reg(pTwid, 0x0B, &ver); + TRACE_INFO("VER = 0x%X\n\r", ver); + + return((unsigned short)(id <<8) | ver); +} + +//----------------------------------------------------------------------------- +/// Read Manufacturer +/// \param pTwid TWI interface +/// \return 0 if error; 1 if the good captor is present +//----------------------------------------------------------------------------- +static unsigned char ov_Manufacturer(Twid *pTwid) +{ + unsigned char midh=0; + unsigned char midl=0; + unsigned status = 0; + + // OV_MIDH + ov_read_reg(pTwid, 0x1C, &midh); + TRACE_DEBUG("MIDH = 0x%X\n\r", midh); + + // OV_MIDL + ov_read_reg(pTwid, 0x1D, &midl); + TRACE_DEBUG("MIDL = 0x%X\n\r", midl); + + if(( midh == 0x7F) && (midl == 0xA2)) { + status = 1; + } + return(status); +} +//----------------------------------------------------------------------------- +/// ov_TestWrite +/// \param pTwid TWI interface +/// \return 1 if the write is correct; 0 otherwise +//----------------------------------------------------------------------------- +static unsigned char ov_TestWrite(Twid *pTwid) +{ + unsigned char value=0; + unsigned char oldvalue=0; + + // OV_BLUE + ov_read_reg(pTwid, 0x01, &oldvalue); + ov_write_reg(pTwid, 0x01, 0xAD); + ov_read_reg(pTwid, 0x01, &value); + if( value != 0xAD ) { + return(0); + } + // return old value + ov_write_reg(pTwid, 0x01, oldvalue); + ov_read_reg(pTwid, 0x01, &value); + if( value != oldvalue ) { + return(0); + } + return(1); +} + +//----------------------------------------------------------------------------- +// Global Functions +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +/// Read a value from a register in an OV9650 sensor device. +/// \param pTwid TWI interface +/// \param reg Register to be read +/// \param pData Data read +/// \return 0 if no error, otherwize TWID_ERROR_BUSY +//----------------------------------------------------------------------------- +unsigned char ov_read_reg(Twid *pTwid, unsigned char reg, unsigned char *pData) +{ + unsigned char status; + + status = TWID_Write( pTwid, OV_CAPTOR_ADDRESS, 0, 0, ®, 1, 0); + status |= TWID_Read( pTwid, OV_CAPTOR_ADDRESS, 0, 0, pData, 1, 0); + //status = TWID_Read(pTwid, OV_CAPTOR_ADDRESS, reg, 1, pData, 1, 0); + if( status != 0 ) { + TRACE_ERROR("ov_read_reg pb"); + } + return status; +} + +//----------------------------------------------------------------------------- +/// Write a value to a register in an OV9650 sensor device. +/// \param pTwid TWI interface +/// \param reg Register to be write +/// \param val Value to be writte +/// \return 0 if no error, otherwize TWID_ERROR_BUSY +//----------------------------------------------------------------------------- +unsigned char ov_write_reg(Twid *pTwid, unsigned char reg, unsigned char val) +{ + unsigned char status; + + status = TWID_Write(pTwid, OV_CAPTOR_ADDRESS, reg, 1, &val, 1, 0); + if( status != 0 ) { + TRACE_ERROR("ov_write_reg pb"); + } + + return status; +} + +//----------------------------------------------------------------------------- +/// Initialize a list of OV registers. +/// The list of registers is terminated by the pair of values +/// { OV_REG_TERM, OV_VAL_TERM }. +/// Returns zero if successful, or non-zero otherwise. +/// \param pTwid TWI interface +/// \param pReglist Register list to be written +/// \return 0 if no error, otherwize TWID_ERROR_BUSY +//----------------------------------------------------------------------------- +int ov_write_regs(Twid *pTwid, const struct ov_reg* pReglist) +{ + int err; + int size=0; + const struct ov_reg *pNext = pReglist; + unsigned int i=0; + + TRACE_DEBUG("ov_write_regs:"); + while (!((pNext->reg == OV_REG_TERM) && (pNext->val == OV_VAL_TERM))) { + err = ov_write_reg(pTwid, pNext->reg, pNext->val); + TRACE_DEBUG_WP("+(%d) ", size); + size++; + + //delay(1); + for(i=0; i<6000; i++ ) { + *(unsigned int*)0x20400000 = 0; + } + + if (err == TWID_ERROR_BUSY){ + TRACE_ERROR("ov_write_regs: TWI ERROR\n\r"); + return err; + } + pNext++; + } + TRACE_DEBUG_WP("\n\r"); + return 0; +} + +//----------------------------------------------------------------------------- +/// Dump all register +/// \param pTwid TWI interface +/// \param ovType Sensor type +//----------------------------------------------------------------------------- +void ov_DumpRegisters(Twid *pTwid, unsigned char ovType) +{ + int i; + unsigned char value; + unsigned char regNum; + + switch(ovType){ + + case BOARD_OV9655: + regNum = 0xDA; + break; + + case BOARD_OV2640: + regNum = 0x5C; + break; + + default: + printf("Omnivision type %d not supported. \r\n", ovType); + return ; + break; + } + TRACE_INFO_WP("Dump all camera register\n\r"); + for(i = 0; i <= regNum; i++) { + value = 0; + ov_read_reg(pTwid, i, &value); + TRACE_INFO_WP("[0x%02x]=0x%02x ", i, value); + if( ((i+1)%5) == 0 ) { + TRACE_INFO_WP("\n\r"); + } + } + TRACE_INFO_WP("\n\r"); +} + +//----------------------------------------------------------------------------- +/// Sequence For correct operation of the sensor +/// \param pTwid TWI interface +/// \param pCtrl1 Ctrl1 signal +/// \param ovType Sensor type +/// \return 1 if initialization ok, otherwise 0 +//----------------------------------------------------------------------------- +unsigned char ov_init(Twid *pTwid, const Pin *pCtrl1, unsigned char ovType) +{ + unsigned short id=0; + unsigned short bdId; + + switch(ovType){ + + case BOARD_OV9655: + bdId = 0x96; + break; + + case BOARD_OV2640: + bdId = 0x26; + ov_reset(pCtrl1); + break; + + default: + printf("Omnivision type %d not supported. \r\n", ovType); + return 0; + break; + } + + id = ov_id(pTwid); + if( (id>>8) == bdId ) { + TRACE_DEBUG("ID and PID OK\n\r"); + if( ov_Manufacturer(pTwid) == 1 ) { + TRACE_DEBUG("Manufacturer OK\n\r"); + if( ov_TestWrite(pTwid) == 1 ) { + return 1; + } + else { + TRACE_ERROR("Problem captor: bad write\n\r"); + } + } + else { + TRACE_ERROR("Problem captor: bad Manufacturer\n\r"); + } + } + else { + TRACE_ERROR("Problem captor: bad PID\n\r"); + } + TRACE_INFO("Problem: captor not responding\n\r"); + return 0; +} + +//----------------------------------------------------------------------------- +/// Power control using ctrl2 signal +/// \param pCtrl2 PIO interface +/// \param power on, off +//----------------------------------------------------------------------------- +void ov_pwd(const Pin *pCtrl2, unsigned char power) +{ + volatile unsigned int i; + + if(pCtrl2->id == 0) + return; + + if(power == OV_CTRL2_POWER_OFF) + pCtrl2->pio->PIO_CODR = pCtrl2->mask; + else if (power == OV_CTRL2_POWER_ON) + pCtrl2->pio->PIO_SODR = pCtrl2->mask; +} + diff --git a/components/omnivision/omnivision.dir b/components/omnivision/omnivision.dir new file mode 100644 index 0000000..b363042 --- /dev/null +++ b/components/omnivision/omnivision.dir @@ -0,0 +1,43 @@ +/* ---------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support + * ---------------------------------------------------------------------------- + * Copyright (c) 2008, Atmel Corporation + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * ---------------------------------------------------------------------------- + */ + +//------------------------------------------------------------------------------ +/// \dir +/// +/// !Purpose +/// +/// This directory contains an API for OmniVision captor +/// +/// !Contents +/// +/// - omnivision.h api definition for omnivision captor +/// - omnivision.c driver for omnivision captor +/// - directory for specific file for OV9655 captor +//------------------------------------------------------------------------------ + diff --git a/components/omnivision/omnivision.h b/components/omnivision/omnivision.h new file mode 100644 index 0000000..1b7f220 --- /dev/null +++ b/components/omnivision/omnivision.h @@ -0,0 +1,82 @@ +/* ---------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support + * ---------------------------------------------------------------------------- + * Copyright (c) 2008, Atmel Corporation + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * ---------------------------------------------------------------------------- + */ + +//------------------------------------------------------------------------------ +/// \unit +/// +/// !!!Purpose +/// +/// Interface for configuration the Omnivision captor. +/// +/// !!!Usage +/// +/// -# Initialize captor +/// -# Write Omnivision configuration +//------------------------------------------------------------------------------ + + +#ifndef OMNIVISION_H +#define OMNIVISION_H + +/// define a structure for monivision register initialization values +struct ov_reg +{ + /// Register to be written + unsigned char reg; + /// Value to be written in the register + unsigned char val; +}; + +/// Captor capture size +struct capture_size { + unsigned long width; + unsigned long height; +}; + +/// Omnivision sensor type +#define BOARD_OV9655 0 +#define BOARD_OV2640 1 + +/// Omnivision power control +#define OV_CTRL2_POWER_OFF 0 +#define OV_CTRL2_POWER_ON 1 + +//------------------------------------------------------------------------------ +// Exported functions +//------------------------------------------------------------------------------ +extern unsigned char ov_init(Twid *pTwid, const Pin *pCtrl1, unsigned char ovType); +extern void ov_DumpRegisters(Twid *pTwid, unsigned char ovType); +extern int ov_write_regs(Twid *pTwid, const struct ov_reg* pReglist); +extern unsigned char ov_read_reg(Twid *pTwid, unsigned char reg, unsigned char *pData); +extern unsigned char ov_write_reg(Twid *pTwid, unsigned char reg, unsigned char val); +extern void ov_configure(Twid *pTwid, unsigned int width, unsigned int heigth); +extern void ov_pwd(const Pin *pCtrl2, unsigned char power); + +#endif + diff --git a/components/omnivision/ov2640/2640_yuv_cif.h b/components/omnivision/ov2640/2640_yuv_cif.h new file mode 100644 index 0000000..55c4e2a --- /dev/null +++ b/components/omnivision/ov2640/2640_yuv_cif.h @@ -0,0 +1,239 @@ +//; Generated by Sensor Tool +//; Ver: 1.2.1 +//; + +#include + +const struct ov_reg ov2640_yuv_cif[]= { + +{0xff, 0x01}, +{0x12, 0x80}, +{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}, +{0x36, 0x1a}, +{0x06, 0x02}, +{0x07, 0xc0}, +{0x0d, 0xb7}, +{0x0e, 0x01}, +{0x4c, 0x00}, +{0x4a, 0x81}, +{0x21, 0x99}, +{0x24, 0x3a}, +{0x25, 0x32}, +{0x26, 0x82}, +{0x5c, 0x00}, +{0x63, 0x00}, +{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}, +{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, 0x02}, +{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, 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}, +{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, 0xc8}, +{0xc1, 0x96}, +{0x86, 0x1d}, +{0x50, 0x00}, +{0x51, 0x90}, +{0x52, 0x18}, +{0x53, 0x00}, +{0x54, 0x00}, +{0x55, 0x88}, +{0x57, 0x00}, +{0x5a, 0x90}, +{0x5b, 0x18}, +{0x5c, 0x05}, +{0xc3, 0xed}, +{0x7f, 0x00}, +{0xda, 0x04}, +{0xe5, 0x1f}, +{0xe1, 0x67}, +{0xe0, 0x00}, +{0xdd, 0xff}, +{0x05, 0x00}, +{0xff, 0x01}, +{0x11, 0x01}, +{0xff, 0x01}, +{0x12, 0x40}, +{0x17, 0x11}, +{0x18, 0x43}, +{0x19, 0x00}, +{0x1a, 0x4b}, +{0x32, 0x09}, +{0x4f, 0xca}, +{0x50, 0xa8}, +{0x5a, 0x23}, +{0x6d, 0x00}, +{0x3d, 0x38}, +{0x39, 0x12}, +{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}, +{0xff, 0x00}, +{0xe0, 0x04}, +{0xc0, 0x64}, +{0xc1, 0x4B}, +{0x8c, 0x00}, +{0x86, 0x1D}, +{0xd3, 0x82}, +{0xe0, 0x00}, +{0xff, 0x00}, +{0xc0, 0x64}, +{0xc1, 0x4B}, +{0x8c, 0x00}, +{0x86, 0x3D}, +{0x50, 0x89}, +{0x51, 0xC8}, +{0x52, 0x96}, +{0x53, 0x00}, +{0x54, 0x00}, +{0x55, 0x00}, +{0x5a, 0x50}, +{0x5b, 0x3C}, +{0x5c, 0x00}, +{0xd3, 0x04}, +{0xFF, 0x00}, +{0xE0, 0x04}, +{0xE1, 0x67}, +{0xD7, 0x01}, +{0xDA, 0x00}, +{0xD3, 0x82}, +{0xE0, 0x00} + +,{0xFF, 0xFF} + +}; + diff --git a/components/omnivision/ov2640/2640_yuv_qvga.h b/components/omnivision/ov2640/2640_yuv_qvga.h new file mode 100644 index 0000000..5082c9b --- /dev/null +++ b/components/omnivision/ov2640/2640_yuv_qvga.h @@ -0,0 +1,243 @@ +//; Generated by Sensor Tool +//; Ver: 1.2.1 +//; + +#include + +const struct ov_reg ov2640_yuv_qvga[]= { + +{0xff, 0x01}, +{0x12, 0x80}, +{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}, +{0x36, 0x1a}, +{0x06, 0x02}, +{0x07, 0xc0}, +{0x0d, 0xb7}, +{0x0e, 0x01}, +{0x4c, 0x00}, +{0x4a, 0x81}, +{0x21, 0x99}, +{0x24, 0x3a}, +{0x25, 0x32}, +{0x26, 0x82}, +{0x5c, 0x00}, +{0x63, 0x00}, +{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}, +{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, 0x02}, +{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, 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}, +{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, 0xc8}, +{0xc1, 0x96}, +{0x86, 0x1d}, +{0x50, 0x00}, +{0x51, 0x90}, +{0x52, 0x18}, +{0x53, 0x00}, +{0x54, 0x00}, +{0x55, 0x88}, +{0x57, 0x00}, +{0x5a, 0x90}, +{0x5b, 0x18}, +{0x5c, 0x05}, +{0xc3, 0xed}, +{0x7f, 0x00}, +{0xda, 0x04}, +{0xe5, 0x1f}, +{0xe1, 0x67}, +{0xe0, 0x00}, +{0xdd, 0xff}, +{0x05, 0x00}, +{0xff, 0x01}, +{0x11, 0x01}, +{0xff, 0x01}, +{0x12, 0x40}, +{0x17, 0x11}, +{0x18, 0x43}, +{0x19, 0x00}, +{0x1a, 0x4b}, +{0x32, 0x09}, +{0x4f, 0xca}, +{0x50, 0xa8}, +{0x5a, 0x23}, +{0x6d, 0x00}, +{0x3d, 0x38}, +{0x39, 0x12}, +{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}, +{0xff, 0x00}, +{0xe0, 0x04}, +{0xc0, 0x64}, +{0xc1, 0x4B}, +{0x8c, 0x00}, +{0x86, 0x1D}, +{0xd3, 0x82}, +{0xe0, 0x00}, +{0xff, 0x00}, +{0xc0, 0x64}, +{0xc1, 0x4B}, +{0x8c, 0x00}, +{0x86, 0x3D}, +{0x50, 0x89}, +{0x51, 0xC8}, +{0x52, 0x96}, +{0x53, 0x00}, +{0x54, 0x00}, +{0x55, 0x00}, +{0x5a, 0x50}, +{0x5b, 0x3C}, +{0x5c, 0x00}, +{0xd3, 0x04}, +{0xFF, 0x00}, +{0xE0, 0x04}, +{0xE1, 0x67}, +{0xD7, 0x01}, + +//{0xDA, 0x00}, +//leon +{0xDA, 0x00}, + +{0xD3, 0x82}, +{0xE0, 0x00} + +,{0xFF, 0xFF} + +}; + diff --git a/components/omnivision/ov2640/2640_yuv_sxga.h b/components/omnivision/ov2640/2640_yuv_sxga.h new file mode 100644 index 0000000..dfedefa --- /dev/null +++ b/components/omnivision/ov2640/2640_yuv_sxga.h @@ -0,0 +1,204 @@ +//; Generated by Sensor Tool +//; Ver: 1.2.1 +//; + +#include + +const struct ov_reg ov2640_yuv_sxga[]= { + +{0xff, 0x01}, +{0x12, 0x80}, +{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}, +{0x36, 0x1a}, +{0x06, 0x02}, +{0x07, 0xc0}, +{0x0d, 0xb7}, +{0x0e, 0x01}, +{0x4c, 0x00}, +{0x4a, 0x81}, +{0x21, 0x99}, +{0x24, 0x3a}, +{0x25, 0x32}, +{0x26, 0x82}, +{0x5c, 0x00}, +{0x63, 0x00}, +{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}, +{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, 0x02}, +{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, 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}, +{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, 0xc8}, +{0xc1, 0x96}, +{0x86, 0x1d}, +{0x50, 0x00}, +{0x51, 0x90}, +{0x52, 0x18}, +{0x53, 0x00}, +{0x54, 0x00}, +{0x55, 0x88}, +{0x57, 0x00}, +{0x5a, 0x90}, +{0x5b, 0x18}, +{0x5c, 0x05}, +{0xc3, 0xed}, +{0x7f, 0x00}, +{0xda, 0x04}, +{0xe5, 0x1f}, +{0xe1, 0x67}, +{0xe0, 0x00}, +{0xdd, 0xff}, +{0x05, 0x00}, +{0xff, 0x01}, +{0x11, 0x00}, +{0xff, 0x00}, +{0xc0, 0xC8}, +{0xc1, 0x96}, +{0x8c, 0x00}, +{0x86, 0x3D}, +{0x50, 0x00}, +{0x51, 0x90}, +{0x52, 0x2C}, +{0x53, 0x00}, +{0x54, 0x00}, +{0x55, 0x88}, +{0x5a, 0x40}, +{0x5b, 0x00}, +{0x5c, 0x05}, +{0xd3, 0x82}, +{0xFF, 0x00}, +{0xE0, 0x04}, +{0xE1, 0x67}, +{0xD7, 0x01}, +{0xDA, 0x00}, +{0xD3, 0x82}, +{0xE0, 0x00} + +,{0xFF, 0xFF} + +}; + diff --git a/components/omnivision/ov2640/2640_yuv_vga.h b/components/omnivision/ov2640/2640_yuv_vga.h new file mode 100644 index 0000000..37581e4 --- /dev/null +++ b/components/omnivision/ov2640/2640_yuv_vga.h @@ -0,0 +1,238 @@ +//; Generated by Sensor Tool +//; Ver: 1.2.2 +//; +#include + +const struct ov_reg ov2640_yuv_vga[]= { + +{0xff, 0x01}, +{0x12, 0x80}, +{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}, +{0x36, 0x1a}, +{0x06, 0x02}, +{0x07, 0xc0}, +{0x0d, 0xb7}, +{0x0e, 0x01}, +{0x4c, 0x00}, +{0x4a, 0x81}, +{0x21, 0x99}, +{0x24, 0x3a}, +{0x25, 0x32}, +{0x26, 0x82}, +{0x5c, 0x00}, +{0x63, 0x00}, +{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}, +{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, 0x02}, +{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, 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}, +{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, 0xc8}, +{0xc1, 0x96}, +{0x86, 0x1d}, +{0x50, 0x00}, +{0x51, 0x90}, +{0x52, 0x18}, +{0x53, 0x00}, +{0x54, 0x00}, +{0x55, 0x88}, +{0x57, 0x00}, +{0x5a, 0x90}, +{0x5b, 0x18}, +{0x5c, 0x05}, +{0xc3, 0xed}, +{0x7f, 0x00}, +{0xda, 0x04}, +{0xe5, 0x1f}, +{0xe1, 0x67}, +{0xe0, 0x00}, +{0xdd, 0xff}, +{0x05, 0x00}, +{0xff, 0x01}, +{0x11, 0x01}, +{0xff, 0x01}, +{0x12, 0x40}, +{0x17, 0x11}, +{0x18, 0x43}, +{0x19, 0x00}, +{0x1a, 0x4b}, +{0x32, 0x09}, +{0x4f, 0xca}, +{0x50, 0xa8}, +{0x5a, 0x23}, +{0x6d, 0x00}, +{0x3d, 0x38}, +{0x39, 0x12}, +{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}, +{0xff, 0x00}, +{0xe0, 0x04}, +{0xc0, 0x64}, +{0xc1, 0x4B}, +{0x8c, 0x00}, +{0x86, 0x1D}, +{0xd3, 0x82}, +{0xe0, 0x00}, +{0xff, 0x00}, +{0xc0, 0x64}, +{0xc1, 0x4B}, +{0x8c, 0x00}, +{0x86, 0x3D}, +{0x50, 0x00}, +{0x51, 0xC8}, +{0x52, 0x96}, +{0x53, 0x00}, +{0x54, 0x00}, +{0x55, 0x00}, +{0x5a, 0xA0}, +{0x5b, 0x78}, +{0x5c, 0x00}, +{0xd3, 0x04}, +{0xFF, 0x00}, +{0xE0, 0x04}, +{0xE1, 0x67}, +{0xD7, 0x01}, +{0xDA, 0x00}, +{0xD3, 0x82}, +{0xE0, 0x00} + +,{0xFF, 0xFF} + +}; + diff --git a/components/omnivision/ov2640/ov2640.c b/components/omnivision/ov2640/ov2640.c new file mode 100644 index 0000000..ccb10e2 --- /dev/null +++ b/components/omnivision/ov2640/ov2640.c @@ -0,0 +1,143 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// Copyright (c) 2009, Atmel Corporation +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the disclaimer below. +// +// Atmel's name may not be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL 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. +// ---------------------------------------------------------------------------- + +#include + +#if defined(BOARD_CAPTOR_OV2640) + +//------------------------------------------------------------------------------ +/// \unit +/// +/// !!!Purpose +/// +/// Specific configuration for Omnivision OV2640 captor +/// +/// !!!Usage +/// +/// -# Different files are been provided by Omnivision: +/// - 2640_yuv_cif.h +/// - 2640_yuv_qcif.h +/// - 2640_yuv_qqcif.h +/// - 2640_yuv_qqvga.h +/// - 2640_yuv_qvga.h +/// - 2640_yuv_sxga.h +/// - 2640_yuv_vga.h +/// -# Configure the captor using theses files +//-------------------------------------------------------------------------- + + +//----------------------------------------------------------------------------- +// Headers +//----------------------------------------------------------------------------- +#include +#include + +#include + +#include "2640_yuv_cif.h" +#include "2640_yuv_qvga.h" +#include "2640_yuv_sxga.h" +#include "2640_yuv_vga.h" + +//------------------------------------------------------------------------------ +/// Array of image sizes supported by OV264x +//------------------------------------------------------------------------------ +const static struct capture_size ov264x_sizes[] = { +// {width, height} + /// QVGA + { 320, 240 }, + /// CIF + { 352, 288 }, + /// VGA + { 640, 480 }, + /// SXGA + {1280, 1024 } +}; + +//------------------------------------------------------------------------------ +// Global Functions +//------------------------------------------------------------------------------ + +//----------------------------------------------------------------------------- +/// Configure the OV9650 for a specified image size, pixel format, +/// and frame period. +//----------------------------------------------------------------------------- +void ov_configure(Twid *pTwid, unsigned int width, unsigned int heigth) +{ + const struct ov_reg *reg_conf; + unsigned char goodCaptureSize = 0; + unsigned char i; + + TRACE_DEBUG("ov264x_configure\n\r"); + for( i=0; i + +const struct ov_reg ov9655_yuv_cif[]= { + { 0x12, 0x80 }, + { 0x00, 0x00 }, + { 0x01, 0x80 }, + { 0x02, 0x80 }, + { 0x03, 0x09 }, // Vertical Control Frame + { 0x04, 0x03 }, + { 0x0e, 0x61 }, + { 0x0f, 0x42 }, + { 0x11, 0x01 }, + { 0x12, 0x62 }, + { 0x13, 0xe7 }, + { 0x14, 0x3a }, + { 0x16, 0x24 }, + { 0x17, 0x18 }, + { 0x18, 0x0c }, + { 0x19, 0x01 }, + { 0x1a, 0x81 }, + { 0x1e, 0x04 }, + { 0x24, 0x3c }, + { 0x25, 0x36 }, + { 0x26, 0x72 }, + { 0x27, 0x08 }, + { 0x28, 0x08 }, + { 0x29, 0x15 }, + { 0x2a, 0x00 }, + { 0x2b, 0x00 }, + { 0x2c, 0x08 }, + { 0x32, 0xe4 }, + { 0x33, 0x00 }, + { 0x34, 0x3f }, + { 0x35, 0x00 }, + { 0x36, 0x3a }, + { 0x38, 0x72 }, + { 0x39, 0x57 }, + // { 0x3a, 0x80 }, // YUYV output sequence + { 0x3a, 0x00 }, // No delay + { 0x3b, 0x04 }, + { 0x3d, 0x99 }, + { 0x3e, 0x0e }, + { 0x3f, 0xc1 }, + { 0x40, 0xc0 }, + { 0x41, 0x01 }, + { 0x42, 0xc0 }, + { 0x43, 0x0a }, + { 0x44, 0xf0 }, + { 0x45, 0x46 }, + { 0x46, 0x62 }, + { 0x47, 0x2a }, + { 0x48, 0x3c }, + { 0x4a, 0xfc }, + { 0x4b, 0xfc }, + { 0x4c, 0x7f }, + { 0x4d, 0x7f }, + { 0x4e, 0x7f }, + { 0x52, 0x28 }, + { 0x53, 0x88 }, + { 0x54, 0xb0 }, + + { 0x52, 0x28 }, // Matrix Coefficient 4 + { 0x53, 0x88 }, // Matrix Coefficient 5 + { 0x54, 0xb0 }, // Matrix Coefficient 6 + { 0x4f, 0x98 }, + { 0x50, 0x98 }, + { 0x51, 0x00 }, + { 0x58, 0x1a }, + + { 0x5b, 0x64 }, + { 0x5c, 0x84 }, + { 0x5d, 0x53 }, + { 0x5e, 0x0e }, + { 0x5f, 0xf0 }, + { 0x60, 0xf0 }, + { 0x61, 0xf0 }, + { 0x62, 0x00 }, + { 0x63, 0x00 }, + { 0x64, 0x02 }, + { 0x65, 0x20 }, + { 0x66, 0x00 }, + { 0x69, 0x0a }, + { 0x6b, 0x5a }, //bypass internal regulator +// { 0x6b, 0x4a }, // use internal regulator + { 0x6c, 0x04 }, + { 0x6d, 0x55 }, + { 0x6e, 0x00 }, + { 0x6f, 0x9d }, + { 0x70, 0x21 }, + { 0x71, 0x78 }, + { 0x72, 0x00 }, // Pixel Output Index + { 0x73, 0x01 }, // Horizontal Scaling Down Coefficients + { 0x74, 0x3a }, + { 0x75, 0x35 }, + { 0x76, 0x01 }, + { 0x77, 0x02 }, + + { 0x7a, 0x12 }, + { 0x7b, 0x08 }, + { 0x7c, 0x15 }, + { 0x7d, 0x24 }, + { 0x7e, 0x45 }, + { 0x7f, 0x55 }, + { 0x80, 0x6a }, + { 0x81, 0x78 }, + { 0x82, 0x87 }, + { 0x83, 0x96 }, + { 0x84, 0xa3 }, + { 0x85, 0xb4 }, + { 0x86, 0xc3 }, + { 0x87, 0xd6 }, + { 0x88, 0xe6 }, + { 0x89, 0xf2 }, + + + { 0x8c, 0x80 }, + { 0x90, 0x7d }, + { 0x91, 0x7b }, + { 0x9d, 0x02 }, + { 0x9e, 0x02 }, + { 0x9f, 0x7a }, + { 0xa0, 0x79 }, + { 0xa1, 0x40 }, + { 0xa4, 0x50 }, + { 0xa5, 0x68 }, + { 0xa6, 0x4a }, + { 0xa8, 0xc1 }, + { 0xa9, 0xef }, + { 0xaa, 0x92 }, + { 0xab, 0x04 }, + { 0xac, 0x80 }, + { 0xad, 0x80 }, + { 0xae, 0x80 }, + { 0xaf, 0x80 }, + { 0xb2, 0xf2 }, + { 0xb3, 0x20 }, + { 0xb4, 0x20 }, + { 0xb5, 0x00 }, + { 0xb6, 0xaf }, + { 0xbb, 0xae }, + { 0xbc, 0x7f }, + { 0xbd, 0x7f }, + { 0xbe, 0x7f }, + { 0xbf, 0x7f }, + { 0xc0, 0xaa }, + { 0xc1, 0xc0 }, + { 0xc2, 0x01 }, + { 0xc3, 0x4e }, + { 0xc6, 0x05 }, + { 0xc7, 0x81 }, // Common control 24 + { 0xc9, 0xe0 }, + { 0xca, 0xe8 }, + { 0xcb, 0xf0 }, + { 0xcc, 0xd8 }, + { 0xcd, 0x93 }, + { 0xcd, 0x93 } + + ,{ 0xFF, 0xFF } +}; + + diff --git a/components/omnivision/ov9655/9655_yuv_qcif.h b/components/omnivision/ov9655/9655_yuv_qcif.h new file mode 100644 index 0000000..5eb8c33 --- /dev/null +++ b/components/omnivision/ov9655/9655_yuv_qcif.h @@ -0,0 +1,162 @@ +//; Generated by Sensor Tool +//; Ver: 1.2.1 +//; + +#include + +const struct ov_reg ov9655_yuv_qcif[]= { + { 0x12, 0x80 }, + { 0x00, 0x00 }, + { 0x01, 0x80 }, + { 0x02, 0x80 }, + { 0x03, 0x12 }, + { 0x04, 0x03 }, + { 0x0e, 0x61 }, + { 0x0f, 0x42 }, + { 0x11, 0x01 }, + { 0x12, 0x62 }, + { 0x13, 0xe7 }, + { 0x14, 0x3a }, + { 0x16, 0x24 }, + { 0x17, 0x18 }, + { 0x18, 0x0c }, + { 0x19, 0x01 }, + { 0x1a, 0x81 }, + { 0x1e, 0x04 }, + { 0x24, 0x3c }, + { 0x25, 0x36 }, + { 0x26, 0x72 }, + { 0x27, 0x08 }, + { 0x28, 0x08 }, + { 0x29, 0x15 }, + { 0x2a, 0x00 }, + { 0x2b, 0x00 }, + { 0x2c, 0x08 }, + { 0x32, 0xa4 }, + { 0x33, 0x00 }, + { 0x34, 0x3f }, + { 0x35, 0x00 }, + { 0x36, 0x3a }, + { 0x38, 0x72 }, + { 0x39, 0x57 }, + // { 0x3a, 0x80 }, // YUYV output sequence + { 0x3a, 0x00 }, // No delay + { 0x3b, 0x04 }, + { 0x3d, 0x99 }, + { 0x3e, 0x0e }, + { 0x3f, 0xc1 }, + { 0x40, 0xc0 }, + { 0x41, 0x01 }, + { 0x42, 0xc0 }, + { 0x43, 0x0a }, + { 0x44, 0xf0 }, + { 0x45, 0x46 }, + { 0x46, 0x62 }, + { 0x47, 0x2a }, + { 0x48, 0x3c }, + { 0x4a, 0xfc }, + { 0x4b, 0xfc }, + { 0x4c, 0x7f }, + { 0x4d, 0x7f }, + { 0x4e, 0x7f }, + + { 0x52, 0x28 }, + { 0x53, 0x88 }, + { 0x54, 0xb0 }, + { 0x4f, 0x98 }, + { 0x50, 0x98 }, + { 0x51, 0x00 }, + { 0x58, 0x1a }, + + + { 0x5b, 0x64 }, + { 0x5c, 0x84 }, + { 0x5d, 0x53 }, + { 0x5e, 0x0e }, + { 0x5f, 0xf0 }, + { 0x60, 0xf0 }, + { 0x61, 0xf0 }, + { 0x62, 0x00 }, + { 0x63, 0x00 }, + { 0x64, 0x02 }, + { 0x65, 0x20 }, + { 0x66, 0x00 }, + { 0x69, 0x0a }, + { 0x6b, 0x5a }, //bypass internal regulator +// { 0x6b, 0x4a }, // use internal regulator + { 0x6c, 0x04 }, + { 0x6d, 0x55 }, + { 0x6e, 0x00 }, + { 0x6f, 0x9d }, + { 0x70, 0x21 }, + { 0x71, 0x78 }, + { 0x72, 0x11 }, + { 0x73, 0x02 }, + { 0x74, 0x3a }, + { 0x75, 0x35 }, + { 0x76, 0x01 }, + { 0x77, 0x02 }, + { 0x7a, 0x12 }, + { 0x7b, 0x08 }, + { 0x7c, 0x15 }, + { 0x7d, 0x24 }, + { 0x7e, 0x45 }, + { 0x7f, 0x55 }, + { 0x80, 0x6a }, + { 0x81, 0x78 }, + { 0x82, 0x87 }, + { 0x83, 0x96 }, + { 0x84, 0xa3 }, + { 0x85, 0xb4 }, + { 0x86, 0xc3 }, + { 0x87, 0xd6 }, + { 0x88, 0xe6 }, + { 0x89, 0xf2 }, + + { 0x8a, 0x24 }, + { 0x8c, 0x80 }, + { 0x90, 0x7d }, + { 0x91, 0x7b }, + { 0x9d, 0x02 }, + { 0x9e, 0x02 }, + { 0x9f, 0x7a }, + { 0xa0, 0x79 }, + { 0xa1, 0x40 }, + { 0xa4, 0x50 }, + { 0xa5, 0x68 }, + { 0xa6, 0x4a }, + { 0xa8, 0xc1 }, + { 0xa9, 0xef }, + { 0xaa, 0x92 }, + { 0xab, 0x04 }, + { 0xac, 0x80 }, + { 0xad, 0x80 }, + { 0xae, 0x80 }, + { 0xaf, 0x80 }, + { 0xb2, 0xf2 }, + { 0xb3, 0x20 }, + { 0xb4, 0x20 }, + { 0xb5, 0x00 }, + { 0xb6, 0xaf }, + { 0xbb, 0xae }, + { 0xbc, 0x7f }, + { 0xbd, 0x7f }, + { 0xbe, 0x7f }, + { 0xbf, 0x7f }, + { 0xc0, 0xaa }, + { 0xc1, 0xc0 }, + { 0xc2, 0x01 }, + { 0xc3, 0x4e }, + { 0xc6, 0x05 }, + { 0xc7, 0x82 }, + { 0xc9, 0xe0 }, + { 0xca, 0xe8 }, + { 0xcb, 0xf0 }, + { 0xcc, 0xd8 }, + { 0xcd, 0x93 }, + { 0xcd, 0x93 } + + ,{ 0xFF, 0xFF } +}; + + diff --git a/components/omnivision/ov9655/9655_yuv_qqcif.h b/components/omnivision/ov9655/9655_yuv_qqcif.h new file mode 100644 index 0000000..e327635 --- /dev/null +++ b/components/omnivision/ov9655/9655_yuv_qqcif.h @@ -0,0 +1,163 @@ +//; Generated by Sensor Tool +//; Ver: 1.2.1 +//; + +#include + +const struct ov_reg ov9655_yuv_qqcif[]= { + { 0x12, 0x80 }, + { 0x00, 0x00 }, + { 0x01, 0x80 }, + { 0x02, 0x80 }, + { 0x03, 0x12 }, + { 0x04, 0x03 }, + { 0x0e, 0x61 }, + { 0x0f, 0x42 }, + { 0x11, 0x01 }, + { 0x12, 0x62 }, + { 0x13, 0xe7 }, + { 0x14, 0x3a }, + { 0x16, 0x24 }, + { 0x17, 0x3a }, + { 0x18, 0x02 }, + { 0x19, 0x01 }, + { 0x1a, 0x3d }, + { 0x1e, 0x04 }, + { 0x24, 0x3c }, + { 0x25, 0x36 }, + { 0x26, 0x72 }, + { 0x27, 0x08 }, + { 0x28, 0x08 }, + { 0x29, 0x15 }, + { 0x2a, 0x00 }, + { 0x2b, 0x00 }, + { 0x2c, 0x08 }, + { 0x32, 0xbf }, + { 0x33, 0x00 }, + { 0x34, 0x3f }, + { 0x35, 0x00 }, + { 0x36, 0x3a }, + { 0x38, 0x72 }, + { 0x39, 0x57 }, + // { 0x3a, 0x80 }, // YUYV output sequence + { 0x3a, 0x00 }, // No delay + { 0x3b, 0x04 }, + { 0x3d, 0x99 }, + { 0x3e, 0x02 }, + { 0x3f, 0xc1 }, + { 0x40, 0xc0 }, + { 0x41, 0x01 }, + { 0x42, 0xc0 }, + { 0x43, 0x0a }, + { 0x44, 0xf0 }, + { 0x45, 0x46 }, + { 0x46, 0x62 }, + { 0x47, 0x2a }, + { 0x48, 0x3c }, + { 0x4a, 0xfc }, + { 0x4b, 0xfc }, + { 0x4c, 0x7f }, + { 0x4d, 0x7f }, + { 0x4e, 0x7f }, + { 0x52, 0x28 }, + { 0x53, 0x88 }, + { 0x54, 0xb0 }, + { 0x4f, 0x98 }, + { 0x50, 0x98 }, + { 0x51, 0x00 }, + { 0x58, 0x1a }, + { 0x59, 0x85 }, + { 0x5a, 0xa9 }, + { 0x5b, 0x64 }, + { 0x5c, 0x84 }, + { 0x5d, 0x53 }, + { 0x5e, 0x0e }, + { 0x5f, 0xf0 }, + { 0x60, 0xf0 }, + { 0x61, 0xf0 }, + { 0x62, 0x00 }, + { 0x63, 0x00 }, + { 0x64, 0x02 }, + { 0x65, 0x20 }, + { 0x66, 0x00 }, + { 0x69, 0x0a }, + { 0x6b, 0x5a }, //bypass internal regulator +// { 0x6b, 0x4a }, // use internal regulator + { 0x6c, 0x04 }, + { 0x6d, 0x55 }, + { 0x6e, 0x00 }, + { 0x6f, 0x9d }, + { 0x70, 0x21 }, + { 0x71, 0x78 }, + { 0x72, 0x22 }, + { 0x73, 0x02 }, + { 0x74, 0x3a }, + { 0x75, 0x35 }, + { 0x76, 0x29 }, + { 0x77, 0x02 }, + { 0x7a, 0x12 }, + { 0x7b, 0x08 }, + { 0x7c, 0x15 }, + { 0x7d, 0x24 }, + { 0x7e, 0x45 }, + { 0x7f, 0x55 }, + { 0x80, 0x6a }, + { 0x81, 0x78 }, + { 0x82, 0x87 }, + { 0x83, 0x96 }, + { 0x84, 0xa3 }, + { 0x85, 0xb4 }, + { 0x86, 0xc3 }, + { 0x87, 0xd6 }, + { 0x88, 0xe6 }, + { 0x89, 0xf2 }, + + + + { 0x8a, 0x24 }, + { 0x8c, 0x80 }, + { 0x90, 0x7d }, + { 0x91, 0x7b }, + { 0x9d, 0x02 }, + { 0x9e, 0x02 }, + { 0x9f, 0x7a }, + { 0xa0, 0x79 }, + { 0xa1, 0x40 }, + { 0xa4, 0x50 }, + { 0xa5, 0x68 }, + { 0xa6, 0x4a }, + { 0xa8, 0xc1 }, + { 0xa9, 0xef }, + { 0xaa, 0x92 }, + { 0xab, 0x04 }, + { 0xac, 0x80 }, + { 0xad, 0x80 }, + { 0xae, 0x80 }, + { 0xaf, 0x80 }, + { 0xb2, 0xf2 }, + { 0xb3, 0x20 }, + { 0xb4, 0x20 }, + { 0xb5, 0x00 }, + { 0xb6, 0xaf }, + { 0xbb, 0xae }, + { 0xbc, 0x7f }, + { 0xbd, 0x7f }, + { 0xbe, 0x7f }, + { 0xbf, 0x7f }, + { 0xc0, 0xaa }, + { 0xc1, 0xc0 }, + { 0xc2, 0x01 }, + { 0xc3, 0x4e }, + { 0xc6, 0x05 }, + { 0xc7, 0x82 }, + { 0xc9, 0xe0 }, + { 0xca, 0xe8 }, + { 0xcb, 0xf0 }, + { 0xcc, 0xd8 }, + { 0xcd, 0x93 }, + { 0xcd, 0x93 } + + ,{ 0xFF, 0xFF } +}; + + diff --git a/components/omnivision/ov9655/9655_yuv_qqvga.h b/components/omnivision/ov9655/9655_yuv_qqvga.h new file mode 100644 index 0000000..f30b5b9 --- /dev/null +++ b/components/omnivision/ov9655/9655_yuv_qqvga.h @@ -0,0 +1,169 @@ +//; Generated by Sensor Tool +//; Ver: 1.2.1 +//; + +#include + +const struct ov_reg ov9655_yuv_qqvga[]= { + { 0x12, 0x80 }, + { 0x00, 0x00 }, + { 0x01, 0x80 }, + { 0x02, 0x80 }, + { 0x03, 0x02 }, + { 0x04, 0x03 }, + { 0x0e, 0x61 }, + { 0x0f, 0x42 }, + { 0x11, 0x01 }, + { 0x12, 0x62 }, + { 0x13, 0xe7 }, + { 0x14, 0x3a }, + { 0x16, 0x24 }, + { 0x17, 0x18 }, + { 0x18, 0x04 }, + { 0x19, 0x01 }, + { 0x1a, 0x81 }, + { 0x1e, 0x04 }, + { 0x24, 0x3c }, + { 0x25, 0x36 }, + { 0x26, 0x72 }, + { 0x27, 0x08 }, + { 0x28, 0x08 }, + { 0x29, 0x15 }, + { 0x2a, 0x00 }, + { 0x2b, 0x00 }, + { 0x2c, 0x08 }, + { 0x32, 0xa4 }, + { 0x33, 0x00 }, + { 0x34, 0x3f }, + { 0x35, 0x00 }, + { 0x36, 0x3a }, + { 0x38, 0x72 }, + { 0x39, 0x57 }, + // { 0x3a, 0x80 }, // YUYV output sequence + { 0x3a, 0x00 }, // No delay + { 0x3b, 0x04 }, + { 0x3d, 0x99 }, + { 0x3e, 0x0e }, + { 0x3f, 0xc1 }, + { 0x40, 0xc0 }, + { 0x41, 0x01 }, + { 0x42, 0xc0 }, + { 0x43, 0x0a }, + { 0x44, 0xf0 }, + { 0x45, 0x46 }, + { 0x46, 0x62 }, + { 0x47, 0x2a }, + { 0x48, 0x3c }, + { 0x4a, 0xfc }, + { 0x4b, 0xfc }, + { 0x4c, 0x7f }, + { 0x4d, 0x7f }, + { 0x4e, 0x7f }, + + + { 0x52, 0x28 }, + { 0x53, 0x88 }, + { 0x54, 0xb0 }, + { 0x4f, 0x98 }, + { 0x50, 0x98 }, + { 0x51, 0x00 }, + { 0x58, 0x1a }, + + + + { 0x59, 0x85 }, + { 0x5a, 0xa9 }, + { 0x5b, 0x64 }, + { 0x5c, 0x84 }, + { 0x5d, 0x53 }, + { 0x5e, 0x0e }, + { 0x5f, 0xf0 }, + { 0x60, 0xf0 }, + { 0x61, 0xf0 }, + { 0x62, 0x00 }, + { 0x63, 0x00 }, + { 0x64, 0x02 }, + { 0x65, 0x20 }, + { 0x66, 0x00 }, + { 0x69, 0x0a }, + { 0x6b, 0x5a }, //bypass internal regulator +// { 0x6b, 0x4a }, // use internal regulator + { 0x6c, 0x04 }, + { 0x6d, 0x55 }, + { 0x6e, 0x00 }, + { 0x6f, 0x9d }, + { 0x70, 0x21 }, + { 0x71, 0x78 }, + { 0x72, 0x22 }, + { 0x73, 0x02 }, + { 0x74, 0x10 }, + { 0x75, 0x10 }, + { 0x76, 0x01 }, + { 0x77, 0x02 }, + { 0x7a, 0x12 }, + { 0x7b, 0x08 }, + { 0x7c, 0x15 }, + { 0x7d, 0x24 }, + { 0x7e, 0x45 }, + { 0x7f, 0x55 }, + { 0x80, 0x6a }, + { 0x81, 0x78 }, + { 0x82, 0x87 }, + { 0x83, 0x96 }, + { 0x84, 0xa3 }, + { 0x85, 0xb4 }, + { 0x86, 0xc3 }, + { 0x87, 0xd6 }, + { 0x88, 0xe6 }, + { 0x89, 0xf2 }, + + + + { 0x8a, 0x24 }, + + { 0x8c, 0x80 }, + { 0x90, 0x7d }, + { 0x91, 0x7b }, + { 0x9d, 0x02 }, + { 0x9e, 0x02 }, + { 0x9f, 0x7a }, + { 0xa0, 0x79 }, + { 0xa1, 0x40 }, + { 0xa4, 0x50 }, + { 0xa5, 0x68 }, + { 0xa6, 0x4a }, + { 0xa8, 0xc1 }, + { 0xa9, 0xef }, + { 0xaa, 0x92 }, + { 0xab, 0x04 }, + { 0xac, 0x80 }, + { 0xad, 0x80 }, + { 0xae, 0x80 }, + { 0xaf, 0x80 }, + { 0xb2, 0xf2 }, + { 0xb3, 0x20 }, + { 0xb4, 0x20 }, + { 0xb5, 0x00 }, + { 0xb6, 0xaf }, + { 0xbb, 0xae }, + { 0xbc, 0x7f }, + { 0xbd, 0x7f }, + { 0xbe, 0x7f }, + { 0xbf, 0x7f }, + { 0xc0, 0xaa }, + { 0xc1, 0xc0 }, + { 0xc2, 0x01 }, + { 0xc3, 0x4e }, + { 0xc6, 0x05 }, + { 0xc7, 0x82 }, + { 0xc9, 0xe0 }, + { 0xca, 0xe8 }, + { 0xcb, 0xf0 }, + { 0xcc, 0xd8 }, + { 0xcd, 0x93 }, + { 0xcd, 0x93 } + + ,{ 0xFF, 0xFF } +}; + + diff --git a/components/omnivision/ov9655/9655_yuv_qvga.h b/components/omnivision/ov9655/9655_yuv_qvga.h new file mode 100644 index 0000000..c2bc02d --- /dev/null +++ b/components/omnivision/ov9655/9655_yuv_qvga.h @@ -0,0 +1,166 @@ +//; Generated by Sensor Tool +//; Ver: 1.2.1 +//; + +#include + +const struct ov_reg ov9655_yuv_qvga[]= { + { 0x12, 0x80 }, + { 0x00, 0x00 }, + { 0x01, 0x80 }, + { 0x02, 0x80 }, + { 0x03, 0x02 }, + { 0x04, 0x03 }, + { 0x0e, 0x61 }, + { 0x0f, 0x42 }, + { 0x11, 0x01 }, + { 0x12, 0x62 }, + { 0x13, 0xe7 }, + { 0x14, 0x3a }, + { 0x16, 0x24 }, + { 0x17, 0x18 }, + { 0x18, 0x04 }, + { 0x19, 0x01 }, + { 0x1a, 0x81 }, + { 0x1e, 0x04 }, + { 0x24, 0x3c }, + { 0x25, 0x36 }, + { 0x26, 0x72 }, + { 0x27, 0x08 }, + { 0x28, 0x08 }, + { 0x29, 0x15 }, + { 0x2a, 0x00 }, + { 0x2b, 0x00 }, + { 0x2c, 0x08 }, + { 0x32, 0x24 }, + { 0x33, 0x00 }, + { 0x34, 0x3f }, + { 0x35, 0x00 }, + { 0x36, 0x3a }, + { 0x38, 0x72 }, + { 0x39, 0x57 }, + // { 0x3a, 0x80 }, // YUYV output sequence + { 0x3a, 0x00 }, // No delay + { 0x3b, 0x04 }, + { 0x3d, 0x99 }, + { 0x3e, 0x0e }, + { 0x3f, 0xc1 }, + { 0x40, 0xc0 }, + { 0x41, 0x01 }, + { 0x42, 0xc0 }, + { 0x43, 0x0a }, + { 0x44, 0xf0 }, + { 0x45, 0x46 }, + { 0x46, 0x62 }, + { 0x47, 0x2a }, + { 0x48, 0x3c }, + { 0x4a, 0xfc }, + { 0x4b, 0xfc }, + { 0x4c, 0x7f }, + { 0x4d, 0x7f }, + { 0x4e, 0x7f }, + + { 0x52, 0x28 }, + { 0x53, 0x88 }, + { 0x54, 0xb0 }, + { 0x4f, 0x98 }, + { 0x50, 0x98 }, + { 0x51, 0x00 }, + { 0x58, 0x1a }, + + { 0x59, 0x85 }, + { 0x5a, 0xa9 }, + { 0x5b, 0x64 }, + { 0x5c, 0x84 }, + { 0x5d, 0x53 }, + { 0x5e, 0x0e }, + { 0x5f, 0xf0 }, + { 0x60, 0xf0 }, + { 0x61, 0xf0 }, + { 0x62, 0x00 }, + { 0x63, 0x00 }, + { 0x64, 0x02 }, + { 0x65, 0x20 }, + { 0x66, 0x00 }, + { 0x69, 0x0a }, + { 0x6b, 0x5a }, //bypass internal regulator +// { 0x6b, 0x4a }, // use internal regulator + { 0x6c, 0x04 }, + { 0x6d, 0x55 }, + { 0x6e, 0x00 }, + { 0x6f, 0x9d }, + { 0x70, 0x21 }, + { 0x71, 0x78 }, + { 0x72, 0x11 }, + { 0x73, 0x01 }, + { 0x74, 0x10 }, + { 0x75, 0x10 }, + { 0x76, 0x01 }, + { 0x77, 0x02 }, + + { 0x7a, 0x12 }, + { 0x7b, 0x08 }, + { 0x7c, 0x15 }, + { 0x7d, 0x24 }, + { 0x7e, 0x45 }, + { 0x7f, 0x55 }, + { 0x80, 0x6a }, + { 0x81, 0x78 }, + { 0x82, 0x87 }, + { 0x83, 0x96 }, + { 0x84, 0xa3 }, + { 0x85, 0xb4 }, + { 0x86, 0xc3 }, + { 0x87, 0xd6 }, + { 0x88, 0xe6 }, + { 0x89, 0xf2 }, + + + + { 0x8a, 0x24 }, + { 0x8c, 0x80 }, + { 0x90, 0x7d }, + { 0x91, 0x7b }, + { 0x9d, 0x02 }, + { 0x9e, 0x02 }, + { 0x9f, 0x7a }, + { 0xa0, 0x79 }, + { 0xa1, 0x40 }, + { 0xa4, 0x50 }, + { 0xa5, 0x68 }, + { 0xa6, 0x4a }, + { 0xa8, 0xc1 }, + { 0xa9, 0xef }, + { 0xaa, 0x92 }, + { 0xab, 0x04 }, + { 0xac, 0x80 }, + { 0xad, 0x80 }, + { 0xae, 0x80 }, + { 0xaf, 0x80 }, + { 0xb2, 0xf2 }, + { 0xb3, 0x20 }, + { 0xb4, 0x20 }, + { 0xb5, 0x00 }, + { 0xb6, 0xaf }, + { 0xbb, 0xae }, + { 0xbc, 0x7f }, + { 0xbd, 0x7f }, + { 0xbe, 0x7f }, + { 0xbf, 0x7f }, + { 0xc0, 0xaa }, + { 0xc1, 0xc0 }, + { 0xc2, 0x01 }, + { 0xc3, 0x4e }, + { 0xc6, 0x05 }, + { 0xc7, 0x81 }, + { 0xc9, 0xe0 }, + { 0xca, 0xe8 }, + { 0xcb, 0xf0 }, + { 0xcc, 0xd8 }, + { 0xcd, 0x93 }, + { 0xcd, 0x93 } + + ,{ 0xFF, 0xFF } +}; + + diff --git a/components/omnivision/ov9655/9655_yuv_sxga.h b/components/omnivision/ov9655/9655_yuv_sxga.h new file mode 100644 index 0000000..9ee1aa4 --- /dev/null +++ b/components/omnivision/ov9655/9655_yuv_sxga.h @@ -0,0 +1,164 @@ +//; Generated by Sensor Tool +//; Ver: 1.2.1 +//; + +#include + +const struct ov_reg ov9655_yuv_sxga[]= { + { 0x12, 0x80 }, + { 0x00, 0x00 }, + { 0x01, 0x80 }, + { 0x02, 0x80 }, + { 0x03, 0x1b }, + { 0x04, 0x03 }, + { 0x0e, 0x61 }, + { 0x0f, 0x42 }, + { 0x11, 0x00 }, + { 0x12, 0x02 }, + { 0x13, 0xe7 }, + { 0x14, 0x3a }, + { 0x16, 0x24 }, + { 0x17, 0x1d }, + { 0x18, 0xbd }, + { 0x19, 0x01 }, + { 0x1a, 0x81 }, + { 0x1e, 0x04 }, + { 0x24, 0x3c }, + { 0x25, 0x36 }, + { 0x26, 0x72 }, + { 0x27, 0x08 }, + { 0x28, 0x08 }, + { 0x29, 0x15 }, + { 0x2a, 0x00 }, + { 0x2b, 0x00 }, + { 0x2c, 0x08 }, + { 0x32, 0xff }, + { 0x33, 0x00 }, + { 0x34, 0x3d }, + { 0x35, 0x00 }, + { 0x36, 0xf8 }, + { 0x38, 0x72 }, + { 0x39, 0x57 }, + // { 0x3a, 0x80 }, // YUYV output sequence + { 0x3a, 0x00 }, // No delay + { 0x3b, 0x04 }, + { 0x3d, 0x99 }, + { 0x3e, 0x0c }, + { 0x3f, 0xc1 }, + { 0x40, 0xc0 }, + { 0x41, 0x00 }, + { 0x42, 0xc0 }, + { 0x43, 0x0a }, + { 0x44, 0xf0 }, + { 0x45, 0x46 }, + { 0x46, 0x62 }, + { 0x47, 0x2a }, + { 0x48, 0x3c }, + { 0x4a, 0xfc }, + { 0x4b, 0xfc }, + { 0x4c, 0x7f }, + { 0x4d, 0x7f }, + { 0x4e, 0x7f }, + { 0x52, 0x28 }, + { 0x53, 0x88 }, + { 0x54, 0xb0 }, + { 0x4f, 0x98 }, + { 0x50, 0x98 }, + { 0x51, 0x00 }, + { 0x58, 0x1a }, + { 0x58, 0x1a }, + { 0x59, 0x85 }, + { 0x5a, 0xa9 }, + { 0x5b, 0x64 }, + { 0x5c, 0x84 }, + { 0x5d, 0x53 }, + { 0x5e, 0x0e }, + { 0x5f, 0xf0 }, + { 0x60, 0xf0 }, + { 0x61, 0xf0 }, + { 0x62, 0x00 }, + { 0x63, 0x00 }, + { 0x64, 0x02 }, + { 0x65, 0x16 }, + { 0x66, 0x01 }, + { 0x69, 0x02 }, + { 0x6b, 0x5a }, //bypass internal regulator +// { 0x6b, 0x4a }, // use internal regulator + { 0x6c, 0x04 }, + { 0x6d, 0x55 }, + { 0x6e, 0x00 }, + { 0x6f, 0x9d }, + { 0x70, 0x21 }, + { 0x71, 0x78 }, + { 0x72, 0x00 }, + { 0x73, 0x01 }, + { 0x74, 0x3a }, + { 0x75, 0x35 }, + { 0x76, 0x01 }, + { 0x77, 0x02 }, + + { 0x7a, 0x12 }, + { 0x7b, 0x08 }, + { 0x7c, 0x15 }, + { 0x7d, 0x24 }, + { 0x7e, 0x45 }, + { 0x7f, 0x55 }, + { 0x80, 0x6a }, + { 0x81, 0x78 }, + { 0x82, 0x87 }, + { 0x83, 0x96 }, + { 0x84, 0xa3 }, + { 0x85, 0xb4 }, + { 0x86, 0xc3 }, + { 0x87, 0xd6 }, + { 0x88, 0xe6 }, + { 0x89, 0xf2 }, + + + + { 0x8a, 0x03 }, + { 0x8c, 0x0d }, + { 0x90, 0x7d }, + { 0x91, 0x7b }, + { 0x9d, 0x03 }, + { 0x9e, 0x04 }, + { 0x9f, 0x7a }, + { 0xa0, 0x79 }, + { 0xa1, 0x40 }, + { 0xa4, 0x50 }, + { 0xa5, 0x68 }, + { 0xa6, 0x4a }, + { 0xa8, 0xc1 }, + { 0xa9, 0xef }, + { 0xaa, 0x92 }, + { 0xab, 0x04 }, + { 0xac, 0x80 }, + { 0xad, 0x80 }, + { 0xae, 0x80 }, + { 0xaf, 0x80 }, + { 0xb2, 0xf2 }, + { 0xb3, 0x20 }, + { 0xb4, 0x20 }, + { 0xb5, 0x00 }, + { 0xb6, 0xaf }, + { 0xbb, 0xae }, + { 0xbc, 0x7f }, + { 0xbd, 0x7f }, + { 0xbe, 0x7f }, + { 0xbf, 0x7f }, + { 0xc0, 0xe2 }, + { 0xc1, 0xc0 }, + { 0xc2, 0x01 }, + { 0xc3, 0x4e }, + { 0xc6, 0x05 }, + { 0xc7, 0x80 }, + { 0xc9, 0xe0 }, + { 0xca, 0xe8 }, + { 0xcb, 0xf0 }, + { 0xcc, 0xd8 }, + { 0xcd, 0x93 } + + ,{ 0xFF, 0xFF } +}; + + diff --git a/components/omnivision/ov9655/9655_yuv_vga.h b/components/omnivision/ov9655/9655_yuv_vga.h new file mode 100644 index 0000000..adddf08 --- /dev/null +++ b/components/omnivision/ov9655/9655_yuv_vga.h @@ -0,0 +1,168 @@ +//; Generated by Sensor Tool +//; Ver: 1.2.2 +//; +#include + +const struct ov_reg ov9655_yuv_vga[]= { + + { 0x12, 0x80 }, + { 0x00, 0x00 }, + { 0x01, 0x80 }, + { 0x02, 0x80 }, + { 0x03, 0x12 }, + { 0x04, 0x03 }, + { 0x0e, 0x61 }, + { 0x0f, 0x42 }, + { 0x11, 0x01 }, + + { 0x12, 0x62 }, // YUV 30fps + { 0x13, 0xe7 }, + { 0x14, 0x3a }, + { 0x16, 0x24 }, + { 0x17, 0x16 }, + { 0x18, 0x02 }, + { 0x19, 0x01 }, + { 0x1a, 0x3d }, + + { 0x1e, 0x04 }, + { 0x24, 0x3c }, + { 0x25, 0x36 }, + { 0x26, 0x72 }, + { 0x27, 0x08 }, + + { 0x28, 0x08 }, + { 0x29, 0x15 }, + { 0x2a, 0x00 }, + { 0x2b, 0x00 }, + { 0x2c, 0x08 }, + { 0x32, 0xff }, + { 0x33, 0x00 }, + { 0x34, 0x3F }, + + { 0x35, 0x00 }, + { 0x36, 0xfa }, + { 0x38, 0x72 }, + { 0x39, 0x57 }, + // { 0x3a, 0x80 }, // YUYV output sequence + { 0x3a, 0x00 }, // No delay + + { 0x3b, 0x04 }, + { 0x3d, 0x99 }, + { 0x3e, 0x0c }, + { 0x3f, 0xc1 }, + { 0x40, 0xc0 }, + { 0x41, 0x00 }, + { 0x42, 0xc0 }, + { 0x43, 0x0a }, + { 0x44, 0xf0 }, + { 0x45, 0x46 }, + { 0x46, 0x62 }, + { 0x47, 0x2a }, + { 0x48, 0x3c }, + { 0x4a, 0xfc }, + { 0x4b, 0xfc }, + { 0x4c, 0x7f }, + { 0x4d, 0x7f }, + { 0x4e, 0x7f }, + + { 0x52, 0x28 }, + { 0x53, 0x88 }, + { 0x54, 0xb0 }, + { 0x4f, 0x98 }, + { 0x50, 0x98 }, + { 0x51, 0x0 }, + { 0x58, 0x1a }, + + { 0x59, 0x85 }, + { 0x5a, 0xa9 }, + { 0x5b, 0x64 }, + { 0x5c, 0x84 }, + { 0x5d, 0x53 }, + { 0x5e, 0x0e }, + { 0x5f, 0xf0 }, + { 0x60, 0xf0 }, + { 0x61, 0xf0 }, + { 0x62, 0x00 }, + { 0x63, 0x00 }, + { 0x64, 0x02 }, + { 0x65, 0x20 }, + { 0x66, 0x00 }, + { 0x69, 0x0a }, + { 0x6b, 0x5a }, //bypass internal regulator +// { 0x6b, 0x4a }, // use internal regulator + { 0x6c, 0x04 }, + { 0x6d, 0x55 }, + { 0x6e, 0x00 }, + { 0x6f, 0x9d }, + { 0x70, 0x21 }, + { 0x71, 0x78 }, + { 0x72, 0x00 }, + { 0x73, 0x00 }, + { 0x74, 0x3a }, + { 0x75, 0x35 }, + { 0x76, 0x01 }, + { 0x77, 0x02 }, + + { 0x7a, 0x12 }, + { 0x7b, 0x08 }, + { 0x7c, 0x15 }, + { 0x7d, 0x24 }, + { 0x7e, 0x45 }, + { 0x7f, 0x55 }, + { 0x80, 0x6a }, + { 0x81, 0x78 }, + { 0x82, 0x87 }, + { 0x83, 0x96 }, + { 0x84, 0xa3 }, + { 0x85, 0xb4 }, + { 0x86, 0xc3 }, + { 0x87, 0xd6 }, + { 0x88, 0xe6 }, + { 0x89, 0xf2 }, + + { 0x8c, 0x8d }, + { 0x90, 0x7d }, + { 0x91, 0x7b }, + { 0x9d, 0x02 }, + { 0x9e, 0x02 }, + { 0x9f, 0x7a }, + { 0xa0, 0x79 }, + { 0xa1, 0x40 }, + { 0xa4, 0x50 }, + { 0xa5, 0x68 }, + { 0xa6, 0x4a }, + { 0xa8, 0xc1 }, + { 0xa9, 0xef }, + { 0xaa, 0x92 }, + { 0xab, 0x04 }, + { 0xac, 0x80 }, + { 0xad, 0x80 }, + { 0xae, 0x80 }, + { 0xaf, 0x80 }, + { 0xb2, 0xf2 }, + { 0xb3, 0x20 }, + { 0xb4, 0x20 }, + { 0xb5, 0x00 }, + { 0xb6, 0xaf }, + { 0xbb, 0xae }, + { 0xbc, 0x7f }, + { 0xbd, 0x7f }, + { 0xbe, 0x7f }, + { 0xbf, 0x7f }, + { 0xc0, 0xaa }, + { 0xc1, 0xc0 }, + { 0xc2, 0x01 }, + { 0xc3, 0x4e }, + { 0xc6, 0x05 }, + { 0xc7, 0x80 }, + { 0xc9, 0xe0 }, + { 0xca, 0xe8 }, + { 0xcb, 0xf0 }, + { 0xcc, 0xd8 }, + { 0xcd, 0x93 }, + { 0xcd, 0x93 } + + ,{ 0xFF, 0xFF } +}; + + diff --git a/components/omnivision/ov9655/ov9655.c b/components/omnivision/ov9655/ov9655.c new file mode 100644 index 0000000..6ee9873 --- /dev/null +++ b/components/omnivision/ov9655/ov9655.c @@ -0,0 +1,163 @@ +/* ---------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support + * ---------------------------------------------------------------------------- + * Copyright (c) 2008, Atmel Corporation + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * ---------------------------------------------------------------------------- + */ + +#include + +#if defined(BOARD_CAPTOR_OV9650) +//------------------------------------------------------------------------------ +/// \unit +/// +/// !!!Purpose +/// +/// Specific configuration for Omnivision OV6555 captor +/// +/// !!!Usage +/// +/// -# Different files are been provided by Omnivision: +/// - 9655_yuv_cif.h +/// - 9655_yuv_qcif.h +/// - 9655_yuv_qqcif.h +/// - 9655_yuv_qqvga.h +/// - 9655_yuv_qvga.h +/// - 9655_yuv_sxga.h +/// - 9655_yuv_vga.h +/// -# Configure the captor using theses files +//------------------------------------------------------------------------------ + +//----------------------------------------------------------------------------- +// Headers +//----------------------------------------------------------------------------- +#include +#include + +#include + +#include "9655_yuv_cif.h" +#include "9655_yuv_qcif.h" +#include "9655_yuv_qqcif.h" +#include "9655_yuv_qvga.h" +#include "9655_yuv_qqvga.h" +#include "9655_yuv_sxga.h" +#include "9655_yuv_vga.h" + +//------------------------------------------------------------------------------ +/// Array of image sizes supported by OV965x +//------------------------------------------------------------------------------ +const static struct capture_size ov965x_sizes[] = { +// {width, height} + /// QQCIF + { 88, 72 }, + /// QQVGA + { 160, 120 }, + /// QCIF + { 176, 144 }, + /// QVGA + { 320, 240 }, + /// CIF + { 352, 288 }, + /// VGA + { 640, 480 }, + /// SXGA + {1280, 1024 } +}; + +//------------------------------------------------------------------------------ +// Global Functions +//------------------------------------------------------------------------------ + +//----------------------------------------------------------------------------- +/// Configure the OV9650 for a specified image size, pixel format, +/// and frame period. +//----------------------------------------------------------------------------- +void ov_configure(Twid *pTwid, unsigned int width, unsigned int heigth) +{ + const struct ov_reg *reg_conf; + unsigned char goodCaptureSize = 0; + unsigned char i; + + TRACE_DEBUG("ov965x_configure\n\r"); + for( i=0; i