Fixed MS/TP state WAIT_FOR_REPLY to allow reception of any frames that are not known to be not reply frames. (#1103)
This fixes segmented Complex-ACK frames which were dropped. This enables all proprietary frames and any new frames to be recieved to the higher layers.
This commit is contained in:
+15
-10
@@ -795,21 +795,26 @@ static bool MSTP_Master_Node_FSM(void)
|
||||
Master_State =
|
||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||
break;
|
||||
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
|
||||
case FRAME_TYPE_TOKEN:
|
||||
case FRAME_TYPE_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_TEST_REQUEST:
|
||||
/* ReceivedUnexpectedFrame */
|
||||
/* FrameType has a value other than a FrameType
|
||||
known to this node that indicates a reply */
|
||||
Master_State =
|
||||
MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
default:
|
||||
/* ReceivedReply */
|
||||
/* or a proprietary type that indicates
|
||||
a reply */
|
||||
/* indicate successful reception to
|
||||
the higher layers */
|
||||
/* FrameType known to this node that
|
||||
indicates a reply */
|
||||
/* indicate successful reception
|
||||
to the higher layers */
|
||||
MSTP_Flag.ReceivePacketPending = true;
|
||||
Master_State =
|
||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||
break;
|
||||
default:
|
||||
/* if proprietary frame was expected, you might
|
||||
need to transition to DONE WITH TOKEN */
|
||||
Master_State = MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* ReceivedUnexpectedFrame */
|
||||
|
||||
+14
-10
@@ -680,21 +680,25 @@ static bool MSTP_Master_Node_FSM(void)
|
||||
Master_State =
|
||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||
break;
|
||||
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
|
||||
case FRAME_TYPE_TOKEN:
|
||||
case FRAME_TYPE_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_TEST_REQUEST:
|
||||
/* ReceivedUnexpectedFrame */
|
||||
/* FrameType has a value other than a FrameType
|
||||
known to this node that indicates a reply */
|
||||
Master_State = MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
default:
|
||||
/* ReceivedReply */
|
||||
/* or a proprietary type that indicates a reply
|
||||
*/
|
||||
/* indicate successful reception to the higher
|
||||
* layers */
|
||||
/* FrameType known to this node that
|
||||
indicates a reply */
|
||||
/* indicate successful reception
|
||||
to the higher layers */
|
||||
MSTP_Flag.ReceivePacketPending = true;
|
||||
Master_State =
|
||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||
break;
|
||||
default:
|
||||
/* if proprietary frame was expected, you might
|
||||
need to transition to DONE WITH TOKEN */
|
||||
Master_State = MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* ReceivedUnexpectedFrame */
|
||||
|
||||
@@ -817,21 +817,26 @@ static bool MSTP_Master_Node_FSM(void)
|
||||
Master_State =
|
||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||
break;
|
||||
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
|
||||
case FRAME_TYPE_TOKEN:
|
||||
case FRAME_TYPE_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_TEST_REQUEST:
|
||||
/* ReceivedUnexpectedFrame */
|
||||
/* FrameType has a value other than a FrameType
|
||||
known to this node that indicates a reply */
|
||||
Master_State =
|
||||
MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
default:
|
||||
/* ReceivedReply */
|
||||
/* or a proprietary type that indicates
|
||||
a reply */
|
||||
/* indicate successful reception to
|
||||
the higher layers */
|
||||
/* FrameType known to this node that
|
||||
indicates a reply */
|
||||
/* indicate successful reception
|
||||
to the higher layers */
|
||||
MSTP_Flag.ReceivePacketPending = true;
|
||||
Master_State =
|
||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||
break;
|
||||
default:
|
||||
/* if proprietary frame was expected, you might
|
||||
need to transition to DONE WITH TOKEN */
|
||||
Master_State = MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* ReceivedUnexpectedFrame */
|
||||
|
||||
+15
-11
@@ -850,12 +850,22 @@ bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t *mstp_port)
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
|
||||
case FRAME_TYPE_TOKEN:
|
||||
case FRAME_TYPE_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_TEST_REQUEST:
|
||||
/* ReceivedUnexpectedFrame */
|
||||
/* FrameType has a value other than a FrameType
|
||||
known to this node that indicates a reply */
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
default:
|
||||
/* ReceivedReply */
|
||||
/* or a proprietary type that indicates a reply
|
||||
*/
|
||||
/* indicate successful reception to the higher
|
||||
* layers */
|
||||
/* FrameType known to this node that
|
||||
indicates a reply */
|
||||
/* indicate successful reception
|
||||
to the higher layers */
|
||||
dlmstp_put_receive(
|
||||
mstp_port->SourceAddress, /* source MS/TP
|
||||
address */
|
||||
@@ -864,12 +874,6 @@ bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t *mstp_port)
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||
break;
|
||||
default:
|
||||
/* if proprietary frame was expected, you might
|
||||
need to transition to DONE WITH TOKEN */
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* ReceivedUnexpectedFrame */
|
||||
|
||||
+15
-11
@@ -858,12 +858,22 @@ bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t *mstp_port)
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
|
||||
case FRAME_TYPE_TOKEN:
|
||||
case FRAME_TYPE_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_TEST_REQUEST:
|
||||
/* ReceivedUnexpectedFrame */
|
||||
/* FrameType has a value other than a FrameType
|
||||
known to this node that indicates a reply */
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
default:
|
||||
/* ReceivedReply */
|
||||
/* or a proprietary type that indicates a reply
|
||||
*/
|
||||
/* indicate successful reception to the higher
|
||||
* layers */
|
||||
/* FrameType known to this node that
|
||||
indicates a reply */
|
||||
/* indicate successful reception
|
||||
to the higher layers */
|
||||
dlmstp_put_receive(
|
||||
mstp_port->SourceAddress, /* source MS/TP
|
||||
address */
|
||||
@@ -872,12 +882,6 @@ bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t *mstp_port)
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||
break;
|
||||
default:
|
||||
/* if proprietary frame was expected, you might
|
||||
need to transition to DONE WITH TOKEN */
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* ReceivedUnexpectedFrame */
|
||||
|
||||
+15
-13
@@ -836,8 +836,6 @@ bool MSTP_Master_Node_FSM(struct mstp_port_struct_t *mstp_port)
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_WAIT_FOR_REPLY;
|
||||
break;
|
||||
case FRAME_TYPE_TEST_RESPONSE:
|
||||
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
|
||||
default:
|
||||
/* SendNoWait */
|
||||
mstp_port->master_state =
|
||||
@@ -883,22 +881,26 @@ bool MSTP_Master_Node_FSM(struct mstp_port_struct_t *mstp_port)
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||
break;
|
||||
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
|
||||
case FRAME_TYPE_TOKEN:
|
||||
case FRAME_TYPE_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER:
|
||||
case FRAME_TYPE_TEST_REQUEST:
|
||||
/* ReceivedUnexpectedFrame */
|
||||
/* FrameType has a value other than a FrameType
|
||||
known to this node that indicates a reply */
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
default:
|
||||
/* ReceivedReply */
|
||||
/* or a proprietary type that indicates a reply
|
||||
*/
|
||||
/* indicate successful reception to the higher
|
||||
* layers */
|
||||
/* FrameType known to this node that
|
||||
indicates a reply */
|
||||
/* indicate successful reception
|
||||
to the higher layers */
|
||||
(void)MSTP_Put_Receive(mstp_port);
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||
break;
|
||||
default:
|
||||
/* if proprietary frame was expected, you might
|
||||
need to transition to DONE WITH TOKEN */
|
||||
mstp_port->master_state =
|
||||
MSTP_MASTER_STATE_IDLE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* ReceivedUnexpectedFrame */
|
||||
|
||||
Reference in New Issue
Block a user