mirror of
https://github.com/espressif/openthread.git
synced 2026-08-22 18:39:50 +00:00
[posix-app] fix diag issues of radio only mode (#2948)
This commit is contained in:
@@ -693,13 +693,11 @@ void platformRadioProcess(otInstance *aInstance)
|
||||
}
|
||||
}
|
||||
|
||||
void radioTransmit(struct RadioMessage *aMessage, const struct otRadioFrame *aFrame)
|
||||
static void radioComputeCrc(struct RadioMessage *aMessage, uint16_t aLength)
|
||||
{
|
||||
uint32_t i;
|
||||
struct sockaddr_in sockaddr;
|
||||
|
||||
uint16_t i;
|
||||
uint16_t crc = 0;
|
||||
uint16_t crc_offset = aFrame->mLength - sizeof(uint16_t);
|
||||
uint16_t crc_offset = aLength - sizeof(uint16_t);
|
||||
|
||||
for (i = 0; i < crc_offset; i++)
|
||||
{
|
||||
@@ -708,6 +706,17 @@ void radioTransmit(struct RadioMessage *aMessage, const struct otRadioFrame *aFr
|
||||
|
||||
aMessage->mPsdu[crc_offset] = crc & 0xff;
|
||||
aMessage->mPsdu[crc_offset + 1] = crc >> 8;
|
||||
}
|
||||
|
||||
void radioTransmit(struct RadioMessage *aMessage, const struct otRadioFrame *aFrame)
|
||||
{
|
||||
uint32_t i;
|
||||
struct sockaddr_in sockaddr;
|
||||
|
||||
if (!sPromiscuous)
|
||||
{
|
||||
radioComputeCrc(aMessage, aFrame->mLength);
|
||||
}
|
||||
|
||||
memset(&sockaddr, 0, sizeof(sockaddr));
|
||||
sockaddr.sin_family = AF_INET;
|
||||
|
||||
@@ -143,13 +143,13 @@
|
||||
#define OPENTHREAD_ENABLE_MULTIPLE_INSTANCES 0
|
||||
|
||||
/* Define to 1 to enable the NCP SPI interface. */
|
||||
#define OPENTHREAD_ENABLE_NCP_SPI 1
|
||||
#define OPENTHREAD_ENABLE_NCP_SPI 0
|
||||
|
||||
/* Define to 1 if using NCP Spinel Encrypter */
|
||||
#define OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER 0
|
||||
|
||||
/* Define to 1 to enable the NCP UART interface. */
|
||||
#define OPENTHREAD_ENABLE_NCP_UART 0
|
||||
#define OPENTHREAD_ENABLE_NCP_UART 1
|
||||
|
||||
/* Define to 1 if using NCP vendor hook */
|
||||
#define OPENTHREAD_ENABLE_NCP_VENDOR_HOOK 0
|
||||
|
||||
@@ -793,7 +793,19 @@ void RadioSpinel::Process(const fd_set &aReadFdSet, const fd_set &aWriteFdSet)
|
||||
if (mState == OT_RADIO_STATE_TRANSMIT && mTxState == kDone)
|
||||
{
|
||||
mState = OT_RADIO_STATE_RECEIVE;
|
||||
otPlatRadioTxDone(mInstance, mTransmitFrame, (mIsAckRequested ? &mRxRadioFrame : NULL), mTxError);
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
if (otPlatDiagModeGet())
|
||||
{
|
||||
otPlatDiagRadioTransmitDone(mInstance, mTransmitFrame, mTxError);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
otPlatRadioTxDone(mInstance, mTransmitFrame, (mIsAckRequested ? &mRxRadioFrame : NULL), mTxError);
|
||||
}
|
||||
|
||||
mTxState = kIdle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1062,7 +1074,7 @@ void RadioSpinel::RadioTransmit(void)
|
||||
otPlatRadioTxStarted(mInstance, mTransmitFrame);
|
||||
assert(mTxState == kIdle);
|
||||
|
||||
mIsAckRequested = isAckRequested(mTransmitFrame->mPsdu);
|
||||
mIsAckRequested = isAckRequested(mTransmitFrame->mPsdu) && !mIsPromiscuous;
|
||||
|
||||
error = Request(true, SPINEL_CMD_PROP_VALUE_SET, SPINEL_PROP_STREAM_RAW,
|
||||
SPINEL_DATATYPE_DATA_WLEN_S SPINEL_DATATYPE_UINT8_S SPINEL_DATATYPE_INT8_S, mTransmitFrame->mPsdu,
|
||||
|
||||
Reference in New Issue
Block a user