Commit Graph

3142 Commits

Author SHA1 Message Date
hathach c28503060c
ad pd_types.h 2023-06-12 14:57:50 +07:00
hathach debde4cc97
response with request safe5v, get passed PS_READY 2023-06-12 12:14:55 +07:00
hathach bb4fb0543b
able to parse SOURCE_CAP message from dfp 2023-06-09 19:38:50 +07:00
hathach 912802456b
move protocol message to stack, disable battery in PWR's CR3
there is still issue with CC1/CC2 pull down resistor and vstate is not
correct.
2023-06-09 18:15:28 +07:00
Eugene Kliuchnikov 0833806980 Fix typos 2023-06-08 15:38:30 +02:00
hathach 8181d470e5
enable DMA for both pd rx, tx 2023-06-08 18:55:54 +07:00
hathach 9c2a8490af
dma rx works well 2023-06-08 13:37:37 +07:00
hathach fc761953b3
define tuc_int_handler() to empty if TUC not enabled 2023-06-08 09:34:15 +07:00
hathach 7fd0a17bc3
default CFG_TUC_ENABLED to 0 2023-06-08 09:11:29 +07:00
hathach 9b7dee563e
able to response with good crc 2023-06-07 18:57:48 +07:00
Aladdin Bakosh 8bb012e50b fix(RA): static assert RUSB2 register 2023-06-07 12:01:59 +02:00
hathach b893f1d541
inital support for usb typec and pd example 2023-06-07 15:10:40 +07:00
hathach b3fda4a354
able to get usbpd irq handler
- handle cc1, cc2 voltage changes
- get order set, rx message end interrupt
- add  segger rtt support for cmake
2023-06-06 23:55:33 +07:00
hathach f6a45a7aab
clean up 2023-06-05 15:41:45 +07:00
Martino Facchin 2b735ee8f5 renesas_ra: fix wrong ifdef
Since CFG_TUSB_RHPORT1_MODE is always defined now for backwards compatibility
2023-06-05 09:48:06 +02:00
Martino Facchin cdbd3a0b4e Merge remote-tracking branch 'mainline/master' into HEAD
Update fsp to 4.0.0
2023-06-05 09:12:50 +02:00
Martino Facchin cdae66c837 renesas_rx: fix compilation on latest GCC
__CCRX__ only applyes to version 4 of RX family compiler http://tool-support.renesas.com/autoupdate/support/onlinehelp/csp/V4.01.00/CS+.chm/Compiler-CCRX.chm/Output/ccrx04c0201y.html

__RX__ is one of the macros exported by latest gcc (gcc_8.3.0.202305_rx_elf)
2023-06-05 09:04:55 +02:00
Aladdin Bakosh 268ab5863a fix(RA Host Portable): git rid of the IAR warnings for packed 2023-06-02 14:14:57 +02:00
Ha Thach c7686f8d5e
Merge pull request #2092 from hathach/stm32g4
Stm32g4
2023-06-02 17:07:28 +07:00
hathach fcf7791454
add IAR support for G0 with cmake 2023-06-02 13:27:18 +07:00
hathach e7090c7514
cmake refactor 2023-06-02 11:42:17 +07:00
Dave Nadler e8b7f21af6 For FreeRTOS kernel-aware debugging, when queue registry is enabled, label tinyUSB queue 2023-06-01 12:57:44 -04:00
Dave Nadler 70a92291fe Fix diagnostic format string (missing %u) 2023-06-01 10:58:03 -04:00
hathach af59864ab5
Merge branch 'master' into feature/STM32G0 2023-06-01 13:28:28 +07:00
hathach 20ef6c4ef7
slightly clean up 2023-05-29 13:29:11 +07:00
hathach 5c428d35a6
check status_change is not zero first 2023-05-29 13:27:20 +07:00
Ivo Popov 8ad024e51b
Even when we get an empty "status change" interrupt from the hub, schedule another interrupt poll.
During enumeration, when there are multiple devices attached to the
hub as it's plugged into the Pi Pico, enumeration hangs, because we
get a "status change" callback with value zero. With this patch, we
retry several times on "zero" status change callbacks, until
eventually we succeed.

This is the cheapo hub that exhibits this behavior, but I assume it's
not the only one: https://www.amazon.com/gp/product/B083RQMC7S.

While debugging this, I consulted the implementation in the Linux
kernel. There, hub setup explicitly checks each port individually,
before starting to depend on "status change" interrupts:
https://elixir.bootlin.com/linux/latest/source/drivers/usb/core/hub.c#L1133.
We probably should do something like that here, but it's a much bigger
change.
2023-05-29 13:18:16 +07:00
gitlab acfaa4494f Fixes bug in tuh_msc_ready 2023-05-28 15:40:01 +01:00
hathach 7ac85d08c7
move lpc18 and rp2040 to cmake workflow since rp2040 often failed randomly with make 2023-05-26 16:37:47 +07:00
hathach b262164a35
fix build with net_lwip_webserver example 2023-05-26 15:16:18 +07:00
Ha Thach 23c8670e79
Merge pull request #2081 from hathach/more-build-system
More build system
2023-05-25 21:54:31 +07:00
hathach 26d05d7fc9
fix issue with ftdi host driver with status bytes
add workflow_dispatch to all ci workflow
2023-05-25 16:53:32 +07:00
Ha Thach eedafb23f7
Merge pull request #2063 from abakosh/develop
fix(RA Host Portable): implement missing function __builtin_ctz(x)
2023-05-24 20:11:50 +07:00
Aladdin Bakosh 57d2eb603b fix(RA Host Portable): implement missing function __builtin_ctz(x) for IAR 2023-05-24 11:38:40 +02:00
Ha Thach 1ef820ecfe
Enhance chipidea (#2075)
* update chipidea dcd, remove manual ep_count and use DCCPARAMS to get number of endpoint instead
* add dcd dcache for chipidea
* add cmake for lpc18
* add makefile build for mcx
* use fork of mcu sdk
* fix ci build with nrf
* flash rp2040 with openocd
2023-05-23 21:45:00 +07:00
hathach 7211dd18b4
more dcache fix 2023-05-19 13:42:26 +07:00
hathach 5dae5e1292
ehci fix dcache clean when control endpoint failed 2023-05-19 13:32:49 +07:00
hathach f26a93908e
only clean/invalidate dcache on imxrt if memory is not in DTCM 2023-05-19 10:56:52 +07:00
hathach ec4bd39a92
refactor ehci: add attached_buffer for dcache invalidate for IN transfer 2023-05-18 16:41:06 +07:00
hathach 27acaa013b
refactor ehci, since usbh only queue 1 TD per queue head 2023-05-18 15:44:08 +07:00
hathach 49e2aabc81
EHCI more improvement
- more dcache clean/invalidate
- extract init_periodic_list()
- improve isr list handling
2023-05-18 13:45:38 +07:00
hathach a0aea52a11
more cache, fix an similar issue with OHCI when removing an queue head 2023-05-18 12:39:53 +07:00
hathach e4f4ad5bc3
use weak local for dcache function to skip if() 2023-05-18 10:21:11 +07:00
hathach a3e017bfd2
EHCI adding dcahe support, passing enumertaion 2023-05-18 10:04:48 +07:00
Martino Facchin 32f9f452af renesas: provide default for CFG_TUSB_RHPORT1_MODE
Should fix CI failure for Renesas RX family
2023-05-17 12:13:28 +02:00
hathach eb89df4115
adding hcd_dcache_clean/hcd_dcache_invalidate 2023-05-17 16:14:35 +07:00
hathach a9aa0e3a1a
fix error on EHCI causes xfer error in non-queued qhd which cause memory fault 2023-05-16 11:10:44 +07:00
hathach 1e998ce3bd
usbd: fix control transfer issue for chipidea hs when previous status and new setup complete in the same isr frame
change usbd edpt busy/stalled/claimed value to 0/1 instead of
(true/false) since they are 1-bit field.
2023-05-16 11:09:23 +07:00
hathach 2c48050993
add various check for disconncted device, also fix #1511 un-roll recursive hub removal with usbh queue 2023-05-16 11:09:22 +07:00
hathach 1c4f22a54c
EHCI: fix xfer failed with disconnected device as stalled
- change CFG_TUH_ENDPOINT_MAX to 16 (max endpoint pair per device) if
not defined
- change QHD_MAX for EHCI, should be user configurable and more
optimized in the future
2023-05-16 11:09:22 +07:00
hathach 206d63e038
correct EHCI reporting failed xfer (instead of stalled) when device is unplugged 2023-05-16 11:09:21 +07:00
hathach c0e4c02b9d allow imxrt build with dual exmaples 2023-05-10 11:15:11 +07:00
hathach 77f0726361 fix ehci issue with portsc when enable port power and port reset
fix attached device not regconized if attached before power on
2023-05-09 17:32:14 +07:00
hathach 654f182176 build host examples with imx 2023-05-08 00:24:48 +07:00
hathach 6945c594d5 update all device cmake example for imx 2023-05-07 22:09:08 +07:00
hathach f15f79df5d cmake work well with imxrt 2023-05-06 15:14:54 +07:00
hathach cda5ab8b25 more temp work 2023-05-05 19:15:19 +07:00
hathach 8a9d2b4b75 wip 2023-05-04 23:29:37 +07:00
Martino Facchin 6ff62c0fe8 renesas: add fallback for targets not defining CFG_TUSB_RHPORT*_MODE 2023-05-03 11:47:41 +02:00
Martino Facchin 5f7e7b4b0a renesas_ra: support RA2A1 (FS only) 2023-05-03 10:06:13 +02:00
Martino Facchin 4afed62646 renesas_ra: host: handle retry on attach() 2023-05-03 10:05:29 +02:00
Martino Facchin be54870c3b renesas_ra: add support for HS port 2023-05-03 10:02:24 +02:00
hathach 1763eede48
more update to host serial API 2023-04-28 22:14:14 +07:00
hathach fb5fe3360f
allow call tuh cdc with blocking (callback = NULL)
- tuh_cdc_set_control_line_state()
- tuh_cdc_set_baudrate()
- tuh_cdc_set_line_coding()
2023-04-28 21:50:54 +07:00
hathach 0a43a7b418
improve host serial drivers
- tuh_control_xfer() update xfer result to user_data if complete
callback = NULL (sync/blocking)
- refactor host serial driver for acm/ftdi/cp210x
2023-04-28 19:13:25 +07:00
hathach 190acc1fb0 add aligned(4) for cdc_line_coding_t 2023-04-28 11:12:03 +07:00
Jean-Baptiste Theou 8f47976639 cdc: fix line_coding aligment
While calling tud_cdc_n_get_line_coding, the structure is copied into
the destination.

Dump of assembler code for function tud_cdc_n_get_line_coding:
   0x000193f4 <+0>:	mov.w	r2, #2112	@ 0x840
0x000193f8 <+4>:	ldr	r3, [pc, #20]	@ (0x19410
<tud_cdc_n_get_line_coding+28>)
   0x000193fa <+6>:	mla	r0, r2, r0, r3
=> 0x000193fe <+10>:	ldr.w	r3, [r0, #6]
   0x00019402 <+14>:	str	r3, [r1, #0]

On some platform (tested on LPC55S28), the address needs to be 4-bytes
aligned. Without this, the address is

(gdb) p &_cdcd_itf.line_coding
$3 = (cdc_line_coding_t *) 0x40100006 <_cdcd_itf+6>

which leads to a HardFault. With this fix

(gdb) p &_cdcd_itf.line_coding
$5 = (cdc_line_coding_t *) 0x40100008 <_cdcd_itf+8>

and the function can be called properly

Signed-off-by: Jean-Baptiste Theou <jb@thing.com>
2023-04-27 15:48:15 -10:00
hathach 732686cc10 add tuh_cdc_set_baudrate() 2023-04-27 23:22:10 +07:00
hathach ee58278ed2 add code to calculate divisor from baudrate for ftdi 2023-04-27 23:08:25 +07:00
hathach 8214f0f497 clean up 2023-04-27 17:40:08 +07:00
hathach c10f52b237 forgot to add cp210x header 2023-04-27 17:39:02 +07:00
hathach 438387be8c more refactor 2023-04-27 17:32:56 +07:00
hathach 86f6fd17ed cp210x seems to work well 2023-04-27 17:09:21 +07:00
hathach a32ef1cde1 more host serial refactor 2023-04-27 16:32:42 +07:00
hathach 9698a088db refactor acm function 2023-04-27 15:29:44 +07:00
hathach 85d9925d24 refactor ftdi driver 2023-04-27 15:20:04 +07:00
hathach 293a6222f8 rename ftdi_host to ftdi_sio 2023-04-27 11:08:42 +07:00
hathach 45169d833d hacky, but ftdi work with hard code baudrate = 9600 2023-04-26 22:36:17 +07:00
Ha Thach 964e7ebf21
Merge pull request #2013 from tannewt/imx_1042
Handle iMX RT 1042 usb naming
2023-04-24 16:53:24 +07:00
Ha Thach 8ede566c41
Merge pull request #2039 from hathach/add-cmake-build
Add cmake build
2023-04-24 16:43:40 +07:00
hathach a4d5d51549 add wip note 2023-04-24 16:24:06 +07:00
hathach 5254202b20 minor update 2023-04-24 11:54:58 +07:00
hathach 0afe1b3684 example run well with cmake for imxrt 2023-04-21 18:10:28 +07:00
Jacek Fedorynski 9bf97e3e52 [rp2040] Make writes to SIE_CTRL aware of concurrent access
This commit makes it so that when setting the START_TRANS bit in the
SIE_CTRL register, along with some other bits, we first set all the
other bits, then wait some cycles, and then set the START_TRANS bit.

Doing so protects against a situation where the USB controller is
reading the register at the same time and gets an incorrect value.

This mirrors the procedure already applied to buffer control
registers.
2023-04-20 20:23:31 +02:00
Reimu NotMoe c0674142a8
Merge branch 'hathach:master' into master 2023-04-18 23:20:25 +08:00
Reimu NotMoe 9002dc7067 Use __GNUC__ macro to determine if __has_attribute is supported 2023-04-18 17:27:42 +08:00
Ha Thach c3a60ed355
Merge pull request #1920 from mikee47/fix/midi-definition
MIDI_CIN_NOTE_ON definition transposed with MIDI_CIN_NOTE_OFF
2023-04-18 10:43:52 +07:00
Mengsk 412b557a08 Cleanup unnecessary code for 16bit access. 2023-04-17 15:34:20 +02:00
Reimu NotMoe fa8f3731c1 Implement TU_BSWAP{16,32} correctly for Microchip XC16 2023-04-17 21:02:12 +08:00
Reimu NotMoe d97b6d57de Fix compatibility with the latest Microchip XC16 compiler 2023-04-17 20:20:22 +08:00
HiFiPhile 818bda18c2 Fix FIFO transfer and buffer alignment. 2023-04-14 23:37:07 +02:00
HiFiPhile 2f2c8ce9ec Fix GCC build. 2023-04-14 21:00:55 +02:00
HiFiPhile 413b0a7da5 Use PLL clock. 2023-04-14 17:12:47 +02:00
HiFiPhile cbf4b1aec8 Merge branch 'master' of https://github.com/hathach/tinyusb into pr1942 2023-04-14 13:16:52 +02:00
Scott Shawcroft 2cda9b60c9
Handle iMX RT 1042 usb naming 2023-04-06 15:45:23 -07:00
hathach 6db24e0dba implement tuh_hid_receive_ready() and tuh_hid_send_ready() 2023-04-06 11:16:28 +07:00
hathach 106084289d add define for vendor_flush() to write_flush() for backward compatible 2023-04-06 11:15:57 +07:00
Ha Thach f7aa716a61
Merge pull request #2000 from jncronin/stm32l5
Add STM32L5 support - no OTG similar to some L4s
2023-04-04 16:30:47 +07:00
John Cronin 718bcdb8bc Add STM32L5 support - no OTG similar to some L4s 2023-04-03 13:56:16 +01:00
epatstarkey 1372d4e4d5 Remove trailing whitespace 2023-03-31 12:58:51 -05:00
epatstarkey 1fb2a2f1bd
Update vendor_device.c 2023-03-28 14:01:33 -05:00
epatstarkey 876f49f6ad
Update vendor_device.c 2023-03-28 14:00:23 -05:00
epatstarkey faaed198b4
Update vendor_device.h 2023-03-28 13:59:59 -05:00
kkitayam 993b8d6686 Add state variable 2023-03-26 21:18:00 +09:00
kkitayam e508831561 Update handle streaming interface 2023-03-25 21:25:13 +09:00
kkitayam 78732d6733 Fix streaming interface handling 2023-03-25 21:25:12 +09:00
kkitayam 97f9321e1d Add handling for bulk EPs 2023-03-25 21:25:12 +09:00
Ha Thach 5add4c97fa
Merge pull request #1979 from hathach/fix-cdc-host-unsupported-line-request
fix cdc host enumeration issue when device does not support line request
2023-03-24 17:58:34 +07:00
hathach df5f60b6d6 fix shadow warning 2023-03-24 17:36:29 +07:00
hathach b054229780 fix cdc host enumeration issue when device does not support line request 2023-03-24 17:26:30 +07:00
Ha Thach 59cbfbbdbe
Merge pull request #1971 from MattMills/class_net_net_device_mac_address_shouldnt_be_consts
Update net_device.h to make MAC addresses not const.
2023-03-24 16:48:33 +07:00
Ha Thach f640163ee9
Merge pull request #1969 from hathach/fix-tmc488-bit-order-1658
Fix tmc488 bit order 1658
2023-03-24 14:41:57 +07:00
hathach 71fb6469d4 separate CFG_TUSB_MEM_SECTION and CFG_TUSB_MEM_ALIGN to
- CFG_TUD_MEM_SECTION and CFG_TUD_MEM_ALIGN
- CFG_TUH_MEM_SECTION and CFG_TUH_MEM_ALIGN
- fix missing mem section and align for host
2023-03-24 14:05:21 +07:00
Matt Mills 4274cab395
Update net_device.h 2023-03-22 07:18:27 -06:00
hathach 096da11e88
more update 2023-03-22 17:01:04 +07:00
hathach c85f46c4ab
fix bitorder in usbtmc_response_capabilities_488_t 2023-03-22 16:59:57 +07:00
Ha Thach 07976ad26d
Merge pull request #1968 from hathach/refactor-hid-host
Refactor hid host
2023-03-22 10:37:06 +07:00
hathach f27486e19a add tuh_hid_itf_get_info() and change tuh_cdc_itf_get_info() to use new tuh_itf_info_t 2023-03-22 10:00:42 +07:00
hathach f8a5cde3c7 add tuh_task_event_ready(), better implement blocking control transfer for rtos 2023-03-22 09:23:44 +07:00
hathach 0921edaf59 use tud_inited() instead of tusb_inited() 2023-03-22 09:23:11 +07:00
hathach d22fc550c7 change meaning of CFG_TUH_HID to total number of HID interfaces supported.
- previously CFG_TUH_HID is max number of interfaces per device which is
rather limited and consume more resources than needed.
- change hid host instance in API to index
2023-03-21 21:04:06 +07:00
hathach 8a0b17598c add osal_task_delay() for control blocking 2023-03-21 18:15:45 +07:00
hathach d34508a316 add note for blocking tuh_configuration_set(), tuh_interface_set() 2023-03-21 18:13:25 +07:00
hathach 878f2b54fe relax hid host enumeration, allow set protocol to be stalled 2023-03-21 18:12:55 +07:00
Ha Thach ec9c666107
Merge pull request #1965 from HiFiPhile/align
UAC2: fix feedback EP buffer alignment.
2023-03-21 15:46:00 +07:00
Mengsk 42decd94e5 UAC2: fix feedback EP buffer alignment. 2023-03-21 07:58:39 +01:00
hathach e44e461ce3 add tuh_set_interface 2023-03-21 12:55:52 +07:00
hathach 4520218786
more compatible with IAR 2023-03-20 11:33:39 +07:00
hathach 1fc203b085
more update to kinetis bsp 2023-03-18 19:50:24 +07:00
hathach 2d187777c0
merge kinetis into its own family in bsp 2023-03-18 18:30:51 +07:00
Bob Paddock f9b8a0667a Add support for NXP FRDM_K32L2A4S eval board. 2023-03-18 16:50:50 +07:00
hathach 9f54cc1eb7
more clean up 2023-03-18 11:43:47 +07:00
hathach d919f107c7
minor clean up 2023-03-18 11:22:44 +07:00
hathach bdfcd50b1b
Merge branch 'master' into portability 2023-03-17 23:53:38 +07:00
hathach 3623ba1884
fix trailing space and new line
temporarily disable codespell
2023-03-17 16:12:49 +07:00
hathach e1fda007f6
minor refactor to invalid index 2023-03-17 14:46:02 +07:00
hathach 317177c83d
update host example, add pio-pico-usb for rp2040 2023-03-17 14:06:25 +07:00
hathach f349ae7702
fix enumerate one device at a time 2023-03-17 13:58:01 +07:00
hathach e7d212f337
more fix 2023-03-16 23:21:15 +07:00
hathach 92aed7e3e0
rename symbols 2023-03-16 11:28:10 +07:00
hathach bc2127b330
rename file link to rusb2 2023-03-16 11:03:53 +07:00
hathach cd1726c009 Merge branch 'master' into renesas-ra 2023-03-16 09:51:27 +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
Ha Thach ea8ecea59a
Merge pull request #1953 from tannewt/fix_cached_imx_reset
Flush the dcd data on reset
2023-03-14 09:08:32 +07:00
Scott Shawcroft d31aac453e
Flush the dcd data on reset 2023-03-13 15:22:00 -07:00
James Smith 296ce528fc Updated host hid_controller example to demo tuh_hid_send_report 2023-03-13 16:31:25 +07:00
James Smith f6774d5611 Implemented tuh_hid_send_report 2023-03-13 16:31:25 +07:00
Hubert Denkmair f8a21fff17 dcd_write_packet_memory: use volatile modifier for destination pointer 2023-03-12 15:51:07 +01:00
hathach 0a7c08d16e minor format 2023-03-12 16:01:24 +07:00
Ha Thach be21413361
Merge pull request #1948 from dhalbert/remove-volatile-cast-include
rp2040: include hardware/sync.h explicitly
2023-03-11 09:35:04 +07:00