Commit graph

21541 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
0da63124d2 Bluetooth: controller: Add ticker allocation for BIG events
Add ticker node allocations for BIG radio event scheduling.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 08:40:28 -04:00
Vinayak Kariappa Chettimada
12f04da828 Bluetooth: controller: Minor rename in BIS PDU data members
Renamed offset and offset_units to offs and offs_unit to be
consistent with rest of the other structures.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 08:40:06 -04:00
Vinayak Kariappa Chettimada
eb5874ca7b Bluetooth: controller: Fix ULL reference decrement on done event
Fix ULL reference count decrement to be performed before the
done events are handled, so that correct reference count is
used to determine if events are pending in the pipeline.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 08:39:41 -04:00
Vinayak Kariappa Chettimada
b0bba245ea Bluetooth: controller: HCI: Allow processing a list of events
Update HCI driver implementation in the controller to
process a list of controller events by traversing net buf
frags.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 08:39:25 -04:00
Vinayak Kariappa Chettimada
323b8efe75 Bluetooth: controller: Reorder feature bits
Reorder Channel Selection Algorithm #2 and Minimum Number of
Used Channels Procedure bits.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 08:38:56 -04:00
Vinayak Kariappa Chettimada
4eca1a821c Bluetooth: controller: Add ticker allocation for BIG Sync events
Add ticker node allocations for BIG Sync radio event
scheduling.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 08:36:43 -04:00
Vinayak Kariappa Chettimada
415e068e16 Bluetooth: controller: Conditional compile ISO Tx functions
Conditional compile ISO Tx related declarations and
implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 08:36:27 -04:00
Eduardo Montoya
a47677da06 net: openthread: add CSL transmitter API
This commit implements the OpenThread APIs to pass MAC keys and
frame counter to the radio layer in order to process the
transmission security. This is needed for the correct functioning
of a CSL transmitter.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-05-05 14:33:47 +02:00
Vinayak Kariappa Chettimada
a4d2e062cb Bluetooth: controller: Fix regression in central initiated terminate
Fix regression in central initiated terminate introduced in
commit 3a80785947 ("Bluetooth: controller: Fix connection
terminate to happen on event done").

The regression caused an additional central connection event
transmitting PDU  after the previous connection event had
received acknowledgment for the terminate_ind PDU from the
peripheral.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 14:21:05 +02:00
Andrzej Kaczmarek
b8dfecfdc5 Bluetooth: conn: Fix invalid ref on conn object
We should unref conn object if skipped during lookup.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-05-05 14:20:05 +02:00
Emil Gydesen
3e6ea470a1 Bluetooth: ISO: Additional text for setting unidir values for the CIG
Add additional text to explain why we use the TX values if RX is
disabled and vice versa.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-05 14:19:38 +02:00
Vinayak Kariappa Chettimada
e5ffc18507 Bluetooth: controller: Do not report Aux PDUs while initiating
Do not report auxiliary PDUs as advertising reports when in
initiator state on auxiliary channels.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 14:15:05 +02:00
Vinayak Kariappa Chettimada
472169befa Bluetooth: controller: Ensure both 1M and Coded PHY can initiate
Ensure that the advertiser address type and address is setup
in both 1M and Coded PHY scanning instance when extended
create connection is enabled on both the PHYs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 14:15:05 +02:00
Vinayak Kariappa Chettimada
a6b8eba7c5 Bluetooth: controller: Implement disabling the other PHY initiator
When connection is initiated in one of either 1M or Coded
PHY initiating scan instance then the other scanning
instance's scheduling and memory allocation needs to be
cleaned up.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 14:15:05 +02:00
Vinayak Kariappa Chettimada
9eb5f85870 Bluetooth: controller: Reserve an additional node rx for Ext. Initiator
Reserve an additional node rx buffer when Extended Initiator
is supported as the received ADV_EXT_IND PDU is being
buffered in the auxiliary channel scanning instance and is
only released/flushed in the done event of the initiating
auxiliary channel radio event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 14:15:05 +02:00
Vinayak Kariappa Chettimada
236755198b Bluetooth: controller: Rename use of params to param
Rename the use of params word with param.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 14:15:05 +02:00
Vinayak Kariappa Chettimada
6f2d4a4458 Bluetooth: controller: Fixes and use of defines related to initiator
Fixed incorrect LLL context used to generate done event for
auxiliary channel scanning. Other minor comments and fixes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 14:15:05 +02:00
Vinayak Kariappa Chettimada
031aa8c340 Bluetooth: controller: Ensure only initiating on selected PHY
Reset the scanning context for the PHY not selected in the
Extended Create Connection command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 14:15:05 +02:00
Andrzej Kaczmarek
0b04dd7221 Bluetooth: controller: Add support for initiator on secondary adv ch
This allows to initiate a connection on secondary advertising channels,
i.e. when advertises uses advertising extensions.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-05-05 14:15:05 +02:00
Andrzej Kaczmarek
c47396abd9 Bluetooth: controller: Fix aux scanning for connectable ADV_EXT_IND
When in initiating state we need to handle ADV_EXT_IND as in regular
scan sice we always want to scan AUX_ADV_IND in order to be able to
connect.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-05-05 14:15:05 +02:00
Andrzej Kaczmarek
37b79ff229 Bluetooth: controller: Fix 1st connection event offset
We need to take RX chain delay and PHY used to send CONNECT_IND into
account when calculating 1st connection event offset.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-05-05 14:15:05 +02:00
Andrzej Kaczmarek
2ab25f67fe Bluetooth: controller: Use proper transmitWindowDelay for central
On secondary advertising channel transmitWindowDelay depends on PHY
used to create connection so we need to adjust it.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-05-05 14:15:05 +02:00
Andrzej Kaczmarek
e58800267f Bluetooth: controller: Add public helpers for scan checks
We will need the same checks for AdvA and TargetA/InitA in lll_scan_aux
so let's make them public and use address explicitly instead of passed
via pdu.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-05-05 14:15:05 +02:00
Andrzej Kaczmarek
95b693965e Bluetooth: controller: Refactor CONNECT_IND prepare to separate func
We can use the same code to create both CONNECT_IND and AUX_CONNECT_REQ
since they are basically that same PDUs.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-05-05 14:15:05 +02:00
Johann Fischer
a42c51654b modbus: fix untrusted loop bound in modbus client
Use size_t type where it makes sense and
check if the buffer is large enough before it is used.

Fixes: #33786
Fixes: #33795

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-05-05 11:33:56 +02:00
Emil Gydesen
556baa2fd2 Bluetooth: Shell: ISO: Broadcast use correct bis_tx_pool
When broadcasting with ISO it would wrongly use the tx_pool
defined for CIS, instead of the broadcast TX pool.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-04 10:20:12 -05:00
Jan Müller
10ee29e947 tracing: Add ISR numbers to SystemView for Cortex-M
The sysview module does not set an interrupt number when recording ISRs
using SEGGER SystemView. Added ISR numbers for Cortex-M based chips.

Signed-off-by: Jan Müller <jan.mueller@nordicsemi.no>
2021-05-04 10:17:23 -05:00
Henrik Brix Andersen
db22c42ba7 canbus: canopen: conversion of k_work API
Replace all existing deprecated API with the recommended alternative.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-05-04 10:12:47 -05:00
Joakim Andersson
80e5295dca Bluetooth: host: Fix buffer leak trying to send when disconnected
Fix buffer leak in L2CAP and SMP when attempting to send over a
a connection that has been disconnected.
Both L2CAP and SMP now have ownership of the buffer in case of failure
to send it and need to unref it in case of send failure.

Change the return type of bt_l2cap_send since the user of this function
has to handle releasing of the buffer when this fails.

Regression from: a77f809faa47ff9922692d2b4eab33062b8a2b4d

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-03 16:45:53 +02:00
Joakim Andersson
ae4662f037 Bluetooth: host: Remove comment providing false information
Remove the comment about bt_l2cap_send_cb not being able to fail when
called from RX thread. It will fail in the case where the connection
has been disconnected.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-03 16:45:53 +02:00
Emil Gydesen
87df76c7f7 Bluetooth: ISO: Improved text for setting ISO data paths
Improved the documentation for the ISO data paths, as well
as making the bt_iso_setup_data_path function a bit more
clear.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-03 11:59:25 +02:00
Emil Gydesen
735009e9f8 Bluetooth: ISO: Only remove a single data path for broadcasters
Since we are only setting up a single data path for
broadcasters (either receive or transmit), we should
only remove that same path.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-03 11:59:25 +02:00
Emil Gydesen
b2281cce78 Bluetooth: shell: Mark BIGinfo reports more clearly in the shell
The BIGinfo reports were almost identical to the
periodic advertising reports when printet. Updated to
mark the start of the line with BIGinfo.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-03 11:59:25 +02:00
Emil Gydesen
1c466d4d92 Bluetooth: ISO: Fix issue with setting iso data path for BISs
When setting the iso data path for a BIS, it shall only be set for
one direction (depending on whether we are a broadcaster or
a receiver).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-03 11:59:25 +02:00
Nicolas Pitre
f1f63dda17 arm64: FPU context switching support
This adds FPU sharing support with a lazy context switching algorithm.

Every thread is allowed to use FPU/SIMD registers. In fact, the compiler
may insert FPU reg accesses in anycontext to optimize even non-FP code
unless the -mgeneral-regs-only compiler flag is used, but Zephyr
currently doesn't support such a build.

It is therefore possible to do FP access in IRS as well with this patch
although IRQs are then disabled to prevent nested IRQs in such cases.

Because the thread object grows in size, some tests have to be adjusted.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-05-03 11:56:50 +02:00
Aurelien Jarno
b61c23943c usb: netusb: rndis: fix a typo
asemble => assemble

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-05-01 14:17:39 -04:00
Sylvio Alves
a3c35c93ff driver: esp32: add bluetooth support
Add support to BLE and BR/EDR feature.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-04-30 16:51:30 -04:00
Jordan Yates
bbd53dcde0 lorawan: port oriented downlink callbacks
Add downlink callbacks on a per-port basis. A single message will be
handled as many times as users have registered matching ports. Callbacks
will also be run on "meta" downlink packets on port 0, such as confirmed
uplink acknowledgements.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-04-30 13:05:10 -05:00
Lukasz Maciejonczyk
4500862af1 net: openthread: Init NCP after USB communication is established
The device has sent RESET_POWER_UP message before the communication
with the host hadn't been established. It could be observed with
pyspinel which displayed `Framing error`.

This commit fixes the bug by initializing NCP after the host stated
is ready to communicate.

This commit reverts initialization the USB stack into function
otPlatUartEnable to be consistent with others OpenThread platforms.
OpenThread co-processor samples are not affected by #27071 as they use
USB for SPINEL communication with host and not for UART console.

Note:
When co-processor communicates by USB CDC ACM and it is hard reset
(what is happening in current Zephyr OpenThread platform)
the connection needs to be properly handled by the host.

For posix platform used together with RCP it was implemented in:
https://github.com/openthread/openthread/pull/6454

and for NCP:
https://github.com/openthread/wpantund/pull/492 .

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-04-30 12:58:31 -05:00
Robert Lubos
39aee39cf9 net: openthread: Align with the new NCP API
OpenThread modified its NCP API, so we need to align with these changes
in Zephyr.

One of the major changes was removal of UART from the platform APIs.
`openthread/platform/uart.h` header file was moved to
`examples/platforms/util/uart.h` so we need to use the new location in
Zephyr. This means that OpenThread no longer impose the UART API but for
the simplicity of the upmerge I've kept the UART APIs as they are for
now.

The NCP initialization function have now to register a send handler,
and the appropriate transport driver have to call NCP callbacks when
transmission/reception is done. For now, re-use the existing code of
the UART driver, just as the upstream NCP application does.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-30 12:55:02 -05:00
Robert Lubos
c2ad0dff72 net: openthread: Use OT mutex in OT shell
Use OpenThread mutex in order to protect OT CLI API call instead of
halting the OpenThread thread.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-30 12:55:02 -05:00
Robert Lubos
983ee8b088 net: openthread: Align with the new CLI API
The OpenThread CLI API has changed therefore it's needed to align
OpenThread Shell implementation in Zephyr with these changes.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-30 12:55:02 -05:00
Robert Lubos
7ca3ccdd0d net: openthread: Introduce new OpenThread options
Introduce new OpenThread configuration options from the upmerge.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-30 12:55:02 -05:00
Andrzej Puzdrowski
29c838ed1d fs/nvs: document flash wbs migration capability
Document the fact than NVS image of different wbs
are compatible each other if psychical ATE size
is kept.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2021-04-30 12:27:27 +02:00
Damian Krolik
95121b544a nvs: fix initialization of fs->data_wra on alignment change
When existing records stored in the NVS are not properly
aligned according to the current flash driver requirements,
fs->data_wra may be initialized with an unaligned address.
Fix the initialization code, so that fs->data_wra is rounded
up to the nearest multiple of the current flash driver block
size.

The situation may occur during a firmware upgrade which
introduces a new flash driver or changes its parameters.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2021-04-30 12:27:27 +02:00
Piotr Pryga
c5f8d0adb7 Bluetooth: controller: radio: Add API to configure CTE Rx
Add Radio configuration API that gives possiblity configure
reception and sampling of CTE.
Part of alrady implemented API was re-factored to comply
with new API and do complete initialization of registers:
DFECTRL1 and CTEINLINECONF.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-04-30 11:07:55 +02:00
Krzysztof Chruscinski
7f1d4fdb5b logging: Enable MPSC_PBUF for legacy modes
Logging failed to compile when --no-gc-sections is used because
log_core is conditionally calling mpsc_pbuf.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-29 09:53:19 -04:00
Michał Narajowski
b9c8d270ab Bluetooth: Mesh: Allow to be NODE when PROVISIONER is enabled
When PROVISIONER and CDB is enabled then IUT couldn't be a NODE.
This patch fixes this by not returning an error when CDB is not
configured. This is useful especially in testing environment, when all
the features are compiled in and we can choose role in runtime.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-04-29 09:52:35 -04:00
Robert Lubos
0d1577f7fe net: lwm2m: Add API function to delete object instance
Since the API already has a function to create an LwM2M object instance,
it makes sense to add a corresponding delete funtion, allowing the
application to delete created objects.

Additionally, for the remote delete set the Registration Update trigger
only when not in bootstrap mode.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-29 09:51:54 -04:00
Robert Lubos
66c5fdc984 net: lwm2m: Fix Registration Update send on object creation
The Registration Update message should be sent whenever an object
instance is created or deleted. Currently this was only the case when an
object instance was created by the server and not by the application.
Fix this by triggerng the Registration Update from the API function
as well.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-29 09:51:54 -04:00