forked from gatsby/df_datalink
fix: 调整bram memcpy的帧长, 对齐64-bit; 调整memcpy的指针数据类型
This commit is contained in:
@@ -94,7 +94,7 @@ typedef struct
|
||||
float srcPosZ; ///< position z
|
||||
uint32_t srcNetStatTime;///< net start time
|
||||
uint32_t advDataId; ///< advertise payload id
|
||||
uint8_t advData[17]; ///< advertise payload data
|
||||
uint8_t advData[L2_PAYLOAD_LEN_ADV]; ///< advertise payload data
|
||||
uint8_t crc; ///< crc
|
||||
} L2_MSG_ADV;
|
||||
|
||||
@@ -112,7 +112,7 @@ typedef struct
|
||||
float srcSpeedY; ///< speed y
|
||||
float srcSpeedZ; ///< speed z
|
||||
uint32_t ackDataId; ///< acknowledge payload id
|
||||
uint8_t ackData[9]; ///< acknowledge payload data
|
||||
uint8_t ackData[L2_PAYLOAD_LEN_ACK]; ///< acknowledge payload data
|
||||
uint8_t crc; ///< crc
|
||||
} L2_MSG_ACK;
|
||||
|
||||
@@ -130,7 +130,7 @@ typedef struct
|
||||
float srcSpeedY; ///< speed y
|
||||
float srcSpeedZ; ///< speed z
|
||||
uint32_t svcDataId; ///< service payload id
|
||||
uint8_t svcData[42]; ///< service payload data
|
||||
uint8_t svcData[L2_PAYLOAD_LEN_SVC_128K]; ///< service payload data
|
||||
uint8_t crc; ///< crc
|
||||
} L2_MSG_SVC_128K;
|
||||
|
||||
@@ -148,7 +148,7 @@ typedef struct
|
||||
float srcSpeedY; ///< speed y
|
||||
float srcSpeedZ; ///< speed z
|
||||
uint32_t svcDataId; ///< service payload id
|
||||
uint8_t svcData[267]; ///< service payload data
|
||||
uint8_t svcData[L2_PAYLOAD_LEN_SVC_512K]; ///< service payload data
|
||||
uint8_t crc; ///< crc
|
||||
} L2_MSG_SVC_512K;
|
||||
|
||||
@@ -166,7 +166,7 @@ typedef struct
|
||||
float srcSpeedY; ///< speed y
|
||||
float srcSpeedZ; ///< speed z
|
||||
uint32_t svcDataId; ///< service payload id
|
||||
uint8_t svcData[1222]; ///< service payload data
|
||||
uint8_t svcData[L2_PAYLOAD_LEN_SVC_2M]; ///< service payload data
|
||||
uint8_t crc; ///< crc
|
||||
} L2_MSG_SVC_2M;
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ static int32_t Phy_SetSendData(PHY_INST *instPtr, L1_FRAME_TYPE frameType, uint8
|
||||
return EPARAM;
|
||||
}
|
||||
instPtr->sendDataOffset = (L1_TXRXDATA_MAX_LEN >> 1) - instPtr->sendDataOffset;
|
||||
memcpy((uint8_t *)(instPtr->sendDataAddr + instPtr->sendDataOffset), dataBuff, frameLen);
|
||||
memcpy((uint8_t *)(instPtr->sendDataAddr + instPtr->sendDataOffset), dataBuff, NORMALIZE_SIZE(frameLen));
|
||||
|
||||
sendCmd = frameLen & SEND_DATA_CMD_LEN_MASK;
|
||||
sendCmd |= (instPtr->sendDataOffset << SEND_DATA_CMD_OFFSET_SHIFT) & SEND_DATA_CMD_OFFSET_MASK;
|
||||
@@ -699,7 +699,7 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
|
||||
const uint8_t *hopPattern;
|
||||
// Implement a ping-pong flow, offset always is 0 or half of buffer depth.
|
||||
instPtr->antConfigOffset = (L1_ANTCONFIG_MAX_LEN >> 1) - instPtr->antConfigOffset;
|
||||
uint32_t antConfigAddr = instPtr->antConfigAddr + instPtr->antConfigOffset;
|
||||
uintptr_t antConfigAddr = instPtr->antConfigAddr + instPtr->antConfigOffset;
|
||||
|
||||
switch (txrxMode)
|
||||
{
|
||||
@@ -752,27 +752,29 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
|
||||
|
||||
// TODO: Set antenna stand by, when suspend.
|
||||
const uint8_t *dataSrcPtr = (uint8_t *)(&(instPtr->antConfig));
|
||||
const size_t antIndexNext = Phy_GetNextAntIndex(instPtr);
|
||||
size_t hopIdx;
|
||||
uint8_t freqIdx;
|
||||
uint16_t hopFreq;
|
||||
uint8_t hopCal;
|
||||
for (int32_t i = 0; i < hopNum; i++)
|
||||
for (uint8_t hopIdx = 0; hopIdx < hopNum; hopIdx++)
|
||||
{
|
||||
hopIdx = hopPattern[i];
|
||||
|
||||
// Frequency setting
|
||||
hopFreq = freqTable[hopIdx];
|
||||
instPtr->antConfig.rfFreq[antIndexNext][0] = (uint8_t)(hopFreq >> 8);
|
||||
instPtr->antConfig.rfFreq[antIndexNext][1] = (uint8_t)hopFreq;
|
||||
// Calibration setting
|
||||
for (uint8_t ii = 0; ii < L1_ANT_CH_NUM; ii ++)
|
||||
freqIdx = hopPattern[hopIdx];
|
||||
hopFreq = freqTable[freqIdx];
|
||||
|
||||
for (uint8_t antIdx = 0; antIdx < L1_ANT_NUM; antIdx++)
|
||||
{
|
||||
hopCal = antCalTable[antIndexNext][hopIdx][ii];
|
||||
instPtr->antConfig.rfNormComp[antIndexNext][ii] = hopCal;
|
||||
instPtr->antConfig.rfFreq[antIdx][0] = (uint8_t)(hopFreq >> 8);
|
||||
instPtr->antConfig.rfFreq[antIdx][1] = (uint8_t)hopFreq;
|
||||
// FIXME: Calibration setting
|
||||
// for (uint8_t chIdx = 0; chIdx < L1_ANT_CH_NUM; chIdx ++)
|
||||
// {
|
||||
// hopCal = antCalTable[antIdx][freqIdx][chIdx];
|
||||
// instPtr->antConfig.rfNormComp[antIdx][chIdx] = hopCal;
|
||||
// }
|
||||
}
|
||||
|
||||
memcpy((uint8_t *)(antConfigAddr + i * ANT_COINFO_LEN),
|
||||
dataSrcPtr, sizeof(PHY_ANT_CONFIG));
|
||||
memcpy((uint8_t *)(antConfigAddr + hopIdx * ANT_COINFO_LEN),
|
||||
dataSrcPtr, NORMALIZE_SIZE(sizeof(PHY_ANT_CONFIG)));
|
||||
}
|
||||
uint32_t antCtrl = (instPtr->antConfigOffset & ANT_CONFIG_OFFSET_MASK)
|
||||
| ((hopNum << ANT_CONFIG_NUM_SHIFT) & ANT_CONFIG_NUM_MASK)
|
||||
@@ -858,7 +860,7 @@ void Phy_PeekRecvData(PHY_INST *instPtr, uint8_t *dataBuff)
|
||||
frameLen = (PhyRead(instPtr, RECVDATA_STATE) & RECVDATA_STATE_LEN_MASK) >> RECVDATA_STATE_LEN_SHIFT;
|
||||
offset = (PhyRead(instPtr, RECVDATA_STATE) & RECVDATA_STATE_OFFSET_MASK) >> RECVDATA_STATE_OFFSET_SHIFT;
|
||||
|
||||
memcpy(dataBuff, (uint8_t *)(instPtr->recvDataAddr + offset), frameLen);
|
||||
memcpy(dataBuff, (uint8_t *)(instPtr->recvDataAddr + offset), NORMALIZE_SIZE(frameLen));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user