Compare commits
7
Commits
677b8b4af5
...
13f07021de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13f07021de | ||
|
|
fbe41ce9a6 | ||
|
|
932b4561d5 | ||
|
|
912b30e457 | ||
|
|
5453b487ff | ||
|
|
1e57ca2c1b | ||
|
|
6bf35c8c5d |
@@ -340,13 +340,13 @@ void L2_FrameStateUpdate(L2_INST *instPtr)
|
||||
}
|
||||
break;
|
||||
case L2_INTRA_W2_ACQ_FRAME:
|
||||
instPtr->log.mgmtRecvCnt++;
|
||||
instPtr->log.w2acqRecvCnt++;
|
||||
if (L2_CrcCheck(instPtr->recvPktData,
|
||||
W2ACQ_FRAME_CRC_DLEN, W2ACQ_FRAME_CRC_POS,
|
||||
L2_CRC16_8005) == true)
|
||||
{
|
||||
L2_DataAvailUpdate(instPtr, true);
|
||||
instPtr->log.mgmtCorrectCnt++;
|
||||
instPtr->log.w2acqCorrectCnt++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -533,8 +533,7 @@ static int32_t Scan_BmAdvtHandler(L2_INST *instPtr)
|
||||
return FAILURE;
|
||||
}
|
||||
DBG_WARNING("BM timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
|
||||
scanFsmPtr->bmTimeout = 0; /* reset listen counter. */
|
||||
StageUpdate(scanFsmPtr, L2_SCAN_INIT_STAGE);
|
||||
ScanNet_Reset(scanFsmPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -592,8 +591,7 @@ static int32_t Scan_2WAcqHandler(L2_INST *instPtr)
|
||||
if (scanFsmPtr->w2acqTimeout >= WAY2_ACQ_SLOT_MAX)
|
||||
{
|
||||
DBG_WARNING("2WAcq timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
|
||||
scanFsmPtr->w2acqTimeout = 0; // reset counter for next scan.
|
||||
StageUpdate(scanFsmPtr, L2_SCAN_INIT_STAGE);
|
||||
ScanNet_Reset(scanFsmPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+12
-12
@@ -69,7 +69,7 @@ int SetupInterruptSystem(XScuGic *instPtr, uint32_t devId);
|
||||
void PhysicalIntr_Handler(void *callBackRef);
|
||||
void PeriodicPull_Handler(void *callBackRef);
|
||||
#ifdef _MPC_CTRL
|
||||
void MPC_IntrHandler(void *CallBackRef);
|
||||
void MPC_IntrHandler(void *callBackRef);
|
||||
#endif
|
||||
|
||||
/*********************** Driver Instance Definitions **************************/
|
||||
@@ -200,12 +200,12 @@ void MPC_PCIESentStart()
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
******************************************************************************/
|
||||
void MPC_IntrHandler(void *CallBackRef)
|
||||
void MPC_IntrHandler(void *callBackRef)
|
||||
{
|
||||
MPC_MsgHandler(mpcInstPtr);
|
||||
}
|
||||
@@ -215,18 +215,13 @@ void MPC_IntrHandler(void *CallBackRef)
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
******************************************************************************/
|
||||
void PhysicalIntr_Handler(void *callBackRef)
|
||||
{
|
||||
uint32_t GpioConfig = XGpio_DiscreteRead(&configGpio, 2);
|
||||
if (L2_isDataAvail(linkInstPtr) == true)
|
||||
{
|
||||
GpioConfig ^= 0x00000001;
|
||||
}
|
||||
Phy_UpdateState(phyInstPtr);
|
||||
if (phyInstPtr->TOR.curr == PHY_TOR_TX)
|
||||
{
|
||||
@@ -292,7 +287,6 @@ void PhysicalIntr_Handler(void *callBackRef)
|
||||
break;
|
||||
}
|
||||
}
|
||||
XGpio_DiscreteWrite(&configGpio, 2, GpioConfig);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
@@ -307,7 +301,6 @@ void PhysicalIntr_Handler(void *callBackRef)
|
||||
void PeriodicPull_Handler(void *callBackRef)
|
||||
{
|
||||
int32_t Status;
|
||||
|
||||
Status = Linklayer_Proc(linkInstPtr);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
@@ -337,7 +330,14 @@ void PeriodicPull_Handler(void *callBackRef)
|
||||
mpcRecord->frame7CntLast = mpcRecord->frame7Recv;
|
||||
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
|
||||
}
|
||||
regValue = PhyRead(instPtr, COASE_FREQEST);
|
||||
acqFreqIdx = (regValue >> COASE_FREQEST_ACQ_SHIFT) && COASE_FREQEST_ACQ_MASK;
|
||||
acqFreqIdx = 80 - acqFreqIdx;
|
||||
syncFreqIdx = (regValue >> COASE_FREQEST_SYNC_SHIFT) && COASE_FREQEST_SYNC_MASK;
|
||||
syncFreqIdx = 8 - syncFreqIdx;
|
||||
acqFreqIdx = (regValue & COASE_FREQEST_ACQ_MASK) >> COASE_FREQEST_ACQ_SHIFT;
|
||||
syncFreqIdx = (regValue & COASE_FREQEST_SYNC_MASK) >> COASE_FREQEST_SYNC_SHIFT;
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
freqEst = acqFreqIdx * (250e3 / 4);
|
||||
// 12M Rc
|
||||
freqEst = (double)(8 - acqFreqIdx) * (250e3 / 4);
|
||||
freqEst += (double)syncFreqIdx * 12e6 / 64 / 128;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,12 +62,12 @@
|
||||
#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 847733 // *10ns(Timer_L)
|
||||
#define L1_FRAME_10KBPS_20MS_COMP 847733 // *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 19725 // *10ns(Timer_L)
|
||||
#define L1_FRAME_1M2BPS_5MS_COMP 19725 // *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
|
||||
|
||||
@@ -225,8 +225,8 @@
|
||||
#define COASE_FREQEST_ACQ_SHIFT 0
|
||||
#define COASE_FREQEST_ACQ_WIDTH 8
|
||||
#define COASE_FREQEST_ACQ_MASK 0x000000FFU
|
||||
#define COASE_FREQEST_SYNC_SHIFT 0
|
||||
#define COASE_FREQEST_SYNC_WIDTH 16
|
||||
#define COASE_FREQEST_SYNC_SHIFT 8
|
||||
#define COASE_FREQEST_SYNC_WIDTH 8
|
||||
#define COASE_FREQEST_SYNC_MASK 0x000FF00U
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/***************************************************************************
|
||||
//**
|
||||
/*******************************************************************************
|
||||
* @file util.h
|
||||
* @brief Implementation of utility functions.
|
||||
* @author DBogdan ([email protected])
|
||||
|
||||
@@ -28,9 +28,11 @@
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
#define __PRINT_BLOCK(block) do {\
|
||||
block\
|
||||
} while(0)
|
||||
#define __PRINT_BLOCK(block) \
|
||||
do \
|
||||
{ \
|
||||
block \
|
||||
} while (0)
|
||||
|
||||
#define ASSERT(exp) ((exp) ? (void)0 : AppAssert(__FILE__, __LINE__))
|
||||
#define _nop_() __asm__("nop")
|
||||
@@ -38,46 +40,53 @@
|
||||
/* Stringify */
|
||||
#define STR(x) #x
|
||||
|
||||
#define _814_DEBUG_LEVEL 3
|
||||
// #define _814_DEBUG_LEVEL 3
|
||||
|
||||
#if _814_DEBUG_LEVEL > 0
|
||||
#define DBG_PRINT(...) printf(__VA_ARGS__)
|
||||
#endif
|
||||
#if _814_DEBUG_LEVEL >= 1
|
||||
#define DBG_ERROR(...) __PRINT_BLOCK( \
|
||||
printf("in"__FILE__" #%4d [error]\t",__LINE__); \
|
||||
printf(__VA_ARGS__); \
|
||||
)
|
||||
printf("in"__FILE__ \
|
||||
" #%4d [error]\t", \
|
||||
__LINE__); \
|
||||
printf(__VA_ARGS__);)
|
||||
#endif
|
||||
#if _814_DEBUG_LEVEL >= 2
|
||||
#define DBG_WARNING(...) __PRINT_BLOCK( \
|
||||
printf("[warning]\t"); \
|
||||
printf(__VA_ARGS__); \
|
||||
)
|
||||
printf(__VA_ARGS__);)
|
||||
#endif
|
||||
#if _814_DEBUG_LEVEL >= 3
|
||||
#define DBG_INFO(...) __PRINT_BLOCK( \
|
||||
printf("[Info]\t"); \
|
||||
printf(__VA_ARGS__); \
|
||||
)
|
||||
printf(__VA_ARGS__);)
|
||||
#endif
|
||||
|
||||
#ifndef DBG_ERROR
|
||||
#define DBG_ERROR(...) {}
|
||||
#define DBG_ERROR(...) \
|
||||
{ \
|
||||
}
|
||||
#endif
|
||||
#ifndef DBG_WARNING
|
||||
#define DBG_WARNING(...) {}
|
||||
#define DBG_WARNING(...) \
|
||||
{ \
|
||||
}
|
||||
#endif
|
||||
#ifndef DBG_INFO
|
||||
#define DBG_INFO(...) {}
|
||||
#define DBG_INFO(...) \
|
||||
{ \
|
||||
}
|
||||
#endif
|
||||
#ifndef DBG_PRINT
|
||||
#define DBG_PRINT(...) {}
|
||||
#define DBG_PRINT(...) \
|
||||
{ \
|
||||
}
|
||||
#endif
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
void AppAssert(const char * file, int line);
|
||||
void AppAssert(const char *file, int line);
|
||||
#endif /* __COMMON_H_ */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/***************************************************************************//**
|
||||
/*******************************************************************************
|
||||
* @file util.h
|
||||
* @brief Implementation of utility functions.
|
||||
* @author DBogdan ([email protected])
|
||||
********************************************************************************
|
||||
********************************************************************************
|
||||
* Copyright 2018(c) Analog Devices, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
@@ -35,7 +35,7 @@
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
#ifndef _UTIL_H_
|
||||
#define _UTIL_H_
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
/******************************************************************************/
|
||||
/********************** Macros and Constants Definitions **********************/
|
||||
/******************************************************************************/
|
||||
//#define __CRC_LSB
|
||||
// #define __CRC_LSB
|
||||
#define __BITSWAP_TABLE
|
||||
#define __CRC_LSB
|
||||
#define CRC16_INIT 0x0000
|
||||
@@ -61,8 +61,8 @@
|
||||
#define ARRAY_SIZE(x) \
|
||||
(sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
#define DIV_ROUND_UP(x,y) \
|
||||
(((x) + (y) - 1) / (y))
|
||||
#define DIV_ROUND_UP(x, y) \
|
||||
(((x) + (y)-1) / (y))
|
||||
#define DIV_ROUND_CLOSEST(x, y) \
|
||||
(((x) + (y) / 2) / (y))
|
||||
#define DIV_ROUND_CLOSEST_ULL(x, y) \
|
||||
@@ -71,23 +71,27 @@
|
||||
#define min(x, y) \
|
||||
(((x) < (y)) ? (x) : (y))
|
||||
#define min_t(type, x, y) \
|
||||
(type)min((type)(x), (type)(y))
|
||||
(type) min((type)(x), (type)(y))
|
||||
|
||||
#define max(x, y) \
|
||||
(((x) > (y)) ? (x) : (y))
|
||||
#define max_t(type, x, y) \
|
||||
(type)max((type)(x), (type)(y))
|
||||
(type) max((type)(x), (type)(y))
|
||||
|
||||
#define clamp(val, min_val, max_val) \
|
||||
(max(min((val), (max_val)), (min_val)))
|
||||
#define clamp_t(type, val, min_val, max_val) \
|
||||
(type)clamp((type)(val), (type)(min_val), (type)(max_val))
|
||||
(type) clamp((type)(val), (type)(min_val), (type)(max_val))
|
||||
|
||||
#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) \
|
||||
(((x)+(y)-1)/(y))
|
||||
#define round_up(x, y) \
|
||||
(((x) + (y)-1) / (y))
|
||||
|
||||
#define BITS_PER_LONG 32
|
||||
|
||||
@@ -116,7 +120,7 @@
|
||||
(((x) & 0x01) << 7))
|
||||
|
||||
#define U16_MAX ((uint16_t)~0U)
|
||||
#define S16_MAX ((int16_t)(U16_MAX>>1))
|
||||
#define S16_MAX ((int16_t)(U16_MAX >> 1))
|
||||
|
||||
#define DIV_U64(x, y) (x / y)
|
||||
|
||||
@@ -170,7 +174,7 @@ void rational_best_approximation(uint32_t given_numerator,
|
||||
/* Calculate the number of set bits. */
|
||||
uint32_t hweight8(uint32_t word);
|
||||
/* Calculate the quotient and the remainder of an integer division. */
|
||||
uint64_t do_div(uint64_t* n,
|
||||
uint64_t do_div(uint64_t *n,
|
||||
uint64_t base);
|
||||
/* Unsigned 64bit divide with 64bit divisor and remainder */
|
||||
uint64_t div64_u64_rem(uint64_t dividend, uint64_t divisor,
|
||||
@@ -186,9 +190,8 @@ int32_t str_to_int32(const char *str);
|
||||
/* Converts from string to uint32_t */
|
||||
uint32_t srt_to_uint32(const char *str);
|
||||
|
||||
int crc16_gen(uint8_t* buffPtr, uint32_t dataLen, uint16_t poly, uint16_t* crcVal);
|
||||
bool crc16_check(uint8_t* buffPtr, uint32_t dataLen, uint32_t crcOffset, uint16_t poly);
|
||||
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);
|
||||
int crc16_gen(uint8_t *buffPtr, uint32_t dataLen, uint16_t poly, uint16_t *crcVal);
|
||||
bool crc16_check(uint8_t *buffPtr, uint32_t dataLen, uint32_t crcOffset, uint16_t poly);
|
||||
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);
|
||||
#endif // UTIL_H_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user