Commit Graph

13478 Commits

Author SHA1 Message Date
Théo Battrel
f477d9d7eb Bluetooth: Gap: Add missing AD types
Add the following AD types:
- `BT_DATA_DEVICE_CLASS`
- `BT_DATA_SIMPLE_PAIRING_HASH_C192`
- `BT_DATA_SIMPLE_PAIRING_RAND_C192`
- `BT_DATA_DEVICE_ID`
- `BT_DATA_PAWR_TIMING_INFO`
- `BT_DATA_ESL`

Note that `BT_DATA_DEVICE_ID` has the same value as
`BT_DATA_SM_TK_VALUE` (0x10), this is not a mistake from the author but
a mistake in the Core Specification, specifically the Assigned Numbers
document with the version date 2024-04-10.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-07-29 14:13:34 +02:00
Adrien Ricciardi
b09972b445 fs: nvs: Allow application to switch sector to get free space
Add an API function allowing the application to determine the amount of
free bytes in the current sector.

Add a second API function allowing the application to switch to the next
NVS sector, calling the garbage collector on such sector.

The goal is togive more granularity to the application to control when
the garbage collector is triggered.

Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
2024-07-28 07:31:44 +03:00
Emil Gydesen
38d09af445 Bluetooth: BAP: Scan delegator add src without PA sync
Modify the bt_bap_scan_delegator_add_src to take an address and
a sid instead of a PA sync object, so that the scan delegator
can add a source without syncing to the PA.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-07-28 07:31:06 +03:00
Andreas Ålgård
a5850b794c net: lib: dhcpv4_server: Add callback to allow user to set address
This functionality is useful to allow for conditional or static leases.

Signed-off-by: Andreas Ålgård <aal@ixys.no>
2024-07-28 07:30:48 +03:00
Pisit Sawangvonganan
444e135679 net: if: streamline interface name checking logic
This commit reduces `#if / #endif` pairs by leveraging the
`IS_ENABLED` macro:
- Removed `#ifdef / #endif` around `NET_L2_DECLARE_PUBLIC` in `net_l2.h`,
  enabling compilation without affecting link time if the configuration
  is unavailable.

`set_default_name` function:
- Replaced multiple `if` statements with `else if` to use the last `else`
  without indirectly checking `name[0] == '\0'`.
- Since `snprintk` guarantees null-termination if `sizeof(name) > 0`,
  the `-1` subtraction is unnecessary, eliminating the need for
  zero initialization in `char name[CONFIG_NET_INTERFACE_NAME_LEN + 1];`.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-28 07:29:01 +03:00
Vineeta S Narkhede
232c802c05 net: hostname: Add a function to set the hostname postfix as is.
Fixes: #72363

The existing function to set the postfix is converting postfix
string to hexadecimal. Adding a new function to handle a use case
where the provided postfix should be used as is without any conversion.

Signed-off-by: Vineeta S Narkhede <VineetaSNarkhede@Eaton.com>
2024-07-28 07:28:51 +03:00
Pisit Sawangvonganan
b5fdbc21bf modem: cmux: optimize modem_cmux_frame structure padding
Downsize `dlci_address` field from `uint16_t` to `uint8_t` in
`modem_cmux_frame` for better memory alignment.

Note: The maximum value of `dlci_address` is 63, which fits
within `uint8_t`.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-27 20:51:42 +03:00
Pisit Sawangvonganan
ba30e7b350 modem: pipe: make modem_pipe_api a pointer to constant
Changed the `api` field in the `modem_pipe` structure to be
a pointer to constant.

This ensures that the `api` field remains immutable after
initialization.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-27 20:51:42 +03:00
Bas van Loon
85f6409043 net: if: Add net_if_ipv4_get_gw as helper function.
Most set functions have a get function as well, add the missing
function to get the set gateway IPv4 address.

Signed-off-by: Bas van Loon <basvanloon@betronic.nl>
2024-07-27 20:51:21 +03:00
Pisit Sawangvonganan
d5cd47fbb2 shell: introduce shell_xxx_impl wrapper functions for output macros
Refactor shell output macros to minimize caller overhead by eliminating
direct `color` parameter passing:
- Introduce wrapper functions: `shell_info_impl`, `shell_print_impl`,
  `shell_warn_impl`, `shell_error_impl`.
- Replace `shell_fprintf` in macros with these new wrappers.
- Update `shell_hexdump_line` to use the new wrappers,
  minimizing caller overhead.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-27 20:50:12 +03:00
Emil Gydesen
8be6db67fc Bluetooth: ISO/BAP: Refactor BIS bitfield
Refactors teh BIS bitfield values used for ISO
and BAP.

Previously BIT(1) meant BIS index 1, which was a Zephyr choice
in the early days of ISO, as the BT Core spec did not use
a bitfield for BIS indexes.

Later the BASS specification came along and defined that
BIT(0) meant BIS index 1, which meant that we had to shift BIS
bitfields between BAP and ISO.

This commit refactors the ISO layer to use BIT(0) for Index 1 now,
which means that there is no longer a need for conversion
between the BAP and ISO layers, and that we can use a value
range defined by a BT Core spec (BASS).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-07-27 15:19:46 +03:00
Chris Friedt
6cf557d64a posix: posix_types.h: simplify conditions on pthread types
Simplify the conditions for pthread type declaration

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-07-27 15:17:24 +03:00
Chris Friedt
6667b500c6 posix: sys/stat.h: move declarations to posix_types.h
A number of types such as uid_t, gitd_t, etc, were defined in
sys/stat.h to workaround compatibility issues many years ago.

Since posix_types.h is slated to become equivalent to
sys/types.h in terms of standard headers, move these types
to where they belong.

For more information, please see

https://pubs.opengroup.org/onlinepubs/9699919799/\
 basedefs/sys_types.h.html

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-07-27 15:17:24 +03:00
Chris Friedt
81f5205006 net + posix: avoid host includes when building for native_sim
A corner case involving C++, posix, networking, and native_sim
was causing problems.

Even though C and C++ builds should include zephyr/posix/.. in
the default search path with `CONFIG_POSIX_API=y`, for some
reason, the native compiler pulls in /usr/include first anyway.

The stat.h header pulled in <sys/types.h> (which is normally
fine) but due to the native build, it was pulling in
/usr/include/sys/types.h, from the host toolchain.

Explicitly include <zephyr/posix/posix_types.h> instead of
<sys/types.h> from stat.h, and continue using the workarounds
for native builds (explicitly including zephyr/posix/arpa/net.h
from net/sockets.h .

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-07-27 15:17:24 +03:00
Chris Friedt
6a0593d554 Revert "net: socket: fix sys/_timespec.h not found error"
This reverts commit 269729a5db.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-07-27 15:17:24 +03:00
Gerard Marull-Paretas
4ba5ad99cc drivers: i3c: fix/improve Doxygen
- Use references whenever possible instead of literals (e.g. `@c`)
- Remove incorrect usages of `@see`
- Fix incorrect usage of INTERNAL_HIDDEN blocks
- Detail Kconfig-dependent options with `@kconfig{}`
- Other minor enhancements

Ref. https://www.doxygen.nl/manual/autolink.html

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-27 15:13:27 +03:00
Gerard Marull-Paretas
003244e069 drivers: i3c: avoid duplicating BCR/LVR docs
Instead use Doxygen anchors to reference to a single source of truth.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-27 15:13:27 +03:00
Gerard Marull-Paretas
6f0b470bba drivers: i3c: use GENMASK/FIELD_GET if possible
This avoids the need to define a position shift macro, and makes code less
verbose.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-27 15:13:27 +03:00
Gerard Marull-Paretas
6ce0b0aab2 drivers: i3c: improve/fix include list
Include what is strictly needed.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-27 15:13:27 +03:00
Rubin Gerritsen
2967bd847f Bluetooth: HCI: Expose bt_hci_conn_lookup_handle()
When implementing vendor specific HCI APIs and events,
we want to be able to convert between host objects,
handles and back again.

Exposing this API makes that possible

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-07-27 15:09:00 +03:00
Rubin Gerritsen
e28207d61b Bluetooth: HCI: Expose bt_hci_per_adv_sync_lookup_handle()
When implementing vendor specific HCI APIs and events,
we want to be able to convert between host objects,
handles and back again.

Exposing this API makes that possible.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-07-27 15:09:00 +03:00
Rubin Gerritsen
5b14748616 Bluetooth: HCI: Expose bt_hci_adv_lookup_handle()
When implementing vendor specific HCI APIs and events,
we want to be able to convert between host objects,
handles and back again.

Exposing this API makes that possible.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-07-27 15:09:00 +03:00
Fin Maaß
2fb983a427 net: l2: ethernet: add way to access phy
add a way to access the ethernet phy
device via the ethernet device.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-07-27 15:07:26 +03:00
Johann Fischer
28b2051bda usb: device_next: add support for configuration string descriptor
Change USBD_CONFIGURATION_DEFINE macro to take the address of a string
descriptor node as an argument. This is a breaking change for macro
users, but quite convenient and easy to implement.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-07-27 15:06:09 +03:00
Johann Fischer
18c624e8df include: usb: fix designator order in usbd.h header
Fix "designator order for field 'usbd_desc_node::ptr' does not match
declaration order in 'usbd_desc_node'" error when building applications
with CONFIG_CPP enabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-07-27 10:47:00 +03:00
Robert Lubos
35fe353ad6 net: lib: coap_client: Replace send_mutex with more generic lock
Introduce a more generic mutex for protecting coap_client structure.

This allows to avoid a certain race condition when sending consecutive
CoAP requests. The case was, that when a CoAP receive thread notified
the application that a complete response was received, and the
application wanted to send another request from the application thread,
the consecutive call to coap_client_req() might've failed if the
application thread has higher priority than the CoAP receive thread
because of the request context cleanup is done after calling the
application callback.
Having a mutex, which is locked while processing the response, and when
attempting to send a new request allows to synchronize threads as
expected.

As this new mutex seemed redundant with the more specialized send_mutex
already present in the coap_client, the latter was removed (i. e.
transmission is also protected with the new mutex).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-07-27 10:43:15 +03:00
Yong Cong Sin
79ed64909f arm: debug: gdbstub: fix header
`exc.h` should be `exception.h` now, fix  it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-07-27 10:42:59 +03:00
Fabian Pflug
ca53d2bf80 net: l2: ieee802154: mgmt: allow beacon payload
The standard does allow for a optional beacon payload, which gets lost
during scan, that could be interesting for the application to access
in the NET_EVENT_IEEE802154_SCAN_RESULT callback.

See section 7.3.1.6 in IEEE Std 802.15.4 for more information about
the beacon payload field. And section 7.3.1 and figure 7-5 about general
beacon frame format.

Signed-off-by: Fabian Pflug <fabian.pflug@grandcentrix.net>
2024-07-27 10:42:45 +03:00
Fabio Baltieri
a7c8ce52f5 lib: os: change __printk_get_hook return type to printk_hook_fn_t
Not sure why this was returning a void * but it seems to make sense to
return the correct type instead.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-07-27 10:41:01 +03:00
Fabio Baltieri
36768aa7ff lib: os: use a typedef for __printk_hook_install argument
Use a typedef for the printk hook function argument.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-07-27 10:41:01 +03:00
Fabio Baltieri
ef14c9b867 lib: os: add a header for printk hook functions
Add a zephyr/printk.h header for the __printk_hook functions, these are
currently manually declared by all console drivers for no good reason.

Move the documentation into the header and also unify the way that
console drivers call the function.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-07-27 10:41:01 +03:00
Robert Lubos
33d59f8148 include: zephyr: net: Add version information to public network APIs
Add \since and \version doxygen tags to the networking APIs, so that
they render correctly on the API overview page.

The version used for \since tag was determined, based on the commit that
introduced the header or in individual cases, when the API was
introduced as a part of a larger header (mostly apply for the oldest,
core network APIs).

The version of the API was set as follows:
* components that use EXPERIMENTAL Kconfig symbol were assigned with
  0.1.0
* The oldest, "core" networking APIs were marked as "stable" (1.0.0).
* Everything else ended up as "unstable" (0.8.0).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-07-27 10:37:41 +03:00
Robert Lubos
1df711420f inlcude: zephyr: net: Fix copy-paste doxygen errors
Use proper description for the socket_can and socket_net_mgmt groups.

Additionally, socket_can group was defined twice, which is incorrect.
For socketcan_utils.h use @addtogroup instead to merge the API
documentation into the socket_can group defined in socketcan.h.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-07-27 10:37:41 +03:00
Jamie McCrae
2aa6b81b64 retention: Fix documentation issue
Fixes a minor issue with the return value in the documentation

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-07-25 09:25:21 +02:00
Dominik Ermel
65e679214e storage/stream_flash: Fix write_block_size too small
Fix for platforms with write-block-size >= 256 bytes.

Fixes #76029

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-07-18 12:32:35 -04:00
Gerard Marull-Paretas
ce8b99b9f0 net: dns_sd: fix incorrect usage of code/endcode
`@code` needs file extension
`@endcode` doesn't take any arguments

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-18 09:23:33 -04:00
Gerard Marull-Paretas
bd921a1ca9 debug: symtab: move to os_services doxygen group
Instead of being a top-level group.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-18 09:23:33 -04:00
Gerard Marull-Paretas
8a7fd88ed3 bindesc: add to os_services doxygen group
Instead of being a top-level group.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-18 09:23:33 -04:00
Gerard Marull-Paretas
284bf28169 dt-bindings: sensor: icm42688: move to sensor_interface doxygen group
Instead of showing up as a top-level Doxygen group.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-18 09:23:33 -04:00
Gerard Marull-Paretas
b792e63b0f debug: mipi_stp_decoder: move to os_services doxygen group
The API was placed under a non-existing group: coresight_apis. Place it
under os_services, as other debug/ APIs.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-18 09:23:33 -04:00
Gerard Marull-Paretas
398dd4e505 drivers: tee: move interface to io_interfaces doxygen group
The TEE driver interface was put under a non-existing group: security.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-18 09:23:33 -04:00
Swift Tian
fe3b65e33e drivers: mspi: Mark MSPI API version 0.1.0
Mark MSPI API as experimental with version 0.1.0 for release 3.7

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2024-07-18 09:32:29 +02:00
Jordan Yates
3e059e7292 sd: sd_spec: update trailing doxygen comments
While doxygen comments on subsequent lines with the `/*<` is technically
valid, it is not standard. It also confuses at a minimum the `vscode`
intellisense provider, which assigns the comments to the wrong enum
values.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-17 16:19:07 -04:00
Jordan Yates
3615e69428 sd: sd_spec: fix voltage enum docs
Fix voltage enum docs as there was a repeated comment at
`SD_OCR_VDD30_31FLAG`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-17 16:19:07 -04:00
Tavish Naruka
ca02651f01 toolchain: gcc: fix SECTION_DATA_PROLOGUE for XIP
Current if CONFIG_XIP is enabled, then ALIGN_WITH_INPUT and the align
argument to SECTION_DATA_PROLOGUE are set together, and that is not a
valid option combination; if ALIGN_WITH_INPUT is present, then the
section's LMA alignment is inherited from the previous section, and that
cannot be combined with another alignment option.

The background for this line is in the following commit:
6b3c5e8bb2

Additionally, this is the documentation from ld:

(from https://sourceware.org/binutils/docs/ld/Forced-Output-Alignment.html)

> 3.6.8.3 Forced Output Alignment
>
> You can increase an output section’s alignment by using ALIGN. As an
> alternative you can enforce that the difference between the VMA and
> LMA remains intact throughout this output section with the
> ALIGN_WITH_INPUT attribute.

Signed-off-by: Tavish Naruka <t-naruka@ispace-inc.com>
2024-07-12 16:09:36 -04:00
Yong Cong Sin
269729a5db net: socket: fix sys/_timespec.h not found error
When building `native_sim` with CPP & POSIX enabled, the
POSIX's `unistd.h` header causes a compilation error as
`sys/_timespec.h` doesn't exist in host gcc lib.

Remove the 'zephyr/posix' prefix, and rely on
`CMakeLists.txt`s to do the routing accordingly:
- zephyr/lib/CMakeLists.txt:L11
- zephyr/lib/posix/options/CMakeLists.txt:L8

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-07-12 09:12:58 -04:00
Simon Hein
2479fdcac1 kernel: timer: Add missing parameter description
Add the missing parameter description for the timer API
function k_timer_remaining_ticks.

Signed-off-by: Simon Hein <Shein@baumer.com>
2024-07-12 09:12:03 -04:00
Emil Gydesen
eaa2bf0ab7 Bluetooth: VOCS: Add missing documentation in vocs.h
Add missing documentation for some defintions in vocs.h

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-07-12 06:24:39 -04:00
Emil Gydesen
e647773d01 Bluetooth: VCP: Add missing documentation in vcp.h
Add missing documentation for some defintions in vcp.h

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-07-12 06:24:39 -04:00
Emil Gydesen
14caa79c45 Bluetooth: TMAP: Add missing documentation in tmap.h
Add missing documentation for some defintions in tmap.h

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-07-12 06:24:39 -04:00