1 /* 2 * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 11 * Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the 14 * distribution. 15 * 16 * Neither the name of Texas Instruments Incorporated nor the names of 17 * its contributors may be used to endorse or promote products derived 18 * from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * 32 */ 33 //***************************************************************************** 34 // 35 // camera.h 36 // 37 // Prototypes and macros for the camera controller module. 38 // 39 //***************************************************************************** 40 41 #ifndef __CAMERA_H__ 42 #define __CAMERA_H__ 43 44 //***************************************************************************** 45 // 46 // If building with a C++ compiler, make all of the definitions in this header 47 // have a C binding. 48 // 49 //***************************************************************************** 50 #ifdef __cplusplus 51 extern "C" 52 { 53 #endif 54 55 //***************************************************************************** 56 // Macro defining Camera buffer address 57 //***************************************************************************** 58 #define CAM_BUFFER_ADDR 0x44018100 59 60 61 //***************************************************************************** 62 // Value that can be passed to CameraXClkSet(). 63 //***************************************************************************** 64 #define CAM_XCLK_STABLE_LO 0x00 65 #define CAM_XCLK_STABLE_HI 0x01 66 #define CAM_XCLK_DIV_BYPASS 0x02 67 68 69 //***************************************************************************** 70 // Value that can be passed to CameraIntEnable(), CameraIntDisable, 71 // CameraIntClear() or returned from CameraIntStatus(). 72 //***************************************************************************** 73 #define CAM_INT_DMA 0x80000000 74 #define CAM_INT_FE 0x00010000 75 #define CAM_INT_FIFO_NOEMPTY 0x00000010 76 #define CAM_INT_FIFO_FULL 0x00000008 77 #define CAM_INT_FIFO_THR 0x00000004 78 #define CAM_INT_FIFO_OF 0x00000002 79 #define CAN_INT_FIFO_UR 0x00000001 80 81 82 //***************************************************************************** 83 // Value that can be passed to CameraXClkConfig(). 84 //***************************************************************************** 85 #define CAM_HS_POL_HI 0x00000000 86 #define CAM_HS_POL_LO 0x00000200 87 #define CAM_VS_POL_HI 0x00000000 88 #define CAM_VS_POL_LO 0x00000100 89 90 #define CAM_PCLK_RISE_EDGE 0x00000000 91 #define CAM_PCLK_FALL_EDGE 0x00000400 92 93 #define CAM_ORDERCAM_SWAP 0x00000800 94 #define CAM_NOBT_SYNCHRO 0x00002000 95 #define CAM_IF_SYNCHRO 0x00080000 96 97 98 //***************************************************************************** 99 // 100 // API Function prototypes 101 // 102 //***************************************************************************** 103 extern void CameraReset(unsigned long ulBase); 104 extern void CameraParamsConfig(unsigned long ulBase, unsigned long ulHSPol, 105 unsigned long ulVSPol, unsigned long ulFlags); 106 extern void CameraXClkConfig(unsigned long ulBase, unsigned long ulCamClkIn, 107 unsigned long ulXClk); 108 extern void CameraXClkSet(unsigned long ulBase, unsigned char bXClkFlags); 109 extern void CameraDMAEnable(unsigned long ulBase); 110 extern void CameraDMADisable(unsigned long ulBase); 111 extern void CameraThresholdSet(unsigned long ulBase, unsigned long ulThreshold); 112 extern void CameraIntRegister(unsigned long ulBase, void (*pfnHandler)(void)); 113 extern void CameraIntUnregister(unsigned long ulBase); 114 extern void CameraIntEnable(unsigned long ulBase, unsigned long ulIntFlags); 115 extern void CameraIntDisable(unsigned long ulBase, unsigned long ulIntFlags); 116 extern unsigned long CameraIntStatus(unsigned long ulBase); 117 extern void CameraIntClear(unsigned long ulBase, unsigned long ulIntFlags); 118 extern void CameraCaptureStop(unsigned long ulBase, tBoolean bImmediate); 119 extern void CameraCaptureStart(unsigned long ulBase); 120 extern void CameraBufferRead(unsigned long ulBase,unsigned long *pBuffer, 121 unsigned char ucSize); 122 123 //***************************************************************************** 124 // 125 // Mark the end of the C bindings section for C++ compilers. 126 // 127 //***************************************************************************** 128 #ifdef __cplusplus 129 } 130 #endif 131 132 #endif //__CAMERA_H__ 133