Commit a12a6ab5 authored by Florian Grandel's avatar Florian Grandel Committed by Chris Friedt
Browse files

drivers: ieee802154: introduce channel pages

Replaces the previous approach to define bands via hardware capabilities
by the standard conforming concept of channel pages.

In the short term this allows us to correctly calculate the PHY specific
symbol rate and several parameters that directly depend from the symbol
rate and were previously not being correctly calculated for some of the
drivers whose channel pages could not be represented previously:
* We now support sub-nanosecond precision symbol rates for UWB. Rounding
  errors are being minimized by switching from a divide-then-multiply
  approach to a multiply-then-divide approach.
* UWB HRP: symbol rate depends on channel page specific preamble symbol
  rate which again requires the pulse repetition value to be known
* Several MAC timings are being corrected based on the now correctly
  calculated symbol rates, namely aTurnaroundTime, aUnitBackoffPeriod,
  aBaseSuperframeDuration.

In the long term, this change unlocks such highly promising functional
areas as UWB ranging and SUN-PHY channel hopping in the SubG area (plus
of course any other PHY specific feature).

Signed-off-by: default avatarFlorian Grandel <fgrandel@code-for-humans.de>
parent 7c00b817
Loading
Loading
Loading
Loading
+17 −0
Changes for doc/releases/release-notes-3.5.rst: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -200,6 +200,23 @@ Drivers and Sensors

* IEEE 802.15.4

  * A new mandatory method attr_get() was introduced into ieee802154_radio_api.
    Drivers need to implement at least
    IEEE802154_ATTR_PHY_SUPPORTED_CHANNEL_PAGES and
    IEEE802154_ATTR_PHY_SUPPORTED_CHANNEL_RANGES.
  * The hardware capabilities IEEE802154_HW_2_4_GHZ and IEEE802154_HW_SUB_GHZ
    were removed as they were not aligned with the standard and some already
    existing drivers couldn't properly express their channel page and channel
    range (notably SUN FSK and HRP UWB drivers). The capabilities were replaced
    by the standard conforming new driver attribute
    IEEE802154_ATTR_PHY_SUPPORTED_CHANNEL_PAGES that fits all in-tree drivers.
  * The method get_subg_channel_count() was removed from ieee802154_radio_api.
    This method could not properly express the channel range of existing drivers
    (notably SUN FSK drivers that implement channel pages > 0 and may not have
    zero-based channel ranges or UWB drivers that could not be represented at
    all). The method was replaced by the new driver attribute
    IEEE802154_ATTR_PHY_SUPPORTED_CHANNEL_RANGES that fits all in-tree drivers.

* Interrupt Controller

  * GIC: Architecture version selection is now based on the device tree
+0 −1
Changes for drivers/ieee802154/Kconfig.cc1200: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ menuconfig IEEE802154_CC1200
	bool "TI CC1200 Driver support"
	default y
	depends on DT_HAS_TI_CC1200_ENABLED
	select NET_L2_IEEE802154_SUB_GHZ

if IEEE802154_CC1200

+0 −1
Changes for drivers/ieee802154/Kconfig.cc13xx_cc26xx: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ menuconfig IEEE802154_CC13XX_CC26XX_SUB_GHZ
	bool "TI CC13xx / CC26xx IEEE 802.15.4g driver support"
	default y
	depends on DT_HAS_TI_CC13XX_CC26XX_IEEE802154_SUBGHZ_ENABLED
	select NET_L2_IEEE802154_SUB_GHZ if NET_L2_IEEE802154

if IEEE802154_CC13XX_CC26XX_SUB_GHZ

+0 −1
Changes for drivers/ieee802154/Kconfig.rf2xx: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ menuconfig IEEE802154_RF2XX
	depends on DT_HAS_ATMEL_RF2XX_ENABLED
	select SPI
	select GPIO
	select NET_L2_IEEE802154_SUB_GHZ if NET_L2_IEEE802154

if IEEE802154_RF2XX

+21 −2
Changes for drivers/ieee802154/ieee802154_b91.c: 21 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -403,7 +403,7 @@ static enum ieee802154_hw_caps b91_get_capabilities(const struct device *dev)
{
	ARG_UNUSED(dev);

	return IEEE802154_HW_FCS | IEEE802154_HW_2_4_GHZ | IEEE802154_HW_FILTER |
	return IEEE802154_HW_FCS | IEEE802154_HW_FILTER |
	       IEEE802154_HW_TX_RX_ACK | IEEE802154_HW_RX_TX_ACK;
}

@@ -428,10 +428,14 @@ static int b91_set_channel(const struct device *dev, uint16_t channel)
{
	ARG_UNUSED(dev);

	if (channel < 11 || channel > 26) {
	if (channel > 26) {
		return -EINVAL;
	}

	if (channel < 11) {
		return -ENOTSUP;
	}

	if (data.current_channel != channel) {
		data.current_channel = channel;
		rf_set_chn(B91_LOGIC_CHANNEL_TO_PHYSICAL(channel));
@@ -585,6 +589,20 @@ static int b91_configure(const struct device *dev,
	return -ENOTSUP;
}

/* driver-allocated attribute memory - constant across all driver instances */
IEEE802154_DEFINE_PHY_SUPPORTED_CHANNELS(drv_attr, 11, 26);

/* API implementation: attr_get */
static int b91_attr_get(const struct device *dev, enum ieee802154_attr attr,
			struct ieee802154_attr_value *value)
{
	ARG_UNUSED(dev);

	return ieee802154_attr_get_channel_page_and_range(
		attr, IEEE802154_ATTR_PHY_CHANNEL_PAGE_ZERO_OQPSK_2450_BPSK_868_915,
		&drv_attr.phy_supported_channels, value);
}

/* IEEE802154 driver APIs structure */
static struct ieee802154_radio_api b91_radio_api = {
	.iface_api.init = b91_iface_init,
@@ -598,6 +616,7 @@ static struct ieee802154_radio_api b91_radio_api = {
	.tx = b91_tx,
	.ed_scan = b91_ed_scan,
	.configure = b91_configure,
	.attr_get = b91_attr_get,
};


Loading