Sc53C94: implement reading the FIFO register.

This commit is contained in:
Maxim Poliakovski 2022-11-02 21:19:31 +01:00
parent f2be286515
commit 2865a611e7
2 changed files with 19 additions and 0 deletions

View File

@ -82,6 +82,8 @@ uint8_t Sc53C94::read(uint8_t reg_offset)
return this->xfer_count & 0xFFU;
case Read::Reg53C94::Xfer_Cnt_MSB:
return (this->xfer_count >> 8) & 0xFFU;
case Read::Reg53C94::FIFO:
return this->fifo_pop();
case Read::Reg53C94::Command:
return this->cmd_fifo[0];
case Read::Reg53C94::Status:
@ -321,6 +323,22 @@ void Sc53C94::fifo_push(const uint8_t data)
}
}
uint8_t Sc53C94::fifo_pop()
{
uint8_t data = 0;
if (this->data_fifo_pos < 1) {
LOG_F(ERROR, "SC53C94: data FIFO underflow!");
this->status |= STAT_GE; // signal IOE/Gross Error
} else {
data = this->data_fifo[0];
this->data_fifo_pos--;
std:memmove(this->data_fifo, &this->data_fifo[1], this->data_fifo_pos);
}
return data;
}
void Sc53C94::seq_defer_state(uint64_t delay_ns)
{
seq_timer_id = TimerManager::get_instance()->add_oneshot_timer(

View File

@ -166,6 +166,7 @@ protected:
void exec_command();
void exec_next_command();
void fifo_push(const uint8_t data);
uint8_t fifo_pop();
void sequencer();
void seq_defer_state(uint64_t delay_ns);