Commit graph

8 commits

Author SHA1 Message Date
Tomasz Moń 08bd1c5ec2 usb: device: Fix ZLP write race condition
ZLP packet has to be read and acknowledged by host just like any other
DATA packet. Do not end transfer until the host actually acknowledged
the trailing ZLP. This fixes the race condition between host and Zephyr
application where the next transfer could be lost if host did not issue
IN token (that would read read ZLP) before the application tried to
start new transfer.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-10-26 13:52:31 +02:00
Tomasz Moń 0ab14d94b8 usb: device: Fix transfer slot leak without callback
Log transfer status and release transfer semaphore regardless if user
provided transfer completion callback or not. This fixes transfer slot
leak when transfer without callback completes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-08-04 22:54:17 +00:00
Johann Fischer 0ad1eef4b7 usb: device: Revert "fix possible deadlock in usb_transfer_sync()"
This reverts commit cd7461495f,
introduced to fix possible deadlock as result of changes in
commit f206170c65
("usb: device: Do not call callback when transfer is cancelled")
which is now reverted.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-04-17 11:30:48 +02:00
Nickolas Lapp 81e4934ebd usb: device: Revert "Do not call callback when transfer is cancelled"
This reverts commit f206170c65
introduced as workaround for nRF USBD device controller in PR
https://github.com/zephyrproject-rtos/zephyr/pull/16193.

This commit may be reverted due to changes made in
commit e326c58399
("usb: device: Do not cancel transfers on suspend").

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-04-17 11:30:48 +02:00
Zachary J. Fields 66aff25396 usb: usb_transfer.c: Address -Wextra warnings
Changed incrementing `for` loop counters to `size_t` from `int` to
eliminate warning, "warning: comparison of integer expressions of
different signedness: 'uint32_t' {aka 'unsigned int'} and 'int'
[-Wsign-compare]"

Signed-off-by: Zachary J. Fields <zachary_fields@yahoo.com>
2023-02-24 09:39:01 +01:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Gerard Marull-Paretas 5113c1418d subsystems: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all subsystems code to
the new prefix <zephyr/...>. Note that the conversion has been scripted,
refer to zephyrproject-rtos#45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 12:07:35 +02:00
Johann Fischer 6be45c2a18 usb: move USB device stack code to own directory
Until now the whole USB device stack code is located
in the top subsys/usb directory. Move it to own directory
in preparation for upcoming extension and rework of USB support.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-31 18:30:14 +02:00
Renamed from subsys/usb/usb_transfer.c (Browse further)