Commit graph

113 commits

Author SHA1 Message Date
Jordan Yates 0d4417d187 ieee802154: cc2520: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05: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
Kumar Gala db725c0ec9 drivers: Replace GPIO_CS Kconfig with devicetree detection
Use DT_INST_SPI_DEV_HAS_CS_GPIOS() in drivers to determine if we should
utilize CS_GPIO base SPI chipselect handling.  This allows us to remove
Kconfig option for this feature.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 13:07:05 +02: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
Kumar Gala f078f6527e drivers: ieee802154: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 17:04:32 -05: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
Carles Cufi 6574efa232 drivers: Add missing debug/stack.h include
In order to use log_stack_usage(), inclusion of <debug/stack.h> is
required.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-03-19 18:45:13 +01:00
Andrew Boie 760644041c net: purge NET_STACK and other stack APIs
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>
2020-03-14 13:10:19 -04:00
Andrew Boie 00f46df6ad drivers: ieee802154: do not use net stack API
Use log_stack_usage() instead, which does the same thing,
safely.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-14 13:10:19 -04:00
Tomasz Bursztyka 3587fe2fe3 drivers/ieee802154: Adapt cc2520 driver to new GPIO API
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>
2020-02-05 12:00:36 +01:00
Peter Bigot ab91eef23b coccinelle: standardize kernel API timeout arguments
Use the int_literal_to_timeout Coccinelle script to convert literal
integer arguments for kernel API timeout parameters to the standard
timeout value representations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-03 11:55:44 -07:00
Peter Bigot d566254e3f drivers: fix k_thread_create timeout argument
Use the named representation for no-wait to future-proof against a
change to the representation of timeout values.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-09-19 17:35:53 +02: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
Anas Nashif 6aa9c3a68f cleanup: include/: move gpio.h to drivers/gpio.h
move gpio.h to drivers/gpio.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
Kumar Gala a614a026b7 dts: Rename DT_.*_GPIO_* to DT_.*_GPIOS_*
Convert DT_.*_GPIO_{CONTROLLER,PIN,FLAGS} ->
	DT_.*_GPIOS_{CONTROLLER,PIN,FLAGS)

Used the following commands to make these conversions:

git grep -l DT_.*_GPIO_CONTROLLER | xargs sed -i 's/DT_\(.*\)_GPIO_CONTROLLER/DT_\1_GPIOS_CONTROLLER/g'
git grep -l DT_.*_GPIO_PIN | xargs sed -i 's/DT_\(.*\)_GPIO_PIN/DT_\1_GPIOS_PIN/g'
git grep -l DT_.*_GPIO_FLAGS | xargs sed -i 's/DT_\(.*\)_GPIO_FLAGS/DT_\1_GPIOS_FLAGS/g'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-27 13:02:34 -05:00
Kumar Gala a2693975d7 dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 08:02:15 -05:00
Andrew Boie 4e5c093e66 kernel: demote K_THREAD_STACK_BUFFER() to private
This macro is slated for complete removal, as it's not possible
on arches with an MPU stack guard to know the true buffer bounds
without also knowing the runtime state of its associated thread.

As removing this completely would be invasive to where we are
in the 1.14 release, demote to a private kernel Z_ API instead.
The current way that the macro is being used internally will
not cause any undue harm, we just don't want any external code
depending on it.

The final work to remove this (and overhaul stack specification in
general) will take place in 1.15 in the context of #14269

Fixes: #14766

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-05 16:10:02 -04:00
Patrik Flykt 97b3bd11a7 drivers: Rename reserved function names
Rename reserved function names in drivers/ subdirectory. Update
function macros concatenatenating function names with '##'. As
there is a conflict between the existing gpio_sch_manage_callback()
and _gpio_sch_manage_callback() names, leave the latter unmodified.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-03 17:31:00 -04:00
Wentong Wu 94615a4f98 ext: lib: crypto: unify the API of CCM alogrith
unify the API of CCM alogrithm's implemation for TinyCrypt,
mbedTLS and cc2520 crypto device to make users easy to use.

Fixes #8339.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-04-02 21:02:00 -04: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 52fd371504 drivers/ieee802154: Switch CC2520 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
Kumar Gala 2492d52f5c ieee802154: cc2520: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert cc5250 driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-28 10:40:14 -06: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
Kumar Gala f249a0f4f2 ieee802154: cc2520: Move to DT only config support
Now that the in tree user of cc2520 uses device tree to configure SPI
and GPIO params, we can remove and convert the driver to utilize DT
only.  This means removing the Kconfig options that come from DT and
rename CONFIG_ to DT_ for those options.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-16 14:02:00 -05: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
Anas Nashif 7147f0ceeb drivers: ieee802154_cc2520: move to new logger
Move to new logger and remove commented logger calls.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 17:30:09 -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 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
Tomasz Bursztyka d4065ae73e drivers/ieee802154: Switch CC2520 to new SPI API
Finally switching to new SPI API. It makes code simpler and performs
better.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Ravi kumar Veeramally 731c7518d2 drivers: cc2520: Change debug information
Driver is 'Busy' can be a warning message which can be enabled with
minimum debug level CONFIG_SYS_LOG_IEEE802154_DRIVER_LEVEL=2.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-02-02 16:50:07 +02:00
Tomasz Bursztyka b52c0f24a6 net/ieee802154: Make RAW mode generic
- Renaming NET_L2_RAW_CHANNEL to NET_RAW_MODE
- Create a generic IEEE 802.15.4 raw mode for drivers
- Modify the IEEE 802.15.4 drivers so it passes the packet unmodified,
up to code using that mode to apply the necessary changes on the
received net_pkt according to their needs
- Modify wpanusb/wpan_serial relevantly

Fixes #5004

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-11-22 10:10:09 -05: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
Jukka Rissanen 07b1376c31 drivers: ieee802154: cc2520: Fix compiler warning
The stack address was incorrectly specified when stack usage
was being debugged. This caused compiler to emit this warning

drivers/ieee802154/ieee802154_cc2520.c:1136:16: warning:
    dereferencing type-punned pointer will break strict-aliasing
    rules [-Wstrict-aliasing]
       ((struct cc2520_context *)(&__device_cc2520))->
                ^

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-08-30 11:54:43 -04:00
Andrew Boie e8cede7940 net: fix references to stack buffers
The net_stack_analyze function wants to look at the stack buffer,
but it is making assumptions on where this data is that are no
longer valid. Change to use the proper APIs for referencing this.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-26 10:31:46 +03:00
Andrew Boie 27bcdc571b drivers: ieee802154: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Kumar Gala a509441210 net: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I4ec03eb2183d59ef86ea2c20d956e5d272656837
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:30:38 -05:00
Tomasz Bursztyka db11fcd174 net/net_pkt: Fully separate struct net_pkt from struct net_buf
- net_pkt becomes a stand-alone structure with network packet meta
  information.
- network packet data is still managed through net_buf, mostly named
  'frag'.
- net_pkt memory management is done through k_mem_slab
- function got introduced or relevantly renamed to target eithe net_pkt
  or net_buf fragments.
- net_buf's sent_list ends up in net_pkt now, and thus helps to save
  memory when TCP is enabled.

Change-Id: Ibd5c17df4f75891dec79db723a4c9fc704eb843d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Tomasz Bursztyka bf964cdd4c net: Renaming net nbuf API to net pkt API
There have been long lasting confusion between net_buf and net_nbuf.
While the first is actually a buffer, the second one is not. It's a
network buffer descriptor. More precisely it provides meta data about a
network packet, and holds the chain of buffer fragments made of net_buf.

Thus renaming net_nbuf to net_pkt and all names around it as well
(function, Kconfig option, ..).

Though net_pkt if the new name, it still inherit its logic from net_buf.
'
This patch is the first of a serie that will separate completely net_pkt
from net_buf.

Change-Id: Iecb32d2a0d8f4647692e5328e54b5c35454194cd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Tomasz Bursztyka feaa1e1371 drivers/ieee802154/cc2520: Set the current rx frame RSSI into its nbuf
Change-Id: I215a8ceaa066a8521a2f647746301dbec780b43f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-13 15:21:45 +03:00
Tomasz Bursztyka 3226b95a5f drivers/ieee802154: Adding support for CC2520 ccm crypto
This will provide the feature through Crypto API.

Change-Id: If6953a54b393544b019755ae73571effe0724e69
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:33 +02:00
Jukka Rissanen 2b487646d6 drivers: ieee802154: cc2520: User can set the MAC address
Allow user to set the four last bytes of a MAC address.
By default the bytes are selected randomly but for testing
purposes we need a way to specify the address in advance.

Change-Id: Ic9820a8026b327d1ee5025ab77fdc77f5778de67
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:45 +02:00