[radio] union the transmit and receive information in radio frame (#2789)

The transmit and receive specific information will not be used at the same time,
so use union structure to save ram usage.
This commit is contained in:
Shu Chen
2018-06-16 01:26:37 +08:00
committed by Jonathan Hui
parent 13a40c8bcf
commit ed58a6775b
21 changed files with 126 additions and 114 deletions
+1 -1
View File
@@ -956,7 +956,7 @@ otLwfCmdSendMacFrameAsync(
Packet->mPsdu,
(uint32_t)Packet->mLength,
Packet->mChannel,
Packet->mRssi
Packet->mInfo.mRxInfo.mRssi
);
if (!NT_SUCCESS(status))
{
@@ -1019,11 +1019,11 @@ otLwfEventWorkerThread(
SPINEL_DATATYPE_STRUCT_S( // Vendor-data
SPINEL_DATATYPE_UINT_PACKED_S
),
&pFilter->otReceiveFrame.mRssi,
&pFilter->otReceiveFrame.mInfo.mRxInfo.mRssi,
&noiseFloor,
&flags,
&pFilter->otReceiveFrame.mChannel,
&pFilter->otReceiveFrame.mLqi,
&pFilter->otReceiveFrame.mInfo.mRxInfo.mLqi,
&errorCode))
{
otLwfRadioReceiveFrame(pFilter, errorCode);
+6 -6
View File
@@ -455,8 +455,8 @@ void readFrame(void)
#if OPENTHREAD_ENABLE_RAW_LINK_API
// Timestamp
sReceiveFrame.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mUsec = 0; // Don't support microsecond timer for now.
sReceiveFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
#endif
// read psdu
@@ -465,13 +465,13 @@ void readFrame(void)
sReceiveFrame.mPsdu[i] = HWREG(RFCORE_SFR_RFDATA);
}
sReceiveFrame.mRssi = (int8_t)HWREG(RFCORE_SFR_RFDATA) - CC2538_RSSI_OFFSET;
crcCorr = HWREG(RFCORE_SFR_RFDATA);
sReceiveFrame.mInfo.mRxInfo.mRssi = (int8_t)HWREG(RFCORE_SFR_RFDATA) - CC2538_RSSI_OFFSET;
crcCorr = HWREG(RFCORE_SFR_RFDATA);
if (crcCorr & CC2538_CRC_BIT_MASK)
{
sReceiveFrame.mLength = length;
sReceiveFrame.mLqi = crcCorr & CC2538_LQI_BIT_MASK;
sReceiveFrame.mLength = length;
sReceiveFrame.mInfo.mRxInfo.mLqi = crcCorr & CC2538_LQI_BIT_MASK;
}
else
{
+7 -7
View File
@@ -1825,15 +1825,15 @@ static void cc2650RadioProcessReceiveQueue(otInstance *aInstance)
{
#if OPENTHREAD_ENABLE_RAW_LINK_API
// TODO: Propagate CM0 timestamp
receiveFrame.mMsec = otPlatAlarmMilliGetNow();
receiveFrame.mUsec = 0; // Don't support microsecond timer for now.
receiveFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
receiveFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
#endif
receiveFrame.mLength = len;
receiveFrame.mPsdu = &(payload[1]);
receiveFrame.mChannel = sReceiveCmd.channel;
receiveFrame.mRssi = rssi;
receiveFrame.mLqi = crcCorr->status.corr;
receiveFrame.mLength = len;
receiveFrame.mPsdu = &(payload[1]);
receiveFrame.mChannel = sReceiveCmd.channel;
receiveFrame.mInfo.mRxInfo.mRssi = rssi;
receiveFrame.mInfo.mRxInfo.mLqi = crcCorr->status.corr;
receiveError = OT_ERROR_NONE;
}
+7 -7
View File
@@ -1837,15 +1837,15 @@ static void cc2652RadioProcessReceiveQueue(otInstance *aInstance)
{
#if OPENTHREAD_ENABLE_RAW_LINK_API
// TODO: Propagate CM0 timestamp
receiveFrame.mMsec = otPlatAlarmMilliGetNow();
receiveFrame.mUsec = 0; // Don't support microsecond timer for now.
receiveFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
receiveFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
#endif
receiveFrame.mLength = len;
receiveFrame.mPsdu = &(payload[1]);
receiveFrame.mChannel = sReceiveCmd.channel;
receiveFrame.mRssi = rssi;
receiveFrame.mLqi = crcCorr->status.corr;
receiveFrame.mLength = len;
receiveFrame.mPsdu = &(payload[1]);
receiveFrame.mChannel = sReceiveCmd.channel;
receiveFrame.mInfo.mRxInfo.mRssi = rssi;
receiveFrame.mInfo.mRxInfo.mLqi = crcCorr->status.corr;
receiveError = OT_ERROR_NONE;
}
+6 -6
View File
@@ -589,13 +589,13 @@ void ftdf_rcv_frame_transparent(ftdf_data_length_t frame_length,
#if OPENTHREAD_ENABLE_RAW_LINK_API
// Timestamp
sReceiveFrame[sWriteFrame].mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame[sWriteFrame].mUsec = 0; // Don't support microsecond timer for now.
sReceiveFrame[sWriteFrame].mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame[sWriteFrame].mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
#endif
sReceiveFrame[sWriteFrame].mChannel = sChannel;
sReceiveFrame[sWriteFrame].mLength = frame_length;
sReceiveFrame[sWriteFrame].mLqi = OT_RADIO_LQI_NONE;
sReceiveFrame[sWriteFrame].mRssi = otPlatRadioGetRssi(sThreadInstance);
sReceiveFrame[sWriteFrame].mChannel = sChannel;
sReceiveFrame[sWriteFrame].mLength = frame_length;
sReceiveFrame[sWriteFrame].mInfo.mRxInfo.mLqi = OT_RADIO_LQI_NONE;
sReceiveFrame[sWriteFrame].mInfo.mRxInfo.mRssi = otPlatRadioGetRssi(sThreadInstance);
memcpy(sReceiveFrame[sWriteFrame].mPsdu, frame, frame_length);
sWriteFrame = (sWriteFrame + 1) % RADIO_FRAMES_BUFFER_SIZE;
+5 -5
View File
@@ -624,13 +624,13 @@ static void processNextRxPacket(otInstance *aInstance, RAIL_Handle_t aRailHandle
memcpy(sReceiveFrame.mPsdu + packetInfo.firstPortionBytes, packetInfo.lastPortionData,
packetInfo.packetBytes - packetInfo.firstPortionBytes);
sReceiveFrame.mLength = length;
sReceiveFrame.mRssi = packetDetails.rssi;
sReceiveFrame.mLqi = packetDetails.lqi;
sReceiveFrame.mLength = length;
sReceiveFrame.mInfo.mRxInfo.mRssi = packetDetails.rssi;
sReceiveFrame.mInfo.mRxInfo.mLqi = packetDetails.lqi;
// TODO: grab timestamp and handle conversion to msec/usec
// sReceiveFrame.mMsec = packetDetails.packetTime;
// sReceiveFrame.mUsec = packetDetails.packetTime;
// sReceiveFrame.mInfo.mRxInfo.mMsec = packetDetails.packetTime;
// sReceiveFrame.mInfo.mRxInfo.mUsec = packetDetails.packetTime;
if (packetDetails.isAck)
{
+5 -5
View File
@@ -462,16 +462,16 @@ void readFrame(void)
#if OPENTHREAD_ENABLE_RAW_LINK_API
// Timestamp
sReceiveFrame.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mUsec = 0; // Don't support microsecond timer for now.
sReceiveFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
#endif
/* Read PSDU */
memcpy(sReceiveFrame.mPsdu, readBuffer, length - 2);
sReceiveFrame.mRssi = (int8_t)(readRssi / MRF24J40_RSSI_SLOPE) - MRF24J40_RSSI_OFFSET;
sReceiveFrame.mLength = (uint8_t)length;
sReceiveFrame.mLqi = readPlqi;
sReceiveFrame.mInfo.mRxInfo.mRssi = (int8_t)(readRssi / MRF24J40_RSSI_SLOPE) - MRF24J40_RSSI_OFFSET;
sReceiveFrame.mLength = (uint8_t)length;
sReceiveFrame.mInfo.mRxInfo.mLqi = readPlqi;
exit:
return;
+1 -1
View File
@@ -217,7 +217,7 @@ void cbQorvoRadioReceiveDone(otRadioFrame *aPacket, otError aError)
{
if (aError == OT_ERROR_NONE)
{
sLastReceivedPower = aPacket->mRssi;
sLastReceivedPower = aPacket->mInfo.mRxInfo.mRssi;
}
otPlatRadioReceiveDone(pQorvoInstance, aPacket, aError);
+4 -4
View File
@@ -742,14 +742,14 @@ static bool rf_process_rx_frame(void)
#if OPENTHREAD_ENABLE_RAW_LINK_API
// Timestamp
sRxFrame.mMsec = otPlatAlarmMilliGetNow();
sRxFrame.mUsec = 0; // Don't support microsecond timer for now.
sRxFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
sRxFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
#endif
sRxFrame.mLength = temp;
temp = (ZLL->LQI_AND_RSSI & ZLL_LQI_AND_RSSI_LQI_VALUE_MASK) >> ZLL_LQI_AND_RSSI_LQI_VALUE_SHIFT;
sRxFrame.mLqi = rf_lqi_adjust(temp);
sRxFrame.mRssi = rf_lqi_to_rssi(sRxFrame.mLqi);
sRxFrame.mInfo.mRxInfo.mLqi = rf_lqi_adjust(temp);
sRxFrame.mInfo.mRxInfo.mRssi = rf_lqi_to_rssi(sRxFrame.mInfo.mRxInfo.mLqi);
#if DOUBLE_BUFFERING
for (temp = 0; temp < sRxFrame.mLength - 2; temp++)
+2 -1
View File
@@ -443,7 +443,8 @@ void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otErro
"\"RemoteID\":%" PRId16 ","
"\"RSSI\":%d"
"}}\r\n",
aFrame->mChannel, message->mChannel, message->mCnt, sID, message->mID, aFrame->mRssi);
aFrame->mChannel, message->mChannel, message->mCnt, sID, message->mID,
aFrame->mInfo.mRxInfo.mRssi);
}
}
}
+14 -14
View File
@@ -328,7 +328,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
nrf_802154_channel_set(aFrame->mChannel);
if (aFrame->mIsCcaEnabled)
if (aFrame->mInfo.mTxInfo.mIsCcaEnabled)
{
nrf_802154_transmit_csma_ca_raw(&aFrame->mPsdu[-1]);
}
@@ -669,15 +669,15 @@ void nrf_802154_received_raw(uint8_t *p_data, int8_t power, uint8_t lqi)
memset(receivedFrame, 0, sizeof(*receivedFrame));
receivedFrame->mPsdu = &p_data[1];
receivedFrame->mLength = p_data[0];
receivedFrame->mRssi = power;
receivedFrame->mLqi = lqi;
receivedFrame->mChannel = nrf_802154_channel_get();
receivedFrame->mPsdu = &p_data[1];
receivedFrame->mLength = p_data[0];
receivedFrame->mInfo.mRxInfo.mRssi = power;
receivedFrame->mInfo.mRxInfo.mLqi = lqi;
receivedFrame->mChannel = nrf_802154_channel_get();
#if OPENTHREAD_ENABLE_RAW_LINK_API
uint64_t timestamp = nrf5AlarmGetCurrentTime();
receivedFrame->mMsec = timestamp / US_PER_MS;
receivedFrame->mUsec = timestamp - receivedFrame->mMsec * US_PER_MS;
uint64_t timestamp = nrf5AlarmGetCurrentTime();
receivedFrame->mInfo.mRxInfo.mMsec = timestamp / US_PER_MS;
receivedFrame->mInfo.mRxInfo.mUsec = timestamp - receivedFrame->mMsec * US_PER_MS;
#endif
PlatformEventSignalPending();
@@ -721,11 +721,11 @@ void nrf_802154_transmitted_raw(const uint8_t *aFrame, uint8_t *aAckPsdu, int8_t
}
else
{
sAckFrame.mPsdu = &aAckPsdu[1];
sAckFrame.mLength = aAckPsdu[0];
sAckFrame.mRssi = aPower;
sAckFrame.mLqi = aLqi;
sAckFrame.mChannel = nrf_802154_channel_get();
sAckFrame.mPsdu = &aAckPsdu[1];
sAckFrame.mLength = aAckPsdu[0];
sAckFrame.mInfo.mRxInfo.mRssi = aPower;
sAckFrame.mInfo.mRxInfo.mLqi = aLqi;
sAckFrame.mChannel = nrf_802154_channel_get();
}
setPendingEvent(kPendingEventFrameTransmitted);
+4 -4
View File
@@ -556,8 +556,8 @@ void radioReceive(otInstance *aInstance)
#if OPENTHREAD_ENABLE_RAW_LINK_API
// Timestamp
sReceiveFrame.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mUsec = 0; // Don't support microsecond timer for now.
sReceiveFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
#endif
sReceiveFrame.mLength = (uint8_t)(rval - 1);
@@ -737,8 +737,8 @@ void radioProcessFrame(otInstance *aInstance)
goto exit;
}
sReceiveFrame.mRssi = -20;
sReceiveFrame.mLqi = OT_RADIO_LQI_NONE;
sReceiveFrame.mInfo.mRxInfo.mRssi = -20;
sReceiveFrame.mInfo.mRxInfo.mLqi = OT_RADIO_LQI_NONE;
// generate acknowledgment
if (isAckRequested(sReceiveFrame.mPsdu))
+4 -4
View File
@@ -477,8 +477,8 @@ void platformRadioReceive(otInstance *aInstance, uint8_t *aBuf, uint16_t aBufLen
#if OPENTHREAD_ENABLE_RAW_LINK_API
// Timestamp
sReceiveFrame.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mUsec = 0; // Don't support microsecond timer for now.
sReceiveFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
#endif
sReceiveFrame.mLength = (uint8_t)(aBufLength - 1);
@@ -637,8 +637,8 @@ void radioProcessFrame(otInstance *aInstance)
goto exit;
}
sReceiveFrame.mRssi = -20;
sReceiveFrame.mLqi = OT_RADIO_LQI_NONE;
sReceiveFrame.mInfo.mRxInfo.mRssi = -20;
sReceiveFrame.mInfo.mRxInfo.mLqi = OT_RADIO_LQI_NONE;
// generate acknowledgment
if (isAckRequested(sReceiveFrame.mPsdu))
+6 -6
View File
@@ -216,8 +216,8 @@ static void handleRx(void)
#if OPENTHREAD_ENABLE_RAW_LINK_API
// Timestamp
sReceiveFrame.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mUsec = 0; // Don't support microsecond timer for now.
sReceiveFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
#endif
#if OPENTHREAD_ENABLE_DIAG
@@ -233,7 +233,7 @@ static void handleRx(void)
// otherwise only signal MAC layer for non-ACK frame
if (sPromiscuous || sReceiveFrame.mLength > IEEE802154_ACK_LENGTH)
{
otLogDebgPlat(sInstance, "Radio receive done, rssi: %d", sReceiveFrame.mRssi);
otLogDebgPlat(sInstance, "Radio receive done, rssi: %d", sReceiveFrame.mInfo.mRxInfo.mRssi);
otPlatRadioReceiveDone(sInstance, &sReceiveFrame, OT_ERROR_NONE);
}
@@ -269,9 +269,9 @@ static void handleTx(void)
void PHY_DataInd(PHY_DataInd_t *ind)
{
sReceiveFrame.mPsdu = ind->data;
sReceiveFrame.mLength = ind->size + IEEE802154_FCS_SIZE;
sReceiveFrame.mRssi = ind->rssi;
sReceiveFrame.mPsdu = ind->data;
sReceiveFrame.mLength = ind->size + IEEE802154_FCS_SIZE;
sReceiveFrame.mInfo.mRxInfo.mRssi = ind->rssi;
sRxDone = true;
}
+32 -21
View File
@@ -97,29 +97,40 @@ typedef enum otRadioCaps {
*/
typedef struct otRadioFrame
{
uint8_t *mPsdu; ///< The PSDU.
uint8_t mLength; ///< Length of the PSDU.
uint8_t mChannel; ///< Channel used to transmit/receive the frame.
int8_t mRssi; ///< Received signal strength indicator in dBm for received frames.
uint8_t mLqi; ///< Link Quality Indicator for received frames.
uint8_t mMaxTxAttempts; ///< Max number of transmit attempts for an outbound frame.
bool mDidTx : 1; ///< Set to true if this frame sent from the radio. Ignored by radio driver.
bool mIsARetx : 1; ///< Set to true if this frame is a retransmission. Should be ignored by radio driver.
bool mIsCcaEnabled : 1; ///< Set to true if CCA must be enabled for this packet. False otherwise.
uint8_t *mPsdu; ///< The PSDU.
uint8_t mLength; ///< Length of the PSDU.
uint8_t mChannel; ///< Channel used to transmit/receive the frame.
bool mDidTx : 1; ///< Set to true if this frame sent from the radio. Ignored by radio driver.
/**
* The timestamp when the frame was received (milliseconds).
* Applicable/Required only when raw-link-api feature (`OPENTHREAD_ENABLE_RAW_LINK_API`) is enabled.
*
*/
uint32_t mMsec;
union
{
struct
{
uint8_t mMaxTxAttempts; ///< Max number of transmit attempts for an outbound frame.
bool mIsARetx : 1; ///< Set to true if this frame is a retransmission. Should be ignored by radio driver.
bool mIsCcaEnabled : 1; ///< Set to true if CCA must be enabled for this packet. False otherwise.
} mTxInfo;
/**
* The timestamp when the frame was received (microseconds, the offset to mMsec).
* Applicable/Required only when raw-link-api feature (`OPENTHREAD_ENABLE_RAW_LINK_API`) is enabled.
*
*/
uint16_t mUsec;
struct
{
int8_t mRssi; ///< Received signal strength indicator in dBm for received frames.
uint8_t mLqi; ///< Link Quality Indicator for received frames.
/**
* The timestamp when the frame was received (microseconds, the offset to mMsec).
* Applicable/Required only when raw-link-api feature (`OPENTHREAD_ENABLE_RAW_LINK_API`) is enabled.
*
*/
uint16_t mUsec;
/**
* The timestamp when the frame was received (milliseconds).
* Applicable/Required only when raw-link-api feature (`OPENTHREAD_ENABLE_RAW_LINK_API`) is enabled.
*
*/
uint32_t mMsec;
} mRxInfo;
} mInfo;
} otRadioFrame;
/**
+1 -1
View File
@@ -260,7 +260,7 @@ void LinkRaw::InvokeTransmitDone(otRadioFrame *aFrame, otRadioFrame *aAckFrame,
if (aError == OT_ERROR_NO_ACK)
{
if (mTransmitAttempts < aFrame->mMaxTxAttempts)
if (mTransmitAttempts < aFrame->mInfo.mTxInfo.mMaxTxAttempts)
{
mTransmitAttempts++;
StartCsmaBackoff();
+9 -9
View File
@@ -859,7 +859,7 @@ public:
* @returns The RSSI in dBm used for reception.
*
*/
int8_t GetRssi(void) const { return mRssi; }
int8_t GetRssi(void) const { return mInfo.mRxInfo.mRssi; }
/**
* This method sets the RSSI in dBm used for reception.
@@ -867,7 +867,7 @@ public:
* @param[in] aRssi The RSSI in dBm used for reception.
*
*/
void SetRssi(int8_t aRssi) { mRssi = aRssi; }
void SetRssi(int8_t aRssi) { mInfo.mRxInfo.mRssi = aRssi; }
/**
* This method returns the receive Link Quality Indicator.
@@ -875,7 +875,7 @@ public:
* @returns The receive Link Quality Indicator.
*
*/
uint8_t GetLqi(void) const { return mLqi; }
uint8_t GetLqi(void) const { return mInfo.mRxInfo.mLqi; }
/**
* This method sets the receive Link Quality Indicator.
@@ -883,7 +883,7 @@ public:
* @param[in] aLqi The receive Link Quality Indicator.
*
*/
void SetLqi(uint8_t aLqi) { mLqi = aLqi; }
void SetLqi(uint8_t aLqi) { mInfo.mRxInfo.mLqi = aLqi; }
/**
* This method returns the maximum number of transmit attempts for the frame.
@@ -891,7 +891,7 @@ public:
* @returns The maximum number of transmit attempts.
*
*/
uint8_t GetMaxTxAttempts(void) const { return mMaxTxAttempts; }
uint8_t GetMaxTxAttempts(void) const { return mInfo.mTxInfo.mMaxTxAttempts; }
/**
* This method set the maximum number of transmit attempts for frame.
@@ -899,7 +899,7 @@ public:
* @returns The maximum number of transmit attempts.
*
*/
void SetMaxTxAttempts(uint8_t aMaxTxAttempts) { mMaxTxAttempts = aMaxTxAttempts; }
void SetMaxTxAttempts(uint8_t aMaxTxAttempts) { mInfo.mTxInfo.mMaxTxAttempts = aMaxTxAttempts; }
/**
* This method indicates whether or not the frame is a retransmission.
@@ -908,7 +908,7 @@ public:
* @retval FALSE This is a new frame and not a retransmission of an earlier frame.
*
*/
bool IsARetransmission(void) const { return mIsARetx; }
bool IsARetransmission(void) const { return mInfo.mTxInfo.mIsARetx; }
/**
* This method sets the retransmission flag attribute.
@@ -916,7 +916,7 @@ public:
* @param[in] aIsARetx TRUE if frame is a retransmission of an earlier frame, FALSE otherwise.
*
*/
void SetIsARetransmission(bool aIsARetx) { mIsARetx = aIsARetx; }
void SetIsARetransmission(bool aIsARetx) { mInfo.mTxInfo.mIsARetx = aIsARetx; }
/**
* This method sets the did Tx attribute.
@@ -932,7 +932,7 @@ public:
* @param[in] aIsCcaEnabled TRUE if CCA must be enabled for this packet, FALSE otherwise.
*
*/
void SetIsCcaEnabled(bool aIsCcaEnabled) { mIsCcaEnabled = aIsCcaEnabled; }
void SetIsCcaEnabled(bool aIsCcaEnabled) { mInfo.mTxInfo.mIsCcaEnabled = aIsCcaEnabled; }
/**
* This method returns the IEEE 802.15.4 PSDU length.
+2 -2
View File
@@ -347,8 +347,8 @@ void Diag::DiagReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError
// for sensitivity test, only record the rssi and lqi for the first packet
if (sStats.mReceivedPackets == 0)
{
sStats.mFirstRssi = aFrame->mRssi;
sStats.mFirstLqi = aFrame->mLqi;
sStats.mFirstRssi = aFrame->mInfo.mRxInfo.mRssi;
sStats.mFirstLqi = aFrame->mInfo.mRxInfo.mLqi;
}
sStats.mReceivedPackets++;
+1 -1
View File
@@ -1006,7 +1006,7 @@ void NcpBase::HandleRawFrame(const otRadioFrame *aFrame)
SuccessOrExit(mEncoder.WriteData(aFrame->mPsdu, aFrame->mLength));
// Append metadata (rssi, etc)
SuccessOrExit(mEncoder.WriteInt8(aFrame->mRssi)); // RSSI
SuccessOrExit(mEncoder.WriteInt8(aFrame->mInfo.mRxInfo.mRssi)); // RSSI
SuccessOrExit(mEncoder.WriteInt8(-128)); // Noise floor (Currently unused)
SuccessOrExit(mEncoder.WriteUint16(flags)); // Flags
+7 -7
View File
@@ -78,15 +78,15 @@ void NcpBase::LinkRawReceiveDone(otRadioFrame *aFrame, otError aError)
}
// Append metadata (rssi, etc)
SuccessOrExit(mEncoder.WriteInt8(aFrame->mRssi)); // RSSI
SuccessOrExit(mEncoder.WriteInt8(aFrame->mInfo.mRxInfo.mRssi)); // RSSI
SuccessOrExit(mEncoder.WriteInt8(-128)); // Noise Floor (Currently unused)
SuccessOrExit(mEncoder.WriteUint16(flags)); // Flags
SuccessOrExit(mEncoder.OpenStruct()); // PHY-data
SuccessOrExit(mEncoder.WriteUint8(aFrame->mChannel)); // 802.15.4 channel (Receive channel)
SuccessOrExit(mEncoder.WriteUint8(aFrame->mLqi)); // 802.15.4 LQI
SuccessOrExit(mEncoder.WriteUint32(aFrame->mMsec)); // The timestamp milliseconds
SuccessOrExit(mEncoder.WriteUint16(aFrame->mUsec)); // The timestamp microseconds, offset to mMsec
SuccessOrExit(mEncoder.WriteUint8(aFrame->mInfo.mRxInfo.mLqi)); // 802.15.4 LQI
SuccessOrExit(mEncoder.WriteUint32(aFrame->mInfo.mRxInfo.mMsec)); // The timestamp milliseconds
SuccessOrExit(mEncoder.WriteUint16(aFrame->mInfo.mRxInfo.mUsec)); // The timestamp microseconds, offset to mMsec
SuccessOrExit(mEncoder.CloseStruct());
SuccessOrExit(mEncoder.OpenStruct()); // Vendor-data
@@ -124,14 +124,14 @@ void NcpBase::LinkRawTransmitDone(otRadioFrame *aFrame, otRadioFrame *aAckFrame,
SuccessOrExit(mEncoder.WriteUint16(aAckFrame->mLength));
SuccessOrExit(mEncoder.WriteData(aAckFrame->mPsdu, aAckFrame->mLength));
SuccessOrExit(mEncoder.WriteInt8(aAckFrame->mRssi)); // RSSI
SuccessOrExit(mEncoder.WriteInt8(aAckFrame->mInfo.mRxInfo.mRssi)); // RSSI
SuccessOrExit(mEncoder.WriteInt8(-128)); // Noise Floor (Currently unused)
SuccessOrExit(mEncoder.WriteUint16(0)); // Flags
SuccessOrExit(mEncoder.OpenStruct()); // PHY-data
SuccessOrExit(mEncoder.WriteUint8(aAckFrame->mChannel)); // Receive channel
SuccessOrExit(mEncoder.WriteUint8(aAckFrame->mLqi)); // Link Quality Indicator
SuccessOrExit(mEncoder.WriteUint8(aAckFrame->mInfo.mRxInfo.mLqi)); // Link Quality Indicator
SuccessOrExit(mEncoder.CloseStruct());
}
@@ -368,7 +368,7 @@ otError NcpBase::SetPropertyHandler_STREAM_RAW(uint8_t aHeader)
memcpy(frame->mPsdu, frameBuffer, frame->mLength);
// TODO: This should be later added in the STREAM_RAW argument to allow user to directly specify it.
frame->mMaxTxAttempts = OPENTHREAD_CONFIG_MAX_TX_ATTEMPTS_DIRECT;
frame->mInfo.mTxInfo.mMaxTxAttempts = OPENTHREAD_CONFIG_MAX_TX_ATTEMPTS_DIRECT;
// Pass frame to the radio layer. Note, this fails if we
// haven't enabled raw stream or are already transmitting.