mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 09:09:10 -04:00
Merge branch 'feat/can_bypass_buffer_align_check' into 'master'
feat(gdma): allow bypass the alignment check in the link driver Closes IDFGH-14453 See merge request espressif/esp-idf!37255
This commit is contained in:
commit
cb9257dae7
@ -166,7 +166,9 @@ esp_err_t gdma_link_mount_buffers(gdma_link_list_handle_t list, int start_item_i
|
||||
uint8_t *buf = (uint8_t *)config->buffer;
|
||||
size_t len = config->length;
|
||||
// check the buffer alignment
|
||||
ESP_RETURN_ON_FALSE(((uintptr_t)buf & (buffer_alignment - 1)) == 0, ESP_ERR_INVALID_ARG, TAG, "buffer not aligned to %zu", buffer_alignment);
|
||||
if (!config->flags.bypass_buffer_align_check) {
|
||||
ESP_RETURN_ON_FALSE(((uintptr_t)buf & (buffer_alignment - 1)) == 0, ESP_ERR_INVALID_ARG, TAG, "buffer not aligned to %zu", buffer_alignment);
|
||||
}
|
||||
uint32_t num_items_need = (len + max_buffer_mount_length - 1) / max_buffer_mount_length;
|
||||
// check if there are enough link list items
|
||||
ESP_RETURN_ON_FALSE((begin_item_idx + num_items_need) <= (start_item_index + num_items_avail), ESP_ERR_INVALID_ARG, TAG, "no more space for buffer mounting");
|
||||
|
@ -72,6 +72,8 @@ typedef struct {
|
||||
Note, DMA engine will stop at this item and trigger an interrupt.
|
||||
If `mark_final` is not set, this list item will point to the next item, and
|
||||
wrap around to the head item if it's the last one in the list. */
|
||||
uint32_t bypass_buffer_align_check: 1; /*!< Whether to bypass the buffer alignment check.
|
||||
Only enable it when you know what you are doing. */
|
||||
} flags; //!< Flags for buffer mount configurations
|
||||
} gdma_buffer_mount_config_t;
|
||||
|
||||
|
@ -1000,6 +1000,7 @@ static esp_err_t lcd_rgb_panel_init_trans_link(esp_rgb_panel_t *rgb_panel)
|
||||
gdma_buffer_mount_config_t restart_buffer_mount_cfg = {
|
||||
.buffer = rgb_panel->fbs[0] + restart_skip_bytes,
|
||||
.length = MIN(LCD_DMA_DESCRIPTOR_BUFFER_MAX_SIZE, rgb_panel->fb_size) - restart_skip_bytes,
|
||||
.flags.bypass_buffer_align_check = true, // the restart buffer may doesn't match the buffer alignment but it doesn't really matter in this case
|
||||
};
|
||||
ESP_RETURN_ON_ERROR(gdma_link_mount_buffers(rgb_panel->dma_restart_link, 0, &restart_buffer_mount_cfg, 1, NULL),
|
||||
TAG, "mount DMA restart buffer failed");
|
||||
|
Loading…
x
Reference in New Issue
Block a user