omit unnecessary reconfiguration

This commit is contained in:
Gatsby Van
2024-02-01 13:45:03 +08:00
parent d0aad73ce5
commit e81be59bbb
+11 -4
View File
@@ -378,22 +378,29 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
PHY_INST *phyRef = linkInstPtr->config.phyInstPtr; PHY_INST *phyRef = linkInstPtr->config.phyInstPtr;
TMC_INST *tmcRef = linkInstPtr->config.tmcInstPtr; TMC_INST *tmcRef = linkInstPtr->config.tmcInstPtr;
if (data[WD_MODE_CMD] == MODE_CMD_HEAD if (data[WD_MODE_CMD] == MODE_CMD_HEAD)
&& L2_GetNodeType(linkInstPtr) != L2_NODE_HEAD) {
// omit unnecessary reconfiguration
if (L2_GetNodeType(linkInstPtr) != L2_NODE_HEAD)
{ {
// head node config // head node config
linkConfig.myType = L2_NODE_HEAD; linkConfig.myType = L2_NODE_HEAD;
linkConfig.myId = 1; linkConfig.myId = 1;
Linklayer_Reconfig(linkInstPtr, &linkConfig); Linklayer_Reconfig(linkInstPtr, &linkConfig);
} }
else if (data[WD_MODE_CMD] == MODE_CMD_MEMBER }
&& L2_GetNodeType(linkInstPtr) != L2_NODE_MEMBER)
else if (data[WD_MODE_CMD] == MODE_CMD_MEMBER )
{
// omit unnecessary reconfiguration
if (L2_GetNodeType(linkInstPtr) != L2_NODE_MEMBER)
{ {
// member node config // member node config
linkConfig.myType = L2_NODE_MEMBER; linkConfig.myType = L2_NODE_MEMBER;
linkConfig.myId = 2; linkConfig.myId = 2;
Linklayer_Reconfig(linkInstPtr, &linkConfig); Linklayer_Reconfig(linkInstPtr, &linkConfig);
} }
}
else else
{ {
// FIXME: to confirm // FIXME: to confirm