Skip to content

Commit 577ddb2

Browse files
joevtdingusdev
authored andcommitted
dbdma: Add update_cmd.
1 parent 49cc164 commit 577ddb2

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

‎devices/common/dbdma.cpp‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@ void DMAChannel::interpret_cmd() {
144144
}
145145
}
146146

147+
void DMAChannel::update_cmd() {
148+
if (this->cur_is_writable) {
149+
if (this->cur_cmd < DBDMA_Cmd::STOP)
150+
WRITE_WORD_LE_A(&this->cur_host->xfer_stat, this->ch_stat | CH_STAT_ACTIVE);
151+
152+
// all INPUT and OUTPUT commands including LOAD_QUAD and STORE_QUAD update cmd.resCount
153+
if (this->cur_cmd < DBDMA_Cmd::NOP)
154+
WRITE_WORD_LE_A(&this->cur_host->res_count, this->res_count);
155+
}
156+
this->ch_stat &= ~(CH_STAT_FLUSH | CH_STAT_BT);
157+
}
158+
147159
void DMAChannel::finish_cmd() {
148160
bool branch_taken = false;
149161

@@ -186,17 +198,9 @@ void DMAChannel::finish_cmd() {
186198
this->ch_stat |= CH_STAT_BT;
187199
}
188200
}
189-
190-
if (this->cur_is_writable)
191-
WRITE_WORD_LE_A(&this->cur_host->xfer_stat, this->ch_stat | CH_STAT_ACTIVE);
192201
}
193202

194-
this->ch_stat &= ~(CH_STAT_FLUSH | CH_STAT_BT);
195-
196-
// all INPUT and OUTPUT commands including LOAD_QUAD and STORE_QUAD update cmd.resCount
197-
if (this->cur_cmd < DBDMA_Cmd::NOP && this->cur_is_writable) {
198-
WRITE_WORD_LE_A(&this->cur_host->res_count, this->res_count);
199-
}
203+
this->update_cmd();
200204

201205
if (this->cur_cmd < DBDMA_Cmd::STOP && !branch_taken)
202206
this->cmd_ptr += 16;

‎devices/common/dbdma.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ class DMAChannel : public DmaBidirChannel, public DmaChannel {
141141
protected:
142142
DMACmd* fetch_cmd(uint32_t cmd_addr, DMACmd* p_cmd, bool *is_writable);
143143
void interpret_cmd(void);
144+
void update_cmd();
144145
void finish_cmd();
145146
void xfer_quad(bool is_store);
146147
void update_irq(uint8_t cmd_bits);

0 commit comments

Comments
 (0)