support detect acks with busy + nack and show in monitoring

This commit is contained in:
Marco Scholl 2024-05-23 15:38:31 +02:00
parent 2adac5e4af
commit a645575a72
No known key found for this signature in database
2 changed files with 23 additions and 12 deletions

View File

@ -19,13 +19,16 @@
#define TP_FRAME_FLAG_ECHO 0b00010000 #define TP_FRAME_FLAG_ECHO 0b00010000
// Means that the frame is processed by this device // Means that the frame is processed by this device
#define TP_FRAME_FLAG_ADDRESSED 0b00000100 #define TP_FRAME_FLAG_ADDRESSED 0b00001000
// Means that the frame has been acked by this device. // Means that the frame has been acked with BUSY
#define TP_FRAME_FLAG_ACKING 0b00000010 #define TP_FRAME_FLAG_ACK_BUSY 0b00000100
// Means that the frame has been acked by other (Busmontior) // Means that the frame has been acked with NACK
#define TP_FRAME_FLAG_ACKED 0b00000001 #define TP_FRAME_FLAG_ACK_NACK 0b00000010
// Means that the frame has been acked
#define TP_FRAME_FLAG_ACK 0b00000001
class TpFrame class TpFrame
{ {

View File

@ -61,6 +61,8 @@
// acknowledge services (device is transparent in bus monitor mode) // acknowledge services (device is transparent in bus monitor mode)
#define L_ACKN_IND 0x00 #define L_ACKN_IND 0x00
#define L_ACKN_MASK 0x33 #define L_ACKN_MASK 0x33
#define L_ACKN_BUSY_MASK 0x0C
#define L_ACKN_NACK_MASK 0xC0
#define L_DATA_CON 0x0B #define L_DATA_CON 0x0B
#define L_DATA_CON_MASK 0x7F #define L_DATA_CON_MASK 0x7F
#define SUCCESS 0x80 #define SUCCESS 0x80
@ -139,11 +141,11 @@ void printFrame(TpFrame *tpframe)
print((tpframe->flags() & TP_FRAME_FLAG_INVALID) ? 'I' : '_'); // Invalid print((tpframe->flags() & TP_FRAME_FLAG_INVALID) ? 'I' : '_'); // Invalid
print((tpframe->flags() & TP_FRAME_FLAG_EXTENDED) ? 'E' : '_'); // Extended print((tpframe->flags() & TP_FRAME_FLAG_EXTENDED) ? 'E' : '_'); // Extended
print((tpframe->flags() & TP_FRAME_FLAG_REPEATED) ? 'R' : '_'); // Repeat print((tpframe->flags() & TP_FRAME_FLAG_REPEATED) ? 'R' : '_'); // Repeat
print((tpframe->flags() & TP_FRAME_FLAG_ECHO) ? 'O' : '_'); // My own print((tpframe->flags() & TP_FRAME_FLAG_ECHO) ? 'T' : '_'); // Send by me
print((tpframe->flags() & 0b00001000) ? 'x' : '_'); // Reserve print((tpframe->flags() & TP_FRAME_FLAG_ADDRESSED) ? 'D' : '_'); // Recv for me
print((tpframe->flags() & TP_FRAME_FLAG_ADDRESSED) ? 'D' : '_'); // For me print((tpframe->flags() & TP_FRAME_FLAG_ACK_NACK) ? 'N' : '_'); // ACK + NACK
print((tpframe->flags() & TP_FRAME_FLAG_ACKING) ? 'A' : '_'); // ACK recevied print((tpframe->flags() & TP_FRAME_FLAG_ACK_BUSY) ? 'B' : '_'); // ACK + BUSY
print((tpframe->flags() & TP_FRAME_FLAG_ACKED) ? 'A' : '_'); // ACK sent print((tpframe->flags() & TP_FRAME_FLAG_ACK) ? 'A' : '_'); // ACK
print("] "); print("] ");
printHex("( ", tpframe->data(), tpframe->size(), false); printHex("( ", tpframe->data(), tpframe->size(), false);
print(")"); print(")");
@ -295,7 +297,13 @@ void TpUartDataLinkLayer::processRxByte()
*/ */
if (_rxFrame->size() > 0) if (_rxFrame->size() > 0)
{ {
_rxFrame->addFlags(TP_FRAME_FLAG_ACKED); if (!(byte & L_ACKN_BUSY_MASK))
_rxFrame->addFlags(TP_FRAME_FLAG_ACK_BUSY);
if (!(byte & L_ACKN_NACK_MASK))
_rxFrame->addFlags(TP_FRAME_FLAG_ACK_NACK);
_rxFrame->addFlags(TP_FRAME_FLAG_ACK);
processRxFrameComplete(); processRxFrameComplete();
} }
// println("L_ACKN_IND"); // println("L_ACKN_IND");
@ -414,7 +422,7 @@ void TpUartDataLinkLayer::processRxFrameByte(uint8_t byte)
if (_txState == TX_IDLE) if (_txState == TX_IDLE)
{ {
// Speichere das ein Acking erfolgen soll // Speichere das ein Acking erfolgen soll
_rxFrame->addFlags(TP_FRAME_FLAG_ACKING); _rxFrame->addFlags(TP_FRAME_FLAG_ACK);
// und im TPUart damit dieser das ACK schicken kann // und im TPUart damit dieser das ACK schicken kann
_platform.writeUart(U_ACK_REQ | U_ACK_REQ_ADRESSED); _platform.writeUart(U_ACK_REQ | U_ACK_REQ_ADRESSED);