bugfix: swap control flow
This commit is contained in:
@@ -352,6 +352,29 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
PHY_INST *phyRef = linkInstPtr->config.phyInstPtr;
|
||||
TMC_INST *tmcRef = linkInstPtr->config.tmcInstPtr;
|
||||
|
||||
if (data[WD_MODE_CMD] == MODE_CMD_HEAD)
|
||||
{
|
||||
// head node config
|
||||
linkConfig.myType = L2_NODE_HEAD;
|
||||
linkConfig.myId = 1;
|
||||
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
||||
}
|
||||
else if (data[WD_MODE_CMD] == MODE_CMD_MEMBER)
|
||||
{
|
||||
// member node config
|
||||
linkConfig.myType = L2_NODE_MEMBER;
|
||||
linkConfig.myId = 2;
|
||||
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME:
|
||||
// Halt linklayer
|
||||
Linklayer_Halt(linkInstPtr);
|
||||
DBG_ERROR("Unexpected config command 0x%02X:0x%02X",
|
||||
WD_MODE_CMD, data[WD_MODE_CMD]);
|
||||
}
|
||||
|
||||
if(data[WD_EN_CMD] == EN_CMD_ON_HIGH_POWER)
|
||||
{
|
||||
// high power config
|
||||
@@ -378,33 +401,9 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
{
|
||||
DBG_ERROR("Physical set pull time failed, with error code: %" PRId32 ".\n", Status);
|
||||
}
|
||||
Phy_SetupNextSlot(phyRef, PHY_TOR_TX, L1_10KBPS_10MS_FRAME, NULL);
|
||||
Phy_SetupNextSlot(phyRef, PHY_TOR_RX, L1_10KBPS_10MS_FRAME, NULL);
|
||||
}
|
||||
|
||||
if (data[WD_MODE_CMD] == MODE_CMD_HEAD)
|
||||
{
|
||||
// head node config
|
||||
linkConfig.myType = L2_NODE_HEAD;
|
||||
linkConfig.myId = 1;
|
||||
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
||||
Linklayer_Start(linkInstPtr);
|
||||
}
|
||||
else if (data[WD_MODE_CMD] == MODE_CMD_MEMBER)
|
||||
{
|
||||
// member node config
|
||||
linkConfig.myType = L2_NODE_MEMBER;
|
||||
linkConfig.myId = 2;
|
||||
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
||||
Linklayer_Start(linkInstPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME:
|
||||
// Halt linklayer
|
||||
Linklayer_Halt(linkInstPtr);
|
||||
DBG_ERROR("Unexpected config command 0x%02X:0x%02X",
|
||||
WD_MODE_CMD, data[WD_MODE_CMD]);
|
||||
}
|
||||
_nop_(); // for debug
|
||||
Status = SUCCESS;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user