add arbitration state timeout

This commit is contained in:
John
2022-03-13 18:01:21 +01:00
parent 980594758a
commit 4172c7d6a1
3 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -652,7 +652,8 @@ result_t BusHandler::handleSymbol() {
}
switch (arbitrationState) {
case as_lost:
logDebug(lf_bus, "arbitration lost");
case as_timeout:
logDebug(lf_bus, arbitrationState == as_lost ? "arbitration lost" : "arbitration lost (timed out)");
if (m_currentRequest == nullptr) {
BusRequest *startRequest = m_nextRequests.peek();
if (startRequest != nullptr && m_nextRequests.remove(startRequest)) {
+2 -2
View File
@@ -596,10 +596,10 @@ bool Device::read(symbol_t* value, bool isAvailable, ArbitrationState* arbitrati
case ENH_RES_RECEIVED:
*value = data;
if (data == SYN && *arbitrationState == as_running && m_arbitrationCheck) {
if (m_arbitrationCheck < 2) { // wait for two SYN symbols before switching to timeout
if (m_arbitrationCheck < 3) { // wait for three SYN symbols before switching to timeout
m_arbitrationCheck++;
} else {
*arbitrationState = as_lost;
*arbitrationState = as_timeout;
m_arbitrationMaster = SYN;
m_arbitrationCheck = 0;
}
+1
View File
@@ -61,6 +61,7 @@ enum ArbitrationState {
as_error, //!< error while sending master address
as_running, //!< arbitration currently running (master address sent, waiting for reception)
as_lost, //!< arbitration lost
as_timeout, //!< arbitration timed out
as_won, //!< arbitration won
};