Commit Graph

2702 Commits

Author SHA1 Message Date
hathach 25580b4fe9 use forloop to avoid -Warray-bounds with host setup packet 2022-06-27 21:05:41 +07:00
hathach 9c56f70111 suppress error with net example 2022-06-27 20:30:47 +07:00
hathach a0ef489890 fix all warnings with host rp2040 2022-06-27 17:11:24 +07:00
hathach 6522a8150e fix all device examples warnings 2022-06-27 13:48:47 +07:00
hathach 1a1f633922 Merge branch 'master' into add-more-warnings 2022-06-27 12:50:50 +07:00
hathach 556b5d5044 change report len in hid API from uint8_t to uint16_t
since HS interrupt endpoint can be up to 1024, 8-bit is not enough.
affected APIs are:
- tud_hid_n_report() / tud_hid_report()
- tud_hid_report_complete_cb()
2022-06-27 12:22:36 +07:00
hathach 0b3503cb33 clean up usbd log level 2022-06-27 11:56:48 +07:00
hathach b9dc9dbd78
fix most warnings with rp2040 -wconversion 2022-06-27 11:50:17 +07:00
NConrad c675debfb2 USBTMC: Handle busy interrupt in. 2022-06-26 14:34:34 -04:00
NConrad 239b5d5279 USBTMC: Manually stall and unstall EP when clear(ENDPOINT_HALT) is received. 2022-06-24 23:06:32 -04:00
hathach 0042eccb3b
fix redundant-decls warnings by usbd/usbh 2022-06-24 22:52:11 +07:00
hathach 4f6e770eda
add more warning option, also fix -Wconversion with rp2040
-Wuninitialized, -Wunused,  -Wredundant-decls
2022-06-24 19:46:19 +07:00
NConrad e9c29e6a2d Update USBTMC driver to support dynamic packet sizes (based on descriptor). 2022-06-21 21:27:52 -04:00
Ha Thach 070382d599
Merge pull request #1509 from liamfraser/rp2040_hcd_improvements
RP2040 HCD Improvements (Hub + Keyboard + Mouse working)
2022-06-21 15:55:02 +07:00
Ha Thach ae8b8f0c93
Merge pull request #1515 from maddyaby/dcd_edpt_close
Stub out dcd_edpt_close for samd
2022-06-18 12:40:39 +07:00
Ha Thach b4e62d1cda
Merge pull request #1518 from mingpepe/master
Fix typo for log format
2022-06-18 12:39:16 +07:00
maddyaby 2cc2a90215 Allow more endpoint packet sizes for SAMD
Tested on SAMD51 - we can allow more packet sizes by checking that the set size value is greater than the requested packet size instead of exactly the same.
2022-06-17 16:07:32 -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
mingpepe 1001d2da40
Fix typo for log format 2022-06-17 16:50:24 +08:00
hathach 905a0b2457 correct bulk size for highspeed endpoint in dynamic_configuration and usbtmc exmaples 2022-06-17 14:37:35 +07:00
maddyaby 05fc2fa7a6 Stub out dcd_edpt_close for samd
Not having this prevents the device from finishing the mounting process.

Tested on a SAMD51 and didn't seem to need to actually do anything in the close function.
2022-06-16 16:57:20 -07:00
Maddy e9089b993f Fix typo in audiod_rx_done_cb in audio_device.c 2022-06-16 16:22:55 -07: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
Ha Thach d7b579a978
Merge pull request #1480 from Ryzee119/multihub_rebase
Host: Add support for multi-level usb hubs
2022-06-16 16:33:48 +07:00
hathach f4a7b5b80c add note for recursive calls of process_device_unplugged() in case of hub 2022-06-16 14:37:57 +07:00
Liam Fraser 19d054f789 hcd_rp2040 improvements:
- Stall now has priority over other interrupt responses
 - Delete eunused hcd_edpt_busy
 - Assert !ep->active when trying to start a new xfer
 - Assert !ep->active when handling buff_status bits
 - Set ep->xferred_len to 8 once a setup packet is finished so the data
structure is accurate
2022-06-13 16:19:11 +01:00
hathach 040ef0640d more dynamic controller for host 2022-06-10 14:53:03 +07:00
hathach 8451d05c50 revert sof_isr driver rename since it cause issue with existing code
also removed commented tud_sof_isr_set() API
2022-06-10 01:45:48 +07: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
hathach 8cbc34de11 add tuh_configure() for port/dynamic host behavior config 2022-06-08 01:17:01 +07:00
hathach 06392247eb add TU_ATTR_FAST_FUNC for audio sof isr call chain 2022-06-07 11:50:50 +07:00
Ha Thach a03a03d74e
Merge pull request #1495 from hathach/enhance-tusb-config
Better support multiple controllers configuration
2022-06-07 01:13:08 +07:00
hathach 7c8278303b update all host examples 2022-06-06 23:16:49 +07:00
Ha Thach afd9b1883d
Merge pull request #1481 from cr1901/msp430-misopt-fix
msp430x5xx: Add fix for possible bug in msp430-elf-gcc 9.3.0.
2022-06-06 15:37:45 +07:00
hathach 1b08672945 more ci fix 2022-06-06 13:25:48 +07:00
hathach 7187cd9a85 fix ci, remove use of CFG_TUSB_RHPORT0_MODE in bsp 2022-06-06 12:51:10 +07:00
hathach f626916a57 update all dwc2 ports to support new dynamic controller support 2022-06-04 23:52:12 +07:00
Ryzee119 7df7590f7f Hub: Remove multi-level hub bypass 2022-06-04 18:58:20 +09:30
hathach 31134f41a1 make dwc2 stm32 rhport support dynamic 2022-06-03 17:24:28 +07:00
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
Reinhard Panhuber 11f0ffd9a8 Generalize feedback value min and max 2022-04-16 14:47:42 +02:00
hathach b5a9537eea
support pio dcd endpiont stall 2022-04-16 01:19:51 +07:00
hathach 05bfc1a9eb pio device works well 2022-04-15 01:04:12 +07:00
hathach cc5a4720e5 catch up with pio lib 2022-04-14 22:00:47 +07:00
Reinhard Panhuber 7094ff7125 Introduce 3 fb calc options: NO_SOF_BY_USER, SOF_BY_AUDIO_D, SOF_BY_USER 2022-04-09 16:36:26 +02:00
hathach d5d4909c20 proof of concpet that device pio-usb work with host pio-usb 2022-04-08 13:36:05 +07:00
hathach d97c154695 add need_pre for pio usb, but not work out well 2022-04-05 00:04:47 +07:00
hathach d7d7e61f34 correct pio usb speed, and close device 2022-04-03 22:48:08 +07:00
hathach 7ea75d3c09 use pio usb host init 2022-04-03 20:44:16 +07:00
hathach f6851cf187 clean up hcd pio 2022-04-03 00:17:58 +07:00
hathach f881e77e66 extracting hw root port 2022-04-02 19:19:00 +07:00
hathach c25f835aea update to use pio hw endpoint 2022-04-01 23:31:43 +07:00
hathach db6cba6a7b rename pio to pio_usb 2022-04-01 16:38:41 +07:00
hathach e6e3dfedc8 hid example work well 2022-04-01 16:34:36 +07:00
hathach 75bca96bc6 pio usb control work well including stall response 2022-04-01 16:01:24 +07:00
hathach e94d11a5b3 implement pio_usb_irq_handler 2022-03-31 12:56:53 +07:00
hathach e2f0aef93b make use pio_usb_port_reset_start/end 2022-03-30 16:41:55 +07:00
hathach 65b6b79e99
clean up and comment out tud_sof_isr_set 2022-03-29 16:53:45 +07:00
Reinhard Panhuber 5cd67baf15 Disable SOF ISR feedback calcuation by default s.t. examples still work 2022-03-20 12:57:53 +01:00
Reinhard Panhuber 8ffdbfebce Streamline call of tud_audio_set_itf_cb() within audiod_set_interface() 2022-03-20 12:08:27 +01:00
Reinhard Panhuber 5aba464270 Add magic checks 2022-03-20 12:04:10 +01:00
Reinhard Panhuber ff2dc0a547 Streamline feedback calc, find fb interval from descriptors, inc. checks 2022-03-20 11:21:33 +01:00
hathach 45052c625e
Merge branch 'master' into pio-host 2022-03-20 00:51:00 +07:00
Reinhard Panhuber fdfde8883f Implement power of two, shift, and float calculation 2022-03-19 13:37:54 +01:00
hathach 821be65b03
rename usbh_edpt_open() to tuh_edpt_open() 2022-03-19 14:59:31 +07:00
hathach 4795cca04a
add parse config descriptor to example
move usbh_edpt_open() to public API, remove rhport from its signature
2022-03-19 00:43:31 +07:00
hathach ba1185bf28
implement tuh_edpt_xfer() for non-control 2022-03-18 22:22:21 +07:00
hathach 9ae0304b1e
move code around 2022-03-18 18:04:25 +07:00
hathach 8750e3b577
move daddr into xfer struct 2022-03-18 16:39:35 +07:00
hathach 2ff8978dde
update sync API, move timeout into xfer struct
remove tuh_control_xfer_sync()
2022-03-18 13:38:30 +07:00
hathach 85c6d6d37d
minor update for control xfer 2022-03-18 12:51:12 +07:00
hathach c063ab4944
try to fix ci 2022-03-18 00:56:51 +07:00
hathach f89ff939d8
rename user_arg to user_data 2022-03-17 22:37:51 +07:00
hathach 9dd2f11f4a
add CFG_TUH_API_EDPT_XFER to enable generic edpt xfer 2022-03-17 21:20:20 +07:00
hathach 55428d7dd2
rename tuh_control_xfer_t to tuh_xfer_t 2022-03-17 20:52:16 +07:00
hathach 102b99a0e8
add actual_len supported 2022-03-17 20:48:32 +07:00
hathach 8aedb2ff37
slightly change the signature of tuh_control_xfer 2022-03-17 17:25:53 +07:00
hathach 66942b814b
change return type of callback to void 2022-03-17 16:55:29 +07:00
hathach deab8c276a
remove const in xfer callback 2022-03-17 16:53:54 +07:00
hathach 6df420f7f3
move result into transfer struct 2022-03-17 16:24:43 +07:00
hathach 68bfd048a5
change tuh_control_xfer_t struct 2022-03-17 12:53:52 +07:00
hathach 98d4ed0584
update hid host to use new control xfer for set config 2022-03-16 18:44:41 +07:00
Reinhard Panhuber ceac9d64c0 Disable CFG_TUD_AUDIO_ENABLE_FEEDBACK_DETERMINATION_WITHIN_SOF_ISR
By default disable
CFG_TUD_AUDIO_ENABLE_FEEDBACK_DETERMINATION_WITHIN_SOF_ISR such that
current examples still work.
2022-03-16 08:05:31 +01:00
Reinhard Panhuber 9fde8f2d9e Fix DSTS_FNSOF in dwc2.c 2022-03-16 07:53:47 +01:00
Reinhard Panhuber 92ac041869 Add todos and comments 2022-03-16 07:13:38 +01:00
hathach fd2ea2605e fix -Wnull-dereference warnings 2022-03-16 10:55:18 +07:00
Reinhard Panhuber 90502739c3 Fix cycle count calculation 2022-03-15 20:45:06 +01:00
Reinhard Panhuber c9b444e771 Implement 16.16 fixed point feedback value calculation 2022-03-15 20:30:31 +01:00
Reinhard Panhuber 26339e694f Merge remote-tracking branch 'upstream/add-sof-isr' into add-sof-isr 2022-03-14 20:40:57 +01:00
Reinhard Panhuber f212899b54 Add SOF callback function for feedback value determination in uac - wip! 2022-03-14 20:40:33 +01:00
Ha Thach 41ffd54fa0
Merge branch 'master' into add-sof-isr 2022-03-14 11:57:01 +07:00
hathach 2929afe2fa add synchronous (blocking) support for usbh control transfer
- add synchronous version of all get descriptor API
- update bare example to use sync API for string descriptor
- change order of index, language_id in tuh_descriptor_get_string() to
match similar API of libusb
- add index to tuh_descriptor_get_hid_report()
2022-03-13 17:45:46 +07:00
hathach 56695569e7 minor changes 2022-03-12 14:28:24 +07:00
hathach ac4483a7c5 misplace fallthrough 2022-03-12 14:26:48 +07:00
hathach a5a565f7eb rework usbh enumeration process using user arg from control transfer as state 2022-03-12 14:20:57 +07:00
hathach ec28593ce5 update hid,msc to new usbh control API 2022-03-11 22:13:57 +07:00
hathach bcdeb386cc rework usbh control xfer
- change API of tuh_control_xfer and its callback
- rename tuh_control_complete_cb_t to tuh_control_xfer_cb_t
- add user argument to control callback
- migrate usbh and hub
2022-03-11 21:57:55 +07:00
hathach 6b5490ced6 merge device_info into bare_api example 2022-03-11 13:12:36 +07:00
hathach a715077b10 remove usbh_control.c 2022-03-11 09:57:35 +07:00
hathach 951ece17e1 fix build warning 2022-03-10 23:20:12 +07:00
hathach 66c933fb61 fix enumeration issue when plugging hub with multiple devices attached 2022-03-10 23:16:59 +07:00