Fixed flushing not blocking correctly

This commit is contained in:
2019-08-03 18:45:51 +02:00
parent 9f9f7a8de5
commit 8153696309
3 changed files with 29 additions and 7 deletions

View File

@@ -64,14 +64,24 @@ class Hardware {
return *Registers::IO_REG;
}
static bool txActive() FORCE_INLINE
static bool txEmpty() FORCE_INLINE
{
return !(*Registers::CTRL_STAT_REG_A & (1 << CtrlFlagsA::DATA_REG_EMPTY));
return *Registers::CTRL_STAT_REG_A & (1 << CtrlFlagsA::DATA_REG_EMPTY);
}
static bool txComplete() FORCE_INLINE
{
return *Registers::CTRL_STAT_REG_A & (1 << CtrlFlagsA::TRANSMIT_COMPLETE);
}
static void clearTxComplete() FORCE_INLINE
{
*Registers::CTRL_STAT_REG_A |= (1 << CtrlFlagsA::TRANSMIT_COMPLETE);
}
static void txByteBlocking(const typename cfg::data_t &byte) FORCE_INLINE
{
while (txActive())
while (!txEmpty())
;
*Registers::IO_REG = byte;