Compare commits
7
Commits
6f98baf096
...
5c5a50e4ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c5a50e4ad | ||
|
|
b3451b6c0a | ||
|
|
f29ffb561d | ||
|
|
34dcdcd0f6 | ||
|
|
4760abdb96 | ||
|
|
c98472cad7 | ||
|
|
f2ce6897d2 |
@@ -75,11 +75,11 @@ int HARDWARE_initialize()
|
||||
// /**********************************************************/
|
||||
// Status = HW_ad9371DynamicCfgInit();
|
||||
// if (Status != ADIERR_OK){
|
||||
// xil_printf("HW:: AD9371 dynamic configuration initialization failed!\n");
|
||||
// printf("HW:: AD9371 dynamic configuration initialization failed!\n");
|
||||
// return ADIERR_FAILED;
|
||||
// }
|
||||
//
|
||||
// xil_printf("HW:: AD9371 ready to be reconfigured!\n");
|
||||
// printf("HW:: AD9371 ready to be reconfigured!\n");
|
||||
//
|
||||
// // main loop
|
||||
// while(1);
|
||||
@@ -97,8 +97,6 @@ int HARDWARE_ad9371Config(void)
|
||||
uint8_t obsFramerStatus;
|
||||
uint8_t deframerStatus;
|
||||
|
||||
xil_printf("main: Hello\n");
|
||||
|
||||
/**********************************************************/
|
||||
/*********** Initialize Configuration Interface ***********/
|
||||
/**********************************************************/
|
||||
@@ -112,7 +110,7 @@ int HARDWARE_ad9371Config(void)
|
||||
return ADIERR_FAILED;
|
||||
}
|
||||
|
||||
xil_printf("HW:: Initialize configuration interface done!\n");
|
||||
printf("HW:: Initialize configuration interface done!\n");
|
||||
|
||||
/**********************************************************/
|
||||
/****************** AD9528 Configuration ******************/
|
||||
@@ -122,14 +120,14 @@ int HARDWARE_ad9371Config(void)
|
||||
return ADIERR_FAILED;
|
||||
}
|
||||
|
||||
xil_printf("HW:: AD9528 configuration done!\n");
|
||||
printf("HW:: AD9528 configuration done!\n");
|
||||
|
||||
Status = HW_9528GetLockStatus(ad9528Init, ®508);
|
||||
if (Status != ADIERR_OK){
|
||||
return ADIERR_FAILED;
|
||||
}
|
||||
|
||||
xil_printf("HW:: AD9528 REG508: 0x%02x \n",reg508);
|
||||
printf("HW:: AD9528 REG508: 0x%02x\n",reg508);
|
||||
|
||||
/**********************************************************/
|
||||
/****************** AD9371 Configuration ******************/
|
||||
@@ -153,7 +151,7 @@ int HARDWARE_ad9371Config(void)
|
||||
printf("HW:: DeframerStatus = 0x%x\n", deframerStatus);
|
||||
}
|
||||
|
||||
xil_printf("HW:: All configuration done!\n");
|
||||
printf("HW:: All configuration done!\n");
|
||||
|
||||
return ADIERR_OK;
|
||||
}
|
||||
@@ -232,13 +230,13 @@ int HW_setupIntrSystem(u16 DeviceId, XScuGic * GicPtr)
|
||||
*/
|
||||
CfgPtr = XScuGic_LookupConfig(DeviceId);
|
||||
if (!CfgPtr) {
|
||||
xil_printf("No interrupt config found for %d\n", DeviceId);
|
||||
printf("No interrupt config found for %d\n", DeviceId);
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
Status = XScuGic_CfgInitialize(GicPtr, CfgPtr, CfgPtr->CpuBaseAddress);
|
||||
if (Status != XST_SUCCESS) {
|
||||
xil_printf("No interrupt config found for %d\n", DeviceId);
|
||||
printf("No interrupt config found for %d\n", DeviceId);
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
@@ -810,7 +808,7 @@ int HW_9371SmallFrequencyChange(mykonosDevice_t *mykDevice, uint64_t freq_Hz)
|
||||
*/
|
||||
if((mykError = MYKONOS_radioOff(mykDevice)) != MYKONOS_ERR_OK)
|
||||
{
|
||||
xil_printf("Turn radio off failed!\n\r");
|
||||
printf("Turn radio off failed!\n\r");
|
||||
return ADIERR_FAILED;
|
||||
}
|
||||
|
||||
@@ -820,14 +818,14 @@ int HW_9371SmallFrequencyChange(mykonosDevice_t *mykDevice, uint64_t freq_Hz)
|
||||
if((mykError = MYKONOS_setRfPllFrequency(mykDevice, TX_PLL,
|
||||
freq_Hz)) != MYKONOS_ERR_OK)
|
||||
{
|
||||
xil_printf("Set TX PLL failed!\n\r");
|
||||
printf("Set TX PLL failed!\n\r");
|
||||
return ADIERR_FAILED;
|
||||
}
|
||||
mykError = MYKONOS_checkPllsLockStatus(mykDevice, &pllLockStatus);
|
||||
if ((pllLockStatus & 0x07) != 0x07)
|
||||
{
|
||||
/*** < Info: Clock, Rx and Tx PLLs not locked > ***/
|
||||
xil_printf("Not all PLLs locked, lock status: 0x%02x\n", pllLockStatus);
|
||||
printf("Not all PLLs locked, lock status: 0x%02x\n", pllLockStatus);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -836,7 +834,7 @@ int HW_9371SmallFrequencyChange(mykonosDevice_t *mykDevice, uint64_t freq_Hz)
|
||||
// If((mykError = MYKONOS_resetExtTxLolChannel(mykDevice, TX1_TX2))
|
||||
// != MYKONOS_ERR_OK) ; //where TX1_TX2 is part of the enum mykonosTxChannels_t
|
||||
// {
|
||||
// xil_printf("Reset external channel FAILED!");
|
||||
// printf("Reset external channel FAILED!");
|
||||
// }
|
||||
|
||||
/*
|
||||
@@ -844,7 +842,7 @@ int HW_9371SmallFrequencyChange(mykonosDevice_t *mykDevice, uint64_t freq_Hz)
|
||||
*/
|
||||
if ((mykError = MYKONOS_radioOn(mykDevice)) != MYKONOS_ERR_OK)
|
||||
{
|
||||
xil_printf("Turn radio on failed!\n\r");
|
||||
printf("Turn radio on failed!\n\r");
|
||||
return ADIERR_FAILED;
|
||||
}
|
||||
|
||||
@@ -854,7 +852,7 @@ int HW_9371SmallFrequencyChange(mykonosDevice_t *mykDevice, uint64_t freq_Hz)
|
||||
// If((mykError = MYKONOS_MYKONOS_setObsRxPathSource(mykDevice, OBS_INTERNALCALS))
|
||||
// != MYKONOS_ERR_OK) ; //where TX1_TX2 is part of the enum mykonosTxChannels_t
|
||||
// {
|
||||
// xil_printf("Reenable tracking calibrations FAILED!");
|
||||
// printf("Reenable tracking calibrations FAILED!");
|
||||
// }
|
||||
return ADIERR_OK;
|
||||
}
|
||||
@@ -877,7 +875,7 @@ int HW_9371LargeFrequencyChange(mykonosDevice_t *mykDevice, uint64_t freq_Hz)
|
||||
*/
|
||||
if((mykError = MYKONOS_radioOff(mykDevice)) != MYKONOS_ERR_OK)
|
||||
{
|
||||
xil_printf("Turn radio off failed!\n\r");
|
||||
printf("Turn radio off failed!\n\r");
|
||||
return ADIERR_FAILED;
|
||||
}
|
||||
|
||||
@@ -894,7 +892,7 @@ int HW_9371LargeFrequencyChange(mykonosDevice_t *mykDevice, uint64_t freq_Hz)
|
||||
if ((pllLockStatus & 0x07) != 0x07)
|
||||
{
|
||||
/*** < Info: Clock, Rx and Tx PLLs not locked > ***/
|
||||
xil_printf("Not all PLLs locked, lock status: 0x%02x\n", pllLockStatus);
|
||||
printf("Not all PLLs locked, lock status: 0x%02x\n", pllLockStatus);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -957,7 +955,7 @@ int HW_9371LargeFrequencyChange(mykonosDevice_t *mykDevice, uint64_t freq_Hz)
|
||||
*/
|
||||
if ((mykError = MYKONOS_radioOn(mykDevice)) != MYKONOS_ERR_OK)
|
||||
{
|
||||
xil_printf("Turn radio on failed!\n\r");
|
||||
printf("Turn radio on failed!\n\r");
|
||||
return ADIERR_FAILED;
|
||||
}
|
||||
|
||||
|
||||
@@ -859,6 +859,7 @@ int32_t Linklayer_EventHandler(L2_INST* instPtr, const L2_EVENT* l2Event) {
|
||||
DBG_INFO("Event L2_EV_NETSETUP_DONE asserted....\n");
|
||||
if(L2_GetNodeType(instPtr) != L2_NODE_HEAD){
|
||||
instPtr->cxn2Net = true;
|
||||
instPtr->netStartTime = *((uint32_t*)l2Event->msg);
|
||||
}
|
||||
else{ // Head node
|
||||
UpdateMainSate(instPtr, L2_NORMAL_STATE);
|
||||
@@ -997,7 +998,7 @@ int32_t Linklayer_PktHandler(L2_INST* instPtr, L2_FRAME_TYPE frameType) {
|
||||
Status = ServiceNet_PktHandler(instPtr);
|
||||
break;
|
||||
default:
|
||||
DBG_WARNING("L2FrameHandler: UNKNOWN L2-FrameType %d", frameType);
|
||||
DBG_WARNING("L2FrameHandler: UNKNOWN L2-FrameType %d\n", frameType);
|
||||
Status = FAILURE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ L2_FRAME_TYPE L2_GetNextFrameType(L2_INST* instPtr);
|
||||
L2_TOR_TYPE L2_GetNextTor(L2_INST* instPtr);
|
||||
|
||||
// Time syncronization
|
||||
int32_t L2_TimeAlign(L2_INST* instPtr, uint32_t frameNum, uint32_t slotNum);
|
||||
int32_t L2_TimeAlign(L2_INST* instPtr, uint32_t frameNum, uint32_t slotNum, bool relative);
|
||||
|
||||
// RTT
|
||||
int32_t RTT_Init(L2_RTT_FSM** rttFsmPtr);
|
||||
|
||||
@@ -425,7 +425,7 @@ static int32_t MgmtMsg_Packing(L2_INST* instPtr, BIT_ARRAY* bitarr, L2_MSG_TYPE
|
||||
break;
|
||||
|
||||
default:
|
||||
DBG_ERROR("Unsupported message type: %d", msgType);
|
||||
DBG_ERROR("Unsupported message type: %d\n", msgType);
|
||||
return EPARAM;
|
||||
break;
|
||||
}
|
||||
@@ -738,7 +738,7 @@ int32_t MgmtNet_PktHandler(L2_INST* instPtr) {
|
||||
L2_RstNodeTTL(instPtr->nodeList, mgmtMsgLog->srcNodeId);
|
||||
// TODO: Check
|
||||
if(mgmtMsgLog->srcNodeId == L2_GetHeadId(instPtr)){
|
||||
L2_TimeAlign(instPtr, L2_GetCurrentFrameNum(instPtr), L2_GetCurrentSlotNum(instPtr));
|
||||
L2_TimeAlign(instPtr, L2_GetLastFrameNum(instPtr), L2_GetLastSlotNum(instPtr), true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -853,7 +853,7 @@ int32_t MgmtNet_PktHandler(L2_INST* instPtr) {
|
||||
L2_RstNodeTTL(instPtr->nodeList, rttMsgRspLog->srcAddr & 0x001F);
|
||||
// TODO: Check
|
||||
if((rttMsgRspLog->srcAddr&0x001F) == L2_GetHeadId(instPtr)){
|
||||
L2_TimeAlign(instPtr, L2_GetCurrentFrameNum(instPtr), L2_GetCurrentSlotNum(instPtr));
|
||||
L2_TimeAlign(instPtr, L2_GetLastFrameNum(instPtr), L2_GetLastSlotNum(instPtr), true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -647,7 +647,7 @@ int32_t ScanNet_PktHandler(L2_INST* instPtr) {
|
||||
|
||||
if ( L2_isCxn2Net(instPtr) == false ) {
|
||||
// TODO: Check
|
||||
L2_TimeAlign(instPtr, scanFsmPtr->BMrcvLog.frameNum, scanFsmPtr->BMrcvLog.slotNum);
|
||||
L2_TimeAlign(instPtr, scanFsmPtr->BMrcvLog.frameNum, scanFsmPtr->BMrcvLog.slotNum, false);
|
||||
}
|
||||
// trigger flag
|
||||
BmrecvStateUpdate(scanFsmPtr, true);
|
||||
@@ -738,19 +738,22 @@ int32_t ScanNet_PktHandler(L2_INST* instPtr) {
|
||||
// TODO: Update node information.
|
||||
}
|
||||
|
||||
if(L2_GetNodeType(instPtr) != L2_NODE_HEAD && scanFsmPtr->W2ACQrcvLog.NetStage != L2_NONE_STATE){
|
||||
// Update net start time
|
||||
instPtr->netStartTime = scanFsmPtr->W2ACQrcvLog.NetScanTime;
|
||||
// sync state with head node
|
||||
L2_NODE_STATE newState = scanFsmPtr->W2ACQrcvLog.NetStage;
|
||||
L2_EVENT stateUpEvent = {
|
||||
.event = L2_EV_MAIN_STATE_UPDATE,
|
||||
.msg = &newState
|
||||
};
|
||||
AssertL2Event(instPtr, &stateUpEvent);
|
||||
|
||||
if(L2_GetNodeType(instPtr) != L2_NODE_HEAD){
|
||||
// check if net setup finished.
|
||||
if(L2_GetMainState(instPtr) == L2_INIT_STATE && L2_isCxn2Net(instPtr) == false){
|
||||
|
||||
// Assert net setup done event...
|
||||
uint32_t netStartTime = scanFsmPtr->W2ACQrcvLog.NetScanTime;
|
||||
L2_EVENT netSetupDoneEvent = {
|
||||
.event = L2_EV_NET_SETUP_DONE,
|
||||
.msg = &netStartTime
|
||||
};
|
||||
AssertL2Event(instPtr, &netSetupDoneEvent);
|
||||
|
||||
// Update time sync since netStartTime updated.
|
||||
L2_TimeAlign(instPtr, L2_GetLastFrameNum(instPtr), L2_GetLastSlotNum(instPtr), true);
|
||||
|
||||
// Assert update routine event...
|
||||
L2_RTNE_CONFIG newRtneConfig = {0};
|
||||
L2_EVENT rtneUpEvent = {
|
||||
.event = L2_ROUTINE_UPDATE,
|
||||
@@ -766,12 +769,17 @@ int32_t ScanNet_PktHandler(L2_INST* instPtr) {
|
||||
newRtneConfig.rtnePrd = ARRAY_SIZE(intraSeekTable);
|
||||
AssertL2Event(instPtr, &rtneUpEvent);
|
||||
}
|
||||
L2_EVENT netSetupDoneEvent = {
|
||||
.event = L2_EV_NET_SETUP_DONE,
|
||||
.msg = NULL
|
||||
};
|
||||
AssertL2Event(instPtr, &netSetupDoneEvent);
|
||||
}
|
||||
|
||||
// sync state with head node
|
||||
L2_NODE_STATE newState = scanFsmPtr->W2ACQrcvLog.NetStage;
|
||||
L2_EVENT stateUpEvent = {
|
||||
.event = L2_EV_MAIN_STATE_UPDATE,
|
||||
.msg = &newState
|
||||
};
|
||||
AssertL2Event(instPtr, &stateUpEvent);
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ static void RTT_GetFrameStart(L2_INST* instPtr, TIME_WORD *tmStamp, L2_TOR_TYPE
|
||||
*
|
||||
******************************************************************************/
|
||||
// TODO: Check
|
||||
int32_t L2_TimeAlign(L2_INST* instPtr, uint32_t frameNum, uint32_t slotNum){
|
||||
int32_t L2_TimeAlign(L2_INST* instPtr, uint32_t frameNum, uint32_t slotNum, bool relative){
|
||||
L1_FRAME_TYPE lastRecvdFrame;
|
||||
lastRecvdFrame = Phy_GetLastRecvFrameType(instPtr->config.phyInstPtr);
|
||||
if(lastRecvdFrame == L1_NONE_FRAME){
|
||||
@@ -68,9 +68,13 @@ int32_t L2_TimeAlign(L2_INST* instPtr, uint32_t frameNum, uint32_t slotNum){
|
||||
uint64_t currTime, expctTime;
|
||||
int64_t timeDiff;
|
||||
TIME_WORD timeStamp, slotTimerAdjmet;
|
||||
expctTime = ((uint64_t)(frameNum*L2_SLOTS_PER_FRAME + slotNum))*TIME_FRAC_MAX;
|
||||
expctTime = ((uint64_t)(frameNum * L2_SLOTS_PER_FRAME + slotNum)) * TIME_FRAC_MAX;
|
||||
expctTime += Phy_GetTimeComp(lastRecvdFrame);
|
||||
|
||||
if(relative) {
|
||||
expctTime += (uint64_t)instPtr->netStartTime * L2_SLOTS_PER_FRAME * TIME_FRAC_MAX;
|
||||
}
|
||||
|
||||
Phy_GetFrameSyncTimeStamp(instPtr->config.phyInstPtr, &timeStamp);
|
||||
currTime = (uint64_t)timeStamp.frac_part;
|
||||
currTime += ((uint64_t)timeStamp.int_part) * TIME_FRAC_MAX;
|
||||
|
||||
@@ -338,7 +338,7 @@ int MPC_StateUpload(MPC_INST* instPtr , uint8_t* mgmtBuffer , uint32_t mgmtMsgC
|
||||
MPC_InsertChunk(mpcTxMsgBuff, STATE_STAGE_OFFSET, STATE_STAGE_LEN, dataChunk);
|
||||
|
||||
// Net setup time
|
||||
dataChunk = (L2_GetNextFrameNum(linkInstPtr) - linkInstPtr->netStartTime) * 1000 + L2_GetNextSlotNum(linkInstPtr) * 5 ;
|
||||
dataChunk = (L2_GetNextFrameNum(linkInstPtr) + linkInstPtr->netStartTime) * 1000 + L2_GetNextSlotNum(linkInstPtr) * 5 ;
|
||||
MPC_InsertChunk(mpcTxMsgBuff, STATE_SETUP_TIME_OFFSET, STATE_SETUP_TIME_LEN, dataChunk);
|
||||
// number of nodes
|
||||
dataChunk = L2_GetNodeListLen(linkInstPtr->nodeList);
|
||||
|
||||
Reference in New Issue
Block a user