Commit Graph

70 Commits

Author SHA1 Message Date
hathach
1f18be93db change the tusb_rhport_init_t struct, exclude the rhport to make API more consistent 2024-10-14 18:27:52 +07:00
hathach
d997f0071e change dcd_init() to take rhport struct 2024-10-11 15:31:49 +07:00
hathach
4bc6a5feb7 fix unused warning 2024-04-08 22:22:00 +07:00
hathach
c3c0648456 add class driver deinit 2024-04-08 22:07:56 +07:00
Felix "xq" Queißner
47c12a07f2 Implements tuh_deinit() and tud_deinit() to uninitialize host/device mode. 2024-04-08 19:00:35 +07:00
hathach
6dc714b6de - only abort ep0 if it is active
- rename reset_ep0_pid() to reset_ep0()
- minor update log message
2024-03-13 11:41:58 +07:00
hathach
2f0ad918cc Merge branch 'master' into fix-rp2040-ctrl-xfer 2024-03-12 16:59:12 +07:00
hathach
5653232144 reformat code 2024-03-11 21:59:30 +07:00
Taylor Yu
473d400cfd work around possible RP2040 erratum
RP2040 device controller does not seem to clear pending transactions
configured in EP0 buffer controls when the host aborts a control
transfer. This causes assertion failures, including when a buffer
AVAILABLE flag set for a previous transfer causes an unexpected
transaction completion.
2024-02-26 09:25:51 -06:00
Lars Pötter
2029ca9536 also fixed pico_trac() log messages. 2023-07-02 10:53:08 +02:00
hathach
3cfb838ba7 fix warnings when enable rtt with rp2040 2023-06-26 17:03:45 +07:00
hathach
bdfcd50b1b Merge branch 'master' into portability 2023-03-17 23:53:38 +07:00
hathach
d9a9dc5ac0 fix PICO_SHARED_IRQ_HANDLER_HIGHEST_ORDER_PRIORITY not defined in old pico-sdk 2023-03-15 17:38:14 +07:00
Dan Halbert
4857abdc6b rp2040: include hardware/sync.h explicitly 2023-03-10 14:01:51 -05:00
graham sanderson
b7fa90e706 rp2040: Fixup lib and example compile for LLVM Embedded Toolchain for ARM 2023-03-02 14:32:22 -06:00
hathach
ddb061f639 fix typos 2023-01-31 19:03:31 +07:00
hathach
19b6cbc616 add e15 prefix or walkaround related functions, also minor refactor 2023-01-31 17:15:42 +07:00
hathach
0cce42fcc6 minor clean up 2023-01-31 11:38:15 +07:00
Jonathan Bell
73b0047efc rp2040: avoid device-mode state machine hang
Don't mark IN buffers as available during the last 200us of a full-speed
frame. This avoids a situation seen with the USB2.0 hub on a Raspberry
Pi 4 where a late IN token before the next full-speed SOF can cause port
babble and a corrupt ACK packet. The nature of the data corruption has a
chance to cause device lockup.

Use the next SOF to mark delayed buffers as available. This reduces
available Bulk IN bandwidth by approximately 20%, and requires that the
SOF interrupt is enabled while these transfers are ongoing.

Inherit the top-level enable from the corresponding Pico-SDK flag.
Applications that will not use the device in a situation where it could
be plugged into a Pi 4 or Pi 400 (for example, when directly connected
to a commodity hub or other host) can turn off the flag in the SDK.

v2: use a field in hw_endpoint to mark pending.

v3: Partial rewrite following review comments

- Stub functions out if the workaround is not required
- Only force-enable SOF while any vulnerable endpoints are active
- Respect dcd_sof_enable() functionality
- Get rid of all but necessary ifdef hackery
- Fix a bug where the "endpoint lock" was used with an uninitialised pointer.
2023-01-24 11:53:28 +00:00
Jonathan Bell
c3e47c31cc rp2040: export hw_endpoint_start_next_buffer() and hw_endpoint_lock_update()
The next change to the driver requires the export of these functions. Leave the
lock unimplemented for now.

Also move hw_set and hw_clear aliases into the top-level header file.
2023-01-23 10:55:20 +00:00
mingpepe
988eeb50c6 Fix typo for log in dcd_rp2040.c 2022-10-05 21:26:22 +08:00
Ben Avison
53f0d5538b Don't assume ints automatically convert to enums
IAR generates warning Pe188 'enumerated type mixed with another type'.
2022-09-13 18:00:50 +01:00
Ben Avison
6dfc857b91 [rp2040] Explicit cast value of hw_set_alias
Some compilers don't support the GNU extension `typeof` so their definitions
of `hw_set_alias` can't inherit their type from their argument, and the best
we can do is have `hw_set_alias` act the same as `hw_set_alias_untyped`.
This requires an explicit cast when the macro is used instead, otherwise
IAR generates error Pe132 'expression must have pointer-to-struct-or-union
type but it has type "void *"'.

The same goes for `hw_clear_alias`.
2022-09-12 18:46:09 +01:00
hathach
9ec92ff97b rp2040 enable SOF as resumed signal when remote wakeup 2022-06-30 15:45:04 +07:00
graham sanderson
c45118dacf rp2040: use shared IRQ handlers, so user can also hook the USB IRQ 2022-06-17 09:13:40 -05:00
graham sanderson
c5ba4af25b rp2040: make moving 1K of code into RAM optional - and off by default 2022-06-16 11:04:48 -05:00
hathach
dd035b0eb2 make all hcd/dcd function used in isr into ram with __no_inline_not_in_flash_func() for faster irq handling
result is 1KB of code moved from rom -> ram
2022-06-08 16:08:53 +07:00
Ha Thach
fdeac8508b Merge pull request #1381 from hathach/add-sof-isr
Add SOF IRQ Handler
2022-05-31 22:25:14 +07:00
hathach
d5d4909c20 proof of concpet that device pio-usb work with host pio-usb 2022-04-08 13:36:05 +07:00
hathach
85dbcf5473 implement dcd_sof_enable() for rp2040 2022-03-07 23:04:47 +07:00
hathach
d10326cb4e rename TUSB_OPT_DEVICE_ENABLED to CFG_TUD_ENABLED
TUSB_OPT_DEVICE_ENABLED still usable for backward compatible
2022-02-25 18:35:21 +07:00
Valentin Milea
ae970ba2e2 Handle xfer events before closing EP 2021-12-08 12:34:00 +02:00
Valentin Milea
36e69b86bf Remove buffer reclaim logs 2021-12-07 15:35:30 +02:00
Valentin Milea
48e1f6d899 Handle the closing of endpoints on RP2040 2021-12-04 16:04:48 +02:00
hathach
5af989384b remove ep descriptor wMaxPacketSize bitfield due to endian issue 2021-10-24 13:11:21 +07:00
graham sanderson
06d9555389 More warning cleanup
- physically suppress warnings in TinyUSB headers using pragmas so they don't break -Werror compilation of external files that include them
 - fix compiler warnings in rp2040 port
 - add cmake method to rp2040 port to allow an external project to suppress warnings in TinyUSB itself
2021-10-14 15:23:26 -05:00
hathach
d6e9fe38be rp2040 implement dcd_edpt_close_all()
aslo rename reset_ep0_pid() and clean up. We only need to reset pid when
setup packet received
2021-09-01 19:44:12 +07:00
hathach
fc889ece74 rp2040 correct ep set/clear stall
- stall will remove pending (not complete) transfer. Correct reset data
toggle when clear stall.
- remove buf ctrl debug code
2021-09-01 16:52:27 +07:00
hathach
ab0c3e8dd0 fix rp2040 chapter 9 TD 9.6 test 2021-08-31 17:41:08 +07:00
hathach
71e77e47fa add dcd_edpt_close_all() for clear existing configured state
correctly responded to TD 9.13 Set Configuration Test
2021-08-26 17:07:03 +07:00
hathach
17ef9f4843 add ready check for edpt claim 2021-08-12 15:54:04 +07:00
hathach
4ad47d9e26 bus_reset will reset all endpoints
allow for dynamic configuration as well as state-less enumeration
2021-08-12 15:40:26 +07:00
hathach
4f2999bc04 white space 2021-08-12 00:31:26 +07:00
hathach
88d4cb402d simplify hw_endpoint_init() 2021-08-12 00:11:04 +07:00
hathach
a2baf9427d more dcd clean up 2021-08-11 20:36:23 +07:00
hathach
979af6c2a8 clean up endpoint set/clear stall 2021-08-11 20:29:39 +07:00
hathach
f3a6e564ee rp2040 enable suspend and resume interrupt 2021-08-11 20:06:57 +07:00
hathach
832d22d7ad force single buffered for device mode, out endpoint 2021-06-17 01:55:35 +07:00
hathach
5c567129ea fix calculating xferred bytes with double buffer with short packet on buffer0 2021-06-13 18:30:26 +07:00
hathach
f38c460433 fix ep tx with double buffered 2021-06-13 17:19:14 +07:00