mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 14:17:47 +00:00
[test] update unit test emulating radio (#9200)
This commit updates the unit tests that emulate the radio platform API to define `otPlatRadioGetCaps()`, which returns the ACK_TIMEOUT and CSMA capabilities. This is to avoid having CSMA being implemented by the `SubMac`, which then uses the microsecond timer that is not emulated in the unit test platform. It also updates the `InitTest()` function to clear the radio platform variable `sRadioTxOngoing`. This is to avoid the possible (though unlikely) situation where an earlier test finishes in the middle of a transmission, causing an extra `TxDone` event in the following test.
This commit is contained in:
@@ -80,6 +80,8 @@ void AdvanceTime(uint32_t aDuration);
|
||||
|
||||
extern "C" {
|
||||
|
||||
otRadioCaps otPlatRadioGetCaps(otInstance *) { return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF; }
|
||||
|
||||
otError otPlatRadioTransmit(otInstance *, otRadioFrame *)
|
||||
{
|
||||
sRadioTxOngoing = true;
|
||||
@@ -188,10 +190,12 @@ void InitTest(void)
|
||||
// Initialize OT instance.
|
||||
|
||||
sNow = 0;
|
||||
sAlarmOn = false;
|
||||
sInstance = static_cast<Instance *>(testInitInstance());
|
||||
|
||||
memset(&sRadioTxFrame, 0, sizeof(sRadioTxFrame));
|
||||
sRadioTxFrame.mPsdu = sRadioTxFramePsdu;
|
||||
sRadioTxOngoing = false;
|
||||
|
||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// Initialize Border Router and start Thread operation.
|
||||
|
||||
Reference in New Issue
Block a user