From 4616093a476c49eb739d17e3676a322ebbbf561a Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Mon, 5 Apr 2021 12:06:21 +1000 Subject: [PATCH] Using enum for PE events --- source/Core/Drivers/FUSB302/int_n.cpp | 2 +- source/Core/Drivers/FUSB302/policy_engine.cpp | 88 ++++++++++--------- source/Core/Drivers/FUSB302/policy_engine.h | 32 ++++--- .../Drivers/FUSB302/policy_engine_user.cpp | 41 ++++----- source/Core/Drivers/FUSB302/protocol_rx.cpp | 2 +- source/Core/Drivers/FUSB302/protocol_tx.cpp | 6 +- 6 files changed, 89 insertions(+), 82 deletions(-) diff --git a/source/Core/Drivers/FUSB302/int_n.cpp b/source/Core/Drivers/FUSB302/int_n.cpp index 892dbfe2..e9d8eab5 100644 --- a/source/Core/Drivers/FUSB302/int_n.cpp +++ b/source/Core/Drivers/FUSB302/int_n.cpp @@ -63,7 +63,7 @@ void InterruptHandler::Thread(const void *arg) { /* If the I_OCP_TEMP and OVRTEMP flags are set, tell the Policy * Engine thread */ if ((status.interrupta & FUSB_INTERRUPTA_I_OCP_TEMP) && (status.status1 & FUSB_STATUS1_OVRTEMP)) { - PolicyEngine::notify(PDB_EVT_PE_I_OVRTEMP); + PolicyEngine::notify(PolicyEngine::Notifications::PDB_EVT_PE_I_OVRTEMP); } } } diff --git a/source/Core/Drivers/FUSB302/policy_engine.cpp b/source/Core/Drivers/FUSB302/policy_engine.cpp index d7d6d1f2..cc07544e 100644 --- a/source/Core/Drivers/FUSB302/policy_engine.cpp +++ b/source/Core/Drivers/FUSB302/policy_engine.cpp @@ -53,9 +53,10 @@ void PolicyEngine::init() { xEventGroupHandle = xEventGroupCreateStatic(&xCreatedEventGroup); } -void PolicyEngine::notify(uint32_t notification) { +void PolicyEngine::notify(PolicyEngine::Notifications notification) { + uint32_t val = (uint32_t)notification; if (xEventGroupHandle != NULL) { - xEventGroupSetBits(xEventGroupHandle, notification); + xEventGroupSetBits(xEventGroupHandle, val); } } @@ -156,9 +157,9 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_wait_cap() { /* Fetch a message from the protocol layer */ eventmask_t evt = 0; if (readMessage()) { - evt = PDB_EVT_PE_MSG_RX_PEND; + evt = (uint32_t)Notifications::PDB_EVT_PE_MSG_RX_PEND; } else { - evt = waitForEvent(PDB_EVT_PE_MSG_RX | PDB_EVT_PE_I_OVRTEMP | PDB_EVT_PE_RESET, + evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_MSG_RX | (uint32_t)Notifications::PDB_EVT_PE_I_OVRTEMP | (uint32_t)Notifications::PDB_EVT_PE_RESET, // Wait for cap timeout PD_T_TYPEC_SINK_WAIT_CAP); } @@ -167,18 +168,18 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_wait_cap() { return PESinkHardReset; } /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET) { return PESinkWaitCap; } /* If we're too hot, we shouldn't negotiate power yet */ - if (evt & PDB_EVT_PE_I_OVRTEMP) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_I_OVRTEMP) { return PESinkWaitCap; } /* If we got a message */ - if (evt & (PDB_EVT_PE_MSG_RX | PDB_EVT_PE_MSG_RX_PEND)) { + if (evt & ((uint32_t)Notifications::PDB_EVT_PE_MSG_RX | (uint32_t)Notifications::PDB_EVT_PE_MSG_RX_PEND)) { /* Get the message */ - while ((evt & PDB_EVT_PE_MSG_RX_PEND) || readMessage() == true) { + while ((evt & (uint32_t)Notifications::PDB_EVT_PE_MSG_RX_PEND) || readMessage() == true) { /* If we got a Source_Capabilities message, read it. */ if (PD_MSGTYPE_GET(&tempMessage) == PD_MSGTYPE_SOURCE_CAPABILITIES && PD_NUMOBJ_GET(&tempMessage) > 0) { /* First, determine what PD revision we're using */ @@ -249,20 +250,20 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_select_cap() { ProtocolTransmit::pushMessage(&_last_dpm_request); // Send indication that there is a message pending ProtocolTransmit::notify(ProtocolTransmit::Notifications::PDB_EVT_PRLTX_MSG_TX); - eventmask_t evt = waitForEvent(PDB_EVT_PE_TX_DONE | PDB_EVT_PE_TX_ERR | PDB_EVT_PE_RESET); + eventmask_t evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_TX_DONE | (uint32_t)Notifications::PDB_EVT_PE_TX_ERR | (uint32_t)Notifications::PDB_EVT_PE_RESET); /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET || evt == 0) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET || evt == 0) { return PESinkTransitionDefault; } /* If the message transmission failed, send a hard reset */ - if ((evt & PDB_EVT_PE_TX_ERR) == PDB_EVT_PE_TX_ERR) { + if ((evt & (uint32_t)Notifications::PDB_EVT_PE_TX_ERR) == (uint32_t)Notifications::PDB_EVT_PE_TX_ERR) { return PESinkHardReset; } /* Wait for a response */ - evt = waitForEvent(PDB_EVT_PE_MSG_RX | PDB_EVT_PE_RESET, PD_T_SENDER_RESPONSE); + evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_MSG_RX | (uint32_t)Notifications::PDB_EVT_PE_RESET, PD_T_SENDER_RESPONSE); /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET) { return PESinkTransitionDefault; } /* If we didn't get a response before the timeout, send a hard reset */ @@ -289,7 +290,7 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_select_cap() { return PESinkReady; } } else { - return PESinkSelectCap; + return PESinkSoftReset; } } return PESinkHardReset; @@ -297,9 +298,9 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_select_cap() { PolicyEngine::policy_engine_state PolicyEngine::pe_sink_transition_sink() { /* Wait for the PS_RDY message */ - eventmask_t evt = waitForEvent(PDB_EVT_PE_MSG_RX | PDB_EVT_PE_RESET, PD_T_PS_TRANSITION); + eventmask_t evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_MSG_RX | (uint32_t)Notifications::PDB_EVT_PE_RESET, PD_T_PS_TRANSITION); /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET) { return PESinkTransitionDefault; } /* If no message was received, send a hard reset */ @@ -333,35 +334,36 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_ready() { eventmask_t evt; /* Wait for an event */ - evt = waitForEvent(PDB_EVT_PE_MSG_RX | PDB_EVT_PE_RESET | PDB_EVT_PE_I_OVRTEMP | PDB_EVT_PE_GET_SOURCE_CAP | PDB_EVT_PE_NEW_POWER | PDB_EVT_PE_PPS_REQUEST); + evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_MSG_RX | (uint32_t)Notifications::PDB_EVT_PE_RESET | (uint32_t)Notifications::PDB_EVT_PE_I_OVRTEMP + | (uint32_t)Notifications::PDB_EVT_PE_GET_SOURCE_CAP | (uint32_t)Notifications::PDB_EVT_PE_NEW_POWER | (uint32_t)Notifications::PDB_EVT_PE_PPS_REQUEST); /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET) { return PESinkTransitionDefault; } /* If we overheated, send a hard reset */ - if (evt & PDB_EVT_PE_I_OVRTEMP) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_I_OVRTEMP) { return PESinkHardReset; } /* If the DPM wants us to, send a Get_Source_Cap message */ - if (evt & PDB_EVT_PE_GET_SOURCE_CAP) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_GET_SOURCE_CAP) { return PESinkGetSourceCap; } /* If the DPM wants new power, let it figure out what power it wants * exactly. This isn't exactly the transition from the spec (that would be * SelectCap, not EvalCap), but this works better with the particular * design of this firmware. */ - if (evt & PDB_EVT_PE_NEW_POWER) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_NEW_POWER) { /* Tell the protocol layer we're starting an AMS */ return PESinkEvalCap; } /* If SinkPPSPeriodicTimer ran out, send a new request */ - if (evt & PDB_EVT_PE_PPS_REQUEST) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_PPS_REQUEST) { return PESinkSelectCap; } /* If we received a message */ - if (evt & PDB_EVT_PE_MSG_RX) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_MSG_RX) { if (messageWaiting()) { readMessage(); /* Ignore vendor-defined messages */ @@ -435,14 +437,14 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_get_source_cap() { /* Transmit the Get_Source_Cap */ ProtocolTransmit::pushMessage(get_source_cap); ProtocolTransmit::notify(ProtocolTransmit::Notifications::PDB_EVT_PRLTX_MSG_TX); - eventmask_t evt = waitForEvent(PDB_EVT_PE_TX_DONE | PDB_EVT_PE_TX_ERR | PDB_EVT_PE_RESET); + eventmask_t evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_TX_DONE | (uint32_t)Notifications::PDB_EVT_PE_TX_ERR | (uint32_t)Notifications::PDB_EVT_PE_RESET); /* Free the sent message */ /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET) { return PESinkTransitionDefault; } /* If the message transmission failed, send a hard reset */ - if ((evt & PDB_EVT_PE_TX_DONE) == 0) { + if ((evt & (uint32_t)Notifications::PDB_EVT_PE_TX_DONE) == 0) { return PESinkHardReset; } @@ -458,16 +460,16 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_give_sink_cap() { /* Transmit our capabilities */ ProtocolTransmit::pushMessage(snk_cap); ProtocolTransmit::notify(ProtocolTransmit::Notifications::PDB_EVT_PRLTX_MSG_TX); - eventmask_t evt = waitForEvent(PDB_EVT_PE_TX_DONE | PDB_EVT_PE_TX_ERR | PDB_EVT_PE_RESET); + eventmask_t evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_TX_DONE | (uint32_t)Notifications::PDB_EVT_PE_TX_ERR | (uint32_t)Notifications::PDB_EVT_PE_RESET); /* Free the Sink_Capabilities message */ /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET) { return PESinkTransitionDefault; } /* If the message transmission failed, send a hard reset */ - if ((evt & PDB_EVT_PE_TX_DONE) == 0) { + if ((evt & (uint32_t)Notifications::PDB_EVT_PE_TX_DONE) == 0) { return PESinkHardReset; } @@ -512,15 +514,15 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_soft_reset() { /* Transmit the Accept */ ProtocolTransmit::pushMessage(&accept); ProtocolTransmit::notify(ProtocolTransmit::Notifications::PDB_EVT_PRLTX_MSG_TX); - eventmask_t evt = waitForEvent(PDB_EVT_PE_TX_DONE | PDB_EVT_PE_TX_ERR | PDB_EVT_PE_RESET); + eventmask_t evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_TX_DONE | (uint32_t)Notifications::PDB_EVT_PE_TX_ERR | (uint32_t)Notifications::PDB_EVT_PE_RESET); /* Free the sent message */ /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET) { return PESinkTransitionDefault; } /* If the message transmission failed, send a hard reset */ - if ((evt & PDB_EVT_PE_TX_DONE) == 0) { + if ((evt & (uint32_t)Notifications::PDB_EVT_PE_TX_DONE) == 0) { return PESinkHardReset; } @@ -538,20 +540,20 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_send_soft_reset() { /* Transmit the soft reset */ ProtocolTransmit::pushMessage(softrst); ProtocolTransmit::notify(ProtocolTransmit::Notifications::PDB_EVT_PRLTX_MSG_TX); - eventmask_t evt = waitForEvent(PDB_EVT_PE_TX_DONE | PDB_EVT_PE_TX_ERR | PDB_EVT_PE_RESET); + eventmask_t evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_TX_DONE | (uint32_t)Notifications::PDB_EVT_PE_TX_ERR | (uint32_t)Notifications::PDB_EVT_PE_RESET); /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET) { return PESinkTransitionDefault; } /* If the message transmission failed, send a hard reset */ - if ((evt & PDB_EVT_PE_TX_DONE) == 0) { + if ((evt & (uint32_t)Notifications::PDB_EVT_PE_TX_DONE) == 0) { return PESinkHardReset; } /* Wait for a response */ - evt = waitForEvent(PDB_EVT_PE_MSG_RX | PDB_EVT_PE_RESET, PD_T_SENDER_RESPONSE); + evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_MSG_RX | (uint32_t)Notifications::PDB_EVT_PE_RESET, PD_T_SENDER_RESPONSE); /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET) { return PESinkTransitionDefault; } /* If we didn't get a response before the timeout, send a hard reset */ @@ -594,14 +596,14 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_send_not_supported() { /* Transmit the message */ ProtocolTransmit::pushMessage(not_supported); ProtocolTransmit::notify(ProtocolTransmit::Notifications::PDB_EVT_PRLTX_MSG_TX); - eventmask_t evt = waitForEvent(PDB_EVT_PE_TX_DONE | PDB_EVT_PE_TX_ERR | PDB_EVT_PE_RESET); + eventmask_t evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_TX_DONE | (uint32_t)Notifications::PDB_EVT_PE_TX_ERR | (uint32_t)Notifications::PDB_EVT_PE_RESET); /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET) { return PESinkTransitionDefault; } /* If the message transmission failed, send a soft reset */ - if ((evt & PDB_EVT_PE_TX_DONE) == 0) { + if ((evt & (uint32_t)Notifications::PDB_EVT_PE_TX_DONE) == 0) { return PESinkSendSoftReset; } @@ -611,9 +613,9 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_send_not_supported() { PolicyEngine::policy_engine_state PolicyEngine::pe_sink_chunk_received() { /* Wait for tChunkingNotSupported */ - eventmask_t evt = waitForEvent(PDB_EVT_PE_RESET, PD_T_CHUNKING_NOT_SUPPORTED); + eventmask_t evt = waitForEvent((uint32_t)Notifications::PDB_EVT_PE_RESET, PD_T_CHUNKING_NOT_SUPPORTED); /* If we got reset signaling, transition to default */ - if (evt & PDB_EVT_PE_RESET) { + if (evt & (uint32_t)Notifications::PDB_EVT_PE_RESET) { return PESinkTransitionDefault; } @@ -646,7 +648,7 @@ void PolicyEngine::PPSTimerCallback() { if (xTaskGetTickCount() - PPSTimeLastEvent > 3 * TICKS_100MS) { // Send a new PPS message PPSTimeLastEvent = xTaskGetTickCount(); - notify(PDB_EVT_PE_PPS_REQUEST); + notify(Notifications::PDB_EVT_PE_PPS_REQUEST); } } } diff --git a/source/Core/Drivers/FUSB302/policy_engine.h b/source/Core/Drivers/FUSB302/policy_engine.h index b8e03204..a9f3e24b 100644 --- a/source/Core/Drivers/FUSB302/policy_engine.h +++ b/source/Core/Drivers/FUSB302/policy_engine.h @@ -25,25 +25,12 @@ * */ -#define PDB_EVT_PE_RESET EVENT_MASK(0) -#define PDB_EVT_PE_MSG_RX EVENT_MASK(1) -#define PDB_EVT_PE_TX_DONE EVENT_MASK(2) -#define PDB_EVT_PE_TX_ERR EVENT_MASK(3) -#define PDB_EVT_PE_HARD_SENT EVENT_MASK(4) -#define PDB_EVT_PE_I_OVRTEMP EVENT_MASK(5) -#define PDB_EVT_PE_PPS_REQUEST EVENT_MASK(6) -#define PDB_EVT_PE_MSG_RX_PEND EVENT_MASK(7) /* Never SEND THIS DIRECTLY*/ -#define PDB_EVT_PE_GET_SOURCE_CAP EVENT_MASK(8) -#define PDB_EVT_PE_NEW_POWER EVENT_MASK(9) -#define PDB_EVT_PE_ALL (EVENT_MASK(9) - 1) class PolicyEngine { public: // Sets up internal state and registers the thread static void init(); // Push an incoming message to the Policy Engine static void handleMessage(union pd_msg *msg); - // Send a notification - static void notify(uint32_t notification); // Returns true if headers indicate PD3.0 compliant static bool isPD3_0(); static bool setupCompleteOrTimedOut() { @@ -57,9 +44,26 @@ public: } // Has pd negotiation completed static bool pdHasNegotiated() { return pdNegotiationComplete; } - + // Call this periodically, at least once every second static void PPSTimerCallback(); + enum class Notifications { + PDB_EVT_PE_RESET = EVENT_MASK(0), + PDB_EVT_PE_MSG_RX = EVENT_MASK(1), + PDB_EVT_PE_TX_DONE = EVENT_MASK(2), + PDB_EVT_PE_TX_ERR = EVENT_MASK(3), + PDB_EVT_PE_HARD_SENT = EVENT_MASK(4), + PDB_EVT_PE_I_OVRTEMP = EVENT_MASK(5), + PDB_EVT_PE_PPS_REQUEST = EVENT_MASK(6), + PDB_EVT_PE_MSG_RX_PEND = EVENT_MASK(7), /* Never send this from user area*/ + PDB_EVT_PE_GET_SOURCE_CAP = EVENT_MASK(8), + PDB_EVT_PE_NEW_POWER = EVENT_MASK(9), + PDB_EVT_PE_ALL = (PDB_EVT_PE_NEW_POWER - 1), + + }; + // Send a notification + static void notify(Notifications notification); + private: static bool pdNegotiationComplete; static int current_voltage_mv; // The current voltage PD is expecting diff --git a/source/Core/Drivers/FUSB302/policy_engine_user.cpp b/source/Core/Drivers/FUSB302/policy_engine_user.cpp index 5bbe116e..d587d1d4 100644 --- a/source/Core/Drivers/FUSB302/policy_engine_user.cpp +++ b/source/Core/Drivers/FUSB302/policy_engine_user.cpp @@ -63,27 +63,28 @@ bool PolicyEngine::pdbs_dpm_evaluate_capability(const union pd_msg *capabilities for (uint8_t i = 0; i < numobj; i++) { /* If we have a fixed PDO, its V equals our desired V, and its I is * at least our desired I */ - if ((capabilities->obj[i] & PD_PDO_TYPE) == PD_PDO_TYPE_FIXED) { - // This is a fixed PDO entry - // Evaluate if it can produve sufficient current based on the tipResistance (ohms*10) - // V=I*R -> V/I => minimum resistance, if our tip resistance is >= this then we can use this supply + // if ((capabilities->obj[i] & PD_PDO_TYPE) == PD_PDO_TYPE_FIXED) { + // // This is a fixed PDO entry + // // Evaluate if it can produve sufficient current based on the tipResistance (ohms*10) + // // V=I*R -> V/I => minimum resistance, if our tip resistance is >= this then we can use this supply + + // int voltage_mv = PD_PDV2MV(PD_PDO_SRC_FIXED_VOLTAGE_GET(capabilities->obj[i])); // voltage in mV units + // int current_a_x100 = PD_PDO_SRC_FIXED_CURRENT_GET(capabilities->obj[i]); // current in 10mA units + // int min_resistance_ohmsx10 = voltage_mv / current_a_x100; + // if (voltage_mv <= (USB_PD_VMAX * 1000)) { + // if (min_resistance_ohmsx10 <= tipResistance) { + // // This is a valid power source we can select as + // if (voltage_mv > bestIndexVoltage||bestIndex == 0xFF) { + // // Higher voltage and valid, select this instead + // bestIndex = i; + // bestIndexVoltage = voltage_mv; + // bestIndexCurrent = current_a_x100; + // bestIsPPS = false; + // } + // } + // } + // } else - int voltage_mv = PD_PDV2MV(PD_PDO_SRC_FIXED_VOLTAGE_GET(capabilities->obj[i])); // voltage in mV units - int current_a_x100 = PD_PDO_SRC_FIXED_CURRENT_GET(capabilities->obj[i]); // current in 10mA units - int min_resistance_ohmsx10 = voltage_mv / current_a_x100; - if (min_resistance_ohmsx10 <= tipResistance) { - // This is a valid power source we can select as - if (bestIndex == 0xFF) { - // This is the first valid source, so select to be safe - bestIndex = i; - bestIndexVoltage = voltage_mv; - bestIndexCurrent = current_a_x100; - } else if (voltage_mv > bestIndexVoltage) { - // Higher voltage and valid, select this instead - bestIndex = i; - bestIndexVoltage = voltage_mv; - bestIndexCurrent = current_a_x100; - } if ((capabilities->obj[i] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED && (capabilities->obj[i] & PD_APDO_TYPE) == PD_APDO_TYPE_PPS) { // If this is a PPS slot, calculate the max voltage in the PPS range that can we be used and maintain uint16_t max_voltage = PD_PAV2MV(PD_APDO_PPS_MAX_VOLTAGE_GET(capabilities->obj[i])); diff --git a/source/Core/Drivers/FUSB302/protocol_rx.cpp b/source/Core/Drivers/FUSB302/protocol_rx.cpp index 2c87f325..b6618d76 100644 --- a/source/Core/Drivers/FUSB302/protocol_rx.cpp +++ b/source/Core/Drivers/FUSB302/protocol_rx.cpp @@ -129,7 +129,7 @@ ProtocolReceive::protocol_rx_state ProtocolReceive::protocol_rx_store_messageid( /* Pass the message to the policy engine. */ PolicyEngine::handleMessage(&tempMessage); - PolicyEngine::notify(PDB_EVT_PE_MSG_RX); + PolicyEngine::notify(PolicyEngine::Notifications::PDB_EVT_PE_MSG_RX); taskYIELD(); /* Don't check if we got a RESET because we'd do nothing different. */ diff --git a/source/Core/Drivers/FUSB302/protocol_tx.cpp b/source/Core/Drivers/FUSB302/protocol_tx.cpp index 686c41d2..e9563f59 100644 --- a/source/Core/Drivers/FUSB302/protocol_tx.cpp +++ b/source/Core/Drivers/FUSB302/protocol_tx.cpp @@ -44,7 +44,7 @@ ProtocolTransmit::protocol_tx_state ProtocolTransmit::protocol_tx_phy_reset() { * we failed to send it */ if (messagePending()) { /* Tell the policy engine that we failed */ - PolicyEngine::notify(PDB_EVT_PE_TX_ERR); + PolicyEngine::notify(PolicyEngine::Notifications::PDB_EVT_PE_TX_ERR); /* Finish failing to send the message */ while (messagePending()) { getMessage(); // Discard @@ -168,7 +168,7 @@ ProtocolTransmit::protocol_tx_state ProtocolTransmit::protocol_tx_transmission_e _tx_messageidcounter = (_tx_messageidcounter + 1) % 8; /* Tell the policy engine that we failed */ - PolicyEngine::notify(PDB_EVT_PE_TX_ERR); + PolicyEngine::notify(PolicyEngine::Notifications::PDB_EVT_PE_TX_ERR); return PRLTxWaitMessage; } @@ -179,7 +179,7 @@ ProtocolTransmit::protocol_tx_state ProtocolTransmit::protocol_tx_message_sent() _tx_messageidcounter = (_tx_messageidcounter + 1) % 8; /* Tell the policy engine that we succeeded */ - PolicyEngine::notify(PDB_EVT_PE_TX_DONE); + PolicyEngine::notify(PolicyEngine::Notifications::PDB_EVT_PE_TX_DONE); return PRLTxWaitMessage; }