feat(isp): support isp dma input and add example

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gaoxu
2026-07-28 14:37:45 +08:00
committed by Gao Xu
co-authored by Cursor
parent 4966865e30
commit 2a02c7e55c
17 changed files with 906 additions and 20 deletions
@@ -409,6 +409,8 @@ static inline void dw_gdma_ll_channel_set_dst_master_port(dw_gdma_dev_t *dev, ui
{
if (mem_addr == MIPI_DSI_BRG_MEM_BASE) {
dev->ch[channel].ctl0.dms = DW_GDMA_LL_MASTER_PORT_MIPI_DSI;
} else if (mem_addr == MIPI_CSI_BRG_MEM_BASE) {
dev->ch[channel].ctl0.dms = DW_GDMA_LL_MASTER_PORT_MIPI_CSI;
} else {
dev->ch[channel].ctl0.dms = DW_GDMA_LL_MASTER_PORT_MEMORY;
}
+77 -1
View File
@@ -27,7 +27,7 @@ extern "C" {
#define ISP_LL_GET_HW(num) (((num) == 0) ? (&ISP) : NULL)
#define ISP_LL_HSIZE_MAX 1920
#define ISP_LL_VSIZE_MAX 1080
#define ISP_LL_VSIZE_MAX 1280
/*---------------------------------------------------------------
Clock
@@ -529,6 +529,82 @@ static inline void isp_ll_enable_line_end_packet_exist(isp_dev_t *hw, bool en)
hw->frame_cfg.hsync_end_exist = en;
}
/**
* @brief Set DMA input data type
*
* @param[in] hw Hardware instance address
* @param[in] format color format, see `isp_color_t`
*
* @return true for valid format, false for invalid format
*/
static inline bool isp_ll_dma_set_data_type(isp_dev_t *hw, isp_color_t format)
{
bool valid = false;
switch (format) {
case ISP_COLOR_RAW8:
hw->dma_cntl.dma_data_type = 0x2A;
valid = true;
break;
case ISP_COLOR_RAW10:
hw->dma_cntl.dma_data_type = 0x2B;
valid = true;
break;
case ISP_COLOR_RAW12:
hw->dma_cntl.dma_data_type = 0x2C;
valid = true;
break;
default:
break;
}
return valid;
}
/**
* @brief Set DMA input burst length in units of 64-bit
*
* @param[in] hw Hardware instance address
* @param[in] burst_len Number of 64-bit beats in one DMA burst
*/
static inline void isp_ll_dma_set_burst_len(isp_dev_t *hw, uint32_t burst_len)
{
hw->dma_cntl.dma_burst_len = burst_len;
}
/**
* @brief Set DMA input total frame size in units of 64-bit
*
* @param[in] hw Hardware instance address
* @param[in] num64b Number of 64-bit words in one frame
*/
static inline void isp_ll_dma_set_frame_size(isp_dev_t *hw, uint32_t num64b)
{
hw->dma_raw_data.dma_raw_num_total = num64b;
hw->dma_raw_data.dma_raw_num_total_set = 1;
}
/**
* @brief Apply DMA input registers
*
* @param[in] hw Hardware instance address
*/
static inline void isp_ll_dma_apply_config(isp_dev_t *hw)
{
hw->dma_cntl.dma_update_reg = 1;
while (hw->dma_cntl.dma_update_reg);
}
/**
* @brief Trigger one DMA input frame transfer
*
* @param[in] hw Hardware instance address
*/
static inline void isp_ll_dma_trigger_frame(isp_dev_t *hw)
{
hw->dma_cntl.dma_en = 1;
}
/**
* @brief Get if demosaic is enabled
*