mirror of
https://github.com/espressif/openthread.git
synced 2026-08-16 23:57:46 +00:00
[mac] add capability to transition from Sleep to Transmit during data request (#4697)
This commit is contained in:
@@ -428,7 +428,8 @@ otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return (otRadioCaps)(OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF);
|
||||
return (otRadioCaps)(OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF |
|
||||
OT_RADIO_CAPS_SLEEP_TO_TX);
|
||||
}
|
||||
|
||||
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
|
||||
|
||||
@@ -123,6 +123,7 @@ enum
|
||||
OT_RADIO_CAPS_ENERGY_SCAN = 1 << 1, ///< Radio supports Energy Scans.
|
||||
OT_RADIO_CAPS_TRANSMIT_RETRIES = 1 << 2, ///< Radio supports tx retry logic with collision avoidance (CSMA).
|
||||
OT_RADIO_CAPS_CSMA_BACKOFF = 1 << 3, ///< Radio supports CSMA backoff for frame transmission (but no retry).
|
||||
OT_RADIO_CAPS_SLEEP_TO_TX = 1 << 4, ///< Radio supports direct transition from sleep to TX with CSMA.
|
||||
};
|
||||
|
||||
#define OT_PANID_BROADCAST 0xffff ///< IEEE 802.15.4 Broadcast PAN ID
|
||||
@@ -244,6 +245,10 @@ typedef enum otRadioState
|
||||
* +----------+ Disable() +-------+ Sleep() +---------+ Receive() +----------+
|
||||
* (Radio OFF) or
|
||||
* signal TransmitDone
|
||||
*
|
||||
* During the IEEE 802.15.4 data request command the transition Sleep->Receive->Transmit
|
||||
* can be shortened to direct transition from Sleep to Transmit if the platform supports
|
||||
* the OT_RADIO_CAPS_SLEEP_TO_TX capability.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -558,7 +563,9 @@ otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance);
|
||||
* requesting transmission. The channel and transmit power are also included in the otRadioFrame structure.
|
||||
*
|
||||
* The transmit sequence consists of:
|
||||
* 1. Transitioning the radio to Transmit from Receive.
|
||||
* 1. Transitioning the radio to Transmit from one of the following states:
|
||||
* - Receive if RX is on when the device is idle or OT_RADIO_CAPS_SLEEP_TO_TX is not supported
|
||||
* - Sleep if RX is off when the device is idle and OT_RADIO_CAPS_SLEEP_TO_TX is supported.
|
||||
* 2. Transmits the psdu on the given channel and at the given transmit power.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
|
||||
@@ -285,8 +285,11 @@ void SubMac::BeginTransmit(void)
|
||||
mTransmitFrame.SetCsmaCaEnabled(true);
|
||||
}
|
||||
|
||||
error = Get<Radio>().Receive(mTransmitFrame.GetChannel());
|
||||
OT_ASSERT(error == OT_ERROR_NONE);
|
||||
if ((mRadioCaps & OT_RADIO_CAPS_SLEEP_TO_TX) == 0)
|
||||
{
|
||||
error = Get<Radio>().Receive(mTransmitFrame.GetChannel());
|
||||
OT_ASSERT(error == OT_ERROR_NONE);
|
||||
}
|
||||
|
||||
SetState(kStateTransmit);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user