Commit Graph

1180 Commits

Author SHA1 Message Date
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 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 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
Jan Dümpelmann fd69cc3dcc clean up
renaming function and variables
changing indent size
2020-05-04 07:59:13 +02: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
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
hathach ae60146274 use explicit all_subclass and all_protocol since 0xFF is stil valid 2020-04-14 22:35:34 +07:00
Nathan Conrad 16f65890eb Merge branch 'master' into edpt_close 2020-04-14 10:22:03 -04:00
hathach b90b00d43b
complete adding subclass and protocol to driver id 2020-04-14 18:35:50 +07:00
hathach 593fe154ec
adding subclass & protocol to class driver structure 2020-04-14 18:00:59 +07:00
Ha Thach 57ffa94a52
Merge pull request #334 from majbthrd/usbnet_osagnostic
usbnet: OS-agnostic (Windows/Linux/macOS) network driver
2020-04-14 17:39:50 +07:00
Nathan Conrad bbc59f1ceb stm32fsdev: add static assert for PMA size bigger than EP0 size. 2020-04-13 20:50:17 -04:00
Nathan Conrad de208b31cf edpt_close: Remove item from queue instead of modifying it. 2020-04-13 11:05:34 -04:00
Nathan Conrad f8e7487355 edpt_close: Updated based on feedback. 2020-04-13 09:51:46 -04:00
hathach f4df829399 lpc17xx move set configdevice into set address
for removing dcd_set_config()
2020-04-13 17:04:18 +07:00
Nathan Conrad 0eeaccaf46 Skeleton, and initial stm32fsdev implementation (that leaks memory) 2020-04-12 21:27:27 -04:00
Peter Lawrence bb3bbcc00b usbnet: OS-agnostic (Windows/Linux/macOS) network driver 2020-04-12 15:41:18 -05:00
Ha Thach 04a06ec401
Merge branch 'master' into refactor-irqhandler 2020-04-11 15:49:34 +07:00
Ha Thach 13a3081d30
Merge pull request #333 from hathach/fix-esp32s2-setup-packet
fix incorrect setup packet
2020-04-11 15:18:41 +07:00
Ha Thach 07809d03a7
Merge pull request #332 from pigrew/stm32fsdev-dcdconnect
stm32fsdev: Implement dcd_connect.
2020-04-11 13:20:31 +07:00
hathach ae1314f1c7 fix incorrect setup packet
also increase usbd stack in example when debug is enabled
2020-04-11 12:55:45 +07:00
Ha Thach 2ff3f765db
Merge pull request #319 from hathach/add-esp32s2
port ESP32 S2
2020-04-10 23:53:03 +07:00
hathach a37a56acd3 remove CONFIG_IDF_TARGET_ESP32S2BETA per review 2020-04-10 23:38:36 +07:00
Nathan Conrad 5bd9d14fc1 stm32fsdev: set dcd_connect API definitions to strong, Modify documentation. 2020-04-10 10:26:41 -04:00
hathach 8953bc9255 added comment note for beta chip walkaround 2020-04-10 20:25:53 +07:00
hathach c545cfc0bc Correct dedicated FIFO SRAM size to 1024
add note for up to 5 active IN endpoints (including EP0 IN)
2020-04-10 15:42:50 +07:00
hathach 978eec73b3 remove 100us delay at the end of dcd_init() 2020-04-10 15:39:59 +07:00
hathach 30945ab9f3 revert name to dcd_int_handler due to function prototype warning 2020-04-10 15:27:23 +07:00
hathach c0695b4b55 clear USB_RXFLVI_M before read_rx_fifo()
more format clean up
2020-04-10 15:13:12 +07:00
hathach 933e3cdfc7 change indent from 4 -> 2 spaces 2020-04-10 15:01:12 +07:00
hathach cec747776d rename dcd_init_handler to dcd_irq_handler to consistent with other ports 2020-04-10 14:47:02 +07:00
hathach d122d7de88 remove commented code 2020-04-10 14:45:55 +07:00
hathach a40d1e800d try to fix racing condition with setup 2020-04-10 14:04:18 +07:00
hathach 1b3d1b52c9 fix uint32_t format with log 2020-04-10 13:54:50 +07:00
Nathan Conrad 715c4dbbf8 stm32fsdev: Implement dcd_connect. 2020-04-09 17:03:12 -04:00
hathach d6578823bb rename static function for dcd_cxd56 to prevent conflict 2020-04-09 12:00:45 +07:00
hathach c1f3fbbc03 implement dcd connect/disconnect for samd and nrf 2020-04-09 11:47:02 +07:00
hathach 11201f1a06 adding dcd_connect/disconnect 2020-04-09 11:42:42 +07:00
Ha Thach defea45d44
Merge branch 'master' into refactor-irqhandler 2020-04-09 11:22:20 +07:00
hathach 40e23672ff rename hal_dcd_isr to dcd_irq_handler for fomu 2020-04-08 16:47:20 +07:00
hathach e879ad1e6f move irq from msp430 2020-04-08 16:42:36 +07:00
hathach 8f17945b67 move irq for stm32 synopsys 2020-04-08 16:37:09 +07:00
hathach 9014ca5528 move irq for stm32 fsdev 2020-04-08 16:26:14 +07:00
hathach 880595433c use macro for easy enable/disable SOF 2020-04-08 15:41:16 +07:00