This reverts commit 755cc644cc.
This approach is problematic in several ways. First, `intptr_t` could
cause undefined behavior in the subtraction when the pointer converts to
a negative value. Except in weird cases where the sign of the pointer
identifies a memory domain (like kernel vs userspace) I'm unaware of any
valid use of `intptr_t`.
Second, this macro was created to address a special need that cannot
rely on defined behavior: i.e. to ensure that data definitions are
placed in contiguous space and access is provided through linker-defined
symbols, for which the language required alignment and continuity is not
guaranteed.
A macro that calculates the span between linker symbols has very
different semantics than one that calculates the difference between
pointers. Replace the global PTR_DIFF with a documented local macro
that tests what's necessary without risking integer overflow.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Let's use the PTR_DIFF() helper which performs pointer difference in a
64-bit compatible way, and use %zu for printing sizeof() results.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
move misc/byteorder.h to sys/byteorder.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
USBD_CFG_DATA_DEFINE macro has not consider that a class
could have more than one set of usb_cfg_data struct.
If a class has more than one set of usb_cfg_data
then they should be sorted the same way like by
USBD_DEVICE_DESCR_DEFINE macro.
Fixes: #16240
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
Refactor device api test using standard placement for descriptor table
and configuration data.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
In order to unify the legacy and composite code, move the class and
vendor request handler buffer into the USB device code, just like in
composite mode. The option is renamed from USB_COMPOSITE_BUFFER_SIZE
into USB_REQUEST_BUFFER_SIZE and also replaces the USB_DFU_MAX_XFER_SIZE
and USB_HID_MAX_PAYLOAD_SIZE options.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Add verification that interface number and endpoint addresses are
correctly allocated.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier. Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.
By default all files without license information are under the default
license of Zephyr, which is Apache version 2.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
After including native_posix USB controller we can perform some simple
tests on native_posix.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This allows to place instances of the class one after another in the
linker section.
Fixes#12908
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
USB relies on descriptors and configuration data allocations in
specific sections. This simple test verifies that at least size of the
data is correct.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>