Added extra sub-state for MS/TP from Addendum 135-2008v. Tested with ports/bdk-atxx4-mstp/ code on the BACnet Development Kit. Clean compile on src/mstp.c, ports/at91sam7s and ports/atmega168, but untested. All other changes were not compiled or tested.
This commit is contained in:
@@ -866,9 +866,19 @@ static bool MSTP_Master_Node_FSM(
|
|||||||
/* before passing the token. */
|
/* before passing the token. */
|
||||||
Master_State = MSTP_MASTER_STATE_USE_TOKEN;
|
Master_State = MSTP_MASTER_STATE_USE_TOKEN;
|
||||||
transition_now = true;
|
transition_now = true;
|
||||||
}
|
} else if ((MSTP_Flag.SoleMaster == false) &&
|
||||||
/* Npoll changed in Errata SSPC-135-2004 */
|
(Next_Station == This_Station)) {
|
||||||
else if (TokenCount < (Npoll - 1)) {
|
/* NextStationUnknown - added in Addendum 135-2008v-1 */
|
||||||
|
/* then the next station to which the token
|
||||||
|
should be sent is unknown - so PollForMaster */
|
||||||
|
Poll_Station = next_this_station;
|
||||||
|
MSTP_Send_Frame(
|
||||||
|
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
|
||||||
|
This_Station, NULL, 0);
|
||||||
|
RetryCount = 0;
|
||||||
|
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
|
||||||
|
} else if (TokenCount < (Npoll - 1)) {
|
||||||
|
/* Npoll changed in Errata SSPC-135-2004 */
|
||||||
if ((MSTP_Flag.SoleMaster == true) &&
|
if ((MSTP_Flag.SoleMaster == true) &&
|
||||||
(Next_Station != next_this_station)) {
|
(Next_Station != next_this_station)) {
|
||||||
/* SoleMaster */
|
/* SoleMaster */
|
||||||
|
|||||||
@@ -783,6 +783,17 @@ static bool MSTP_Master_Node_FSM(
|
|||||||
/* before passing the token. */
|
/* before passing the token. */
|
||||||
Master_State = MSTP_MASTER_STATE_USE_TOKEN;
|
Master_State = MSTP_MASTER_STATE_USE_TOKEN;
|
||||||
transition_now = true;
|
transition_now = true;
|
||||||
|
} else if ((MSTP_Flag.SoleMaster == false) &&
|
||||||
|
(Next_Station == This_Station)) {
|
||||||
|
/* NextStationUnknown - added in Addendum 135-2008v-1 */
|
||||||
|
/* then the next station to which the token
|
||||||
|
should be sent is unknown - so PollForMaster */
|
||||||
|
Poll_Station = next_this_station;
|
||||||
|
MSTP_Send_Frame(
|
||||||
|
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
|
||||||
|
This_Station, NULL, 0);
|
||||||
|
RetryCount = 0;
|
||||||
|
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
|
||||||
}
|
}
|
||||||
/* Npoll changed in Errata SSPC-135-2004 */
|
/* Npoll changed in Errata SSPC-135-2004 */
|
||||||
else if (TokenCount < (Npoll - 1)) {
|
else if (TokenCount < (Npoll - 1)) {
|
||||||
|
|||||||
@@ -888,6 +888,17 @@ static bool MSTP_Master_Node_FSM(
|
|||||||
/* before passing the token. */
|
/* before passing the token. */
|
||||||
Master_State = MSTP_MASTER_STATE_USE_TOKEN;
|
Master_State = MSTP_MASTER_STATE_USE_TOKEN;
|
||||||
transition_now = true;
|
transition_now = true;
|
||||||
|
} else if ((MSTP_Flag.SoleMaster == false) &&
|
||||||
|
(Next_Station == This_Station)) {
|
||||||
|
/* NextStationUnknown - added in Addendum 135-2008v-1 */
|
||||||
|
/* then the next station to which the token
|
||||||
|
should be sent is unknown - so PollForMaster */
|
||||||
|
Poll_Station = next_this_station;
|
||||||
|
MSTP_Send_Frame(
|
||||||
|
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
|
||||||
|
This_Station, NULL, 0);
|
||||||
|
RetryCount = 0;
|
||||||
|
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
|
||||||
}
|
}
|
||||||
/* Npoll changed in Errata SSPC-135-2004 */
|
/* Npoll changed in Errata SSPC-135-2004 */
|
||||||
else if (TokenCount < (Npoll - 1)) {
|
else if (TokenCount < (Npoll - 1)) {
|
||||||
|
|||||||
@@ -884,6 +884,17 @@ static bool MSTP_Master_Node_FSM(
|
|||||||
/* before passing the token. */
|
/* before passing the token. */
|
||||||
Master_State = MSTP_MASTER_STATE_USE_TOKEN;
|
Master_State = MSTP_MASTER_STATE_USE_TOKEN;
|
||||||
transition_now = true;
|
transition_now = true;
|
||||||
|
} else if ((MSTP_Flag.SoleMaster == false) &&
|
||||||
|
(Next_Station == This_Station)) {
|
||||||
|
/* NextStationUnknown - added in Addendum 135-2008v-1 */
|
||||||
|
/* then the next station to which the token
|
||||||
|
should be sent is unknown - so PollForMaster */
|
||||||
|
Poll_Station = next_this_station;
|
||||||
|
MSTP_Send_Frame(
|
||||||
|
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
|
||||||
|
This_Station, NULL, 0);
|
||||||
|
RetryCount = 0;
|
||||||
|
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
|
||||||
}
|
}
|
||||||
/* Npoll changed in Errata SSPC-135-2004 */
|
/* Npoll changed in Errata SSPC-135-2004 */
|
||||||
else if (TokenCount < (Npoll - 1)) {
|
else if (TokenCount < (Npoll - 1)) {
|
||||||
|
|||||||
@@ -799,6 +799,17 @@ bool MSTP_Master_Node_FSM(
|
|||||||
/* before passing the token. */
|
/* before passing the token. */
|
||||||
mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN;
|
mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN;
|
||||||
transition_now = true;
|
transition_now = true;
|
||||||
|
} else if ((MSTP_Flag.SoleMaster == false) &&
|
||||||
|
(Next_Station == This_Station)) {
|
||||||
|
/* NextStationUnknown - added in Addendum 135-2008v-1 */
|
||||||
|
/* then the next station to which the token
|
||||||
|
should be sent is unknown - so PollForMaster */
|
||||||
|
Poll_Station = next_this_station;
|
||||||
|
MSTP_Send_Frame(
|
||||||
|
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
|
||||||
|
This_Station, NULL, 0);
|
||||||
|
RetryCount = 0;
|
||||||
|
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
|
||||||
}
|
}
|
||||||
/* Npoll changed in Errata SSPC-135-2004 */
|
/* Npoll changed in Errata SSPC-135-2004 */
|
||||||
else if (mstp_port->TokenCount < (Npoll - 1)) {
|
else if (mstp_port->TokenCount < (Npoll - 1)) {
|
||||||
|
|||||||
@@ -938,6 +938,17 @@ bool MSTP_Master_Node_FSM(
|
|||||||
/* then this node may send another information frame */
|
/* then this node may send another information frame */
|
||||||
/* before passing the token. */
|
/* before passing the token. */
|
||||||
mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN;
|
mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN;
|
||||||
|
} else if ((mstp_port->SoleMaster == false) &&
|
||||||
|
(mstp_port->Next_Station == mstp_port->This_Station)) {
|
||||||
|
/* NextStationUnknown - added in Addendum 135-2008v-1 */
|
||||||
|
/* then the next station to which the token
|
||||||
|
should be sent is unknown - so PollForMaster */
|
||||||
|
mstp_port->Poll_Station = next_this_station;
|
||||||
|
MSTP_Create_And_Send_Frame(mstp_port,
|
||||||
|
FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station,
|
||||||
|
mstp_port->This_Station, NULL, 0);
|
||||||
|
mstp_port->RetryCount = 0;
|
||||||
|
mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER;
|
||||||
}
|
}
|
||||||
/* Npoll changed in Errata SSPC-135-2004 */
|
/* Npoll changed in Errata SSPC-135-2004 */
|
||||||
else if (mstp_port->TokenCount < (Npoll - 1)) {
|
else if (mstp_port->TokenCount < (Npoll - 1)) {
|
||||||
|
|||||||
@@ -795,6 +795,17 @@ bool MSTP_Master_Node_FSM(
|
|||||||
/* before passing the token. */
|
/* before passing the token. */
|
||||||
mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN;
|
mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN;
|
||||||
transition_now = true;
|
transition_now = true;
|
||||||
|
} else if ((mstp_port->SoleMaster == false) &&
|
||||||
|
(mstp_port->Next_Station == mstp_port->This_Station)) {
|
||||||
|
/* NextStationUnknown - added in Addendum 135-2008v-1 */
|
||||||
|
/* then the next station to which the token
|
||||||
|
should be sent is unknown - so PollForMaster */
|
||||||
|
mstp_port->Poll_Station = next_this_station;
|
||||||
|
MSTP_Create_And_Send_Frame(mstp_port,
|
||||||
|
FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station,
|
||||||
|
mstp_port->This_Station, NULL, 0);
|
||||||
|
mstp_port->RetryCount = 0;
|
||||||
|
mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER;
|
||||||
} else if (mstp_port->TokenCount < (Npoll - 1)) {
|
} else if (mstp_port->TokenCount < (Npoll - 1)) {
|
||||||
/* Npoll changed in Errata SSPC-135-2004 */
|
/* Npoll changed in Errata SSPC-135-2004 */
|
||||||
if ((mstp_port->SoleMaster == true) &&
|
if ((mstp_port->SoleMaster == true) &&
|
||||||
|
|||||||
Reference in New Issue
Block a user