Compare commits
37
Commits
b5f920b4f3
...
alpha-0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f75b519e0 | ||
|
|
7e38cf59e2 | ||
|
|
86d089e2b4 | ||
|
|
5cefee63f8 | ||
|
|
1647f4b97c | ||
|
|
1b1790657a | ||
|
|
da212a47e7 | ||
|
|
49e962612e | ||
|
|
64c116dbe0 | ||
|
|
a13ded2a89 | ||
|
|
949d0d7049 | ||
|
|
ec56ec6f6f | ||
|
|
f4f9bd0125 | ||
|
|
06cac2a2ed | ||
|
|
a4106b997c | ||
|
|
3463fab14c | ||
|
|
246d54755a | ||
|
|
c5f64ada29 | ||
|
|
b4a88711d7 | ||
|
|
3f10a1cbe4 | ||
|
|
1555c7493c | ||
|
|
b87bcb8fb7 | ||
|
|
9afd439852 | ||
|
|
017886bf00 | ||
|
|
2f0ee92e33 | ||
|
|
0496e6a2f6 | ||
|
|
463836b92a | ||
|
|
8b2fcfb810 | ||
|
|
ddf42c6543 | ||
|
|
03aec683ef | ||
|
|
bbf5aad749 | ||
|
|
0882d94071 | ||
|
|
90a48b908b | ||
|
|
89ef050cc2 | ||
|
|
683940b5ff | ||
|
|
9c6b3a64c8 | ||
|
|
43df6dd7af |
+5
-1
@@ -50,4 +50,8 @@
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
dkms.conf
|
||||
|
||||
# MacOS .DS_Store file
|
||||
**/.DS_Store
|
||||
**/._.DS_Store
|
||||
@@ -989,7 +989,7 @@ int HW_9371LargeFrequencyChange(mykonosDevice_t *mykDevice, uint64_t freq_Hz)
|
||||
// HW_9371LargeFrequencyChange(&mykDevice, NewFreqHz);
|
||||
// }
|
||||
// mykDevice.tx->txPllLoFrequency_Hz = NewFreqHz;
|
||||
// printf("New Tx frequency set to %ld Hz!\n",NewFreqHz);
|
||||
// printf("New Tx frequency set to %d Hz!\n",NewFreqHz);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
@@ -1017,7 +1017,7 @@ int HW_9371LargeFrequencyChange(mykonosDevice_t *mykDevice, uint64_t freq_Hz)
|
||||
// HW_9371LargeFrequencyChange(&mykDevice, NewFreqHz);
|
||||
// }
|
||||
// mykDevice.rx->rxPllLoFrequency_Hz = NewFreqHz;
|
||||
// printf("New Rx frequency set to %ld Hz!\n",NewFreqHz);
|
||||
// printf("New Rx frequency set to %d Hz!\n",NewFreqHz);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <assert.h>
|
||||
#include "util.h"
|
||||
#include "error.h"
|
||||
|
||||
+31
-30
@@ -49,6 +49,7 @@ void Phy_IntrHandler(void *context);
|
||||
void PeriodicPull_Handler(void *callBackRef);
|
||||
void ScuTimer_IntrHandler(void *context);
|
||||
void Systembus_RxIntrHandler(void *context);
|
||||
void Systembus_TxIntrHandler(void *context);
|
||||
/************************** Constant Definitions *****************************/
|
||||
struct callback_desc phy_callback_desc = {
|
||||
.callback = Phy_IntrHandler,
|
||||
@@ -67,7 +68,7 @@ struct callback_desc sysbus_rx_callback_desc = {
|
||||
};
|
||||
|
||||
struct callback_desc sysbus_tx_callback_desc = {
|
||||
.callback = Systembus_RxIntrHandler,
|
||||
.callback = Systembus_TxIntrHandler,
|
||||
.ctx = NULL
|
||||
};
|
||||
|
||||
@@ -76,25 +77,25 @@ struct callback_desc scutm_callback_desc = {
|
||||
.ctx = NULL
|
||||
};
|
||||
|
||||
static L2_CONFIG linkConfig = {
|
||||
L2_CONFIG linkConfig = {
|
||||
.myType = L2_NODE_HEAD,
|
||||
.clustId = 1,
|
||||
.myId = 1,
|
||||
.headId = 1,
|
||||
.bkpHeadId = 0,
|
||||
.netScale = 2,
|
||||
.phyInstPtr = NULL, // pyhsical layer reference
|
||||
.phyInstPtr = NULL, // physical layer reference
|
||||
.tmcInstPtr = NULL
|
||||
};
|
||||
|
||||
// static L2_CONFIG linkConfig = {
|
||||
// L2_CONFIG linkConfig = {
|
||||
// .myType = L2_NODE_MEMBER,
|
||||
// .clustId = 1,
|
||||
// .myId = 2,
|
||||
// .headId = 1,
|
||||
// .bkpHeadId = 0,
|
||||
// .netScale = 2,
|
||||
// .phyInstPtr = NULL, // pyhsical layer reference
|
||||
// .phyInstPtr = NULL, // physical layer reference
|
||||
// .tmcInstPtr = NULL
|
||||
// };
|
||||
|
||||
@@ -123,7 +124,7 @@ static struct timer_desc *logTmPtr;
|
||||
static SYSBUS *sysbusDescPtr;
|
||||
static PHY_INST *phyInstPtr;
|
||||
static TMC_INST *tmcInstPtr = NULL;
|
||||
static L2_INST *linkInstPtr;
|
||||
L2_INST *linkInstPtr;
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
@@ -145,7 +146,7 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_ctrl_init(&descPtr, &intc_init_param);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Intc Init FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("Intc Init FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -159,21 +160,21 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_trigger_level_set(descPtr, PHY_INTR_ID, IRQ_EDGE_RISING);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
// Set highest interrupt priority
|
||||
Status = irq_set_priority(descPtr, PHY_INTR_ID, 0x08);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
// Connect the interrupt service routine isr1 to the interrupt controller
|
||||
Status = irq_register_callback(descPtr, PHY_INTR_ID, &phy_callback_desc);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -181,21 +182,21 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_trigger_level_set(descPtr, PERIODIC_5MS_INTR_ID, IRQ_EDGE_RISING);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PERIODIC_5MS_INTR_ID trigger level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PERIODIC_5MS_INTR_ID trigger level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
// Set highest interrupt priority
|
||||
Status = irq_set_priority(descPtr, PERIODIC_5MS_INTR_ID, 0x00);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PERIODIC_5MS_INTR_ID priority level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PERIODIC_5MS_INTR_ID priority level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
// Connect the interrupt service routine isr1 to the interrupt controller
|
||||
Status = irq_register_callback(descPtr, PERIODIC_5MS_INTR_ID, &periodicpull_callback_desc);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -203,14 +204,14 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
// Status = irq_trigger_level_set(descPtr, SYSBUS_TX_INTR_ID, IRQ_EDGE_RISING);
|
||||
// if (Status != SUCCESS)
|
||||
// {
|
||||
// DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
// DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
// return Status;
|
||||
// }
|
||||
// // Set interrupt priority
|
||||
// Status = irq_set_priority(descPtr, SYSBUS_TX_INTR_ID, 0x10);
|
||||
// if (Status != SUCCESS)
|
||||
// {
|
||||
// DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
// DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
// return Status;
|
||||
// }
|
||||
//
|
||||
@@ -218,20 +219,20 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
// Status = irq_register_callback(descPtr, SYSBUS_TX_INTR_ID, &sysbus_tx_callback_desc);
|
||||
// if (Status != SUCCESS)
|
||||
// {
|
||||
// DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %ld.\n", Status);
|
||||
// DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
// return Status;
|
||||
// }
|
||||
// Status = irq_trigger_level_set(descPtr, SYSBUS_RX_INTR_ID, IRQ_EDGE_RISING);
|
||||
// if (Status != SUCCESS)
|
||||
// {
|
||||
// DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
// DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
// return Status;
|
||||
// }
|
||||
// // Set interrupt priority
|
||||
// Status = irq_set_priority(descPtr, SYSBUS_RX_INTR_ID, 0x18);
|
||||
// if (Status != SUCCESS)
|
||||
// {
|
||||
// DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
// DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
// return Status;
|
||||
// }
|
||||
//
|
||||
@@ -239,7 +240,7 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
// Status = irq_register_callback(descPtr, SYSBUS_RX_INTR_ID, &sysbus_rx_callback_desc);
|
||||
// if (Status != SUCCESS)
|
||||
// {
|
||||
// DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %ld.\n", Status);
|
||||
// DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
// return Status;
|
||||
// }
|
||||
//
|
||||
@@ -248,7 +249,7 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
// Status = irq_register_callback(descPtr, SCUTIMER_INTR_ID, &scutm_callback_desc);
|
||||
// if (Status != SUCCESS)
|
||||
// {
|
||||
// DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %ld.\n", Status);
|
||||
// DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
// return Status;
|
||||
// }
|
||||
|
||||
@@ -263,7 +264,7 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_global_enable(descPtr);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("IRQ global enable FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("IRQ global enable FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
return SUCCESS;
|
||||
@@ -300,7 +301,7 @@ void PeriodicPull_Handler(void *callBackRef)
|
||||
Status = Linklayer_Proc(linkInstPtr);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Link layer runs failed, with error code: %ld\n", Status);
|
||||
DBG_ERROR("Link layer runs failed, with error code: %" PRId32 "\n", Status);
|
||||
_nop_();
|
||||
}
|
||||
} // PeriodicPull_Handler
|
||||
@@ -320,7 +321,7 @@ void Systembus_RxIntrHandler(void *context)
|
||||
Status = SystemBus_RxIntrHandler(sysbusDescPtr);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("SystemBus_RxIntrHandler exit with error code %ld,\n", Status);
|
||||
DBG_ERROR("SystemBus_RxIntrHandler exit with error code %" PRId32 ",\n", Status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +340,7 @@ void Systembus_TxIntrHandler(void *context)
|
||||
Status = SystemBus_TxIntrHandler(sysbusDescPtr);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("SystemBus_TxIntrHandler exit with error code %ld,\n", Status);
|
||||
DBG_ERROR("SystemBus_TxIntrHandler exit with error code %" PRId32 ",\n", Status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +381,7 @@ void ScuTimer_IntrHandler(void *context)
|
||||
******************************************************************************/
|
||||
int main(void)
|
||||
{
|
||||
int Status;
|
||||
int32_t Status;
|
||||
DBG_PRINT("Application Version: %2d.%2d.%4d.\n", _APP_VER_MAIN, _APP_VER_MINOR, _APP_VER_PATCH);
|
||||
|
||||
/* System Monitor Initialize */
|
||||
@@ -448,7 +449,7 @@ int main(void)
|
||||
// Status = SystemBus_Init(&sysbusDescPtr, &sysbusConfig);
|
||||
// if (Status != SUCCESS)
|
||||
// {
|
||||
// DBG_ERROR("Systembus init FAILED, with error code: %d\n", Status);
|
||||
// DBG_ERROR("Systembus init FAILED, with error code: %" PRId32 "\n", Status);
|
||||
// return Status;
|
||||
// }
|
||||
|
||||
@@ -456,7 +457,7 @@ int main(void)
|
||||
Status = timer_init(&logTmPtr, &scutimer_init_param);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("SCU Timer init FAILED, with error code: %d\n", Status);
|
||||
DBG_ERROR("SCU Timer init FAILED, with error code: %" PRId32 "\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -468,7 +469,7 @@ int main(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_ERROR("Interrupt system setup FAILED, ErrorCode: %d.\n", Status);
|
||||
DBG_ERROR("Interrupt system setup FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -490,7 +491,7 @@ int main(void)
|
||||
// Status = SystemBus_HandleCmd(sysbusDescPtr);
|
||||
// if (Status != SUCCESS)
|
||||
// {
|
||||
// DBG_ERROR("SystemBus_HandleCmd exit with ErrorCode: %d.\n", Status);
|
||||
// DBG_ERROR("SystemBus_HandleCmd exit with ErrorCode: %" PRId32 ".\n", Status);
|
||||
// }
|
||||
// }
|
||||
// if (SystemBus_IsRsqPendding(sysbusDescPtr) && (!SystemBus_IsTxBusy(sysbusDescPtr)))
|
||||
@@ -500,7 +501,7 @@ int main(void)
|
||||
// Status = SystemBus_MakeResp(sysbusDescPtr);
|
||||
// if (Status != SUCCESS)
|
||||
// {
|
||||
// DBG_ERROR("SystemBus_HandleCmd exit with ErrorCode: %d.\n", Status);
|
||||
// DBG_ERROR("SystemBus_HandleCmd exit with ErrorCode: %" PRId32 ".\n", Status);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <assert.h>
|
||||
#include "util.h"
|
||||
#include "error.h"
|
||||
|
||||
+34
-33
@@ -45,6 +45,7 @@ void Phy_IntrHandler(void *context);
|
||||
void PeriodicPull_Handler(void *callBackRef);
|
||||
void ScuTimer_IntrHandler(void *context);
|
||||
void Systembus_RxIntrHandler(void *context);
|
||||
void Systembus_TxIntrHandler(void *context);
|
||||
/************************** Constant Definitions *****************************/
|
||||
struct callback_desc phy_callback_desc = {
|
||||
.callback = Phy_IntrHandler,
|
||||
@@ -63,7 +64,7 @@ struct callback_desc sysbus_rx_callback_desc = {
|
||||
};
|
||||
|
||||
struct callback_desc sysbus_tx_callback_desc = {
|
||||
.callback = Systembus_RxIntrHandler,
|
||||
.callback = Systembus_TxIntrHandler,
|
||||
.ctx = NULL
|
||||
};
|
||||
|
||||
@@ -72,25 +73,25 @@ struct callback_desc scutm_callback_desc = {
|
||||
.ctx = NULL
|
||||
};
|
||||
|
||||
static L2_CONFIG linkConfig = {
|
||||
L2_CONFIG linkConfig = {
|
||||
.myType = L2_NODE_HEAD,
|
||||
.clustId = 1,
|
||||
.myId = 1,
|
||||
.headId = 1,
|
||||
.bkpHeadId = 0,
|
||||
.netScale = 2,
|
||||
.phyInstPtr = NULL, // pyhsical layer reference
|
||||
.phyInstPtr = NULL, // physical layer reference
|
||||
.tmcInstPtr = NULL
|
||||
};
|
||||
|
||||
// static L2_CONFIG linkConfig = {
|
||||
// L2_CONFIG linkConfig = {
|
||||
// .myType = L2_NODE_MEMBER,
|
||||
// .clustId = 1,
|
||||
// .myId = 2,
|
||||
// .headId = 1,
|
||||
// .bkpHeadId = 0,
|
||||
// .netScale = 2,
|
||||
// .phyInstPtr = NULL, // pyhsical layer reference
|
||||
// .phyInstPtr = NULL, // physical layer reference
|
||||
// .tmcInstPtr = NULL
|
||||
// };
|
||||
|
||||
@@ -119,7 +120,7 @@ static struct timer_desc *logTmPtr;
|
||||
static SYSBUS *sysbusDescPtr;
|
||||
static PHY_INST *phyInstPtr;
|
||||
static TMC_INST *tmcInstPtr = NULL;
|
||||
static L2_INST *linkInstPtr;
|
||||
L2_INST *linkInstPtr;
|
||||
|
||||
static struct hmc7044_dev *hmc7044_inst;
|
||||
static struct ad9361_reg_dev *ad9361_1_reg_inst;
|
||||
@@ -146,7 +147,7 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_ctrl_init(&descPtr, &intc_init_param);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Intc Init FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("Intc Init FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -160,21 +161,21 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_trigger_level_set(descPtr, PHY_INTR_ID, IRQ_EDGE_RISING);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
// Set highest interrupt priority
|
||||
Status = irq_set_priority(descPtr, PHY_INTR_ID, 0x08);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
// Connect the interrupt service routine isr1 to the interrupt controller
|
||||
Status = irq_register_callback(descPtr, PHY_INTR_ID, &phy_callback_desc);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -182,21 +183,21 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_trigger_level_set(descPtr, PERIODIC_5MS_INTR_ID, IRQ_EDGE_RISING);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PERIODIC_5MS_INTR_ID trigger level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PERIODIC_5MS_INTR_ID trigger level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
// Set highest interrupt priority
|
||||
Status = irq_set_priority(descPtr, PERIODIC_5MS_INTR_ID, 0x00);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PERIODIC_5MS_INTR_ID priority level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PERIODIC_5MS_INTR_ID priority level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
// Connect the interrupt service routine isr1 to the interrupt controller
|
||||
Status = irq_register_callback(descPtr, PERIODIC_5MS_INTR_ID, &periodicpull_callback_desc);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -204,14 +205,14 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_trigger_level_set(descPtr, SYSBUS_TX_INTR_ID, IRQ_EDGE_RISING);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
// Set interrupt priority
|
||||
Status = irq_set_priority(descPtr, SYSBUS_TX_INTR_ID, 0x10);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -219,20 +220,20 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_register_callback(descPtr, SYSBUS_TX_INTR_ID, &sysbus_tx_callback_desc);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
Status = irq_trigger_level_set(descPtr, SYSBUS_RX_INTR_ID, IRQ_EDGE_RISING);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR trigger level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
// Set interrupt priority
|
||||
Status = irq_set_priority(descPtr, SYSBUS_RX_INTR_ID, 0x18);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR priority level set FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -240,7 +241,7 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_register_callback(descPtr, SYSBUS_RX_INTR_ID, &sysbus_rx_callback_desc);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -249,7 +250,7 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_register_callback(descPtr, SCUTIMER_INTR_ID, &scutm_callback_desc);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("PHY_INTR register callback FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -264,7 +265,7 @@ int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
|
||||
Status = irq_global_enable(descPtr);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("IRQ global enable FAILED, ErrorCode: %ld.\n", Status);
|
||||
DBG_ERROR("IRQ global enable FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
return SUCCESS;
|
||||
@@ -301,7 +302,7 @@ void PeriodicPull_Handler(void *callBackRef)
|
||||
Status = Linklayer_Proc(linkInstPtr);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Link layer runs failed, with error code: %ld\n", Status);
|
||||
DBG_ERROR("Link layer runs failed, with error code: %" PRId32 "\n", Status);
|
||||
_nop_();
|
||||
}
|
||||
} // PeriodicPull_Handler
|
||||
@@ -321,7 +322,7 @@ void Systembus_RxIntrHandler(void *context)
|
||||
Status = SystemBus_RxIntrHandler(sysbusDescPtr);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("SystemBus_RxIntrHandler exit with error code %ld,\n", Status);
|
||||
DBG_ERROR("SystemBus_RxIntrHandler exit with error code %" PRId32 ",\n", Status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +341,7 @@ void Systembus_TxIntrHandler(void *context)
|
||||
Status = SystemBus_TxIntrHandler(sysbusDescPtr);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("SystemBus_TxIntrHandler exit with error code %ld,\n", Status);
|
||||
DBG_ERROR("SystemBus_TxIntrHandler exit with error code %" PRId32 ",\n", Status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +567,7 @@ int Hardware_Init(void)
|
||||
Status = hmc7044_init(&hmc7044_inst, &hmc7044_default_init_param);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("hmc7044_init() error: %ld\n", Status);
|
||||
DBG_ERROR("hmc7044_init() error: %" PRId32 "\n", Status);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -730,7 +731,7 @@ int Hardware_Init(void)
|
||||
******************************************************************************/
|
||||
int main(void)
|
||||
{
|
||||
int Status;
|
||||
int32_t Status;
|
||||
DBG_PRINT("Application Version: %2d.%2d.%4d.\n", _APP_VER_MAIN, _APP_VER_MINOR, _APP_VER_PATCH);
|
||||
|
||||
/* System Monitor Initialize */
|
||||
@@ -799,7 +800,7 @@ int main(void)
|
||||
Status = SystemBus_Init(&sysbusDescPtr, &sysbusConfig);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Systembus init FAILED, with error code: %d\n", Status);
|
||||
DBG_ERROR("Systembus init FAILED, with error code: %" PRId32 "\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -807,7 +808,7 @@ int main(void)
|
||||
Status = timer_init(&logTmPtr, &scutimer_init_param);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("SCU Timer init FAILED, with error code: %d\n", Status);
|
||||
DBG_ERROR("SCU Timer init FAILED, with error code: %" PRId32 "\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -819,7 +820,7 @@ int main(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_ERROR("Interrupt system setup FAILED, ErrorCode: %d.\n", Status);
|
||||
DBG_ERROR("Interrupt system setup FAILED, ErrorCode: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -829,7 +830,7 @@ int main(void)
|
||||
DBG_PRINT("Physical started...\n");
|
||||
Phy_Start(phyInstPtr);
|
||||
|
||||
Linklayer_Start(linkInstPtr);
|
||||
// Linklayer_Start(linkInstPtr);
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -839,17 +840,17 @@ int main(void)
|
||||
Status = SystemBus_HandleCmd(sysbusDescPtr);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("SystemBus_HandleCmd exit with ErrorCode: %d.\n", Status);
|
||||
DBG_ERROR("SystemBus_HandleCmd exit with ErrorCode: %" PRId32 ".\n", Status);
|
||||
}
|
||||
}
|
||||
if (SystemBus_IsRsqPendding(sysbusDescPtr) && (!SystemBus_IsTxBusy(sysbusDescPtr)))
|
||||
{
|
||||
// FIXME: Required by 12 (CASC)
|
||||
udelay(200);
|
||||
udelay(4000);
|
||||
Status = SystemBus_MakeResp(sysbusDescPtr);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("SystemBus_HandleCmd exit with ErrorCode: %d.\n", Status);
|
||||
DBG_ERROR("SystemBus_HandleCmd exit with ErrorCode: %" PRId32 ".\n", Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ static void L2_DataAvailUpdate(L2_INST *instPtr, bool status);
|
||||
static inline void UpdateMainSate(L2_INST *instPtr, L2_NODE_STATE newSate)
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
DBG_INFO("MainStateUpdate: %d -> %d\n", instPtr->mainState, newSate);
|
||||
DBG_INFO("MainStateUpdate: %" PRId8 " -> %" PRId8 "\n", instPtr->mainState, newSate);
|
||||
instPtr->nextState = newSate;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ static inline void UpdateMainSate(L2_INST *instPtr, L2_NODE_STATE newSate)
|
||||
static void L2_SetSlotNum(L2_INST *instPtr, uint32_t newSlotNum)
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
DBG_INFO("Set new slot number to %u\n", newSlotNum);
|
||||
DBG_INFO("Set new slot number to %" PRIu32 "\n", newSlotNum);
|
||||
instPtr->slotNum.next = newSlotNum;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ static void L2_SetSlotNum(L2_INST *instPtr, uint32_t newSlotNum)
|
||||
static void L2_SetFrameNum(L2_INST *instPtr, uint32_t newFrameNum)
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
DBG_INFO("Set new frame number to %u\n", newFrameNum);
|
||||
DBG_INFO("Set new frame number to %" PRIu32 "\n", newFrameNum);
|
||||
instPtr->frameNum.next = newFrameNum;
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ void L2_FrameStateUpdate(L2_INST *instPtr)
|
||||
else
|
||||
{
|
||||
DBG_INFO("A frame received, checking data validation...\n");
|
||||
DBG_INFO("Last frame type is: %u.\n", instPtr->frame.last);
|
||||
DBG_INFO("Last frame type is: %" PRId32 ".\n", instPtr->frame.last);
|
||||
Phy_RetrieveRecvData(phyRef, instPtr->recvPktData);
|
||||
instPtr->log.frameRecv++;
|
||||
|
||||
@@ -353,9 +353,13 @@ void L2_FrameStateUpdate(L2_INST *instPtr)
|
||||
case L2_SCAN_FRAME:
|
||||
case L2_ADV_FRAME:
|
||||
isValid = L2_CrcCheck(instPtr->recvPktData, L2_ADV_PACK_LEN, L2_CRC16_1021);
|
||||
instPtr->log.advRecvCnt++;
|
||||
instPtr->log.advCorrectCnt = isValid ? instPtr->log.advCorrectCnt + 1 : instPtr->log.advCorrectCnt;
|
||||
break;
|
||||
case L2_CFM_FRAME:
|
||||
isValid = L2_CrcCheck(instPtr->recvPktData, L2_CMF_PACK_LEN, L2_CRC16_1021);
|
||||
instPtr->log.cfmRecvCnt++;
|
||||
instPtr->log.cfmCorrectCnt = isValid ? instPtr->log.cfmCorrectCnt + 1 : instPtr->log.cfmCorrectCnt;
|
||||
break;
|
||||
case L2_SVC_FRAME:
|
||||
#ifndef DATALINK_ENABLE_BERTEST
|
||||
@@ -363,6 +367,8 @@ void L2_FrameStateUpdate(L2_INST *instPtr)
|
||||
#else
|
||||
isValid = true;
|
||||
#endif
|
||||
instPtr->log.svcRecvCnt++;
|
||||
instPtr->log.svcCorrectCnt = isValid ? instPtr->log.svcCorrectCnt + 1 : instPtr->log.svcCorrectCnt;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -451,7 +457,7 @@ int32_t L2_SteerBeam2Node(L2_INST *instPtr, uint8_t nodeId)
|
||||
Status = L2_GetNodePos(instPtr->nodeList, nodeId, &dstPos);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Failed to retrieve position info of node %u, remain last configuration.\n", nodeId);
|
||||
DBG_ERROR("Failed to retrieve position info of node %" PRIu8 ", remain last configuration.\n", nodeId);
|
||||
return EPARAM;
|
||||
}
|
||||
myPos.x = instPtr->sysInfo.posX;
|
||||
@@ -587,7 +593,7 @@ int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE f
|
||||
frameStr = "UNKNOWN Frame";
|
||||
break;
|
||||
}
|
||||
DBG_INFO("# Setup Next Slot # [%u-%u], %s, %s.\n",
|
||||
DBG_INFO("# Setup Next Slot # [%" PRIu32 "-%" PRIu32 "], %s, %s.\n",
|
||||
instPtr->frameNum.next,
|
||||
instPtr->slotNum.next,
|
||||
torStr, frameStr);
|
||||
@@ -603,7 +609,7 @@ int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE f
|
||||
Status = Phy_SetTimeWord(phyRef, &pullTime, PHY_TIME_WORD_POLL);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Physical set pull time failed, with error code: %d\n", Status);
|
||||
DBG_ERROR("Physical set pull time failed, with error code: %" PRId32 "\n", Status);
|
||||
}
|
||||
|
||||
PHY_TOR_TYPE tor;
|
||||
@@ -619,14 +625,14 @@ int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE f
|
||||
tor = PHY_TOR_RX;
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR("Invalid txrx mode :%d.\n", txrxMode);
|
||||
DBG_ERROR("Invalid txrx mode :%" PRId8 ".\n", txrxMode);
|
||||
return EPARAM;
|
||||
}
|
||||
|
||||
Status = Phy_SetupNextSlot(phyRef, tor, L2_L2frame2L1frame(frameType), instPtr->sendPktData);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Physical setup failed, with error code: %d\n", Status);
|
||||
DBG_ERROR("Physical setup failed, with error code: %" PRId32 "\n", Status);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
@@ -723,7 +729,7 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
|
||||
goto init_error;
|
||||
}
|
||||
// Reset basic info
|
||||
(*instPtr)->netStartTime = UINT32_MAX;
|
||||
(*instPtr)->netStartTime = NET_START_TIME_INFTY;
|
||||
(*instPtr)->rtneConfig.last = NULL;
|
||||
(*instPtr)->rtneConfig.curr = NULL;
|
||||
(*instPtr)->rtneConfig.next = NULL;
|
||||
@@ -762,14 +768,14 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
|
||||
Status = L2_CreateSchedEventPool(&((*instPtr)->schdEventPool));
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("L2_CreateSchedEventPool runs failed, with error code: %d.\n", Status);
|
||||
DBG_ERROR("L2_CreateSchedEventPool runs failed, with error code: %" PRId32 ".\n", Status);
|
||||
goto init_error;
|
||||
}
|
||||
|
||||
Status = L2_NodeList_Init(&((*instPtr)->nodeList));
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("NodeList_Init runs failed, with error code: %d.\n", Status);
|
||||
DBG_ERROR("NodeList_Init runs failed, with error code: %" PRId32 ".\n", Status);
|
||||
goto init_error;
|
||||
}
|
||||
|
||||
@@ -895,7 +901,10 @@ void Linklayer_Destroy(L2_INST *instPtr)
|
||||
int32_t Linklayer_Start(L2_INST *instPtr)
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
instPtr->netStartTime = TimeCtrl_GetIntCnt(instPtr->config.tmcInstPtr) / L2_SLOTS_PER_FRAME + 1;
|
||||
// Set netStartTime at first call.
|
||||
if (instPtr->netStartTime == NET_START_TIME_INFTY) {
|
||||
instPtr->netStartTime = TimeCtrl_GetIntCnt(instPtr->config.tmcInstPtr) / L2_SLOTS_PER_FRAME + 1;
|
||||
}
|
||||
instPtr->isEnable = true;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -990,7 +999,7 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
|
||||
DBG_ERROR("Illegal event, only None_Head node can assert L2_EV_LOST_CXN.\n");
|
||||
break;
|
||||
}
|
||||
DBG_WARNING("Lost connection with head node [%d].\n", L2_GetHeadId(instPtr));
|
||||
DBG_WARNING("Lost connection with head node [%" PRId8 "].\n", L2_GetHeadId(instPtr));
|
||||
L2_Scan_Reset(instPtr->scanFSM);
|
||||
L2_Service_Reset(instPtr->serviceFSM);
|
||||
instPtr->cxn2Net = false;
|
||||
@@ -1024,7 +1033,7 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_WARNING("Unsupported routine state [%d], Continue withe previous routine table.\n", instPtr->nextState);
|
||||
DBG_WARNING("Unsupported routine state [%" PRId8 "], Continue withe previous routine table.\n", instPtr->nextState);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1038,7 +1047,7 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
|
||||
}
|
||||
default:
|
||||
{
|
||||
DBG_WARNING("UNKNOWN Event %d asserted.\n", l2Event->event);
|
||||
DBG_WARNING("UNKNOWN Event %" PRId8 " asserted.\n", l2Event->event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1076,7 +1085,7 @@ int32_t Linklayer_PktHandler(L2_INST *instPtr, L2_FRAME_TYPE frameType)
|
||||
Status = L2_Service_PktHandler(instPtr, instPtr->recvPktData);
|
||||
break;
|
||||
default:
|
||||
DBG_WARNING("L2FrameHandler: UNKNOWN L2-FrameType %d", frameType);
|
||||
DBG_WARNING("L2FrameHandler: UNKNOWN L2-FrameType %" PRId8 "\n", frameType);
|
||||
Status = FAILURE;
|
||||
break;
|
||||
}
|
||||
@@ -1100,14 +1109,14 @@ static int32_t IntcNodeTTL(NODE_ENTRY *node, const void *param)
|
||||
static bool IsNodeConnected(NODE_ENTRY *node)
|
||||
{
|
||||
ASSERT(node != NULL);
|
||||
DBG_INFO("Node: %u, TTL: %u.\n", node->nodeInfo.nodeId, node->ttlCnt);
|
||||
DBG_INFO("Node: %" PRIu8 ", TTL: %" PRIu32 ".\n", node->nodeInfo.nodeId, node->ttlCnt);
|
||||
if (node->ttlCnt < LINK_BROCK_THRESHOLD)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_WARNING("Lost Connection to NODE %u.\n", node->nodeInfo.nodeId);
|
||||
DBG_WARNING("Lost Connection to NODE %" PRIu8 ".\n", node->nodeInfo.nodeId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1139,7 +1148,7 @@ static int32_t Linklayer_Routine(L2_INST *instPtr)
|
||||
instPtr->rtneConfig.curr = instPtr->rtneConfig.next;
|
||||
instPtr->rtneConfig.next = &(instPtr->rtneConfig.rtneTable[tableIndx][entryIndx]);
|
||||
rtneEntry = instPtr->rtneConfig.rtneTable[tableIndx][entryIndx];
|
||||
DBG_INFO("## Routine: %u-%u, Routine period: %u.\n", tableIndx, entryIndx, instPtr->rtneConfig.rtnePrd);
|
||||
DBG_INFO("## Routine: %" PRIu32 "-%" PRIu32 ", Routine period: %" PRIu32 ".\n", tableIndx, entryIndx, instPtr->rtneConfig.rtnePrd);
|
||||
|
||||
switch (rtneEntry.slotType)
|
||||
{
|
||||
@@ -1157,7 +1166,7 @@ static int32_t Linklayer_Routine(L2_INST *instPtr)
|
||||
Status = L2_Service_Routine(instPtr, &rtneEntry);
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR("UNKNOWN slot type [%d].\n", rtneEntry.slotType);
|
||||
DBG_ERROR("UNKNOWN slot type [%" PRId8 "].\n", rtneEntry.slotType);
|
||||
return EPARAM;
|
||||
}
|
||||
|
||||
@@ -1212,7 +1221,7 @@ int32_t Linklayer_Proc(L2_INST *instPtr)
|
||||
uint32_t nextTimeUnit = (TimeCtrl_GetIntCnt(instPtr->config.tmcInstPtr) + 1) / L2_SLOTS_PER_FRAME;
|
||||
if (nextTimeUnit < instPtr->netStartTime)
|
||||
{
|
||||
DBG_WARNING("Linklayer not start yet, next time unit: %u, start time unit: %u.\n",
|
||||
DBG_WARNING("Linklayer not start yet, next time unit: %" PRIu32 ", start time unit: %" PRIu32 ".\n",
|
||||
nextTimeUnit, instPtr->netStartTime);
|
||||
return EIGNORE;
|
||||
}
|
||||
@@ -1220,7 +1229,7 @@ int32_t Linklayer_Proc(L2_INST *instPtr)
|
||||
// Update slot number.
|
||||
L2_UpdateSlotNum(instPtr);
|
||||
|
||||
DBG_INFO("######## Current frameNum: %u, SlotNum: %u ########\n",
|
||||
DBG_INFO("######## Current frameNum: %" PRIu32 ", SlotNum: %" PRIu32 " ########\n",
|
||||
instPtr->frameNum.curr, instPtr->slotNum.curr);
|
||||
|
||||
// Sync System info
|
||||
@@ -1234,7 +1243,7 @@ int32_t Linklayer_Proc(L2_INST *instPtr)
|
||||
{
|
||||
if (Linklayer_PktHandler(instPtr, L2_GetLastOptFrameType(instPtr)) != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Failed to handle last received frame: %d.\n", L2_GetLastOptFrameType(instPtr));
|
||||
DBG_ERROR("Failed to handle last received frame: %" PRId8 ".\n", L2_GetLastOptFrameType(instPtr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -193,8 +193,8 @@ typedef struct
|
||||
bool isAckPending; // 2way acq done.
|
||||
uint8_t scanCnt;
|
||||
uint8_t beamNo;
|
||||
uint32_t advTimeout;
|
||||
uint32_t cfmTimeout;
|
||||
uint8_t advTimeout;
|
||||
uint8_t cfmTimeout;
|
||||
SCAN_STAGE scanStage; // only for member node
|
||||
} L2_SCAN_FSM;
|
||||
|
||||
|
||||
@@ -104,8 +104,10 @@
|
||||
#define L2_MSG_SVC_SRC_SPEEDY_LEN 4
|
||||
#define L2_MSG_SVC_SRC_SPEEDZ 28
|
||||
#define L2_MSG_SVC_SRC_SPEEDZ_LEN 4
|
||||
#define L2_MSG_SVC_PAYLOAD 32
|
||||
#define L2_MSG_SVC_PAYLOAD_LEN 234
|
||||
#define L2_MSG_SVC_PAYLOAD_ID 32
|
||||
#define L2_MSG_SVC_PAYLOAD_ID_LEN 4
|
||||
#define L2_MSG_SVC_PAYLOAD 36
|
||||
#define L2_MSG_SVC_PAYLOAD_LEN 230
|
||||
#define L2_MSG_SVC_CRC 266
|
||||
#define L2_MSG_SVC_CRC_LEN 2
|
||||
|
||||
|
||||
@@ -159,10 +159,10 @@ NODE_ENTRY *L2_AppendNode(NODE_LIST *list, uint8_t nodeId, L2_NODE_TYPE nodeType
|
||||
ASSERT(list != NULL);
|
||||
if (L2_isNodeInList(list, nodeId))
|
||||
{
|
||||
DBG_WARNING("Node [%d] already exist.\n", nodeId);
|
||||
DBG_WARNING("Node [%" PRIu8 "] already exist.\n", nodeId);
|
||||
return NULL;
|
||||
}
|
||||
DBG_INFO("Link layer appending node [%d] to node list.\n", nodeId);
|
||||
DBG_INFO("Link layer appending node [%" PRIu8 "] to node list.\n", nodeId);
|
||||
NODE_ENTRY *nodeEntry = (NODE_ENTRY *)malloc(sizeof(NODE_ENTRY));
|
||||
if (nodeEntry == NULL)
|
||||
{
|
||||
@@ -208,10 +208,10 @@ int32_t L2_DeleteNodeById(NODE_LIST *list, uint8_t nodeId)
|
||||
clist_node_t *node = clist_find(list, &util_entry);
|
||||
if (node == NULL)
|
||||
{
|
||||
DBG_WARNING("Node [%d] in not in node list, skip deleting process.\n", nodeId);
|
||||
DBG_WARNING("Node [%" PRIu8 "] in not in node list, skip deleting process.\n", nodeId);
|
||||
return SUCCESS;
|
||||
}
|
||||
DBG_INFO("Deleting node [%d].\n", nodeId);
|
||||
DBG_INFO("Deleting node [%" PRIu8 "].\n", nodeId);
|
||||
clist_remove(list, node);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
||||
static inline void LockStateUpdate(L2_SCAN_FSM *scanFsmPtr, bool state)
|
||||
{
|
||||
ASSERT(scanFsmPtr != NULL);
|
||||
DBG_INFO("Update BeamLockState from [%d] to [%d].\n",
|
||||
DBG_INFO("Update BeamLockState from [%" PRId8 "] to [%" PRId8 "].\n",
|
||||
scanFsmPtr->isLocked, state);
|
||||
scanFsmPtr->isLocked = state;
|
||||
return;
|
||||
@@ -65,7 +65,7 @@ static inline void LockStateUpdate(L2_SCAN_FSM *scanFsmPtr, bool state)
|
||||
static void AdvRecvStateUpdate(L2_SCAN_FSM *scanFsmPtr, bool state)
|
||||
{
|
||||
ASSERT(scanFsmPtr != NULL);
|
||||
DBG_INFO("Update AdvRecvState from [%d] to [%d].\n",
|
||||
DBG_INFO("Update AdvRecvState from [%" PRId8 "] to [%" PRId8 "].\n",
|
||||
scanFsmPtr->isAdvRecvd, state);
|
||||
scanFsmPtr->isAdvRecvd = state;
|
||||
return;
|
||||
@@ -95,7 +95,7 @@ static void PendCfmAck(L2_SCAN_FSM *scanFsmPtr)
|
||||
static void StageUpdate(L2_SCAN_FSM *scanFsmPtr, SCAN_STAGE newStage)
|
||||
{
|
||||
ASSERT(newStage >= L2_SCAN_NONE_STAGE && newStage <= L2_SCAN_CFM_STAGE);
|
||||
DBG_INFO("ScanNet current stage: %u -> ScanNet new stage: %u \n",
|
||||
DBG_INFO("ScanNet current stage: %" PRIu8 " -> ScanNet new stage: %" PRIu8 " \n",
|
||||
scanFsmPtr->scanStage, newStage);
|
||||
scanFsmPtr->scanStage = newStage;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ static int32_t Scan_InitScanHandler(L2_INST *instPtr)
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
||||
DBG_INFO("** Net-Setup - InitScan Procedure (Attempts: %u)**\n", scanFsmPtr->scanCnt);
|
||||
DBG_INFO("** Net-Setup - InitScan Procedure (Attempts: %" PRIu8 ")**\n", scanFsmPtr->scanCnt);
|
||||
|
||||
if (scanFsmPtr->isLocked == true)
|
||||
{
|
||||
@@ -144,7 +144,7 @@ static int32_t Scan_InitScanHandler(L2_INST *instPtr)
|
||||
static int32_t Scan_AdvHandler(L2_INST *instPtr)
|
||||
{
|
||||
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
||||
DBG_INFO("** Net-Setup - Advertisement Procedure (Timeout: %u) **\n", scanFsmPtr->advTimeout);
|
||||
DBG_INFO("** Net-Setup - Advertisement Procedure (Timeout: %" PRIu8 ") **\n", scanFsmPtr->advTimeout);
|
||||
|
||||
// if received a valid bm frame.
|
||||
if (scanFsmPtr->isAdvRecvd == true)
|
||||
@@ -188,7 +188,7 @@ static int32_t Scan_AdvHandler(L2_INST *instPtr)
|
||||
static int32_t Scan_CfmHandler(L2_INST *instPtr)
|
||||
{
|
||||
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
||||
DBG_INFO("** Net-Setup - Confirm Procedure (Timeout: %u) **\n", scanFsmPtr->cfmTimeout);
|
||||
DBG_INFO("** Net-Setup - Confirm Procedure (Timeout: %" PRIu8 ") **\n", scanFsmPtr->cfmTimeout);
|
||||
|
||||
// 2 way acq failed, back to init stage.
|
||||
if (scanFsmPtr->cfmTimeout >= CFM_LISTEN_TIMEOUT)
|
||||
@@ -227,7 +227,7 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
||||
uint8_t *buff = instPtr->sendPktData;
|
||||
if(type < L2_ADV_FRAME || type > L2_CFM_FRAME)
|
||||
{
|
||||
DBG_ERROR("Unexpected frame type: %d.\n", type);
|
||||
DBG_ERROR("Unexpected frame type: %" PRId8 ".\n", type);
|
||||
return EPARAM;
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
||||
Status = L2_CrcAppend(buff, L2_ADV_PACK_LEN - L2_MSG_ADV_SVC_CRC_LEN, L2_MSG_ADV_SVC_CRC, L2_CRC16_1021);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Fail to append CRC, error code: %d.\n", Status);
|
||||
DBG_ERROR("Fail to append CRC, error code: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
break;
|
||||
@@ -282,14 +282,14 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
||||
Status = L2_CrcAppend(buff, L2_CMF_PACK_LEN - L2_MSG_CFM_CRC_LEN, L2_MSG_CFM_CRC, L2_CRC16_1021);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Fail to append CRC, error code: %d.\n", Status);
|
||||
DBG_ERROR("Fail to append CRC, error code: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DBG_ERROR("Unexpected frame type: %d.\n", type);
|
||||
DBG_ERROR("Unexpected frame type: %" PRId8 ".\n", type);
|
||||
return EPARAM;
|
||||
}
|
||||
}
|
||||
@@ -392,7 +392,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
node = L2_AppendNode(instPtr->nodeList, nodeId, L2_NODE_MEMBER);
|
||||
if(node == NULL)
|
||||
{
|
||||
DBG_ERROR("Failed to append new node [id: %d]", nodeId);
|
||||
DBG_ERROR("Failed to append new node [id: %" PRId8 "]", nodeId);
|
||||
Status = ENOMEM;
|
||||
break;
|
||||
}
|
||||
@@ -441,7 +441,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
node = L2_AppendNode(instPtr->nodeList, nodeId, L2_NODE_MEMBER);
|
||||
if(node == NULL)
|
||||
{
|
||||
DBG_ERROR("Failed to append new node [id: %d]", nodeId);
|
||||
DBG_ERROR("Failed to append new node [id: %" PRId8 "]", nodeId);
|
||||
Status = ENOMEM;
|
||||
break;
|
||||
}
|
||||
@@ -506,7 +506,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DBG_ERROR("Unsupported frame type: %d.\n", frameType);
|
||||
DBG_ERROR("Unsupported frame type: %" PRId8 ".\n", frameType);
|
||||
Status = EUNEXP;
|
||||
break;
|
||||
}
|
||||
@@ -550,7 +550,7 @@ int32_t L2_Scan_Proc(L2_INST *instPtr)
|
||||
Status = Scan_CfmHandler(instPtr);
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR("Unexpected scan net stage: %d.\n", scanFSM->scanStage);
|
||||
DBG_ERROR("Unexpected scan net stage: %" PRId8 ".\n", scanFSM->scanStage);
|
||||
Status = FAILURE;
|
||||
break;
|
||||
}
|
||||
@@ -664,7 +664,7 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
|
||||
L2_SetupNextSlot(instPtr, torState, L2_CFM_FRAME);
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR("Cannot start a routine for slot type [%d] properly.\n", rtneEntry->slotType);
|
||||
DBG_ERROR("Cannot start a routine for slot type [%" PRId8 "] properly.\n", rtneEntry->slotType);
|
||||
Status = FAILURE;
|
||||
goto routine_err;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ L2_SCHD_EVENT *L2_CreatNewSchdEvent(L2_SCHD_POOL *schdPool, L2_EVENT_TYPE event,
|
||||
ASSERT(schdPool != NULL);
|
||||
if (event < L2_EV_SCAN_PROC_DONE || event > L2_ROUTINE_UPDATE)
|
||||
{
|
||||
DBG_ERROR("Unknown event type: %d.\n", event);
|
||||
DBG_ERROR("Unknown event type: %" PRId8 ".\n", event);
|
||||
return NULL;
|
||||
}
|
||||
L2_SCHD_EVENT *schdEvent = (L2_SCHD_EVENT *)malloc(sizeof(L2_SCHD_EVENT));
|
||||
@@ -192,7 +192,7 @@ L2_SCHD_EVENT *L2_GetEventById(L2_SCHD_POOL *schdPool, uint32_t id)
|
||||
clist_node_t *node = clist_find(schdPool->schdList, &util_schdevent);
|
||||
if (node != NULL)
|
||||
{
|
||||
DBG_WARNING("Event with id=%d, dose not exist.\n", id);
|
||||
DBG_WARNING("Event with id=%" PRIu32 ", dose not exist.\n", id);
|
||||
return NULL;
|
||||
}
|
||||
return ((L2_SCHD_EVENT *)node->val);
|
||||
@@ -217,7 +217,7 @@ int32_t L2_DeleteSchdEventById(L2_SCHD_POOL *schdPool, uint32_t id)
|
||||
clist_node_t *node = clist_find(schdPool->schdList, &util_schdevent);
|
||||
if (node != NULL)
|
||||
{
|
||||
DBG_ERROR("Event with id=%d, dose not exist.\n", id);
|
||||
DBG_ERROR("Event with id=%" PRIu32 ", dose not exist.\n", id);
|
||||
return EIGNORE;
|
||||
}
|
||||
clist_remove(schdPool->schdList, node);
|
||||
@@ -242,16 +242,16 @@ int32_t L2_ScheduleEventAt(L2_INST *instPtr, L2_SCHD_EVENT *schdEvent, uint32_t
|
||||
ASSERT(schdEvent != NULL);
|
||||
if (L2_isEventScheduled(schdEvent) == true)
|
||||
{
|
||||
DBG_ERROR("Event %d has already been scheduled.\n", schdEvent->eventId);
|
||||
DBG_ERROR("Event %" PRIu32 " has already been scheduled.\n", schdEvent->eventId);
|
||||
return FAILURE;
|
||||
}
|
||||
if (frameNum <= L2_GetCurrentFrameNum(instPtr) && slotNum < L2_GetCurrentSlotNum(instPtr))
|
||||
{
|
||||
DBG_ERROR("Cannot schedule event %d to the past(current: [%u-%u], schedule: [%u-%u]).\n",
|
||||
DBG_ERROR("Cannot schedule event %" PRIu32 " to the past(current: [%" PRIu32 "-%" PRIu32 "], schedule: [%" PRIu32 "-%" PRIu32 "]).\n",
|
||||
schdEvent->eventId, L2_GetCurrentFrameNum(instPtr), L2_GetCurrentSlotNum(instPtr), frameNum, slotNum);
|
||||
return FAILURE;
|
||||
}
|
||||
DBG_INFO("Schedule event (type:%d) [%u] at %u-%u.\n",
|
||||
DBG_INFO("Schedule event (type:%" PRIu8 ") [%" PRIu32 "] at %" PRIu32 "-%" PRIu32 ".\n",
|
||||
schdEvent->l2Event.event, schdEvent->eventId,
|
||||
frameNum, slotNum);
|
||||
schdEvent->isSchd = true;
|
||||
@@ -277,7 +277,7 @@ int32_t L2_ScheduleEventAfter(L2_INST *instPtr, L2_SCHD_EVENT *schdEvent, uint32
|
||||
ASSERT(schdEvent != NULL);
|
||||
if (L2_isEventScheduled(schdEvent) == true)
|
||||
{
|
||||
DBG_ERROR("Event %d has already been scheduled.\n", schdEvent->eventId);
|
||||
DBG_ERROR("Event %" PRIu32 " has already been scheduled.\n", schdEvent->eventId);
|
||||
return FAILURE;
|
||||
}
|
||||
uint32_t frameNum = L2_GetCurrentFrameNum(instPtr) + (numSlots / L2_SLOTS_PER_FRAME);
|
||||
@@ -303,7 +303,7 @@ int32_t L2_RescheduleEventAt(L2_INST *instPtr, L2_SCHD_EVENT *schdEvent, uint32_
|
||||
ASSERT(schdEvent != NULL);
|
||||
if (schdEvent->isSchd == false)
|
||||
{
|
||||
DBG_WARNING("Event %d has not been scheduled yet.\n", schdEvent->eventId);
|
||||
DBG_WARNING("Event %" PRIu32 " has not been scheduled yet.\n", schdEvent->eventId);
|
||||
}
|
||||
schdEvent->isSchd = false;
|
||||
return L2_ScheduleEventAt(instPtr, schdEvent, frameNum, slotNum);
|
||||
@@ -326,7 +326,7 @@ int32_t L2_RescheduleEventAfter(L2_INST *instPtr, L2_SCHD_EVENT *schdEvent, uint
|
||||
ASSERT(schdEvent != NULL);
|
||||
if (schdEvent->isSchd == false)
|
||||
{
|
||||
DBG_WARNING("Event %d has not been scheduled yet.\n", schdEvent->eventId);
|
||||
DBG_WARNING("Event %" PRIu32 " has not been scheduled yet.\n", schdEvent->eventId);
|
||||
}
|
||||
return L2_ScheduleEventAfter(instPtr, schdEvent, numSlots);
|
||||
}
|
||||
@@ -359,11 +359,11 @@ void L2_EventPoolHandler(L2_INST *instPtr)
|
||||
{
|
||||
if (event->schdFrame == L2_GetCurrentFrameNum(instPtr) && event->schdSlot == L2_GetCurrentSlotNum(instPtr))
|
||||
{
|
||||
DBG_INFO("Asserting scheduled event [%d].\n", event->eventId);
|
||||
DBG_INFO("Asserting scheduled event [%" PRIu32 "].\n", event->eventId);
|
||||
AssertL2Event(instPtr, &(event->l2Event));
|
||||
if (event->isVolatile == true)
|
||||
{
|
||||
DBG_INFO("Deleting scheduled event [%d], since it is volatile.\n", event->eventId);
|
||||
DBG_INFO("Deleting scheduled event [%" PRIu32 "], since it is volatile.\n", event->eventId);
|
||||
clist_remove(pool->schdList, node);
|
||||
}
|
||||
else
|
||||
@@ -407,7 +407,7 @@ inline int32_t L2_CancelEvent(L2_SCHD_EVENT *schdEvent)
|
||||
ASSERT(schdEvent != NULL);
|
||||
if (schdEvent->isSchd == false)
|
||||
{
|
||||
DBG_WARNING("Event %d has not been scheduled yet.\n", schdEvent->eventId);
|
||||
DBG_WARNING("Event %" PRIu32 " has not been scheduled yet.\n", schdEvent->eventId);
|
||||
}
|
||||
schdEvent->isSchd = false;
|
||||
return SUCCESS;
|
||||
|
||||
@@ -112,17 +112,28 @@ static int32_t Service_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_SRC_SPEEDY, L2_MSG_SVC_SRC_SPEEDY_LEN, &(instPtr->sysInfo.vY));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_SRC_SPEEDZ, L2_MSG_SVC_SRC_SPEEDZ_LEN, &(instPtr->sysInfo.vZ));
|
||||
|
||||
// packing payload
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD, L2_MSG_SVC_PAYLOAD_LEN, testData);
|
||||
uint32_t dataId;
|
||||
if(L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||
{
|
||||
SysMonitor_GetSendPayloadFLJRaw(buff + L2_MSG_SVC_PAYLOAD, &dataId);
|
||||
}
|
||||
else
|
||||
{
|
||||
SysMonitor_GetSendPayloadLJRaw(buff + L2_MSG_SVC_PAYLOAD, &dataId);
|
||||
}
|
||||
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD_ID, L2_MSG_SVC_PAYLOAD_ID_LEN, &dataId);
|
||||
if (dataId == DATA_ID_NONE)
|
||||
{
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD, L2_MSG_SVC_PAYLOAD_LEN, testData);
|
||||
}
|
||||
|
||||
// // packing payload
|
||||
// uint32_t dataId;
|
||||
// dataId = DATA_ID_TEST;
|
||||
// L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD_ID, L2_MSG_SVC_PAYLOAD_ID_LEN, &dataId);
|
||||
// L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD, L2_MSG_SVC_PAYLOAD_LEN, testData);
|
||||
|
||||
// if(L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||
// {
|
||||
// SysMonitor_GetSendPayloadLJRaw(buff+L2_MSG_SVC_PAYLOAD);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SysMonitor_GetSendPayloadFLJRaw(buff+L2_MSG_SVC_PAYLOAD);
|
||||
// }
|
||||
|
||||
Status = L2_CrcAppend(buff, L2_SVC_PACK_LEN - L2_MSG_SVC_CRC_LEN, L2_MSG_SVC_CRC, L2_CRC16_1021);
|
||||
if (Status != SUCCESS)
|
||||
@@ -134,7 +145,7 @@ static int32_t Service_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
||||
}
|
||||
default:
|
||||
{
|
||||
DBG_ERROR("Unexpected frame type: %d.\n", type);
|
||||
DBG_ERROR("Unexpected frame type: %" PRIu8 ".\n", type);
|
||||
return EPARAM;
|
||||
break;
|
||||
}
|
||||
@@ -233,7 +244,7 @@ int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
node = L2_AppendNode(instPtr->nodeList, nodeId, L2_NODE_MEMBER);
|
||||
if(node == NULL)
|
||||
{
|
||||
DBG_ERROR("Failed to append new node [id: %d]", nodeId);
|
||||
DBG_ERROR("Failed to append new node [id: %" PRIu8 "]", nodeId);
|
||||
Status = ENOMEM;
|
||||
break;
|
||||
}
|
||||
@@ -258,14 +269,21 @@ int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
// Reset node ttl
|
||||
node->ttlCnt = 0;
|
||||
|
||||
if(L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||
uint32_t dataId;
|
||||
L2_FrameGetChunk(msg, L2_MSG_SVC_PAYLOAD_ID, L2_MSG_SVC_PAYLOAD_ID_LEN, &dataId);
|
||||
|
||||
if(dataId != DATA_ID_NONE)
|
||||
{
|
||||
SysMonitor_UpdateRecvPayloadLJRaw(msg+L2_MSG_SVC_PAYLOAD);
|
||||
}
|
||||
else
|
||||
{
|
||||
SysMonitor_UpdateRecvPayloadFLJRaw(msg+L2_MSG_SVC_PAYLOAD);
|
||||
if(L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||
{
|
||||
SysMonitor_UpdateRecvPayloadFLJRaw(msg+L2_MSG_SVC_PAYLOAD);
|
||||
}
|
||||
else
|
||||
{
|
||||
SysMonitor_UpdateRecvPayloadLJRaw(msg+L2_MSG_SVC_PAYLOAD);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DATALINK_ENABLE_AUTOTIMESYNC
|
||||
// Implement a auto time sync.
|
||||
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
|
||||
@@ -279,7 +297,7 @@ int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DBG_ERROR("Unsupported frame type: %d.\n", instPtr->frame.last);
|
||||
DBG_ERROR("Unsupported frame type: %" PRIu8 ".\n", frameType);
|
||||
break;
|
||||
}
|
||||
return Status;
|
||||
@@ -318,6 +336,12 @@ int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntr
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
DBG_INFO("-------- ServiceNet Routine --------\n");
|
||||
|
||||
if (rtneEntry->slotSeq != 0)
|
||||
{
|
||||
return SUCCESS; // skip
|
||||
}
|
||||
|
||||
PHY_INST* phyRef = instPtr->config.phyInstPtr;
|
||||
L2_TOR_TYPE torState;
|
||||
if (rtneEntry->src == L2_GetNodeId(instPtr))
|
||||
@@ -351,7 +375,7 @@ int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntr
|
||||
L2_SetupNextSlot(instPtr, torState, L2_SVC_FRAME);
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR("UNKNOWN slot type [%d].\n", rtneEntry->slotType);
|
||||
DBG_ERROR("UNKNOWN slot type [%" PRIu8 "].\n", rtneEntry->slotType);
|
||||
return FAILURE;
|
||||
}
|
||||
#ifdef DATALINK_ENABLE_BERTEST
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
#define ANT_MODE_WIDE_BEAM_3 0x30 // 120
|
||||
|
||||
#define ANT_MODE_HIGH_POWER 0x00
|
||||
#define ANT_MODE_LOWAPOWER 0x04
|
||||
#define ANT_MODE_LOW_POWER 0x04
|
||||
#define ANT_MODE_STANDBY 0x0F
|
||||
#define ATN_MODE_DEFAULT (ANT_MODE_WIDE_BEAM_1 | ANT_MODE_LOWAPOWER)
|
||||
#define ATN_MODE_DEFAULT (ANT_MODE_WIDE_BEAM_1 | ANT_MODE_LOW_POWER)
|
||||
#define ATN_MODE_HIGH (ANT_MODE_WIDE_BEAM_1 | ANT_MODE_HIGH_POWER)
|
||||
|
||||
#define DEFAULT_CENTRTAL_FREQ 0x06D7 // 26.25GHz
|
||||
@@ -86,21 +86,17 @@ uint16_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] =
|
||||
|
||||
uint16_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] =
|
||||
{
|
||||
1500, 1600, 1700, 1800, 1900, 2000, 1500, 1600,
|
||||
1700, 1800, 1900
|
||||
1500
|
||||
};
|
||||
|
||||
uint16_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] =
|
||||
{
|
||||
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
|
||||
2400
|
||||
1600
|
||||
};
|
||||
|
||||
uint16_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] =
|
||||
{
|
||||
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
|
||||
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
|
||||
2400, 2400, 2400
|
||||
1600
|
||||
};
|
||||
|
||||
uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] =
|
||||
@@ -246,8 +242,31 @@ 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;
|
||||
switch (mode)
|
||||
{
|
||||
case PHY_ANT_MODE_SILENT:
|
||||
config |= ANT_MODE_STANDBY;
|
||||
break;
|
||||
case PHY_ANT_MODE_LOW_POWER:
|
||||
config |= ANT_MODE_LOW_POWER;
|
||||
break;
|
||||
case PHY_ANT_MODE_HIGH_POWER:
|
||||
config |= ANT_MODE_HIGH_POWER;
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR("Unknown antenna mode: %" PRIu8 ", remain previous mode.\n", mode);
|
||||
return;
|
||||
}
|
||||
instPtr->antConfig.antMode = config;
|
||||
}
|
||||
|
||||
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
if (instPtr->beamWd.next == PHY_ANT_BEAM_8)
|
||||
{
|
||||
if (beamNo >= L1_NUM_ANT_NRRW_PATTERN)
|
||||
@@ -296,6 +315,7 @@ int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
|
||||
|
||||
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
uint8_t beamConfig = instPtr->antConfig.antMode & (~ANT_MODE_BEAM_MASK);
|
||||
switch (beamWidth)
|
||||
{
|
||||
@@ -324,13 +344,14 @@ int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
|
||||
// Common version radius double input
|
||||
int32_t Phy_SetBeamAngle(PHY_INST *instPtr, double offAx, double rndAx)
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
uint16_t offAxDeg = 0;
|
||||
uint16_t rndAxDeg = 0;
|
||||
offAxDeg = (offAx >= 0) ? (((int32_t)(offAx * 180 / ANT_PI)) % 360) : (((int32_t)(offAx * 180 / ANT_PI)) % 360 + 360);
|
||||
rndAxDeg = (rndAx >= 0) ? (((int32_t)(rndAx * 180 / ANT_PI)) % 360) : (((int32_t)(rndAx * 180 / ANT_PI)) % 360 + 360);
|
||||
if (offAxDeg > 60)
|
||||
{
|
||||
DBG_ERROR("Angle out of range, off axis angle: %u (should be 0~60), round axis angle: %u (should be 0~360).\n",
|
||||
DBG_ERROR("Angle out of range, off axis angle: %" PRIu16 " (should be 0~60), round axis angle: %" PRIu16 " (should be 0~360).\n",
|
||||
offAxDeg, rndAxDeg);
|
||||
return EPARAM;
|
||||
}
|
||||
|
||||
@@ -35,10 +35,29 @@
|
||||
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
#define TOR_BUFF_MAX_SIZE 1024 // 8192bits
|
||||
#define L1_FRAME_LEN_MAX (8192 / 8) // byte
|
||||
#define L1_FRAME_2KBPS_20MS_LEN 0 // byte
|
||||
#define L1_FRAME_2KBPS_100MS_LEN (312 / 8) // byte
|
||||
#define L1_FRAME_10KBPS_10MS_LEN 0 // byte
|
||||
#define L1_FRAME_10KBPS_20MS_LEN (232 / 8) // byte
|
||||
#define L1_FRAME_40KBPS_20MS_LEN (2152 / 8) // byte
|
||||
#define L1_FRAME_40KBPS_10MS_LEN (712 / 8) // byte
|
||||
#define L1_FRAME_200KBPS_5MS_LEN (2040 / 8) // byte
|
||||
#define L1_FRAME_1M2BPS_5MS_LEN (8176 / 8) // byte
|
||||
|
||||
#define L1_FRAME_2KBPS_20MS_COMP 1841158 // *10ns(Timer_L)
|
||||
#define L1_FRAME_2KBPS_100MS_COMP 1841158 // *10ns(Timer_L)
|
||||
#define L1_FRAME_10KBPS_10MS_COMP 850950 // *10ns(Timer_L)
|
||||
#define L1_FRAME_10KBPS_20MS_COMP 850950 // *10ns(Timer_L)
|
||||
#define L1_FRAME_40KBPS_20MS_COMP 111485 // *10ns(Timer_L)
|
||||
#define L1_FRAME_40KBPS_10MS_COMP 111485 // *10ns(Timer_L)
|
||||
#define L1_FRAME_200KBPS_5MS_COMP 22493 // *10ns(Timer_L)
|
||||
#define L1_FRAME_1M2BPS_5MS_COMP 22493 // *10ns(Timer_L)
|
||||
|
||||
#define L1_ANTCONFIG_MAX_LEN 8192
|
||||
#define L1_TXRXDATA_MAX_LEN 2048
|
||||
|
||||
#define ANT_COINFO_LEN 32 // bytes
|
||||
#define ANTCONFIG_MAX_LEN (8192 / 2)
|
||||
#define PAYLOAD_MAX_LEN (4096 / 2)
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
/************************** Function Prototypes ******************************/
|
||||
@@ -519,7 +538,7 @@ void Phy_Halt(PHY_INST *instPtr)
|
||||
uint32_t phyMainCtrl = PhyRead(instPtr, PHY_MAIN_CTRL);
|
||||
if ((phyMainCtrl & PHY_MAIN_CTRL_EN_MASK) == PHY_MAIN_CTRL_EN_DSBL)
|
||||
{
|
||||
DBG_WARNING("Physical layer was allready halted.\n");
|
||||
DBG_WARNING("Physical layer was already halted.\n");
|
||||
}
|
||||
instPtr->isPhyEn = false;
|
||||
PhyWrite(instPtr, PHY_MAIN_CTRL, (phyMainCtrl & (~PHY_MAIN_CTRL_EN_MASK)));
|
||||
@@ -611,7 +630,7 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
|
||||
case L1_2KBPS_20MS_FRAME:
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_2KBPS_20MS;
|
||||
hopNum = L1_FRAME_2KBPS_20MS_HOPS;
|
||||
hopPattern = hopPattern_10KBPS_10MS;
|
||||
hopPattern = hopPattern_2KBPS_20MS;
|
||||
break;
|
||||
case L1_2KBPS_100MS_FRAME:
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_2KBPS_100MS;
|
||||
@@ -630,8 +649,8 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
|
||||
break;
|
||||
case L1_40KBPS_20MS_FRAME:
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_40KBPS_20MS;
|
||||
hopNum = L1_FRAME_200KBPS_5MS_HOPS;
|
||||
hopPattern = hopPattern_200KBPS_5MS;
|
||||
hopNum = L1_FRAME_40KBPS_20MS_HOPS;
|
||||
hopPattern = hopPattern_40KBPS_20MS;
|
||||
break;
|
||||
case L1_40KBPS_10MS_FRAME:
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_40KBPS_10MS;
|
||||
|
||||
@@ -35,15 +35,14 @@
|
||||
#include "../../system_monitor.h"
|
||||
#include "../../time_ctrl/time_ctrl.h"
|
||||
/************************** Constant Definitions *****************************/
|
||||
#define L1_TMWORD_FRAC_MAX 500000
|
||||
#define L1_ANTCONFIG_MAX_LEN 8192
|
||||
#define L1_TXRXDATA_MAX_LEN 2048
|
||||
#define L1_NUM_ANT_SUBNRRW_PATTERN 37
|
||||
#define L1_NUM_ANT_NRRW_PATTERN 61
|
||||
#define L1_INIT_BEAM_NO 0
|
||||
#define L1_INIT_ANT_WD PHY_ANT_BEAM_120
|
||||
#define L1_INIT_ANT_NO 0
|
||||
|
||||
#define L1_FRAME_NONE_LEN UINT32_MAX // byte
|
||||
#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns(Timer_L)
|
||||
#define L1_FRAME_NONE_HOPS UINT32_MAX
|
||||
#define L1_FRAME_MAX_HOPS 81
|
||||
#define L1_FRAME_2KBPS_20MS_HOPS 1
|
||||
@@ -55,27 +54,6 @@
|
||||
#define L1_FRAME_200KBPS_5MS_HOPS 20
|
||||
#define L1_FRAME_1M2BPS_5MS_HOPS 20
|
||||
|
||||
#define L1_FRAME_NONE_LEN UINT32_MAX // byte
|
||||
#define L1_FRAME_LEN_MAX (8192 / 8) // byte
|
||||
#define L1_FRAME_2KBPS_20MS_LEN 1 // byte
|
||||
#define L1_FRAME_2KBPS_100MS_LEN 312 / 8 // byte
|
||||
#define L1_FRAME_10KBPS_10MS_LEN 1 // byte
|
||||
#define L1_FRAME_10KBPS_20MS_LEN (232 / 8) // byte
|
||||
#define L1_FRAME_40KBPS_20MS_LEN (2152 / 8) // byte
|
||||
#define L1_FRAME_40KBPS_10MS_LEN (712 / 8) // byte
|
||||
#define L1_FRAME_200KBPS_5MS_LEN (2040 / 8) // byte
|
||||
#define L1_FRAME_1M2BPS_5MS_LEN (8176 / 8) // byte
|
||||
|
||||
#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns(Timer_L)
|
||||
#define L1_FRAME_2KBPS_20MS_COMP 1841158 // *10ns(Timer_L)
|
||||
#define L1_FRAME_2KBPS_100MS_COMP 1841158 // *10ns(Timer_L)
|
||||
#define L1_FRAME_10KBPS_10MS_COMP 850950 // *10ns(Timer_L)
|
||||
#define L1_FRAME_10KBPS_20MS_COMP 850950 // *10ns(Timer_L)
|
||||
#define L1_FRAME_40KBPS_20MS_COMP 110667 // *10ns(Timer_L)
|
||||
#define L1_FRAME_40KBPS_10MS_COMP 110667 // *10ns(Timer_L)
|
||||
#define L1_FRAME_200KBPS_5MS_COMP 22493 // *10ns(Timer_L)
|
||||
#define L1_FRAME_1M2BPS_5MS_COMP 22493 // *10ns(Timer_L)
|
||||
|
||||
#define PHY_TIME_WORD_H_MAX UINT32_MAX
|
||||
#define PHY_TIME_WORD_L_MAX 0x0007A120 // 5ms/10ns
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
@@ -189,6 +167,14 @@ typedef enum
|
||||
PHY_MODE_PULL = 3
|
||||
} PHY_MODE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PHY_ANT_MODE_NONE = 0,
|
||||
PHY_ANT_MODE_SILENT = 1,
|
||||
PHY_ANT_MODE_LOW_POWER = 2,
|
||||
PHY_ANT_MODE_HIGH_POWER = 3,
|
||||
} PHY_ANT_MODE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t devId;
|
||||
@@ -277,6 +263,7 @@ uint32_t Phy_GetHopLength(L1_FRAME_TYPE frameType);
|
||||
uint32_t Phy_GetTimeComp(L1_FRAME_TYPE frameType);
|
||||
|
||||
void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig);
|
||||
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode);
|
||||
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth);
|
||||
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo);
|
||||
int32_t Phy_SetBeamAngle(PHY_INST *phyInstPtr, double offAx, double rndAx);
|
||||
|
||||
@@ -277,7 +277,7 @@
|
||||
/**
|
||||
* Register: ANT_STATUS_0
|
||||
*/
|
||||
#define ANT_STATUS 0x00000100U
|
||||
#define ANT_STATUS 0x00000048U
|
||||
#define ANT_STATUS_CODE_SHIFT 0
|
||||
#define ANT_STATUS_CODE_WIDTH 8
|
||||
#define ANT_STATUS_CODE_MASK 0x000000FFU
|
||||
@@ -294,7 +294,7 @@
|
||||
/**
|
||||
* Register: ANT_FRAME_CNT
|
||||
*/
|
||||
#define ANT_FRAME_CNT 0x00000104U
|
||||
#define ANT_FRAME_CNT 0x0000004CU
|
||||
#define ANT_FRAME_CNT_SHIFT 0
|
||||
#define ANT_FRAME_CNT_WIDTH 32
|
||||
#define ANT_FRAME_CNT_MASK 0xFFFFFFFFU
|
||||
@@ -302,7 +302,7 @@
|
||||
/**
|
||||
* Register: RF_STATUS
|
||||
*/
|
||||
#define RF_STATUS 0x00000108U
|
||||
#define RF_STATUS 0x00000050U
|
||||
#define RF_STATUS_TEMP_SHIFT 0
|
||||
#define RF_STATUS_TEMP_WIDTH 8
|
||||
#define RF_STATUS_TEMP_MASK 0x000000FFU
|
||||
@@ -319,7 +319,7 @@
|
||||
/**
|
||||
* Register: RF_MGC
|
||||
*/
|
||||
#define RF_MGC 0x0000010CU
|
||||
#define RF_MGC 0x00000054U
|
||||
#define RF_MGC_CH1_SHIFT 0
|
||||
#define RF_MGC_CH1_WIDTH 4
|
||||
#define RF_MGC_CH1_MASK 0x0000000FU
|
||||
@@ -336,7 +336,7 @@
|
||||
/**
|
||||
* Register: RF_FRAME_CNT
|
||||
*/
|
||||
#define RF_FRAME_CNT 0x00000110U
|
||||
#define RF_FRAME_CNT 0x00000058U
|
||||
#define RF_FRAME_CNT_SHIFT 0
|
||||
#define RF_FRAME_CNT_WIDTH 32
|
||||
#define RF_FRAME_CNT_MASK 0xFFFFFFFFU
|
||||
|
||||
@@ -77,6 +77,15 @@ int32_t SysMonitor_Init(void)
|
||||
memset(&(sysMonitorInst->recvLogCtrl), BUFF_NONE, sizeof(PINGPONG));
|
||||
memset(&(sysMonitorInst->protocolLogCtrl), BUFF_NONE, sizeof(PINGPONG));
|
||||
memset(&(sysMonitorInst->hwStateCtrl), BUFF_NONE, sizeof(PINGPONG));
|
||||
|
||||
sysMonitorInst->recvPL[0].dataId_flj = DATA_ID_NONE;
|
||||
sysMonitorInst->recvPL[0].dataId_lj = DATA_ID_NONE;
|
||||
sysMonitorInst->recvPL[1].dataId_flj = DATA_ID_NONE;
|
||||
sysMonitorInst->recvPL[1].dataId_lj = DATA_ID_NONE;
|
||||
sysMonitorInst->sendPL[0].dataId_flj = DATA_ID_NONE;
|
||||
sysMonitorInst->sendPL[0].dataId_lj = DATA_ID_NONE;
|
||||
sysMonitorInst->sendPL[1].dataId_flj = DATA_ID_NONE;
|
||||
sysMonitorInst->sendPL[1].dataId_lj = DATA_ID_NONE;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -209,7 +218,8 @@ void SysMonitor_UpdateSendPayloadFLJRaw(uint8_t *buff)
|
||||
uint8_t buffIndx;
|
||||
buffIndx = GetWritable(sysMonitorInst->sendPLCtrl);
|
||||
sysMonitorInst->sendPLCtrl.wBusy = buffIndx;
|
||||
memcpy(sysMonitorInst->sendPL[buffIndx].data_flj, buff, sizeof(uint8_t) * PAYLOAD_FLJ);
|
||||
memcpy(sysMonitorInst->sendPL[buffIndx].data_flj, buff, sizeof(uint8_t) * PAYLOAD_FLJ_TX);
|
||||
sysMonitorInst->sendPL[buffIndx].dataId_flj++;
|
||||
sysMonitorInst->sendPLCtrl.latest = buffIndx;
|
||||
sysMonitorInst->sendPLCtrl.wBusy = BUFF_NONE;
|
||||
}
|
||||
@@ -217,7 +227,7 @@ void SysMonitor_UpdateSendPayloadFLJRaw(uint8_t *buff)
|
||||
/**
|
||||
* Get send FLJ payload as raw data.
|
||||
*/
|
||||
void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff)
|
||||
void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff, uint32_t *id)
|
||||
{
|
||||
ASSERT(sysMonitorInst != NULL);
|
||||
uint8_t buffIndx, buffIndex_old;
|
||||
@@ -227,7 +237,11 @@ void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff)
|
||||
else
|
||||
buffIndx = GetReadable(sysMonitorInst->sendPLCtrl);
|
||||
sysMonitorInst->sendPLCtrl.rBusy = buffIndx;
|
||||
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ);
|
||||
if (sysMonitorInst->sendPL[buffIndx].dataId_flj != DATA_ID_NONE)
|
||||
{
|
||||
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ_TX);
|
||||
}
|
||||
*id = sysMonitorInst->sendPL[buffIndx].dataId_flj;
|
||||
sysMonitorInst->sendPLCtrl.rBusy = buffIndex_old;
|
||||
}
|
||||
|
||||
@@ -240,7 +254,8 @@ void SysMonitor_UpdateSendPayloadLJRaw(uint8_t *buff)
|
||||
uint8_t buffIndx;
|
||||
buffIndx = GetWritable(sysMonitorInst->sendPLCtrl);
|
||||
sysMonitorInst->sendPLCtrl.wBusy = buffIndx;
|
||||
memcpy(sysMonitorInst->sendPL[buffIndx].data_lj, buff, sizeof(uint8_t) * PAYLOAD_LJ);
|
||||
memcpy(sysMonitorInst->sendPL[buffIndx].data_lj, buff, sizeof(uint8_t) * PAYLOAD_LJ_TX);
|
||||
sysMonitorInst->sendPL[buffIndx].dataId_lj++;
|
||||
sysMonitorInst->sendPLCtrl.latest = buffIndx;
|
||||
sysMonitorInst->sendPLCtrl.wBusy = BUFF_NONE;
|
||||
}
|
||||
@@ -248,7 +263,7 @@ void SysMonitor_UpdateSendPayloadLJRaw(uint8_t *buff)
|
||||
/**
|
||||
* Get send LJ payload as raw data.
|
||||
*/
|
||||
void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff)
|
||||
void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff, uint32_t *id)
|
||||
{
|
||||
ASSERT(sysMonitorInst != NULL);
|
||||
uint8_t buffIndx, buffIndex_old;
|
||||
@@ -258,7 +273,11 @@ void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff)
|
||||
else
|
||||
buffIndx = GetReadable(sysMonitorInst->sendPLCtrl);
|
||||
sysMonitorInst->sendPLCtrl.rBusy = buffIndx;
|
||||
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ);
|
||||
if (sysMonitorInst->sendPL[buffIndx].dataId_lj != DATA_ID_NONE)
|
||||
{
|
||||
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ_TX);
|
||||
}
|
||||
*id = sysMonitorInst->sendPL[buffIndx].dataId_lj;
|
||||
sysMonitorInst->sendPLCtrl.rBusy = buffIndex_old;
|
||||
}
|
||||
|
||||
@@ -272,7 +291,8 @@ void SysMonitor_UpdateRecvPayloadFLJRaw(uint8_t *buff)
|
||||
uint8_t buffIndx;
|
||||
buffIndx = GetWritable(sysMonitorInst->recvPLCtrl);
|
||||
sysMonitorInst->recvPLCtrl.wBusy = buffIndx;
|
||||
memcpy(sysMonitorInst->recvPL[buffIndx].data_flj, buff, sizeof(uint8_t) * PAYLOAD_FLJ);
|
||||
memcpy(sysMonitorInst->recvPL[buffIndx].data_flj, buff, sizeof(uint8_t) * PAYLOAD_FLJ_RX);
|
||||
sysMonitorInst->recvPL[buffIndx].dataId_flj++;
|
||||
sysMonitorInst->recvPLCtrl.latest = buffIndx;
|
||||
sysMonitorInst->recvPLCtrl.wBusy = BUFF_NONE;
|
||||
}
|
||||
@@ -280,7 +300,7 @@ void SysMonitor_UpdateRecvPayloadFLJRaw(uint8_t *buff)
|
||||
/**
|
||||
* Get send FLJ payload as raw data.
|
||||
*/
|
||||
void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff)
|
||||
void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff, uint32_t *id)
|
||||
{
|
||||
ASSERT(sysMonitorInst != NULL);
|
||||
uint8_t buffIndx, buffIndex_old;
|
||||
@@ -290,7 +310,11 @@ void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff)
|
||||
else
|
||||
buffIndx = GetReadable(sysMonitorInst->recvPLCtrl);
|
||||
sysMonitorInst->recvPLCtrl.rBusy = buffIndx;
|
||||
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ);
|
||||
if (sysMonitorInst->recvPL[buffIndx].dataId_flj != DATA_ID_NONE)
|
||||
{
|
||||
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ_RX);
|
||||
}
|
||||
*id = sysMonitorInst->recvPL[buffIndx].dataId_flj;
|
||||
sysMonitorInst->recvPLCtrl.rBusy = buffIndex_old;
|
||||
}
|
||||
|
||||
@@ -303,7 +327,8 @@ void SysMonitor_UpdateRecvPayloadLJRaw(uint8_t *buff)
|
||||
uint8_t buffIndx;
|
||||
buffIndx = GetWritable(sysMonitorInst->recvPLCtrl);
|
||||
sysMonitorInst->recvPLCtrl.wBusy = buffIndx;
|
||||
memcpy(sysMonitorInst->recvPL[buffIndx].data_lj, buff, sizeof(uint8_t) * PAYLOAD_LJ);
|
||||
memcpy(sysMonitorInst->recvPL[buffIndx].data_lj, buff, sizeof(uint8_t) * PAYLOAD_LJ_RX);
|
||||
sysMonitorInst->recvPL[buffIndx].dataId_lj++;
|
||||
sysMonitorInst->recvPLCtrl.latest = buffIndx;
|
||||
sysMonitorInst->recvPLCtrl.wBusy = BUFF_NONE;
|
||||
}
|
||||
@@ -311,7 +336,7 @@ void SysMonitor_UpdateRecvPayloadLJRaw(uint8_t *buff)
|
||||
/**
|
||||
* Get send LJ payload as raw data.
|
||||
*/
|
||||
void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff)
|
||||
void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff, uint32_t *id)
|
||||
{
|
||||
ASSERT(sysMonitorInst != NULL);
|
||||
uint8_t buffIndx, buffIndex_old;
|
||||
@@ -321,7 +346,11 @@ void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff)
|
||||
else
|
||||
buffIndx = GetReadable(sysMonitorInst->recvPLCtrl);
|
||||
sysMonitorInst->recvPLCtrl.rBusy = buffIndx;
|
||||
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ);
|
||||
if (sysMonitorInst->recvPL[buffIndx].dataId_lj != DATA_ID_NONE)
|
||||
{
|
||||
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ_RX);
|
||||
}
|
||||
*id = sysMonitorInst->recvPL[buffIndx].dataId_lj;
|
||||
sysMonitorInst->recvPLCtrl.rBusy = buffIndex_old;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,14 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define PAYLOAD_FLJ 78
|
||||
#define PAYLOAD_LJ 168
|
||||
#define PAYLOAD_LEN 256
|
||||
#define PAYLOAD_FLJ_RX 168
|
||||
#define PAYLOAD_FLJ_TX 66
|
||||
#define PAYLOAD_LJ_RX 66
|
||||
#define PAYLOAD_LJ_TX 168
|
||||
|
||||
#define DATA_ID_NONE UINT32_MAX
|
||||
#define DATA_ID_TEST 0x02030203
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -54,8 +60,10 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t data_lj[PAYLOAD_LJ];
|
||||
uint8_t data_flj[PAYLOAD_FLJ];
|
||||
uint32_t dataId_lj;
|
||||
uint8_t data_lj[PAYLOAD_LEN];
|
||||
uint32_t dataId_flj;
|
||||
uint8_t data_flj[PAYLOAD_LEN];
|
||||
} PAYLOAD;
|
||||
|
||||
typedef struct
|
||||
@@ -65,7 +73,7 @@ typedef struct
|
||||
uint8_t slotNo;
|
||||
uint8_t frameType;
|
||||
// Payload
|
||||
uint8_t payload[256];
|
||||
uint8_t payload[PAYLOAD_LEN];
|
||||
// Time sync info
|
||||
uint64_t tmStamp;
|
||||
uint32_t tmDevi;
|
||||
@@ -95,7 +103,7 @@ typedef struct
|
||||
// -- Signal processor status
|
||||
uint16_t spVolt;
|
||||
uint16_t spTemp;
|
||||
uint16_t chipSt;
|
||||
uint8_t chipSt;
|
||||
// -- Antenna status
|
||||
uint8_t antVolt;
|
||||
uint8_t antTemp;
|
||||
@@ -131,10 +139,10 @@ void SysMonitor_UpdateSendPayloadFLJRaw(uint8_t *buff);
|
||||
void SysMonitor_UpdateRecvPayloadFLJRaw(uint8_t *buff);
|
||||
void SysMonitor_UpdateSendPayloadLJRaw(uint8_t *buff);
|
||||
void SysMonitor_UpdateRecvPayloadLJRaw(uint8_t *buff);
|
||||
void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff);
|
||||
void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff);
|
||||
void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff);
|
||||
void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff);
|
||||
void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff, uint32_t *id);
|
||||
void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff, uint32_t *id);
|
||||
void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff, uint32_t *id);
|
||||
void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff, uint32_t *id);
|
||||
|
||||
void SysMonitor_UpdateSendSlotLog(SLOTLOG *log);
|
||||
void SysMonitor_UpdateRecvSlotLog(SLOTLOG *log);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "../system_monitor.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
// Common Field
|
||||
// -- Command word
|
||||
#define WD_CMD 0x00
|
||||
@@ -37,7 +38,7 @@
|
||||
// -- Production type
|
||||
#define WD_PRD 0x01
|
||||
#define PRD_DL_K 0xDD
|
||||
#define PRD_DL_S 0xDE
|
||||
#define PRD_DL_S 0xEE
|
||||
#define PRD_ALL 0xFF
|
||||
|
||||
// Self-Test
|
||||
@@ -51,55 +52,53 @@
|
||||
#define ST_RET_OK 0xAA
|
||||
#define ST_RET_ERROR 0x55
|
||||
// -- -- Signal processor voltage
|
||||
#define WD_SP_VOLT_L 0x03
|
||||
#define WD_SP_VOLT_H 0x04
|
||||
#define WD_SP_VOLT 0x03
|
||||
// -- -- Signal processor temperature
|
||||
#define WD_SP_TEMP_L 0x05
|
||||
#define WD_SP_TEMP_H 0x06
|
||||
#define WD_SP_TEMP 0x04
|
||||
// -- -- Signal processor chip status
|
||||
#define WD_SP_CS_L 0x07
|
||||
#define WD_SP_CS_H 0x08
|
||||
#define WD_SP_CS 0x05
|
||||
// -- -- Signal processor antenna voltage
|
||||
#define WD_AS_VOLT 0x09
|
||||
#define WD_ANT_VOLT 0x06
|
||||
// -- -- Signal processor antenna temperature
|
||||
#define WD_AS_TEMP 0x0A
|
||||
#define WD_ANT_TEMP 0x07
|
||||
// -- -- Signal processor antenna PLL lock status
|
||||
#define WD_AS_PLL 0x0B
|
||||
#define WD_ANT_PLL 0x08
|
||||
// -- -- Signal processor antenna MGC
|
||||
#define WD_AS_MGC_L 0x0C
|
||||
#define WD_AS_MGC_H 0x0D
|
||||
#define WD_ANT_MGC_L 0x09
|
||||
#define WD_ANT_MGC_H 0x0A
|
||||
// -- -- Signal processor antenna status
|
||||
#define WD_AS_ST 0x0E.
|
||||
#define WD_ANT_ST 0x0B
|
||||
// -- -- Dummy must be 0x00
|
||||
#define WD_ST_DUMMY 0x0F
|
||||
#define WD_ST_DUMMY 0x0C
|
||||
|
||||
// Data Send Test Command
|
||||
#define CMD_DATA_TEST_A 0xE2
|
||||
// -- Request
|
||||
#define DATA_TEST_REQ_A_LEN 80
|
||||
// -- -- 78 byte payload
|
||||
#define DATA_TEST_REQ_A_LEN 68
|
||||
// -- -- 68 byte payload
|
||||
// -- Response
|
||||
#define DATA_TEST_RSP_A_LEN 80
|
||||
// -- -- 78 byte payload
|
||||
#define DATA_TEST_RSP_A_LEN 68
|
||||
// -- -- 68 byte payload
|
||||
|
||||
// Data Send Test Command
|
||||
#define CMD_DATA_TEST_B 0xF2
|
||||
// -- Request
|
||||
#define DATA_TEST_REQ_B_LEN 152
|
||||
// -- -- 150 byte payload
|
||||
#define DATA_TEST_REQ_B_LEN 170
|
||||
// -- -- 170 byte payload
|
||||
// -- Response
|
||||
#define DATA_TEST_RSP_B_LEN 152
|
||||
// -- -- 150 byte payload
|
||||
#define DATA_TEST_RSP_B_LEN 170
|
||||
// -- -- 170 byte payload
|
||||
|
||||
// Config load
|
||||
#define CMD_CONFIG 0xE3
|
||||
// -- Request
|
||||
#define WD_EN_CMD 0x02
|
||||
#define EN_CMD_ON 0x66
|
||||
#define EN_CMD_ON_HIGH_POWER 0x66
|
||||
#define EN_CMD_ON_LOW_POWER 0x88
|
||||
|
||||
#define WD_MODE_CMD 0x03
|
||||
#define MODE_CMD_HEAD 0x11
|
||||
#define MODE_CMD_MEMBER 0x11
|
||||
#define MODE_CMD_MEMBER 0x00
|
||||
// -- Response
|
||||
// -- -- none response
|
||||
|
||||
@@ -133,8 +132,8 @@
|
||||
#define WD_FLJ_POLL 0x02
|
||||
#define FLJ_POLL_CODE 0x77
|
||||
// -- Response
|
||||
#define FLJ_POLL_RESP_LEN 78
|
||||
// -- -- received 78 byte payload
|
||||
#define FLJ_POLL_RESP_LEN 170
|
||||
// -- -- received 170 byte payload
|
||||
|
||||
// LJ Poll
|
||||
#define CMD_LJ_POLL 0xF5
|
||||
@@ -142,8 +141,8 @@
|
||||
#define WD_LJ_POLL 0x02
|
||||
#define LJ_POLL_CODE 0x77
|
||||
// -- Response
|
||||
#define LJ_POLL_RESP_LEN 168
|
||||
// -- -- received 156 byte payload
|
||||
#define LJ_POLL_RESP_LEN 68
|
||||
// -- -- received 68 byte payload
|
||||
|
||||
// Remote Test FLJ
|
||||
#define CMD_FLJ_RM_TEST 0xE6
|
||||
@@ -165,6 +164,15 @@
|
||||
// My Production Type
|
||||
#define MY_PRD_ID PRD_DL_K
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
/**************************** Type Definitions *******************************/
|
||||
/************************** Variable Definitions *****************************/
|
||||
// TODO: better approach?
|
||||
#include "../networking/link_layer/link_layer.h"
|
||||
#include "../networking/phy_layer/phy_layer.h"
|
||||
extern L2_INST *linkInstPtr;
|
||||
extern L2_CONFIG linkConfig;
|
||||
|
||||
inline bool SystemBus_IsReqPendding(SYSBUS *instPtr)
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
@@ -337,10 +345,62 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
break;
|
||||
}
|
||||
case CMD_CONFIG:
|
||||
{
|
||||
// FIXME: apply configurations
|
||||
// Power + Mode
|
||||
// -- No response
|
||||
{
|
||||
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
|
||||
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_HIGH_POWER);
|
||||
Linklayer_Start(linkInstPtr);
|
||||
|
||||
}
|
||||
else if(data[WD_EN_CMD] == EN_CMD_ON_LOW_POWER)
|
||||
{
|
||||
// low power config
|
||||
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_LOW_POWER);
|
||||
Linklayer_Start(linkInstPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
// silence config
|
||||
// TODO: better approach?
|
||||
Linklayer_Halt(linkInstPtr);
|
||||
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_SILENT);
|
||||
TIME_WORD pullTime = {0, 0};
|
||||
pullTime.int_part = TimeCtrl_GetIntCnt(tmcRef) + 1;
|
||||
Status = Phy_SetTimeWord(phyRef, &pullTime, PHY_TIME_WORD_POLL);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Physical set pull time failed, with error code: %" PRId32 ".\n", Status);
|
||||
}
|
||||
Phy_SetupNextSlot(phyRef, PHY_TOR_RX, L1_10KBPS_10MS_FRAME, NULL);
|
||||
}
|
||||
|
||||
_nop_(); // for debug
|
||||
Status = SUCCESS;
|
||||
break;
|
||||
@@ -377,9 +437,17 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
break;
|
||||
}
|
||||
sysbusRsp->len = FLJ_POLL_RESP_LEN;
|
||||
sysbusRsp->data[WD_CMD] = WD_FLJ_POLL;
|
||||
sysbusRsp->data[WD_CMD] = CMD_FLJ_POLL;
|
||||
sysbusRsp->data[WD_PRD] = MY_PRD_ID;
|
||||
SysMonitor_GetRecvPayloadFLJRaw(sysbusRsp->data + FLJ_DATA_OFFSET); // omit control info
|
||||
uint32_t dataId;
|
||||
SysMonitor_GetRecvPayloadFLJRaw(sysbusRsp->data + FLJ_DATA_OFFSET, &dataId); // omit control info
|
||||
if (dataId == DATA_ID_NONE)
|
||||
{
|
||||
free(sysbusRsp);
|
||||
DBG_WARNING("SystemBus::no RX data!\n");
|
||||
Status = SUCCESS;
|
||||
break;
|
||||
}
|
||||
if (CircQueuePush(instPtr->txQueue, (void *)sysbusRsp) == false)
|
||||
{
|
||||
free(sysbusRsp);
|
||||
@@ -405,9 +473,17 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
break;
|
||||
}
|
||||
sysbusRsp->len = LJ_POLL_RESP_LEN;
|
||||
sysbusRsp->data[WD_CMD] = WD_LJ_POLL;
|
||||
sysbusRsp->data[WD_CMD] = CMD_LJ_POLL;
|
||||
sysbusRsp->data[WD_PRD] = MY_PRD_ID;
|
||||
SysMonitor_GetRecvPayloadLJRaw(sysbusRsp->data + 2); // omit control info
|
||||
uint32_t dataId;
|
||||
SysMonitor_GetRecvPayloadLJRaw(sysbusRsp->data + LJ_DATA_OFFSET, &dataId); // omit control info
|
||||
if (dataId == DATA_ID_NONE)
|
||||
{
|
||||
free(sysbusRsp);
|
||||
DBG_WARNING("SystemBus::no RX data!\n");
|
||||
Status = SUCCESS;
|
||||
break;
|
||||
}
|
||||
if (CircQueuePush(instPtr->txQueue, (void *)sysbusRsp) == false)
|
||||
{
|
||||
free(sysbusRsp);
|
||||
|
||||
@@ -218,13 +218,13 @@ void TimeCtrl_TimeAdjust(TMC_INST *instPtr, const TIME_WORD *tmWord, TIMECTRL_AD
|
||||
ASSERT(tmWord != NULL);
|
||||
if (type < TM_ADJ_ADD || TM_ADJ_ADD > TM_ADJ_SET)
|
||||
{
|
||||
DBG_ERROR("Unsupported adjustment type: %d", type);
|
||||
DBG_ERROR("Unsupported adjustment type: %" PRId8 ".\n", type);
|
||||
return;
|
||||
}
|
||||
if (((int32_t)tmWord->frac_part) > TIME_FRAC_MAX || ((int32_t)tmWord->frac_part) < -TIME_FRAC_MAX)
|
||||
{
|
||||
DBG_WARNING("Invalid fractional value %d (should between %d~%d)\n",
|
||||
tmWord->frac_part, -TIME_FRAC_MAX, TIME_FRAC_MAX);
|
||||
DBG_WARNING("Invalid fractional value %" PRIu32 " (should between %" PRIu32 "~%" PRIu32 ")\n",
|
||||
tmWord->frac_part, (uint32_t)(-TIME_FRAC_MAX), (uint32_t)TIME_FRAC_MAX);
|
||||
return;
|
||||
}
|
||||
TMC_Write(instPtr, TIME_ADJ_FRAC, tmWord->frac_part);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#! /bin/sh
|
||||
|
||||
GE_TXATT=0
|
||||
GE_RXATT=25
|
||||
|
||||
DST_DIR=`pwd`
|
||||
PROJECT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
cp -rL $PROJECT_DIR/df_datalink_sp/src $DST_DIR/df_datalink_sp
|
||||
cp -rL $PROJECT_DIR/df_datalink_ge/src $DST_DIR/df_datalink_ge
|
||||
|
||||
cd $DST_DIR/df_datalink_ge/networking/phy_layer
|
||||
sed -i "s/antConfig->rfTxMgc = 0;/antConfig->rfTxMgc = $GE_TXATT;/g" ./phy_antenna.c
|
||||
sed -i "s/antConfig->rcvMgc = 0;/antConfig->rcvMgc = $GE_RXATT;/g" ./phy_antenna.c
|
||||
Reference in New Issue
Block a user