1 /*
2  * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 #include <stdint.h>
10 #include <stdbool.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /**
17  * @brief LCD peripheral SOC layer handle
18  */
19 typedef struct lcd_cam_dev_t *lcd_soc_handle_t;
20 
21 /**
22  * @brief LCD HAL layer context
23  */
24 typedef struct {
25     lcd_soc_handle_t dev; // SOC layer handle
26 } lcd_hal_context_t;
27 
28 /**
29  * @brief LCD HAL layer initialization
30  *
31  * @param hal LCD HAL layer context
32  * @param id LCD peripheral ID
33  */
34 void lcd_hal_init(lcd_hal_context_t *hal, int id);
35 
36 #define LCD_HAL_PCLK_FLAG_ALLOW_EQUAL_SYSCLK (1 << 0)
37 
38 /**
39  * @brief LCD PCLK clock calculation
40  * @note Currently this function is only used by RGB LCD driver, I80 driver still uses a fixed clock division
41  *
42  * @param hal LCD HAL layer context
43  * @param src_freq_hz LCD source clock frequency in Hz
44  * @param expect_pclk_freq_hz Expected LCD PCLK frequency in Hz
45  * @param lcd_clk_flags Extra flags to control LCD PCLK clock calculation, supported flags are prefixed with LCD_HAL_PCLK_FLAG_
46  * @return Actual LCD PCLK frequency in Hz
47  */
48 uint32_t lcd_hal_cal_pclk_freq(lcd_hal_context_t *hal, uint32_t src_freq_hz, uint32_t expect_pclk_freq_hz, int lcd_clk_flags);
49 
50 #ifdef __cplusplus
51 }
52 #endif
53