Compute the maximum of the CONFIG_USBD_VIDEO_MAX_FRMIVAL and
CONFIG_USBH_VIDEO_MAX_FRMIVAL for struct definition, so that
the same struct can be relevant for both host and device
implementation.
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Signed-off-by: Aiden Hu <weiwei.hu@nxp.com>
Co-authored-by: Aiden Hu <weiwei.hu@nxp.com>
Loop through each of the VideoStreaming and VideoControl descriptor
to parse them. This is meant as a stub for the purpose of testing the
class API.
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
This fixes an issue where the modem pipe is declared closed before it
actually is closed, leading to issues when you try to re-open quickly.
Signed-off-by: Vytautas Virvičius <vytautas@virvicius.dev>
Use the appropriate macro K_MUTEX_DEFINE to define the global `llext_lock`
mutex instead of declaring it like a regular variable initialized
using the internal Z_MUTEX_INITIALIZER() helper.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
The driver and module now supports nRF70 only, nRF71 support will be
added in the future using a new driver.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
NVS ATE validation currently relies on CRC8 and coarse boundary checks
against the sector size. Because CRC8 has a non-negligible collision
probability (1/256), a corrupted ATE may occasionally pass CRC
verification while still containing invalid offset or length fields.
Instead of only validating that the referenced data fits within the
sector, this change additionally verifies that the end of the data
region (offset + len) does not exceed the physical position of the ATE
itself.
Due to the append-only write order of NVS, data is always written before
its corresponding ATE. Therefore, any ATE referencing data beyond its
own location is structurally invalid and must be rejected.
This tighter consistency check significantly reduces the likelihood of
accepting corrupted ATEs without introducing additional flash reads or
changing the on-flash format.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
next_event should not be global. This can cause
linkage conflicts if another file defines a symbol
with the same name.
Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
CoAP response code 2.00 is not defined anywhere in the spec nor
assigned in the IANA registry, therefore it should not be defined
in Zephyr either. Remove the invalid response code and its usage
in tests.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This makes using instrumentation with any sample/board combination
much easier, as it eliminates the need to define a custom dt overlay.
Trigger/stopper functions need to be configured at build time.
Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
Move UVC helper functions to a file shared between UVC host and device.
The arrays are not visible anymore from either USB host or device, but
instead accessed through a front-end funciton.
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
With the C23 standard, false and true are keywords and constants of type
bool with a value of 0 and 1. Though there does not seem to be issues
with GCC version 14, there is a note in the specification that the
spelling of false and true inside expressions that are subject to the #
and ## preprocessing operators is unspecified.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Correct function prototype which causes a compiler warning
and builds to fail due to it.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The USB host will have to select the appropriate size for the configurtion
descriptor, and the defaults will not be enough for some classes that
encode a lot of information in the configuration descriptor.
Add logging to debug this.
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Add tests making sure the USB Host class APIs introduced build
and run as expected. Use USB device samples common code for
initialization.
Co-authored-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Allocate a larger size to keep room for a nil descriptor at the end of
the configuration descriptor. This is used to walk through the list of
descriptors until this empty descriptor happens.
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Make sure that there is at least enough room for the header before
dereferencing the fields such as bLength.
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Move the UVC header with all the definitions from the UVC standard to
share it between USB host and device class implementation.
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Add functions to probe/remove all classes as part of a new usbh_class.c
and a matching usbh_class.h. These functions are called from the function
usbh_init_device_intl() in usbh_core.c to initialize every class upon
connection of a device. Every class driver provide filters to match the
interfaces of the device.
Co-authored-by: Aiden Hu <weiwei.hu@nxp.com>
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Add basic functions to initialize and probe class drivers.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Add helpers to parse and validate USB descriptors.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
In addition to storing the interface pointers, also store the pointers
for the interface association. Also add comments to the other fields
of the structs to adapt to a new CI check.
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Add API wrappers around the function pointers in struct usbh_class_api,
while also documenting the USB host class internal API.
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Rename variable 'ret' to 'err' in cmd_send_media() to align with
Zephyr coding conventions for error return values.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
- Name derived from Zephyr cyclictest
- Inspired by Linux realtime test program cyclictest
- Measure latency of interrupt service routine as well as thread with the
help of the timer interrupt, of which the programmed point of time is
known.
- Zyclictest thread is running in background while individual application
under test can be running in foreground.
- The interval can be set up with optional argument -i. It should be at
least double of expected worst case thread latency to get valid output.
If this is not met the measurement needs to be repeated.
- The priority can also be set up. It should be the priority of the
application which should run on the final product.
- The maximum size of the histogram is hard coded to 200 so far.
- After stopping measurement the maximum latency, number of errors /
overflows and the histogram itself is printed.
- Histogram is printed in a form which is easy to be used by plotting
programs like GNUplot or Python matplotlib.
- Example: One wants to know what is the expected maximum latency of a
cooperative task with priority of -10.
$ zyclictest start -i 400 -p -10
$ # start your application test cases
$ zyclictest stop
Count: 547329
IRQ Thread
Max-Latency: 21 27
Errors: 0 0
Overflow: 0 0
Histogram:
...
23 0 547306
24 0 2
25 0 5
26 0 5
27 0 2
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Add pressure policy to cpu_freq subsystem. The
pressure policy evaluates system load by accumulating
the priorities of runnable threads to inform P-state
transitions.
As more threads of higher priorities queue as ready
in the scheduluer, the system pressure increases
and the policy may decide to choose a more aggressive
P-state.
Signed-off-by: Sean Kyer <sean.actor@gmail.com>
Enchance the cpu_freq subsystem to remember the latest
pstate and skip calling the pstate_set function if
the next pstate is the same as the last.
Signed-off-by: Sean Kyer <sean.actor@gmail.com>
Add shell command for testing BR/EDR inquiry scan parameters update.
Supports default parameter set and custom parameters via interval/
window/type arguments for inquiry scan configuration.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Implement BR/EDR inquiry scan parameters update functionality with
new API bt_br_inquiry_scan_update_param(). Adds support for setting
inquiry scan interval, window and type via HCI commands. Includes
default parameter set for standard inquiry scanning.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Implement BR/EDR page scan parameters update functionality with new
API bt_br_page_scan_update_param(). Adds support for setting page scan
interval, window and type (standard/interlaced) via HCI commands.
Includes predefined parameter sets for different Bluetooth versions
and use cases.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
This commit implements Class of Device (COD) test shell
functionality for Classic Bluetooth, supporting both
setting and retrieving COD from the controller.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
This commit implements Class of Device (COD) functionality for
Classic Bluetooth, supporting both setting and retrieving COD
from the controller by bt_br_write_cod and bt_br_read_cod.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Allow applications to respond to HTTP OPTIONS requests (e.g. CORS pre-
flight) by routing OPTIONS through the same dynamic handler path
as GET/DELETE.
This enables OPTIONS handling for both HTTP/1.1 and HTTP/2.
Signed-off-by: Robert Eichinger <robert.eichinger@bshg.com>
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
When building with CONFIG_NO_OPTIMIZATIONS the compiler will not
optimize create_answer() based on the caller, and will try to call
ipv4/6 code even if not built.
Let's add an extra check in the if before those possibly unavailable
calls to ensure those branches are dropped in this case.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Extend the Wi-Fi shell connect command to allow passing an SAE
password separately from PSK. Previously, the shell stored all
passwords in the PSK field, preventing proper use of SAE credentials
required for WPA3 connections.
This change adds a dedicated option to populate the SAE password
field so that SAE authentication paths can be exercised correctly
from the shell.
Signed-off-by: Somil Gupta <somil24559@iiitd.ac.in>
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
initialized and used with proper essential type (true/false).
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Fixes macros that broke after changes were merged which started
using the unit address of partition nodes. This also fixes the
test to ensure devices not starting at 0x0 are properly checked
which previously would silently be unknown
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add helpers for sending all the data in a buffer. This is
only useful for stream sockets like TCP.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
CoAP .well-known/core handling routine assumed that the "user_data"
pointer in struct coap_resource will be set to a valid struct
coap_core_metadata pointer, or left NULL. This approach is error
prone (application cannot use "user_data" field freely) and renders the
"user_data" field useless for other cases.
Therefore, introduce a separate "metadata" pointer within the struct
coap_resource specifically to configure the resource-related metadata,
and leave "user_data" for the applications to use freely.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If fs_stat() is done on a mount point treat
it like it is a directory, instead of leaving it to
the implementation of the filesystem.
The fatfs for example will fail.
That is also the reason `fs cd` from the fs shell
fails, when trying it on a mountpoint with fatfs.
This also makes the behavior of fs_stat() similar to the one
of fs_readdir(). Especially as both functions use the
`struct fs_dirent` to return the informations.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>