Merge branch 'feat/esp_hal_isp_v6.0' into 'release/v6.0'

isp: move isp hal to cam hal (v6.0)

See merge request espressif/esp-idf!44134
This commit is contained in:
morris
2025-12-17 18:52:30 +08:00
32 changed files with 186 additions and 167 deletions
@@ -16,26 +16,28 @@
extern "C" {
#endif
#define ESP_CAM_CTLR_ISP_DVP_DATA_SIG_NUM_MAX 16
/**
* @brief ESP CAM ISP DVP controller configurations.
*/
typedef struct {
cam_ctlr_data_width_t data_width; /*!< Number of data lines. */
int data_io[ISP_DVP_DATA_SIG_NUM]; /*!< ISP DVP data-in IO numbers. */
int pclk_io; /*!< ISP DVP pclk IO number. */
int hsync_io; /*!< ISP DVP hsync IO number. */
int vsync_io; /*!< ISP DVP vsync IO number. */
int de_io; /*!< ISP DVP de IO number. */
cam_ctlr_data_width_t data_width; /*!< Number of data lines. */
int data_io[ESP_CAM_CTLR_ISP_DVP_DATA_SIG_NUM_MAX]; /*!< ISP DVP data-in IO numbers. */
int pclk_io; /*!< ISP DVP pclk IO number. */
int hsync_io; /*!< ISP DVP hsync IO number. */
int vsync_io; /*!< ISP DVP vsync IO number. */
int de_io; /*!< ISP DVP de IO number. */
struct {
uint32_t pclk_invert: 1; /*!< Set to 1 to invert the pclk signal. */
uint32_t hsync_invert: 1; /*!< Set to 1 to invert the hsync signal (i.e., active low). */
uint32_t vsync_invert: 1; /*!< Set to 1 to invert the vsync signal (i.e., active high). */
uint32_t de_invert: 1; /*!< Set to 1 to invert the de signal (i.e., active low). */
} io_flags; /*!< ISP DVP IO flags. */
int queue_items; /*!< Queue items. */
uint32_t pclk_invert: 1; /*!< Set to 1 to invert the pclk signal. */
uint32_t hsync_invert: 1; /*!< Set to 1 to invert the hsync signal (i.e., active low). */
uint32_t vsync_invert: 1; /*!< Set to 1 to invert the vsync signal (i.e., active high). */
uint32_t de_invert: 1; /*!< Set to 1 to invert the de signal (i.e., active low). */
} io_flags; /*!< ISP DVP IO flags. */
int queue_items; /*!< Queue items. */
struct {
uint32_t byte_swap_en : 1; /*!< Set to 1 to enable byte swap. */
uint32_t bk_buffer_dis : 1; /*!< Set to 1 to disable backup buffer. */
uint32_t byte_swap_en : 1; /*!< Set to 1 to enable byte swap. */
uint32_t bk_buffer_dis : 1; /*!< Set to 1 to disable backup buffer. */
};
} esp_cam_ctlr_isp_dvp_cfg_t;
@@ -66,7 +66,7 @@ typedef struct isp_dvp_controller_t {
typedef struct isp_dvp_ctx_t {
_lock_t mutex;
isp_dvp_controller_t *dvp_ctlr[SOC_ISP_DVP_CTLR_NUMS];
isp_dvp_controller_t *dvp_ctlr[ISP_LL_DVP_CTLR_NUMS];
} isp_dvp_ctx_t;
static const char *TAG = "ISP_DVP";
@@ -572,7 +572,7 @@ static esp_err_t s_isp_claim_dvp_controller(isp_proc_handle_t isp_proc, isp_dvp_
_lock_acquire(&s_ctx.mutex);
bool found = false;
for (int i = 0; i < SOC_ISP_DVP_CTLR_NUMS; i++) {
for (int i = 0; i < ISP_LL_DVP_CTLR_NUMS; i++) {
found = !s_ctx.dvp_ctlr[i];
if (found) {
s_ctx.dvp_ctlr[i] = dvp_ctlr;
@@ -9,6 +9,7 @@
#include "esp_cam_ctlr_isp_dvp.h"
#include "esp_cam_ctlr.h"
#include "driver/isp.h"
#include "hal/isp_ll.h"
TEST_CASE("ISP DVP controller exhausted allocation", "[isp]")
{
@@ -35,14 +36,14 @@ TEST_CASE("ISP DVP controller exhausted allocation", "[isp]")
.io_flags.vsync_invert = 1,
.queue_items = 10,
};
esp_cam_ctlr_handle_t dvp_ctrlr[SOC_ISP_DVP_CTLR_NUMS + 1] = {};
for (int i = 0; i < SOC_ISP_DVP_CTLR_NUMS; i++) {
esp_cam_ctlr_handle_t dvp_ctrlr[ISP_LL_DVP_CTLR_NUMS + 1] = {};
for (int i = 0; i < ISP_LL_DVP_CTLR_NUMS; i++) {
TEST_ESP_OK(esp_cam_new_isp_dvp_ctlr(isp_proc, &dvp_ctlr_config, &dvp_ctrlr[i]));
}
TEST_ASSERT(esp_cam_new_isp_dvp_ctlr(isp_proc, &dvp_ctlr_config, &dvp_ctrlr[SOC_ISP_DVP_CTLR_NUMS]) == ESP_ERR_NOT_FOUND);
TEST_ASSERT(esp_cam_new_isp_dvp_ctlr(isp_proc, &dvp_ctlr_config, &dvp_ctrlr[ISP_LL_DVP_CTLR_NUMS]) == ESP_ERR_NOT_FOUND);
for (int i = 0; i < SOC_ISP_DVP_CTLR_NUMS; i++) {
for (int i = 0; i < ISP_LL_DVP_CTLR_NUMS; i++) {
TEST_ESP_OK(esp_cam_ctlr_del(dvp_ctrlr[i]));
}
TEST_ESP_OK(esp_isp_del_processor(isp_proc));