1 /*
2  * Copyright  2017 NXP
3  * All rights reserved.
4  *
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef _FSL_CAMERA_H_
10 #define _FSL_CAMERA_H_
11 
12 #include "fsl_video_common.h"
13 
14 /*******************************************************************************
15  * Definitions
16  ******************************************************************************/
17 
18 /*! @brief Camera control flags. */
19 enum _camera_flags
20 {
21     kCAMERA_HrefActiveLow          = 0U,         /*!< HREF is active low. */
22     kCAMERA_HrefActiveHigh         = (1U << 0U), /*!< HREF is active high. */
23     kCAMERA_DataLatchOnFallingEdge = 0U,         /*!< Pixel data latched at falling edge of pixel clock. */
24     kCAMERA_DataLatchOnRisingEdge  = (1U << 1U), /*!< Pixel data latched at rising edge of pixel clock. */
25     kCAMERA_VsyncActiveLow         = 0U,         /*!< VSYNC is active low. */
26     kCAMERA_VsyncActiveHigh        = (1U << 2U), /*!< VSYNC is active high. */
27 };
28 
29 /*! @brief Camera interface type. */
30 typedef enum _camera_interface
31 {
32     kCAMERA_InterfaceGatedClock,    /*!< HSYNC/HREF, VSYNC, and PIXCLK signals are used. */
33     kCAMERA_InterfaceNonGatedClock, /*!< VSYNC, and PIXCLK signals are used. */
34     kCAMERA_InterfaceCCIR656,       /*!< CCIR656 interface. */
35     kCAMERA_InterfaceMIPI,          /*!< MIPI CSI2 interface. */
36 } camera_interface_t;
37 
38 /*! @brief Camera configuration. */
39 typedef struct _camera_config
40 {
41     video_pixel_format_t pixelFormat;    /*!< Pixel format. */
42     uint8_t bytesPerPixel;               /*!< Byte per pixel. */
43     uint32_t resolution;                 /*!< Resolution, see @ref video_resolution_t and @ref FSL_VIDEO_RESOLUTION. */
44     uint16_t frameBufferLinePitch_Bytes; /*!< Frame buffer line pitch in bytes. */
45     camera_interface_t interface;        /*!< Interface type. */
46     uint32_t controlFlags;               /*!< Control flags, OR'ed value of @ref _camera_flags. */
47     uint8_t framePerSec;                 /*!< Frame per second. */
48     uint8_t mipiChannel;                 /*!< MIPI virtual channel. */
49     uint8_t csiLanes;                    /*!< MIPI CSI data lanes number. */
50 } camera_config_t;
51 
52 #endif /* _FSL_CAMERA_H_ */
53