Commit graph

21541 commits

Author SHA1 Message Date
Torbjörn Leksell
86d8b36955 Tracing: k_free tracing hook heap reference added
Added heap reference parameter to k_free tracing
hook to allow tracing of the pointer which was
passed as a parameter to a k_free call.
As part of this update the defines
(for this hook) in the various tracing formats
was also updated.

Signed-off-by: Torbjörn Leksell <torbjorn.leksell@percepio.com>
2021-11-16 09:45:01 -05:00
Vinayak Kariappa Chettimada
e07af1fa08 Bluetooth: Controller: Fix Periodic Sync Failed to be Established
Fix Periodic Advertising Synchronize implementation to
generate Synchronization Failed to be Established event
when 6 AUX_SYNC_IND PDUs are not received when establishing
synchronization.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-16 12:12:56 +01:00
Vinayak Kariappa Chettimada
f9ac97336d Bluetooth: Controller: Rename ticker operation callbacks
Rename ticker operation callback suitably to reflect their
purpose.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-16 12:12:56 +01:00
Dominik Ermel
1d17a4bc55 mgmt/mcumgr: Add CONFIG_IMG_MGMT_FRUGAL_LIST
The commit adds Kconfig options that enables "frugal status list";
when enabled, the status list will be sent with zero, empty and false
values omitted, slightly reducing number of bytes sent as response
from device.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-16 10:45:57 +01:00
Dominik Ermel
a29ab5106b mgmt/mcumgr/lib: Add Kconfig option MGMT_CBORATTR_FLOAT_SUPPORT
The option enables float numbers processing within CBOR attributes.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-16 10:45:57 +01:00
Dominik Ermel
cf10549e7e mgmt/mcumgr/lib: Replace license block
The commit changes licensing to SPDX tags.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-16 10:45:57 +01:00
Dominik Ermel
56e602b22b mgmt/mcumgr/lib: Fix compliance
Commit fixes compliance issues.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-16 10:45:57 +01:00
Dominik Ermel
0bc87573bf mgmt/mcumgr/lib: Documentation fixes
References to Mynewt have been removed and README for Zephyr has been
merged directly to the README.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-16 10:45:57 +01:00
Dominik Ermel
dfc57ae390 mgmt/mcumgr/lib: Remove non-Zephyr code
The commit removes MYNEWT sepcific code and code that has been
conditionally compiled with "ifndef _ZEPHYR_".

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-16 10:45:57 +01:00
Dominik Ermel
c8381a9d14 mgmt/mcumgr/lib: Remove log management commands
Not implemented.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-16 10:45:57 +01:00
Dominik Ermel
af75feac4f mgmt/mcumgr/lib: Copy mcumgr library under mgmt subsystem
The commit copies code of mcumgr, as a lib, under subsys/mgmt/mcumgr.
Only source files relevant for Zephyr have been copied, and changes
to source files have been limited only to path changes, where
required.
Samples have been left out as the only relevant sample, smp_svr,
is already within Zephyr source tree.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-16 10:45:57 +01:00
Vinayak Kariappa Chettimada
c025e07557 Bluetooth: Controller: Fix DTM HCI command returned error codes
Fix DTM HCI command returned error codes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-16 10:42:38 +01:00
Vinayak Kariappa Chettimada
ee40950282 Bluetooth: Controller: Fix missing DTM Tx/Rx reset on HCI Reset Command
Fix missing implementation to reset DTM Tx/Rx reset on HCI
Reset Command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-16 10:42:38 +01:00
Emil Gydesen
c8f08c9e94 Bluetooth: ISO: Update loop variables types in iso.c
Some of the loop variables used `int` where it
makes more sense to use `size_t` or `uint8_t`.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-15 14:39:59 -05:00
Emil Gydesen
db29cea01c Bluetooth: ISO: Add CIG state machine
Add a state to the bt_iso_cig struct. This makes
checks for the CIG state easier, and follows the
state machine in the core spec.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-15 14:39:59 -05:00
Emil Gydesen
65620363e3 Bluetooth: ISO: Add CIG reconfigure function
Add function to reconfigure and even add additional
CIS to a CIG.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-15 14:39:59 -05:00
Emil Gydesen
be1912b66a Bluetooth: ISO: Move validation of CIG parameters to function
Move the validation of specific CIG parameters to its
own function. This is mainly to be able to reuse it for
validationg CIG refconfiguration parameters.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-15 14:39:59 -05:00
Emil Gydesen
19c032ed78 Bluetooth: ISO: Rename bt_iso_cig_create_param
Renames the struct from bt_iso_cig_create_param to
bt_iso_cig_param as the same struct can, without
modification, be used to update the CIG as well
(function to support that will come in a later commit).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-15 14:39:59 -05:00
Emil Gydesen
3f345132e0 Bluetooth: ISO: Move cis/bis param checks to earlier
Move the verification of the individual cis/bis checks to
an earlier point, because we actually start allocating
resources for the groups.

This removes a double check for NULL, while also
allows us to terminate earlier if there were any
issues.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-15 14:39:59 -05:00
Emil Gydesen
2b58a94ab2 Bluetooth: ISO: Rename cis/bis in cig/big to cis/bis channels
Rename the field in the struct to x_channels to make
it more clear what the field represents.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-15 14:39:59 -05:00
Emil Gydesen
ba0a053f94 Bluetooth: ISO: Change CIG/BIG to use slist instead of array
A CIG may be updated later to include more CIS, and thus a slist
makes more sense.

The BIG doesn't need the change, but it makes more sense to
have similar handling for both.

This change also removes the requirement that the arrays
used to create the CIG/BIG need to static.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-15 14:39:59 -05:00
Adhipta Putra
2d9a4d13c0 Bluetooth: Controller: Updated code indent to use tabs
Replacing spaces code indent

Signed-off-by: Adhipta Putra <adhipta.putra@nordicsemi.no>
2021-11-15 14:39:43 -05:00
Adhipta Putra
f3654fc4f9 Bluetooth: Controller: Added PDU_CRC_POLYNOMIAL
Replacing RADIO_CRC_POLYNOMIAL

Signed-off-by: Adhipta Putra <adhipta.putra@nordicsemi.no>
2021-11-15 14:39:43 -05:00
Adhipta Putra
8a9711b48f Bluetooth: Controller: Use sys_get_le24 to fetch 24-bit data
Use sys_get_le24 to pass crc init value input

Signed-off-by: Adhipta Putra <adhipta.putra@nordicsemi.no>
2021-11-15 14:39:43 -05:00
Christopher Friedt
6735f11bac Bluetooth: Audio: otc: update print format specifier for atomics
Atomics changed from `int` to `long` and print format specifiers
must be updated as well.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-15 09:59:01 -05:00
Christopher Friedt
829eec9ec5 portability: cmsis: use correct type for atomics
With the change of `atomic_t` from `int` to `long` there
were a few places where there was some type aliasing
occuring.

Update CMSIS to use `atomic_t` rather than `int` for all
atomic operations.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-15 09:59:01 -05:00
Christopher Friedt
3e86c627f7 kernel: atomics: update print specifiers for atomic_t
The print specifier for `atomic_t` should be updated
to `%ld`, `%lu`, or `%lx` to account for the type
change of `atomic_t` to `long`.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-15 09:59:01 -05:00
Emil Lindqvist
f0af9275ed logging: typecast to stop signed-unsigned comparison
If source_id is -1, which is a valid value, it will be
converted to unsigned since it's compared with an unsigned
which means it will be huge and asserts will trigger. To avoid
this, we typecast the unsigned part to signed.

Resolves #40115

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-11-15 08:53:51 -05:00
Emil Gydesen
12decc70d0 Bluetooth: ISO: Add bitmask for retrieving iso header lenght
Add a macro to retrieve the iso data load length (the
length stored in the iso header) with a bit mask that
ensures that we only take the first 14 bits.

This is to remove any RFU bits that may have been set.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-12 14:52:33 +01:00
Emil Gydesen
08b1dfb4a2 Bluetooth: ISO: Fix incorrect struct for ISO hdr data
There were a few cases where bt_hci_iso_data_hdr was used
instead of the proper struct bt_hci_iso_hdr.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-12 14:52:33 +01:00
Carlo Caione
bf19df0292 ipc_service: Re-organize Kconfig
Re-organize Kconfigs to make easier adding new backends.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-11-12 14:51:29 +01:00
Carlo Caione
f141565b85 ipc_service: Move libraries in a stalone directory
The IPC libraries will be used by several backends. Move the libraries
out in a new 'lib' directory.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-11-12 14:51:29 +01:00
Dominik Ermel
4c9b308367 mgmt/mcumgr: Remove duplicated frame fragment marker processing
The mcumgr_serial_parse_op has been called to extract marker and
check if it is valid, just for the caller mcumgr_serial_process_frag
to process the marker again.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-12 14:48:52 +01:00
Vinayak Kariappa Chettimada
b1c03b4185 Bluetooth: Controller: Periodic Adv Sync same peer and sid check
Add implementation to check Periodic Advertiser
Synchronization to already synchronized peer and same SID.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-12 14:08:19 +01:00
Emil Gydesen
2be4a537af Bluetooth: shell: VCS: Use BT_VOCS_MIN_OFFSET/BT_VOCS_MAX_OFFSET
Use the defined min and max values for offset instead
of UINT8_MAX.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-11 19:26:02 -05:00
Robert Lubos
51dc4c3b1e shell: telnet: Disable echo
When telnet client queries about remote echo support, we reply that we
won't do it (which reduces the traffic), however the echo was not
actually disabled on the shell. In result characters were double-echoed
in the character mode (by both local echo from the client and remote
echo from the server).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-11 19:23:20 -05:00
Robert Lubos
c932354694 shell: telnet: Fix handling of multiple commands in a single packet
In case multiple commands were sent in a single packet, only the first
one was processed. Fix this by processing them in a loop.

As the subnegotiation command have variable length, and we currently
don't have any support for subnegotiation, stop processing packet when
such a command occurs.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-11 19:23:20 -05:00
Robert Lubos
c479458392 net: arp: Fix ARP retransmission source address selection
There was a problem with source address selection for ARP
retransmissions, when an ARP entry was already pending. In such case,
the `entry` value passed to `arp_prepare()` is NULL, which in result
caused the `current_ip` variable being used as the source value. The
problem with this approach is, that the `current_ip` is only set in
IPv4 autoconf, the Ethernet L2 does not set this variable. In result,
every retransmission of an ARP packet was sent with unspecified source
address, preventing the response from being handled.

Fix this by partially restoring the behaviour of the ARP source address
assignment from before IPv4 autoconf was introduced. If the ARP is sent
by the IPv4 autoconf, use the `current_ip` value provided. If entry is
not set, use the source IPv4 address set in the actual data packet.
Otherwise, search for a source address on the interface corresponding to
the `entry`.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-11 19:19:40 -05:00
Martí Bolívar
fc0d56a663 Bluetooth: controller: remove obsolete Kconfig options
Remove now-unused Kconfig options used for specifying radio front end
module configuration.

These are now handled in devicetree.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-11-11 21:52:24 +01:00
Martí Bolívar
7ff74e0ab9 Bluetooth: controller: support FEMs via devicetree
A FEM in this case is an external Front-End Module. This is basically
a range booster with some extra amplification in the TX and RX paths.

This feature is supported for the Nordic open source controller. See
the changes to the ubx_bmd345eval_nrf52840 board for a quick summary
of what you have to do to take advantage of this.

(This patch doesn't actually remove the feature in the openisa HAL,
though, because that never implemented the required GPIO handling
routines.)

We are using the 'fem' property previously added to the
nordic,nrf-radio's devicetree binding, which points to the FEM that is
in use. If you have this property and the node it points to is
enabled, the controller subsystem respects it. Otherwise, FEM support
is disabled.

This obsoletes the following Kconfig options, which are now unused:

- CONFIG_BT_CTLR_GPIO_PA
- CONFIG_BT_CTLR_GPIO_PA_PIN
- CONFIG_BT_CTLR_GPIO_PA_POL_INV
- CONFIG_BT_CTLR_GPIO_PA_OFFSET

- CONFIG_BT_CTLR_GPIO_LNA
- CONFIG_BT_CTLR_GPIO_LNA_PIN
- CONFIG_BT_CTLR_GPIO_LNA_POL_INV
- CONFIG_BT_CTLR_GPIO_LNA_OFFSET

- CONFIG_BT_CTLR_FEM_NRF21540
- CONFIG_BT_CTLR_GPIO_PDN_PIN
- CONFIG_BT_CTLR_GPIO_PDN_POL_INV
- CONFIG_BT_CTLR_GPIO_CSN_PIN
- CONFIG_BT_CTLR_GPIO_CSN_POL_INV
- CONFIG_BT_CTLR_GPIO_PDN_CSN_OFFSET

The PA and LNA pins are now specified via fem-specific devicetree
properties in the FEM node:

- The "generic" PA/LNA case is handled with the ctx-gpios and
  crx-gpios properties of the generic-fem-two-ctrl-pins compatible,
  respectively.

- If the fem is an nRF21540, use the tx-en-gpios and rx-en-gpios
  properties instead (and also respectively). This allows us to specify
  FEM properties in a way that makes sense for the hardware datasheet,
  while still handling them in a uniform way within the controller.

We support this in the nRF5 HAL with a new radio_nrf5_fem.h
sub-header, which pulls in radio_nrf5_fem_generic.h or
radio_nrf5_fem_nrf21540.h depending on the fem node's compatible, if
one is defined. These in turn let us replace the implementation
routines in radio.c with DT equivalents.

Keep in-tree users and devicetree binding documentation up to date.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-11-11 21:52:24 +01:00
Martí Bolívar
6d0e2c55dc Bluetooth: controller: add nRF21540-as-fem indirection
Introduce an intermediate macro for use detecting that we have a FEM
node, and it's an nRF21540. This is also prep work for converting the
FEM configuration mechanism to devicetree.

No functional changes expected.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-11-11 21:52:24 +01:00
Martí Bolívar
862e63091b Bluetooth: controller: add PA/LNA existence indirection
Add indirection macros for the ifdefs that test for the existence of
PA and LNA pins.

This will be convenient when the pins are configured in devicetree,
and the Kconfig symbols will no longer be around.

No functional changes expected.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-11-11 21:52:24 +01:00
Martí Bolívar
e064334c74 Bluetooth: controller: add FEM offset indirection
Hide the CONFIG_BT_CTLR_GPIO_..._OFFSET Kconfig macros behind
equivalent ones in the HAL_RADIO_ namespace. This removes any direct
usage of the Kconfig macros from the controller HALs.

That will be convenient when we are getting these values from
devicetree properties instead.

Notice that the "PDN/CSN offset" is dropping the "CSN" portion of the
name: CONFIG_BT_CTLR_GPIO_PDN_CSN_OFFSET is now
HAL_RADIO_GPIO_PDN_OFFSET. This is because the DT binding for nRF21540
has a pre-existing 'pdn-settle-time-us' property we're going to use to
replace the Kconfig option.

Other than that, the name changes are self-explanatory.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-11-11 21:52:24 +01:00
Martí Bolívar
30f1dc1d4a Bluetooth: controller: add GPIO polarity indirection
Hide the CONFIG_BT_CTLR_GPIO_..._POL_INV Kconfig macros behind
equivalent ones in the HAL_RADIO_ namespace. This removes any direct
usage of the Kconfig macros from the controller HAL ifdeffery, except
for the usage in radio.c where the actual work is done.

Add "NRF21540" in the macros that are specific to that FEM.

That will be convenient when we are getting the GPIO polarity from
devicetree GPIO flags instead.

No functional changes expected.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-11-11 21:52:24 +01:00
Martí Bolívar
c8aee4d04f Bluetooth: controller: remove hidden GPIOTE configs
The GPIOTE channels used to manage radio front end module GPIOs are
configured with invisible Kconfig symbols. They are therefore not user
visible. Remove them by redefining them in terms of equivalent macros
defined in radio_nrf5.h. This lets us get rid of a couple of ifdefs
that are no longer needed as well.

This is because these invisible symbols depend on the
CONFIG_BT_CTLR_GPIO_* pin configuration symbols. We would like to move
all of that pin configuration to devicetree, because it's hardware
description. It is therefore inconvenient to have the GPIOTE channel
configuration set via Kconfig in a way that depends on something we
would like to remove.

No functional changes or user impact expected: invisible symbols
cannot be set in .conf files.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-11-11 21:52:24 +01:00
Piotr Pryga
f758daa14b Bluetooth: controller: add missing ADI support in per adv chains
Recently there was added ADI support to periodic advertising.
There was missing implementation of ADI for periodic advertising
chained PDUs and direction finding. Also unit tests for periodic
advertising chains required update to handle ADI field.

The commit provides missing implementation.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-11 18:36:54 +01:00
Asbjørn Sæbø
e710f5acb1 Bluetooth: Audio: Workaround for false license positive
Add a workaround to stop Scancode from falsely detecting an MPL
license in the code.

See https://github.com/nexB/scancode-toolkit/issues/2304

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2021-11-11 15:31:37 +01:00
Asbjørn Sæbø
faeec32e2c Bluetooth: Audio: Bugfix - add missing parameters
Add missing parameter to shell_print call

(The bug exists in the topic-le-audio branch also, but was not
discovered there.  In the upmerge branch, it causes build failure.)

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2021-11-11 15:31:37 +01:00
Asbjørn Sæbø
b320dd7217 Bluetooth: Audio: Media control shell commands
This commit adds shell commands for the media control client, the
media player and the media proxy.  This is a part of the upmerge of
the le-audio media control files.

The commit is a pure copy of the files and content in the
topic-le-audio branch, with these exception:

- some include paths have been modified to correspond to new locations
  of files.
- some instances of the shell variable has been renamed to not be the
  same as the name of the shell struct tag.
- spaces have been replaced with TABs a couple of places
- remove cplusplus guards
- changed a debug dependency for MCC from MCS to MCC
- changed log name for the media controller shell

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>

mcc.c shell - replace name of shell variable

tmp

f

shell
2021-11-11 15:31:37 +01:00
Asbjørn Sæbø
4d9f516815 Bluetooth: Audio: Media control service
This commit adds the Media Control Service, and a dummy media player,
from the topic-le-audio branch.  This is a part of the upmerge of the
le-audio media control files.

This service has been developed and maintained over a couple of years
now, and is mature.  During the development it has passed both
IOP-testing and PTS qualification testing.

The commit is a pure copy of the files and content in the
topic-le-audio branch, with the following exceptions:

- files are in bluetooth/audio instead of bluetooth/host/audio, with
  some include paths updated as a consequence
- as a consequence, CMake files and Kconfig files updates are done in
  other locations
- copyrights have been updated

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2021-11-11 15:31:37 +01:00