2713 Commits

Author SHA1 Message Date
hathach
2571211957 remove static port defined for device/host 2022-06-03 11:32:09 +07:00
Jerzy Kasenberg
8b37aa1579 nrf5x: Fix DMA access
There were two problems:
- dma_running flag could be checked in USB interrupt (not set yet) then higher priority
  interrupt could start transfer, check dma_running (not set yet) set it to true start
  DMA; then when USB interrupt continues it starts another DMA that is not allowed
- when DMA is started some registers can't be safely accessed, read can yield invalid
  values (SIZE.EPOUT, SIZE.EPISO)
  current implementation could start DMA for one OUT endpoint then check that another
  endpoint also has data and while DMA was not started right away, SIZE.EPOUT was copied
  already to MAXCNT register. Later on when DMA was started not all data was read from
  endpoint due to incorrect DMA size previously set.

To prevent both cases dma_running is changed in atomic way.
Only code that actually set this value to true starts DMA, code that tried and
had dma_running flag already set simply defers DMA start to USB task.
This eliminates also need to have mutex that was there to limit access to dma_running flag
to one task only.
transfer also now has started flag that is set only after dcd_edpt_xfer() sets up total_len
and actua_len. Previously USB interrupt was disabled when total_len and actual_len were
setup to prevent race condition when data arrived to ednpoint before transfer was setup
was finished.
2022-06-02 17:23:35 +02:00
hathach
8b9cf152a0 rhport argument in usbd_ API() is not used (always use the initialized port)
remove the usage of TUD_OPT_RHPORT in class driver
2022-06-02 16:51:17 +07:00
hathach
99c1585ed2 rename board specific macro for example
- BOARD_DEVICE/HOST_RHPORT_NUM to  BOARD_TUD/H_RHPORT
- BOARD_DEVICE/HOST_RHPORT_SPEED to  BOARD_TUD/H_MAX_SPEED
2022-06-01 23:53:40 +07:00
tfx2001
54d7790e8b
fix compile error 2022-06-01 21:37:26 +08:00
Ha Thach
fd8afc7e3b
Merge pull request #1454 from Iktek/bugfix_1453
overwrite grstctl on edpt_disable
2022-06-01 14:36:36 +07:00
hathach
6e7cd220dc grstctl set fifo + flush in one assign 2022-06-01 13:18:24 +07:00
Ha Thach
9352f75220
Merge pull request #1438 from Nikitarc/master
Update dwc2_stm32.h
2022-06-01 12:23:32 +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
e384d16d57 clean up tud_audio_set_itf_cb() invocation 2022-05-31 21:52:54 +07:00
hathach
f2926670cc comment out fifo count method for now 2022-05-31 20:26:37 +07:00
William D. Jones
731ac3d3d6 msp430x5xx: Add fix for possible bug in msp430-elf-gcc 9.3.0. 2022-05-30 14:28:30 -04:00
Ryzee119
b7c8cb3c41 Hub: Unplug downstream devices on non-root hub disconnect 2022-05-29 14:15:57 +09:30
Ryzee119
9e30ec4f16 Hub: Retry port status transfer if failed 2022-05-29 14:15:23 +09:30
Ryzee119
688a3a0cc2 Fix non-trivial designated initializers compile error 2022-05-29 14:15:18 +09:30
hathach
dce2ad4ffb
adding feedback fifo count (WIP) 2022-05-27 23:11:25 +07:00
hathach
15aa593790
wrap feedback and compute to its own struct/union 2022-05-27 12:27:31 +07:00
Ha Thach
7b1344fe69
Merge pull request #1467 from kilograham/rp2040_cleanup
Minor cleanup of RP2040 code post addition of Pico-PIO-USB
2022-05-26 23:54:20 +07:00
Ha Thach
0a4a28a90c
Merge pull request #1451 from kasjer/kasjer/pic32-sanity-fixes
pic32 sanity fixes
2022-05-24 20:42:06 +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
e5113a1cfc prototype for feedback method 2022-05-19 16:05:55 +07:00
hathach
5766c9ac4e rename tud_audio_sof_isr() to tud_audio_feedback_interval_isr()
- also add interval_log2 to isr callback
- also rename other variables
2022-05-19 13:44:10 +07:00
hathach
20b810d25b
fix ci build 2022-05-13 23:01:06 +07:00
hathach
c5ba1ea8c1
changes proposal to audio feedback computation 2022-05-13 22:54:47 +07:00
hathach
8473ca16fb clean up 2022-05-10 22:56:06 +07:00
Pascal Speck
f452ab745e overwrite grstctl on edpt_disable 2022-05-03 09:52:10 +02:00
Jerzy Kasenberg
e49cad84e2 dcd_pic32: Fix memory overwrite in incoming data
When transfer was finished rx_fifo_read() read all that
was to read RXPKTRDY was cleared allowing next packet to
be received.
Then xfer_complete was called.
Interrupt for OUT endpoint was left enable, that would not
be a problem if data was handled fast and new transfer was
scheduled.
For MSC when host sends a lot of data this interrupt that was
enabled could cause epn_handle_rx_int() to be called after
transfer was completed and next was not scheduled yet.
Without TU_ASSERT that was added to detect this, incoming
data was written past buffer provided by user code resulting
in random memory corruption.

This just blocks RX interrupt when transfer is finished,
and also only unmasked rx interrupts are handled.
2022-05-01 14:26:24 +02:00
Jerzy Kasenberg
c145777e0e dcd_pic32: Add asserts transfer sanity check
TU_ASSERTS added to detect transfer inconsistency.
2022-05-01 14:14:42 +02:00
Jerzy Kasenberg
d51743a21c Add TU_BREAKPOINT for mips architecture
_mips is provided by xc32-gcc
2022-05-01 14:05:49 +02:00
hathach
0b30a10ab3 configure hid_to_cdc example to build with rp2040 with pio usb as host 2022-04-29 22:24:36 +07:00
hathach
85dcb73774 more clean up 2022-04-28 18:00:30 +07:00
hathach
a72d4e2462 make hcd_event_handler() fastfunc, and force inline other helper 2022-04-27 20:54:21 +07:00
hathach
ae5490e5a5 clean up 2022-04-27 20:52:56 +07:00
hathach
4a661dead0 add TU_ATTR_FAST_FUNC for rp2040 __not_in_flash() section 2022-04-27 17:57:52 +07:00
hathach
455bddddcd
minor clean up 2022-04-26 18:47:09 +07:00
hathach
4d11c658ff
improve pio usb endpoint handler 2022-04-26 13:08:03 +07:00
hathach
26a25279bc
follow pio usb changes 2022-04-26 00:35:16 +07:00
Nikitarc
15c01f20ec Update tusb_option.h
Makes ISO compiler happy
2022-04-25 14:06:15 +02:00
hathach
2f9b9a31be
more with pio usb 2022-04-22 18:26:58 +07:00
hathach
12debd7763
keep up with pio usb 2022-04-22 01:06:17 +07:00
hathach
98bbb0d402
Merge branch 'master' into pio-host 2022-04-21 12:05:22 +07:00
hathach
6a022c73db
add note for tud_task() behavior in freertos example 2022-04-20 18:35:38 +07:00
hathach
b034c18077
add tud_task_ext(), tuh_task_ext() as exteneded version that take timeout and in_isr
also allow exit tud_task,tuh_task after processing all events for
running other background task for user
2022-04-20 18:29:41 +07:00
Nikitarc
c422b9ef41 Update dwc2_stm32.h
Add missing #endif
2022-04-20 11:29:03 +02:00
hathach
669e36d674
fix freertos issue when 1 tick > 1 ms 2022-04-20 14:37:42 +07:00
hathach
a90839688c
add msec timeout to osal_queue_receive(), tud_task() and tuh_task() both pending for event queue with timeout of 1 ms 2022-04-20 13:25:38 +07:00
Nikitarc
52190e7308 Update dwc2_stm32.h
Support STM32H7 with only 1 USB port: H72x / H73x / H7Ax / H7Bx
2022-04-19 21:53:00 +02:00
hathach
a32cb1bb93 clean up pio driver 2022-04-18 17:49:21 +07:00
Skyler Mansfield
35668fc523 hcd_rp2040: Add bulk in/out+interrupt out support.
Added support for allocating hw_endpoints for non-interrupt endpoints.
Allow endpoints to be used in either direction by updating bit checks.
2022-04-17 01:30:03 +01:00
Skyler Mansfield
16c13bc110 tusb_types:
Added descriptive strings for edpt_dir and edpt_type
2022-04-17 01:16:49 +01:00