Compare commits
4
Commits
246d54755a
...
f4f9bd0125
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4f9bd0125 | ||
|
|
06cac2a2ed | ||
|
|
a4106b997c | ||
|
|
3463fab14c |
@@ -40,7 +40,7 @@
|
|||||||
/* Stringify */
|
/* Stringify */
|
||||||
#define STR(x) #x
|
#define STR(x) #x
|
||||||
|
|
||||||
#define _DEBUG_LEVEL 3
|
// #define _DEBUG_LEVEL 3
|
||||||
|
|
||||||
#if _DEBUG_LEVEL > 0
|
#if _DEBUG_LEVEL > 0
|
||||||
#define DBG_PRINT(...) printf(__VA_ARGS__)
|
#define DBG_PRINT(...) printf(__VA_ARGS__)
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ L2_CONFIG linkConfig = {
|
|||||||
.tmcInstPtr = NULL
|
.tmcInstPtr = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// static L2_CONFIG linkConfig = {
|
// L2_CONFIG linkConfig = {
|
||||||
// .myType = L2_NODE_MEMBER,
|
// .myType = L2_NODE_MEMBER,
|
||||||
// .clustId = 1,
|
// .clustId = 1,
|
||||||
// .myId = 2,
|
// .myId = 2,
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig)
|
|||||||
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode)
|
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode)
|
||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
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)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case PHY_ANT_MODE_SILENT:
|
case PHY_ANT_MODE_SILENT:
|
||||||
@@ -259,8 +259,9 @@ void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBG_ERROR("Unknown antenna mode: %" PRIu8 ", remain previous mode.\n", mode);
|
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)
|
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
|
||||||
|
|||||||
@@ -352,6 +352,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)
|
||||||
|
{
|
||||||
|
// 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)
|
if(data[WD_EN_CMD] == EN_CMD_ON_HIGH_POWER)
|
||||||
{
|
{
|
||||||
// high power config
|
// 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);
|
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
|
_nop_(); // for debug
|
||||||
Status = SUCCESS;
|
Status = SUCCESS;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -60,15 +60,16 @@ void clist_clear(clist_t *self)
|
|||||||
clist_node_t *next;
|
clist_node_t *next;
|
||||||
clist_node_t *curr = self->head;
|
clist_node_t *curr = self->head;
|
||||||
|
|
||||||
while (len)
|
while (curr != NULL)
|
||||||
{
|
{
|
||||||
next = curr->next;
|
next = curr->next;
|
||||||
if (self->free)
|
if (self->free)
|
||||||
self->free(curr->val);
|
self->free(curr->val);
|
||||||
LIST_FREE(curr);
|
LIST_FREE(curr);
|
||||||
curr = next;
|
curr = next;
|
||||||
len--;
|
|
||||||
}
|
}
|
||||||
|
self->len = 0;
|
||||||
|
self->head = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user