Commit Graph

1418 Commits

Author SHA1 Message Date
Reinhard Panhuber 37be0ca732 Fix formatting, get rid of all tabs. 2020-08-20 20:09:44 +02:00
Gavin Li 72183c7bb4
Slight optimization for cdc tx refill 2020-08-20 09:59:23 -07:00
Gavin Li 15b063beb2 Smarter CDC TX refill logic 2020-08-20 02:20:01 -07:00
Reinhard Panhuber c14f68e2c1 Commit before sharing.
Setup a test example - UNTESTED!
Missing: Start transmitting audio data in set_interface.
2020-08-19 21:07:43 +02:00
Reinhard Panhuber 6309364722 Merge remote-tracking branch 'upstream/master' into uac2
Conflicts:
	src/device/usbd.c
	src/device/usbd.h
	src/portable/st/synopsys/dcd_synopsys.c
2020-08-16 14:08:24 +02:00
Reinhard Panhuber 444e4d2821 Add EP close. Fix bug in set_interface within audio. 2020-08-16 13:48:25 +02:00
Jerzy Kasenberg e8d50a3c57 Add dcd_edpt_close() to synopsys
Endpoint close was implemented only in one driver so far.
This function is needed for interfaces with several alternate settings.

The way FIFO is allocated in dcd_edpt_open() allows to correctly close
only one IN endpoint (the one that was opened last).
2020-08-14 14:29:35 +02:00
Jerzy Kasenberg 88c5e2a37f Fix synopsys fifo flush during stall
Wrong FIFO was flushed in dcd_edpt_stall().
(epnum - 1) should only be used when accessing DIEPTXF registers.

For DIEPCTL and GRSTCTL epnum is correct index.
2020-08-12 10:26:36 +02:00
hathach 61e96e97cb use usbd_edpt_open in bth driver 2020-08-11 22:09:16 +07:00
hathach a9d362185b update note for app driver list mustbe accesible at all time. 2020-08-07 15:06:19 +07:00
hathach 01b9b77d3b allow application driver to overwrite built-in one
- position application driver before built-in
- remove dcd.h from public include.
2020-08-07 14:47:32 +07:00
hathach 9df8057702 Merge branch 'master' into add-app-driver 2020-08-07 12:13:13 +07:00
Ha Thach 6f3378f71d
Merge pull request #476 from kasjer/kasjer/fix-synopsys-fix-iso-frame-bit
Fix synopsys odd/even frame bit for IN ISO endpoints
2020-08-05 22:36:05 +07:00
Jerzy Kasenberg e9aa36a6e8 Fix synopsys odd/even frame bit for IN ISO endpoints
For ISO endpoint driver has to specify when data
is to be transmitted (odd or even frame).
Currently code was not updating this bit resulting in
data being sent every other frame.
If interval was 1ms full data packed was sent every 2ms, and
ZLP was sent in between.
2020-08-04 09:32:41 +02:00
hathach 7d9efd0697 manually submit unplugged event for nrf dcd_disconnect() 2020-08-04 14:18:12 +07:00
Ha Thach 026a1e7ac8
Merge pull request #478 from hathach/move-dcdconnect-to-dcdinit
Move pull-up enabling to dcd_init() instead of usbd
2020-08-04 14:11:32 +07:00
Reinhard Panhuber c557bf7b2e Implement dynamic FIFO RAM allocation according to configuration desc. 2020-08-03 19:48:05 +02:00
Ha Thach 72464faca4
Merge pull request #472 from hathach/fix-msp430-warning
fix msp430 gcc 9.2.0 warning
2020-08-02 12:53:03 +07:00
hathach acde49ccc9
enable pull-up in dcd_init() instead of usbd 2020-08-01 20:14:58 +07:00
Ha Thach 310797a580
Merge pull request #477 from hathach/fix-nrf-unplugg-isr-event
correct isr context for nrf DCD_EVENT_UNPLUGGED
2020-08-01 12:31:48 +07:00
hathach 9bf2b33366
correct isr context for nrf DCD_EVENT_UNPLUGGED
also rename debug lookup to prevent conflict
2020-08-01 12:02:59 +07:00
Jerzy Kasenberg c3b0389f10 Fix synopsys size check for ISO endpoint
Constraint was incorrect for ISO endpoint as stated in TODO.
2020-07-31 15:52:21 +02:00
hathach 10a8ef7614
fix nested extern declaration of 'SystemCoreClock' [-Werror=nested-externs] 2020-07-29 17:04:47 +07:00
hathach 5af08e2ffc
fix strict prototype 2020-07-29 16:59:07 +07:00
Ha Thach 78f1576e93
Merge pull request #412 from hathach/fix-net-cast-align
suppress cast-align warnings for net device driver
2020-07-29 11:23:11 +07:00
Ha Thach 8dda0a0dd1
Merge pull request #454 from me-no-dev/esp32-s2-fifos
ESP32-S2: Handle the fact that available EP IN FIFOs are less than the number of available EP INs
2020-07-28 15:16:15 +07:00
me-no-dev a1a390a788 Update dcd_esp32s2.c 2020-07-28 10:54:23 +03:00
hathach 6976e64217 fix msp430 gcc 9.2.0 warning in #465 2020-07-28 14:36:15 +07:00
Reinhard Panhuber 01903a4a6d Implement dynamic reallocation of RX and TX fifos for EP0.
Tested with EP0 size 8/16/32/64.
2020-07-27 21:03:20 +02:00
Reinhard Panhuber 5e3f90cd6e add 'set_EP0_max_pkt_size(...)' and fix EP0 size to 64 bytes after reset 2020-07-26 19:21:30 +02:00
Reinhard Panhuber 1269bb440a Fix structure definition audio_control_range_X_n_t 2020-07-25 14:31:25 +02:00
Reinhard Panhuber e047fbe8fb Merge remote-tracking branch 'upstream/master' into uac2 2020-07-25 14:26:24 +02:00
Reinhard Panhuber d91843bcd2 Get and set requests work 2020-07-25 11:18:50 +02:00
hathach 503c15217e
example to call tud_init() after freeRTOS kernel is started
add note for usb init when using with RTOS
2020-07-23 09:20:45 +07:00
hathach 0407cfe16c fix samd21 race condition with setup packet
reproduced with Adafruit_TinyUSB_ArduinoCore port commit 11d669b4d2a40eb2fc5e51b2a9707a6de9d42363 and SAMD BSP 1.6.1
2020-07-23 01:39:15 +07:00
Ha Thach 7d2fc12445
Merge pull request #469 from hathach/followup-pr466-pr468
Followup pr466 pr468
2020-07-21 21:56:57 +07:00
hathach dfca92d29b
follow up to pr468 2020-07-21 21:06:10 +07:00
Ha Thach be744e1e01
Merge pull request #466 from chang196700/feature/string_desc_msos
Remove 0xEE index string if statement & change TU_ASSERT to TU_VERIFY
2020-07-21 20:25:08 +07:00
Reinhard Panhuber 141db1278a Make definition of CFG_TUD_AUDIO_CTRL_BUF_SIZE mandatory 2020-07-20 20:24:05 +02:00
Reinhard Panhuber fdb156a3bb Implement control EP0 buffer and get rid of CFG_TUD_AUDIO_USE_TX_FIFO 2020-07-20 20:18:45 +02:00
me-no-dev 3822a6a385 FreeRTOS: Yield from ISR to notify the USB task
If we do not yeld in ISR when we write to queue/give semaphore, the scheduler will not know of the change and will not check the queue untill the next OS tick. This change causes the task to be called immediately and makes communication many times faster.
2020-07-20 00:46:16 +03:00
Chang Feng 5cd654838b
Remove 0xEE index string if statement & change TU_ASSERT to TU_VERIFY
Signed-off-by: Chang Feng <chang_196700@hotmail.com>
2020-07-19 19:13:17 +08:00
Reinhard Panhuber 077e881c92 Implement all missing A.17 control selectors 2020-07-19 11:53:35 +02:00
Reinhard Panhuber 47bcedc0b4 Add A.17.4 - Terminal Control Selectors 2020-07-18 19:27:00 +02:00
hathach 881025afdc add new name warning to cdc and midi (skip msc, hid warning for now) 2020-07-17 23:01:39 +07:00
hathach 7baeea7a00 update actual link speed for spresense 2020-07-17 18:28:19 +07:00
Reinhard Panhuber d0f3d03933 Intermediate commit. 2020-07-17 08:40:10 +02:00
hathach dc00f0cae1
update link speed detection for nuc505 2020-07-16 20:44:06 +07:00
hathach 0517f4a2f1
dcd tdi report link speed on reset 2020-07-16 16:12:21 +07:00
hathach 5ca748a68e
rename CFG_TUD_MSC_BUFSIZE to CFG_TUD_MSC_EP_BUFSIZE
rename CFG_TUD_HID_BUFSIZE to CFG_TUD_HID_EP_BUFSIZE
2020-07-16 15:34:16 +07:00
hathach fea6fb73a1
add fs & hs config for cdc_msc_freertos, midi_test, msc_dual_lun 2020-07-16 13:04:10 +07:00
hathach 706413f751 add tud_speed_get()
- define both fs and hs configuration descriptor
- rename CFG_TUD_CDC_EPSIZE to CFG_TUD_CDC_EP_BUFSIZE with default size of 64 for FS, and 512 for HS
2020-07-16 00:44:09 +07:00
Craig Hutchinson 323ae5a84f
Improve comment on CDC tud_cdc_write_available()
Fixes #460
2020-07-10 12:24:09 +01:00
Ha Thach 81392da1ea
Merge pull request #456 from me-no-dev/esp32-s2-epin-to
ESP32-S2: Detect EP IN Xfer Timeout
2020-07-10 12:29:06 +07:00
Ha Thach dbced9911d
Merge pull request #447 from hathach/add-stm-hs
Add support for STM32 OTG HS core
2020-07-08 19:47:24 +07:00
hathach 0fd074afd8
change REDUCE_SPEED=0/1 to explicitly SPEED=high/full
update readme, boards.md to add link to new stm boards
2020-07-08 16:29:48 +07:00
Ha Thach a192d99bf0
Merge pull request #457 from UweBonnes/add-stm-hs
Add stm hs
2020-07-05 14:07:08 +07:00
Uwe Bonnes fd38178189 STM32/OTG_HS: Allow OTG_HS port to run at FS speed.
Add "REDUCE_SPEED=1" to the compile options.
2020-07-03 10:52:57 +02:00
hathach ad5ae8c31d
update per review 2020-07-03 14:50:39 +07:00
hathach a09a86d299
fix NVIC disable typo 2020-07-03 01:19:02 +07:00
me-no-dev d493724a7b ESP32-S2: Detect EP IN Xfer Timeout
In some rare ocasions (bad cable, noise, etc.) data transfer might timeout and hang the endpoint, unless the interrupt flag is cleared.
This pull request targets to solve that case.
2020-07-02 13:05:17 +03:00
hathach 4cec866994
correct HSE_VALUE in hal_conf
- although it is define in CFLAGS, it is worth to correct to be
consistent with other build
- extract set_speed()
2020-07-02 14:57:00 +07:00
hathach 9a290febcd
change default port some stm bsp
- f769disco default port is highspeed port1
- remove PORT0 on stlink since the board only populated HS connector
2020-07-02 11:58:40 +07:00
hathach 4966fb2e13 clean up 2020-07-02 01:25:21 +07:00
hathach c2289777f7 Merge branch 'add-stm-hs' of github.com:hathach/tinyusb into add-stm-hs 2020-07-01 23:53:33 +07:00
Uwe Bonnes 196bdbc702 st/synopsys/dcd_synopsys.c: Remove USBC PHY PLL stabilization delay for now
While the ST code has a 2 ms stabilization delay for the USBC PHY PLL,
running without this delay showed no problem for at leat 10 USB un/replug
cycles. Observe for problems!
2020-07-01 14:45:07 +02:00
hathach d2450abaaf only set turnaround in reset complete 2020-07-01 18:51:04 +07:00
hathach e3974d6869 correctly set turn around according to cpu clock
help to run with low speed mcu
2020-07-01 18:44:52 +07:00
hathach a512a31c9d Merge branch 'master' into add-stm-hs 2020-07-01 17:58:02 +07:00
hathach ed1b670c55 clean up code 2020-07-01 17:57:37 +07:00
me-no-dev 6178f8de2f ESP32-S2: Handle the fact that available EP IN FIFOs are less than the number of available EP INs
ESP32-S2 has only 5 available endpoint-in FIFOs (including EP0) but 7 available EP IN numbers. This change decouples the fifo number from the endpoint number, providing FIFO numbers until they reach the limit, at which point it will return false and assert an error that too many endpoints were allocated.
2020-07-01 13:38:59 +03:00
Ha Thach 0c9932440b
Merge pull request #452 from hathach/fix-dfu-rt
Fix dfu rt
2020-07-01 15:24:39 +07:00
hathach 12a145b27d fix dfu-rt to response to SET_INTERFACE and DFU_GETSTATUS
fix #450
2020-07-01 01:33:02 +07:00
Jan Dümpelmann 378e6aab8c Clear ep0_pending if rx short packet 2020-06-30 17:56:25 +02:00
Jan Dümpelmann 9e35ef73f7 Fix receiving of short packet data (ep out) 2020-06-30 12:55:39 +02:00
Uwe Bonnes 30a18e2605 stm32f723disco: USB HS enumerates. 2020-06-30 11:07:53 +02:00
Uwe Bonnes 05bfd9ac4a dcd_synopsys: Handle HS and FS IP in one device
FIXME: Allow run-time selection to allow to handle both HS and FS with
one file

F746 HS port enumerates with error
config 1 interface 2 altsetting 0 bulk endpoint 0x3 has invalid maxpacket 64
2020-06-30 11:02:41 +02:00
hathach ab75998316 Merge branch 'master' into add-stm-hs 2020-06-30 01:55:57 +07:00
Ha Thach 05996aee64
Merge pull request #427 from kasjer/kasjer/add-da1469x-support
Support for DA1469x MCU from Dialog Semiconductor
2020-06-30 01:20:56 +07:00
Ha Thach 268ab9eaa8
Merge pull request #399 from duempel/redesign_synopsys_receive
Improvements to Synopsys EP OUT
2020-06-29 16:02:40 +07:00
Jan Dümpelmann 99df7789a7 Add author name to dcd_synopsys.c 2020-06-29 10:55:03 +02:00
Jan Dümpelmann 4f69bcea7e Remove EP0 remaining bytes manipulation
Renaming edpt_xact to edpt_schedule_packets
2020-06-26 17:18:25 +02:00
Jeff Epler b2ef8cdd42 dcd_samd: Provide implementation for OPT_MCU_SAME5X 2020-06-25 18:51:04 -05:00
hathach d4d6e06c1d added OPT_MCU_SAME5X option 2020-06-24 00:53:17 +07:00
Gavin Li 7ae47a9397
Call tud_cdc_tx_cb right after flush to keep tx fifo full 2020-06-20 22:12:10 -07:00
Reinhard Panhuber 28505cf03e Merge branch 'master' into uac2
Conflicts:
	src/device/usbd.c
2020-06-20 11:10:35 +02:00
Reinhard Panhuber ada82b840f Get update from tinyusb. 2020-06-20 10:51:21 +02:00
Jan Dümpelmann 067287ef91 Add transaction (edpt_xact) as sub transfer
A transfer can have one or multiple transactions.
Usually only EP0 splits one xfer into multiple xact.
2020-06-18 17:18:28 +02:00
Mengsk 9ffb9b69a4 Disable SOF in dcd_stm32_fsdev
Signed-off-by: Mengsk <admin@hifiphile.com>
2020-06-18 14:18:00 +02:00
Gavin Li 8fe887198b Add tx callback to cdc device
Useful for continuous transmission of data, which is difficult currently
because there is no notification of tx completion.
2020-06-18 01:13:44 -07:00
Mengsk 57b553e023 Fix IAR warnings.
Pa039 : use of address of unaligned structure member.
Pe188: enumerated type mixed with another type.
2020-06-17 10:08:33 +02:00
hathach 2b1c7730b7 fix hs port1 build with net endpoint 2020-06-16 00:53:06 +07:00
hathach 667eaa6dd6 fix stm32h743 priority with freeRTOS 2020-06-16 00:03:52 +07:00
hathach 2dd1be13e5 Enhance EP FIFO allocation for both Fullspeed and Highspeed
- Update shared RX FIFO calculation with FS/HS
- IN FIFO EP
  - Interrupt -> use EPSize
  - Bulk/ISO  -> use  max(EPSize, remaining-fifo / non-opened-EPIN)
2020-06-15 23:17:49 +07:00
Reinhard Panhuber bc7e24b659 Fix wrong comment for IAD checks. 2020-06-14 14:22:10 +02:00
Jan Dümpelmann 4399dd1b06 cherry pick PR399 commit : Interrupt time improvements 2020-06-14 19:13:31 +07:00
hathach f438aedccb overwrite setup packet 2020-06-14 18:29:38 +07:00
hathach 95966c2201 improve usbd log for control transfer 2020-06-14 18:29:02 +07:00
hathach a347de6e50 revert CFG_TUSB_RHPORT0_MODE to previous way 2020-06-14 18:28:45 +07:00
Reinhard Panhuber b25bbf4776 Fix alignment. 2020-06-14 12:58:16 +02:00
Reinhard Panhuber 3012175351 Fix alignment. 2020-06-14 12:57:00 +02:00
Reinhard Panhuber 862d1667f0 Fix alignment. 2020-06-14 12:55:52 +02:00
Reinhard Panhuber 930817221d Merge branch 'fix-too-strict-iad-checks' into uac2
Conflicts:
	src/device/usbd.c
2020-06-14 12:36:59 +02:00
Reinhard Panhuber 48b2e6cf78 Fix too strict checks on subclass and interface of iad descriptor. 2020-06-13 13:51:50 +02:00
Reinhard Panhuber 4362665fb3 Fix mic audio descriptor, fix too strict check on IAD desc. in usbd.c 2020-06-13 12:36:05 +02:00
Reinhard Panhuber d2f1bb58b3 Merge branch 'master' into uac2 2020-06-11 14:35:44 +02:00
Jerzy Kasenberg 0635bafe0a Add DCD for Dialog DA1469x MCU
Dialog Semiconductor's BLE MCU DA1469x comes with full speed USB.
It's base on National Semiconductor discrete USB controller USBN9603/4.

This adds support for:
- control/interrupt/bulk endpoints (up to 64 bytes)
- ISO endpoint were not tested and may not work correctly
- reset/sleep/wakeup are handled
- code for VBUS changes is provided
2020-06-09 15:55:46 +02:00
hathach e92118635c adding speed detect on bus reset 2020-06-01 13:40:18 +07:00
hathach 710c54f8cb allow hs ep open with 512 bytes 2020-06-01 01:36:09 +07:00
hathach f771afe6af fixed EP0 size to 64 since LS is not supported in device mode
- set turn-around and report actual speed in Enum Done
- add dcd_event_bus_reset() helper to report speed
2020-05-31 23:43:29 +07:00
hathach 5ffba8536d able to detect as hs 2020-05-31 19:41:22 +07:00
Ha Thach 5efeaf2ac1
Merge pull request #413 from kasjer/kasjer/ble-over-usb
Bluetooth HCI transport over USB
2020-05-31 15:07:56 +07:00
hathach d6d29897f3 add get device qualifier descriptor 2020-05-28 23:16:16 +07:00
Jerzy Kasenberg 56d46483e4 Add bt hci device class
Code implements USB transport for bluetooth HCI.
2020-05-28 10:58:49 +02:00
Jerzy Kasenberg 077437b3dc Add non standard request handling in class
For some reason bluetooth stack implementations send class requests
to device instead of interface.
To implement HCI interface over USB non device addressed requests
for class need to be handled.
2020-05-28 10:11:37 +02:00
hathach 53b749fd72 check max_len for vendor and hid 2020-05-28 14:44:26 +07:00
hathach fb214f7cf7 rename to drv_len to be consistent 2020-05-28 13:57:49 +07:00
hathach 10cd3f24bf initial transfer failed in open() shouldn't cause the driver open to fail. 2020-05-28 13:48:02 +07:00
hathach c1db36a15c
update vendor open() 2020-05-28 12:19:06 +07:00
hathach bec5b5f9da
update usbtmc open() 2020-05-28 12:13:48 +07:00
hathach 13860e9f94
update net open() 2020-05-28 11:51:25 +07:00
hathach 8f560bf275
update midi open() 2020-05-28 11:41:37 +07:00
hathach 89a3d1f6d1
update hid open() 2020-05-28 11:19:12 +07:00
hathach 7a15d2e0d2
improve msc 2020-05-28 00:56:33 +07:00
hathach 2eeeda1bcf
change signature for dfu runtime 2020-05-28 00:46:32 +07:00
hathach e340404968
changing usbd driver open() return type, add max_len
only done with cdc and msc, push this interim for feedback first
2020-05-27 19:01:59 +07:00
hathach d4bf777c94 try to get synopsys work with OTG HS + external PHY 2020-05-27 11:01:33 +07:00
hathach b4804d1592 random clean up for tdi 2020-05-26 22:15:38 +07:00
hathach 0482f0d686 update h743eval with rhport=1 highspeed 2020-05-26 22:15:00 +07:00
hathach 947c3eb10d multiple port support for global otg base 2020-05-26 16:07:48 +07:00
hathach b7ab60aa44 suporting multiple port (OTG FS + HS) for stm32 2020-05-26 15:52:02 +07:00
hathach fad088719e merge CFG_TUSB_RHPORT1_MODE into CFG_TUSB_RHPORT0_MODE
each port is 1 byte for easy maintenance
2020-05-26 15:21:23 +07:00
hathach d108ea4326 implement hcd_uframe_number for ohci
able to get 8 byte descriptors using LPC1769 + base, but failed to reset
and set address.
2020-05-22 21:45:34 +07:00
Reinhard Panhuber 9be2f1bf3d Add basic UAC2 structure - untested 2020-05-22 12:09:34 +02:00
hathach f308990ab5 Merge branch 'master' into update-host 2020-05-22 15:28:22 +07:00
hathach ff9994116e fix nrf hanged (blocking wait) when called within critical section 2020-05-21 21:22:12 +07:00
hathach 8b66098335 fix freeRTOS logic 2020-05-20 15:21:11 +07:00
hathach a0fe3a80e7 remove queue lock/unlock per review 2020-05-20 15:09:46 +07:00
hathach d8a15aca77 remove osal_queue_t const qhdl from osal API
since it doesn't make any differences.
2020-05-20 14:38:34 +07:00
hathach 88a455a9b9 added tud_task_event_ready()
to check if there is pending events in the tud task without executing
it. Useful to check before entering low power mode with WFI/WFE
2020-05-20 14:31:45 +07:00
hathach 4e8d414bc6 added osal_queue_empty() API
ported for osal none/freertos/mynewt
2020-05-20 13:38:41 +07:00
hathach 58cedf4c06 usb0 host on mcb1800 work with fullspeed mode.
use usbh_edpt_open() to correctly map ep2drv[]
2020-05-19 00:55:43 +07:00
hathach 81b1f97ef7 suppress cast-align warnings for net device driver 2020-05-18 13:23:40 +07:00
hathach 550746097b fix cast-align warning for nuc505 2020-05-18 13:03:41 +07:00
hathach 1a8ce043ed enable -Wcast-align
suppress vendor sdk driver at board.mk
2020-05-17 14:24:15 +07:00
Jan Dümpelmann 42edbc0006 Allow EP0 to use xfer sizes larger than one packet 2020-05-15 22:26:14 +02:00
Jan Dümpelmann 28696de390 Interrupt time improvements 2020-05-15 18:21:44 +02:00
hathach b0d49e55de refactor copy to and from fifo 2020-05-14 14:24:55 +07:00
Mengsk 46875a3912 Optimize FIFO for byte transfer.
Signed-off-by: Mengsk <admin@hifiphile.com>
2020-05-13 23:54:23 +02:00
Ha Thach 4e6aa0d81d
Merge pull request #390 from hathach/detect-nrf-softdevice
detect if SD is actually present on the flash using SD magic
2020-05-12 14:35:45 +07:00
Jan Dümpelmann 3401e0f6ff Synopsys OUT EP improvements:
- Use register based XFRSIZ to determine transfer complete
  (xfer->queued_len and xfer->short_packet were deleted)
- Pop out as many RxFIFO data entries as available within a IRQ call
- less application interruption due to XFRC calls
2020-05-08 18:10:48 +02:00
Mengsk f02ad1d0dc Add IAR compiler attribute and endian support. 2020-05-08 13:29:33 +02:00
hathach eeb076454b add CFG_TUSB_DEBUG_PRINTF() for log retargeting 2020-05-08 12:56:32 +07:00
Ha Thach f9f0873b72
Merge pull request #393 from xobs/fix-debug-warning
device: fix build warning when CFG_TUSB_DEBUG >= 2
2020-05-08 12:38:50 +07:00
Sean Cross 63bd8d2e44 device: fix build warning when CFG_TUSB_DEBUG >= 2
The function is defined inside of a function body which generates a
warning.  Circuit Python treats these warnings as errors, and so
refuses to build with debugging enabled:

    ../../lib/tinyusb/src/device/usbd_control.c: In function 'usbd_control_xfer_cb':
    ../../lib/tinyusb/src/device/usbd_control.c:195:19: error: nested extern declaration of 'usbd_driver_print_control_complete_name' [-Werror=nested-externs]
      195 |       extern void usbd_driver_print_control_complete_name(bool (*control_complete) (uint8_t, tusb_control_request_t const *));
          |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make: *** [../../py/mkrules.mk:55:
    build-simmel/lib/tinyusb/src/device/usbd_control.o] Error 1

Move the declaration to the top of the function to silence this warning.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-07 19:03:40 +08:00
hathach 58b99e59d4 detect if SD is actually present on the flash using SD magic
even with SOFTDEVICE_PRESENT defined, SD may not be present on actual
flash.
2020-05-05 23:07:56 +07:00
Ha Thach 101f234a16
Merge pull request #387 from duempel/redesign_transmit_synopsys
Redesign of Synopsys device transmission
2020-05-04 14:41:20 +07:00
hathach 905a80d1b2 temporarily remove osal_task_delay() from osal
- add hcd_uframe_number() API, update EHCI to return uframe number
- get host running on ea4357
2020-05-04 14:11:58 +07:00
Jan Dümpelmann fd69cc3dcc clean up
renaming function and variables
changing indent size
2020-05-04 07:59:13 +02:00
hathach 4a3a448340 clean up things, add makefile for host example 2020-05-04 00:29:52 +07:00
hathach 0e30afa691 abstract all UDP_CSR 2020-05-02 18:24:23 +07:00
hathach 3ad0cd041b clean up 2020-05-02 16:29:22 +07:00
hathach ac3c645dc1 fix EP0 data toggle issue 2020-05-02 16:09:28 +07:00
hathach 2a479175ae remove toggle walkaround, fix control stall race condition 2020-05-02 14:51:21 +07:00
hathach a74a823b0a fix dcd samd race condition with setup packet
setup packet can complete together with previous status (in & out).
Always make sure to prepare valid buffer for holding setup packet when
queuing control status.
2020-04-30 00:29:47 +07:00
Jan Dümpelmann 59ff208c65 Changed switch into if statements 2020-04-29 12:37:29 +02:00
Jan Dümpelmann 3e6feb7f6d Redesign of Synopsys device transmission
Changes:
  - checking if tx buffer empty interrupt is masked
  - process more than one packet in isr
  - mask tx buffer empty just after all bytes were written
  - use of transmit_fifo_packet instead of transmit_packet
2020-04-29 11:32:22 +02:00
hathach 6f4b6a1d03 remove the use of TU_VERIFY_HDLR 2020-04-29 11:31:27 +07:00
hathach c14c0cfc9f support class drivers implemented by application 2020-04-29 10:49:58 +07:00
Ha Thach d4511186a2
Merge pull request #383 from kasjer/kasjer/fox-busy-flag-race-condition
Fix endpoint busy flag race condition
2020-04-29 10:12:31 +07:00
hathach fcdb22b2f9 fix typo 2020-04-28 10:53:43 +07:00
Jerzy Kasenberg 63cefb7615 Fix endpoint busy flag race condition
Busy flag was set to true after call to dcd_edpt_xfer().
In some cased it was possible that transfer finished before function
ended.
In this case busy flag could be set to false before it was set to
true.
Then setting it to true after dcd_edpt_xfer() made edpoint busy forever.

This change marks endpoint as busy before transfer is started to
avoid race condition.
2020-04-27 16:42:35 +02:00
hathach 958b5510cb added comment for hw clearing TXFE 2020-04-27 13:17:47 +07:00
hathach e785b09118 TXFE is read only bit 2020-04-27 12:06:14 +07:00
hathach d0487088ac revert a change to net driver 2020-04-26 23:04:17 +07:00
hathach 00fcf829a1 sync synopsis fix for esp32s2 2020-04-26 22:41:04 +07:00
hathach 8d18d6077b turn off TX FIFO Empty for EPIN if all bytes are written
fix dcd synopsys issue with usbnet #289
2020-04-26 22:14:59 +07:00
hathach 83353dd93f add TODO for usbnet clean up 2020-04-26 22:03:05 +07:00
hathach a1c599f4b6 clean up log message 2020-04-26 22:02:49 +07:00
hathach 9c8517a8d2 fix missing debug log macros 2020-04-26 14:58:23 +07:00
hathach 017c95037f add usbd edpt open
- RTT mode is blocking to prevent log lost
- Improve logging message
2020-04-26 14:51:44 +07:00
Jerzy Kasenberg b949ae596f synopsys: Reduce interrupt time for IN ZLP
For IN endpoints output FIFO is filled in interrupt, therefor before
endpoint is enabled, DIEPTSIZ is set with correct size of packet.
Then endpoint is enabled and FIFO empty interrupt is enabled.

This works fine except for the ZLP. Enabling FIFO empty interrupt
results in interrupt handler being called all the time because
there is nothing to put in the FIFO.
Eventually it ends when IN token is received and empty
packed is transmitted out.

This change does not enable FIFO empty interrupt for ZLP reducing
CPU load.
2020-04-24 17:38:30 +02:00
hathach c59fa77427 Revert "Merge pull request #359 from versioduo/midi-flow-control"
This reverts commit 1d33aa9b6f, reversing
changes made to 718db7e536.
2020-04-23 23:25:20 +07:00
Ha Thach f8bb4c86ef
Merge pull request #376 from hathach/add-more-example
Add dynamic configuration example
2020-04-23 14:50:27 +07:00
Ha Thach c39dc03331
Merge pull request #374 from duempel/stm32f1_synopsys_support
Added support for STM32F1 Connectivity Line MCU
2020-04-23 13:38:48 +07:00
hathach 10e035241f
house keeping 2020-04-22 23:04:21 +07:00
Jan Dümpelmann 551724498a Added support for STM32F1 Connectivity Line MCU
STM32F105 and STM32F107 are using the Synopsys IP
2020-04-22 17:39:53 +02:00
hathach 7acdcc2ebc Merge branch 'master' into add-more-example 2020-04-22 19:50:23 +07:00
hathach 1fc7f54a8a
added swo as logger
tested with feather nrf52840 + jlink
2020-04-22 19:18:03 +07:00
hathach 3aa3c35986 Merge branch 'master' into add-rtt 2020-04-22 13:45:20 +07:00
Ha Thach 379b8ac556
Merge pull request #365 from pigrew/desc_tu_verify
tu_verify for getting descriptors
2020-04-22 12:24:05 +07:00
hathach 3b83813f01 clean up 2020-04-22 00:29:51 +07:00
Ha Thach 1d33aa9b6f
Merge pull request #359 from versioduo/midi-flow-control
MIDI - Add flow control to incoming packet stream
2020-04-22 00:11:27 +07:00
Nathan Conrad 0ec69de77c sof is optional, revert other changes but remove unneeded check. 2020-04-21 10:06:17 -04:00
Nathan Conrad d1656c0b8d tu_verify for getting descriptors 2020-04-20 16:09:15 -04:00
hathach bbcf9241bd add back MIDI multiple jack 2020-04-20 23:46:17 +07:00
hathach d57312602d add extra comma to HID_REPORT_ID
this make the template with Report ID look less weird to the user
2020-04-20 16:09:17 +07:00
hathach e4570c35f7 add uart for ea4357 2020-04-20 00:27:35 +07:00
Kay Sievers a0598ef369 MIDI - Add flow control to incoming packet stream
Larger SysEx transfers get corrupted by incoming packets.

This changes the FIFOs not to overwrite their data. MIDI should not be
a transport that drops packets. A potentially blocking device is easier
to detect and handle than a device that silently corrupts the packet
stream at random overflows, especially when SysEx messages are involved.
2020-04-19 11:44:15 +02:00
Ha Thach f9262007ac
Merge pull request #258 from versioduo/midi-packets
MIDI packet interface
2020-04-19 15:43:07 +07:00
hathach 1f442c0a9a also add wakeup event 2020-04-18 23:48:36 +07:00
hathach c3fc5f1595 session end interrupt doesn't trigger on esp32 saola board
it is possibly due to the board design without vbus sense. Revisit
later.
2020-04-18 23:42:51 +07:00
hathach fa71402e17 implement disconnection detection for stm32 synopsys
- disconnection is OTG INT session end bit
- add USE_SOF to disable 1ms interrupt on mcu which isn't used now by
the stack
- add suspend detection
2020-04-18 23:40:27 +07:00
hathach ce6a81e74d
fix typo 2020-04-17 22:10:31 +07:00
hathach 464b1e8e89
correct return for write flush 2020-04-17 15:57:24 +07:00
hathach 4571ce0d29
add a bit of document for cdc device API. also improve cdc write flush when complete. 2020-04-17 15:54:20 +07:00
Ha Thach 0b1b9a2b9e
Merge pull request #260 from majbthrd/cdczlp
CDC device: fix behavior for transfers that are a whole multiple of endpoint buffer
2020-04-17 15:00:12 +07:00
hathach 6f9c256ad0
complete remove dcd_set_config(), fix unit test 2020-04-17 13:52:34 +07:00
hathach 05476d9ad7 Merge branch 'master' into remove-dcd-set-config 2020-04-17 13:38:22 +07:00
Ha Thach 85f0894fff
Merge pull request #347 from majbthrd/nuc505_config
nuc505: change dcd_set_config() behavior
2020-04-17 13:36:16 +07:00
Ha Thach 1f69807621
Merge pull request #354 from hathach/cxd56-disconnect-connect
Cxd56 disconnect connect
2020-04-17 13:12:47 +07:00
hathach dddf30f532
added disconnect for spresense 2020-04-17 12:53:42 +07:00
hathach 50be9d7c3a
mass rename tud/dcd_irq_handler to tud/dcd_init_handler 2020-04-17 12:27:53 +07:00
hathach 89f99426fc
add code for disconnect/connect (not tested) 2020-04-17 11:48:49 +07:00
Ha Thach 4bbbba48cb
Merge pull request #351 from hathach/valentyusb-dcd-disconnect-connect
Valentyusb dcd disconnect connect
2020-04-17 09:52:29 +07:00
Ha Thach 19e2eb66c0
Merge pull request #350 from hathach/synopsys-msp430-dcd-disconnect-connect
Synopsys msp430 dcd disconnect connect
2020-04-17 09:51:15 +07:00
Ha Thach 9aa553ccc2
Merge pull request #352 from hathach/samg-dcd-disconnect-connect
samg implement dcd connect/disconnect
2020-04-16 23:14:42 +07:00
Ha Thach 33610751d7
Merge pull request #336 from pigrew/edpt_close
> If you notice my chain of events above, the bulk transfer was started BEFORE the SET_INTERFACE call. The USB device hardware swaps the order of them being delivered. On STM32, it gives priority to the lower-numbered EP index.

It shouldn't be a matter, control is 2+ stage, before sending the setup. Host should stop all communication to the endpoint that It wants to close.
2020-04-16 23:10:36 +07:00
hathach 36d4efa077
samg implement dcd connect/disconnect 2020-04-16 22:59:19 +07:00
hathach 6377699d77
implement dcd disconnect connect 2020-04-16 22:30:33 +07:00
Ha Thach bfec3b4479
Merge pull request #345 from hathach/add-alt-itf
Implement setInterface(alt) for usb net driver
2020-04-16 21:33:03 +07:00
hathach 3aaad8cd73
add int enable/disable for pullup 2020-04-16 21:30:12 +07:00
hathach 18d936b414
msp430 disconnect/connect 2020-04-16 21:04:28 +07:00
Nathan Conrad 2994d100cd Remove transfer queue filtering. May need to be revisited later. 2020-04-16 09:59:40 -04:00
hathach 63655ac9d7
cleanup for esp32 2020-04-16 20:43:26 +07:00
hathach 4c74140b31
stm32 sysnopsys disconnect/connect 2020-04-16 20:20:20 +07:00
hathach a009775745
dcd disconnect/connect for transdimension ip 2020-04-16 16:56:16 +07:00
hathach 418b69f2db
implement dcd disconnect/connect for lpc ip3511 2020-04-16 16:05:57 +07:00
hathach 969121df4f
added dcd disconnect/connect to lpc17/40 2020-04-16 15:52:45 +07:00
hathach 2eed58d096
per review 2020-04-16 11:13:54 +07:00
Peter Lawrence b9fca0bbb4 nuc505: change dcd_set_config() behavior 2020-04-15 14:16:48 -05:00
hathach 86ff5651ad
correct usbnet control complete response
don't return false with STD request get/setInterface() or targeted Data
Interface (itfnum +1)
2020-04-15 23:10:52 +07:00
hathach 0ddbda08cb
always response if GET_INTERFACE even if class driver does not support alt interface 2020-04-15 23:08:49 +07:00
Nathan Conrad b0270f499b stm32fsdev: dynamic allocation of PMA. 2020-04-15 11:53:30 -04:00
hathach caa1dceed9
implement alternate setInterface() request
mostly forward these request (recipient = interface) to class driver.
2020-04-15 17:51:02 +07:00
hathach d315393fbb
use IAD to assign itf2drv mapping correctly
merge net_data back into net driver
2020-04-15 16:18:24 +07:00
hathach 0b39168dc2
add IAD for CDC ECM, remove EEM descriptor template 2020-04-15 15:40:53 +07:00
hathach b03b9eb939
change cdc template protocol to None 2020-04-15 15:14:26 +07:00
hathach 93ffe317b2
clean up 2020-04-15 13:53:50 +07:00
hathach 3bfb402d8c
clean up 2020-04-15 11:44:12 +07:00
hathach 1faa3b2768
tested usbnet, completely remove class code 2020-04-15 11:41:26 +07:00
hathach c74f7e708e
remove class_code/subclass/protocol from driver structure, add name for logging 2020-04-15 11:06:35 +07:00
hathach f1a6f92fab
Merge branch 'master' into class-driver-id 2020-04-15 10:47:49 +07:00
hathach 490771a094
test vendor 2020-04-15 10:39:01 +07:00
hathach c1c9ca5629
test with tmc 2020-04-15 10:37:31 +07:00
hathach e713b534fa
test ok with cdc and msc 2020-04-15 10:30:34 +07:00
hathach bae570f7c7
tested with midi 2020-04-15 10:30:07 +07:00
Peter Lawrence 7fa8d87291 usbnet: remove CDC-EEM 2020-04-14 21:10:43 -05:00
hathach 8614dcece7
tested with hid 2020-04-15 01:01:07 +07:00
hathach 3ef6e33533
use class driver open() for interface support detection
tested with dfu_runtime
2020-04-15 01:00:37 +07:00