Make drivers multi-instance wherever possible using DT_INST_FOREACH.
This allows removing DT_HAS_DRV_INST in favor of making drivers just
do the right thing regardless of how many instances there are.
There are a few exceptions:
- SoC drivers which use CMake input files (like i2c_dw.c) or otherwise
would require more time to convert than I have at the moment. For the
sake of expediency, just inline the DT_HAS_DRV_INST expansion for
now in these cases.
- SoC drivers which are explicitly single-instance (like the nRF SAADC
driver). Again for the sake of expediency, drop a BUILD_ASSERT in
those cases to make sure the assumption that all supported SoCs have
at most one available instance is valid, failing fast otherwise.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add a Kconfig option that allows user to set any necessary config
using management interface before interface be operational. A use
case is set the EUI-64 address from an external EEPROM by the
NET_REQUEST_IEEE802154_SET_EXT_ADDR command. After all configs
are done net_if_up() can be invoked to bring interface up.
Fixes#23193.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
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>
The radio driver will now notify the upper layer about Frame Pending Bit
value in the ACK response it sent.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Obtain RX time from the radio driver. Fill the `net_pkt` with
a timestamp if `NET_PKT_TIMESTAMP` is enabled.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
nRF radio driver will call `nrf_802154_transmit_failed` callback in case
no ACK is received, so we do not need to set timeout at the shim layer
anymore.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Notify about actual data transmission start.
Needed when ACK timeout is disabled in the radio driver.
Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
Add CSMA CA capability for the `ieee802154_nrf5` radio driver along with
appropriate implementation in the `nrf5_tx` function.
Introduce 802.15.4 radio driver with CSMA/CA support enabled. Add help
text, mentioning a list of peripherals occupied by the radio driver.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Even though radio driver can report in its capabilities that it does
support CSMA CA, there's no way in the driver to select how the frame
should be transmitted (with CSMA or without). As layers above radio
driver (Thread, Zigbee) can expect that both TX modes are available, we
need to extend the API to allow either of these modes.
This commits extends the API `tx` function with an extra parameter,
`ieee802154_tx_mode`, which informs the driver how the packet should be
transmitted. Currently, the following modes are specified:
* direct (regular tx, no cca, just how it worked so far),
* CCA before transmission,
* CSMA CA before transmission,
* delayed TX,
* delayed TX with CCA
Assume that radios that reported CSMA CA capability transmit in CSMA CA
mode by default, all others will support direct mode.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Energy scan procedure, while introduced specifically for OpenThread in
Zephyr, may also be used by other upper layers (like Zigbee).
Therefore, disable conditional inclusion of the `ed_scan` API.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add a missing include of debug/stack.h in order to fix the
compilation warning on implicit declaration of log_stack_usage().
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
By changing the various *NET_DEVICE* macros. It is up to the device
drivers to either set a proper PM function or, if not supported or PM
disabled, to use device_pm_control_nop relevantly.
All existing macro calls are updated. Since no PM support was added so
far, device_pm_control_nop is used as the default everywhere.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
At OpenThread stack on ieee802154_radio_handle_ack method the
net_pkt_read fail because net_pkt_cursor wasn't proper initialized.
This ensures that net_pkt_cursor is initialized for any ack frame.
Another hidden problem fixed was the frags property on net_buf. Now
it is defined as NULL to ensures that no fragments are available.
The ack frame should be returned to OT only if requested. In this
case, the IEEE 802.15.4 Frame Control field from TX frag is now
verified for an ACK request and if OT requires ACK response it will
be proper handled and dispatched.
Fixes#23595
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This reverts commit 979ed4e1cd.
Pull Request #23437 was merged by mistake with an invalid manifest.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add a missing include of debug/stack.h in order to fix the
compilation warning on implicit declaration of log_stack_usage().
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
The current design of the network-specific stack dumping APIs
is fundamentally unsafe. You cannot properly dump stack data
without information which is only available in the thread object.
In addition, this infrastructure is unnecessary. There is already
a core shell command which dumps stack information for all
active threads.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Convert driver to use DT_INST_ defines. There was just one case for
CS_GPIOS that wasn't using DT_INST defines already.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Fix build failure when CONFIG_NET_L2_OPENTHREAD is not enabled. The
failure looks as follows:
drivers/ieee802154/ieee802154_nrf5.c:187:12:
warning: 'nrf5_energy_scan_start' defined but not used
[-Wunused-function]
static int nrf5_energy_scan_start(struct device *dev,
^~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Implement function and necessary callbacks to handle Energy Scan feature
of the nRF radio driver needed by some radio stacks.
Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
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>
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>
Current rf2xx_thread_main code have too many if/for/while imbrication.
Extract methods from rx2xx_thread_main for better readability.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Update to use new API for GPIO pin configuration and operation. Fix
invalid arithmetic on void pointer. Convert to support devicetree.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Update to use new API for GPIO pin configuration and operation. Fix
invalid arithmetic on void pointer. Mark all CC2520 GPIOs as required
in binding.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The rf2xx driver is doing automatic retransmissions in hardware based
on whether ACKs are received or not. Currently the driver is not
invoking ieee802154_radio_handle_ack() as other drivers are doing and
required by OpenThread since 4fe1da9. This add rf2xx_handle_ack method
to ensures required ACK processing when driver performs TX.
Fixes: #21763
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
The RF2XX driver not always sent ACK when a RX frame requests. This
happen because RF2XX transceiver asserts TRX_END interrupt after
confirm that the FCS is valid. The driver can now decode the frame
but in parallel the radio still processing the ACK frame. This will
sync the radio FSM state to ensure that ACK will be send.
Fixes#21659
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
So far, nRF 802.15.4 radio driver build was dependent on the 802.15.4
subsystem in Zephyr. While this was a reasonable approach for samples,
it prevented the radio driver from being built as a standalone entity,
which could be useful in some applications (e. g. running core nRF
802.15.4 radio driver tests with Zephyr).
Resolve this, by providing a separate set of Kconfigs for the radio
driver, therefore allowing to build it as a separate entity. The 802154
subsystem simply enables the radio driver module in this case.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The build infrastructure should not be adding the drivers subdirectory
to the include path. Fix the legacy uses that depended on that
addition.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The build infrastructure should not be adding the drivers subdirectory
to the include path. Fix the legacy uses that depended on that
addition.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The build infrastructure should not be adding the drivers subdirectory
to the include path. Fix the legacy uses that depended on that
addition.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The rf2xx driver needs GPIO driver to works. The RST, SLPTR and INT
are mandatory signals and driver uses DT to configure them. This add
the GPIO dependency on Kconfig.rf2xx file.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Same deal as in commit bd6e04411e ("kconfig: Clean up header comments
and make them consistent") and commit 1f38ea77ba ("kconfig: Clean up
'config FOO' (two spaces) definitions"), for some newly-introduced
stuff.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
OpenThread recently introduced CMake build system into its repostiory
so we no longer need autotools to build OpenThread libraries and can
integrate them natively.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
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>
Upper layers like OpenThread expect the radio driver to forward ACK
frame received by the radio.
Simulate this behavior on kw41z by recreating the ACK frame from the
available data.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
nRF5 driver did not utilize `ieee802154_radio_handle_ack` API, therefore
did not provide ACK frames to the upper layer. This commit fixes this
problem.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>