Commit graph

47431 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada 6bc79ce33a Bluetooth: Define assigned number values of BIGInfo and Broadcast Code
Add defines for assigned number values of BIGInfo and
Broadcast Code.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-08 16:38:19 +02:00
Maik Vermeulen f03d1177d0 net: lwm2m: Direct firmware_transfer() call instead of work-item
The LwM2M firmware pull object no longer uses the system workqueue
to execute firmware_transfer(), but directly executes it itself.
Previously, the workqueue would be blocked because firmware_transfer()
indirectly calls a blocking connect(). This would lead to problems
with e.g. modem drivers that use UART to interface with the modem
hardware, as some UART drivers use the workqueue.

Fixes #31053.

Signed-off-by: Maik Vermeulen <maik.vermeulen@innotractor.com>
2021-01-08 15:46:57 +02:00
Anas Nashif 7aaead1e81 soc: intel_cavs: use correct config for V15
Use SOC_INTEL_CAVS_V15 instead of SOC_INTEL_CAVS_APL.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-08 07:49:19 -05:00
Anas Nashif b2a5782570 ci: remove west extension call
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-08 07:49:19 -05:00
Anas Nashif c078eb9f3b samples: audio: sof: add filter
Build only for relevant platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-08 07:49:19 -05:00
Anas Nashif 92da29dbf1 sof: remove west extension
sof module now has rimage integrated until issue with submodules is
resolved.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-08 07:49:19 -05:00
Flavio Ceolin 6bf34a6258 arc: power: Remove dead code
Removing dead code to handle deep sleep. This option is never enabled
and it is broken.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-08 06:49:43 -05:00
Flavio Ceolin 47e0621bb7 power: Remove not used build option
There is no usage of BOOTLOADER_CONTEXT_RESTORE since quark support
was removed.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-08 06:49:43 -05:00
Flavio Ceolin 28cf88183a x86: power: Remove dead code
X86 currently has no support for deep sleep states, just removing this
dead code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-08 06:49:43 -05:00
Vasilyev, Pavel d593af30db Bluetooth: Mesh: Fix typo when deleting app key in CDB
This commit sets `net_idx` to `BT_MESH_KEY_UNUSED` when deleting app key in
cdb.

Signed-off-by: Vasilyev, Pavel <pavel.vasilyev@nordicsemi.no>
2021-01-08 13:16:46 +02:00
Jukka Rissanen d904f95562 net: tcp2: Mark tcphdr struct as packed
As the tcp header struct can be cast to unaligned memory, mark
it as packed and access fields using UNALIGNED_GET/PUT when
needed.

Fixes #31145

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-01-08 11:31:43 +02:00
Christian Taedcke d969aced6d dts: silabs: Fix wrong gpio interrupt numbers
The interrupt numbers for two socs for the gpio peripheral was wrong.
This commits corrects this issue for the relevant socs.

Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2021-01-07 16:54:23 -06:00
Christian Taedcke 0c17b3681c dts: silabs: Fix invalid nodes in gpio node
The watchdog and rng nodes were a sub-node of the gpio node.
This commits corrects this issue for the relevant socs.

Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2021-01-07 16:54:23 -06:00
Krzysztof Chruscinski 712ff3298b doc: kernel: other: ring_buffers: Add Kconfig option description
Added section with configuration options.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-01-07 16:54:59 -05:00
Thomas Stranger 13a5d05757 boards: nucleo_g071rb: enable adc support
Enable ADC on Nucleo G071RB board(ADC1 channel 0 and 1)

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-01-07 15:50:22 -06:00
Thomas Stranger 4ed375040e drivers: adc: stm32: add support for stm32g0 series
Adds support for ADC on G0 series.
Simple implementation: sequencer not fully configurable,
and only one common sampling time.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-01-07 15:50:22 -06:00
Erwan Gouriou 56c3c8b2e3 boards: stm32: Remove default PWM configuration
PWM, as other peripherals should not be enabled as part of
default board configuration.
Fix this.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-07 15:46:43 -06:00
Johan Hedberg 4ba387829b edtlib: Match any parent bus when binding lacks an explicit on-bus
There are some drivers in the tree that support devices on multiple
different buses, although so far this has not been represented in
device tree using the bus concept. In order to convert these drivers &
bindings to refer to a formal bus in device tree we need to be able to
match bindings which lack an explicit "on-bus: ..." value against any
parent bus. This will also be needed for any external bindings, since
those would not be aware of on-bus (as it's a Zephyhr-specific
extension).

The two drivers I'm particularly targeting is the ns16550 UART driver
(drivers/serial/uart_ns16550.c) and the DW I2C driver
(drivers/i2c/i2c_dw.c). They both support devices with a fixed MMIO
address as well as devices connected and discovered over PCIe. The
only issue is that instead of encoding the bus information the proper
DT way these bindings use a special "pcie" property in the DT node
entries to indicate whether the node is on the PCIe bus or not.

Being able to convert the above two drivers to use the DT bus concept
allow the removal of "hacks" like this:

 if DT_INST_PROP(0, pcie) || \
       DT_INST_PROP(1, pcie) || \
       DT_INST_PROP(2, pcie) || \
       DT_INST_PROP(3, pcie)

to the more intuitive:

 if DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie)

This also has the benefit that the driver doesn't need to make any
arbitrary assumptions of how many matching devices there may be but
works for any number of matches. This is already a problem now since
e.g. the ns16550 driver assumes a maximum of 4 nodes, whereas
dts/x86/elkhart_lake.dtsi defines up to 9 different ns16550 nodes.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-07 20:07:12 +02:00
Flavio Ceolin 2b49266861 power: Add notifier API
Get rid of weak functions adding a new API to register an object to
receive notifications when the system changes power state.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-07 12:40:19 -05:00
Vinayak Kariappa Chettimada 8a5154d71c Bluetooth: controller: Add missing initialization of ISO sync
Add missing initialization of ISO sync context to be
established.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 18:02:34 +01:00
Vinayak Kariappa Chettimada c709d4f85f Bluetooth: controller: Rename periodic adv rx enable flag
Rename the Periodic Advertising Rx Enable flag from
is_enabled to is_rx_enabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 18:01:44 +01:00
Vinayak Kariappa Chettimada 44492c8324 Bluetooth: controller: Rename supported ISO Sets Kconfig
Rename Kconfig BT_CTLR_SCAN_SYNC_ISO_MAX to
BT_CTLR_SCAN_SYNC_ISO_SET, to be consistent with other
Kconfig naming.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 18:01:10 +01:00
Vinayak Kariappa Chettimada 32a79dd7e3 Bluetooth: controller: Fix AUX_CONNECT_RSP PDU buffer size
AUX_CONNECT_RSP PDU static buffer definition was missing one
byte required for the Extended Header Flags.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 18:00:35 +01:00
Vinayak Kariappa Chettimada 5d3d9b7522 Bluetooth: controller: Internal documentation of node rx count
Document with comments, the explanation of node rx count and
the design of the free rx PDU management.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:59:59 +01:00
Vinayak Kariappa Chettimada bc71d39d81 Bluetooth: controller: Fix free Rx PDU queue starvation
Fix for scenarios where in active PHY Update Procedure or
Connection Update Procedure could cause temporary depletion
of the free Rx PDUs in the queue between LL/HCI thread
context to LLL context. Symptoms being on-air NACKing during
the above said procedures, causing supervision timeouts due
to procedures not completing at instants.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:59:59 +01:00
Vinayak Kariappa Chettimada 2a99857cad Bluetooth: controller: Refactor PA/LNA PPI configuration
Refactor the implementation of PA/LNA PPI configuration
which was done on every Tx or Rx as common code to be
executed once per radio reset. And only setup the timeout
and enabling of PPI at every Tx or Rx.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:59:20 +01:00
Vinayak Kariappa Chettimada 5470444e6a Bluetooth: controller: PA/LNA use NRF_P0/P1 define
For PA/LNA implementation use NRF_P0/P1 defines instead of
the deprecated NRF_GPIO to reference GPIO Port 0 registers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:58:24 +01:00
Vinayak Kariappa Chettimada e51295a309 Bluetooth: controller: Fix missing GPIOTE channel disable
Fix the missing GPIOTE channel disable when GPIOTE channel
is alternately used between PA and LNA use.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:58:01 +01:00
Vinayak Kariappa Chettimada f265b178c3 Bluetooth: controller: Fix regression in PA/LNA support
Fix regression in PA/LNA support wherein the GPIO pins where
left in undefined state after each radio event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:57:29 +01:00
Vinayak Kariappa Chettimada e14be4477a Bluetooth: controller: Fix missing call to radio_setup interface
Fix regression, add back missing call to radio_setup HAL
interface. This is needed to setup the initial PA/LNA GPIO
states.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:56:57 +01:00
Vinayak Kariappa Chettimada 108d431902 Bluetooth: controller: nRF52811: Errata Id 164 not applicable
nRF52840 Engineering A Errata Id 164 is not applicable to
nRF52811 SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:56:03 +01:00
Martí Bolívar 7097e1785d doc: improve west's repo-tool.rst
Various improvements to the west repo-tool.rst page and pages that
link to it:

Rename the page title to "Basics", since it documents, well the
basics, including built-in commands like "help" an "config" that are
not directly related to multiple repositories.

The "multi-repo" term was invented before we started using
"workspace". Drop it from the text and rework things using words like
"workspace", "basics", or "built-ins" instead, which read better.

We've been using west for a long enough time that justifying its
existence prominently at the start of this page is no longer
necessary; move that to the "dustbin of history" page (why.rst).

Try harder to clarify exactly what a "project" is, along with other
workspace related clarifications.

Improve the documentation for the west init and west update commands,
and create :ref: targets for linking directly to them for convenience
elsewhere in the docs.

Slim down the usages for other built-in commands, so we don't have to
keep those up to date as carefully each release. This is about to be
important for west 0.9, which is going to change the detailed
semantics for the "[PROJECT ...]" part of each command synopsis in a
way that will be inconvenient to duplicate for each of these.

Move the "Topologies supported" content lower down. Try to help the
reading flow by letting people get familiar with a workspace and what
you can do with it using the Zephyr GSG workspace that they probably
already have before overwhelming them with other possibilities and
choices.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-07 17:16:35 +01:00
Steve Winslow 476e9e80d1 samples: net: Fix vlan error message in samples
This fixes an incorrect error message log statement for IPv4 vs.
IPv6 in several net samples.

The error message is in a portion of the files dealing with IPv4
bring-up. If the address is invalid, it logs the invalid address;
however, the IPv4 statement incorrectly refers to ipv6_addr. This
PR corrects it to output ipv4_addr as expected.

Signed-off-by: Steve Winslow <steve@swinslow.net>
2021-01-07 09:52:21 -06:00
Jefferson Lee 35c5fbe554 boards: Add the Arduino Nano BLE 33
This commit adds the board definition files
needed to support the Arduino Nano BLE 33.
Tested: the following have been verified with
my logic analyzer.
* Serial peripherals (UART, I2C, SPI)
* USB
* RTC

Untested:
* PWM. In theory it should work but I don't
have a good enough logic analyzer to test this

* RTC's. The board doesn't have a backup battery.
The peripherals are enabled for modding another
battery in the device tree.

Signed-off-by: Jefferson Lee <jeffersonlee2000@gmail.com>
2021-01-07 09:46:22 -06:00
Bilal Wasim f4a26837c8 boards/arm: Adding Contextual Electronics Advanced BLE Cell board to Zephyr
This commit adds supports for the nRF52840 based BLE Cell board from
Contextual Electronics. This board contains support for BG95 Modem,
BQ52895 charger, SD card etc and can be used as a PI Hat.

In this commit, this board supports UART, I2C, SPI, Modem. Support
for charger, SD card and other things will be added later.

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2021-01-07 15:14:23 +01:00
Peter Bigot 6297c667c5 lib: os: cbprintf: correct arg extraction of wide characters
The l length modifier can apply to the c format specifier; in that
case the expected value is of type wint_t.  Minimal libc doesn't
define wint_t, and it is complex to do so correctly (must add
<wchar.h>, and use a lot of conditional tricks).

wint_t can differ from wchar_t in rank when wchar_t undergoes default
integral promotion, which it does on xtensa (wchar_t is unsigned
short).  So we can use wchar_t as an approximation, except in va_arg
where we need to use a wider type: int covers this case.

Note that we still don't format wide characters, but we do want to
consume the correct amount of data for a default-promoted extended
character.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Peter Bigot 8eda19a898 lib: os: cbprintf: correctly handle signed vs unsigned char
Whether char is signed or unsigned is toolchain and target specific.
Rather than assume it's signed (which is true for x86, but not for
ARM), do the right thing based on whether the minimum representable
value is less than zero.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Peter Bigot b036afba5a lib: cbprintf: document length modifiers
It may not be clear that the length modifiers reference native C types
with specific ranks.  Document the core type for each modifier.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Peter Bigot d12a99588b lib: cbprintf: remove cbprintf_arglen
This function was designed to support the logging infrastructure's
need to copy values from va_list structures.  It did not meet that
need, since some values need to be changed based on additional data
that is only available when the complete format specification is
examined.  Remove the function as unnecessary.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Peter Bigot 0bc01822a2 lib: cbprintf: improve coverage
Providing a literal width or precision that exceeds the non-negative
range of int does not appear to be rejected by the standard, but it
does produce a build diagnostic so we can't test it.  Switch to an
equivalent form that doesn't affect line coverage.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Peter Bigot 9e5b50afc8 tests: cbprintf: avoid checkpatch diagnostic
checkpatch wants parameters to IS_ENABLED() to be Kconfig constants,
i.e. ones that start with CONFIG_.  Avoid the whinage.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Peter Bigot 5f493c669d tests: cbprintf: make skip messages consistent
TC_PRINTF doesn't append a newline, so the skip messages sometimes ran
into the test result message.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Peter Bigot 928183b8ca tests: cbprintf: sanitize language
Replace SANITYCHECK flag with TWISTER.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Joakim Andersson 577cd82b0d Bluetooth: host: Fix crash when receiving response after ATT timeout
Fix crash in ATT when the response for a request is received after
the ATT timeout has fired and the ATT channel has been detached.
Add similar handling for all ATT channel operations.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-07 13:51:18 +01:00
Lingao Meng 8b54f08a69 drivers: bluetooth: Add discard mechanism to avoid waiting timeout
The Bluetooth receiving thread may not be able to process broadcast
packets because the system API(bt_hci_cmd_send_sync) is in block state.
If HCI driver is still waiting buffer for adv report, an assertion will
be triggered.

Fixes: #30955

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-01-07 14:44:13 +02:00
Peter Bigot d510f1f84d net: if: tweak DAD and RS timeout handling
Both RS and DAD timeouts are simplified because the delay is a
constant, and by construction the list of timeouts is in increasing
time remaining.

Refactor to avoid repeating the expression that represents the time
until DAD state expires.  Uniformly use unsigned operands in deadline
calculation.

Note a case where the racy idiom for retaining an existing timeout is
required in the current work API, but can be replaced with a robust
solution in the proposed new API (the reschedule API replaces any
existing pending update, but the schedule API will leave an existing
scheduled submission in place).

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 11:14:38 +02:00
Peter Bigot 4882dd69af net: if: fix error in calculating router expiration
The existing implementation is inconsistent in that checking for
expired routers when a timeout is processed detects end-of-life
correctly (when the remaining duration exceeds the signed maximum),
but the calculation of time remaining before expiration uses only
unsigned calculation.  So when the set of routers is changed the newly
calculated timeout will not recognize routers that have expired, and
so those routers expired late.  In the worst case if the only
remaining router had expired the timer may be set for almost two
months in the future.

Refactor to calculate remaining time in one place and as a signed
value.  Change a function name to more clearly reflect what it does.
Avoid unnecessary race conditions in k_work API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 11:14:38 +02:00
Peter Bigot acd43cbaac net: timeout: refactor to fix multiple problems
The net_timeout structure is documented to exist because of behavior
that is no longer true, i.e. that `k_delayed_work_submit()` supports
only delays up to INT32_MAX milliseconds.  Nonetheless, use of 32-bit
timestamps within the work handlers mean the restriction is still
present.

This infrastructure is currently used for two timers with long
durations:
* address for IPv6 addresses
* prefix for IPv6 prefixes

The handling of rollover was subtly different between these: address
wraps reset the start time while prefix wraps did not.

The calculation of remaining time in ipv6_nbr was incorrect when the
original requested time in seconds was a multiple of
NET_TIMEOUT_MAX_VALUE: the remainder value would be zero while the
wrap counter was positive, causing the calculation to indicate no time
remained.

The maximum value was set to allow a 100 ms latency between elapse of
the deadline and assessment of a given timer, but detection of
rollover assumed that the captured time in the work handler was
precisely the expected deadline, which is unlikely to be true.  Use of
the shared system work queue also risks observed latency exceeding 100
ms.  These calculations could produce delays to next event that
exceeded the maximum delay, which introduced special cases.

Refactor so all operations that use this structure are encapsulated
into API that is documented and has a full-coverage unit test.  Switch
to the standard mechanism of detecting completed deadlines by
calculating the signed difference between the deadline and the current
time, which eliminates some special cases.

Uniformly rely on the scanning the set of timers to determine the next
deadline, rather than assuming that the most recent update is always
next.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 11:14:38 +02:00
Jordan Yates 9f95d8d029 net: buf: convert #define to static inline
Swap the `net_buf_*` -> `net_buf_simple_*` conversion `#define`s to
`static inline` functions. This is to provide better type checking on
the use of these functions.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-01-07 10:40:48 +02:00
Akseli Peltola 3bcb1efc33 modem: fix socket descriptor leak
z_free_fd() is called twice then you close(). For example in ublox sara
r4 driver offload_close() calls modem_socket_put() where z_free_fd() is
called first time. Then this same function is called another time in
socket.c in z_impl_zsock_close() after this function has called
offload_close() in ublox sara r4 driver. This causes socket
descriptor leak.

Fixes #26819

Signed-off-by: Akseli Peltola <peltsu1324@gmail.com>
2021-01-07 10:36:19 +02:00