escc: remove old DMA implementation.

This commit is contained in:
Maxim Poliakovski committed 2026-05-29 23:36:24 +02:00
1 parent a68bd5b07e
commit b63b658343
2 files changed
-147

No files matched your search

-91
View File
@@ -432,97 +432,6 @@ void EsccChannel::set_enh_reg(uint8_t value)
}
}
void EsccChannel::dma_start_tx()
{
}
void EsccChannel::dma_start_rx()
{
}
void EsccChannel::dma_stop_tx()
{
if (this->timer_id_tx) {
TimerManager::get_instance()->cancel_timer(this->timer_id_tx);
this->timer_id_tx = 0;
}
}
void EsccChannel::dma_stop_rx()
{
if (this->timer_id_rx) {
TimerManager::get_instance()->cancel_timer(this->timer_id_rx);
this->timer_id_rx = 0;
}
}
void EsccChannel::dma_in_tx()
{
LOG_F(ERROR, "%s: Unexpected DMA INPUT command for transmit.", this->name.c_str());
}
void EsccChannel::dma_in_rx()
{
if (dma_ch[DIR_RX]->get_push_data_remaining()) {
this->timer_id_rx = TimerManager::get_instance()->add_oneshot_timer(
0,
[this]() {
this->timer_id_rx = 0;
char c = receive_byte();
dma_ch[DIR_RX]->push_data(&c, 1);
this->dma_in_rx();
});
}
}
void EsccChannel::dma_out_tx()
{
this->timer_id_tx = TimerManager::get_instance()->add_oneshot_timer(
10,
[this]() {
this->timer_id_tx = 0;
uint8_t *data;
uint32_t avail_len;
if (dma_ch[DIR_TX]->pull_data(256, &avail_len, &data) == MoreData) {
while(avail_len) {
this->send_byte(*data++);
avail_len--;
}
this->dma_out_tx();
}
});
}
void EsccChannel::dma_out_rx()
{
LOG_F(ERROR, "%s: Unexpected DMA OUTPUT command for receive.", this->name.c_str());
}
void EsccChannel::dma_flush_tx()
{
this->dma_stop_tx();
this->timer_id_tx = TimerManager::get_instance()->add_oneshot_timer(
10,
[this]() {
this->timer_id_tx = 0;
dma_ch[DIR_TX]->end_pull_data();
});
}
void EsccChannel::dma_flush_rx()
{
this->dma_stop_rx();
this->timer_id_rx = TimerManager::get_instance()->add_oneshot_timer(
10,
[this]() {
this->timer_id_rx = 0;
dma_ch[DIR_RX]->end_push_data();
});
}
int EsccChannel::xfer_from(DmaChannel *ch_obj, uint8_t *buf, int len) {
if (ch_obj->get_id() == DIR_TX) {
LOG_F(WARNING, "%s: attempt to receive data over the DMA TX channel",
-56
View File
@@ -33,8 +33,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <memory>
#include <string>
class DmaBidirChannel;
/** ESCC register positions */
/* Please note that the registers below are provided
by the Apple I/O controllers for accessing ESCC
@@ -97,37 +95,6 @@ public:
uint8_t get_enh_reg();
void set_enh_reg(uint8_t value);
void set_dma_channel(DirIndex dir_index, DmaBidirChannel *dma_ch) {
this->dma_ch[dir_index] = dma_ch;
auto dbdma_ch = dynamic_cast<DMAChannel*>(dma_ch);
if (dbdma_ch) {
switch (dir_index) {
case DIR_TX:
dbdma_ch->set_callbacks(
std::bind(&EsccChannel::dma_start_tx, this),
std::bind(&EsccChannel::dma_stop_tx, this)
);
dbdma_ch->set_data_callbacks(
std::bind(&EsccChannel::dma_in_tx, this),
std::bind(&EsccChannel::dma_out_tx, this),
std::bind(&EsccChannel::dma_flush_tx, this)
);
break;
case DIR_RX:
dbdma_ch->set_callbacks(
std::bind(&EsccChannel::dma_start_rx, this),
std::bind(&EsccChannel::dma_stop_rx, this)
);
dbdma_ch->set_data_callbacks(
std::bind(&EsccChannel::dma_in_rx, this),
std::bind(&EsccChannel::dma_out_rx, this),
std::bind(&EsccChannel::dma_flush_rx, this)
);
break;
}
}
}
void set_dma_channel(DirIndex dir_index, DmaChannel *ch_obj) {
this->dma_channels[dir_index] = ch_obj;
@@ -147,22 +114,6 @@ public:
int xfer_to (DmaChannel *ch_obj, uint8_t *buf, int len) override;
private:
uint32_t timer_id_tx = 0;
uint32_t timer_id_rx = 0;
void dma_start_tx();
void dma_stop_tx();
void dma_in_tx();
void dma_out_tx();
void dma_flush_tx();
void dma_start_rx();
void dma_stop_rx();
void dma_in_rx();
void dma_out_rx();
void dma_flush_rx();
DmaBidirChannel* dma_ch[DIR_MAX+1];
DmaChannel* dma_channels[2];
std::string name;
@@ -192,13 +143,6 @@ public:
uint8_t read(uint8_t reg_offset);
void write(uint8_t reg_offset, uint8_t value);
void set_dma_channel(ChIndex ch_index, DirIndex dir_index, DmaBidirChannel *dma_ch) {
switch (ch_index) {
case CH_A: ch_a->set_dma_channel(dir_index, dma_ch); break;
case CH_B: ch_b->set_dma_channel(dir_index, dma_ch); break;
}
}
void connect_dma_channel(ChIndex ch_idx, DirIndex dir_idx, DmaChannel *ch_obj) {
switch (ch_idx) {
case CH_A: ch_a->set_dma_channel(dir_idx, ch_obj); break;