Lines Matching +full:half +full:- +full:phase

4  * SPDX-License-Identifier: Apache-2.0
33 #include <openthread-system.h>
40 #include "platform-zephyr.h"
46 #define PKT_IS_IPv6(_p) ((NET_IPV6_HDR(_p)->vtc & 0xf0) == 0x60)
66 #define CHANNEL_COUNT OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX - OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN + 1
133 max_tx_power_table[aChannel - OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN]; in get_transmit_power_for_channel()
247 /* do nothing - ignore event */ in handle_radio_event()
254 * @brief Convert 32-bit (potentially wrapped) OpenThread microsecond timestamps
255 * to 64-bit Zephyr network subsystem nanosecond timestamps.
257 * This is a workaround until OpenThread is able to schedule 64-bit RX/TX time.
262 * @return 64-bit nanosecond timestamp
267 * OpenThread provides target time as a (potentially wrapped) 32-bit in convert_32bit_us_wrapped_to_64bit_ns()
272 * set the absolute (non-wrapped) target time, it's necessary to compare in convert_32bit_us_wrapped_to_64bit_ns()
273 * the least significant 32 bits of the current 64-bit network subsystem in convert_32bit_us_wrapped_to_64bit_ns()
274 * time with the provided 32-bit target time. Let's assume that half of in convert_32bit_us_wrapped_to_64bit_ns()
275 * the 32-bit range can be used for specifying target times in the in convert_32bit_us_wrapped_to_64bit_ns()
276 * future, and the other half - in the past. in convert_32bit_us_wrapped_to_64bit_ns()
280 uint32_t time_diff = target_time_us_wrapped - now_us_wrapped; in convert_32bit_us_wrapped_to_64bit_ns()
285 * Target time is assumed to be in the future. Check if a 32-bit overflow in convert_32bit_us_wrapped_to_64bit_ns()
290 * Add a 32-bit overflow and replace the least significant 32 bits in convert_32bit_us_wrapped_to_64bit_ns()
305 * Target time is assumed to be in the past. Check if a 32-bit overflow in convert_32bit_us_wrapped_to_64bit_ns()
316 * Subtract a 32-bit overflow and replace the least significant in convert_32bit_us_wrapped_to_64bit_ns()
319 result = now_us - UINT32_MAX - 1; in convert_32bit_us_wrapped_to_64bit_ns()
341 sTransmitFrame.mPsdu = tx_payload->data; in dataInit()
360 radio_api = (struct ieee802154_radio_api *)radio_dev->api; in platformRadioInit()
370 if ((radio_api->get_capabilities(radio_dev) & in platformRadioInit()
378 radio_api->configure(radio_dev, IEEE802154_CONFIG_EVENT_HANDLER, &cfg); in platformRadioInit()
384 radio_api->set_channel(radio_dev, ch); in radio_set_channel()
393 enum ieee802154_hw_caps radio_caps = radio_api->get_capabilities(radio_dev); in transmit_message()
396 * The payload is already in tx_payload->data, in transmit_message()
402 tx_payload->len = sTransmitFrame.mLength - FCS_SIZE; in transmit_message()
404 radio_api->set_txpower(radio_dev, get_transmit_power_for_channel(sTransmitFrame.mChannel)); in transmit_message()
407 if (sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset != 0) { in transmit_message()
409 sTransmitFrame.mPsdu + sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset; in transmit_message()
411 otPlatTimeGet() + sTransmitFrame.mInfo.mTxInfo.mIeInfo->mNetworkTimeOffset; in transmit_message()
413 *(time_ie++) = sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeSyncSeq; in transmit_message()
439 radio_api->tx(radio_dev, IEEE802154_TX_MODE_TXTIME_CCA, tx_pkt, tx_payload); in transmit_message()
443 tx_err = radio_api->tx(radio_dev, IEEE802154_TX_MODE_CSMA_CA, tx_pkt, in transmit_message()
446 tx_err = radio_api->cca(radio_dev); in transmit_message()
448 tx_err = radio_api->tx(radio_dev, IEEE802154_TX_MODE_DIRECT, tx_pkt, in transmit_message()
454 tx_err = radio_api->tx(radio_dev, IEEE802154_TX_MODE_DIRECT, tx_pkt, tx_payload); in transmit_message()
459 * - OT_ERROR_NONE in transmit_message()
460 * - OT_ERROR_NO_ACK in transmit_message()
461 * - OT_ERROR_CHANNEL_ACCESS_FAILURE in transmit_message()
462 * - OT_ERROR_ABORT in transmit_message()
469 case -ENOMSG: in transmit_message()
472 case -EBUSY: in transmit_message()
475 case -EIO: in transmit_message()
507 recv_frame.mPsdu = net_buf_frag_last(pkt->buffer)->data; in openthread_handle_received_frame()
509 recv_frame.mLength = net_buf_frags_len(pkt->buffer); in openthread_handle_received_frame()
585 for (buf = pkt->buffer; buf; buf = buf->frags) { in openthread_handle_frame_to_send()
586 if (otMessageAppend(message, buf->data, buf->len) != OT_ERROR_NONE) { in openthread_handle_frame_to_send()
632 return -EBUSY; in run_tx_task()
680 radio_api->get_capabilities(radio_dev) & IEEE802154_HW_SLEEP_TO_TX) { in platformRadioProcess()
694 radio_api->set_channel(radio_dev, in platformRadioProcess()
697 if (!radio_api->ed_scan(radio_dev, in platformRadioProcess()
729 radio_api->filter(radio_dev, true, IEEE802154_FILTER_TYPE_PAN_ID, in otPlatRadioSetPanId()
738 radio_api->filter(radio_dev, true, IEEE802154_FILTER_TYPE_IEEE_ADDR, in otPlatRadioSetExtendedAddress()
746 radio_api->filter(radio_dev, true, IEEE802154_FILTER_TYPE_SHORT_ADDR, in otPlatRadioSetShortAddress()
785 radio_api->stop(radio_dev); in otPlatRadioSleep()
798 radio_api->set_channel(radio_dev, aChannel); in otPlatRadioReceive()
799 radio_api->set_txpower(radio_dev, get_transmit_power_for_channel(channel)); in otPlatRadioReceive()
800 radio_api->start(radio_dev); in otPlatRadioReceive()
820 result = radio_api->configure(radio_dev, IEEE802154_CONFIG_RX_SLOT, in otPlatRadioReceiveAt()
830 if (radio_api->continuous_carrier == NULL) { in platformRadioTransmitCarrier()
835 radio_api->set_txpower(radio_dev, get_transmit_power_for_channel(channel)); in platformRadioTransmitCarrier()
837 if (radio_api->continuous_carrier(radio_dev) != 0) { in platformRadioTransmitCarrier()
854 if (radio_api->modulated_carrier == NULL) { in platformRadioTransmitModulatedCarrier()
863 radio_api->set_txpower(radio_dev, get_transmit_power_for_channel(channel)); in platformRadioTransmitModulatedCarrier()
865 if (radio_api->modulated_carrier(radio_dev, aData) != 0) { in platformRadioTransmitModulatedCarrier()
898 radio_caps = radio_api->get_capabilities(radio_dev); in otPlatRadioTransmit()
931 radio_caps = radio_api->get_capabilities(radio_dev); in otPlatRadioGetRssi()
942 * using no-blocking ed_scan in otPlatRadioGetRssi()
944 error = radio_api->ed_scan(radio_dev, detection_time, in otPlatRadioGetRssi()
966 radio_caps = radio_api->get_capabilities(radio_dev); in otPlatRadioGetCaps()
1017 radio_api->configure(radio_dev, IEEE802154_CONFIG_RX_ON_WHEN_IDLE, &config); in otPlatRadioSetRxOnWhenIdle()
1041 * promiscuous mode, see net_if_l2(iface)->get_flags() and in otPlatRadioSetPromiscuous()
1044 radio_api->configure(radio_dev, IEEE802154_CONFIG_PROMISCUOUS, &config); in otPlatRadioSetPromiscuous()
1053 if (radio_api->ed_scan == NULL) { in otPlatRadioEnergyScan()
1060 radio_api->set_channel(radio_dev, aScanChannel); in otPlatRadioEnergyScan()
1062 if (radio_api->ed_scan(radio_dev, energy_detection_time, energy_detected) != 0) { in otPlatRadioEnergyScan()
1103 (void)radio_api->configure(radio_dev, IEEE802154_CONFIG_AUTO_ACK_FPB, in otPlatRadioEnableSrcMatch()
1121 if (radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB, in otPlatRadioAddSrcMatchShortEntry()
1136 .ack_fpb.addr = (uint8_t *)aExtAddress->m8, in otPlatRadioAddSrcMatchExtEntry()
1140 if (radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB, in otPlatRadioAddSrcMatchExtEntry()
1162 if (radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB, in otPlatRadioClearSrcMatchShortEntry()
1177 .ack_fpb.addr = (uint8_t *)aExtAddress->m8, in otPlatRadioClearSrcMatchExtEntry()
1181 if (radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB, in otPlatRadioClearSrcMatchExtEntry()
1199 (void)radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB, in otPlatRadioClearSrcMatchShortEntries()
1213 (void)radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB, in otPlatRadioClearSrcMatchExtEntries()
1248 if (radio_api == NULL || radio_api->get_time == NULL) { in otPlatTimeGet()
1251 return radio_api->get_time(radio_dev) / NSEC_PER_USEC; in otPlatTimeGet()
1277 error = otPlatCryptoExportKey(aPrevKey->mKeyMaterial.mKeyRef, in otPlatRadioSetMacKey()
1278 (uint8_t *)aPrevKey->mKeyMaterial.mKey.m8, OT_MAC_KEY_SIZE, in otPlatRadioSetMacKey()
1281 error = otPlatCryptoExportKey(aCurrKey->mKeyMaterial.mKeyRef, in otPlatRadioSetMacKey()
1282 (uint8_t *)aCurrKey->mKeyMaterial.mKey.m8, OT_MAC_KEY_SIZE, in otPlatRadioSetMacKey()
1285 error = otPlatCryptoExportKey(aNextKey->mKeyMaterial.mKeyRef, in otPlatRadioSetMacKey()
1286 (uint8_t *)aNextKey->mKeyMaterial.mKey.m8, OT_MAC_KEY_SIZE, in otPlatRadioSetMacKey()
1321 uint8_t prev_key_id = aKeyId == 1 ? 0x80 : aKeyId - 1; in otPlatRadioSetMacKey()
1325 keys[0].key_value = (uint8_t *)aPrevKey->mKeyMaterial.mKey.m8; in otPlatRadioSetMacKey()
1328 keys[1].key_value = (uint8_t *)aCurrKey->mKeyMaterial.mKey.m8; in otPlatRadioSetMacKey()
1331 keys[2].key_value = (uint8_t *)aNextKey->mKeyMaterial.mKey.m8; in otPlatRadioSetMacKey()
1341 (void)radio_api->configure(radio_dev, IEEE802154_CONFIG_MAC_KEYS, in otPlatRadioSetMacKey()
1352 (void)radio_api->configure(radio_dev, IEEE802154_CONFIG_FRAME_COUNTER, in otPlatRadioSetMacFrameCounter()
1361 (void)radio_api->configure(radio_dev, IEEE802154_CONFIG_FRAME_COUNTER_IF_LARGER, in otPlatRadioSetMacFrameCounterIfLarger()
1371 /* CSL phase will be injected on-the-fly by the driver. */ in otPlatRadioEnableCsl()
1373 IEEE802154_DEFINE_HEADER_IE_CSL_REDUCED(/* phase */ 0, aCslPeriod); in otPlatRadioEnableCsl()
1382 result = radio_api->configure(radio_dev, IEEE802154_CONFIG_CSL_PERIOD, &config); in otPlatRadioEnableCsl()
1390 config.ack_ie.ext_addr = aExtAddr != NULL ? aExtAddr->m8 : NULL; in otPlatRadioEnableCsl()
1393 result = radio_api->configure(radio_dev, IEEE802154_CONFIG_ENH_ACK_HEADER_IE, &config); in otPlatRadioEnableCsl()
1403 result = radio_api->configure(radio_dev, IEEE802154_CONFIG_CSL_PERIOD, &config); in otPlatRadioResetCsl()
1409 result = radio_api->configure(radio_dev, IEEE802154_CONFIG_ENH_ACK_HEADER_IE, &config); in otPlatRadioResetCsl()
1423 convert_32bit_us_wrapped_to_64bit_ns(aCslSampleTime - PHR_DURATION_US), in otPlatRadioUpdateCslSampleTime()
1426 (void)radio_api->configure(radio_dev, IEEE802154_CONFIG_EXPECTED_RX_TIME, &config); in otPlatRadioUpdateCslSampleTime()
1445 result = radio_api->configure(radio_dev, IEEE802154_OPENTHREAD_CONFIG_CST_PERIOD, &config); in otPlatRadioEnableCst()
1456 /* Leave CST Phase empty intentionally */ in otPlatRadioEnableCst()
1463 config.ack_ie.ext_addr = aExtAddr != NULL ? aExtAddr->m8 : NULL; in otPlatRadioEnableCst()
1466 result = radio_api->configure(radio_dev, IEEE802154_CONFIG_ENH_ACK_HEADER_IE, &config); in otPlatRadioEnableCst()
1479 aCstSampleTime - PHR_DURATION_US), in otPlatRadioUpdateCstSampleTime()
1482 result = radio_api->configure(radio_dev, IEEE802154_OPENTHREAD_CONFIG_EXPECTED_TX_TIME, in otPlatRadioUpdateCstSampleTime()
1493 return radio_api->get_sch_acc(radio_dev); in otPlatRadioGetCslAccuracy()
1507 * Header IE format - IEEE Std. 802.15.4-2015, 7.4.2.1 && 7.4.2.2
1509 * +---------------------------------+----------------------+
1511 * +-----------+------------+--------+----------------------+
1512 * | Bytes: 0-1 | 2-4 |
1513 * +-----------+---------------------+----------------------+
1514 * | Bits: 0-6 | 7-14 | 15 | IE_VENDOR_THREAD_OUI |
1515 * +-----------+------------+--------+----------------------|
1518 * +---------------------------------+-------------------+------------------+
1520 * +---------------------------------+-------------------+------------------+
1522 * +---------------------------------+-------------------+------------------+
1524 * |---------------------------------|-------------------|------------------|
1528 /* Vendor-specific IE identifier */ in set_vendor_ie_header_lm()
1530 /* Thread Vendor-specific ACK Probing IE subtype ID */ in set_vendor_ie_header_lm()
1532 /* Thread Vendor-specific IE OUI */ in set_vendor_ie_header_lm()
1534 /* Thread Vendor-specific ACK Probing IE RSSI value placeholder */ in set_vendor_ie_header_lm()
1536 /* Thread Vendor-specific ACK Probing IE Link margin value placeholder */ in set_vendor_ie_header_lm()
1538 /* Thread Vendor-specific ACK Probing IE LQI value placeholder */ in set_vendor_ie_header_lm()
1565 /* Set Length - number of octets in content field. */ in set_vendor_ie_header_lm()
1601 .ack_ie.ext_addr = aExtAddress->m8, in otPlatRadioConfigureEnhAckProbing()
1611 result = radio_api->configure(radio_dev, IEEE802154_CONFIG_ENH_ACK_HEADER_IE, &config); in otPlatRadioConfigureEnhAckProbing()
1628 max_tx_power_table[aChannel - OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN] = aMaxPower; in otPlatRadioSetChannelMaxTransmitPower()
1631 radio_api->set_txpower(radio_dev, get_transmit_power_for_channel(aChannel)); in otPlatRadioSetChannelMaxTransmitPower()