00001 /* ---------------------------------------------------------------------------- 00002 * SAM Software Package License 00003 * ---------------------------------------------------------------------------- 00004 * Copyright (c) 2013, Atmel Corporation 00005 * 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions are met: 00010 * 00011 * - Redistributions of source code must retain the above copyright notice, 00012 * this list of conditions and the disclaimer below. 00013 * 00014 * Atmel's name may not be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR 00018 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00020 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 00022 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00023 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00024 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00025 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00026 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00027 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00028 * ---------------------------------------------------------------------------- 00029 */ 00030 00031 #ifndef OMNIVISION_H 00032 #define OMNIVISION_H 00033 00034 00035 /*--------------------------------------------------------------------------- 00036 * TYPE 00037 *---------------------------------------------------------------------------*/ 00038 /** define a structure for ovxxxx register initialization values */ 00039 struct ov_reg 00040 { 00041 /* Register to be written */ 00042 uint16_t reg; 00043 /* Value to be written in the register */ 00044 uint8_t val; 00045 }; 00046 00047 00048 /*--------------------------------------------------------------------------- 00049 * DEFINITAION 00050 *---------------------------------------------------------------------------*/ 00051 #define OV_2640 0x00 00052 #define OV_2643 0x01 00053 #define OV_5640 0x02 00054 #define OV_7740 0x03 00055 #define OV_9740 0x04 00056 #define OV_UNKNOWN 0xFF 00057 00058 /*---------------------------------------------------------------------------- 00059 * Exported functions 00060 *----------------------------------------------------------------------------*/ 00061 extern uint8_t ov_init(Twid *pTwid); 00062 extern void ov_DumpRegisters8(Twid *pTwid); 00063 extern void ov_DumpRegisters16(Twid *pTwid); 00064 extern uint32_t ov_write_regs8(Twid *pTwid, const struct ov_reg* pReglist); 00065 extern uint32_t ov_write_regs16(Twid *pTwid, const struct ov_reg* pReglist); 00066 extern uint8_t ov_read_reg8(Twid *pTwid, uint8_t reg, uint8_t *pData); 00067 extern uint8_t ov_read_reg16(Twid *pTwid, uint16_t reg, uint8_t *pData); 00068 extern uint8_t ov_write_reg8(Twid *pTwid, uint8_t reg, uint8_t val); 00069 extern uint8_t ov_write_reg16(Twid *pTwid, uint16_t reg, uint8_t val); 00070 extern void isOV5640_AF_InitDone(Twid *pTwid); 00071 extern uint32_t ov_5640_AF_single(Twid *pTwid); 00072 extern uint32_t ov_5640_AF_continue(Twid *pTwid); 00073 extern uint32_t ov_5640_AFPause(Twid *pTwid); 00074 extern uint32_t ov_5640_AFrelease(Twid *pTwid); 00075 00076 #endif