add arbitration state timeout
This commit is contained in:
@@ -652,7 +652,8 @@ result_t BusHandler::handleSymbol() {
|
|||||||
}
|
}
|
||||||
switch (arbitrationState) {
|
switch (arbitrationState) {
|
||||||
case as_lost:
|
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) {
|
if (m_currentRequest == nullptr) {
|
||||||
BusRequest *startRequest = m_nextRequests.peek();
|
BusRequest *startRequest = m_nextRequests.peek();
|
||||||
if (startRequest != nullptr && m_nextRequests.remove(startRequest)) {
|
if (startRequest != nullptr && m_nextRequests.remove(startRequest)) {
|
||||||
|
|||||||
@@ -596,10 +596,10 @@ bool Device::read(symbol_t* value, bool isAvailable, ArbitrationState* arbitrati
|
|||||||
case ENH_RES_RECEIVED:
|
case ENH_RES_RECEIVED:
|
||||||
*value = data;
|
*value = data;
|
||||||
if (data == SYN && *arbitrationState == as_running && m_arbitrationCheck) {
|
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++;
|
m_arbitrationCheck++;
|
||||||
} else {
|
} else {
|
||||||
*arbitrationState = as_lost;
|
*arbitrationState = as_timeout;
|
||||||
m_arbitrationMaster = SYN;
|
m_arbitrationMaster = SYN;
|
||||||
m_arbitrationCheck = 0;
|
m_arbitrationCheck = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ enum ArbitrationState {
|
|||||||
as_error, //!< error while sending master address
|
as_error, //!< error while sending master address
|
||||||
as_running, //!< arbitration currently running (master address sent, waiting for reception)
|
as_running, //!< arbitration currently running (master address sent, waiting for reception)
|
||||||
as_lost, //!< arbitration lost
|
as_lost, //!< arbitration lost
|
||||||
|
as_timeout, //!< arbitration timed out
|
||||||
as_won, //!< arbitration won
|
as_won, //!< arbitration won
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user