mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
Merge branch 'refactor/esp_hal_ppa' into 'master'
refactor(ppa): split PPA HAL into a separate component Closes IDF-14097 See merge request espressif/esp-idf!44203
This commit is contained in:
@@ -18,5 +18,6 @@ endif()
|
||||
|
||||
idf_component_register(SRCS ${srcs}
|
||||
INCLUDE_DIRS ${public_include}
|
||||
REQUIRES esp_hal_ppa
|
||||
PRIV_REQUIRES "${priv_requires}"
|
||||
)
|
||||
|
||||
@@ -5,3 +5,4 @@ components/esp_driver_ppa/test_apps:
|
||||
- if: SOC_PPA_SUPPORTED != 1
|
||||
depends_components:
|
||||
- esp_driver_ppa
|
||||
- esp_hal_ppa
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
|
||||
set(srcs)
|
||||
set(includes "include")
|
||||
|
||||
# Add target-specific include directory if it exists
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include")
|
||||
list(APPEND includes "${target}/include")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_PPA_SUPPORTED)
|
||||
list(APPEND srcs "ppa_hal.c")
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS ${srcs}
|
||||
INCLUDE_DIRS ${includes}
|
||||
REQUIRES soc hal)
|
||||
@@ -0,0 +1,33 @@
|
||||
# ESP Hardware Abstraction Layer for PPA Peripheral
|
||||
|
||||
> [!NOTE]
|
||||
> This component is currently in beta. Its API, behavior, and compatibility may change at any time and without notice; backward compatibility is not guaranteed. Use caution when integrating into production systems.
|
||||
|
||||
## Overview
|
||||
|
||||
The `esp_hal_ppa` component provides a **Hardware Abstraction Layer** for the PPA (Pixel Processing Accelerator) peripheral across ESP-IDF supported targets that implement it.
|
||||
|
||||
## Architecture
|
||||
|
||||
The PPA HAL is structured in two main sub-layers:
|
||||
|
||||
1. **HAL Layer (Upper)**: Defines the operational steps and data structures required to control the PPA peripheral (e.g., initialization, task submission, engine control, and synchronization).
|
||||
2. **Low-Level Layer (Bottom)**: Serves as a translation layer between the HAL and the register files defined in the `soc` component, handling target-specific register configurations.
|
||||
|
||||
## Features
|
||||
|
||||
- Engine initialization and reset helpers
|
||||
- Task/command configuration helpers (depending on target capabilities)
|
||||
- Interrupt and status helpers
|
||||
- Clock and power-management hooks (on supported chips)
|
||||
|
||||
## Usage
|
||||
|
||||
The HAL functions primarily serve ESP-IDF peripheral drivers such as `esp_driver_ppa`.
|
||||
|
||||
Advanced developers can use these interfaces directly when implementing custom drivers, with the understanding that API stability is not guaranteed.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- `soc`: Provides chip-specific register definitions
|
||||
- `hal`: Core hardware abstraction utilities and macros
|
||||
+14
-14
@@ -16,10 +16,6 @@
|
||||
#include "hal/misc.h"
|
||||
#include "hal/config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PPA_LL_GET_HW &PPA
|
||||
|
||||
#define PPA_LL_BLEND0_CLUT_MEM_ADDR_OFFSET 0x400
|
||||
@@ -28,6 +24,10 @@ extern "C" {
|
||||
#define PPA_LL_SRM_SCALING_INT_MAX (PPA_SR_SCAL_X_INT_V + 1)
|
||||
#define PPA_LL_SRM_SCALING_FRAG_MAX (PPA_SR_SCAL_X_FRAG_V + 1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enumeration of PPA SRM macro block size options
|
||||
*/
|
||||
@@ -273,7 +273,7 @@ static inline bool ppa_ll_srm_is_color_mode_supported(ppa_srm_color_mode_t color
|
||||
static inline void ppa_ll_srm_set_rx_color_mode(ppa_dev_t *dev, ppa_srm_color_mode_t color_mode)
|
||||
{
|
||||
uint32_t val = 0;
|
||||
bool is_yuv422 __attribute__ ((unused)) = false;
|
||||
bool is_yuv422 __attribute__((unused)) = false;
|
||||
switch (color_mode) {
|
||||
case PPA_SRM_COLOR_MODE_ARGB8888:
|
||||
val = 0;
|
||||
@@ -712,8 +712,8 @@ static inline bool ppa_ll_blend_is_color_mode_supported(ppa_blend_color_mode_t c
|
||||
case PPA_BLEND_COLOR_MODE_RGB565:
|
||||
case PPA_BLEND_COLOR_MODE_A8:
|
||||
case PPA_BLEND_COLOR_MODE_A4:
|
||||
// case PPA_BLEND_COLOR_MODE_L8:
|
||||
// case PPA_BLEND_COLOR_MODE_L4:
|
||||
// case PPA_BLEND_COLOR_MODE_L8:
|
||||
// case PPA_BLEND_COLOR_MODE_L4:
|
||||
#if HAL_CONFIG(CHIP_SUPPORT_MIN_REV) >= 300
|
||||
case PPA_BLEND_COLOR_MODE_YUV420:
|
||||
case PPA_BLEND_COLOR_MODE_YUV422_UYVY:
|
||||
@@ -737,7 +737,7 @@ static inline bool ppa_ll_blend_is_color_mode_supported(ppa_blend_color_mode_t c
|
||||
static inline void ppa_ll_blend_set_rx_bg_color_mode(ppa_dev_t *dev, ppa_blend_color_mode_t color_mode)
|
||||
{
|
||||
uint32_t val = 0;
|
||||
bool is_yuv422 __attribute__ ((unused)) = false;
|
||||
bool is_yuv422 __attribute__((unused)) = false;
|
||||
switch (color_mode) {
|
||||
case PPA_BLEND_COLOR_MODE_ARGB8888:
|
||||
val = 0;
|
||||
@@ -748,12 +748,12 @@ static inline void ppa_ll_blend_set_rx_bg_color_mode(ppa_dev_t *dev, ppa_blend_c
|
||||
case PPA_BLEND_COLOR_MODE_RGB565:
|
||||
val = 2;
|
||||
break;
|
||||
// case PPA_BLEND_COLOR_MODE_L8:
|
||||
// val = 4;
|
||||
// break;
|
||||
// case PPA_BLEND_COLOR_MODE_L4:
|
||||
// val = 5;
|
||||
// break;
|
||||
// case PPA_BLEND_COLOR_MODE_L8:
|
||||
// val = 4;
|
||||
// break;
|
||||
// case PPA_BLEND_COLOR_MODE_L4:
|
||||
// val = 5;
|
||||
// break;
|
||||
#if HAL_CONFIG(CHIP_SUPPORT_MIN_REV) >= 300
|
||||
case PPA_BLEND_COLOR_MODE_YUV420:
|
||||
val = 8;
|
||||
@@ -12,6 +12,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
#if SOC_HAS(PPA)
|
||||
#include "hal/ppa_ll.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include "hal/ppa_hal.h"
|
||||
#include "hal/ppa_ll.h"
|
||||
|
||||
void ppa_hal_init(ppa_hal_context_t *hal)
|
||||
{
|
||||
@@ -140,10 +140,6 @@ elseif(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "vbat_hal.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_PPA_SUPPORTED)
|
||||
list(APPEND srcs "ppa_hal.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED)
|
||||
list(APPEND srcs "sdio_slave_hal.c")
|
||||
endif()
|
||||
|
||||
@@ -29,6 +29,7 @@ INPUT += \
|
||||
$(PROJECT_PATH)/components/esp_driver_jpeg/include/driver/jpeg_encode.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_jpeg/include/driver/jpeg_types.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_ppa/include/driver/ppa.h \
|
||||
$(PROJECT_PATH)/components/esp_hal_ppa/include/hal/ppa_types.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_touch_sens/hw_ver3/include/driver/touch_version_types.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_touch_sens/include/driver/touch_sens.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_touch_sens/include/driver/touch_sens_types.h \
|
||||
@@ -36,7 +37,6 @@ INPUT += \
|
||||
$(PROJECT_PATH)/components/esp_hal_cam/include/hal/isp_types.h \
|
||||
$(PROJECT_PATH)/components/esp_lcd/dsi/include/esp_lcd_mipi_dsi.h \
|
||||
$(PROJECT_PATH)/components/esp_lcd/rgb/include/esp_lcd_panel_rgb.h \
|
||||
$(PROJECT_PATH)/components/hal/include/hal/ppa_types.h \
|
||||
$(PROJECT_PATH)/components/sdmmc/include/sd_pwr_ctrl.h \
|
||||
$(PROJECT_PATH)/components/sdmmc/include/sd_pwr_ctrl_by_on_chip_ldo.h \
|
||||
$(PROJECT_PATH)/components/esp_hal_dma/esp32p4/include/hal/bitscrambler_peri_select.h \
|
||||
|
||||
@@ -380,6 +380,7 @@ examples/peripherals/ppa/ppa_dsi:
|
||||
- if: SOC_PPA_SUPPORTED != 1 or SOC_MIPI_DSI_SUPPORTED != 1
|
||||
depends_components:
|
||||
- esp_driver_ppa
|
||||
- esp_hal_ppa
|
||||
- esp_lcd
|
||||
|
||||
examples/peripherals/rmt:
|
||||
|
||||
Reference in New Issue
Block a user