Commit Graph

51 Commits

Author SHA1 Message Date
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
hathach
069215c538 white spaces 2022-11-30 18:58:30 +07:00
rppicomidi
9825fbe9ac Fix RP2040 Issue 1721 2022-11-23 13:12:31 -08:00
graham sanderson
fc1a27b6c9 RP@040: rework CMake for compiler warnings 2022-07-12 12:58:30 -05:00
mingpepe
1001d2da40 Fix typo for log format 2022-06-17 16:50:24 +08: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
graham sanderson
26c4d4b328 Minor cleanup of RP2040 code post addition of Pico-PIO_USB
* Removed some compiler warnings, and cleaned out unnecessary warning suppression from CMake suppress_tinyusb_warnings()
* Made explicit family_configure_dual_usb_example() for DUAL mode examples as family_configure_target() may not generally be called multiple times for the same target

* Renamed library pico_pio_usb to tinyusb_picio_pio_usb to be clearer and avoid conflict if someone already has a pico_pio_usb in their project
* Added family_add_pico_pio_usb() method for adding Pico-PIO_SUB support to an existing example
* Allowed tinyusb_pico_pio_usb to be added to regular apps using the Pico SDK
2022-05-20 17:25:30 -05:00
hathach
96165a1950 rename HCD_MAX_XFER to CFG_TUH_ENDPOINT_MAX
minor clean up
2022-03-04 17:07:04 +07:00
Scott Shawcroft
2cd73ca602 Add host string descriptor functions
Plus typo fixes, GCC11 array bounds fix, snprintf for malloc-free
debug and pragmas for alignment checks.
2022-03-03 21:53:12 -08:00
hathach
31aa077cb0 rename TUSB_OPT_HOST_ENABLED to CFG_TUH_ENABLED 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
48e1f6d899 Handle the closing of endpoints on RP2040 2021-12-04 16:04:48 +02: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
graham sanderson
7667299b48 Remove compiler warning 2021-10-14 12:13:39 -05: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
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
hathach
bd039c8d37 fix build with log for device 2021-06-13 16:16:25 +07:00
hathach
1af64f9729 remove sent_setup from hw endpoint 2021-06-13 15:31:00 +07:00
hathach
a6d22f5a68 replace pico_warn by log level 1 2021-06-11 18:40:01 +07:00
hathach
66c8a13f13 remove unused variable in hw endpoint
last_buf, buf_sel, transfer_size
2021-06-11 18:26:41 +07:00
hathach
93cb2ff4cf more refactor double buffered rp2040 2021-06-11 18:16:13 +07:00
hathach
1d48320d8a rename hw endpoint
- total_len to remaining_len
- len to xferred_len
2021-06-11 17:58:29 +07:00
hathach
5d6e381ef6 refactor rp2040 usb
- make _hw_endpoint_xfer_sync and _hw_endpoint_start_next_buffer private
- drop prefix _ from _hw_endpoint_xfer_continue and
_hw_endpoint_reset_transfer
2021-06-11 17:34:51 +07:00
hathach
a1a03c92f6 double buffered work with host 2021-06-11 17:05:49 +07:00
hathach
501de2a5e8 fix computing transferred bytes with E4 2021-06-08 10:29:22 +07:00
hathach
c2a0c1507b add more comment 2021-05-30 23:44:29 +07:00
hathach
54c9150574 add errata number 2021-05-30 23:41:59 +07:00
hathach
6498ee1996 fix incorrect data toggle when max packet size < 64
fix host buf_sel panic with "already available"
2021-05-30 23:35:54 +07:00
hathach
164778a716 update limit each transfer not less than 64 2021-05-28 17:42:13 +07:00
hathach
8cabbb28df fix enum walkaround forever check for SE0 when pull up is disabled 2021-03-04 18:36:18 +07:00
Ha Thach
559ff80643 Merge pull request #684 from hathach/rp2040-host-example
add rp2040 to host example build
2021-03-02 13:03:52 +07:00
Ha Thach
5a753c1ab0 Merge pull request #675 from majbthrd/rp2040epaddr
rp2040: use TU endpoint conventions and remove redundant variables
2021-02-27 00:38:53 +07:00
hathach
f6b48c07fc add rp2040 to host example build 2021-02-26 14:05:08 +07:00
majbthrd
efea18a888 Merge branch 'master' into rp2040epaddr 2021-02-25 09:15:42 -06:00
majbthrd
0632ecf556 Merge branch 'master' into rp2040device 2021-02-25 08:57:09 -06:00
Peter Lawrence
e00178a1af rp2040: don't compile in host code when in device mode 2021-02-23 14:04:56 -06:00
Peter Lawrence
c5422a5c48 rp2040: use TU endpoint conventions and remove redundant variables 2021-02-23 12:06:41 -06:00
Peter Lawrence
592d047936 rp2040: correctly size variables to reduce RAM usage 2021-02-22 20:53:16 -06:00
hathach
43ca626774 merge iso and cbi transaction size to max ep size 2021-02-22 12:27:02 +07:00
ndinsmore
cb5b9eb2f6 Remove stray. commented out line 2021-02-19 08:33:06 -05:00
ndinsmore
ac87a4547d Change to using tu_min32
This was a github edit, not tested
2021-02-18 08:25:04 -05:00
Nicholas R Dinsmore
27f4b6f5a4 Included size check for ISO buffers 2021-02-17 18:22:24 -05:00
Nicholas R Dinsmore
79b360f0a6 Enable iso buffers per rp2040 spec 2021-02-17 13:22:34 -05:00
hathach
c3c4f65fea wrap rp2040_usb around opt mcu 2021-01-27 13:04:38 +07:00