Commit graph

15 commits

Author SHA1 Message Date
Florian Grandel a12a6ab5b9 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: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-27 12:44:15 -04:00
Gerson Fernando Budke 037618a638 drivers: ieee802154: rf2xx: Fix rx promiscuous behaviour
When radio is set to promiscuous mode it is desirable to receive
invalid frames. This skip a few checks and allow an invalid and
non-standard frames be delivered for diagnose.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-09-27 09:53:08 +02:00
Gerson Fernando Budke 6d5cdc17b4 drivers: ieee802154: rf2xx: Add support to Sub-Giga
Add support to at86rf212[b] sub-giga devices. This work enables use of
pages 0, 2 and 5 in accordance with IEEE-802.15.4/2003/2006/2011. The
proprietary speeds can be object of future work.

Note: It is recommended that user define a power table for better
performance, low emissions and to save power. A reference power table
can be found in the datasheet and should be used for tests only and
not on a final product.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-09-09 10:31:35 -07:00
Gerson Fernando Budke 65960c4d32 drivers: ieee802154: rf2xx: Move power table to devicetree
The current version of power table is hardcoded in the driver which is a
problem when use devices in production. This change remove all hardcode
from driver and reimplement the feature to allow people create a table
which is defined in devicetree. The big advantage is that each board can
define their own table based on lab tests and allows use of FEM devices
inclusive.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-09-09 10:31:35 -07:00
Gerard Marull-Paretas b15fb9cb2f drivers: ieee802154: rf2xx: use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Bartosz Bilas f445cb9a7e drivers: ieee802154_rf2xx: convert to use spi_dt_spec
Convert ieee802154_rf2xx driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-08 11:06:16 -05:00
Gerson Fernando Budke 195800145e drivers: ieee802154: rf2xx: Add tx mode direct
The current RF2XX driver only support IEEE802154_TX_MODE_CSMA_CA.  Add
IEEE802154_TX_MODE_DIRECT to allow transmit packets immediately without
performing random backoff, CCA and retransmission process.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Tomasz Bursztyka 949b25cf68 drivers: ieee802154: Fix device instance const qualifier loss
In all of these drivers, passing the device's data was sufficient as
only the data is being used by thread.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Andrew Boie 7d920ba39b drivers: use K_KERNEL_STACK macros
None of these threads run in user mode and we can save some
memory.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-04 12:16:43 -04:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Gerson Fernando Budke c755821608 drivers: ieee802154: rf2xx: Add local-mac-address
Add local-mac-address on DT and enable it on rf2xx driver. If user
define local-mac-address this value will be used as default mac address.
Otherwise driver automatically add a random mac address.

On application level user can change default mac address using net_mgmt
command with NET_REQUEST_IEEE802154_SET_EXT_ADDR parameter defined on
include/net/ieee802154_mgmt.h header.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-28 10:30:55 +03:00
Gerson Fernando Budke 2cfb11e050 drivers: ieee802154: rf2xx: Rem trx_state variable
The rx timeout timer callback need update trx_state variable and this
variable is protected by a mutex. Because of that, when compiling the
system with CONFIG_ASSERT=y the system reports 'ASSERTION FAIL
[!arch_is_in_isr()] @ ZEPHYR_BASE/kernel/include/ksched.h:262'.

This refactor the driver remove trx_state variable dependency and
consequently removes phy_mutex and rx timeout timer to be compliant
with kernel rules.

Fixes: #23198

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-09 14:17:06 +02:00
Gerson Fernando Budke be56e36fe4 drivers: ieee802154: rf2xx: Add RX improvements
The current version of at86rf2xx RX implementation don't uses advanced
capabilities offer by the transceiver. This access SRAM space to gatter
PHR information in parallel with transceiver frame reception. It allows
improve RX reception by handling properlly the frame protection feature
removing transceiver states changes.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-09 14:17:06 +02:00
Gerson Fernando Budke 67289d07fe drivers: ieee802154: rf2xx: Add initial driver
Add initial Atmel at86rf2xx transceiver driver. This driver uses device
tree to configure the physical interface. The driver had capability to
use multiple transceiver and systems with multiple bands can be used.
With this, 2.4GHz ISM and Sub-Giga can be used simultaneous.

Below a valid DT example. This samples assume same SPI port with two
transceivers.

&spi0 {
    status = "okay";
    label = "SPI_RF2XX";
    cs-gpios = <&porta 31 0 &porta 30 0>;

    rf2xx@0 {
        compatible = "atmel,rf2xx";
        reg = <0x0>;
        label = "RF2XX_0";
        spi-max-frequency = <7800000>;
        irq-gpios = <&portb 2 0>;
        reset-gpios = <&porta 3 0>;
        slptr-gpios = <&portb 3 0>;
        status = "okay";
    };

    rf2xx@1 {
        compatible = "atmel,rf2xx";
        reg = <0x1>;
        label = "RF2XX_1";
        spi-max-frequency = <7800000>;
        irq-gpios = <&portb 4 0>;
        reset-gpios = <&porta 4 0>;
        slptr-gpios = <&portb 4 0>;
        status = "okay";
    };
};

At the moment driver assume two transceiver are enouth for majority of
appications. Sub-Giga band will be enabled in future.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2019-12-13 11:23:23 +02:00