feat(cam): add camera buffer alloc function

This commit is contained in:
gaoxu
2025-07-04 16:58:44 +08:00
parent b9c224215e
commit ee3de247e2
13 changed files with 166 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
#include "esp_heap_caps.h"
#include "esp_cam_ctlr_types.h"
#ifdef __cplusplus
@@ -132,6 +133,23 @@ esp_err_t esp_cam_ctlr_get_frame_buffer(esp_cam_ctlr_handle_t handle, uint32_t f
*/
esp_err_t esp_cam_ctlr_get_frame_buffer_len(esp_cam_ctlr_handle_t handle, size_t *ret_fb_len);
/**
* @brief Allocate camera buffer for ESP CAM controller
*
* @note This function must be called after esp_cam_new_*_ctlr
*
* @param[in] handle ESP CAM controller handle
* @param[in] size Buffer size in bytes
* @param[in] buf_caps Buffer allocation capabilities:
* - MALLOC_CAP_SPIRAM || MALLOC_CAP_DMA: Memory in external SPI RAM
* - MALLOC_CAP_INTERNAL || MALLOC_CAP_DMA: Memory in internal SRAM
*
* @return
* - Buffer pointer on success
* - NULL on failure
*/
void *esp_cam_ctlr_alloc_buffer(esp_cam_ctlr_handle_t handle, size_t size, uint32_t buf_caps);
#ifdef __cplusplus
}
#endif