dbdma: implement xfer_to_device method.

This commit is contained in:
Maxim Poliakovski 2024-11-03 15:03:44 +01:00
parent 46425faaa9
commit 5057792d4d
2 changed files with 16 additions and 0 deletions

View File

@ -97,6 +97,7 @@ uint8_t DMAChannel::interpret_cmd() {
switch (this->cur_cmd) {
case DBDMA_Cmd::OUTPUT_MORE:
case DBDMA_Cmd::OUTPUT_LAST:
this->xfer_to_device();
if (this->out_cb)
this->out_cb();
break;
@ -434,6 +435,20 @@ void DMAChannel::xfer_from_device() {
this->interpret_cmd();
}
void DMAChannel::xfer_to_device() {
if (this->dev_obj == nullptr)
return;
this->xfer_dir = DMA_DIR_TO_DEV;
if (!this->dev_obj->xfer_to(this->queue_data, this->queue_len)) {
this->queue_len = 0;
this->finish_cmd();
}
this->interpret_cmd();
}
DmaPullResult DMAChannel::pull_data(uint32_t req_len, uint32_t *avail_len, uint8_t **p_data)
{
*avail_len = 0;

View File

@ -135,6 +135,7 @@ protected:
void xfer_quad(const DMACmd *cmd_desc, DMACmd *cmd_host);
void update_irq();
void xfer_from_device();
void xfer_to_device();
void start(void);
void resume(void);