Align the frame buffers to the structure alignment (#623)

* Align the frame buffers to the structure alignment 

cc: https://github.com/esp-rs/esp-idf-sys/issues/278
cc: https://github.com/esp-rs/rust/pull/195

* Include stdalign.h
This commit is contained in:
Me No Dev
2024-01-22 11:27:48 +02:00
committed by GitHub
parent dba8da9898
commit 8df17f7286

View File

@ -14,6 +14,7 @@
#include <stdio.h>
#include <string.h>
#include <stdalign.h>
#include "esp_heap_caps.h"
#include "ll_cam.h"
#include "cam_hal.h"
@ -265,7 +266,7 @@ static esp_err_t cam_dma_config(const camera_config_t *config)
cam_obj->dma_buffer = NULL;
cam_obj->dma = NULL;
cam_obj->frames = (cam_frame_t *)heap_caps_calloc(1, cam_obj->frame_cnt * sizeof(cam_frame_t), MALLOC_CAP_DEFAULT);
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);
CAM_CHECK(cam_obj->frames != NULL, "frames malloc failed", ESP_FAIL);
uint8_t dma_align = 0;