無線電操作
這個模組包含無線電作業的平台抽象層。
摘要
Functions |
|
---|---|
otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
void
無線電驅動程式會呼叫這個方法來通知接收影格的 OpenThread 診斷模組。
|
otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
void
無線電驅動程式會呼叫這個方法,通知 OpenThread 診斷模組,傳輸作業已完成。
|
otPlatRadioAddCalibratedPower(otInstance *aInstance, uint8_t aChannel, int16_t aActualPower, const uint8_t *aRawPowerSetting, uint16_t aRawPowerSettingLength)
|
將指定頻道經過校正的功率加入功率校正表。
|
otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
|
在來源地址比對表格中新增延伸地址。
|
otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress)
|
在來源地址比對表格中新增短位址。
|
otPlatRadioClearCalibratedPowers(otInstance *aInstance)
|
清除校準表中的所有校正功率。
|
otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
|
void
清除來源地址比對表格中的所有延伸/長地址。
|
otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
|
從來源地址比對表格中移除延伸地址。
|
otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
|
void
清除來源地址比對表中的所有簡短地址。
|
otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress)
|
從來源地址比對表格中移除短地址。
|
otPlatRadioConfigureEnhAckProbing(otInstance *aInstance, otLinkMetrics aLinkMetrics, otShortAddress aShortAddress, const otExtAddress *aExtAddress)
|
針對特定的發起者啟用/停用或更新電台中採用進階 ACK 技術的探測。
|
otPlatRadioDisable(otInstance *aInstance)
|
停用收音機。
|
otPlatRadioEnable(otInstance *aInstance)
|
啟用電台。
|
otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShortAddress aShortAddr, const otExtAddress *aExtAddr)
|
啟用或停用 CSL 接收器。
|
otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
|
void
啟用/停用來源地址比對功能。
|
otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
|
開啟無線電的能量掃描順序。
|
otPlatRadioEnergyScanDone(otInstance *aInstance, int8_t aEnergyScanMaxRssi)
|
void
無線電驅動程式會呼叫這個方法,通知 OpenThread 已完成能源掃描。
|
otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics)
|
取得無線電共存指標。
|
otPlatRadioGetCslAccuracy(otInstance *aInstance)
|
uint8_t
取得目前用於安排 CSL 運算時鐘的精確度,單位為 ± ppm。
|
otPlatRadioGetCslUncertainty(otInstance *aInstance)
|
uint8_t
以 10 微秒為單位,針對裝置安排 CSL 傳輸作業的固定不確定度。
|
otPlatRadioGetPreferredChannelMask(otInstance *aInstance)
|
uint32_t
取得裝置偏好使用的無線電通道遮罩。
|
otPlatRadioGetRawPowerSetting(otInstance *aInstance, uint8_t aChannel, uint8_t *aRawPowerSetting, uint16_t *aRawPowerSettingLength)
|
取得指定頻道的原始功率設定。
|
otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode)
|
取得地區代碼。
|
otPlatRadioGetRssi(otInstance *aInstance)
|
int8_t
取得最新的 RSSI 測量結果。
|
otPlatRadioGetState(otInstance *aInstance)
|
取得廣播的目前狀態。
|
otPlatRadioGetSupportedChannelMask(otInstance *aInstance)
|
uint32_t
取得支援裝置的無線電遮罩,
|
otPlatRadioGetTransmitBuffer(otInstance *aInstance)
|
取得無線電傳輸影格緩衝區。
|
otPlatRadioIsCoexEnabled(otInstance *aInstance)
|
bool
檢查是否啟用無線電 coex。
|
otPlatRadioIsEnabled(otInstance *aInstance)
|
bool
檢查電台是否已啟用。
|
otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
|
將電台從「休眠」轉換為「接收」(開啟無線電)。
|
otPlatRadioReceiveAt(otInstance *aInstance, uint8_t aChannel, uint32_t aStart, uint32_t aDuration)
|
安排 特定 時間 時 的 電台 接收 時間。
|
otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
void
無線電驅動程式呼叫此方法,以通知 OpenThread 所接收的影格。
|
otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower)
|
設定特定頻道的最大傳輸功率。
|
otPlatRadioSetChannelTargetPower(otInstance *aInstance, uint8_t aChannel, int16_t aTargetPower)
|
設定指定頻道的目標功率。
|
otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled)
|
啟用電台。
|
otPlatRadioSetRegion(otInstance *aInstance, uint16_t aRegionCode)
|
設定區域代碼。
|
otPlatRadioSleep(otInstance *aInstance)
|
將收音機從「接收」轉換為「休眠」(關閉收音機)。
|
otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
|
開啟電台上的傳輸序列。
|
otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)
|
void
無線電驅動程式會呼叫這個函式來通知 OpenThread 傳輸作業已完成,同時提供已傳輸的影格和收到的 ack 影格 (如適用)。
|
otPlatRadioTxStarted(otInstance *aInstance, otRadioFrame *aFrame)
|
void
無線電驅動程式會呼叫這個方法,通知 OpenThread 傳輸開始。
|
otPlatRadioUpdateCslSampleTime(otInstance *aInstance, uint32_t aCslSampleTime)
|
void
更新無線電驅動程式的 CSL 樣本時間。
|
Functions
otPlatDiagRadioReceiveDone
void otPlatDiagRadioReceiveDone( otInstance *aInstance, otRadioFrame *aFrame, otError aError )
無線電驅動程式會呼叫這個方法來通知接收影格的 OpenThread 診斷模組。
啟用診斷功能時,系統會使用此功能。
詳細資料 | |||||||
---|---|---|---|---|---|---|---|
參數 |
|
otPlatDiagRadioTransmitDone
void otPlatDiagRadioTransmitDone( otInstance *aInstance, otRadioFrame *aFrame, otError aError )
無線電驅動程式會呼叫這個方法,通知 OpenThread 診斷模組,傳輸作業已完成。
啟用診斷功能時,系統會使用此功能。
詳細資料 | |||||||
---|---|---|---|---|---|---|---|
參數 |
|
otPlatRadioAddCalibratingPower
otError otPlatRadioAddCalibratedPower( otInstance *aInstance, uint8_t aChannel, int16_t aActualPower, const uint8_t *aRawPowerSetting, uint16_t aRawPowerSettingLength )
將指定頻道經過校正的功率加入功率校正表。
注意:此 API 為可選的廣播平台 API。但可由平台層實作。
aActualPower
是無線電硬體模組參數設為 aRawPowerSetting
時實際測量的輸出功率。
原始電源設定是不透明位元組陣列。OpenThread 不會定義原始電源設定的格式。其格式與無線電硬體相關,且應由平台無線電驅動程式的開發人員定義。舉例來說,如果無線電硬體同時含有無線電晶片與 FEM 晶片,原始功率設定可以是無線電功率暫存器和 FEM 增益值的組合。
詳細資料 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
參數 |
|
||||||||||
回傳值 |
|
otPlatRadioAddSrcMatchExtEntry
otError otPlatRadioAddSrcMatchExtEntry( otInstance *aInstance, const otExtAddress *aExtAddress )
在來源地址比對表格中新增延伸地址。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
||||
回傳值 |
|
otPlatRadioAddSrcMatchShortEntry
otError otPlatRadioAddSrcMatchShortEntry( otInstance *aInstance, otShortAddress aShortAddress )
在來源地址比對表格中新增短位址。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
||||
回傳值 |
|
otPlatRadioClearCalibratedPowers
otError otPlatRadioClearCalibratedPowers( otInstance *aInstance )
清除校準表中的所有校正功率。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
||||
回傳值 |
|
otPlatRadioClearSrcMatchExtEntries
void otPlatRadioClearSrcMatchExtEntries( otInstance *aInstance )
清除來源地址比對表格中的所有延伸/長地址。
詳細資料 | |||
---|---|---|---|
參數 |
|
otPlatRadioClearSrcMatchExtEntry
otError otPlatRadioClearSrcMatchExtEntry( otInstance *aInstance, const otExtAddress *aExtAddress )
從來源地址比對表格中移除延伸地址。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
||||
回傳值 |
|
otPlatRadioClearSrcMatchShortEntries
void otPlatRadioClearSrcMatchShortEntries( otInstance *aInstance )
清除來源地址比對表中的所有簡短地址。
詳細資料 | |||
---|---|---|---|
參數 |
|
otPlatRadioClearSrcMatchShortEntry
otError otPlatRadioClearSrcMatchShortEntry( otInstance *aInstance, otShortAddress aShortAddress )
從來源地址比對表格中移除短地址。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
||||
回傳值 |
|
otPlatRadioConfigureEnhAckProbing
otError otPlatRadioConfigureEnhAckProbing( otInstance *aInstance, otLinkMetrics aLinkMetrics, otShortAddress aShortAddress, const otExtAddress *aExtAddress )
針對特定的發起者啟用/停用或更新電台中採用進階 ACK 技術的探測。
由特定探測探測器設定「增強型 ACK」後,傳送至該節點的增強型 ACK 應包含包含連結指標資料的供應商專屬 IE。這個方法會告知收音機開始/停止收集連結指標資料,並納入供應商專屬 IE,其中含有傳送至該探測啟動者的 Enhanced-ACK 資料。
詳細資料 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
參數 |
|
||||||||||
回傳值 |
|
otPlatRadio 停用
otError otPlatRadioDisable( otInstance *aInstance )
停用收音機。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
||||
回傳值 |
|
otPlatRadio 啟用
otError otPlatRadioEnable( otInstance *aInstance )
啟用電台。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
||||
回傳值 |
|
otPlatRadioEnableCsl
otError otPlatRadioEnableCsl( otInstance *aInstance, uint32_t aCslPeriod, otShortAddress aShortAddr, const otExtAddress *aExtAddr )
啟用或停用 CSL 接收器。
詳細資料 | |||||||||
---|---|---|---|---|---|---|---|---|---|
參數 |
|
||||||||
回傳值 |
|
otPlatRadioEnableSrcMatch
void otPlatRadioEnableSrcMatch( otInstance *aInstance, bool aEnable )
啟用/停用來源地址比對功能。
來源地址比對功能可控制無線電圖層針對回應子項資料指令而傳送的封包,決定「待定影格」位元的方式。
如果停用此選項,廣播圖層必須將所有影格的「Frame 處理中」設為資料要求指令。
啟用時,無線電圖層會使用來源位址比對表,以判斷是否要設定或清除資料要求指令中的堆疊的「待處理的影格」位元。
來源地址比對表格會顯示有待處理頁框的兒童清單。可在來源地址比對表格中,新增簡短地址或延伸/長地址。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
otPlatRadioEnergyScan
otError otPlatRadioEnergyScan( otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration )
開啟無線電的能量掃描順序。
無線電提供 OT_RADIO_CAPS_ENERGY_SCAN 功能時,系統會使用此功能。
詳細資料 | |||||||
---|---|---|---|---|---|---|---|
參數 |
|
||||||
回傳值 |
|
otPlatRadioEnergyScanDone
void otPlatRadioEnergyScanDone( otInstance *aInstance, int8_t aEnergyScanMaxRssi )
無線電驅動程式會呼叫這個方法,通知 OpenThread 已完成能源掃描。
無線電提供 OT_RADIO_CAPS_ENERGY_SCAN 功能時,系統會使用此功能。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
otPlatRadioGetCoexMetrics
otError otPlatRadioGetCoexMetrics( otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics )
取得無線電共存指標。
啟用 OPENOPEN_CONFIG_PLATFORM_RADIO_COEX_ENABLE 功能時,系統就會使用這個函式。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
||||
回傳值 |
|
otPlatRadioGetCslAccuracy
uint8_t otPlatRadioGetCslAccuracy( otInstance *aInstance )
取得目前用於安排 CSL 運算時鐘的精確度,單位為 ± ppm。
詳細資料 | |||
---|---|---|---|
參數 |
|
||
傳回 |
目前的 CSL rx/tx 排程偏移,單位為 ± ppm。
|
otPlatRadioGetCslUn 不確定 ty
uint8_t otPlatRadioGetCslUncertainty( otInstance *aInstance )
以 10 微秒為單位,針對裝置安排 CSL 傳輸作業的固定不確定度。
詳細資料 | |||
---|---|---|---|
參數 |
|
||
傳回 |
CSL 的不確定性單位為 10 個單位。
|
otPlatRadioGetPreferredChannelMask
uint32_t otPlatRadioGetPreferredChannelMask( otInstance *aInstance )
取得裝置偏好使用的無線電通道遮罩。
詳細資料 | |||
---|---|---|---|
參數 |
|
||
傳回 |
廣播電台偏好頻道遮罩。
|
otPlatRadioGetRawPowerSetting
otError otPlatRadioGetRawPowerSetting( otInstance *aInstance, uint8_t aChannel, uint8_t *aRawPowerSetting, uint16_t *aRawPowerSettingLength )
取得指定頻道的原始功率設定。
注意:OpenThread src/core/utils
會實作 API otPlatRadioAddCalibratedPower()
、otPlatRadioClearCalibratedPowers()
和 otPlatRadioSetChannelTargetPower()
的預設實作。這個 API 是由預設的實作提供,可取得指定頻道的原始功率設定。如果平台未使用預設實作,則可忽略這個 API。
平台無線電層應根據無線電圖層定義的格式剖析原始功率設定,並設定每個無線電硬體模組的參數。
詳細資料 | |||||||||
---|---|---|---|---|---|---|---|---|---|
參數 |
|
||||||||
回傳值 |
|
otPlatRadioGetRegion
otError otPlatRadioGetRegion( otInstance *aInstance, uint16_t *aRegionCode )
取得地區代碼。
射波地域格式是 ISO 3166 alpha-2 代碼的 2 字符 cisi 表示。
詳細資料 | |||||||||
---|---|---|---|---|---|---|---|---|---|
參數 |
|
||||||||
回傳值 |
|
OTPPRadioRadioGetRssi
int8_t otPlatRadioGetRssi( otInstance *aInstance )
取得最新的 RSSI 測量結果。
詳細資料 | |||
---|---|---|---|
參數 |
|
||
傳回 |
這個 IBI 的 RSSI 為有效值,RSS1 無效時為 127。
|
otPlatRadioGetState
otRadioState otPlatRadioGetState( otInstance *aInstance )
取得廣播的目前狀態。
OpenThread 不需要此函式。此 API 可能用來偵錯及/或特定應用程式。
詳細資料 | |||
---|---|---|---|
參數 |
|
||
傳回 |
無線電的目前狀態。
|
otPlatRadioGetSupportedChannelMask
uint32_t otPlatRadioGetSupportedChannelMask( otInstance *aInstance )
取得支援裝置的無線電遮罩,
詳細資料 | |||
---|---|---|---|
參數 |
|
||
傳回 |
電台支援的頻道遮罩。
|
otPlatRadioGetTransmitBuffer
otRadioFrame * otPlatRadioGetTransmitBuffer( otInstance *aInstance )
取得無線電傳輸影格緩衝區。
OpenThread 在此緩衝區中形成 IEEE 802.15.4 框架,然後呼叫 otPlatRadioTransmit()
以要求傳輸。
詳細資料 | |||
---|---|---|---|
參數 |
|
||
傳回 |
指向傳輸影格緩衝區的指標。
|
otPlatRadioIsCoexEnabled
bool otPlatRadioIsCoexEnabled( otInstance *aInstance )
檢查是否啟用無線電 coex。
啟用 OPENOPEN_CONFIG_PLATFORM_RADIO_COEX_ENABLE 功能時,系統就會使用這個函式。
詳細資料 | |||
---|---|---|---|
參數 |
|
||
傳回 |
如已啟用無線電 coco,則傳回 TRUE,否則傳回 FALSE。
|
otPlatRadioIsEnabled
bool otPlatRadioIsEnabled( otInstance *aInstance )
檢查電台是否已啟用。
詳細資料 | |||
---|---|---|---|
參數 |
|
||
傳回 |
如已啟用電台,則傳回 TRUE,否則為 FALSE。
|
otPlatRadioReceive
otError otPlatRadioReceive( otInstance *aInstance, uint8_t aChannel )
將電台從「休眠」轉換為「接收」(開啟無線電)。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
||||
回傳值 |
|
OTPPRadioRadioReceiveAt
otError otPlatRadioReceiveAt( otInstance *aInstance, uint8_t aChannel, uint32_t aStart, uint32_t aDuration )
安排 特定 時間 時 的 電台 接收 時間。
詳細資料 | |||||||
---|---|---|---|---|---|---|---|
參數 |
|
||||||
回傳值 |
|
otPlatRadioReceiveDone
void otPlatRadioReceiveDone( otInstance *aInstance, otRadioFrame *aFrame, otError aError )
無線電驅動程式呼叫此方法,以通知 OpenThread 所接收的影格。
詳細資料 | |||||||
---|---|---|---|---|---|---|---|
參數 |
|
otPlatRadioSetChannelMaxTransmitPower
otError otPlatRadioSetChannelMaxTransmitPower( otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower )
設定特定頻道的最大傳輸功率。
詳細資料 | |||||||||
---|---|---|---|---|---|---|---|---|---|
參數 |
|
||||||||
回傳值 |
|
otPlatRadioSetChannelTargetPower
otError otPlatRadioSetChannelTargetPower( otInstance *aInstance, uint8_t aChannel, int16_t aTargetPower )
設定指定頻道的目標功率。
注意:此 API 為可選的廣播平台 API。至於執行該平台,則需由平台層決定。如果實作了這個 API,應停用 otPlatRadioSetTransmitPower()
函式。無線電驅動程式應將實際輸出功率設為小於或等於目標功率,並盡可能接近目標功率。
詳細資料 | |||||||
---|---|---|---|---|---|---|---|
參數 |
|
||||||
回傳值 |
|
otPlatRadioSetCoexEnabled
otError otPlatRadioSetCoexEnabled( otInstance *aInstance, bool aEnabled )
啟用電台。
啟用 OPENOPEN_CONFIG_PLATFORM_RADIO_COEX_ENABLE 功能時,系統就會使用這個函式。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
||||
回傳值 |
|
otPlatRadioSetRegion
otError otPlatRadioSetRegion( otInstance *aInstance, uint16_t aRegionCode )
設定區域代碼。
射波地域格式是 ISO 3166 alpha-2 代碼的 2 字符 cisi 表示。
詳細資料 | |||||||
---|---|---|---|---|---|---|---|
參數 |
|
||||||
回傳值 |
|
otPlatRadioSleep
otError otPlatRadioSleep( otInstance *aInstance )
將收音機從「接收」轉換為「休眠」(關閉收音機)。
詳細資料 | |||||||
---|---|---|---|---|---|---|---|
參數 |
|
||||||
回傳值 |
|
otPlatRadioTransmit
otError otPlatRadioTransmit( otInstance *aInstance, otRadioFrame *aFrame )
開啟電台上的傳輸序列。
在呼叫傳輸之前,呼叫端必須在 otPlatRadioGetTransmitBuffer()
提供的緩衝區中,建立 IEEE 802.15.4 影格。頻道和傳輸功率也包含在 otRadioFrame 結構中。
傳輸順序包含下列項目:
- 從下列任一種狀態將無線電轉換到傳輸:
- 在裝置處於閒置狀態或不支援 OT_RADIO_CAPS_SLEEP_TO_TX 時開啟 RX 時接收通知
- 如果裝置處於閒置狀態且支援 OT_RADIO_CAPS_SLEEP_TO_TX,則 RX 關閉時就會進入休眠模式。
- 在指定的頻道和指定的傳輸功率上傳輸 psdu。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
||||
回傳值 |
|
otPlatRadioTxDone
void otPlatRadioTxDone( otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError )
無線電驅動程式會呼叫這個函式來通知 OpenThread 傳輸作業已完成,同時提供已傳輸的影格和收到的 ack 影格 (如適用)。
當無線電提供 OT_RADIO_CAPS_TRANSMIT_SEC
功能時,無線電平台層將 aFrame
更新為安全影格計數器和無線電維護的金鑰索引值。
詳細資料 | |||||||||
---|---|---|---|---|---|---|---|---|---|
參數 |
|
OTPPRadioRadioTxStarted
void otPlatRadioTxStarted( otInstance *aInstance, otRadioFrame *aFrame )
無線電驅動程式會呼叫這個方法,通知 OpenThread 傳輸開始。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
otPlatRadioUpdateCslSampleTime
void otPlatRadioUpdateCslSampleTime( otInstance *aInstance, uint32_t aCslSampleTime )
更新無線電驅動程式的 CSL 樣本時間。
使用 CSL IE 傳送 ACK 時,系統會將取樣時間儲存在無線電驅動程式的計算中,用來計算階段的階段。
詳細資料 | |||||
---|---|---|---|---|---|
參數 |
|
資源
OpenThread API 參考資料主題來自原始碼,可在 GitHub 取得。如需詳細資訊或為說明文件貢獻一己之力,請參閱資源。