1
0
forked from me/IronOS

Update int_n.cpp

This commit is contained in:
Ben V. Brown
2020-09-05 20:29:57 +10:00
parent 8bacbe49fc
commit 023e176c87

View File

@@ -40,8 +40,6 @@ void InterruptHandler::init() {
void InterruptHandler::Thread(const void *arg) { void InterruptHandler::Thread(const void *arg) {
(void) arg; (void) arg;
union fusb_status status; union fusb_status status;
uint32_t events;
bool notifSent = false;
while (true) { while (true) {
/* If the INT_N line is low */ /* If the INT_N line is low */
if (xTaskNotifyWait(0x00, 0x0F, NULL, if (xTaskNotifyWait(0x00, 0x0F, NULL,
@@ -49,7 +47,6 @@ void InterruptHandler::Thread(const void *arg) {
//delay slightly so we catch the crc with better timing //delay slightly so we catch the crc with better timing
osDelay(1); osDelay(1);
} }
notifSent = false;
/* Read the FUSB302B status and interrupt registers */ /* Read the FUSB302B status and interrupt registers */
fusb_get_status(&status); fusb_get_status(&status);
/* If the I_TXSENT or I_RETRYFAIL flag is set, tell the Protocol TX /* If the I_TXSENT or I_RETRYFAIL flag is set, tell the Protocol TX
@@ -57,19 +54,16 @@ void InterruptHandler::Thread(const void *arg) {
if (status.interrupta & FUSB_INTERRUPTA_I_TXSENT) { if (status.interrupta & FUSB_INTERRUPTA_I_TXSENT) {
ProtocolTransmit::notify( ProtocolTransmit::notify(
ProtocolTransmit::Notifications::PDB_EVT_PRLTX_I_TXSENT); ProtocolTransmit::Notifications::PDB_EVT_PRLTX_I_TXSENT);
notifSent = true;
} }
if (status.interrupta & FUSB_INTERRUPTA_I_RETRYFAIL) { if (status.interrupta & FUSB_INTERRUPTA_I_RETRYFAIL) {
ProtocolTransmit::notify( ProtocolTransmit::notify(
ProtocolTransmit::Notifications::PDB_EVT_PRLTX_I_RETRYFAIL); ProtocolTransmit::Notifications::PDB_EVT_PRLTX_I_RETRYFAIL);
notifSent = true;
} }
/* If the I_GCRCSENT flag is set, tell the Protocol RX thread */ /* If the I_GCRCSENT flag is set, tell the Protocol RX thread */
//This means a message was recieved with a good CRC //This means a message was recieved with a good CRC
if (status.interruptb & FUSB_INTERRUPTB_I_GCRCSENT) { if (status.interruptb & FUSB_INTERRUPTB_I_GCRCSENT) {
ProtocolReceive::notify(PDB_EVT_PRLRX_I_GCRCSENT); ProtocolReceive::notify(PDB_EVT_PRLRX_I_GCRCSENT);
notifSent = true;
} }
/* If the I_OCP_TEMP and OVRTEMP flags are set, tell the Policy /* If the I_OCP_TEMP and OVRTEMP flags are set, tell the Policy
@@ -77,7 +71,6 @@ void InterruptHandler::Thread(const void *arg) {
if (status.interrupta & FUSB_INTERRUPTA_I_OCP_TEMP if (status.interrupta & FUSB_INTERRUPTA_I_OCP_TEMP
&& status.status1 & FUSB_STATUS1_OVRTEMP) { && status.status1 & FUSB_STATUS1_OVRTEMP) {
PolicyEngine::notify(PDB_EVT_PE_I_OVRTEMP); PolicyEngine::notify(PDB_EVT_PE_I_OVRTEMP);
notifSent = true;
} }
} }
} }