Commit graph

15409 commits

Author SHA1 Message Date
Gerson Fernando Budke
88cedcf5c5 drivers: clock: Add Atmel SAM PMC driver
Add initial version of clock control for Atmel SAM SoC series. This add
support to Power Management which allows control peripherals clock.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Peter Mitsis
18af9f0f61 kernel: Add missing stdbool.h to kernel/stats.h
The structure k_cycle_stats uses the bool type. Consequently it
should include the stdbool.h header file.

Fixes #55972

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-03-21 15:43:36 -04:00
Théo Battrel
a693b9b33b Bluetooth: Host: Add Encrypted Advertising Data
Create a new Bluetooth library and add Encrypted Advertising Data to it.

Encrypted Advertising Data is a new feature from the Bluetooth Core
Specification 5.4. It provides a way to communicate encrypted data in
advertising, scan response and EIR packets. To do that it introduce a
new advertising data type called `Encrypted Advertising Data`. Also, it
introduce a new characteristic called `Encrypted Data Key Material`,
this provides a way to share the key material.

The library add two main functions `bt_ead_encrypt` and
`bt_ead_decrypt`.

Two helper functions are added to `bluetooth.h`. `bt_data_get_len` and
`bt_data_serialize`, the first one allow the user to get the total size
of a set of `bt_data` structures; the second one generate a spec
compliant bytes array from a `bt_data` structure. The last one is useful
because `bt_ead_encrypt` take as input those kind of bytes array.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-03-21 13:39:09 +02:00
Freddie Yang
2ffe890b6a Bluetooth: Host: add appearance values
Assigned values last modified on 2023-01-05.

Signed-off-by: Freddie Yang <freddie.yang325@outlook.com>
2023-03-21 10:42:05 +02:00
Emil Gydesen
9ce647ba79 Bluetooth: Audio: Implement CAP unicast stop procedure
Implements the CAP unicast stop procedures, which is used
to stop (either disable or release) multiple streams.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-21 09:35:05 +01:00
Emil Gydesen
f7f69b6ff0 Bluetooth: Audio: Implement CAP unicast metadata update
Implement the CAP unicast metadata update procedure.

The procedure lets an application update the metadata of one
or more CAP streams in a single function call, while also ensuring
that the provided metadata follows the requirement from CAP.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-21 09:35:05 +01:00
Emil Gydesen
b71f9f2702 Bluetooth: Audio: Implement CAP unicast audio start
Implement the CAP unicast start procedure, which
will put one or more CAP streams from the idle state
to the streaming state, across or more ACL connections.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-21 09:35:05 +01:00
Fabio Baltieri
9889e8e20a input: move the listener section in common-rom
Move the input listener section declaration in common-rom-misc.ld
instead of using a custom input.ld file. This seems to be the common
practice for upstream iterable sections and seems to solve a
compatibility issue where the section was getting allocated incorrectly
on esp32 based platforms.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-03-20 12:56:18 -07:00
Robert Lubos
0771535119 net: sockets: Update zsock_poll() API documentation
It is no longer true that zsock_poll() works only with networking
sockets, we now support for example eventfd objects which can also be
polled. Therefore just remove the outdated comment in the zsock_poll()
documentation, as it is misleading.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-03-20 16:53:04 +01:00
Sebastian Panceac
2e7c02bef6 Bluetooth: pairing: OOB: Separate LE SC OOB from legacy OOB logic
Some systems can support only legacy OOB pairing while others only
LE SC OOB pairing.

The existent API function "bt_set_oob_data_flag" was removed.

Two new API functions were added:

 * "bt_le_oob_set_legacy_flag" to signal that legacy OOB pairing is used
 * "bt_le_oob_set_sc_flag" to signal that LE SC OOB pairing is used

The code will now advertise the presence of OOB flag depending
on the type of pairing method(SC vs legacy)

Signed-off-by: Sebastian Panceac <sebastian.panceac@ext.grandcentrix.net>
2023-03-20 16:13:18 +01:00
Jamie McCrae
2fedb306f7 drivers: Add retained memory driver interface
Adds a new driver interface for retained memory devices which
can be used to store data and have it retained whilst the device is
powered thorugh different application execution states (though this
data may be lost in low power states).

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-20 15:02:09 +01:00
Krzysztof Kopyściński
8194c34669 Bluetooth: Mesh: allow user to define BLOB ID for bt_mesh_dfu_cli_send
User can now use self-defined BLOB ID for transfer instead of using
random one each time. This allows to send multiple FW Update Start
messages with same BLOB ID, for example to resume previous one.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-03-20 13:38:40 +01:00
Théo Battrel
85d1a27a3d Bluetooth: Host: Document bt_conn_set_security behavior
Document `bt_conn_set_security` behavior; `sec` has no effect on the
security level selected for the pairing process. The selection is
instead controlled by the values of the registered `bt_conn_auth_cb`.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-03-20 10:59:59 +01:00
Armin Brauns
0866ea4e21 include: drivers: fix typo in gpio.h
Rising/Falling, not Rising/Failing

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-20 10:43:12 +01:00
Yanqin Wei
2122efee1c include: arch: add macro for mpu memory configuration
Add noncache memory attribute and memory-region-mpu compatible
macro for Armv8r64.

Signed-off-by: Yanqin Wei <Yanqin.Wei@arm.com>
2023-03-20 09:54:35 +01:00
Georges Oates_Larsen
3c6b7dc35a net: dummy L2 for offloaded ifaces
Adds dummy link layer for offloaded ifaces, allowing
ifaces to directly receive l2_enable calls

Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
2023-03-20 09:53:25 +01:00
Krishna T
5e6c733006 net: wifi: Use a macro for TWT wake interval
Remove the magic number 255, esp. now that we support 262.144ms.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2023-03-20 09:53:02 +01:00
Krishna T
65aae9cbfb net: wifi: Use micro seconds for precision for TWT intervals
In order to take granular input use micro seconds as input for TWT
intervals, this helps us in providing inputs such as 65.28ms without the
need of using floating points.

This also expands the TWT wake interval range to 262.144ms, earlier as
we want to use uint8, limited to 256ms.

Also, remove the units from the variable names, this is unnecessary and
also avoids doing breaking changes.

Update release notes as this is a breaking change, both type and
variable names are changed.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2023-03-20 09:53:02 +01:00
Henrik Brix Andersen
3c89bbf876 drivers: can: reset statistics when starting the CAN controller
Reset CAN controller statistics when starting the CAN controller.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-20 09:52:50 +01:00
Maureen Helm
2da26be77b drivers: sensor: Document sensor trigger pointer storage in API
Updates the sensor driver API documentation to state that the driver
will store the user-supplied sensor trigger as a pointer rather than a
copy.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Aleksander Wasaznik
cc1c3ac58e Shell: Add missing include
`include/zephyr/shell/shell_string_conv.h` uses `bool` from `stdbool.h`,
but the include was missing.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-03-20 09:51:24 +01:00
Tom Burdick
2d1375f89d rtio: Fix consume semaphore usage
When the consume semaphore is enabled always give and take from the
semaphore. It's expected that rtio_cqe_consume and rtio_cqe_consume_block
will be used exclusively rather than directly poking at the SPSC queues.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-17 12:49:57 -05:00
Tom Burdick
debbb69eec rtio: Adds rtio_iodev_cancel_all
Ability to cancel all pending requests in the queue turns out to be
useful and shareable.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-17 12:49:57 -05:00
Tom Burdick
bfecb77fde rtio: Make rtio_mpsc.h C++ friendly
C++ requires casting void * as the implicit cast isn't enough and
the C++ sample app fails to build without duplicating type information
here. Do that, and wrap it in extern C allowing the C++ to include
rtio_mpsc.h directly or indirectly.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-17 12:49:57 -05:00
Tom Burdick
610d307fa0 rtio: Properly track last sqe in the queue
The pending_sqe logic to track where in the ring queue the concurrent
executor had left off was slightly flawed. It didn't account for starting
all sqes in the queue and ending back up at the beginning.

Instead track the last SQE in the queue, from which the next one in the
queue will the one to start next.

If we happen to sweep the last known SQE in the queue, reset it to NULL
so the next time prepare is called we start at the beginning of the queue
again.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-17 12:49:57 -05:00
Tom Burdick
3353342e5f rtio: Add transactional submissions
Transactional submissions treat a sequence of sqes as a single atomic
submission given to a single iodev and expect as a reply a single
completion.

This is useful for scatter gather like APIs that exist in Zephyr already
for I2C and SPI.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-17 12:49:57 -05:00
Tom Burdick
22273e34d0 rtio: Clear flags in prep helpers
Tests were failing when the sqe was allocated on the stack for some
architectures. Initialization of variables on the stack is not guaranteed
to be zeroed like static data. This caused undefined behavior.

Secondly if the sqe is recycled and had a flag set, there would
unexpected behavior as well.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-17 12:49:57 -05:00
Kumar Gala
b0ea0c8ec6 debug: coredump: Fix build issue with armclang
Building tests/drivers/coredump/coredump_api with armclang gets:

include/zephyr/debug/coredump.h:98:2: error: unknown type name 'uint8_t'
        uint8_t *buffer;
        ^

Fix simply be including <stdint.h> to get uint8_t typedef.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-03-16 16:42:41 -04:00
Emil Gydesen
68fa04788a Bluetooth: Audio: Add unicast client cp notify callbacks
Add callbacks for control point notifications sent by the
unicast server. These will allow the upper layers to know
if and why a specific operation failed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-16 09:18:00 +01:00
Aleksander Wasaznik
9a63f9d3d8 Bluetooth: Host: Doc bt_conn_foreach includes disconnected
A user reported confusion about whether disconnected `bt_conn` are
meant to be found by `bt_conn_foreach`. The confusion likely stems from
the inprecise wording "existing connections".

This commit doucments `bt_conn_foreach` as it is: A low-level API for
iterating trough all `bt_conn` objects, connected or not.

This commit also includes a warning about possibly unintutive behavior
in preemptible threads.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/53996

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-03-15 22:43:09 +00:00
Jonathan Rico
b23c330c63 Bluetooth: host: shrink bt_l2cap_le_chan size
Most of this struct is bookkeeping for the dynamic channels.
This isn't needed for e.g., a simple peripheral using GATT.

With a peripheral_hr build for nrf52840dk_nrf52840, we save
280 bytes of RAM.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-03-15 09:11:33 +01:00
Fabio Baltieri
2815f96440 drivers: move gpio_keys from gpio to input
Port the gpio_keys_zephyr driver from the gpio subsystem with a
dedicated API to the input subsystem reporting input events.

Move the test as well, simplify the cases a bit since the API is simpler
now.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-03-14 17:15:09 -04:00
Benjamin Björnsson
f38a75f753 drivers: clock_control: add STM32C0 support
Add STM32C0 support to clock_control driver.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-14 17:35:37 +00:00
Benjamin Björnsson
17f96eba34 dt-bindings: reset: Add STM32C0 reset header
Add header to be included in STM32C0 series dtsi files.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-14 17:35:37 +00:00
Aleksandr Khromykh
4d1757b15a Bluetooth: Mesh: add more fixed group addresses
Mesh-1.1 spec extends number group addresses.
There were added:
all forwarding address,
all ip nodes,
all ip border routers.
Even Zephyr's mesh doesn't support them it should be able
to subscribe heartbeat on these groups.
Also mesh should provide ability to subscribe\publish models on
these groups.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-03-14 12:26:50 -04:00
Patryk Duda
8a85f0e87f drivers: flash: Introduce API function for flash extended operations
Besides of standard flash operations like write or erase, flash
controllers also support additional features like write protection or
readout protection. These features are not available in every flash
controller, what's more controllers can implement it in a different way.

It doesn't make sense to add a separate flash API function for every
flash controller feature, because it could be unique (supported on small
number of flash controllers) or the API won't be able to represent the
same feature on every flash controller.

Extended operation interface provides flexible way for supporting flash
controller features. Code space is divided equally into Zephyr codes
(MSb == 0) and vendor codes (MSb == 1). This way we can easily add
extended operations to the drivers without cluttering the API or
problems with API incompatibility. Extended operation can be promoted
from vendor codes to Zephyr codes if the feature is available in most
flash controllers and can be represented in the same way.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-03-14 11:17:13 +01:00
Ajay Parida
43bd60a13a net: wifi_mgmt: Send TWT sleep status event to app
Send TWT sleep status(sleep/awake) event to the apps registered
for event.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2023-03-14 10:49:30 +01:00
Jaxson Han
463b1c9396 arch: arm64: Add safe exception stack init function
Add safe exception stack init function which does several things:
1) setting current cpu safe exception stack pointer to its corresponding
stack top.
2) init sp_el0 with the above safe exception stack.
That makes sure the sp_el0 points to per-cpu safe_stack in the kernel
space.
3) init the current_stack_limit and corrupted_sp with 0

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-03-14 10:49:22 +01:00
Jaxson Han
3a5fa0498f arch: arm64: Add stack_limit to thread_arch_t
Add stack_limit to thread_arch_t to store the thread's stack limit.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-03-14 10:49:22 +01:00
Jaxson Han
61b8b34b27 arch: arm64: Add the sp variable in _esf_t
As the preparation for enabling safe exception stack, add a variable in
_esf_t to save the user stack held by sp_el0 at the point of the
exception happening from EL0. The newly added variable in _esf_t is
named sp from which the user stack will be restored when exceptions eret
to EL0.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-03-14 10:49:22 +01:00
Jaxson Han
7040c55438 arch: arm64: Add stack check relevant variables to _cpu_arch_t
Add three per-cpu variables for the convenience of quickly accessing.

The safe_exception_stack stores the top of safe exception stack pointer.
The current_stack_limit stores the current thread's priv stack limit.
The corrputed_sp stores the priv sp or irq sp for the stack overflow
case, or 0 for the normal case.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-03-14 10:49:22 +01:00
Vibhor Meshram
4684006f1b Bluetooth: Audio: Remove "Input" from MICP naming
Removed "Input" from Microphone Input Control Profile.
Release notes kept unchanged.

Signed-off-by: Vibhor Meshram <vibhor69meshram@gmail.com>
2023-03-13 18:34:09 +00:00
Aleksander Wasaznik
6648da731b Bluetooth: Host: SMP Keypress Notification
Add experimental support for SMP Keypress Notification.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-03-13 14:04:25 +01:00
Emil Gydesen
0ebc7c2b69 Bluetooth: Audio: Rename BT_AUDIO_LC3_PRESET to BT_BAP...
This was missing from the recent BT_AUDIO -> BT_BAP rename.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-13 14:02:50 +01:00
Henrik Brix Andersen
b24dca032e drivers: can: add CAN-FD Error State Indicator (ESI) flag
Add definition for the CAN-FD Error State Indicator (ESI) flag. The
presence of this flag indicates that the transmitting CAN-FD node is in
error-passive state.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-11 19:45:14 +01:00
Henrik Brix Andersen
9ca4968b21 drivers: can: clarify the documentation on overlapping filters
Attempt to clarify the documentation on the behaviour of overlapping CAN RX
filters.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-11 19:45:07 +01:00
Andy Ross
196defd953 doc: Clean up documentation for cycle counter API
Discussion in #55658 showed that our API docs for the hardware cycle
counter layer were a little lacking.  Technically it's owned by the
architecture layer, but the arch docs were unhelpful.  And the arch
layers uniformly farm it out to an API in the timer drivers that was
never documented at all.  Clean things up.

Signed-off-by: Andy Ross <andyross@google.com>
2023-03-11 08:46:43 +02:00
Herman Berget
7b85e70722 Bluetooth: Host: Add missing include in bluetooth/gap.h
bluetooth/gap.h uses some utility macros. Include the relevant header to
avoid users having to include it before including the GAP header.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2023-03-10 11:39:19 +01:00
Krzysztof Chruscinski
68955ebdb6 logging: Increase package size limit to 2047
Package length was previously stored on 10 bits which limited
package size to 1023 bytes. Descriptor which contained package
length field had one unused bit which can be used to increase
package length field to 11 bits doubling the maximum package
length.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-03-09 15:10:06 -08:00
Krzysztof Chruscinski
24ad096232 logging: Renamed internal defines to get rid of 2 suffix
Some internal macros were still using 2 suffix which comes from
time when there was v1 and v2. Cleaning up by removing the suffix.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-03-09 15:10:06 -08:00