[csl] update CSL public APIs to use microseconds unit for period (#9285)

This commit updates public APIs for getting and setting CSL period to
use microseconds unit instead of the internal ten symbols unit. This
makes the APIs easier to use.

The CSL APIs have been renamed to follow the `otLinkGet/SetCsl{Item}()`
pattern, which is the common naming style of OpenThread. This
renaming will make the APIs more consistent and avoid potential
confusion with the now-removed APIs, which used a different unit for
CSL period.

This commit also updates the related CLI CSL commands:
- The `csl period` expects the given period to be in microseconds.
- The `csl` command (which outputs all CSL parameter) shows the CSL
  period in microsecond unit (e.g., "Period: 160000us").

The NCP spinel `SPINEL_PROP_THREAD_CSL_PERIOD` is also updated to use
microsecond unit for CSL period.

The related test script are updated to use the new unit, in particular
the test harness `setCSLperiod()` in `harness-thci/OpenThread.py` is
updated (no need to convert from msec).
This commit is contained in:
Abtin Keshavarzian
2023-07-19 13:21:29 -07:00
committed by GitHub
parent 5340a6e944
commit 5fc0e7774c
20 changed files with 122 additions and 71 deletions
@@ -383,8 +383,8 @@ MAC_FRAME_TYPE_ACK = 0x2
MAC_FRAME_TYPE_MAC_CMD = 0x3
# CSL
CSL_DEFAULT_PERIOD = 3125 # 0.5s, 3125 in units of ten symbols
CSL_DEFAULT_PERIOD_IN_SECOND = 0.5
CSL_DEFAULT_PERIOD = CSL_DEFAULT_PERIOD_IN_SECOND * 1000 * 1000 # in usec
US_PER_TEN_SYMBOLS = 160
CSL_IE_ID = 0x1a
CSL_DEFAULT_TIMEOUT = 30
@@ -36,7 +36,7 @@ import config
LEADER = 1
SSED_1 = 2
CSL_PERIOD = 500 * 6.25 # 500ms
CSL_PERIOD = 500 * 1000 # 0.5 in usec
CSL_TIMEOUT = 30 # 30s