Storing stuff in user_data? That's a paddlin'
We have been debugging issue after issue because ownership of this
"user" data is not clearly defined. Now it is. L2CAP owns the user_data
field entirely, as soon as `send()` is called.
Also add a warning and retval using CHECKIF.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Declare __stdout_hook_install in libc-hooks.h and use it in the console
drivers rather than redeclare it every time.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
If using `<zephyr/linker/section_tags.h>` without including
`zephyr/linker/sections.h` as well, we get a warning an the linker fails
to place the data in the desired section.
Signed-off-by: Martin Stumpf <finomnis@gmail.com>
Adapting icmsg to work without the MULTITHREADING functionality.
Dependencies for kernel work_queue, mutexes and other functions
related to running multithreaded applications have been 'ifdefed'.
Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
Add support of sys_poweroff API on m46x series.
It could support SPD standby or DPD deep power down mode.
Signed-off-by: cyliang tw <cyliang@nuvoton.com>
The i2c_transfer API specifies that the I2C_MSG_STOP flag implicitly
is set for the last message in a i2c_transfer(). This is identical to
explicitly setting the I2C_MSG_STOP flag in the last message, which is
what every driver which properly adheres to this specification does.
The i2c_transfer_cb API is seemingly identical to the i2c_transfer_api,
it references it using @see i2c_transfer(), while providing a callback,
and being available from isr context. This commit extends the wrapper
to provide the following guarantees also present in the i2c_transfer API:
- If num_msgs is 0, no transfer will occur
- The last message of the transfer implies a stop condition
This allows for users to use both functions interchangeably, while
removing handling of num_msgs = 0 and last message missing stop cond
from device drivers.
Additionally a check for num_msgs == 0 is added to prevent any transfer
and immediately call back with success then return without invoking
the transfer_cb API.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
The i2c_transfer API specifies that the I2C_MSG_STOP flag implicitly
is set for the last message in a i2c_transfer(). This is identical to
explicitly setting the I2C_MSG_STOP flag in the last message, which is
what every driver which properly adheres to this specification does.
This commit updates the i2c_transfer() API wrapper to explicitly set
the flag before calling the drivers API implementation, which ensures
the specification is followed, while moving this additional complexity
from the device drivers themselves.
Additinally it checks for the num_msgs being 0, in which case no
transfer shall occur, nor shall any stop condition be set. This removes
an additional check from device drivers.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Allow an application to add a Block2 option to an initial request for a
resource. For any subsequent requests as part of a blockwise transfer,
drop the application-added Block2 option since the coap_client must
append a Block2 option with updated NUM and SZX fields based on the
server response.
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
Add usbd_device_set_bcd_device() for setting the bcdDevice device
descriptor value.
The default bcdDevice is set to the version of Zephyr being used, which may
or may not be what a downstream USB device wants it to be.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Rename usbd_device_set_bcd() to usbd_device_set_bcd_usb() to make room for
other BCD encoded values being set.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Add a INPUT_CALLBACK_DEFINE_NAMED macro, same as INPUT_CALLBACK_DEFINE
but with custom struct name, useful for declaring multiple callbacks
with different user_data on the same callback function.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add a void *user_data pointer to the input callback structure. This is
useful for driver to get back the driver data structure and avoid
defining wrapper functions.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Convert pin control, GPIO and external interrupt controller drivers
based on SIUL2 peripheral to native drivers. This must be done in a
single commit to preserve atomicity, as these drivers depend on each
other.
Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
adds filesystem as a resource for the http_server which serves static
(gzipped) files from a filesystem to the client.
Signed-off-by: Gerhard Jörges <joerges@metratec.com>
The Association permit bit shall be set to zero if the coordinator does
not accept association requests.
Not accepting association request ist not a reason to filter the
beacons from this coordinator during network scan. It is still a
network, just one you cannot associate with.
Signed-off-by: Fabian Pflug <fabian.pflug@grandcentrix.net>
This should make it more clear for users that they shouldn't
run blocking code in the callback.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Update the struct gnss_time millisecond member to specify
that a leap second is a valid value.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Introduce UDC_BUF_POOL_*_DEFINE macros based on NET_BUF_POOL_*_DEFINE
macros but use our own version of alloc and unref callbacks to get
buffers with specific alignment and granularity. Also, do not use ref
callback because it breaks alignment.
Also introduces helper macros for defining and checking UDC
driver-compliant static buffers.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add implementation to analyze threads on each cpu separately. This
feature can be enabled with THREAD_ANALYZER_AUTO_SEPARATE_CORES Kconfig
option. If enabled, an analyzer thread is started for each cpu, and
the threads will only analyze thread on the cpu its running on.
This feature is needed for Intel ADSP platform, where cpu specific
caches are not synchronized between the cpu. It is also probably
needed by other platforms having CONFIG_KERNEL_COHERENCE=y, so default
to THREAD_ANALYZER_AUTO_SEPARATE_CORES=y for those platform.
Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Add functions k_thread_foreach_unlocked_filter_by_cpu() and
k_thread_foreach_filter_by_cpu() to loop through the threads on the
specified cpu only.
Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Revision 1p7 of the silicon added support for IBI TIR, full word fifo
while target usage, defining byte with direct CCCs. This also adds
support of HDR-DDR.
This also fixes short ccc commands where multiple targets in a
payload for the same ccc.
Modification of the i3c_target_tx_write had to be done in order to
distinguish the difference for each fifo to be written to.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
This commit adds a description for the lsm9ds1 sensor,
with a .h file containing all configuration options.
Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
This patch introduces a new API function, `dai_config_update`, in the
DAI driver API to enable runtime updates to the DAI configuration. This
function allows bespoke configuration parameters to be set, enabling
updates that are specific to the DAI implementation and can be applied
outside of the regular configuration flow.
The addition of this API provides greater flexibility for adjusting DAI
settings at runtime, which is particularly useful in scenarios where
only specific parameters need to be modified without the need to
reconfigure the entire DAI interface.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
The modem pipe APIs include synchronous calls to open/close,
which internally use a fixed timeout of 10 seconds. The timeout
should be configurable through the APIs, anywhere from K_NO_WAIT
to K_FOREVER.
This commit adds timeout parameters to the open/close APIs, and
updates in-tree usage of the open/close APIs to explicitly
provide the previously implicit timeout of 10 seconds.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>