@@ -36,6 +36,8 @@ static void ieee802154_cc13xx_cc26xx_subg_data_init(
3636 struct ieee802154_cc13xx_cc26xx_subg_data * drv_data );
3737static int ieee802154_cc13xx_cc26xx_subg_stop (
3838 const struct device * dev );
39+ static int ieee802154_cc13xx_cc26xx_subg_stop_if (
40+ const struct device * dev );
3941static int ieee802154_cc13xx_cc26xx_subg_rx (
4042 const struct device * dev );
4143static void ieee802154_cc13xx_cc26xx_subg_setup_rx_buffers (
@@ -66,6 +68,12 @@ static uint32_t overrides_sub_ghz[] = {
6668 (uint32_t )0xFFFFFFFF
6769};
6870
71+ /** RF patches to use (note: RF core keeps a pointer to this, so no stack). */
72+ static RF_Mode rf_mode = {
73+ .rfMode = RF_MODE_MULTIPLE ,
74+ .cpePatchFxn = & rf_patch_cpe_multi_protocol ,
75+ };
76+
6977/* Sub GHz power table */
7078static const RF_TxPowerTable_Entry txPowerTable_sub_ghz [] = {
7179 { -20 , RF_TxPowerTable_DEFAULT_PA_ENTRY (0 , 3 , 0 , 2 ) },
@@ -493,10 +501,14 @@ static void ieee802154_cc13xx_cc26xx_subg_rx_done(
493501
494502static int ieee802154_cc13xx_cc26xx_subg_start (const struct device * dev )
495503{
496- ARG_UNUSED (dev );
504+ /* Start RX */
505+ (void )ieee802154_cc13xx_cc26xx_subg_rx (dev );
497506 return 0 ;
498507}
499508
509+ /**
510+ * Flushes / stops all radio commands in RF queue.
511+ */
500512static int ieee802154_cc13xx_cc26xx_subg_stop (const struct device * dev )
501513{
502514 struct ieee802154_cc13xx_cc26xx_subg_data * drv_data =
@@ -515,6 +527,26 @@ static int ieee802154_cc13xx_cc26xx_subg_stop(const struct device *dev)
515527 return 0 ;
516528}
517529
530+ /**
531+ * Stops the sub-GHz interface and yields the radio (tells RF module to power
532+ * down).
533+ */
534+ static int ieee802154_cc13xx_cc26xx_subg_stop_if (const struct device * dev )
535+ {
536+ struct ieee802154_cc13xx_cc26xx_subg_data * drv_data =
537+ get_dev_data (dev );
538+ int ret ;
539+
540+ ret = ieee802154_cc13xx_cc26xx_subg_stop (dev );
541+ if (ret < 0 ) {
542+ return ret ;
543+ }
544+
545+ /* power down radio */
546+ RF_yield (drv_data -> rf_handle );
547+ return 0 ;
548+ }
549+
518550static int
519551ieee802154_cc13xx_cc26xx_subg_configure (const struct device * dev ,
520552 enum ieee802154_config_type type ,
@@ -602,7 +634,7 @@ static struct ieee802154_radio_api
602634 .set_txpower = ieee802154_cc13xx_cc26xx_subg_set_txpower ,
603635 .tx = ieee802154_cc13xx_cc26xx_subg_tx ,
604636 .start = ieee802154_cc13xx_cc26xx_subg_start ,
605- .stop = ieee802154_cc13xx_cc26xx_subg_stop ,
637+ .stop = ieee802154_cc13xx_cc26xx_subg_stop_if ,
606638 .configure = ieee802154_cc13xx_cc26xx_subg_configure ,
607639 .get_subg_channel_count =
608640 ieee802154_cc13xx_cc26xx_subg_get_subg_channel_count ,
@@ -612,10 +644,6 @@ static int ieee802154_cc13xx_cc26xx_subg_init(const struct device *dev)
612644{
613645 RF_Params rf_params ;
614646 RF_EventMask reason ;
615- RF_Mode rf_mode = {
616- .rfMode = RF_MODE_MULTIPLE ,
617- .cpePatchFxn = & rf_patch_cpe_multi_protocol ,
618- };
619647 struct ieee802154_cc13xx_cc26xx_subg_data * drv_data =
620648 get_dev_data (dev );
621649
0 commit comments