1 /* 2 * Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef R_MIPI_DSI_H 8 #define R_MIPI_DSI_H 9 10 /*********************************************************************************************************************** 11 * Includes 12 **********************************************************************************************************************/ 13 14 #include "bsp_api.h" 15 #include "r_mipi_dsi_cfg.h" 16 #include "r_mipi_dsi_api.h" 17 18 /* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */ 19 FSP_HEADER 20 21 /*******************************************************************************************************************//** 22 * @addtogroup MIPI_DSI 23 * @{ 24 **********************************************************************************************************************/ 25 26 /*********************************************************************************************************************** 27 * Macro definitions 28 **********************************************************************************************************************/ 29 30 /*********************************************************************************************************************** 31 * Typedef definitions 32 **********************************************************************************************************************/ 33 34 /** MIPI DSI interrupt configuration */ 35 typedef struct st_mipi_dsi_irq_cfg 36 { 37 uint8_t ipl; ///< Interrupt priority 38 IRQn_Type irq; ///< Interrupt vector number 39 } mipi_dsi_irq_cfg_t; 40 41 /** Extended configuration structure for MIPI DSI. */ 42 typedef struct st_mipi_dsi_extended_cfg 43 { 44 /* Interrupt configuration */ 45 mipi_dsi_irq_cfg_t dsi_seq0; ///< Sequence 0 interrupt 46 mipi_dsi_irq_cfg_t dsi_seq1; ///< Sequence 1 interrupt 47 mipi_dsi_irq_cfg_t dsi_ferr; ///< DSI Fatal Error interrupt 48 mipi_dsi_irq_cfg_t dsi_ppi; ///< D-PHY PPI interrupt 49 mipi_dsi_irq_cfg_t dsi_rcv; ///< Receive interrupt 50 mipi_dsi_irq_cfg_t dsi_vin1; ///< Video Input Operation interrupt 51 52 uint32_t dsi_rxie; ///< Receive interrupt enable configuration 53 uint32_t dsi_ferrie; ///< Fatal error interrupt enable configuration 54 uint32_t dsi_plie; ///< Physical lane interrupt enable configuration 55 uint32_t dsi_vmie; ///< Video mode interrupt enable configuration 56 uint32_t dsi_sqch0ie; ///< Sequence Channel 0 interrupt enable configuration 57 uint32_t dsi_sqch1ie; ///< Sequence Channel 1 interrupt enable configuration 58 } mipi_dsi_extended_cfg_t; 59 60 /** MIPI DSI instance control block. */ 61 typedef struct st_mipi_dsi_instance_ctrl 62 { 63 uint32_t open; ///< Interface is open 64 bool data_ulps_active; ///< Data lane ULPS status 65 bool clock_ulps_active; ///< Data lane ULPS status 66 mipi_dsi_lane_t ulps_status; ///< Ultra-low Power State active status 67 mipi_dsi_cfg_t const * p_cfg; ///< Pointer to configuration structure used to open the interface 68 void (* p_callback)(mipi_dsi_callback_args_t *); ///< Pointer to callback that is called when an adc_event_t occurs. 69 void const * p_context; ///< Pointer to context to be passed into callback function 70 mipi_dsi_callback_args_t * p_callback_memory; ///< Pointer to non-secure memory that can be used to pass arguments to a callback in non-secure memory. 71 } mipi_dsi_instance_ctrl_t; 72 73 /********************************************************************************************************************** 74 * Exported global variables 75 **********************************************************************************************************************/ 76 77 /** @cond INC_HEADER_DEFS_SEC */ 78 /** Filled in Interface API structure for this Instance. */ 79 extern const mipi_dsi_api_t g_mipi_dsi; 80 81 /** @endcond */ 82 83 /*********************************************************************************************************************** 84 * Exported global functions (to be accessed by other files) 85 **********************************************************************************************************************/ 86 87 /*********************************************************************************************************************** 88 * Public APIs 89 **********************************************************************************************************************/ 90 fsp_err_t R_MIPI_DSI_Open(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_cfg_t const * const p_cfg); 91 fsp_err_t R_MIPI_DSI_Close(mipi_dsi_ctrl_t * const p_api_ctrl); 92 fsp_err_t R_MIPI_DSI_Start(mipi_dsi_ctrl_t * const p_api_ctrl); 93 fsp_err_t R_MIPI_DSI_UlpsEnter(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_lane_t lane); 94 fsp_err_t R_MIPI_DSI_UlpsExit(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_lane_t lane); 95 fsp_err_t R_MIPI_DSI_Stop(mipi_dsi_ctrl_t * const p_api_ctrl); 96 fsp_err_t R_MIPI_DSI_Command(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_cmd_t * p_cmd); 97 fsp_err_t R_MIPI_DSI_StatusGet(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_status_t * p_status); 98 99 /*******************************************************************************************************************//** 100 * @} (end defgroup MIPI_DSI) 101 **********************************************************************************************************************/ 102 103 /* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */ 104 FSP_FOOTER 105 106 #endif // R_MIPI_DSI_H 107