mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
feat(isp): support isp dma input and add example
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
Gao Xu
co-authored by
Cursor
parent
4966865e30
commit
2a02c7e55c
@@ -32,6 +32,7 @@ typedef struct {
|
||||
uint32_t h_res; ///< Input horizontal resolution, i.e. the number of pixels in a line
|
||||
uint32_t v_res; ///< Input vertical resolution, i.e. the number of lines in a frame
|
||||
color_raw_element_order_t bayer_order; ///< Bayer order
|
||||
uint32_t dma_burst_size; ///< DMA output burst length in units of 64-bit beats. Set to 0 to use default value 16
|
||||
int intr_priority; ///< The interrupt priority, range 0~3, if set to 0, the driver will try to allocate an interrupt with a relative low priority (1,2,3)
|
||||
struct {
|
||||
uint32_t bypass_isp : 1; ///< Bypass ISP pipelines
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include "esp_err.h"
|
||||
#include "driver/isp_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Process one ISP DMA frame: feed the input buffer through the ISP and wait for completion
|
||||
*
|
||||
* @note Input buffer content should be ready before calling this function. If the buffers are in
|
||||
* cacheable memory, the caller should synchronize them around DMA access. Buffer sizes are
|
||||
* derived from the ISP processor resolution and pixel formats. Both buffers must be 8-byte
|
||||
* aligned. This function blocks until both input and output DMA channels finish.
|
||||
*
|
||||
* @param[in] proc Processor handle
|
||||
* @param[in] output_buffer Destination buffer for ISP output (8-byte aligned)
|
||||
* @param[in] input_buffer Source input buffer for RAW frame data (8-byte aligned)
|
||||
* @param[in] timeout_ms Timeout in milliseconds for waiting transfer completion
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK On success
|
||||
* - ESP_ERR_INVALID_ARG Invalid argument
|
||||
* - ESP_ERR_TIMEOUT Wait timeout
|
||||
*/
|
||||
esp_err_t esp_isp_dma_process_frame(isp_proc_handle_t proc, void *output_buffer, const void *input_buffer, uint32_t timeout_ms);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -60,6 +60,8 @@ typedef enum {
|
||||
/*---------------------------------------------------------------
|
||||
Driver Context
|
||||
---------------------------------------------------------------*/
|
||||
typedef struct esp_isp_dma_frame_ctx_t esp_isp_dma_frame_ctx_t;
|
||||
|
||||
typedef struct isp_processor_t {
|
||||
int proc_id;
|
||||
isp_clk_src_t clk_src;
|
||||
@@ -72,10 +74,14 @@ typedef struct isp_processor_t {
|
||||
portMUX_TYPE spinlock;
|
||||
color_space_pixel_format_t in_color_format;
|
||||
color_space_pixel_format_t out_color_format;
|
||||
isp_input_data_source_t input_data_source;
|
||||
uint32_t h_res;
|
||||
uint32_t v_res;
|
||||
color_raw_element_order_t bayer_order;
|
||||
bool bypass_isp;
|
||||
uint32_t dma_in_burst_len; // ISP DMA input burst length (64-bit beats), kept in sync with the input GDMA dst MSIZE
|
||||
uint32_t dma_out_burst_len; // ISP DMA output burst length (64-bit beats)
|
||||
esp_isp_dma_frame_ctx_t *dma_frame_ctx;
|
||||
/* sub module contexts */
|
||||
isp_af_ctlr_t af_ctlr[SOC_ISP_AF_CTLR_NUMS];
|
||||
isp_awb_ctlr_t awb_ctlr;
|
||||
@@ -133,6 +139,45 @@ bool esp_isp_awb_isr(isp_proc_handle_t proc, uint32_t awb_events);
|
||||
bool esp_isp_sharpen_isr(isp_proc_handle_t proc, uint32_t sharp_events);
|
||||
bool esp_isp_hist_isr(isp_proc_handle_t proc, uint32_t hist_events);
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
DMA INPUT
|
||||
---------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Configure the ISP DMA input path (frame size, burst length, data type)
|
||||
*
|
||||
* @note Internal helper invoked while creating a processor whose input source is DWGDMA.
|
||||
*
|
||||
* @param[in] proc Processor handle
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK On success
|
||||
* - ESP_ERR_INVALID_ARG Invalid input color format or frame size
|
||||
*/
|
||||
esp_err_t isp_dma_configure_input(isp_proc_handle_t proc);
|
||||
|
||||
/**
|
||||
* @brief Create the ISP DMA frame context
|
||||
*
|
||||
* @note Internal helper invoked while creating a processor whose input source is DWGDMA.
|
||||
*
|
||||
* @param[in] proc Processor handle
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK On success
|
||||
* - ESP_ERR_INVALID_ARG Invalid processor, burst length, or frame size
|
||||
* - ESP_ERR_INVALID_STATE Processor input source is not DWGDMA or the context already exists
|
||||
* - ESP_ERR_NO_MEM Failed to allocate the context or synchronization objects
|
||||
* - Other errors returned by the underlying DMA driver
|
||||
*/
|
||||
esp_err_t isp_dma_new_frame_ctx(isp_proc_handle_t proc);
|
||||
|
||||
/**
|
||||
* @brief Delete the ISP DMA frame context
|
||||
*
|
||||
* @param[in] proc Processor handle
|
||||
*/
|
||||
void isp_dma_del_frame_ctx(isp_proc_handle_t proc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user