Commit graph

6135 commits

Author SHA1 Message Date
Martí Bolívar 7e0eed9235 devicetree: allow access to all nodes
Usually, we want to operate only on "available" device
nodes ("available" means "status is okay and a matching binding is
found"), but that's not true in all cases.

Sometimes we want to operate on special nodes without matching
bindings, such as those describing memory.

To handle the distinction, change various additional devicetree APIs
making it clear that they operate only on available device nodes,
adjusting gen_defines and devicetree.h implementation details
accordingly:

- emit macros for all existing nodes in gen_defines.py, regardless
  of status or matching binding
- rename DT_NUM_INST to DT_NUM_INST_STATUS_OKAY
- rename DT_NODE_HAS_COMPAT to DT_NODE_HAS_COMPAT_STATUS_OKAY
- rename DT_INST_FOREACH to DT_INST_FOREACH_STATUS_OKAY
- rename DT_ANY_INST_ON_BUS to DT_ANY_INST_ON_BUS_STATUS_OKAY
- rewrite DT_HAS_NODE_STATUS_OKAY in terms of a new DT_NODE_HAS_STATUS
- resurrect DT_HAS_NODE in the form of DT_NODE_EXISTS
- remove DT_COMPAT_ON_BUS as a public API
- use the new default_prop_types edtlib parameter

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Henrik Brix Andersen 71b893056f drivers: i2c: add I2C bus recovery API
Add API for recovering an I2C bus. This API can be used to recover
from situations where the I2C master and one or more I2C slaves are
out of synchronization (e.g. if the I2C master was reset in the middle
of an I2C transaction or if a noise pulse was induced on the SCL
line).

Fixes #23441.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Tomasz Bursztyka 48135cdd34 usermode: Rework Z_SYSCALL_SPECIFIC_DRIVER to fit with device refactoring
init_fn is not anymore part of struct device, so let's test instead the
driver's API structure pointer which is also unique per device driver.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka 97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka 8d7bb8ffd8 device: Refactor device structures
When the device driver model got introduced, there were no concept of
SYS_INIT() which can be seen as software service. These were introduced
afterwards and reusing the device infrastructure for simplicity.
However, it meant to allocate a bit too much for something that only
required an initialization function to be called at right time.

Thus refactoring the devices structures relevantly:
- introducing struct init_entry which is a generic init end-point
- struct deviceconfig is removed and struct device owns everything now.
- SYS_INIT() generates only a struct init_entry via calling
  INIT_ENTRY_DEFINE()
- DEVICE_AND_API_INIT() generates a struct device and calls
  INIT_ENTRY_DEFINE()
- init objects sections are in ROM
- device objects sections are in RAM (but will end up in ROM once they
  will be 'constified')

It also generate a tiny memory gain on both ROM and RAM, which is nice.

Perhaps kernel/device.c could be renamed to something more relevant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka 48b784abb3 init: Fix tiny indentation issue
The whole file is perfectly indented everywhere else.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka 6f318a5223 device: Fix tiny indentation issue
The whole file is perfectly indented everywhere else.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Dominik Ermel 6ba69f19d4 sys/util.h: Add IS_EMPTY and LIST_DROP_EMPTY macros
IS_EMPTY macro allows to check if defined name is empty, i.e.
does not contain replacement list.
LIST_DROP_EMPTY macro may be used to process __VA_ARGS__ type lists,
e.g. a,b,,c , and remove empty elements.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-05-08 17:50:25 +02:00
Andrew Boie a203d21962 kernel: remove legacy fields in _kernel
UP should just use _kernel.cpus[0].

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-08 17:42:49 +02:00
Emil Obalski 8d2f13c203 usb: Add USB audio implementation
By this commit USB audio class implementation is introduced
to Zephyr.

The Zephyr USB audio device class follows bellow
documentations:

- Universal Serial Bus specification rev2.0 (usb20.pdf)
- Universal Serial Bus Device Class Definition for Audio Devices
  (audio10.pdf)
- Universal Serial Bus Device Class Definition for Audio Data Formats
  (frmts10.pdf)
- Universal Serial Bus Device Class Definition for Terminal Types
  (termt10.pdf)

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Emil Obalski 98c9cebfac usb: Add Audio class related files
This commit adds files related to USB audio device class.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Emil Obalski 7b9fcfd30d drivers: usb: Add enum type for Synchronization Type.
This commit adds enumeration type for isochronous
endpoints specific information required by USB Audio Class.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Emil Obalski 9e998d108a drivers: usb: Correct naming for endpoint Transfer Type
This commit updates definitions to better match usb 2.0 spec.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Alberto Escolar Piedras cd0659e36f util.h: Remove INLINE definition and user
INLINE is a very common macro, just like MAX or MIN.
Defining it always can easily collide with libraries or
application headers.
And option would be to add a ifdef guard around it,
But it was used in only 1 place in Zephyr, instead
of keeping it just for that, remove it.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2020-05-08 08:37:21 -04:00
Stephanos Ioannidis 0b930a2195 kconfig: Rename x86 FPU sharing symbols
This commit renames the x86 Kconfig `CONFIG_{EAGER,LAZY}_FP_SHARING`
symbol to `CONFIG_{EAGER,LAZY}_FPU_SHARING`, in order to align with the
recent `CONFIG_FP_SHARING` to `CONFIG_FPU_SHARING` renaming.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-08 10:58:33 +02:00
Stephanos Ioannidis aaf93205bb kconfig: Rename CONFIG_FP_SHARING to CONFIG_FPU_SHARING
This commit renames the Kconfig `FP_SHARING` symbol to `FPU_SHARING`,
since this symbol specifically refers to the hardware FPU sharing
support by means of FPU context preservation, and the "FP" prefix is
not fully descriptive of that; leaving room for ambiguity.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-08 10:58:33 +02:00
Henrik Brix Andersen bbc1928dd1 canbus: canopen: add program download support
Add program download (firmware update) support according to the CAN in
Automation (CiA) 302-3 draft standard proposal v4.1.0.

The implementation supports a Zephyr specific vendor command allowing
external confirmation of a newly booted firmware image. If this is not
desired, the application can confirm the image by other means.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-08 10:53:42 +02:00
Andy Ross 46dc8a0813 include: Add documentation for spinlocks
The kernel spinlock API didn't have proper API documentation.  Fix
that.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-05-08 10:46:44 +02:00
Paul Sokolovsky ecf8c0146d include: posix: Add <sys/select.h> header for POSIX subsystem
Provides implementation of select() call in terms of zsock_select().

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-05-08 11:16:31 +03:00
Krzysztof Chruscinski 512de5ecac shell: Refactor command execution to enable raw arguments
Added special flag that can be used to indicate that optional
arguments are passed without any parsing (e.g. quotation marks
removal). Modified execute command to parse command line buffer
argument by argument.

After this change it is possible to forward whole command to
command handler (using select).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-07 23:47:39 -05:00
Luiz Augusto von Dentz d2caa658f5 Bluetooth: hci_raw: Fix build error on hci_usb_h4
BT_BUF_TX_SIZE is actually used for setting the MPS properly.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-07 22:38:31 -05:00
Dominik Ermel ba8b74d801 devicetree: Add DT_FOREACH_CHILD macro
The macro iterates through the list of child nodes and invokes provided
macro for each node.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 21:42:58 -05:00
Joakim Andersson 6f0b8c1421 Bluetooth: host: Add application control of PHY change procedure
Add application control of initiating phy change procedure and it's
parameters.
The reasons for allowing the application control over the PHY:
 - Allow changing to Coded PHY.
 - Application may change PHY to react to changes in environment
   to balance throughput and range.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson f55c8c9d0b Bluetooth: host: Document parameters to remote information callback
Document the parameters in the remote_info_available callback.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson d9e228a4b0 Bluetooth: host: Add application control of data length procedure
Add application control of initiating data length procedure and it's
parameters.
The reasons for allowing the application control over the data length:
 - Bandwidth control adjusted based on number of active connections.
 - Changing data length before switching to coded phy.
 - Applying workarounds for interoperability problems.
 - Controlling order of ATT MTU and data length procedures.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Peter A. Bigot e444274e95 drivers: counter: add Maxim DS3231 support
The DS3231 is an I2C real-time clock with internal temperature
compensated oscillator, maintaining civil time to 1 s precision with
nominal 2 ppm accuracy from 0-40 Cel.

The basic functionality is exposed as a counter that is always running
at 1 Hz.  Much more functionality is exposed as driver-specific API,
including the ability to translate between the time scale of the DS3231
and the time scale of the Zephyr uptime clock.  This allows correlation
of events in the system clock to UTC, TAI, or whatever time scale is
used to maintain the DS3231.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-07 19:45:06 +02:00
Christopher Friedt 3315f8fecf kernel: pipe: read_avail / write_avail syscalls
These helper functions may clarify how much data is available to read
from or write to the circular buffer of a k_pipe.

Fixes #25036

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-05-07 19:39:53 +02:00
Vinayak Kariappa Chettimada ba4e8ff2fd Bluetooth: Add identifiers for Bluetooth 5.2
The Bluetooth 5.2 specification was recently released, and has a new
version identifier (11) assigned to it in the Bluetooth Assigned
Numbers.

Relates to commit fa241f0249 ("bluetooth: Add decoding for BLE 5.2
version string")

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-05-07 19:26:13 +03:00
Andreas Sandberg d3c6cfc0ee drivers: lora: Add a continuous wave test API
Add an API to transmit a continuous wave at a fixed frequency. This
functionality is useful to test the radio in a lab setup.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-05-07 14:49:06 +02:00
Sandeep Tripathy bd985dcd67 drivers: add GIC V3 driver
Add basic driver for GIC V3 interrupt controller.

This implementation supports
 - distributor, re-distributor and cpu interface initialization
 - configuration and handling of SPI, PPI and SGI.
 - V2 Legacy mode is not supported and uses system interface.

Current implementation supports GIC secure state only.
All interrupts are routed to Secure EL1 as 'irq' by configuring
them as Group1 Secure.

TODO:
- MPIDR based affinity routing setting.
- percpu redistributor probe
- message based SPI and SGI generation api
- EL1NS support. Legacy mode support.
- LPI/ITS is not supported.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-05-07 14:22:53 +02:00
Emil Obalski 45bdb23005 usb: Special return values for custom_handler
This commit introduces dedicated return type for custom_handler.
Relevant code is updated to fulfill the API documentation.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-07 11:20:27 +02:00
Emil Obalski 8fa51bca58 usb: Allow Audio Class to handle custom_hander for all interfaces
This exception allows USB Audio Class to properly respond to the
interface requests.

This commit is temporary solution and shall not be considered as
valid solution for other classes.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-07 11:20:27 +02:00
Carles Cufi 9ba20dd48e drivers: audio: Port to the new timeout API
Port the I2S and DMIC drivers to the new timeout API so that they do
not need to enable legacy timeouts.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi 6aa8f11c93 drivers: video: Remove legacy timeout use
Stop using the legacy timeout option in the video drivers.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi 9b096f40b6 timeouts: Port UART async API to the new timeout API
Port the API to the new paradigm as to avoid having to select
LEGACY_TIMEOUT_API.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi 9b04a99243 timeouts: Port BBC micro:bit to the new timeout API
Port the BBC micro:bit display driver to the new timeout API exposed by
the kernel.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Peter Bigot e052c7991c settings: add const qualifier for unmodified data source
Code using this API to set a key to a value that is a string literal
produces errors in C++ because the passed pointer is not const
qualified, allowing the possibility that the callee modifies the
referenced string literal memory.  Add the required const qualifiers
since the set function does not change the passed to it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-07 10:51:49 +02:00
Simon Glass fc0e10d064 shell: Support output using a va_list
At present it is not possible to write a printf()-like function in
board code which outputs to the shell. Add shell_vfprintf() to permit
this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-07 10:04:28 +02:00
Simon Glass 2a8463e2b8 shell: Extend dummy backend to record for testing
It is useful to run tests which generate shell output and check that it
is correct. Update the existing 'dummy' backend to support this.

It works by retaining the output in a small buffer so that it can be
read and checked by the test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-07 10:04:28 +02:00
Luiz Augusto von Dentz 1c35cc18fe Bluetooth: hci_raw: Split TX into ACL and CMD pools
This might reduce the footprint if the supported sizes are different.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-07 10:31:36 +03:00
Martí Bolívar 87e1743ae0 devicetree: replace DT_HAS_DRV_INST with DT_INST_FOREACH
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>
2020-05-06 17:35:08 -05:00
Wayne Ren e43e137d8b arch: arc: remove MPU_STACK_GUARD for ARC_MPU_VER 2
ARC_MPU_VER 2 has a strong requirement in
  * size, must be >= 2048 bytes and power of 2
  * start address must be aligned to size

It may bring a big waste of memory.

On the other hand, GEN_PRIV_STACK is used for ARC_MPU_VER 2,
it conflicts with MPU_STACK_GUARD.

So considering the limmitations, remove MPU_STACK_GUARD for
ARC_MPU_VER 2

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-06 12:51:05 -07:00
Wayne Ren 7633da7046 arch: arc: ARC MPUv3 doesn't use GEN_PRIV_STACK
Because ARC MPUv3 doesn't have a strong alignment requirement
as ARC MPUv2 does, no use of GEN_PRIV_STACK for it.

Without GEN_PRIV_STACK, all stack elements can be in one stack object.
See #24048.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-06 12:51:05 -07:00
Wayne Ren 99dd392825 arch: arc: use the way of GEN_PRIV_STACK for privilege stack
drop the original C macro based allocation of privilged stack as
it may cause the waste of memory for ARC MPUv2.

now use the way of GEN_PRIV_STACK to generate privilege stack as
other archs did, e.g. ARM.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-06 12:51:05 -07:00
Joakim Andersson a2a7cc9fe6 Bluetooth: host: Only persist advertising with bt_le_adv_start API
Only persist advertising when the bt_le_adv_start API is used to start
the advertiser. For multiple advertising set a connectable advertiser
can only be started if there is a connection object available for the
advertiser. Leave the decision on which advertising set should be
advertising up to the application instead of suspending advertising
when no connection object is available.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-06 17:08:49 +03:00
Krzysztof Chruscinski fa3729fd11 sys: util: Add missing doxygen tags
Some macros were missing doxygen tag.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-06 14:30:18 +02:00
Krzysztof Chruscinski 32d9da7224 sys: util: Deprecate MACRO_MAP
MACRO_MAP has the same functionality as FOR_EACH macro. Removed macro
implementation and replaced with FOR_EACH call.

Deprecated macro to avoid having two macros with the same
functionality.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-06 14:30:18 +02:00
Krzysztof Chruscinski ae6749f65f logging: Replace MACRO_MAP with FOR_EACH
In process of deprecating MACRO_MAP macro which has same functionality
as FOR_EACH macro, replaced MACRO_MAP with FOR_EACH.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-06 14:30:18 +02:00
Krzysztof Chruscinski 69577eb619 sys: util: Update FOR_EACH and FOR_EACH_FIXED_ARG implementation
Updated implementation of FOR_EACH and FOR_EACH_FIXED_ARG to use same
engine as FOR_EACH_IDX macro.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-06 14:30:18 +02:00
Krzysztof Chruscinski 925540a112 sys: util: Add FOR_EACH_IDX and FOR_EACH_IDX_FIXED_ARG macros
Added macros which iterate over provided parameters and call specific
macro with this parameter, index and fixed argument
(FOR_EACH_IDX_FIXED_ARG).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-06 14:30:18 +02:00
Kumar Gala fdd85d5ad7 dts: Rename DT_HAS_NODE macro to DT_HAS_NODE_STATUS_OKAY
Rename DT_HAS_NODE to DT_HAS_NODE_STATUS_OKAY so the semantics are
clear.  As going forward DT_HAS_NODE will report if a NODE exists
regardless of its status.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-06 05:25:41 -05:00
Håkon Øye Amundsen 0aa21a632a dfu: use stream_flash in flash_img
Leverage strem_flash in flash_img.c to reduce code size.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-05-06 11:14:00 +02:00
Håkon Øye Amundsen a9676831cb storage: add stream flash library
This library supports stream writes to flash with
optinal progressive erase.

This module is a direct copy of the functionality found in
subsys/dfu/img_util/flash_img.c

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-05-06 11:14:00 +02:00
Alexander Wachter 464f135ce6 canbus: Convert canbus driver and subsys to new timeout API
Convert all canbus related API/samples/tests/subsys
to the new timeout API with k_timeout_t.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-05-06 10:19:13 +02:00
Kumar Gala 339e3f79eb riscv: linker: replace DT_FLASH_{BASE_ADDRESS,SIZE} with new macros
The riscv linker scripts utilize DT_FLASH_BASE_ADDRESS and
DT_FLASH_SIZE, as we want to phase out the old generator we need to
replace these defines with macros from devicetree.h.

We support two flash configurations at this point, either a QSPI flash
like on the hifive board or a SoC flash like on the rv32m1_vega.  We
update the linker scripts to check the compat of the zephyr,flash node
and based on if its 'jedec,spi-nor' or 'soc-nv-flash' we determine how
to extract the "flash" base address and size.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-05 09:23:32 -05:00
Lukasz Maciejonczyk ae68354428 net: l2: openthread: Add function for getting openthread default instance
The new function simplifies use of OpenThread API in Zephyr.

Signed-off-by: Lukasz Maciejonczyk <Lukasz.Maciejonczyk@nordicsemi.no>
2020-05-05 16:30:20 +03:00
Jukka Rissanen 65a1bebe85 net: Replace NET_WAIT_FOREVER by SYS_FOREVER_MS
As we now have SYS_FOREVER_MS, use that instead of network
specific NET_WAIT_FOREVER.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-05 16:29:23 +03:00
Jukka Rissanen 8160385b57 net: pkt: Fix removal of empty buffers in net_pkt_pull()
If we have removed first net_buf, then we must not restore the
original cursor as that will point to wrong head net_buf.
Add also unit test to check that the packets are removed
properly.
Clarify the documentation that we are removing data from
beginning of the function, also document that the cursor
is reset after this call.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-05 13:39:45 +03:00
Jukka Rissanen fdf184858e kernel: Fix k_thread_resource_pool_assign() documentation
The k_thread_resource_pool_assign() parameters were incorrectly
documented. Part of the thread parameter description should have been
in memory pool variable documentation.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-04 14:49:28 -07:00
Joakim Andersson ee9326d8c0 Bluetooth: host: Fix BT_CONN_LE_OPT_NONE renamed issue
Fix BT_LE_CONN_OPT_NONE renamed to BT_CONN_LE_OPT_NONE missed in 2
places in conn.h

Regression from commit: fdb3da8aff

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-04 21:07:55 +03:00
Parthiban Nallathambi 84da7e362f stm32_pinctrl: remove duplicate definition
remove duplicate definition of STM32PIN

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-05-04 19:49:14 +02:00
Manivannan Sadhasivam 7be8debaab lora: Switch to new timeout API
Get rid of legacy timeout API and move to new timeout API for LoRa.
This involves changes to API, SX1276 driver and sample application.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-05-04 19:01:09 +02:00
Frank Li a298c890ee arm: linker.ld: move bss section to ram end
fix bss section be copy to binary.

When compiling with non-xip.
All sections will be placed in the ram.
If NOBITS section isn't placed at the end of ram,
objcopy will placed these section to binary file.

The modify only for no-userspace.
In userspace the section will be adjust,
kobject_data size increase,
the bss be shifted, the content of kobject_data
will no mactch to kernel obj of bss.

Signed-off-by: Frank Li <lgl88911@163.com>
2020-05-04 18:46:40 +02:00
Joakim Andersson fdb3da8aff Bluetooth: host: Rename BT_LE_CONN_OPT to BT_CONN_LE_OPT
Rename connection options to be consistent with the rest of the API
names in conn.h

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-04 17:48:22 +03:00
Joakim Andersson 8b70079ebe Bluetooth: host: Remove BT_LE_CONN_OPT_2M option
Remove the BT_LE_CONN_OPT_2M option and update documentation.
This was a misunderstand about the init PHY HCI parameter.
The init PHY in the extended connection create command does not
determine which PHYs are accepted as the initial PHY of the
connection. This is instead determined by the secondary PHY of the
extended advertiser.
The init PHY parameter only specifies which conn parameters are
provided, and since we only provide one conn parameter this option
has no effect.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-04 17:48:22 +03:00
Luiz Augusto von Dentz ec5603da8d Bluetooth: L2CAP: Add status flag to track encrypt pending
This adds a new flag to track if the L2CAP channel is pending waiting
for encryption to be changed to resume connecting.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Luiz Augusto von Dentz e0cbdf3b87 Bluetooth: GATT: Add support for new PDUs
This adds support for ATT_MULTIPLE_HANDLE_VALUE_NTF,
ATT_READ_MULTIPLE_VARIABLE_REQ and ATT_READ_MULTIPLE_VARIABLE_RSP.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Luiz Augusto von Dentz f4192bda26 Bluetooth: ATT: Add support EATT bearer
This adds support for EATT bearer which was introduced in 5.2, they work
as extra channels to have GATT traffic, at the moment it is completely
transparent to application when they are in use since the allocation
happens automatically.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Luiz Augusto von Dentz d148f8648b Bluetooth: ATT: Add definitions from 5.2
This adds the definitions for Enhanced ATT along with new PDUs and UUIDs
introduced in 5.2.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Luiz Augusto von Dentz 14d6c00b9b Bluetooth: L2CAP: Add released callback
This adds a callback to indicate when the stack has released all
references to a given channel so the owner free up any resources
associated with that.

This is requires since EATT channels cannot rely on the destroy callback
as it does not use a fixed channel like ATT.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Luiz Augusto von Dentz f7586b0b04 Bluetooth: L2CAP: Add initial implementation of ECRED mode
This adds the initial implementation of ECRED mode which can connect up
to 5 channels simultaneously and is required by EATT.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Joakim Andersson 78a6cdb07c Bluetooth: host: Avoid use of array compound literals in API
Attempt to fix C++ error: taking address of temporary array.

According to GCC documentation:
  In C++, a compound literal designates a temporary object that only
  lives until the end of its full-expression.

Finishing with this recommendation:
  As an optimization, G++ sometimes gives array compound literals
  longer lifetimes: when the array either appears outside a function
  or has a const-qualified type.
  But it is probably safest just to avoid the use of array compound
  literals in C++ code.

Fix the issue by introducing INIT macros as an alternative, and use
these in the inline functions to avoid the use of array compound
literals in Bluetooth headers.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-02 13:08:59 +03:00
Kumar Gala e7332f924b soc: arc: Use new dts macros in linker scripts and arc_mpu_regions
Convert linker scripts and arc_mpu_regions.c setup to use new
devicetree.h macros to extract the base address and size of the various
memory regions (DDR, SRAM, FLASH, DCCM, ICCM).  We also remove the
scaling up and down since DT_REG_SIZE() returns the value in bytes.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 13:29:48 -05:00
Stephanos Ioannidis 8b27d5c6b9 linker: Clean up section name definitions
This commit cleans up the section name definitions in the linker
sections header file (`include/linker/sections.h`) to have the uniform
format of `_(SECTION)_SECTION_NAME`.

In addition, the scope of the short section reference aliases (e.g.
`TEXT`, `DATA`, `BSS`) are now limited to the ASM code, as they are
currently used (and intended to be used) only by the ASM code to
specify the target section for functions and variables, and these short
names can cause name conflicts with the symbols used in the C code.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-30 13:42:36 -04:00
Peter Bigot 842c42d7f0 documentation: fix wrong recommendation for millisecond timeouts
API documentation for parameters that accept a duration specified in
milliseconds is updated to replace references to K_NO_WAIT with 0, and
K_FOREVER with SYS_FOREVER_MS.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-30 18:26:26 +02:00
Kumar Gala 3dd2f610b0 x86: Cleanup linker scripts to use new DTS macros
Rework x86 linker scripts to use DT_REG_ADDR/DT_REG_SIZE on
DT_CHOSEN(zephyr_sram) and DT_CHOSEN(zephyr_flash).  As part of this
we remove the dts_fixup.h.  Using DT_REG_SIZE means we don't have to
adjust the sizes by 1024.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 08:37:18 -05:00
Kumar Gala a45ea3806f x86: Rework rework x86 related code to use new DTS macros
Replace DT_PHYS_RAM_ADDR and DT_RAM_SIZE with DT_REG_ADDR/DT_REG_SIZE
for the DT_CHOSEN(zephyr_sram) node.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 08:37:18 -05:00
Kamil Piszczek 3223c43af2 bluetooth: uuid: add ots related uuids
This change contains UUID definitions for Object Transfer Service.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-04-30 13:34:38 +02:00
Joakim Andersson 89d1bbc639 Bluetooth: doc: Fix detailed API description rendered into text boxes
Fix detailed API description rendered into text boxes.
API documentation with more that one paragraph must use the @brief tag
to be rendered correctly.
Fix indentation level of '*' in doxygen documentation.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:34:28 +02:00
Joakim Andersson 28e99b7efb Bluetooth: doc: Include gap.h and addr.h in documentation build
Add gap.h and addr.h to the Generic Access Profile part of the
documentation build.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:34:28 +02:00
Bilal Wasim 220b664617 net: tftp: Adding support for TFTP Client.
Adding RFC1350 compliant support for TFTP Client in Zephyr. The
current implementation is minimal and only supports the ability
to get a file from the server.

Things for the future include support for putting files to
server and adding support for RFC2347.

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-04-30 14:19:46 +03:00
Joakim Andersson 87d9eadf50 Bluetooth: mesh: Convert bluetooth mesh to using k_timeout struct
Convert bluetooth mesh to using k_timeout struct. Many of the mesh
modules uses timeout calculations, so it is most practical to keep
the s32_t type and only initialize a k_timeout_t struct when
calling the kernel.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:46:48 +03:00
Joakim Andersson d858264d9e Bluetooth: host: Convert bluetooth host to using k_timeout_t struct
Convert bluetooth host to using k_timeout_struct for the timeout values.
This is mostly replacing s32_t with k_timeout_t.
In l2cap the handling of no timeout in send channel request was removed
since the timeout is both documented as minimum of 1 second and never
given any no timeout value.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:46:48 +03:00
Joakim Andersson 666c0f8f60 include: sys: Fix SYS_TIMEOUT_MS macro definition
Fix SYS_TIMEOUT_MS macro not compiling.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:46:48 +03:00
Kumar Gala 3f236f2183 can: dts: Convert can-primary alias to zephyr,can-primary chosen prop
Convert CAN to use a chosen node property that is similar to how we
handle zephyr,entroy or zephyr,flash-controller as the means to select a
specific peripheral instance utilized by a subsystem.

Replace references of the form:

alias {
	can-primary = &can1;
};

with:

chosen {
	zephyr,can-primary = &can1;
};

Replace various macro/define references with either
DT_CHOSEN(zephyr_can_primary) or replace DT_ALIAS_CAN_PRIMARY_LABEL
with DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-29 14:27:31 -05:00
Kumar Gala 689f93bc33 devicetree.h: pwms: Add DT_PWMS_ macros
Add DT_PWMS macros to be used in pwm clients drivers.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-29 13:11:22 -05:00
Carles Cufi 1ed6a3889b include: sys: Add SYS_FOREVER_MS and SYS_TIMEOUT_MS macros
Add a macro that represents a system-wide forever wait for millisecond
timeouts, and a second one that converts from ms to kernel timeout
units.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-29 15:28:02 +03:00
Kumar Gala b7626df483 drivers: timer: arm: Convert to new DTS macros
Convert old style defines for IRQ numbers to using DT_IRQN and
DT_INST to extract IRQ numbers.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-28 20:40:35 -04:00
Kiril Petrov 7305e7b4a2 net: coap: add coap_pendings_clear and coap_replies_clear
Clears whole stack of pendins and replies.

Signed-off-by: Kiril Petrov <retfie@gmail.com>
2020-04-28 20:46:35 +03:00
Sandeep Tripathy d4f1f2a07e arch: arm64: add public header for asm macros
Move generic macros to exported assembly header file
'macro.inc'. Rename the existing 'macro.inc' to 'macro_priv.inc'.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-04-28 10:44:42 -07:00
Sandeep Tripathy 3dface77ae arch: arm64: basic synchronization barriers
Add __DSB system wide berrier.
Move the barrier macros to inline function header.

TODO: add more granular oneway barriers.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-04-28 10:44:42 -07:00
Sandeep Tripathy c4e0b28bb5 arch: arm64: add GIC ICC system register accessors
-Add GIC system register defines.
-Add sysreg read write macros.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-04-28 10:44:42 -07:00
Joakim Andersson 27ef15b8f5 debug: thread_analyzer: Implement thread analyzer
Thread analyzer is simple module that helps in printing thread
information, like stacks usage statistics.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
Signed-off-by: Bartosz Gentkowski <bartosz.gentkowski@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-28 09:11:13 -04:00
Tobias Svehagen ca872a44c1 lib: posix: Add support for eventfd
This implements a file descriptor used for event notification that
behaves like the eventfd in Linux.

The eventfd supports nonblocking operation by setting the EFD_NONBLOCK
flag and semaphore operation by settings the EFD_SEMAPHORE flag.

The major use case for this is when using poll() and the sockets that
you poll are dynamic. When a new socket needs to be added to the poll,
there must be some way to wake the thread and update the pollfds before
calling poll again. One way to solve it is to have a timeout set in the
poll call and only update the pollfds during a timeout but that is not
a very nice solution. By instead including an eventfd in the pollfds,
it is possible to wake the polling thread by simply writing to the
eventfd.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-04-28 09:57:41 +03:00
Robert Lubos df152ab59f net: coap: Add initial tx time to coap_pending structure
So far, coap_pending structure kept track only of the timeout interval
between two consecutive retransmissions. Calculations inside
`coap_pending_next_to_expire` relied only on this value. This approach
gives incorrect results though, in case multiple messages are pending
for retransmission.

For instance, assuming initial retransmission timeout is set to 2
seconds. If some message had been retransmitted already, its timeout
would be increased to 4 seconds. Any new message added to the pending
list would have a retransmission timeout set to 2 seconds, and will be
returned as a first message to expire, no matter how long the initial
message was already on the list.

To resolve this, add a `t0` field to the coap_pending structure. This
field is initialized to the initial transmission time, and is increased
on each retransmission by the retransmission timeout.
`coap_pending_next_to_expire` uses this value to calculate absolute
time, when the next retransmission should take place, and based on this
information returns correctly first pending message to expire.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-04-28 09:50:45 +03:00
Kumar Gala 7a15afc1d4 drivers: flash: replace DT_FLASH_DEV_NAME with DT macro
Replace DT_FLASH_DEV_NAME with DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL.
We now set zephyr,flash-controller in the chosen node of the device
tree to the flash controller device.

NOTE: For a SoCs with on die flash, this points to the controller and
      not the 'soc-nv-flash' node.  Typically the controller is the
      parent of the 'soc-nv-flash' node).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-27 18:43:20 -05:00
Peter A. Bigot 008f9c08a2 kernel: use designated initializers consistently
Use of the K_POLL_EVENT initializers in C++20 code causes a diagnostic
since C++ requires consistent use of designated initializers.  As the
initialized object is an anonymous union there is no member name to
use, but neither is one required.  Initialize the member without
wrapping it in braces as with an initializer list.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-04-27 15:03:33 -07:00
Stephanos Ioannidis 0e6ede8929 kconfig: Rename CONFIG_FLOAT to CONFIG_FPU
This commit renames the Kconfig `FLOAT` symbol to `FPU`, since this
symbol only indicates that the hardware Floating Point Unit (FPU) is
used and does not imply and/or indicate the general availability of
toolchain-level floating point support (i.e. this symbol is not
selected when building for an FPU-less platform that supports floating
point operations through the toolchain-provided software floating point
library).

Moreover, given that the symbol that indicates the availability of FPU
is named `CPU_HAS_FPU`, it only makes sense to use "FPU" in the name of
the symbol that enables the FPU.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-27 19:03:44 +02:00
Peter A. Bigot e3d613e1f4 subsys/cfb: move MSB_FIRST down to font capabilities
Font capabilities currently indicate whether font data is packed
horizontally or vertically, and this is used to control frame buffer
updates.  The font bit ordering should likewise be recorded in the font
description, and any reversal to match the display applied when text is
being set in the frame buffer.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-04-27 13:27:03 +02:00
Kumar Gala 9b4298c20d arm: Convert DT_CCM_* to new devicetree.h macros
Convert various DT_CCM_* macros to use DT_CHOSEN(zephyr_ccm) and
associated macros from devicetree.h.

We remove CCM references from cortex_a and cortex_r linker scripts as
its only a feature on Cortex-M STM32 SoCs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-26 06:04:46 -05:00