mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-26 09:29:28 +00:00
dbmda: Fix dma output res_count update.
Use this->res_count to track amount of data transferred.
This commit is contained in:
parent
0166059d1b
commit
2d8f2422b3
@ -84,6 +84,7 @@ uint8_t DMAChannel::interpret_cmd() {
|
||||
res = mmu_map_dma_mem(cmd_struct.address, cmd_struct.req_count, false);
|
||||
this->queue_data = res.host_va;
|
||||
this->queue_len = cmd_struct.req_count;
|
||||
this->res_count = 0;
|
||||
this->cmd_in_progress = true;
|
||||
break;
|
||||
case DBDMA_Cmd::STORE_QUAD:
|
||||
@ -170,7 +171,9 @@ void DMAChannel::finish_cmd() {
|
||||
|
||||
// all INPUT and OUTPUT commands including LOAD_QUAD and STORE_QUAD update cmd.resCount
|
||||
if (this->cur_cmd < DBDMA_Cmd::NOP && res.is_writable) {
|
||||
WRITE_WORD_LE_A(&cmd_desc[12], this->queue_len & 0xFFFFUL);
|
||||
WRITE_WORD_LE_A(&cmd_desc[12], this->res_count);
|
||||
this->queue_len = 0;
|
||||
this->res_count = 0;
|
||||
}
|
||||
|
||||
if (!branch_taken)
|
||||
@ -192,7 +195,7 @@ void DMAChannel::xfer_quad(const DMACmd *cmd_desc, DMACmd *cmd_host) {
|
||||
} else {
|
||||
xfer_size = 1;
|
||||
}
|
||||
this->queue_len = cmd_desc->req_count; // this is the value that gets written to cmd.resCount
|
||||
this->res_count = cmd_desc->req_count; // this is the value that gets written to cmd.resCount
|
||||
|
||||
addr = cmd_desc->address;
|
||||
if (addr & (xfer_size - 1)) {
|
||||
@ -388,12 +391,14 @@ DmaPullResult DMAChannel::pull_data(uint32_t req_len, uint32_t *avail_len, uint8
|
||||
*p_data = this->queue_data;
|
||||
*avail_len = req_len;
|
||||
this->queue_len -= req_len;
|
||||
this->res_count += req_len;
|
||||
this->queue_data += req_len;
|
||||
} else { // return less data than req_len
|
||||
LOG_F(9, "%s: Return queue_len = %d data", this->get_name().c_str(),
|
||||
this->queue_len);
|
||||
*p_data = this->queue_data;
|
||||
*avail_len = this->queue_len;
|
||||
this->res_count += this->queue_len;
|
||||
this->queue_len = 0;
|
||||
}
|
||||
return DmaPullResult::MoreData; // tell the caller there is more data
|
||||
@ -418,6 +423,7 @@ int DMAChannel::push_data(const char* src_ptr, int len) {
|
||||
len = std::min((int)this->queue_len, len);
|
||||
std::memcpy(this->queue_data, src_ptr, len);
|
||||
this->queue_data += len;
|
||||
this->res_count += len;
|
||||
this->queue_len -= len;
|
||||
}
|
||||
|
||||
|
@ -123,6 +123,7 @@ private:
|
||||
uint32_t cmd_ptr = 0;
|
||||
uint32_t queue_len = 0;
|
||||
uint8_t* queue_data = 0;
|
||||
uint32_t res_count = 0;
|
||||
uint32_t int_select = 0;
|
||||
uint32_t branch_select = 0;
|
||||
uint32_t wait_select = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user