Commit graph

41 commits

Author SHA1 Message Date
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
Robert Lubos 1fb418df4c net: ieee802154_radio: Allow to specify TX mode
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>
2020-04-03 14:07:41 +03:00
Tomasz Bursztyka 4ae72db135 net: Enable PM settings on network devices
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>
2020-03-27 14:48:30 +02:00
Robert Lubos 44c947ec3e drivers: ieee802154_kw41z: Create a fake ACK frame for upper layers
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>
2019-12-09 12:47:45 -05:00
Anas Nashif 5d001f3e41 cleanup: include/: move misc/byteorder.h to sys/byteorder.h
move misc/byteorder.h to sys/byteorder.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Tobias Schlaepfer c88c91942d drivers/ieee802154: Fix KW41Z driver fault
KW41Z IEEE802154 driver fix, by adding an empty configure function
to resolve HardFault at start up

Signed-off-by: Tobias Schlaepfer <scpf@zhaw.ch>
2019-05-31 19:49:27 -04:00
Kumar Gala f92abffe5f ieee802154_kw41z: Fix build error with SYS_LOG_INFO
The following fix:

commit c8b17ec403
Author: Tobias Aschenbrenner <tobias.aschenbrenner@blik.io>
Date:   Tue Dec 18 14:16:00 2018 +0100

    fix: kw41z: Use correct mapping for dBm

Was using SYS_LOG_INFO and should be using LOG_INFO.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-04-17 13:46:07 -05:00
Tobias Aschenbrenner c8b17ec403 fix: kw41z: Use correct mapping for dBm
The radio API expects the setting of the TX-power in dBm. The actual
TX-power is however set by a 6bit register, which mapping between
register value and power in dBm is a lookup-table in the datasheet.

This mapping for the kw41z was off, which not only lead to incorrect
output power, but also to a maximal output power of only -1.9 dBm
instead of the possible +3.5 dBm.

Signed-off-by: Tobias Aschenbrenner <tobias.aschenbrenner@blik.io>
Signed-off-by: Franco Saworski <f.saworski@posteo.de>
2019-04-17 10:26:19 -05:00
Patrik Flykt 21358baa72 all: Update unsigend 'U' suffix due to multiplication
As the multiplication rule is updated, new unsigned suffixes
are added in the code.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Tomasz Bursztyka 23251b040d drivers/ieee802154: Switch KW41Z to new net_ptk allocator
Now buffer is allocated at the same time.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-23 07:44:59 -05:00
Robert Lubos 635191ac8c net: ieee802154: Fix ack check
15.4 MHR is no longer set in net_buf pointed by net_pkt, but in a
separate net_buf, hence we need to check that net_buf now to
determine if we need to wait for ACK or not.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-01-17 11:16:26 +02:00
Tomasz Bursztyka e97a543e9b net/pkt: Remove parameters to "reserve" some headroom
Such parameter is not used anymore, it was defaulted to 0 previously.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka 6ea225e34a net/ieee802154: Finally removing usage of ll_reserve in L2
Moving towards serialized fragmentation, adapting mac command creation
to avoid the need of ll_reserve etc...

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Patrik Flykt 8ff96b5a57 drivers: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Tomasz Bursztyka ebb40ba338 net/ieee802154: Switch to L2 sending path
As for Ethernet, up to ieee802154 L2's send to actually sent the packet.
It's currently unoptimized as 6lo compression, 15.4 fragmentation and so
on will reallocate net_buf etc... but it's the first step towards
removing ll reserve space and more.

Applying changes to Openthread L2 as well.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-30 11:12:13 -08:00
Andrei Emeltchenko 13b02d620c ieee802154: Allow to set debug for RAW_CHANNEL
Allow to set debug also for RAW_CHANNEL and set general debug template
instead of networking one.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-15 08:42:52 -05:00
Kumar Gala aa2bdbe322 drivers: Remove board.h include
We either don't need board.h in the driver or we should be include soc.h
instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-01 13:21:11 -04:00
Jukka Rissanen 90dc38f8c9 drivers: ieee802154: Convert to use new logging
Convert the IEEE 802.15.4 drivers to use the new logging system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-04 14:13:57 +03:00
Tomasz Bursztyka 50990cdfaf drivers/ieee802154: KW41Z drivers is missing hw ACK caps
ACK frames are handled on hardware level, so let's expose this
capability in order to avoid L2 waiting for these.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 16:18:53 +03:00
Tomasz Bursztyka 49bd1e9c6f ieee802154: Add support for filtering source short/ieee addresses
L2 could take advantage of such hardware capability, when supported by
the device. This is also required for OpenThread.

Fixes #5714

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 16:18:53 +03:00
David Leach 9f7470e240 drivers: ieee802154: Add OpenThread modifications to KW41Z driver
- Add modifications to the KW41Z driver to enable operation with
  OpenThread L2 layer.

Signed-off-by: David Leach <david.leach@nxp.com>
2018-04-11 16:57:12 +03:00
David Leach 7738a501d9 drivers: ieee802154: Add auto-ack support to KW41Z driver
- Enabled and fixed auto-ack offload support for 802.15.4 transmit

Signed-off-by: David Leach <david.leach@nxp.com>
2018-04-11 16:57:12 +03:00
Kumar Gala 4b2348c9e7 drivers/ieee802154_kw41z: Fix interrupt priority
The interrupt priority on KW41Z is from 0..3.  The value of 0x80 is
invalid, so lets set it to 0 for now as all the other interrupt
priorities default to 0 right now.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-11-15 08:30:16 -06:00
Kumar Gala 7cd27be39a drivers/ieee802154_kw41z: Update kw41z to support event trace buffer
Added conditionally enabled event state tracing support.
Needed for enhanced debug visibility of tight timed events where
normal print debug messages affect the timing of things. This is a
simple buffer that allows post analysis via gdb of what sequencer
events occurred.

Signed-off-by: David Leach <david.leach@nxp.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-11-15 08:30:16 -06:00
David Leach fcffac92b7 drivers/ieee802154_kw41z: Reduce debug logging due to false positives
- Removed some debug output and changed the level of others to reduce
  the amount of information logged. The reason is that some of this is
  causing false positive distractions.
- Removed enabling of FILTER error IRQ events. It isn't needed and is
  only informational.
- Changed frame control AR bit inspection to use native retrieval
  routine.
- Addressed some coding style issues.

Signed-off-by: David Leach <david.leach@nxp.com>
2017-11-15 08:30:16 -06:00
David Leach 280ccbaffb drivers/ieee802154_kw41z: Modified RX handling of filter failures
Changed the logic to reset the sequencer when a RX filter
failure has been detected. This also disables the RX timer
until the next watermark detection.

Signed-off-by: David Leach <david.leach@nxp.com>
2017-11-15 08:30:16 -06:00
David Leach e8431daac0 drivers/ieee802154_kw41z: Stabilize the KW41Z IEEE802.15.4 driver
- Reworked the driver logic around TX/RX to correctly handle the
  expectations of the underlying 802.15.4 hardware IP.
- Fixed a problem with TX always reporting an error to the stack
  which resulted in constant retries.
- Fixed bug in RX to TX transition which would occasionally cause the
  driver to error the TX.
- Changed RX logic to ensure that invalid RX frames were not passed up
  the stack.
- Simplified hardware timer usage to only use TMR3.
- Added RX watermark and TMR3 support to fix a hardware problem where
  the hw IP can get stuck on a receive in noisy environments.
- Modified samples/net/echo_client and echo_server kw41z project config
  files to provide enanced debug visibility into stacks and threads.

Signed-off-by: David Leach <david.leach@nxp.com>
2017-11-15 08:30:16 -06:00
Leandro Pereira adce1d1888 subsys: Add random subsystem
Some "random" drivers are not drivers at all: they just implement the
function `sys_rand32_get()`.  Move those to a random subsystem in
preparation for a reorganization.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-11-01 08:26:29 -04:00
Tomasz Bursztyka ea0aee2bb3 drivers/ieee802154: Stop exposing old radio API functions
set_ieee_addr, set_short_addr and set_pan_id are now unused by L2, so
removing their exposure through the radio API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka 54b3d6b130 drivers/ieee802154: Implement radio API's set_filter() relevantly
Currently, all drivers seem to support hardware filtering.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka b2726e14a6 drivers/ieee802154: Implement get_capabilities in existing drivers
Further support will need work per-driver basis, as soon as the L2 will
be able to make usage of such support.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka 164cbec9d0 drivers/ieee802154: Set lqi/rssi to net_pkt, stop exposing get_lqi
Both values are now embedded into net_pkt, get_lqi will be removed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Bogdan Davidoaia e392ef2285 drivers: ieee802154: kw41z: add support for KW40Z
Add support for KW40Z in the KW41Z IEEE 802.15.4 driver as both chips
expose almost the same radio registers.

Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-07-06 14:20:32 -05:00
Bogdan Davidoaia 3389ee4eb4 drivers: ieee802154: kw41z: fix issue in RX sequence
The chip seems to require a wait time before reading packet
data after the RX sequence done interrupt, as imidiate reading
of it will indicate a packet size of zero and cause the RX
sequence done to be continually retriggered.

In addition, the extra clearing of the interrupt flags can be
removed, as this is already done at the beginning of the isr.

Jira: ZEP-2278
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-07-06 14:20:32 -05:00
Bogdan Davidoaia 2b1dfbcd7c drivers: ieee802154: kw41z: remove unnecessary cast for PKT_BUFFER_RX
The cast to u16_t in not needed as PKT_BUFFER_RX already is
of that type.

Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-07-06 14:20:32 -05:00
Kumar Gala c11877941a drivers: ieee802154_kw41z: Cleanup use of C99 types
We introduced some see C99 types, so convert them over to the Zephyr
types.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-05-09 17:06:28 -04:00
Bogdan Davidoaia 15e55e1823 ieee802154: kw41z: keep global transceiver interrupt unmasked
There is no need to unmask/mask the global transceiver interrupt
in kw41z_start/stop as the radio interrupt line is enabled/disabled
anyway with irq_enable/disable calls.

Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-05-04 11:58:46 -04:00
Bogdan Davidoaia cbe030d444 ieee802154: kw41z: fix sync issue in CCA sequence
- set state to IDLE if TMR1 expires, but CCA reports channel as free
- no need to check for CCABFRTX, as the hardware isn't setup to do
CCA before TX

Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-05-04 11:58:46 -04:00
Bogdan Davidoaia 5dc68e3855 ieee802154: kw41z: adjust sequence timeouts
Sequence timeouts should be scaled to 16us, as TMR_PRESCALE was set
to 62.5kHz.

Also, radio warmup times and TX packet length need to be taken into
account.

Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-05-04 11:58:46 -04:00
Bogdan Davidoaia 90e0665190 net: ieee802154: add native IEEE 802.15.4 driver for KW41Z
The driver uses KW41Z's IEEE 802.15.4 hardware registers (ZLL).

Origin: Original

Jira: ZEP-2026
Change-Id: I8eb82a7c16c8ca3e3003f8318f74a3651eb24f68
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-04-28 15:01:10 +03:00