Skip to content

Commit 8df17f7

Browse files
authored
Align the frame buffers to the structure alignment (#623)
* Align the frame buffers to the structure alignment cc: esp-rs/esp-idf-sys#278 cc: esp-rs/rust#195 * Include stdalign.h
1 parent dba8da9 commit 8df17f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

driver/cam_hal.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include <stdio.h>
1616
#include <string.h>
17+
#include <stdalign.h>
1718
#include "esp_heap_caps.h"
1819
#include "ll_cam.h"
1920
#include "cam_hal.h"
@@ -265,7 +266,7 @@ static esp_err_t cam_dma_config(const camera_config_t *config)
265266
cam_obj->dma_buffer = NULL;
266267
cam_obj->dma = NULL;
267268

268-
cam_obj->frames = (cam_frame_t *)heap_caps_calloc(1, cam_obj->frame_cnt * sizeof(cam_frame_t), MALLOC_CAP_DEFAULT);
269+
cam_obj->frames = (cam_frame_t *)heap_caps_aligned_calloc(alignof(cam_frame_t), 1, cam_obj->frame_cnt * sizeof(cam_frame_t), MALLOC_CAP_DEFAULT);
269270
CAM_CHECK(cam_obj->frames != NULL, "frames malloc failed", ESP_FAIL);
270271

271272
uint8_t dma_align = 0;

0 commit comments

Comments
 (0)