mirror of
https://github.com/espressif/openthread.git
synced 2026-08-01 00:27:47 +00:00
[low-power] add csl feature for Thread 1.2 (#4557)
This commit implements the CSL feature in Thread 1.2. - Add macro definitions for low power to control the compiling of source code. - Add data and methods for running CSL in Mac and SubMac. This mainly includes setting CSL parameters, starting/stopping CSL, and the timer handling process. - Add otPlatTimeGetAPI and implementation. - Add CSL transmission implementation. CSL transmission is a new kind of transmission, the related definition and implementaion for the whole transmitting process is added. - Add calling of start/stop CSL in certain cases. - Implement CSL synchronization maintainence. If a CSL cordinator didn't get a frame containing CSL IE for CSLTimeout, the CSL receiver is regarded as de-synchronized. - Add Cli interface for using CSL. - Implement enhanced Ack with IE. The original code can only generate auto ack for Imm-Ack. As CSL requires CSL IE included in enhanced ack. This PR implements it. - Add basic functional test for CSL transmission. More tests corresponding to test plan would be added later.
This commit is contained in:
@@ -132,6 +132,9 @@ const struct Command Interpreter::sCommands[] = {
|
||||
{"contextreusedelay", &Interpreter::ProcessContextIdReuseDelay},
|
||||
#endif
|
||||
{"counters", &Interpreter::ProcessCounters},
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
{"csl", &Interpreter::ProcessCsl},
|
||||
#endif
|
||||
{"dataset", &Interpreter::ProcessDataset},
|
||||
#if OPENTHREAD_FTD
|
||||
{"delaytimermin", &Interpreter::ProcessDelayTimerMin},
|
||||
@@ -1283,6 +1286,44 @@ exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
void Interpreter::ProcessCsl(uint8_t aArgsLength, char *argv[])
|
||||
{
|
||||
otError error = OT_ERROR_INVALID_ARGS;
|
||||
|
||||
if (aArgsLength == 0)
|
||||
{
|
||||
OutputFormat("Channel: %u\r\n", otLinkCslGetChannel(mInstance));
|
||||
OutputFormat("Period: %u(in units of 10 symbols), %ums\r\n", otLinkCslGetPeriod(mInstance),
|
||||
otLinkCslGetPeriod(mInstance) * kUsPerTenSymbols / 1000);
|
||||
OutputFormat("Timeout: %us\r\n", otLinkCslGetTimeout(mInstance));
|
||||
error = OT_ERROR_NONE;
|
||||
}
|
||||
else if (aArgsLength == 2)
|
||||
{
|
||||
long value;
|
||||
|
||||
SuccessOrExit(error = ParseLong(argv[1], value));
|
||||
|
||||
if (strcmp(argv[0], "channel") == 0)
|
||||
{
|
||||
SuccessOrExit(error = otLinkCslSetChannel(mInstance, static_cast<uint8_t>(value)));
|
||||
}
|
||||
else if (strcmp(argv[0], "period") == 0)
|
||||
{
|
||||
SuccessOrExit(error = otLinkCslSetPeriod(mInstance, static_cast<uint16_t>(value)));
|
||||
}
|
||||
else if (strcmp(argv[0], "timeout") == 0)
|
||||
{
|
||||
SuccessOrExit(error = otLinkCslSetTimeout(mInstance, static_cast<uint32_t>(value)));
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
void Interpreter::ProcessDelayTimerMin(uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user