Skip to content

Commit

Permalink
Align the frame buffers to the structure alignment (#623)
Browse files Browse the repository at this point in the history
* Align the frame buffers to the structure alignment 

cc: esp-rs/esp-idf-sys#278
cc: esp-rs/rust#195

* Include stdalign.h
  • Loading branch information
me-no-dev committed Jan 22, 2024
1 parent dba8da9 commit 8df17f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion driver/cam_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8df17f7

Please sign in to comment.