mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
Merge branch 'refactor/isp_af_interrupt_and_callback_v5.3' into 'release/v5.3'
refactor(isp): refactor the interrupt and callback solution (v5.3) See merge request espressif/esp-idf!30565
This commit is contained in:
@@ -537,6 +537,7 @@ static inline void isp_ll_af_set_window_range(isp_dev_t *hw, uint32_t window_id,
|
||||
*
|
||||
* @return Window sum
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline uint32_t isp_ll_af_get_window_sum(isp_dev_t *hw, uint32_t window_id)
|
||||
{
|
||||
switch (window_id) {
|
||||
@@ -560,6 +561,7 @@ static inline uint32_t isp_ll_af_get_window_sum(isp_dev_t *hw, uint32_t window_i
|
||||
*
|
||||
* @return Window lum
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline uint32_t isp_ll_af_get_window_lum(isp_dev_t *hw, uint32_t window_id)
|
||||
{
|
||||
switch (window_id) {
|
||||
@@ -742,6 +744,18 @@ static inline uint32_t isp_ll_get_intr_status(isp_dev_t *hw)
|
||||
return hw->int_st.val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get interrupt status reg address
|
||||
*
|
||||
* @param[in] hw Hardware instance address
|
||||
*
|
||||
* @return Interrupt status reg address
|
||||
*/
|
||||
static inline uint32_t isp_ll_get_intr_status_reg_addr(isp_dev_t *hw)
|
||||
{
|
||||
return (uint32_t)&(hw->int_st);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get interrupt raw
|
||||
*
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -50,14 +50,6 @@ void isp_hal_init(isp_hal_context_t *hal, int isp_id);
|
||||
*/
|
||||
void isp_hal_af_window_config(const isp_hal_context_t *hal, int window_id, const isp_af_window_t *window);
|
||||
|
||||
/**
|
||||
* @brief Get AF oneshot result
|
||||
*
|
||||
* @param[in] hal Context of the HAL layer
|
||||
* @param[out] out_res AF result
|
||||
*/
|
||||
void isp_hal_af_get_oneshot_result(const isp_hal_context_t *hal, isp_af_result_t *out_res);
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
INTR
|
||||
---------------------------------------------------------------*/
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -48,6 +48,12 @@ typedef enum {
|
||||
/*---------------------------------------------------------------
|
||||
AF
|
||||
---------------------------------------------------------------*/
|
||||
#if SOC_ISP_AF_WINDOW_NUMS
|
||||
#define ISP_AF_WINDOW_NUM SOC_ISP_AF_WINDOW_NUMS // The AF window number for sampling
|
||||
#else
|
||||
#define ISP_AF_WINDOW_NUM 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief ISP AF window
|
||||
*/
|
||||
@@ -62,10 +68,8 @@ typedef struct {
|
||||
* @brief ISP AF result
|
||||
*/
|
||||
typedef struct {
|
||||
#if SOC_ISP_SUPPORTED
|
||||
int definition[SOC_ISP_AF_WINDOW_NUMS]; ///< Definition, it refers how clear and sharp an image is
|
||||
int luminance[SOC_ISP_AF_WINDOW_NUMS]; ///< Luminance, it refers how luminant an image is
|
||||
#endif
|
||||
int definition[ISP_AF_WINDOW_NUM]; ///< Definition, it refers how clear and sharp an image is
|
||||
int luminance[ISP_AF_WINDOW_NUM]; ///< Luminance, it refers how luminant an image is
|
||||
} isp_af_result_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -31,22 +31,6 @@ void isp_hal_af_window_config(const isp_hal_context_t *hal, int window_id, const
|
||||
isp_ll_af_set_window_range(hal->hw, window_id, window->top_left_x, window->top_left_y, window->bottom_right_x, window->bottom_right_y);
|
||||
}
|
||||
|
||||
void isp_hal_af_get_oneshot_result(const isp_hal_context_t *hal, isp_af_result_t *out_res)
|
||||
{
|
||||
isp_ll_clear_intr(hal->hw, ISP_LL_EVENT_AF_FDONE);
|
||||
isp_ll_af_manual_update(hal->hw);
|
||||
|
||||
while (!(isp_ll_get_intr_raw(hal->hw) & ISP_LL_EVENT_AF_FDONE)) {
|
||||
;
|
||||
}
|
||||
|
||||
for (int i = 0; i < SOC_ISP_AF_WINDOW_NUMS; i++) {
|
||||
out_res->definition[i] = isp_ll_af_get_window_sum(hal->hw, i);
|
||||
out_res->luminance[i] = isp_ll_af_get_window_lum(hal->hw, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
INTR, put in iram
|
||||
---------------------------------------------------------------*/
|
||||
|
Reference in New Issue
Block a user