mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(csi): support using internal buffer when there's no new trans buffer
Also when the new trans buffer is not big enough
This commit is contained in:
parent
ce1e996747
commit
e7c1f6b3b2
@ -280,16 +280,25 @@ static bool csi_dma_trans_done_callback(dw_gdma_channel_handle_t chan, const dw_
|
||||
|
||||
if (ctlr->cbs.on_get_new_trans) {
|
||||
need_yield = ctlr->cbs.on_get_new_trans(&(ctlr->base), &new_trans, ctlr->cbs_user_data);
|
||||
assert(new_trans.buflen >= ctlr->fb_size_in_bytes);
|
||||
csi_dma_transfer_config.dst.addr = (uint32_t)(new_trans.buffer);
|
||||
if (!(new_trans.buffer) || new_trans.buflen < ctlr->fb_size_in_bytes) {
|
||||
use_backup = true;
|
||||
} else {
|
||||
csi_dma_transfer_config.dst.addr = (uint32_t)(new_trans.buffer);
|
||||
}
|
||||
} else if (xQueueReceiveFromISR(ctlr->trans_que, &new_trans, &high_task_woken) == pdTRUE) {
|
||||
assert(new_trans.buflen >= ctlr->fb_size_in_bytes);
|
||||
csi_dma_transfer_config.dst.addr = (uint32_t)(new_trans.buffer);
|
||||
if (!(new_trans.buffer) || new_trans.buflen < ctlr->fb_size_in_bytes) {
|
||||
use_backup = true;
|
||||
} else {
|
||||
csi_dma_transfer_config.dst.addr = (uint32_t)(new_trans.buffer);
|
||||
}
|
||||
} else {
|
||||
use_backup = true;
|
||||
}
|
||||
|
||||
if (use_backup) {
|
||||
new_trans.buffer = ctlr->backup_buffer;
|
||||
new_trans.buflen = ctlr->fb_size_in_bytes;
|
||||
ESP_EARLY_LOGD(TAG, "no new buffer, use driver internal buffer");
|
||||
ESP_EARLY_LOGD(TAG, "no new buffer or no long enough new buffer, use driver internal buffer");
|
||||
csi_dma_transfer_config.dst.addr = (uint32_t)ctlr->backup_buffer;
|
||||
}
|
||||
|
||||
@ -297,7 +306,7 @@ static bool csi_dma_trans_done_callback(dw_gdma_channel_handle_t chan, const dw_
|
||||
dw_gdma_channel_config_transfer(chan, &csi_dma_transfer_config);
|
||||
dw_gdma_channel_enable_ctrl(chan, true);
|
||||
|
||||
if (!use_backup) {
|
||||
if (ctlr->trans.buffer != ctlr->backup_buffer) {
|
||||
esp_err_t ret = esp_cache_msync((void *)(ctlr->trans.buffer), ctlr->trans.received_size, ESP_CACHE_MSYNC_FLAG_INVALIDATE);
|
||||
assert(ret == ESP_OK);
|
||||
assert(ctlr->cbs.on_trans_finished);
|
||||
|
Loading…
x
Reference in New Issue
Block a user