|
| 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_B_H |
| 8 | +#define R_MIPI_DSI_B_H |
| 9 | + |
| 10 | +/*********************************************************************************************************************** |
| 11 | + * Includes |
| 12 | + **********************************************************************************************************************/ |
| 13 | + |
| 14 | +#include "bsp_api.h" |
| 15 | +#include "r_mipi_dsi_api.h" |
| 16 | + |
| 17 | +/* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */ |
| 18 | +FSP_HEADER |
| 19 | + |
| 20 | +/*******************************************************************************************************************//** |
| 21 | + * @addtogroup MIPI_DSI_B |
| 22 | + * @{ |
| 23 | + **********************************************************************************************************************/ |
| 24 | + |
| 25 | +/*********************************************************************************************************************** |
| 26 | + * Macro definitions |
| 27 | + **********************************************************************************************************************/ |
| 28 | + |
| 29 | +/*********************************************************************************************************************** |
| 30 | + * Typedef definitions |
| 31 | + **********************************************************************************************************************/ |
| 32 | +typedef enum e_mipi_dsi_clock_state |
| 33 | +{ |
| 34 | + MIPI_DSI_CLOCK_STATE_IDLE, ///< MIPI DSI Clock is off |
| 35 | + MIPI_DSI_CLOCK_STATE_STARTING, ///< MIPI DSI Clock starting |
| 36 | + MIPI_DSI_CLOCK_STATE_STARTED, ///< MIPI DSI Clock is started |
| 37 | + MIPI_DSI_CLOCK_STATE_STOPPING, ///< MIPI DSI Clock is stopping |
| 38 | +} mipi_dsi_clock_state_t; |
| 39 | + |
| 40 | +/** MIPI DSI interrupt configuration */ |
| 41 | +typedef struct st_mipi_dsi_b_irq_cfg |
| 42 | +{ |
| 43 | + uint8_t ipl; ///< Interrupt priority |
| 44 | + IRQn_Type irq; ///< Interrupt vector number |
| 45 | +} mipi_dsi_b_irq_cfg_t; |
| 46 | + |
| 47 | +/** Extended configuration structure for MIPI DSI. */ |
| 48 | +typedef struct st_mipi_dsi_b_extended_cfg |
| 49 | +{ |
| 50 | + /* Interrupt configuration */ |
| 51 | + mipi_dsi_b_irq_cfg_t dsi_seq0; ///< Sequence 0 interrupt |
| 52 | + mipi_dsi_b_irq_cfg_t dsi_seq1; ///< Sequence 1 interrupt |
| 53 | + mipi_dsi_b_irq_cfg_t dsi_ferr; ///< DSI Fatal Error interrupt |
| 54 | + mipi_dsi_b_irq_cfg_t dsi_ppi; ///< D-PHY PPI interrupt |
| 55 | + mipi_dsi_b_irq_cfg_t dsi_rcv; ///< Receive interrupt |
| 56 | + mipi_dsi_b_irq_cfg_t dsi_vin1; ///< Video Input Operation interrupt |
| 57 | + |
| 58 | + uint32_t dsi_rxie; ///< Receive interrupt enable configuration |
| 59 | + uint32_t dsi_ferrie; ///< Fatal error interrupt enable configuration |
| 60 | + uint32_t dsi_plie; ///< Physical lane interrupt enable configuration |
| 61 | + uint32_t dsi_vmie; ///< Video mode interrupt enable configuration |
| 62 | + uint32_t dsi_sqch0ie; ///< Sequence Channel 0 interrupt enable configuration |
| 63 | + uint32_t dsi_sqch1ie; ///< Sequence Channel 1 interrupt enable configuration |
| 64 | +} mipi_dsi_b_extended_cfg_t; |
| 65 | + |
| 66 | +/** MIPI DSI instance control block. */ |
| 67 | +typedef struct st_mipi_dsi_b_instance_ctrl |
| 68 | +{ |
| 69 | + uint32_t open; ///< Interface is open |
| 70 | + bool data_ulps_active; ///< Data lane ULPS status |
| 71 | + bool clock_ulps_active; ///< Data lane ULPS status |
| 72 | + bool video_started; ///< If video started or not |
| 73 | + mipi_dsi_clock_state_t clock_state; ///< Clock state |
| 74 | + mipi_dsi_lane_t ulps_status; ///< Ultra-low Power State active status |
| 75 | + mipi_dsi_cfg_t const * p_cfg; ///< Pointer to configuration structure used to open the interface |
| 76 | + void (* p_callback)(mipi_dsi_callback_args_t *); ///< Pointer to callback that is called when an adc_event_t occurs. |
| 77 | + void const * p_context; ///< Pointer to context to be passed into callback function |
| 78 | + 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. |
| 79 | +} mipi_dsi_b_instance_ctrl_t; |
| 80 | + |
| 81 | +/********************************************************************************************************************** |
| 82 | + * Exported global variables |
| 83 | + **********************************************************************************************************************/ |
| 84 | + |
| 85 | +/** @cond INC_HEADER_DEFS_SEC */ |
| 86 | +/** Filled in Interface API structure for this Instance. */ |
| 87 | +extern const mipi_dsi_api_t g_mipi_dsi; |
| 88 | + |
| 89 | +/** @endcond */ |
| 90 | + |
| 91 | +/*********************************************************************************************************************** |
| 92 | + * Exported global functions (to be accessed by other files) |
| 93 | + **********************************************************************************************************************/ |
| 94 | + |
| 95 | +/*********************************************************************************************************************** |
| 96 | + * Public APIs |
| 97 | + **********************************************************************************************************************/ |
| 98 | +fsp_err_t R_MIPI_DSI_B_Open(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_cfg_t const * const p_cfg); |
| 99 | +fsp_err_t R_MIPI_DSI_B_Close(mipi_dsi_ctrl_t * const p_api_ctrl); |
| 100 | +fsp_err_t R_MIPI_DSI_B_Start(mipi_dsi_ctrl_t * const p_api_ctrl); |
| 101 | +fsp_err_t R_MIPI_DSI_B_UlpsEnter(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_lane_t lane); |
| 102 | +fsp_err_t R_MIPI_DSI_B_UlpsExit(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_lane_t lane); |
| 103 | +fsp_err_t R_MIPI_DSI_B_Stop(mipi_dsi_ctrl_t * const p_api_ctrl); |
| 104 | +fsp_err_t R_MIPI_DSI_B_Command(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_cmd_t * p_cmd); |
| 105 | +fsp_err_t R_MIPI_DSI_B_StatusGet(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_status_t * p_status); |
| 106 | + |
| 107 | +/*******************************************************************************************************************//** |
| 108 | + * @} (end defgroup MIPI_DSI_B) |
| 109 | + **********************************************************************************************************************/ |
| 110 | + |
| 111 | +/* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */ |
| 112 | +FSP_FOOTER |
| 113 | + |
| 114 | +#endif // R_MIPI_DSI_B_H |
0 commit comments