Commit Graph

55 Commits

Author SHA1 Message Date
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
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
hathach
bd039c8d37 fix build with log for device 2021-06-13 16:16:25 +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
b36b211c26 clean up tusb_fifo.h include 2021-05-27 17:58:42 +07:00
hathach
a397353916 fix ci build with rp2040 2021-03-10 17:58:39 +07:00
hathach
8cabbb28df fix enum walkaround forever check for SE0 when pull up is disabled 2021-03-04 18:36:18 +07:00
hathach
a298045f6c clean up 2021-03-02 23:30:21 +07:00
hathach
9d5e369170 rp2040 add disconnection detection
- also use dcd_event_bus_reset()
- Add TODO for suspend, resume later on (need to test with/without vbus
detection).
2021-03-02 23:24:36 +07:00
Peter Lawrence
eb44b6f7db rp2040: improve _hw_endpoint_init() 2021-02-26 11:07:34 -06:00
majbthrd
efea18a888 Merge branch 'master' into rp2040epaddr 2021-02-25 09:15:42 -06:00
Peter Lawrence
762f262be7 rp2040: requested change from TU_MIN to tu_min16 2021-02-25 07:58:54 -06:00
Peter Lawrence
c5422a5c48 rp2040: use TU endpoint conventions and remove redundant variables 2021-02-23 12:06:41 -06:00
Peter Lawrence
5a8ae31316 rp2040: leverage existing macro for capping endpoints in pico-sdk 2021-02-23 10:08:38 -06:00
Peter Lawrence
592d047936 rp2040: correctly size variables to reduce RAM usage 2021-02-22 20:53:16 -06:00