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 =
|
Master_State =
|
||||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||||
break;
|
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 */
|
/* ReceivedReply */
|
||||||
/* or a proprietary type that indicates
|
/* FrameType known to this node that
|
||||||
a reply */
|
indicates a reply */
|
||||||
/* indicate successful reception to
|
/* indicate successful reception
|
||||||
the higher layers */
|
to the higher layers */
|
||||||
MSTP_Flag.ReceivePacketPending = true;
|
MSTP_Flag.ReceivePacketPending = true;
|
||||||
Master_State =
|
Master_State =
|
||||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
/* if proprietary frame was expected, you might
|
|
||||||
need to transition to DONE WITH TOKEN */
|
|
||||||
Master_State = MSTP_MASTER_STATE_IDLE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* ReceivedUnexpectedFrame */
|
/* ReceivedUnexpectedFrame */
|
||||||
|
|||||||
+14
-10
@@ -680,21 +680,25 @@ static bool MSTP_Master_Node_FSM(void)
|
|||||||
Master_State =
|
Master_State =
|
||||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||||
break;
|
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 */
|
/* ReceivedReply */
|
||||||
/* or a proprietary type that indicates a reply
|
/* FrameType known to this node that
|
||||||
*/
|
indicates a reply */
|
||||||
/* indicate successful reception to the higher
|
/* indicate successful reception
|
||||||
* layers */
|
to the higher layers */
|
||||||
MSTP_Flag.ReceivePacketPending = true;
|
MSTP_Flag.ReceivePacketPending = true;
|
||||||
Master_State =
|
Master_State =
|
||||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
/* if proprietary frame was expected, you might
|
|
||||||
need to transition to DONE WITH TOKEN */
|
|
||||||
Master_State = MSTP_MASTER_STATE_IDLE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* ReceivedUnexpectedFrame */
|
/* ReceivedUnexpectedFrame */
|
||||||
|
|||||||
@@ -817,21 +817,26 @@ static bool MSTP_Master_Node_FSM(void)
|
|||||||
Master_State =
|
Master_State =
|
||||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||||
break;
|
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 */
|
/* ReceivedReply */
|
||||||
/* or a proprietary type that indicates
|
/* FrameType known to this node that
|
||||||
a reply */
|
indicates a reply */
|
||||||
/* indicate successful reception to
|
/* indicate successful reception
|
||||||
the higher layers */
|
to the higher layers */
|
||||||
MSTP_Flag.ReceivePacketPending = true;
|
MSTP_Flag.ReceivePacketPending = true;
|
||||||
Master_State =
|
Master_State =
|
||||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
/* if proprietary frame was expected, you might
|
|
||||||
need to transition to DONE WITH TOKEN */
|
|
||||||
Master_State = MSTP_MASTER_STATE_IDLE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* ReceivedUnexpectedFrame */
|
/* 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_port->master_state =
|
||||||
MSTP_MASTER_STATE_IDLE;
|
MSTP_MASTER_STATE_IDLE;
|
||||||
break;
|
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 */
|
/* ReceivedReply */
|
||||||
/* or a proprietary type that indicates a reply
|
/* FrameType known to this node that
|
||||||
*/
|
indicates a reply */
|
||||||
/* indicate successful reception to the higher
|
/* indicate successful reception
|
||||||
* layers */
|
to the higher layers */
|
||||||
dlmstp_put_receive(
|
dlmstp_put_receive(
|
||||||
mstp_port->SourceAddress, /* source MS/TP
|
mstp_port->SourceAddress, /* source MS/TP
|
||||||
address */
|
address */
|
||||||
@@ -864,12 +874,6 @@ bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t *mstp_port)
|
|||||||
mstp_port->master_state =
|
mstp_port->master_state =
|
||||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||||
break;
|
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 {
|
} else {
|
||||||
/* ReceivedUnexpectedFrame */
|
/* 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_port->master_state =
|
||||||
MSTP_MASTER_STATE_IDLE;
|
MSTP_MASTER_STATE_IDLE;
|
||||||
break;
|
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 */
|
/* ReceivedReply */
|
||||||
/* or a proprietary type that indicates a reply
|
/* FrameType known to this node that
|
||||||
*/
|
indicates a reply */
|
||||||
/* indicate successful reception to the higher
|
/* indicate successful reception
|
||||||
* layers */
|
to the higher layers */
|
||||||
dlmstp_put_receive(
|
dlmstp_put_receive(
|
||||||
mstp_port->SourceAddress, /* source MS/TP
|
mstp_port->SourceAddress, /* source MS/TP
|
||||||
address */
|
address */
|
||||||
@@ -872,12 +882,6 @@ bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t *mstp_port)
|
|||||||
mstp_port->master_state =
|
mstp_port->master_state =
|
||||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||||
break;
|
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 {
|
} else {
|
||||||
/* ReceivedUnexpectedFrame */
|
/* ReceivedUnexpectedFrame */
|
||||||
|
|||||||
+15
-13
@@ -836,8 +836,6 @@ bool MSTP_Master_Node_FSM(struct mstp_port_struct_t *mstp_port)
|
|||||||
mstp_port->master_state =
|
mstp_port->master_state =
|
||||||
MSTP_MASTER_STATE_WAIT_FOR_REPLY;
|
MSTP_MASTER_STATE_WAIT_FOR_REPLY;
|
||||||
break;
|
break;
|
||||||
case FRAME_TYPE_TEST_RESPONSE:
|
|
||||||
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
|
|
||||||
default:
|
default:
|
||||||
/* SendNoWait */
|
/* SendNoWait */
|
||||||
mstp_port->master_state =
|
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_port->master_state =
|
||||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||||
break;
|
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 */
|
/* ReceivedReply */
|
||||||
/* or a proprietary type that indicates a reply
|
/* FrameType known to this node that
|
||||||
*/
|
indicates a reply */
|
||||||
/* indicate successful reception to the higher
|
/* indicate successful reception
|
||||||
* layers */
|
to the higher layers */
|
||||||
(void)MSTP_Put_Receive(mstp_port);
|
(void)MSTP_Put_Receive(mstp_port);
|
||||||
mstp_port->master_state =
|
mstp_port->master_state =
|
||||||
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
MSTP_MASTER_STATE_DONE_WITH_TOKEN;
|
||||||
break;
|
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 {
|
} else {
|
||||||
/* ReceivedUnexpectedFrame */
|
/* ReceivedUnexpectedFrame */
|
||||||
|
|||||||
Reference in New Issue
Block a user