[nrf528xx] ensure there is no radio pending events after diag is disabled (#4343)

This commit is contained in:
Duda, Lukasz
2019-11-20 10:47:47 -08:00
committed by Jonathan Hui
parent 205842d414
commit 4b422a33a0
3 changed files with 24 additions and 0 deletions
+3
View File
@@ -415,6 +415,9 @@ void otPlatDiagModeSet(bool aMode)
{
otPlatRadioReceive(NULL, sChannel);
otPlatRadioSleep(NULL);
// Clear all remaining events before switching to MAC callbacks.
nrf5RadioClearPendingEvents();
}
else
{
@@ -166,6 +166,12 @@ void nrf5RadioDeinit(void);
*/
void nrf5RadioProcess(otInstance *aInstance);
/**
* Function for clearing Radio driver pending events.
*
*/
void nrf5RadioClearPendingEvents(void);
/**
* Initialization of hardware crypto engine.
*
+15
View File
@@ -254,6 +254,21 @@ void nrf5RadioDeinit(void)
sPendingEvents = 0;
}
void nrf5RadioClearPendingEvents(void)
{
sPendingEvents = 0;
for (uint32_t i = 0; i < NRF_802154_RX_BUFFERS; i++)
{
if (sReceivedFrames[i].mPsdu != NULL)
{
uint8_t *bufferAddress = &sReceivedFrames[i].mPsdu[-1];
sReceivedFrames[i].mPsdu = NULL;
nrf_802154_buffer_free_raw(bufferAddress);
}
}
}
otRadioState otPlatRadioGetState(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);