ieee802154: cc13xx_cc26xx: Make filter more reliable
The radio driver updates the filters but never submit the new ones to the radio core. The filters was only applied later thanks, probably during a channel selection that was happening often. Update the driver stop RX operation and restart it using the new filters. Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
This commit is contained in:
committed by
Henrik Brix Andersen
parent
06503ceb02
commit
3d11f60b58
@@ -223,6 +223,7 @@ static int ieee802154_cc13xx_cc26xx_do_set_channel(const struct device *dev,
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
drv_data->rx_handle = cmd_handle;
|
||||
|
||||
ret = 0;
|
||||
|
||||
@@ -260,11 +261,15 @@ ieee802154_cc13xx_cc26xx_filter(const struct device *dev, bool set,
|
||||
const struct ieee802154_filter *filter)
|
||||
{
|
||||
struct ieee802154_cc13xx_cc26xx_data *drv_data = dev->data;
|
||||
RF_CmdHandle cmd_handle;
|
||||
int ret = 0;
|
||||
|
||||
if (!set) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
RF_cancelCmd(drv_data->rf_handle, drv_data->rx_handle, 0);
|
||||
|
||||
if (type == IEEE802154_FILTER_TYPE_IEEE_ADDR) {
|
||||
memcpy((uint8_t *)&drv_data->cmd_ieee_rx.localExtAddr,
|
||||
filter->ieee_addr,
|
||||
@@ -274,10 +279,21 @@ ieee802154_cc13xx_cc26xx_filter(const struct device *dev, bool set,
|
||||
} else if (type == IEEE802154_FILTER_TYPE_PAN_ID) {
|
||||
drv_data->cmd_ieee_rx.localPanID = filter->pan_id;
|
||||
} else {
|
||||
return -ENOTSUP;
|
||||
ret = -ENOTSUP;
|
||||
}
|
||||
|
||||
return 0;
|
||||
/* Run BG receive process with requested filter updated */
|
||||
drv_data->cmd_ieee_rx.status = IDLE;
|
||||
cmd_handle = RF_scheduleCmd(drv_data->rf_handle,
|
||||
(RF_Op *)&drv_data->cmd_ieee_rx, RF_PriorityNormal,
|
||||
cmd_ieee_rx_callback, RF_EventRxEntryDone);
|
||||
if (cmd_handle < 0) {
|
||||
LOG_ERR("Failed to post RX command (%d)", cmd_handle);
|
||||
return -EIO;
|
||||
}
|
||||
drv_data->rx_handle = cmd_handle;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ieee802154_cc13xx_cc26xx_set_txpower(const struct device *dev,
|
||||
|
||||
@@ -93,6 +93,7 @@ struct ieee802154_cc13xx_cc26xx_data {
|
||||
#endif /* CONFIG_SOC_CCxx52x */
|
||||
|
||||
volatile int16_t saved_cmdhandle;
|
||||
volatile RF_CmdHandle rx_handle;
|
||||
};
|
||||
|
||||
#endif /* ZEPHYR_DRIVERS_IEEE802154_IEEE802154_CC13XX_CC26XX_H_ */
|
||||
|
||||
Reference in New Issue
Block a user