[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:
Jonathan Hui
2018-07-30 10:45:24 -05:00
committed by GitHub
parent f824343f8c
commit b6c2a2b06e
+10 -1
View File
@@ -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;