Lines Matching +full:sub +full:- +full:bands

4  * SPDX-License-Identifier: Apache-2.0
45 /* User-defined CMD_PROP_RADIO_DIV_SETUP structures */
54 /* Radio register overrides for CC13x2R (note: CC26x2 does not support sub-GHz radio)
55 * from SmartRF Studio (200kbps, 50kHz deviation, 2-GFSK, 311.8kHz Rx BW),
73 /* Rx: Set RSSI offset to adjust reported RSSI by -1 dB (default: -2),
77 /* Rx: Set anti-aliasing filter bandwidth to 0x8 (in ADI0, set IFAMPCTL3[7:4]=0x8) */
86 /* CC1352P overrides from SmartRF Studio (200kbps, 50kHz deviation, 2-GFSK, 311.8kHz Rx BW) */
92 /* Rx: Set RSSI offset to adjust reported RSSI by -1 dB (default: -2),
96 /* Rx: Set anti-aliasing filter bandwidth to 0x6 (in ADI0, set IFAMPCTL3[7:4]=0x8) */
112 /* The ANADIV radio parameter based on the LO divider (0) and front-end (0) settings */
125 /* The ANADIV radio parameter based on the LO divider (0) and front-end (0) settings */
150 .modType = 1, /* 2-GFSK - non-standard modulation */
151 .deviation = 200, /* +/- 200*250 = 50kHz deviation (modulation index 0.5) */
157 .rxBw = 0x59, /* 310.8 kHz RX bandwidth, see TRM, section 25.10.5.2, table 25-183 */
160 .nSwBits = 24, /* 24-bit (1 byte preamble + 16 bit SFD) */
181 /* Sub GHz power tables */
187 { -20, RF_TxPowerTable_DEFAULT_PA_ENTRY(0, 3, 0, 2) },
188 { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY(1, 3, 0, 3) },
189 { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(2, 3, 0, 5) },
190 { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(4, 3, 0, 5) },
211 /* Sub GHz power table */
213 { -20, RF_TxPowerTable_DEFAULT_PA_ENTRY(0, 3, 0, 2) },
214 { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY(1, 3, 0, 3) },
215 { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(2, 3, 0, 5) },
216 { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(4, 3, 0, 5) },
257 /* See IEEE 802.15.4-2020, section 10.1.3.3. */ in drv_channel_frequency()
266 *frequency = 906 + 2 * (channel - 1); in drv_channel_frequency()
271 return channel <= 26 ? -ENOTSUP : -EINVAL; in drv_channel_frequency()
281 * Assuming operating mode #3, the parameters for some frequently used bands in drv_channel_frequency()
293 * https://github.com/zephyrproject-rtos/zephyr/issues/50336#issuecomment-1251122582. in drv_channel_frequency()
305 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in drv_power_down()
307 (void)RF_yield(drv_data->rf_handle); in drv_power_down()
316 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in cmd_prop_tx_adv_callback()
321 op->commandNo, op->status, drv_data->cmd_prop_tx_adv.status, e); in cmd_prop_tx_adv_callback()
337 if (drv_data->rx_entry[i].status == DATA_ENTRY_FINISHED) { in drv_rx_done()
338 len = drv_data->rx_data[i][0]; in drv_rx_done()
339 sdu = drv_data->rx_data[i] + 1; in drv_rx_done()
340 status = drv_data->rx_data[i][len--]; in drv_rx_done()
341 rssi = drv_data->rx_data[i][len--]; in drv_rx_done()
344 /* append CRC-16/CCITT */ in drv_rx_done()
356 drv_data->iface, len, AF_UNSPEC, 0, K_NO_WAIT); in drv_rx_done()
368 drv_data->rx_entry[i].status = DATA_ENTRY_PENDING; in drv_rx_done()
377 if (ieee802154_handle_ack(drv_data->iface, pkt) == NET_OK) { in drv_rx_done()
382 if (net_recv_data(drv_data->iface, pkt)) { in drv_rx_done()
387 } else if (drv_data->rx_entry[i].status == in drv_rx_done()
390 drv_data->rx_entry[i].status = DATA_ENTRY_PENDING; in drv_rx_done()
399 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in cmd_prop_rx_adv_callback()
403 op->commandNo, op->status, e); in cmd_prop_rx_adv_callback()
409 if (e & RF_EventRxEntryDone || op->status == PROP_ERROR_RXBUF) { in cmd_prop_rx_adv_callback()
413 if (op->status == PROP_ERROR_RXBUF in cmd_prop_rx_adv_callback()
414 || op->status == PROP_ERROR_RXFULL in cmd_prop_rx_adv_callback()
415 || op->status == PROP_ERROR_RXOVF) { in cmd_prop_rx_adv_callback()
416 LOG_DBG("RX Error %x", op->status); in cmd_prop_rx_adv_callback()
419 if (k_sem_take(&drv_data->lock, LOCK_TIMEOUT)) { in cmd_prop_rx_adv_callback()
424 k_sem_give(&drv_data->lock); in cmd_prop_rx_adv_callback()
452 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in ieee802154_cc13xx_cc26xx_subg_cca()
457 if (k_sem_take(&drv_data->lock, LOCK_TIMEOUT)) { in ieee802154_cc13xx_cc26xx_subg_cca()
458 return -EWOULDBLOCK; in ieee802154_cc13xx_cc26xx_subg_cca()
461 if (!drv_data->is_up) { in ieee802154_cc13xx_cc26xx_subg_cca()
462 ret = -ENETDOWN; in ieee802154_cc13xx_cc26xx_subg_cca()
466 drv_data->cmd_prop_cs.status = IDLE; in ieee802154_cc13xx_cc26xx_subg_cca()
468 was_rx_on = drv_data->cmd_prop_rx_adv.status == ACTIVE; in ieee802154_cc13xx_cc26xx_subg_cca()
472 ret = -EIO; in ieee802154_cc13xx_cc26xx_subg_cca()
477 events = RF_runCmd(drv_data->rf_handle, (RF_Op *)&drv_data->cmd_prop_cs, RF_PriorityNormal, in ieee802154_cc13xx_cc26xx_subg_cca()
481 ret = -EIO; in ieee802154_cc13xx_cc26xx_subg_cca()
485 switch (drv_data->cmd_prop_cs.status) { in ieee802154_cc13xx_cc26xx_subg_cca()
487 /* Do not re-enable RX when the channel is idle as in ieee802154_cc13xx_cc26xx_subg_cca()
495 ret = -EBUSY; in ieee802154_cc13xx_cc26xx_subg_cca()
498 ret = -EIO; in ieee802154_cc13xx_cc26xx_subg_cca()
502 /* Re-enable RX if we found it on initially in ieee802154_cc13xx_cc26xx_subg_cca()
512 k_sem_give(&drv_data->lock); in ieee802154_cc13xx_cc26xx_subg_cca()
519 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in drv_start_rx()
522 if (drv_data->cmd_prop_rx_adv.status == ACTIVE) { in drv_start_rx()
523 return -EALREADY; in drv_start_rx()
530 __ASSERT_NO_MSG(drv_data->rx_entry[i].pNextEntry != NULL); in drv_start_rx()
531 __ASSERT_NO_MSG(drv_data->rx_entry[i].status == DATA_ENTRY_PENDING); in drv_start_rx()
536 drv_data->cmd_prop_rx_adv.status = IDLE; in drv_start_rx()
537 cmd_handle = RF_postCmd(drv_data->rf_handle, in drv_start_rx()
538 (RF_Op *)&drv_data->cmd_prop_rx_adv, RF_PriorityNormal, in drv_start_rx()
542 return -EIO; in drv_start_rx()
545 drv_data->rx_cmd_handle = cmd_handle; in drv_start_rx()
553 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in drv_stop_rx()
556 if (drv_data->cmd_prop_rx_adv.status != ACTIVE) { in drv_stop_rx()
557 return -EALREADY; in drv_stop_rx()
561 status = RF_cancelCmd(drv_data->rf_handle, drv_data->rx_cmd_handle, RF_ABORT_GRACEFULLY); in drv_stop_rx()
567 return -EIO; in drv_stop_rx()
574 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in ieee802154_cc13xx_cc26xx_subg_set_channel()
585 if (k_sem_take(&drv_data->lock, LOCK_TIMEOUT)) { in ieee802154_cc13xx_cc26xx_subg_set_channel()
586 return -EWOULDBLOCK; in ieee802154_cc13xx_cc26xx_subg_set_channel()
589 was_rx_on = drv_data->cmd_prop_rx_adv.status == ACTIVE; in ieee802154_cc13xx_cc26xx_subg_set_channel()
593 ret = -EIO; in ieee802154_cc13xx_cc26xx_subg_set_channel()
599 drv_data->cmd_fs.status = IDLE; in ieee802154_cc13xx_cc26xx_subg_set_channel()
600 drv_data->cmd_fs.frequency = freq; in ieee802154_cc13xx_cc26xx_subg_set_channel()
601 drv_data->cmd_fs.fractFreq = fract; in ieee802154_cc13xx_cc26xx_subg_set_channel()
602 events = RF_runCmd(drv_data->rf_handle, (RF_Op *)&drv_data->cmd_fs, in ieee802154_cc13xx_cc26xx_subg_set_channel()
604 if (events != RF_EventLastCmdDone || drv_data->cmd_fs.status != DONE_OK) { in ieee802154_cc13xx_cc26xx_subg_set_channel()
606 ret = -EIO; in ieee802154_cc13xx_cc26xx_subg_set_channel()
611 /* Re-enable RX if we found it on initially. */ in ieee802154_cc13xx_cc26xx_subg_set_channel()
613 } else if (!drv_data->is_up) { in ieee802154_cc13xx_cc26xx_subg_set_channel()
617 k_sem_give(&drv_data->lock); in ieee802154_cc13xx_cc26xx_subg_set_channel()
631 return -ENOTSUP; in ieee802154_cc13xx_cc26xx_subg_filter()
637 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in ieee802154_cc13xx_cc26xx_subg_set_txpower()
646 return -EINVAL; in ieee802154_cc13xx_cc26xx_subg_set_txpower()
650 status = RF_setTxPower(drv_data->rf_handle, power_table_value); in ieee802154_cc13xx_cc26xx_subg_set_txpower()
653 return -EIO; in ieee802154_cc13xx_cc26xx_subg_set_txpower()
656 if (k_sem_take(&drv_data->lock, LOCK_TIMEOUT)) { in ieee802154_cc13xx_cc26xx_subg_set_txpower()
657 return -EWOULDBLOCK; in ieee802154_cc13xx_cc26xx_subg_set_txpower()
660 if (!drv_data->is_up) { in ieee802154_cc13xx_cc26xx_subg_set_txpower()
664 k_sem_give(&drv_data->lock); in ieee802154_cc13xx_cc26xx_subg_set_txpower()
675 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in ieee802154_cc13xx_cc26xx_subg_tx()
679 if (buf->len > (CC13XX_CC26XX_TX_BUF_SIZE - IEEE802154_PHY_SUN_FSK_PHR_LEN)) { in ieee802154_cc13xx_cc26xx_subg_tx()
680 return -EINVAL; in ieee802154_cc13xx_cc26xx_subg_tx()
685 NET_ERR("TX mode %d not supported - sending directly instead.", mode); in ieee802154_cc13xx_cc26xx_subg_tx()
688 if (k_sem_take(&drv_data->lock, K_FOREVER)) { in ieee802154_cc13xx_cc26xx_subg_tx()
689 return -EIO; in ieee802154_cc13xx_cc26xx_subg_tx()
692 if (!drv_data->is_up) { in ieee802154_cc13xx_cc26xx_subg_tx()
693 ret = -ENETDOWN; in ieee802154_cc13xx_cc26xx_subg_tx()
697 if (drv_data->cmd_prop_rx_adv.status == ACTIVE) { in ieee802154_cc13xx_cc26xx_subg_tx()
700 ret = -EIO; in ieee802154_cc13xx_cc26xx_subg_tx()
706 drv_data->tx_data[0] = buf->len + IEEE802154_FCS_LENGTH; in ieee802154_cc13xx_cc26xx_subg_tx()
710 * TODO: Zero-copy TX, see discussion in #49775. in ieee802154_cc13xx_cc26xx_subg_tx()
712 memcpy(&drv_data->tx_data[IEEE802154_PHY_SUN_FSK_PHR_LEN], buf->data, buf->len); in ieee802154_cc13xx_cc26xx_subg_tx()
713 drv_data->cmd_prop_tx_adv.pktLen = buf->len + IEEE802154_PHY_SUN_FSK_PHR_LEN; in ieee802154_cc13xx_cc26xx_subg_tx()
715 drv_data->cmd_prop_tx_adv.status = IDLE; in ieee802154_cc13xx_cc26xx_subg_tx()
716 events = RF_runCmd(drv_data->rf_handle, (RF_Op *)&drv_data->cmd_prop_tx_adv, in ieee802154_cc13xx_cc26xx_subg_tx()
720 ret = -EIO; in ieee802154_cc13xx_cc26xx_subg_tx()
724 if (drv_data->cmd_prop_tx_adv.status != PROP_DONE_OK) { in ieee802154_cc13xx_cc26xx_subg_tx()
725 LOG_DBG("Transmit failed (0x%x)", drv_data->cmd_prop_tx_adv.status); in ieee802154_cc13xx_cc26xx_subg_tx()
726 ret = -EIO; in ieee802154_cc13xx_cc26xx_subg_tx()
732 k_sem_give(&drv_data->lock); in ieee802154_cc13xx_cc26xx_subg_tx()
736 /* driver-allocated attribute memory - constant across all driver instances */
746 * ensure SUN-FSK timing, see the TODO in in ieee802154_cc13xx_cc26xx_subg_attr_get()
756 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in ieee802154_cc13xx_cc26xx_subg_start()
759 if (k_sem_take(&drv_data->lock, LOCK_TIMEOUT)) { in ieee802154_cc13xx_cc26xx_subg_start()
760 return -EIO; in ieee802154_cc13xx_cc26xx_subg_start()
763 if (drv_data->is_up) { in ieee802154_cc13xx_cc26xx_subg_start()
764 ret = -EALREADY; in ieee802154_cc13xx_cc26xx_subg_start()
773 drv_data->is_up = true; in ieee802154_cc13xx_cc26xx_subg_start()
776 k_sem_give(&drv_data->lock); in ieee802154_cc13xx_cc26xx_subg_start()
783 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in drv_abort_commands()
786 status = RF_flushCmd(drv_data->rf_handle, RF_CMDHANDLE_FLUSH_ALL, 0); in drv_abort_commands()
792 return -EIO; in drv_abort_commands()
799 * Stops the sub-GHz interface and yields the radio (tells RF module to power
804 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in ieee802154_cc13xx_cc26xx_subg_stop_if()
807 if (k_sem_take(&drv_data->lock, LOCK_TIMEOUT)) { in ieee802154_cc13xx_cc26xx_subg_stop_if()
808 return -EIO; in ieee802154_cc13xx_cc26xx_subg_stop_if()
811 if (!drv_data->is_up) { in ieee802154_cc13xx_cc26xx_subg_stop_if()
812 ret = -EALREADY; in ieee802154_cc13xx_cc26xx_subg_stop_if()
826 drv_data->is_up = false; in ieee802154_cc13xx_cc26xx_subg_stop_if()
829 k_sem_give(&drv_data->lock); in ieee802154_cc13xx_cc26xx_subg_stop_if()
838 return -ENOTSUP; in ieee802154_cc13xx_cc26xx_subg_configure()
848 if (i < CC13XX_CC26XX_NUM_RX_BUF - 1) { in drv_setup_rx_buffers()
849 drv_data->rx_entry[i].pNextEntry = in drv_setup_rx_buffers()
850 (uint8_t *) &drv_data->rx_entry[i + 1]; in drv_setup_rx_buffers()
852 drv_data->rx_entry[i].pNextEntry = in drv_setup_rx_buffers()
853 (uint8_t *) &drv_data->rx_entry[0]; in drv_setup_rx_buffers()
856 drv_data->rx_entry[i].config.type = DATA_ENTRY_TYPE_PTR; in drv_setup_rx_buffers()
857 drv_data->rx_entry[i].config.lenSz = 1; in drv_setup_rx_buffers()
858 drv_data->rx_entry[i].length = sizeof(drv_data->rx_data[0]); in drv_setup_rx_buffers()
859 drv_data->rx_entry[i].pData = drv_data->rx_data[i]; in drv_setup_rx_buffers()
862 drv_data->rx_queue.pCurrEntry = (uint8_t *)&drv_data->rx_entry[0]; in drv_setup_rx_buffers()
863 drv_data->rx_queue.pLastEntry = NULL; in drv_setup_rx_buffers()
873 drv_data->tx_data[1] = BIT(3) | /* FCS Type: 2-octet FCS */ in drv_setup_tx_buffer()
876 drv_data->cmd_prop_tx_adv.pPkt = drv_data->tx_data; in drv_setup_tx_buffer()
883 /* TODO: Do multi-protocol devices need more than one IEEE MAC? */ in drv_data_init()
891 sys_memcpy_swap(&drv_data->mac, mac, sizeof(drv_data->mac)); in drv_data_init()
896 /* Setup TX buffer (TRM 25.10.2.1.1, table 25-171) */ in drv_data_init()
899 k_sem_init(&drv_data->lock, 1, 1); in drv_data_init()
905 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in ieee802154_cc13xx_cc26xx_subg_iface_init()
907 net_if_set_link_addr(iface, drv_data->mac, sizeof(drv_data->mac), in ieee802154_cc13xx_cc26xx_subg_iface_init()
910 drv_data->iface = iface; in ieee802154_cc13xx_cc26xx_subg_iface_init()
933 struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data; in ieee802154_cc13xx_cc26xx_subg_init()
938 /* No need for locking - initialization is exclusive. */ in ieee802154_cc13xx_cc26xx_subg_init()
948 drv_data->rf_handle = RF_open(&drv_data->rf_object, in ieee802154_cc13xx_cc26xx_subg_init()
951 if (drv_data->rf_handle == NULL) { in ieee802154_cc13xx_cc26xx_subg_init()
953 return -EIO; in ieee802154_cc13xx_cc26xx_subg_init()
960 drv_data->cmd_fs.status = IDLE; in ieee802154_cc13xx_cc26xx_subg_init()
961 drv_data->cmd_fs.frequency = freq; in ieee802154_cc13xx_cc26xx_subg_init()
962 drv_data->cmd_fs.fractFreq = fract; in ieee802154_cc13xx_cc26xx_subg_init()
963 events = RF_runCmd(drv_data->rf_handle, (RF_Op *)&drv_data->cmd_fs, in ieee802154_cc13xx_cc26xx_subg_init()
965 if (events != RF_EventLastCmdDone || drv_data->cmd_fs.status != DONE_OK) { in ieee802154_cc13xx_cc26xx_subg_init()
967 return -EIO; in ieee802154_cc13xx_cc26xx_subg_init()
995 /* Last preamble byte and SFD for uncoded 2-FSK SUN PHY, phySunFskSfd = 0,
996 * see IEEE 802.15.4, section 19.2.3.2, table 19-2.
1005 .lenOffset = -4,
1028 /* see IEEE 802.15.4, section 11.3, table 11-1 and section 10.2.8 */
1045 TRIG_REL_START, /* workaround for CC13_RF_ROM_FW_CPE--BUG00016 */
1047 /* Last preamble byte and SFD for uncoded 2-FSK SUN PHY, phySunFskSfd = 0,
1048 * see IEEE 802.15.4, section 19.2.3.2, table 19-2.