Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13f07021de | ||
|
|
fbe41ce9a6 | ||
|
|
932b4561d5 | ||
|
|
912b30e457 | ||
|
|
5453b487ff | ||
|
|
1e57ca2c1b | ||
|
|
6bf35c8c5d |
@@ -340,13 +340,13 @@ void L2_FrameStateUpdate(L2_INST *instPtr)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case L2_INTRA_W2_ACQ_FRAME:
|
case L2_INTRA_W2_ACQ_FRAME:
|
||||||
instPtr->log.mgmtRecvCnt++;
|
instPtr->log.w2acqRecvCnt++;
|
||||||
if (L2_CrcCheck(instPtr->recvPktData,
|
if (L2_CrcCheck(instPtr->recvPktData,
|
||||||
W2ACQ_FRAME_CRC_DLEN, W2ACQ_FRAME_CRC_POS,
|
W2ACQ_FRAME_CRC_DLEN, W2ACQ_FRAME_CRC_POS,
|
||||||
L2_CRC16_8005) == true)
|
L2_CRC16_8005) == true)
|
||||||
{
|
{
|
||||||
L2_DataAvailUpdate(instPtr, true);
|
L2_DataAvailUpdate(instPtr, true);
|
||||||
instPtr->log.mgmtCorrectCnt++;
|
instPtr->log.w2acqCorrectCnt++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -533,8 +533,7 @@ static int32_t Scan_BmAdvtHandler(L2_INST *instPtr)
|
|||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
DBG_WARNING("BM timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
|
DBG_WARNING("BM timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
|
||||||
scanFsmPtr->bmTimeout = 0; /* reset listen counter. */
|
ScanNet_Reset(scanFsmPtr);
|
||||||
StageUpdate(scanFsmPtr, L2_SCAN_INIT_STAGE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -592,8 +591,7 @@ static int32_t Scan_2WAcqHandler(L2_INST *instPtr)
|
|||||||
if (scanFsmPtr->w2acqTimeout >= WAY2_ACQ_SLOT_MAX)
|
if (scanFsmPtr->w2acqTimeout >= WAY2_ACQ_SLOT_MAX)
|
||||||
{
|
{
|
||||||
DBG_WARNING("2WAcq timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
|
DBG_WARNING("2WAcq timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
|
||||||
scanFsmPtr->w2acqTimeout = 0; // reset counter for next scan.
|
ScanNet_Reset(scanFsmPtr);
|
||||||
StageUpdate(scanFsmPtr, L2_SCAN_INIT_STAGE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+12
-12
@@ -69,7 +69,7 @@ int SetupInterruptSystem(XScuGic *instPtr, uint32_t devId);
|
|||||||
void PhysicalIntr_Handler(void *callBackRef);
|
void PhysicalIntr_Handler(void *callBackRef);
|
||||||
void PeriodicPull_Handler(void *callBackRef);
|
void PeriodicPull_Handler(void *callBackRef);
|
||||||
#ifdef _MPC_CTRL
|
#ifdef _MPC_CTRL
|
||||||
void MPC_IntrHandler(void *CallBackRef);
|
void MPC_IntrHandler(void *callBackRef);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*********************** Driver Instance Definitions **************************/
|
/*********************** Driver Instance Definitions **************************/
|
||||||
@@ -200,12 +200,12 @@ void MPC_PCIESentStart()
|
|||||||
/**
|
/**
|
||||||
* @brief Handler of mater pc contrl interrupt.
|
* @brief Handler of mater pc contrl interrupt.
|
||||||
*
|
*
|
||||||
* @param CallBackRef A pointer to corresponding mpcInstPtr instance.
|
* @param callBackRef A pointer to corresponding mpcInstPtr instance.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void MPC_IntrHandler(void *CallBackRef)
|
void MPC_IntrHandler(void *callBackRef)
|
||||||
{
|
{
|
||||||
MPC_MsgHandler(mpcInstPtr);
|
MPC_MsgHandler(mpcInstPtr);
|
||||||
}
|
}
|
||||||
@@ -215,18 +215,13 @@ void MPC_IntrHandler(void *CallBackRef)
|
|||||||
/**
|
/**
|
||||||
* @brief Handler of physical layer interrupt.
|
* @brief Handler of physical layer interrupt.
|
||||||
*
|
*
|
||||||
* @param CallBackRef A pointer to corresponding physical layer instance.
|
* @param callBackRef A pointer to corresponding physical layer instance.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void PhysicalIntr_Handler(void *callBackRef)
|
void PhysicalIntr_Handler(void *callBackRef)
|
||||||
{
|
{
|
||||||
uint32_t GpioConfig = XGpio_DiscreteRead(&configGpio, 2);
|
|
||||||
if (L2_isDataAvail(linkInstPtr) == true)
|
|
||||||
{
|
|
||||||
GpioConfig ^= 0x00000001;
|
|
||||||
}
|
|
||||||
Phy_UpdateState(phyInstPtr);
|
Phy_UpdateState(phyInstPtr);
|
||||||
if (phyInstPtr->TOR.curr == PHY_TOR_TX)
|
if (phyInstPtr->TOR.curr == PHY_TOR_TX)
|
||||||
{
|
{
|
||||||
@@ -292,7 +287,6 @@ void PhysicalIntr_Handler(void *callBackRef)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XGpio_DiscreteWrite(&configGpio, 2, GpioConfig);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@@ -307,7 +301,6 @@ void PhysicalIntr_Handler(void *callBackRef)
|
|||||||
void PeriodicPull_Handler(void *callBackRef)
|
void PeriodicPull_Handler(void *callBackRef)
|
||||||
{
|
{
|
||||||
int32_t Status;
|
int32_t Status;
|
||||||
|
|
||||||
Status = Linklayer_Proc(linkInstPtr);
|
Status = Linklayer_Proc(linkInstPtr);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -337,7 +330,14 @@ void PeriodicPull_Handler(void *callBackRef)
|
|||||||
mpcRecord->frame7CntLast = mpcRecord->frame7Recv;
|
mpcRecord->frame7CntLast = mpcRecord->frame7Recv;
|
||||||
mpcRecord->frame8CntLast = mpcRecord->frame8Recv;
|
mpcRecord->frame8CntLast = mpcRecord->frame8Recv;
|
||||||
}
|
}
|
||||||
} // PhyIntr_Handler
|
|
||||||
|
uint32_t GpioConfig = XGpio_DiscreteRead(&configGpio, 2);
|
||||||
|
if (L2_isDataAvail(linkInstPtr) == true)
|
||||||
|
{
|
||||||
|
GpioConfig ^= 0x00000001;
|
||||||
|
}
|
||||||
|
XGpio_DiscreteWrite(&configGpio, 2, GpioConfig);
|
||||||
|
} // PeriodicPull_Handler
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -666,18 +666,18 @@ double Phy_GetCoarseFreqEst(PHY_INST *instPtr)
|
|||||||
return INFINITY; // FIXME
|
return INFINITY; // FIXME
|
||||||
}
|
}
|
||||||
regValue = PhyRead(instPtr, COASE_FREQEST);
|
regValue = PhyRead(instPtr, COASE_FREQEST);
|
||||||
acqFreqIdx = (regValue >> COASE_FREQEST_ACQ_SHIFT) && COASE_FREQEST_ACQ_MASK;
|
acqFreqIdx = (regValue & COASE_FREQEST_ACQ_MASK) >> COASE_FREQEST_ACQ_SHIFT;
|
||||||
acqFreqIdx = 80 - acqFreqIdx;
|
syncFreqIdx = (regValue & COASE_FREQEST_SYNC_MASK) >> COASE_FREQEST_SYNC_SHIFT;
|
||||||
syncFreqIdx = (regValue >> COASE_FREQEST_SYNC_SHIFT) && COASE_FREQEST_SYNC_MASK;
|
|
||||||
syncFreqIdx = 8 - syncFreqIdx;
|
|
||||||
if (frameType >= L1_200KBPS_5MS_FRAME)
|
if (frameType >= L1_200KBPS_5MS_FRAME)
|
||||||
{
|
{
|
||||||
freqEst = (double)acqFreqIdx * (250e3 / 4);
|
// 1.5M Rc
|
||||||
|
freqEst = (double)(80 - acqFreqIdx) * (31.25e3 / 4);
|
||||||
freqEst += (double)syncFreqIdx * 1.5e6 / 64 / 128;
|
freqEst += (double)syncFreqIdx * 1.5e6 / 64 / 128;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
freqEst = acqFreqIdx * (250e3 / 4);
|
// 12M Rc
|
||||||
|
freqEst = (double)(8 - acqFreqIdx) * (250e3 / 4);
|
||||||
freqEst += (double)syncFreqIdx * 12e6 / 64 / 128;
|
freqEst += (double)syncFreqIdx * 12e6 / 64 / 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,12 +62,12 @@
|
|||||||
#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns(Timer_L)
|
#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns(Timer_L)
|
||||||
#define L1_FRAME_2KBPS_20MS_COMP 1841158 // *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_2KBPS_100MS_COMP 1841158 // *10ns(Timer_L)
|
||||||
#define L1_FRAME_10KBPS_10MS_COMP 847733 // *10ns(Timer_L)
|
#define L1_FRAME_10KBPS_10MS_COMP 850950 // *10ns(Timer_L)
|
||||||
#define L1_FRAME_10KBPS_20MS_COMP 847733 // *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_20MS_COMP 110667 // *10ns(Timer_L)
|
||||||
#define L1_FRAME_40KBPS_10MS_COMP 110667 // *10ns(Timer_L)
|
#define L1_FRAME_40KBPS_10MS_COMP 110667 // *10ns(Timer_L)
|
||||||
#define L1_FRAME_200KBPS_5MS_COMP 19725 // *10ns(Timer_L)
|
#define L1_FRAME_200KBPS_5MS_COMP 22493 // *10ns(Timer_L)
|
||||||
#define L1_FRAME_1M2BPS_5MS_COMP 19725 // *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_H_MAX UINT32_MAX
|
||||||
#define PHY_TIME_WORD_L_MAX 0x0007A120 // 5ms/10ns
|
#define PHY_TIME_WORD_L_MAX 0x0007A120 // 5ms/10ns
|
||||||
|
|||||||
@@ -225,8 +225,8 @@
|
|||||||
#define COASE_FREQEST_ACQ_SHIFT 0
|
#define COASE_FREQEST_ACQ_SHIFT 0
|
||||||
#define COASE_FREQEST_ACQ_WIDTH 8
|
#define COASE_FREQEST_ACQ_WIDTH 8
|
||||||
#define COASE_FREQEST_ACQ_MASK 0x000000FFU
|
#define COASE_FREQEST_ACQ_MASK 0x000000FFU
|
||||||
#define COASE_FREQEST_SYNC_SHIFT 0
|
#define COASE_FREQEST_SYNC_SHIFT 8
|
||||||
#define COASE_FREQEST_SYNC_WIDTH 16
|
#define COASE_FREQEST_SYNC_WIDTH 8
|
||||||
#define COASE_FREQEST_SYNC_MASK 0x000FF00U
|
#define COASE_FREQEST_SYNC_MASK 0x000FF00U
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
/***************************************************************************
|
/*******************************************************************************
|
||||||
//**
|
|
||||||
* @file util.h
|
* @file util.h
|
||||||
* @brief Implementation of utility functions.
|
* @brief Implementation of utility functions.
|
||||||
* @author DBogdan ([email protected])
|
* @author DBogdan ([email protected])
|
||||||
|
|||||||
@@ -28,7 +28,9 @@
|
|||||||
|
|
||||||
/************************** Constant Definitions *****************************/
|
/************************** Constant Definitions *****************************/
|
||||||
/***************** Macros (Inline Functions) Definitions *********************/
|
/***************** Macros (Inline Functions) Definitions *********************/
|
||||||
#define __PRINT_BLOCK(block) do {\
|
#define __PRINT_BLOCK(block) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
block \
|
block \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@@ -38,41 +40,48 @@
|
|||||||
/* Stringify */
|
/* Stringify */
|
||||||
#define STR(x) #x
|
#define STR(x) #x
|
||||||
|
|
||||||
#define _814_DEBUG_LEVEL 3
|
// #define _814_DEBUG_LEVEL 3
|
||||||
|
|
||||||
#if _814_DEBUG_LEVEL > 0
|
#if _814_DEBUG_LEVEL > 0
|
||||||
#define DBG_PRINT(...) printf(__VA_ARGS__)
|
#define DBG_PRINT(...) printf(__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
#if _814_DEBUG_LEVEL >= 1
|
#if _814_DEBUG_LEVEL >= 1
|
||||||
#define DBG_ERROR(...) __PRINT_BLOCK( \
|
#define DBG_ERROR(...) __PRINT_BLOCK( \
|
||||||
printf("in"__FILE__" #%4d [error]\t",__LINE__); \
|
printf("in"__FILE__ \
|
||||||
printf(__VA_ARGS__); \
|
" #%4d [error]\t", \
|
||||||
)
|
__LINE__); \
|
||||||
|
printf(__VA_ARGS__);)
|
||||||
#endif
|
#endif
|
||||||
#if _814_DEBUG_LEVEL >= 2
|
#if _814_DEBUG_LEVEL >= 2
|
||||||
#define DBG_WARNING(...) __PRINT_BLOCK( \
|
#define DBG_WARNING(...) __PRINT_BLOCK( \
|
||||||
printf("[warning]\t"); \
|
printf("[warning]\t"); \
|
||||||
printf(__VA_ARGS__); \
|
printf(__VA_ARGS__);)
|
||||||
)
|
|
||||||
#endif
|
#endif
|
||||||
#if _814_DEBUG_LEVEL >= 3
|
#if _814_DEBUG_LEVEL >= 3
|
||||||
#define DBG_INFO(...) __PRINT_BLOCK( \
|
#define DBG_INFO(...) __PRINT_BLOCK( \
|
||||||
printf("[Info]\t"); \
|
printf("[Info]\t"); \
|
||||||
printf(__VA_ARGS__); \
|
printf(__VA_ARGS__);)
|
||||||
)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DBG_ERROR
|
#ifndef DBG_ERROR
|
||||||
#define DBG_ERROR(...) {}
|
#define DBG_ERROR(...) \
|
||||||
|
{ \
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef DBG_WARNING
|
#ifndef DBG_WARNING
|
||||||
#define DBG_WARNING(...) {}
|
#define DBG_WARNING(...) \
|
||||||
|
{ \
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef DBG_INFO
|
#ifndef DBG_INFO
|
||||||
#define DBG_INFO(...) {}
|
#define DBG_INFO(...) \
|
||||||
|
{ \
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef DBG_PRINT
|
#ifndef DBG_PRINT
|
||||||
#define DBG_PRINT(...) {}
|
#define DBG_PRINT(...) \
|
||||||
|
{ \
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/**************************** Type Definitions *******************************/
|
/**************************** Type Definitions *******************************/
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/***************************************************************************//**
|
/*******************************************************************************
|
||||||
* @file util.h
|
* @file util.h
|
||||||
* @brief Implementation of utility functions.
|
* @brief Implementation of utility functions.
|
||||||
* @author DBogdan ([email protected])
|
* @author DBogdan ([email protected])
|
||||||
@@ -84,7 +84,11 @@
|
|||||||
(type) clamp((type)(val), (type)(min_val), (type)(max_val))
|
(type) clamp((type)(val), (type)(min_val), (type)(max_val))
|
||||||
|
|
||||||
#define swap(x, y) \
|
#define swap(x, y) \
|
||||||
{typeof(x) _tmp_ = (x); (x) = (y); (y) = _tmp_;}
|
{ \
|
||||||
|
typeof(x) _tmp_ = (x); \
|
||||||
|
(x) = (y); \
|
||||||
|
(y) = _tmp_; \
|
||||||
|
}
|
||||||
|
|
||||||
#define round_up(x, y) \
|
#define round_up(x, y) \
|
||||||
(((x) + (y)-1) / (y))
|
(((x) + (y)-1) / (y))
|
||||||
@@ -191,4 +195,3 @@ bool crc16_check(uint8_t* buffPtr, uint32_t dataLen, uint32_t crcOffset, uint16_
|
|||||||
int crc8_gen(uint8_t *buffPtr, uint32_t dataLen, uint16_t poly, uint8_t *crcVal);
|
int crc8_gen(uint8_t *buffPtr, uint32_t dataLen, uint16_t poly, uint8_t *crcVal);
|
||||||
bool crc8_check(uint8_t *buffPtr, uint32_t dataLen, uint32_t crcOffset, uint16_t poly);
|
bool crc8_check(uint8_t *buffPtr, uint32_t dataLen, uint32_t crcOffset, uint16_t poly);
|
||||||
#endif // UTIL_H_
|
#endif // UTIL_H_
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user