mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 02:20:57 +02:00
Merge branch 'bugfix/some_lcd_improvement' into 'master'
fix(lcd): allow i80 lcd to skip the setting of clk_src as default choice See merge request espressif/esp-idf!41928
This commit is contained in:
@@ -612,7 +612,7 @@ esp_err_t esp_lcd_dpi_panel_register_event_callbacks(esp_lcd_panel_handle_t pane
|
|||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE(panel && cbs, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
ESP_RETURN_ON_FALSE(panel && cbs, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||||
esp_lcd_dpi_panel_t *dpi_panel = __containerof(panel, esp_lcd_dpi_panel_t, base);
|
esp_lcd_dpi_panel_t *dpi_panel = __containerof(panel, esp_lcd_dpi_panel_t, base);
|
||||||
#if CONFIG_LCD_DSI_ISR_HANDLER_IN_IRAM
|
#if CONFIG_LCD_DSI_ISR_CACHE_SAFE
|
||||||
if (cbs->on_color_trans_done) {
|
if (cbs->on_color_trans_done) {
|
||||||
ESP_RETURN_ON_FALSE(esp_ptr_in_iram(cbs->on_color_trans_done), ESP_ERR_INVALID_ARG, TAG, "on_color_trans_done callback not in IRAM");
|
ESP_RETURN_ON_FALSE(esp_ptr_in_iram(cbs->on_color_trans_done), ESP_ERR_INVALID_ARG, TAG, "on_color_trans_done callback not in IRAM");
|
||||||
}
|
}
|
||||||
|
@@ -9,45 +9,12 @@
|
|||||||
// In fact, we're simulating the Intel 8080 bus with I2S peripheral, in a special parallel mode.
|
// In fact, we're simulating the Intel 8080 bus with I2S peripheral, in a special parallel mode.
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include "i80_io_priv.h"
|
||||||
#include <string.h>
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/queue.h>
|
|
||||||
#include "sdkconfig.h"
|
|
||||||
#if CONFIG_LCD_ENABLE_DEBUG_LOG
|
|
||||||
// The local log level must be defined before including esp_log.h
|
|
||||||
// Set the maximum log level for this source file
|
|
||||||
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
|
|
||||||
#endif
|
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/task.h"
|
|
||||||
#include "freertos/queue.h"
|
|
||||||
#include "esp_attr.h"
|
|
||||||
#include "esp_check.h"
|
|
||||||
#include "esp_intr_alloc.h"
|
|
||||||
#include "esp_heap_caps.h"
|
|
||||||
#include "esp_pm.h"
|
|
||||||
#include "esp_lcd_panel_io_interface.h"
|
|
||||||
#include "esp_lcd_panel_io.h"
|
|
||||||
#include "esp_lcd_common.h"
|
|
||||||
#include "esp_rom_gpio.h"
|
|
||||||
#include "soc/soc_caps.h"
|
|
||||||
#include "hal/gpio_hal.h"
|
|
||||||
#include "driver/gpio.h"
|
|
||||||
#include "esp_clk_tree.h"
|
|
||||||
#include "esp_private/periph_ctrl.h"
|
|
||||||
#include "esp_private/i2s_platform.h"
|
#include "esp_private/i2s_platform.h"
|
||||||
#include "esp_private/gdma_link.h"
|
|
||||||
#include "esp_private/esp_dma_utils.h"
|
|
||||||
#include "esp_private/gpio.h"
|
|
||||||
#include "soc/lcd_periph.h"
|
|
||||||
#include "hal/i2s_hal.h"
|
#include "hal/i2s_hal.h"
|
||||||
#include "hal/i2s_ll.h"
|
#include "hal/i2s_ll.h"
|
||||||
#include "hal/i2s_types.h"
|
#include "hal/i2s_types.h"
|
||||||
|
|
||||||
static const char *TAG = "lcd_panel.io.i80";
|
|
||||||
|
|
||||||
typedef struct esp_lcd_i80_bus_t esp_lcd_i80_bus_t;
|
typedef struct esp_lcd_i80_bus_t esp_lcd_i80_bus_t;
|
||||||
typedef struct lcd_panel_io_i80_t lcd_panel_io_i80_t;
|
typedef struct lcd_panel_io_i80_t lcd_panel_io_i80_t;
|
||||||
typedef struct lcd_i80_trans_descriptor_t lcd_i80_trans_descriptor_t;
|
typedef struct lcd_i80_trans_descriptor_t lcd_i80_trans_descriptor_t;
|
||||||
@@ -126,9 +93,6 @@ struct lcd_panel_io_i80_t {
|
|||||||
|
|
||||||
esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lcd_i80_bus_handle_t *ret_bus)
|
esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lcd_i80_bus_handle_t *ret_bus)
|
||||||
{
|
{
|
||||||
#if CONFIG_LCD_ENABLE_DEBUG_LOG
|
|
||||||
esp_log_level_set(TAG, ESP_LOG_DEBUG);
|
|
||||||
#endif
|
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
esp_lcd_i80_bus_t *bus = NULL;
|
esp_lcd_i80_bus_t *bus = NULL;
|
||||||
ESP_GOTO_ON_FALSE(bus_config && ret_bus, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");
|
ESP_GOTO_ON_FALSE(bus_config && ret_bus, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");
|
||||||
@@ -178,7 +142,12 @@ esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lc
|
|||||||
// initialize HAL layer
|
// initialize HAL layer
|
||||||
i2s_hal_init(&bus->hal, bus->bus_id);
|
i2s_hal_init(&bus->hal, bus->bus_id);
|
||||||
// set peripheral clock resolution
|
// set peripheral clock resolution
|
||||||
ret = i2s_lcd_select_periph_clock(bus, bus_config->clk_src);
|
lcd_clock_source_t clk_src = bus_config->clk_src;
|
||||||
|
// if user doesn't specify a clock source, use the default one
|
||||||
|
if (clk_src == 0) {
|
||||||
|
clk_src = LCD_CLK_SRC_DEFAULT;
|
||||||
|
}
|
||||||
|
ret = i2s_lcd_select_periph_clock(bus, clk_src);
|
||||||
ESP_GOTO_ON_ERROR(ret, err, TAG, "select periph clock failed");
|
ESP_GOTO_ON_ERROR(ret, err, TAG, "select periph clock failed");
|
||||||
// reset peripheral, DMA channel and FIFO
|
// reset peripheral, DMA channel and FIFO
|
||||||
i2s_ll_tx_reset(bus->hal.dev);
|
i2s_ll_tx_reset(bus->hal.dev);
|
||||||
@@ -855,3 +824,11 @@ static IRAM_ATTR void i2s_lcd_default_isr_handler(void *args)
|
|||||||
portYIELD_FROM_ISR();
|
portYIELD_FROM_ISR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_LCD_ENABLE_DEBUG_LOG
|
||||||
|
__attribute__((constructor))
|
||||||
|
static void i2s_lcd_override_default_log_level(void)
|
||||||
|
{
|
||||||
|
esp_log_level_set(TAG, ESP_LOG_VERBOSE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -4,41 +4,8 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include "i80_io_priv.h"
|
||||||
#include <string.h>
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/queue.h>
|
|
||||||
#include "sdkconfig.h"
|
|
||||||
#if CONFIG_LCD_ENABLE_DEBUG_LOG
|
|
||||||
// The local log level must be defined before including esp_log.h
|
|
||||||
// Set the maximum log level for this source file
|
|
||||||
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
|
|
||||||
#endif
|
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/task.h"
|
|
||||||
#include "freertos/queue.h"
|
|
||||||
#include "esp_attr.h"
|
|
||||||
#include "esp_check.h"
|
|
||||||
#include "esp_pm.h"
|
|
||||||
#include "esp_lcd_panel_io_interface.h"
|
|
||||||
#include "esp_lcd_panel_io.h"
|
|
||||||
#include "esp_rom_gpio.h"
|
|
||||||
#include "soc/soc_caps.h"
|
|
||||||
#include "esp_clk_tree.h"
|
|
||||||
#include "esp_memory_utils.h"
|
|
||||||
#include "esp_cache.h"
|
|
||||||
#include "driver/gpio.h"
|
|
||||||
#include "esp_private/esp_clk_tree_common.h"
|
|
||||||
#include "esp_private/gpio.h"
|
|
||||||
#include "esp_private/gdma.h"
|
#include "esp_private/gdma.h"
|
||||||
#include "esp_private/gdma_link.h"
|
|
||||||
#include "esp_private/esp_dma_utils.h"
|
|
||||||
#include "esp_private/periph_ctrl.h"
|
|
||||||
#include "esp_lcd_common.h"
|
|
||||||
#include "soc/lcd_periph.h"
|
|
||||||
#include "soc/io_mux_reg.h"
|
|
||||||
#include "soc/gpio_sig_map.h"
|
|
||||||
#include "hal/lcd_ll.h"
|
#include "hal/lcd_ll.h"
|
||||||
#include "hal/lcd_hal.h"
|
#include "hal/lcd_hal.h"
|
||||||
#include "hal/cache_ll.h"
|
#include "hal/cache_ll.h"
|
||||||
@@ -60,8 +27,6 @@
|
|||||||
#define LCD_CACHE_ADDR_TO_NON_CACHE_ADDR(addr) (addr)
|
#define LCD_CACHE_ADDR_TO_NON_CACHE_ADDR(addr) (addr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char *TAG = "lcd_panel.io.i80";
|
|
||||||
|
|
||||||
typedef struct esp_lcd_i80_bus_t esp_lcd_i80_bus_t;
|
typedef struct esp_lcd_i80_bus_t esp_lcd_i80_bus_t;
|
||||||
typedef struct lcd_panel_io_i80_t lcd_panel_io_i80_t;
|
typedef struct lcd_panel_io_i80_t lcd_panel_io_i80_t;
|
||||||
typedef struct lcd_i80_trans_descriptor_t lcd_i80_trans_descriptor_t;
|
typedef struct lcd_i80_trans_descriptor_t lcd_i80_trans_descriptor_t;
|
||||||
@@ -146,9 +111,6 @@ struct lcd_panel_io_i80_t {
|
|||||||
|
|
||||||
esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lcd_i80_bus_handle_t *ret_bus)
|
esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lcd_i80_bus_handle_t *ret_bus)
|
||||||
{
|
{
|
||||||
#if CONFIG_LCD_ENABLE_DEBUG_LOG
|
|
||||||
esp_log_level_set(TAG, ESP_LOG_DEBUG);
|
|
||||||
#endif
|
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
esp_lcd_i80_bus_t *bus = NULL;
|
esp_lcd_i80_bus_t *bus = NULL;
|
||||||
ESP_RETURN_ON_FALSE(bus_config && ret_bus, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
ESP_RETURN_ON_FALSE(bus_config && ret_bus, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||||
@@ -187,8 +149,13 @@ esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lc
|
|||||||
lcd_ll_enable_clock(bus->hal.dev, true);
|
lcd_ll_enable_clock(bus->hal.dev, true);
|
||||||
}
|
}
|
||||||
// set peripheral clock resolution
|
// set peripheral clock resolution
|
||||||
ret = lcd_i80_select_periph_clock(bus, bus_config->clk_src);
|
lcd_clock_source_t clk_src = bus_config->clk_src;
|
||||||
ESP_GOTO_ON_ERROR(ret, err, TAG, "select periph clock %d failed", bus_config->clk_src);
|
// if user doesn't specify a clock source, use the default one
|
||||||
|
if (clk_src == 0) {
|
||||||
|
clk_src = LCD_CLK_SRC_DEFAULT;
|
||||||
|
}
|
||||||
|
ret = lcd_i80_select_periph_clock(bus, clk_src);
|
||||||
|
ESP_GOTO_ON_ERROR(ret, err, TAG, "select periph clock %d failed", clk_src);
|
||||||
// reset peripheral and FIFO after we select a correct clock source
|
// reset peripheral and FIFO after we select a correct clock source
|
||||||
lcd_ll_reset(bus->hal.dev);
|
lcd_ll_reset(bus->hal.dev);
|
||||||
lcd_ll_fifo_reset(bus->hal.dev);
|
lcd_ll_fifo_reset(bus->hal.dev);
|
||||||
@@ -830,3 +797,11 @@ IRAM_ATTR static void i80_lcd_default_isr_handler(void *args)
|
|||||||
portYIELD_FROM_ISR();
|
portYIELD_FROM_ISR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_LCD_ENABLE_DEBUG_LOG
|
||||||
|
__attribute__((constructor))
|
||||||
|
static void i80_lcd_override_default_log_level(void)
|
||||||
|
{
|
||||||
|
esp_log_level_set(TAG, ESP_LOG_VERBOSE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
55
components/esp_lcd/i80/i80_io_priv.h
Normal file
55
components/esp_lcd/i80/i80_io_priv.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/queue.h>
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
#if CONFIG_LCD_ENABLE_DEBUG_LOG
|
||||||
|
// The local log level must be defined before including esp_log.h
|
||||||
|
// Set the maximum log level for gptimer driver
|
||||||
|
#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
|
||||||
|
#endif
|
||||||
|
#include "soc/soc_caps_full.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "freertos/task.h"
|
||||||
|
#include "freertos/queue.h"
|
||||||
|
#include "esp_err.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "esp_check.h"
|
||||||
|
#include "esp_attr.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
#include "esp_intr_alloc.h"
|
||||||
|
#include "esp_clk_tree.h"
|
||||||
|
#include "esp_pm.h"
|
||||||
|
#include "esp_cache.h"
|
||||||
|
#include "esp_memory_utils.h"
|
||||||
|
#include "esp_lcd_panel_io_interface.h"
|
||||||
|
#include "esp_lcd_panel_io.h"
|
||||||
|
#include "esp_lcd_common.h"
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
#include "esp_private/periph_ctrl.h"
|
||||||
|
#include "esp_private/esp_clk_tree_common.h"
|
||||||
|
#include "esp_private/gdma_link.h"
|
||||||
|
#include "esp_private/esp_dma_utils.h"
|
||||||
|
#include "esp_private/gpio.h"
|
||||||
|
#include "soc/lcd_periph.h"
|
||||||
|
#include "soc/io_mux_reg.h"
|
||||||
|
#include "soc/gpio_sig_map.h"
|
||||||
|
|
||||||
|
///!< Logging settings
|
||||||
|
#define TAG "lcd.i80"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Reference in New Issue
Block a user