Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion driver/cam_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,10 @@ static esp_err_t cam_dma_config(const camera_config_t *config)
} else {
_caps |= MALLOC_CAP_SPIRAM;
}
size_t fb_align = dcache_line_size();
if (fb_align == 0) {
fb_align = 32;
}
for (int x = 0; x < cam_obj->frame_cnt; x++) {
cam_obj->frames[x].dma = NULL;
cam_obj->frames[x].fb_offset = 0;
Expand All @@ -497,7 +501,7 @@ static esp_err_t cam_dma_config(const camera_config_t *config)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)
// In IDF v4.2 and earlier, memory returned by heap_caps_aligned_alloc must be freed using heap_caps_aligned_free.
// And heap_caps_aligned_free is deprecated on v4.3.
cam_obj->frames[x].fb.buf = (uint8_t *)heap_caps_aligned_alloc(16, alloc_size, _caps);
cam_obj->frames[x].fb.buf = (uint8_t *)heap_caps_aligned_alloc(fb_align, alloc_size, _caps);
#else
cam_obj->frames[x].fb.buf = (uint8_t *)heap_caps_malloc(alloc_size, _caps);
#endif
Expand Down