1 /* 2 * Copyright 2019 NXP 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #ifndef _FSL_DC_FB_H_ 9 #define _FSL_DC_FB_H_ 10 11 #include "fsl_video_common.h" 12 13 /*! 14 * @addtogroup dc_fb 15 * @{ 16 */ 17 18 /******************************************************************************* 19 * Definitions 20 ******************************************************************************/ 21 /*! @brief frame buffer information. */ 22 typedef struct _dc_fb_info 23 { 24 uint16_t startX; /*!< The start position in the panel. */ 25 uint16_t startY; /*!< The start position in the panel. */ 26 uint16_t width; /*!< How many pixels in one line of the frame buffer.*/ 27 uint16_t height; /*!< How many lines in one frame buffer. */ 28 uint16_t strideBytes; /*!< Stride of the frame buffer */ 29 video_pixel_format_t pixelFormat; /*!< Pixel format of the frame buffer */ 30 } dc_fb_info_t; 31 32 /*! @brief Display controller frame callback. */ 33 typedef void (*dc_fb_callback_t)(void *param, void *inactiveBuffer); 34 35 /*! @brief Display controller. */ 36 typedef struct _dc_fb dc_fb_t; 37 38 /*! @brief Display controller operations. */ 39 typedef struct _dc_fb_ops 40 { 41 status_t (*init)(const dc_fb_t *dc); 42 status_t (*deinit)(const dc_fb_t *dc); 43 status_t (*enableLayer)(const dc_fb_t *dc, uint8_t layer); 44 status_t (*disableLayer)(const dc_fb_t *dc, uint8_t layer); 45 status_t (*setLayerConfig)(const dc_fb_t *dc, uint8_t layer, dc_fb_info_t *fbInfo); 46 status_t (*getLayerDefaultConfig)(const dc_fb_t *dc, uint8_t layer, dc_fb_info_t *fbInfo); 47 status_t (*setFrameBuffer)(const dc_fb_t *dc, uint8_t layer, void *frameBuffer); 48 uint32_t (*getProperty)(const dc_fb_t *dc); 49 void (*setCallback)(const dc_fb_t *dc, uint8_t layer, dc_fb_callback_t callback, void *param); 50 } dc_fb_ops_t; 51 52 /*! @brief Display controller property. */ 53 enum _dc_fb_property 54 { 55 kDC_FB_ReserveFrameBuffer = (1 << 0), /*< One frame buffer is always used as the DC active buffer. */ 56 kDC_FB_TwoDimensionMemoryWrite = (1 << 1), /*< Support writing memory to device in two dimension way. */ 57 }; 58 59 /*! @brief Display controller driver handle. */ 60 struct _dc_fb 61 { 62 const dc_fb_ops_t *ops; /* Display controller operations. */ 63 void *prvData; /* Private data for the display controller. */ 64 const void *config; /* Configuration for the display controller. */ 65 }; 66 67 /******************************************************************************* 68 * API 69 ******************************************************************************/ 70 71 #if defined(__cplusplus) 72 extern "C" { 73 #endif 74 75 #if defined(__cplusplus) 76 } 77 #endif 78 79 /*! @} */ 80 81 #endif /* _FSL_DC_FB_H_ */ 82