mirror of
https://github.com/espressif/openthread.git
synced 2026-08-06 02:37:47 +00:00
[sub-mac] relax the requirement for TxDone callback (#4113)
This commit changes the `SubMac::BeginTrasnmit()` by moving the call to `Transmit()` on radio platform after the state change to `kStateTransmit` (and pcap callback). This relaxes the requirement for radio platform implementation and allow it to invoke `TxDone` callback directly from the `Transmit()` call itself (instead of requiring `TxDone` to be called only after the `Transmit()` call returns).
This commit is contained in:
committed by
Jonathan Hui
parent
1812d8cfda
commit
27336a95cf
@@ -286,9 +286,6 @@ void SubMac::BeginTransmit(void)
|
||||
error = Get<Radio>().Receive(mTransmitFrame.GetChannel());
|
||||
assert(error == OT_ERROR_NONE);
|
||||
|
||||
error = Get<Radio>().Transmit(mTransmitFrame);
|
||||
assert(error == OT_ERROR_NONE);
|
||||
|
||||
SetState(kStateTransmit);
|
||||
|
||||
if (mPcapCallback)
|
||||
@@ -296,6 +293,9 @@ void SubMac::BeginTransmit(void)
|
||||
mPcapCallback(&mTransmitFrame, true, mPcapCallbackContext);
|
||||
}
|
||||
|
||||
error = Get<Radio>().Transmit(mTransmitFrame);
|
||||
assert(error == OT_ERROR_NONE);
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user