Added MS/TP statistics counters for BadCRC and Poll-For-Master. (#1081)
This commit is contained in:
@@ -833,14 +833,17 @@ void dlenv_maintenance_timer(uint16_t elapsed_seconds)
|
||||
dlmstp_fill_statistics(&statistics);
|
||||
fprintf(
|
||||
stderr,
|
||||
"MSTP: Frames Rx:%u/%u/%u Tx:%u PDU Rx:%u Tx:%u Lost:%u\n",
|
||||
"MSTP: Frames Rx:%u/%u/%u Tx:%u PDU Rx:%u Tx:%u "
|
||||
"Lost:%u BadCRC:%u PFM:%u\n",
|
||||
statistics.receive_valid_frame_counter,
|
||||
statistics.receive_valid_frame_not_for_us_counter,
|
||||
statistics.receive_invalid_frame_counter,
|
||||
statistics.transmit_frame_counter,
|
||||
statistics.receive_pdu_counter,
|
||||
statistics.transmit_pdu_counter,
|
||||
statistics.lost_token_counter);
|
||||
statistics.lost_token_counter, statistics.bad_crc_counter,
|
||||
statistics.poll_for_master_counter);
|
||||
|
||||
fflush(stderr);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -400,6 +400,9 @@ uint16_t dlmstp_receive(
|
||||
}
|
||||
if (MSTP_Port->ReceivedValidFrame) {
|
||||
user->Statistics.receive_valid_frame_counter++;
|
||||
if (MSTP_Port->FrameType == FRAME_TYPE_POLL_FOR_MASTER) {
|
||||
user->Statistics.poll_for_master_counter++;
|
||||
}
|
||||
if (user->Valid_Frame_Rx_Callback) {
|
||||
user->Valid_Frame_Rx_Callback(
|
||||
MSTP_Port->SourceAddress, MSTP_Port->DestinationAddress,
|
||||
@@ -418,6 +421,11 @@ uint16_t dlmstp_receive(
|
||||
}
|
||||
if (MSTP_Port->ReceivedInvalidFrame) {
|
||||
user->Statistics.receive_invalid_frame_counter++;
|
||||
if (MSTP_Port->HeaderCRC != 0x55) {
|
||||
user->Statistics.bad_crc_counter++;
|
||||
} else if (MSTP_Port->DataCRC != 0xF0B8) {
|
||||
user->Statistics.bad_crc_counter++;
|
||||
}
|
||||
if (user->Invalid_Frame_Rx_Callback) {
|
||||
user->Invalid_Frame_Rx_Callback(
|
||||
MSTP_Port->SourceAddress, MSTP_Port->DestinationAddress,
|
||||
|
||||
@@ -42,6 +42,8 @@ typedef struct dlmstp_statistics {
|
||||
uint32_t transmit_pdu_counter;
|
||||
uint32_t receive_pdu_counter;
|
||||
uint32_t lost_token_counter;
|
||||
uint32_t bad_crc_counter;
|
||||
uint32_t poll_for_master_counter;
|
||||
} DLMSTP_STATISTICS;
|
||||
|
||||
#ifndef DLMSTP_MAX_INFO_FRAMES
|
||||
|
||||
Reference in New Issue
Block a user