Convert with a combo of scripts and by hand fixups:
git grep -l DT_FLASH_AREA_.*_ID | \
xargs sed -i -r 's/DT_FLASH_AREA_(.*)_ID/FLASH_AREA_ID(\L\1)/'
git grep -l DT_FLASH_AREA_.*_OFFSET | \
xargs sed -i -r 's/DT_FLASH_AREA_(.*)_OFFSET/FLASH_AREA_OFFSET(\L\1)/'
git grep -l DT_FLASH_AREA_.*_SIZE | \
xargs sed -i -r 's/DT_FLASH_AREA_(.*)_SIZE/FLASH_AREA_SIZE(\L\1)/'
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an
undesirable API for the following reasons:
- it's inconsistent with the rest of the DT_NODE_HAS_FOO names
- DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand
for macros which are equivalent to
DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) &&
- DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck
- DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway
- it is seen as a somewhat aesthetically challenged name
Replace all users with DT_NODE_HAS_STATUS(..., okay), which is
semantically equivalent.
This is mostly done with sed, but a few remaining cases were done by
hand, along with whitespace, docs, and comment changes. These special
cases include the Nordic SOC static assert files.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit updates USB audio class implementation with
DT changes introduced in 7e0eed9235. In particular rename
DT_NUM_INST to DT_NUM_INST_STATUS_OKAY.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
By this commit USB audio class implementation is introduced
to Zephyr.
The Zephyr USB audio device class follows bellow
documentations:
- Universal Serial Bus specification rev2.0 (usb20.pdf)
- Universal Serial Bus Device Class Definition for Audio Devices
(audio10.pdf)
- Universal Serial Bus Device Class Definition for Audio Data Formats
(frmts10.pdf)
- Universal Serial Bus Device Class Definition for Terminal Types
(termt10.pdf)
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
This commit adds support for receiveing data from ISO OUT endpoint
for NRF devices. NRF USB IP core does not generate IRQ when
data are received on ISO OUT endpoint and it must be synchronized
with SOF event.
Enable SOF handling by default if usb audio is configured
with NRF devices.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
This commit introduces dedicated return type for custom_handler.
Relevant code is updated to fulfill the API documentation.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
This exception allows USB Audio Class to properly respond to the
interface requests.
This commit is temporary solution and shall not be considered as
valid solution for other classes.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
Rename DT_HAS_NODE to DT_HAS_NODE_STATUS_OKAY so the semantics are
clear. As going forward DT_HAS_NODE will report if a NODE exists
regardless of its status.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Flash drivers may impose alignment requirements on the destination
buffers due to use of DMA transfers. In particular Nordic QSPI flash
API requires that addresses, sizes, and buffers all by 4-byte aligned.
Align the page buffer to satisfy this requirement.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Convert the usb_vbus_set function to utilize a chosen property
('zephyr,usb-device') to determine the device node that should have a
'vbus-gpios' property set for usb_vbus_set to be more than just a noop.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This makes hci_raw to manage RX and TX buffers so its logic don't have
to be replicated on each an every driver/application, it also makes it
simpler to deal with extra headers for H:4 mode since that then can be
done at earlier at buffer allocation.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds support for registering a command extention table which is
used to match incoming commands and then pass the buffer to its
function handler.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds 2 config options which enables hci_raw to work in
H:4 mode and enable it by default automatically.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Buffer are allocated with K_FOREVER should never fail, in addition to
that asserts needs to be enabled and is not worth converting to runtime
check given the use of K_FOREVER.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Allowing to configuring the MPS different then the buffer size might
actually generate data fragmentation/reassembly so this just use
BT_BUF_RX_SIZE which is set accourding to the controller buffer size.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Allowing to configuring the MPS different then the buffer size might
actually generate data fragmentation/reassembly so this just use
BT_BUF_ACL_SIZE which is set accourding to the controller buffer size.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds USB_PID_BLE_HCI_H4_SAMPLE along with it driver which uses H4
over bulk endpoints.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Now that the hardware identifier obtained with the hwinfo API is stored
in the correct order based on the platform, there is no longer the need
to reverse its bytes when populating the serial number in the
corresponding USB descriptor.
Fixes#24103
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit makes cdc class to omit notifications about
interfaces swap that may happen if cdc is configured together
with audio.
Signed-off-by: Johan Carlsson <johan.carlsson@teenage.engineering>
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
Kernel timeouts have always been a 32 bit integer despite the
existence of generation macros, and existing code has been
inconsistent about using them. Upcoming commits are going to make the
timeout arguments opaque, so fix things up to be rigorously correct.
Changes include:
+ Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout
values for equality (e.g. with K_FOREVER or K_NO_WAIT).
+ Adding a k_msleep() synonym for k_sleep() which can continue to take
integral arguments as k_sleep() moves away to timeout arguments.
+ Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to
generate timeout arguments.
+ Removing the usage of K_NO_WAIT as the final argument to
K_THREAD_DEFINE(). This is just a count of milliseconds and we need
to use a zero.
This patch include no logic changes and should not affect generated
code at all.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
By changing the various *NET_DEVICE* macros. It is up to the device
drivers to either set a proper PM function or, if not supported or PM
disabled, to use device_pm_control_nop relevantly.
All existing macro calls are updated. Since no PM support was added so
far, device_pm_control_nop is used as the default everywhere.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Fix so that different isochronous synchronization modes can be used.
It filters out the synchronization mode before sending the endpoint
type to drivers.
Signed-off-by: Johan Carlsson <johan.carlsson@teenage.engineering>
Fix API usage error introduced by the commit c88155fd2d
("usb: mass_storage: fix possible page buffer overflow")'
Fixes: #23295
CID: 208676
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
Set initialization level of CDC ACM class to POST_KERNEL.
The proposed OpenThread Network-Coprocessor uses ACM. OpenThread is
started at POST_KERNEL level by the 802.15.4 radio drivers.
Signed-off-by: Markus Becker <markus.becker@tridonic.com>
When an unsupported SCSI command is received, an error status reply
is sent even if the Host expects data prior to the status.
This fix stalls the data reply before sending the error status.
Signed-off-by: Audun Korneliussen <audun.korneliussen@nordicsemi.no>
The page buffer can overflow if dCBWDataTransferLength
is multiple of the BLOCK_SIZE but the host uses
OUT packets smaller than MPS durng transfer.
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
During DFU_UPLOAD, the host could requests more data
as stated in wTransferSize. Limit upload length to the
size of the request buffer (USB_REQUEST_BUFFER_SIZE).
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
When the length of the transfer is an exact multiple of IN endpoint MPS
in the ring buffer, transfer one byte less to avoid zero-length packet.
Otherwise the application running on the host may conclude that there
is no more data to be received (i.e. the transaction has completed),
hence not triggering another I/O Request Packet (IRP).
Fixes#21713.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
In case the ring buffer is empty, ring_buf_get_claim() returns a zero
length. Exit the function in that case as calling usb_transfer() with a
zero length will send a ZLP.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Currently the cdc_acm implementation pass the data to usb_transfer() by
a chunk of IN endpoint MPS. This has 2 drawbacks:
- at higher throughput, each transfer needs 2 packets due to the need of
an extra ZLP;
- a temporary buffer of size USB MPS is needed.
This patch improves the memory consumption and performances by passing
the ring buffer directly to usb_transfer(). It only has a small
performance degradation when the ring buffer wraps and less than a IN
endpoint MPS has to be sent.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
setting/resetting endpoints is required when switching to alternate
interfaces. This is a common operation for usb audio class.
When audio device is enumerated host invokes set_interface request
to alternate with 0 endpoints associated. That operation lead to
disable never enabled endpoints. With previous solution error message
will appear.
This commit limits error messages to be present only if endpoint
was configured/enabled before and there was a problem when trying
to configure/enable it for the first time.
* Kinetis driver was updated with return error value when ep was
already configured/enabled.
* nxp driver updated with return error value when ep was already
enabled
* sam0 driver updated with return codes instead of magic numbers.
This is fix patch to #21741
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
I think people might be reading differences into 'if' and 'depends on'
that aren't there, like maybe 'if' being needed to "hide" a symbol,
while 'depends on' just adds a dependency.
There are no differences between 'if' and 'depends on'. 'if' is just a
shorthand for 'depends on'. They work the same when it comes to creating
implicit menus too.
The way symbols get "hidden" is through their dependencies not being
satisfied ('if'/'depends on' get copied up as a dependency on the
prompt).
Since 'if' and 'depends on' are the same, an 'if' with just a single
symbol in it can be replaced with a 'depends on'. IMO, it's best to
avoid 'if' there as a style choice too, because it confuses people into
thinking there's deep Kconfig magic going on that requires 'if'.
Going for 'depends on' can also remove some nested 'if's, which
generates nicer symbol information and docs, because nested 'if's really
are so simple/dumb that they just add the dependencies from both 'if's
to all symbols within.
Replace a bunch of single-symbol 'if's with 'depends on' to despam the
Kconfig files a bit and make it clearer how things work. Also do some
other minor related dependency refactoring.
The replacement isn't complete. Will fix up the rest later. Splitting it
a bit to make it more manageable.
(Everything above is true for choices, menus, and comments as well.)
Detected by tweaking the Kconfiglib parsing code. It's impossible to
detect after parsing, because 'if' turns into 'depends on'.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
For USB audio class interface may have alternate interfaces.
Those alternates may have different endpoint configurations.
When Standard Request SET_INTERFACE is served it choses between
alternate interfaces and configuring associated endpoints.
When switching between alternate interfaces, endpoints
associated with them must be disabled/enabled accordingly.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
IS_ENABLED() is only useful for macros that might be undefined.
VERBOSE_DEBUG is defined at the top of these files.
Also makes it harder to confuse for for Kconfig references.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
For the native_posix board where hwinfo is not implemented tests were
reporting errors.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>