Fixed flushing not blocking correctly
This commit is contained in:
parent
9f9f7a8de5
commit
8153696309
16
hardware.hpp
16
hardware.hpp
@ -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;
|
||||
|
@ -107,8 +107,11 @@ class Hardware0 {
|
||||
|
||||
static void flushTx() FORCE_INLINE
|
||||
{
|
||||
while (HardwareImpl::txActive())
|
||||
while (!HardwareImpl::txEmpty())
|
||||
;
|
||||
while (!HardwareImpl::txComplete())
|
||||
;
|
||||
HardwareImpl::clearTxComplete();
|
||||
}
|
||||
|
||||
private:
|
||||
@ -174,8 +177,11 @@ class Hardware0<mode, cfg, Driven::INTERRUPT> {
|
||||
{
|
||||
while (sm_txBuf.head != sm_txBuf.tail)
|
||||
;
|
||||
while (HardwareImpl::txActive())
|
||||
while (!HardwareImpl::txEmpty())
|
||||
;
|
||||
while (!HardwareImpl::txComplete())
|
||||
;
|
||||
HardwareImpl::clearTxComplete();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -111,8 +111,11 @@ class Hardware1 {
|
||||
|
||||
static void flushTx() FORCE_INLINE
|
||||
{
|
||||
while (HardwareImpl::txActive())
|
||||
while (!HardwareImpl::txEmpty())
|
||||
;
|
||||
while (!HardwareImpl::txComplete())
|
||||
;
|
||||
HardwareImpl::clearTxComplete();
|
||||
}
|
||||
|
||||
private:
|
||||
@ -178,8 +181,11 @@ class Hardware1<mode, cfg, Driven::INTERRUPT> {
|
||||
{
|
||||
while (sm_txBuf.head != sm_txBuf.tail)
|
||||
;
|
||||
while (HardwareImpl::txActive())
|
||||
while (!HardwareImpl::txEmpty())
|
||||
;
|
||||
while (!HardwareImpl::txComplete())
|
||||
;
|
||||
HardwareImpl::clearTxComplete();
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user