mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 14:17:47 +00:00
[kw41z] load bytes into TX Packet Buffer in order (#2882)
The MKW41Z Reference Manual Section 44.6.2.7 states: - "The 802.15.4 Link Layer software prepares data to be transmitted, by loading the octets, in order, into the Packet Buffer." This commit maintains a separate buffer for building the transmit frame then copies the buffer just before the transmit frame is submitted to the radio.
This commit is contained in:
@@ -101,6 +101,7 @@ static otError sTxStatus;
|
||||
|
||||
static otRadioFrame sTxFrame;
|
||||
static otRadioFrame sRxFrame;
|
||||
static uint8_t sTxData[OT_RADIO_FRAME_MAX_SIZE];
|
||||
#if DOUBLE_BUFFERING
|
||||
static uint8_t sRxData[OT_RADIO_FRAME_MAX_SIZE];
|
||||
#endif
|
||||
@@ -357,6 +358,14 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
|
||||
|
||||
*(uint8_t *)ZLL->PKT_BUFFER_TX = aFrame->mLength;
|
||||
|
||||
/* MKW41Z Reference Manual Section 44.6.2.7 states: "The 802.15.4
|
||||
* Link Layer software prepares data to be transmitted, by loading
|
||||
* the octets, in order, into the Packet Buffer." */
|
||||
for (int i = 0; i < aFrame->mLength - sizeof(uint16_t); i++)
|
||||
{
|
||||
((uint8_t *)ZLL->PKT_BUFFER_TX)[1 + i] = sTxFrame.mPsdu[i];
|
||||
}
|
||||
|
||||
/* Set CCA mode */
|
||||
ZLL->PHY_CTRL &= ~ZLL_PHY_CTRL_CCATYPE_MASK;
|
||||
ZLL->PHY_CTRL |= ZLL_PHY_CTRL_CCATYPE(DEFAULT_CCA_MODE);
|
||||
@@ -929,7 +938,7 @@ void kw41zRadioInit(void)
|
||||
rf_set_tx_power(0);
|
||||
|
||||
sTxFrame.mLength = 0;
|
||||
sTxFrame.mPsdu = (uint8_t *)ZLL->PKT_BUFFER_TX + 1;
|
||||
sTxFrame.mPsdu = sTxData;
|
||||
sRxFrame.mLength = 0;
|
||||
#if DOUBLE_BUFFERING
|
||||
sRxFrame.mPsdu = sRxData;
|
||||
|
||||
Reference in New Issue
Block a user