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 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00022 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00023 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00024 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00025 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00026 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 * ---------------------------------------------------------------------------- 00028 */ 00029 00030 /** \file */ 00031 00032 /** \addtogroup isi_module 00033 * @{ 00034 * \section gmac_usage Usage 00035 * - ISI_Init: initialize ISI with default parameters 00036 * - ISI_EnableInterrupt: enable one or more interrupts 00037 * - ISI_DisableInterrupt: disable one or more interrupts 00038 * - ISI_Enable: enable isi module 00039 * - ISI_Disable: disable isi module 00040 * - ISI_CodecPathFull: enable codec path 00041 * - ISI_SetFrame: set frame rate 00042 * - ISI_BytesForOnePixel: return number of byte for one pixel 00043 * - ISI_StatusRegister: return ISI status register 00044 * - ISI_Reset: make a software reset 00045 */ 00046 /**@}*/ 00047 00048 #ifndef ISI_H 00049 #define ISI_H 00050 00051 00052 00053 /*---------------------------------------------------------------------------- 00054 * Definition 00055 *----------------------------------------------------------------------------*/ 00056 #define YUV_INPUT 0 00057 #define RGB_INPUT 1 00058 #define GRAYSCALE_INPUT 2 00059 00060 /*---------------------------------------------------------------------------- 00061 * Types 00062 *----------------------------------------------------------------------------*/ 00063 00064 /** ISI descriptors */ 00065 typedef struct 00066 { 00067 /** Current LCD index, used with AT91C_ISI_MAX_PREV_BUFFER */ 00068 uint32_t CurrentLcdIndex; 00069 /** set if Fifo Codec Empty is present */ 00070 volatile uint32_t DisplayCodec; 00071 /** upgrade for each Fifo Codec Overflow (statistics use) */ 00072 uint32_t nb_codec_ovf; 00073 /** upgrade for each Fifo Preview Overflow (statistics use) */ 00074 uint32_t nb_prev_ovf; 00075 }ISI_Descriptors; 00076 00077 /** Frame Buffer Descriptors */ 00078 typedef struct 00079 { 00080 /** Address of the Current FrameBuffer */ 00081 uint32_t Current; 00082 /** Address of the Control */ 00083 uint32_t Control; 00084 /** Address of the Next FrameBuffer */ 00085 uint32_t Next; 00086 }ISI_FrameBufferDescriptors; 00087 00088 00089 /** ISI Matrix Color Space Conversion YCrCb to RGB */ 00090 typedef struct 00091 { 00092 /** Color Space Conversion Matrix Coefficient C0*/ 00093 uint8_t C0; 00094 /** Color Space Conversion Matrix Coefficient C1 */ 00095 uint8_t C1; 00096 /** Color Space Conversion Matrix Coefficient C2 */ 00097 uint8_t C2; 00098 /** Color Space Conversion Matrix Coefficient C3 */ 00099 uint8_t C3; 00100 /** Color Space Conversion Red Chrominance Default Offset */ 00101 uint8_t Croff; 00102 /** Color Space Conversion Blue Chrominance Default Offset */ 00103 uint8_t Cboff; 00104 /** Color Space Conversion Luminance Default Offset */ 00105 uint8_t Yoff; 00106 /** Color Space Conversion Matrix Coefficient C4 */ 00107 uint16_t C4; 00108 }ISI_Y2R; 00109 00110 /** ISI Matrix Color Space Conversion RGB to YCrCb */ 00111 typedef struct 00112 { 00113 /** Color Space Conversion Matrix Coefficient C0*/ 00114 uint8_t C0; 00115 /** Color Space Conversion Matrix Coefficient C1 */ 00116 uint8_t C1; 00117 /** Color Space Conversion Matrix Coefficient C2 */ 00118 uint8_t C2; 00119 /** Color Space Conversion Red Component Offset */ 00120 uint8_t Roff; 00121 /** Color Space Conversion Matrix Coefficient C3*/ 00122 uint8_t C3; 00123 /** Color Space Conversion Matrix Coefficient C4 */ 00124 uint8_t C4; 00125 /** Color Space Conversion Matrix Coefficient C5 */ 00126 uint8_t C5; 00127 /** Color Space Conversion Green Component Offset */ 00128 uint8_t Goff; 00129 /** Color Space Conversion Matrix Coefficient C6*/ 00130 uint8_t C6; 00131 /** Color Space Conversion Matrix Coefficient C7 */ 00132 uint8_t C7; 00133 /** Color Space Conversion Matrix Coefficient C8 */ 00134 uint8_t C8; 00135 /** Color Space Conversion Blue Component Offset */ 00136 uint8_t Boff; 00137 }ISI_R2Y; 00138 00139 /*---------------------------------------------------------------------------- 00140 * Exported functions 00141 *----------------------------------------------------------------------------*/ 00142 extern void ISI_Enable(void); 00143 00144 extern void ISI_Disable(void); 00145 00146 void ISI_DmaChannelEnable(uint32_t channel); 00147 00148 void ISI_DmaChannelDisable(uint32_t channel); 00149 00150 extern void ISI_EnableInterrupt(uint32_t flag); 00151 00152 extern void ISI_DisableInterrupt(uint32_t flag); 00153 00154 extern void ISI_CodecPathFull(void); 00155 00156 extern void ISI_SetFrameRate(uint32_t frame); 00157 00158 extern uint8_t ISI_BytesForOnePixel(uint8_t bmpRgb); 00159 00160 extern void ISI_Reset(void); 00161 00162 extern void ISI_Init(pIsi_Video pVideo); 00163 00164 extern uint32_t ISI_StatusRegister(void); 00165 00166 extern void ISI_SetBlank( 00167 uint8_t hBlank, 00168 uint8_t vBlank); 00169 00170 extern void ISI_SetSensorSize( 00171 uint32_t hSize, 00172 uint32_t vSize); 00173 00174 extern void ISI_RgbPixelMapping(uint32_t wRgbPixelMapping); 00175 00176 extern void ISI_RgbSwapMode(uint32_t swapMode); 00177 00178 extern void ISI_YCrCbFormat(uint32_t wYuvSwapMode); 00179 00180 extern void ISI_setGrayScaleMode(uint32_t wPixelFormat); 00181 00182 extern void ISI_setInputStream(uint32_t wStreamMode); 00183 00184 extern void ISI_setPreviewSize( 00185 uint32_t hSize, 00186 uint32_t vSize); 00187 00188 extern void ISI_calcScalerFactor( void ); 00189 00190 extern void ISI_setDmaInPreviewPath( 00191 uint32_t baseFrameBufDesc, 00192 uint32_t dmaCtrl, 00193 uint32_t frameBufferStartAddr); 00194 00195 extern void ISI_setDmaInCodecPath( 00196 uint32_t baseFrameBufDesc, 00197 uint32_t dmaCtrl, 00198 uint32_t frameBufferStartAddr); 00199 00200 extern void ISI_SetMatrix4Yuv2Rgb (ISI_Y2R* yuv2rgb); 00201 extern void ISI_SetMatrix4Rgb2Yuv (ISI_R2Y* rgb2yuv); 00202 00203 #endif //#ifndef ISI_H 00204