4 Commits
Author SHA1 Message Date
Gatsby Van f4f9bd0125 miscellaneous update 2024-01-29 21:44:32 +08:00
Gatsby Van 06cac2a2ed *bugfix: correct clear routine 2024-01-29 20:39:35 +08:00
Gatsby Van a4106b997c bugfix: swap control flow 2024-01-29 20:39:14 +08:00
Gatsby Van 3463fab14c *bugfix: add missing config update 2024-01-29 20:38:44 +08:00
5 changed files with 33 additions and 32 deletions
+1 -1
View File
@@ -40,7 +40,7 @@
/* Stringify */
#define STR(x) #x
#define _DEBUG_LEVEL 3
// #define _DEBUG_LEVEL 3
#if _DEBUG_LEVEL > 0
#define DBG_PRINT(...) printf(__VA_ARGS__)
+1 -1
View File
@@ -84,7 +84,7 @@ L2_CONFIG linkConfig = {
.tmcInstPtr = NULL
};
// static L2_CONFIG linkConfig = {
// L2_CONFIG linkConfig = {
// .myType = L2_NODE_MEMBER,
// .clustId = 1,
// .myId = 2,
@@ -245,7 +245,7 @@ void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig)
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode)
{
ASSERT(instPtr != NULL);
uint8_t config = instPtr->antConfig.antMode & (~ANT_MODE_BEAM_MASK);
uint8_t config = instPtr->antConfig.antMode & ANT_MODE_BEAM_MASK;
switch (mode)
{
case PHY_ANT_MODE_SILENT:
@@ -259,8 +259,9 @@ void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode)
break;
default:
DBG_ERROR("Unknown antenna mode: %" PRIu8 ", remain previous mode.\n", mode);
break;
return;
}
instPtr->antConfig.antMode = config;
}
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
+25 -26
View File
@@ -351,6 +351,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)
{
@@ -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);
}
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]);
Phy_SetupNextSlot(phyRef, PHY_TOR_RX, L1_10KBPS_10MS_FRAME, NULL);
}
_nop_(); // for debug
Status = SUCCESS;
break;
+3 -2
View File
@@ -60,15 +60,16 @@ void clist_clear(clist_t *self)
clist_node_t *next;
clist_node_t *curr = self->head;
while (len)
while (curr != NULL)
{
next = curr->next;
if (self->free)
self->free(curr->val);
LIST_FREE(curr);
curr = next;
len--;
}
self->len = 0;
self->head = NULL;
}
/*