mirror of
https://github.com/espressif/openthread.git
synced 2026-08-22 02:19:52 +00:00
[efr32] avoid asserts during data requests (#5697)
If the RAIL interrupt fires late (for example, when the MCU is heavily loaded), then RAIL_IEEE802154_GetAddress and RAIL_IEEE802154_SetFramePending return RAIL_STATUS_INVALID_STATE because it is too late to modify the outgoing Immediate ACK. The proposed solution is to avoid asserting and print a warning to make the user aware of such problems.
This commit is contained in:
@@ -889,14 +889,14 @@ exit:
|
||||
|
||||
static void ieee802154DataRequestCommand(RAIL_Handle_t aRailHandle)
|
||||
{
|
||||
RAIL_Status_t status;
|
||||
RAIL_Status_t status = RAIL_STATUS_NO_ERROR;
|
||||
|
||||
if (sIsSrcMatchEnabled)
|
||||
{
|
||||
RAIL_IEEE802154_Address_t sourceAddress;
|
||||
|
||||
status = RAIL_IEEE802154_GetAddress(aRailHandle, &sourceAddress);
|
||||
assert(status == RAIL_STATUS_NO_ERROR);
|
||||
otEXPECT(status == RAIL_STATUS_NO_ERROR);
|
||||
|
||||
if ((sourceAddress.length == RAIL_IEEE802154_LongAddress &&
|
||||
utilsSoftSrcMatchExtFindEntry((otExtAddress *)sourceAddress.longAddress) >= 0) ||
|
||||
@@ -904,16 +904,26 @@ static void ieee802154DataRequestCommand(RAIL_Handle_t aRailHandle)
|
||||
utilsSoftSrcMatchShortFindEntry(sourceAddress.shortAddress) >= 0))
|
||||
{
|
||||
status = RAIL_IEEE802154_SetFramePending(aRailHandle);
|
||||
assert(status == RAIL_STATUS_NO_ERROR);
|
||||
otEXPECT(status == RAIL_STATUS_NO_ERROR);
|
||||
insertIeee802154DataRequestCommand(aRailHandle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = RAIL_IEEE802154_SetFramePending(aRailHandle);
|
||||
assert(status == RAIL_STATUS_NO_ERROR);
|
||||
otEXPECT(status == RAIL_STATUS_NO_ERROR);
|
||||
insertIeee802154DataRequestCommand(aRailHandle);
|
||||
}
|
||||
|
||||
exit:
|
||||
if (status == RAIL_STATUS_INVALID_STATE)
|
||||
{
|
||||
otLogWarnPlat("Too late to modify outgoing FP");
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(status == RAIL_STATUS_NO_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
static void RAILCb_Generic(RAIL_Handle_t aRailHandle, RAIL_Events_t aEvents)
|
||||
|
||||
Reference in New Issue
Block a user