dma: Add is_active method for input channels.

Since DBDMA contains an input and output channel, rename the existing is_active method to is_out_active.
This commit is contained in:
joevt 2023-11-21 20:36:43 -08:00 committed by dingusdev
parent 31036b8dee
commit 29d13aef09
4 changed files with 17 additions and 5 deletions

View File

@ -429,7 +429,16 @@ int DMAChannel::push_data(const char* src_ptr, int len) {
return 0;
}
bool DMAChannel::is_active() {
bool DMAChannel::is_out_active() {
if (this->ch_stat & CH_STAT_DEAD || !(this->ch_stat & CH_STAT_ACTIVE)) {
return false;
}
else {
return true;
}
}
bool DMAChannel::is_in_active() {
if (this->ch_stat & CH_STAT_DEAD || !(this->ch_stat & CH_STAT_ACTIVE)) {
return false;
}

View File

@ -92,7 +92,8 @@ public:
uint32_t reg_read(uint32_t offset, int size);
void reg_write(uint32_t offset, uint32_t value, int size);
bool is_active();
bool is_out_active();
bool is_in_active();
DmaPullResult pull_data(uint32_t req_len, uint32_t *avail_len, uint8_t **p_data);
int push_data(const char* src_ptr, int len);

View File

@ -35,7 +35,7 @@ class DmaOutChannel {
public:
DmaOutChannel(std::string name) { this->name = name; };
virtual bool is_active() { return true; };
virtual bool is_out_active() { return true; };
virtual DmaPullResult pull_data(uint32_t req_len, uint32_t *avail_len,
uint8_t **p_data) = 0;
@ -49,7 +49,9 @@ class DmaInChannel {
public:
DmaInChannel(std::string name) { this->name = name; };
virtual int push_data(const char* src_ptr, int len) = 0;
virtual bool is_in_active() { return true; };
virtual int push_data(const char* src_ptr, int len) = 0;
std::string get_name(void) { return this->name; };
private:

View File

@ -108,7 +108,7 @@ long sound_out_callback(cubeb_stream *stream, void *user_data,
long frames, out_frames;
DmaOutChannel *dma_ch = static_cast<DmaOutChannel*>(user_data); /* C API baby! */
if (!dma_ch->is_active()) {
if (!dma_ch->is_out_active()) {
return 0;
}