Commit Graph

1685 Commits

Author SHA1 Message Date
ndinsmore ac87a4547d
Change to using tu_min32
This was a github edit, not tested
2021-02-18 08:25:04 -05:00
Reinhard Panhuber 681cfd0bf2 Correct for wrong pointer type in audio_device.c 2021-02-18 11:12:16 +01:00
Nicholas R Dinsmore 27f4b6f5a4 Included size check for ISO buffers 2021-02-17 18:22:24 -05:00
Reinhard Panhuber 6cb9a6ebb1 Add (void *) for pointer cast. 2021-02-17 23:04:19 +01:00
Reinhard Panhuber d8481ac7e4 Fix wrong pointer call in dcd_samg.c 2021-02-17 22:52:59 +01:00
Reinhard Panhuber 666e0fad35 Fix wrong tu_fifo_read_n() call in dcd_stm32_fsdev.c 2021-02-17 22:50:49 +01:00
Reinhard Panhuber 402005c9e0 Fix missing pointer operator in dcd_nuc505.c 2021-02-17 22:49:10 +01:00
Reinhard Panhuber 94bf4f54da Fix missing FIFO definitions 2021-02-17 22:29:51 +01:00
Reinhard Panhuber 53a796a92e Fix wrong pointer type. 2021-02-17 22:29:40 +01:00
Reinhard Panhuber ae20d11124 Merge remote-tracking branch 'upstream/master' into edpt_ISO_xfer
Conflicts:
	src/common/tusb_fifo.h
2021-02-17 22:08:21 +01:00
Reinhard Panhuber eee47493a3 Fix bug in evasion buffer list 2021-02-17 21:59:32 +01:00
Reinhard Panhuber e407ce463d Add SAMD MCUs to buffer evasion list 2021-02-17 21:47:01 +01:00
Reinhard Panhuber 189b357b54 Implement an evasion linear buffer for MCUs not capable for EP FIFO
Also MCUs using DMAs are within this list, however, these can use an EP
FIFO. There is just no time for implementation
2021-02-17 21:42:44 +01:00
Reinhard Panhuber 2d7b61972c Implement dcd_edpt_iso_xfer() for dcd_stm32_fsdev
Implemented a special copy strategy to copy directly from the FIFO. This
function, however, is untested and should be regarded as unreliable
until somebody was able to test it
2021-02-17 20:46:31 +01:00
Reinhard Panhuber c87357c025 Improve tu_fifo capabilites
Added tu_fifo_get_linear_write_info(), tu_fifo_backward_write_pointer(),
and tu_fifo_backward_read_pointer()
2021-02-17 20:44:26 +01:00
Nicholas R Dinsmore 79b360f0a6 Enable iso buffers per rp2040 spec 2021-02-17 13:22:34 -05:00
Nicholas R Dinsmore b7ec66e33a This fixes the overflow mathmatic in the fifo 2021-02-16 23:08:08 -05:00
Jeremiah McCarthy f8fbc0930b Add alternate bitfield padding option
Adds configuration option CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT, which
substitutes bitfield variable " : 0" padding syntax with an unused
variable of size equal to the remaining number of bits.

This change resolves aligned access issues for some platforms.

Default behavior is original if the option is not explicitly enabled.
2021-02-16 10:43:52 -05:00
Reinhard Panhuber a5d7b6266d Implement dcd_edpt_iso_xfer() for msp430 2021-02-14 14:05:15 +01:00
Reinhard Panhuber 893f997dcb Change FIFO use indication to ff == NULL to avoid future errors.
This way people don't need to pay attention for the buffer pointer
2021-02-14 09:25:34 +01:00
Reinhard Panhuber b634b5958b Implement dcd_edpt_iso_xfer() for INTERRUPT driven dcd_nuc505 2021-02-13 21:00:55 +01:00
Reinhard Panhuber 0c3dc8f99b Implement dcd_edpt_iso_xfer() for dcd_nuc121.c 2021-02-13 17:44:59 +01:00
Reinhard Panhuber 126e46e38a Fix not increment xfer->buffer if xfer->buffer == NULL in dcd_samg.c 2021-02-13 17:37:13 +01:00
Reinhard Panhuber e681678402 Implement dcd_edpt_iso_xfer() for dcd_nuc120.c 2021-02-13 17:06:27 +01:00
Reinhard Panhuber 7ab389db21 Implement dcd_edpt_iso_xfer() for dcd_samg.c. NOTE: ISO EP not supported 2021-02-13 16:36:32 +01:00
Reinhard Panhuber 59d6ed9ea4 Implement dcd_edpt_iso_xfer() for dcd_esp32s2.c 2021-02-13 12:13:10 +01:00
Reinhard Panhuber 9e2a1d2e6a Fix CFG_TUD_AUDIO_EP_IN/OUT_SW_BUFFER_SIZE to be defined anyway 2021-02-12 18:31:54 +01:00
Reinhard Panhuber cdf600048f Merge remote-tracking branch 'upstream/master' into edpt_ISO_xfer 2021-02-12 18:05:20 +01:00
Reinhard Panhuber 185414721f Formating 2021-02-12 18:04:45 +01:00
Reinhard Panhuber a9fd0a454a Complete redesign of audio driver. 2021-02-12 16:28:41 +01:00
ndinsmore 09868434cd
Fixes RP2040 buffer reallocation overrun problem (#642)
Fix running out of memory on a device that repeatedly closes and opens an endpoint. This is a workaround at the moment. A better solution would be to implement reclaiming usb buffer memory when closing an endpoint (i.e. implement dcd_edpt_close).
2021-02-12 08:16:46 +00:00
Ha Thach 04ab6b4082
Merge pull request #648 from hathach/rename-dfu-rt-to-runtime
Rename dfu rt to runtime
2021-02-11 15:29:55 +07:00
Ha Thach d4281291e5
Merge pull request #647 from hathach/correct-fs-bulk-epsize
more epsize checking per type
2021-02-11 12:36:19 +07:00
hathach e12c25ec2c rename dfu_rt to dfu_runtime for easy reading
also rename tud_dfu_rt_reboot_to_dfu to tud_dfu_runtime_reboot_to_dfu_cb
2021-02-11 12:05:22 +07:00
hathach 9812cfc6c6 clean up 2021-02-11 11:48:34 +07:00
hathach 919bb9ce38 more epsize checking per type 2021-02-11 11:45:24 +07:00
hathach 49bc97b0ca remove the requirement of std SET/CLEAR_FEATURE must not return zlp status 2021-02-11 11:22:02 +07:00
hathach d2b8e591f6 tud_hid_report_complete_cb() API
update hid composite to make use of tud_hid_report_complete_cb() for
sending reports when possible.
2021-02-09 15:57:29 +07:00
Ha Thach ecd16cf24b
Merge pull request #637 from tfx2001/master
add basic support for rt-thread
2021-02-08 20:10:07 +07:00
tfx2001 1b678eccf5 add basic support for rt-thread 2021-02-08 20:46:49 +08:00
hathach 72bcc0685c add tud_hid_n_gamepad_report() helper for gamepad report
- Add gamepad to hid_composite example. Though it needs a bit of extra
work but it will come later as separated PR.
2021-02-08 19:08:16 +07:00
hathach b2019e4d71 enhance gampepad report with dpad/hat support
add hid_gamepad_report_t along with GAMEPAD_BUTTON_ and GAMEPAD_HAT_
enum
2021-02-08 16:10:13 +07:00
Ha Thach be1bd74b4b
Merge pull request #618 from homeodor/master
A CDC-like blocking behaviour for MIDI, incl. SysEx
2021-02-06 12:30:28 +07:00
hathach 465ea7a66e increase TUSB_VERSION_ to 0.8.0 2021-02-05 22:37:22 +07:00
hathach bb2f93d427 prepare for release 2021-02-05 20:41:41 +07:00
Ha Thach 78f50518a4
Merge pull request #610 from hathach/rp2040-followup2
Rp2040 followup2
2021-02-01 12:44:53 +07:00
Ha Thach a044578a33
Merge pull request #601 from majbthrd/start_pi2tu
start the assimilation of Pi Pico into TU
2021-02-01 12:43:59 +07:00
Reinhard Panhuber 84406f1654 Rework audio driver 2021-01-31 19:08:23 +01:00
Alexander Golovanov 2a34be2eb0
A CDC-like blocking behaviour 2021-01-30 04:11:08 +03:00
Michael Himing c4f7ea09f1 Fix midi sysex sending bug 2021-01-28 20:31:11 +11:00
hathach 1abf9eeb80 clean up rp2040 assigned_address, remove panic from remote_wakeup 2021-01-27 13:18:03 +07:00
hathach c3c4f65fea wrap rp2040_usb around opt mcu 2021-01-27 13:04:38 +07:00
Ha Thach 045674745a
Merge pull request #604 from kamtom480/spresense-sdk-2.0.2
Update Spresense SDK and fix dcd issues
2021-01-25 22:55:46 +07:00
Kamil Tomaszewski 5f999fa6a0 Fix dcd issues on cxd56
Pass the next setup package when USB stack is ready to receive it.
When the transfer is 0 on EP0 send complete to the USB stack
Pass the data received after the setup package to the USB stack.
2021-01-25 11:13:56 +01:00
hathach ec458292fe fix host build 2021-01-25 13:25:47 +07:00
Peter Lawrence edc2224118 rp2040: start to adopt TU coding conventions 2021-01-23 20:21:58 -06:00
Peter Lawrence 587d1b334b rp2040_hcd: check pointer before using 2021-01-23 20:19:10 -06:00
hathach 67a9cdc35b fix compiler warning 2021-01-22 11:33:25 +07:00
Ha Thach 1e134cbb31
Merge branch 'master' into pico 2021-01-21 16:35:13 +07:00
Reinhard Panhuber f1551d7a5f Add __restrict keyword and memore alignment to src/dst pointer of
_tu_fifo_read_from_const_src_ptr()
 _tu_fifo_write_to_const_dst_ptr()
2021-01-20 20:14:23 +01:00
graham sanderson e0aa405d19 RP2040 support 2021-01-19 19:52:07 -06:00
Reinhard Panhuber 93ec6f3735 Adjust #include "dcd.h" to "device/dcd.h", the same for usbd.h in usbd.c 2021-01-19 17:10:08 +01:00
Reinhard Panhuber 56edc2b261 Change names from edpt_ISO_xfer to edpt_iso_xfer 2021-01-19 10:50:19 +01:00
Reinhard Panhuber 99e6bc3720 Explicitly add cast to uint32_t before shifting uint8 to left 2021-01-18 17:54:08 +01:00
Reinhard Panhuber 595a88b34c Correct include path to #include "common/tusb_fifo.h" 2021-01-18 17:38:32 +01:00
Reinhard Panhuber dff588d772 Implement dcd_edpt_ISO_xfer() and adapt transmission scheme 2021-01-18 17:15:23 +01:00
Reinhard Panhuber 2284db1fb5 Add usbd_edpt_ISO_xfer() 2021-01-18 17:14:17 +01:00
Reinhard Panhuber 51c80630f5 Clean up 2021-01-18 17:13:06 +01:00
Reinhard Panhuber 8450bc3225 Add FIFO copy modes: tu_fifo_copy_mode_t
Allows to copy from/to constant pointers required for STM32 hardware
FIFO copies.
2021-01-18 17:12:39 +01:00
Reinhard Panhuber 84c383061f Add tusb_fifo.h header file to dcd.h 2021-01-18 17:08:59 +01:00
Reinhard Panhuber 3a3ada0c57 Implement the usage of usbd_edpt_ISO_xfer() 2021-01-18 17:07:15 +01:00
Reinhard Panhuber bdbcb8df39 Add tu_fifo_read_n_into_other_fifo() to copy into from FIFO into another
Fix overflow in tu_fifo_write_n()
2021-01-17 11:55:33 +01:00
Reinhard Panhuber 485d8fa77e Merge remote-tracking branch 'upstream/master' into edpt_ISO_xfer 2021-01-09 12:10:08 +01:00
hathach d33b22d127 fix ci 2021-01-08 22:48:52 +07:00
hathach 6e6e6265e4 use dcd_event_bus_reset() with speed to replace bus_signal 2021-01-08 22:34:36 +07:00
hathach cca27fc383 another rename 2021-01-08 16:54:50 +07:00
hathach 201ea7ca6d remove inline for update_grxfsiz 2021-01-08 16:38:41 +07:00
hathach 9998e8a665 more minor work 2021-01-08 16:34:36 +07:00
hathach 86c34a9a33 minor clean up following pr581 2021-01-08 16:25:30 +07:00
Ha Thach 1f00a182c4
Merge pull request #581 from hathach/dcd_synopsis_mem_allocation
Dcd synopsis mem allocation
2021-01-08 12:45:46 +07:00
hathach 3e1d85eed2 comment clean up 2021-01-08 11:43:26 +07:00
hathach cc5dfd03cd update comment and correct the size to 8+2 2021-01-08 11:21:26 +07:00
hathach 60620dca42 walkround for samd21 setup_packet overflow
increase setup packet size from 8 to 12, since USB DMA controller is
suspected to overflow the buffer with 2 extra bytes
2021-01-08 01:21:03 +07:00
hathach 29f84b1602 change default CFG_TUD_HID_EP_BUFSIZE from 16 to 64 2021-01-07 11:58:05 +07:00
Reinhard Panhuber f2b4567a2b Correct function declaration 2021-01-04 17:15:42 +01:00
Reinhard Panhuber 2fa500af18 Minor corrections for PR
- externerlize code into functions
- correct comments
2021-01-04 17:00:23 +01:00
Reinhard Panhuber 37bb14678a Remove too verbose comment 2021-01-04 12:06:16 +01:00
Reinhard Panhuber 09d8ead4b8 Start changes - not yet finished 2021-01-04 12:02:08 +01:00
Reinhard Panhuber 13b499f910 Clean up 2021-01-03 17:59:50 +01:00
Reinhard Panhuber 56c47188d8 Rework USB FIFO allocation scheme and allow RX FIFO size reduction 2021-01-03 16:11:56 +01:00
Ha Thach 1491bc9162
Merge pull request #569 from kkitayam/add_support_for_frdm_kl25z
add support for frdm_kl25z
2020-12-25 23:03:23 +07:00
Ha Thach 08f8f488a0
Merge pull request #571 from HiFiPhile/iar_fifo
Fix IAR error on memcpy and warnings.
2020-12-24 12:03:57 +07:00
HiFIPhile baa5417f3e Fix IAR error on memcpy and warnings.
Signed-off-by: MasterPhi <admin@hifiphile.com>
2020-12-23 16:54:55 +01:00
kkitayam 2737166d2b fixed wrong direction to enable EP in dcd_edpt_open.
fixed incorrect handling of STALL other than EP0
convert tabs to spaces
removed unused symbols
2020-12-23 20:32:29 +09:00
Yakovenko Andrey bdee6397eb Added MSC read10 and write10 function 2020-12-23 12:52:51 +02:00
Ha Thach b580a0b7f3
Merge pull request #573 from HiFiPhile/scsi_mode_sense6_t
IAR build error fixes
2020-12-22 17:17:36 +07:00
HiFiPhile c8dc7f807f Fix more warnings.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2020-12-22 10:13:10 +01:00
HiFiPhile b3c0d417ef Fix error if "Required Prototype" is selected.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2020-12-20 23:10:34 +01:00
HiFiPhile 13e6afd589 Fix scsi_mode_sense6_t padding, which cause IAR compiler internal error.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2020-12-20 22:56:39 +01:00
kkitayam 2bbfc56bd8 added support for frdm_kl25z 2020-12-18 00:07:50 +09:00
hathach 8b34f2fca8 fix ci 2020-11-27 16:07:13 +07:00
hathach 94527951a0 add bus suspend & resume support for esp32s2 2020-11-27 15:54:55 +07:00
hathach f5e13d5898 msc only invoke scsi complete callback after status transaction is complete 2020-11-24 23:42:30 +07:00
hathach 148eea1417 add tud_connected()
which return true as long as we receive the very first SETUP packet from
host.
2020-11-24 21:49:12 +07:00
hathach 4b4f880785 add tud_ready() check in tud_cdc_n_write_flush()
other clean up
2020-11-23 23:40:13 +07:00
Ha Thach 308028e17c
Merge branch 'master' into cdc_without_dtr 2020-11-23 23:25:55 +07:00
hathach 14138f105e have tusb_init() return true instead of TUSB_ERROR_NONE 2020-11-23 13:12:51 +07:00
hathach e4144d8b47 remove control_complete 2020-11-20 17:21:01 +07:00
hathach cebb375eac migrate audio device to new control xfer cb 2020-11-20 17:20:05 +07:00
hathach c4bc8b2561 migrate net device to new control xfer cb 2020-11-20 16:59:33 +07:00
hathach d6461abe78 clean up 2020-11-20 16:30:03 +07:00
hathach 9f853685ae migrate bth device to new control xfer cb 2020-11-20 16:13:58 +07:00
hathach 61ad7bef71 migrate vendor device to new control xfer cb 2020-11-20 15:50:11 +07:00
hathach 3cc1979adb migrate dfu runtime device to new control xfer cb 2020-11-20 15:42:32 +07:00
hathach 7df979673d migrate usbtmc device to new control xfer cb 2020-11-20 15:38:56 +07:00
hathach 8813f9d3b8 clean up 2020-11-20 15:33:05 +07:00
hathach e2abb089f4 migrate midi device to new control xfer cb 2020-11-20 15:30:36 +07:00
hathach dc9a309839 migrate hid device to new control xfer cb 2020-11-19 22:00:49 +07:00
hathach dd07fecc5f migrate cdc_device to new control_xfer_cb 2020-11-19 21:26:06 +07:00
hathach 3c31d08051 merge class driver control_request & control_complete to control_xfer_cb()
migrated msc_device
2020-11-19 21:01:33 +07:00
Jan Dümpelmann 339b1a7723 Remove dcd_edpt_xfer_abort from DCD header 2020-11-18 11:12:06 +01:00
Jan Dümpelmann 54e29e9ff4 Implementation of the discussed changes
- remove usbd_edpt_xfer_abort
- rename tu_fifo_change_mode to tu_fifo_set_mode
- remove CFG_TUD_CDC_CLEAR_AT_CONNECTION definition
- remove auto fifo clear at connection event
- add tud_cdc_n_write_clear function
2020-11-18 09:42:50 +01:00
hathach 496c7c701a fix ci 2020-11-09 01:23:19 +07:00
hathach 23b6b66f4d release 0.7.0 with changelog and doc update 2020-11-07 23:43:39 +07:00
Ha Thach a708ab6254
Merge pull request #553 from hathach/host-async-control
Host async control
2020-11-07 10:52:14 +07:00
hathach 2907b1e438 clean up 2020-11-07 10:37:33 +07:00
Jan Dümpelmann af9f0f1cd6 Merge remote-tracking branch 'hathach/master' into cdc_without_dtr 2020-11-04 17:11:01 +01:00
Ha Thach 075334af80
Merge pull request #547 from hathach/cdc-auto-write-flush
enable cdc auto flush on write()
2020-11-03 11:42:17 +07:00
Ha Thach 720909e7f8
Merge pull request #545 from j4cbo/master
Rename CDC_COMM_SUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL
2020-11-02 22:07:05 +07:00
hathach 6fcd540cb6 enable cdc auto flush on write()
if there is enough data in the fifo
2020-11-02 16:50:46 +07:00
hathach 14461beffa remove legacy blocking usbh_control_xfer()
reworking cdc host driver
2020-11-02 09:19:34 +07:00
hathach 2efdc2fb64 get hub work more reliably 2020-11-02 08:46:24 +07:00
hathach 6eafdfab93 update usbh with hub to use async control transfer
work ok with msc + hub, but definitely need more testing.
2020-11-02 00:54:04 +07:00
hathach e029d6d726 added host set_config driver
to resolve control conflict with SET_CONFIGURE for class driver
- open will be called to open endpoint only
- set_config called later to initialized class driver
2020-11-01 17:46:46 +07:00
hathach 67ac40b98d house keeping: make tu_print_mem format easier to compare with hex2dump 2020-11-01 13:37:56 +07:00
Jacob Potter 3ea8138750 Rename CDC_COMM_SUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL
This was a confusing name; "Ethernet control model" (CDC ECM)
and "network control model" (CDC NCM) are two separate USB subclasses.
2020-10-31 10:57:53 -06:00
Ha Thach 065991e011
Merge pull request #543 from majbthrd/net_tweaks
net_device: re-factor code so as to not be specific to lwIP
2020-10-26 23:43:24 +07:00
Peter Lawrence a097b7e51a net_device: re-factor code so as to not be specific to lwIP 2020-10-24 20:27:57 -05:00
Jacob Potter 229be75a98 Move into if statement 2020-10-24 17:16:05 -06:00
Jacob Potter 01996457c8 CR feedback: compare CFG_TUSB_RHPORT1_MODE instead of using new macro 2020-10-24 17:11:32 -06:00
Peter Lawrence f5b72f5796 net_device: tweak 'pbuf chain' implementation 2020-10-24 17:29:47 -05:00
Jacob Potter c87ed8eff1 Allow use of internal FS PHY on OTG_HS interface
Some ST parts (like STM32F74xxx / STM32F75xxx) allow the USB_OTG_HS core to be used with
either an external high-speed ULPI PHY or an internal full-speed-only (12mbps) PHY. Currently
the code assumes than an ULPI PHY is used unless the chip has an internal high-speed PHY
(`#if defined(USB_HS_PHYC)`), with no provision to use the internal FS PHY.
2020-10-18 17:01:17 -06:00
Jerzy Kasenberg 8669fd7383 audio: Add two channel feature unit descriptor
Feature unit descriptor size depends on number of channels.
So far only single channel feature unit was present.
This change adds feature unit descriptor for two channels.
2020-10-15 15:37:40 +02:00
Jerzy Kasenberg db70a35044 osal_none: Fix queue definition
OSAL_QUEUE_DEF was not updated while FIFO was changed
to use unmasked pointers.

Two fields that are crucial to new functionality were left
uninitialized resulting in FIFO slowing down in time.
2020-10-13 16:34:44 +02:00
hathach 3623f578a4 more clean up 2020-10-13 14:11:17 +07:00
hathach d92d1a03ca clean up 2020-10-13 13:45:22 +07:00
hathach 437ccac696 implement tuh_msc_scsi_inquiry() / tuh_msc_read_capacity() / tuh_msc_get_maxlun() 2020-10-13 13:23:33 +07:00
hathach 9c07a2a4e2 rework msc host
- msc host enum is now async
- implement async tuh_msc_scsi_command() / tuh_msc_request_sense() /
tuh_msc_test_unit_ready()
2020-10-13 00:07:51 +07:00
hathach 87b989e8b4 add usbh_edpt_claim/release
implement USBH_EVENT_FUNC_CALL
2020-10-12 00:35:45 +07:00
hathach b5d4c8185d Merge branch 'master' into host-async-control 2020-10-11 16:22:12 +07:00
Ha Thach 6ce5395947
Merge pull request #525 from kasjer/kasjer/da1469x-iso
da1469x iso support
2020-10-11 16:12:20 +07:00
Ha Thach 80c509a0f3
Merge pull request #520 from salkinium/feature/misc_enhancements
STM32F3 IRQ remap option and some minor improvements
2020-10-11 14:55:06 +07:00
Ha Thach 762b390433
Merge pull request #521 from PanRe/uac2
Uac2
2020-10-10 14:33:42 +07:00
Niklas Hauser f914e48d25 Dynamically check STM32F3 IRQ remap option 2020-10-10 05:02:37 +02:00
Reinhard Panhuber 032e84c9be Revert dcd_alloc_mem_for_conf() but keep changes from @kasjer for ISO EP
Add tud_audio_set_itf_close_EP_cb()
2020-10-09 19:50:05 +02:00
hathach 8ba0c362cc update tud_hid_boot_mode_cb/tud_hid_set_idle_cb support mul interfaces
also clean up code
2020-10-09 20:51:20 +07:00
hathach 13abcb953f rename multiple hid callback 2020-10-09 20:24:10 +07:00
Ha Thach c2a0612885
Merge pull request #524 from zlittell/f_MultipleHIDInterfaces
Feature multiple hid interfaces
2020-10-09 00:28:13 +07:00
Zachery Littell a4ba1f0827 Fix tu_verify args 2020-10-08 12:08:13 -05:00
Zachery Littell 298aa1b669 Cleanup per review on PR 2020-10-08 11:59:12 -05:00
Jerzy Kasenberg d36bfddc30 DA146xx: Allow transmitting of packets larger then 64 bytes
FIFO is limited to 64 bytes yet MCU is capable of transmitting
larger packets provided that FIFO will be filled on the fly
and USB_USB_TXCx_REG_USB_LAST_Msk bit is set after FIFO is
filled with all the data that should be transmitted.

This change allows to use FIFO level warning interrupt to fill
FIFO. When DMA is available it will be used instead of interrupts.
Some function names were changed to better reflect what each function
does.
2020-10-08 13:20:58 +02:00
Jerzy Kasenberg 33a5081bd1 DA146xx: Add support for ISO endpoints
Few changes were needed to have working ISO endpoints.
2020-10-08 13:20:58 +02:00
Jerzy Kasenberg 6615dd9062 DA146xx: Add dcd_edpt_close
Closing endpoints can be important when there are alternate
instances. This adds functionality of closing endpoints
similar to what exists in other drivers.
2020-10-08 13:20:58 +02:00
Jerzy Kasenberg 9edf4334c4 DA146xx: Allow receiving of packets larger then 64 bytes
Internal FIFO for each endpoint is limited to 64 bytes.
It is possible to have longer packets if respective FIFO
is read during actual packet transmission.
This change updates receive data path to allow packets (and
endpoint size) larger then 64 bytes.
If DMA is not used yet DMA is setup for reception of big packets.
If DMA is already assigned to some transfer, code enables FIFO level
warning interrupts and tries to read data before FIFO is filled up.
2020-10-08 13:20:58 +02:00
Zachery Littell db3fe97f62 fix variable names. add itf n callbacks to multihid 2020-10-07 20:36:00 -05:00
Reinhard Panhuber f700c08aed Remove CFG_TUD_AUDIO_TX_DMA_RINGBUFFER_SIZE which is not needed any more 2020-10-07 10:57:12 +02:00
Ha Thach 440e23c491
Merge pull request #529 from gh2o/stm32-race
stm32 fsdev: fix ISTR and CTR_RX/TX race conditions
2020-10-07 15:16:55 +07:00
hathach 74a1404bea tab -> spaces 2020-10-07 13:36:27 +07:00
hathach 3f54c27afa fix audio_test build 2020-10-07 13:36:03 +07:00
Gavin Li 020ad47bb0 stm32: fix ISTR and CTR_RX/TX race conditions 2020-10-06 14:43:10 -07:00
hathach d41248900b Merge branch 'uac2' of https://github.com/PanRe/tinyusb into PanRe-uac2 2020-10-06 22:32:22 +07:00
Ha Thach 0686bd9369
Merge pull request #516 from PanRe/tusb_fifo_unmaksed_pointers
Tusb fifo unmaksed pointers
2020-10-06 00:01:51 +07:00
Niklas Hauser 788dcc200d Change CFG_TUSB_CONFIG_FILE mechanism to improve header file scanning 2020-10-03 20:17:53 +02:00
Niklas Hauser e41d9202b8 Allow overwriting TU_ASSERT etc macros 2020-10-03 20:17:53 +02:00
Niklas Hauser 51fb659533 Use tu_printf instead of printf 2020-10-03 20:17:53 +02:00
Niklas Hauser 78477077b4 Use C++11 static_assert when available 2020-10-03 20:17:36 +02:00
Reinhard Panhuber 2050dc0dc7 Revert #define CFG_TUSB_DEBUG 2 to #define CFG_TUSB_DEBUG 0
Change 1 << 31 to 0x100000000 in audio.h
2020-10-03 09:46:22 +02:00
Zachery Littell 081af79009 fix simple pull request comments. Implement descriptor index hack. 2020-10-02 16:02:00 -05:00
Ha Thach 9c4aceaaa8
Merge pull request #518 from kasjer/kasjer/nrf5x-iso-support
nrf5x iso support
2020-10-02 21:17:24 +07:00
Zachery Littell b7208d6f7e add index to report descriptor callback. this is breaking and needs to be reviewed 2020-10-01 12:51:48 -05:00
Zachery Littell 849681724a create N functions and inlines for multi hid interfaces 2020-10-01 11:51:33 -05:00
Reinhard Panhuber 603ce17696 Change AUDIO_CS_INTERFACE_HEADER to AUDIO_CS_AC_INTERFACE_HEADER 2020-10-01 17:49:30 +02:00
Jerzy Kasenberg 96da1ca4b8 nrf5x: Add support for ISO endpoints
ISO endpoints were not covered so far by the driver code.
This adds support for ISO IN and OUT endpoint handling.
Registers for ISO IN(OUT) endpoints are placed just after normal IN(OUT)
so in some cases common code could be used for handling all type of
transfers.
Generally code synchronizes ISO endpoint handling to SOF interrupt.
This code does not change the way of how non-ISO endpoints are treated.

Code uses strategy outlined in nRF52840 Produce Specification v1.0
sections 6.35.11.1 and 6.35.11.2.
2020-10-01 09:22:55 +02:00
Jerzy Kasenberg 6f5ee09511 nrf5x: Increase size of mps to 16 bits
msp stores max packet size.
For ISO endpoints 8 bits is not enough so it's changed to 16 bits.
2020-10-01 09:22:55 +02:00
Jerzy Kasenberg fceb8853c7 nrf5x: Add dcd_edpt_close
Closing endpoints can be important when there are alternate
instances. This adds functionality of closing endpoints
similar to what exists in other drivers.
2020-10-01 09:22:55 +02:00
Jerzy Kasenberg b2ce7a39b0 device: Make number of endpoints configurable
Currently number of endpoints was hard coded to 8.
NRF52 has 9 IN and 9 OUT endpoints.
ISO endpoints are 0x08 and 0x88 and without this change those
two ISO endpoint could not be used.
2020-10-01 09:22:49 +02:00
Reinhard Panhuber 13a9cbde79 Change AUDIO_FUNC_PROTOCOL_CODE_UNDEF for midi in usbd.h 2020-09-29 23:30:35 +02:00
Reinhard Panhuber da1c3c226b Change AUDIO_PROTOCOL_V1 to AUDIO_FUNC_PROTOCOL_CODE_UNDEF in midi.c.
The USB specification does not define any AUDIO_PROTOCOL_V1!
2020-09-28 22:44:09 +02:00
Reinhard Panhuber 9c837300f1 Fix minor issue.
- Change set_EP0_max_pkt_size() to set_EP0_max_pkt_size(void).
2020-09-28 19:23:38 +02:00
Reinhard Panhuber 529622710c Cleanup for PR. 2020-09-28 18:10:57 +02:00
Reinhard Panhuber 142871654e Merge remote-tracking branch 'upstream/master' into uac2 2020-09-28 18:08:39 +02:00
Jerzy Kasenberg f55437d889 audio: Add descriptor for mono speaker
This provides descriptor for mono speaker with
explicit feedback.
2020-09-28 08:41:17 +02:00
Jerzy Kasenberg 642a8b00c8 synopsys: Fix odd/even frame handling for ISO
Current implementation always sets odd/even bit for ISO transactions.
This is a good strategy only if interval is 1.
For ISO endpoint interval in (micro)frames is computed as
2^(interval-1), which means that odd/frame number should stay
same for interval values > 1.
With this change only when interval is 1 odd/even bit is modified.
2020-09-28 08:41:17 +02:00
Jerzy Kasenberg 2ace98e943 audio_device: Update explicit feedback support
Feedback can be specified by the user code and will be
sent at feedback endpoint specified interval.
2020-09-28 08:41:17 +02:00
Jerzy Kasenberg 6b52330969 synopsys: Remove compilation warning in dcd_edpt_close
dcd_edpt_close() no longer modifies FIFO distribution.
Code that that was commented out is removed along with
variables that are no longer used.
FIFO distribution among endpoints is handled upfront
and does not need to be modified in open and close endpoint
functions.
2020-09-28 08:41:17 +02:00
Jerzy Kasenberg 759d530506 audio_device: Allow one FIFO for N channels
This allow to build with single FIFO for devices with multiple channels.
Having just one FIFO greatly reduces time needed to feed endpoint.

This change also allows to have one FIFO with 24 bit samples that
is not rounded up to 32 bit elements.
CFG_TUD_AUDIO_RX_ITEMSIZE and CFG_TUD_AUDIO_TX_ITEMSIZE can be manually
defined. This allows to use FIFO more efficiently when 24 bits samples
are already using 3 bytes, in this case there is no need to put them
into FIFO one by one.
For 8, 16, 32 bits samples size efficient FIFO access is always used
when single FIFO is selected.

This also changes FIFO element size to 1, FIFO usage was confusing
in some place it treated content as byte base in other it looked like
ITEM size is to be used. Also bufsize that in most (maybe all) cases
was really meaning item count.
bufsize now mean buffer size in bytes so there is no confusion.
2020-09-28 08:41:17 +02:00
Jerzy Kasenberg 28cf63c7db audio_device: Fix tud_audio_n_read_flush TU_VERIFY usage
void function used TU_VERIFY in a way that returned bool value.
It would not compile.
2020-09-28 08:41:17 +02:00
Jerzy Kasenberg ca4a42156c audio_device: Fix audio_rx_done_type_I_pcm_ff_cb bufor size check
Function was not checking buffer size correctly due missing parenthesis.
2020-09-28 08:41:17 +02:00
Jerzy Kasenberg 66b091282f audio_device: Fix audio_rx_done_type_I_pcm_ff_cb prototype
Function prototype did not have return type specified by mistake.
2020-09-28 08:41:17 +02:00
Jerzy Kasenberg e67fc808aa audio_device: Store rhport in interface data
Some API uses interface number as argument, some wants to have
rhport.
To accommodate need of rhport for functions that don't have it
rhport can be extracted from interface data.
2020-09-28 08:41:17 +02:00
Jerzy Kasenberg f4a44ee063 audio: Update ISO endpoint attributes
Explicit feedback attribute was missing.
No synchronization now also has definition.
2020-09-28 08:41:17 +02:00
Jerzy Kasenberg 5ad2f8efc6 audio_device: Fix inline function specifiers
Having just inline keyword for function specified in header
may not be enough to generate code for function.

Adding static solves this problem.
static inline is used in all other inline functions in TinyUSB.
2020-09-28 08:41:17 +02:00
Jerzy Kasenberg 6f3d0af1e6 synopsys: Fix fifo allocation schema
Recommended FIFO allocation schema includes 2 maximum endpoint sizes.
Comment suggested that this is the case while it would work according
to this description only in checked endpoints were ascending sizes.
Also two same size endpoints would be counted as one.
That is fixed by way sz is filled.

Calculation used too much modulo operation while single division was enough
to account for odd FIFO sizes.

Extra space that is evenly distributed between Bulk and control endpoints
was incorrectly calculated it could prevent allocation of ISO endpoint FIFO
when bulk endpoints existed with smaller endpoint numbers.

Minimum endpoint FIFO size is 16 32bit words, FIFO space requirement is
now observed.
2020-09-28 08:41:17 +02:00
Reinhard Panhuber 8dcb104933 Change modulo substitute to while ( idx >= depth) idx -= depth; 2020-09-26 11:00:31 +02:00
Reinhard Panhuber 9ddcfc09d7 Fix wrong comments, rename pos to offset, rename overflow(). 2020-09-25 15:58:28 +02:00
Reinhard Panhuber 52c9a467b4 Fix bug in modulo substitute. 2020-09-23 21:36:30 +02:00
Reinhard Panhuber 9bdeafb295 Change maximum depth to 2^15 which allows for a fast modulo substitute.
Thus, however, overflows are detectable only for one time FIFO depth.
2020-09-23 20:48:03 +02:00
Ha Thach 8b2c822557
Merge pull request #512 from mzero/fix-midi-sysex
Fix a bug in writing SysEx messages.
2020-09-23 11:23:53 +07:00
Reinhard Panhuber 21299f90fa Final cleanup. 2020-09-19 11:46:43 +02:00
Reinhard Panhuber 9dfb78e9d8 Tested, working. 2020-09-15 20:40:41 +02:00
Jerzy Kasenberg 62a76c0e04 nrf52: Fix edpt_dma_start() wrong condition check
Operator < used in while condition was obviously incorrect.
Loop starts with checking if unsigned variable is less then 0.
This condition is always false.

This reverses condition to follow intention of of the code.
2020-09-15 16:08:23 +02:00
Ha Thach 745c15d5b5
Merge pull request #508 from hathach/fix-edpt-race
Fix edpt xfer race condition
2020-09-14 23:56:21 +07:00
Reinhard Panhuber 349c0f640e Implementation done, yet to be tested. 2020-09-14 18:24:08 +02:00
hathach 9c0d15fc43 more const 2020-09-14 22:23:59 +07:00
hathach 23e6ee2ea2 cdc device: claim endpoint before checking fifo availability
- add pre-check to reduce mutex lock in usbd_edpt_claim
2020-09-14 22:14:31 +07:00
Mark Lentczner 3b0216d3bf
Update midi_device.c
Fix a bug in writing SysEx messages.

At the start of a new USB packet (4 bytes), while in the middle of a SysEx, the code mistakenly
set the buffer length to 4, not the target length. As a consequence, the 3rd and 4th bytes from
the last packet were included, after every byte of the SysEx after the first packet of three.

The fix is simple, as it was just a typo, as can bee seen from the other branches in the same
section of if/else statements: At the start of a new packet, the code should set up the target
length... the buffer length should be left at 2 (as set on line 180).
2020-09-13 15:05:18 -07:00
hathach 5931d19666 correct the TUD_HID_REPORT_DESC_GAMEPAD 2020-09-13 15:01:20 +07:00
hathach 1804dba615 typo 2020-09-12 08:48:49 +07:00
hathach ce4a9b9c3a clean up 2020-09-11 00:14:07 +07:00
hathach 801f8b5b38 update claim edpt for hid and midi 2020-09-10 23:32:08 +07:00
Jan Dümpelmann b15c209805 Set new define because of build failure 2020-09-10 13:36:07 +02:00
hathach ed6d48b81e typo 2020-09-09 16:45:54 +07:00
hathach fe1b5dfa23 clean up 2020-09-09 16:29:45 +07:00
hathach 33f0a18523 update cdc edpt read 2020-09-09 16:25:31 +07:00
hathach 8b9893cada introduce optional usbd_edpt_claim, usbd_edpt_release which can be used to gain exclusive access to usbd_edpt_xfer 2020-09-09 15:48:11 +07:00
hathach 2b54dcb9f6 move functions around 2020-09-07 15:39:46 +07:00
hathach 7a3b24827e clean up 2020-09-07 15:25:03 +07:00
hathach 66a10ec9c8 rework usbh control transfer
use series of complete callback instead of blocking semaphore, which is
more noOS friendly. still working with hid host
2020-09-07 15:19:20 +07:00
Reinhard Panhuber 4e789b240d Start of sampling works. 2020-09-06 11:37:59 +02:00
hathach b3e81673c0 change xfer_cb return type from void to bool 2020-09-06 12:11:07 +07:00
hathach 15ad585e67 replacing hcd_pipe_xfer by usbh_edpt_xfer 2020-09-06 11:49:00 +07:00
hathach 9a6d7c648e clean up enum task 2020-09-05 21:12:43 +07:00
hathach 828f720207 refactor hub class
- separate connect/disconnect handling
- hub work with full speed, but doesn't seem to work with Low speed
device (with mcb1800)
- need to update msc host after migrating from isr to xfer_cb (blocked
at inquiry)
2020-09-05 20:20:45 +07:00
hathach 7ffb6acc16 more clean up 2020-09-05 17:16:46 +07:00
hathach b8b95e8494 add in_isr to all hcd event functions 2020-09-05 15:46:50 +07:00
hathach 90c8c14652 clean up 2020-09-05 15:19:01 +07:00
hathach bc09b6065f refactor extract parse_configuration_descriptor() 2020-09-05 15:16:45 +07:00
hathach d87f2a9691 remove usbh control mutex 2020-09-05 15:05:25 +07:00
hathach 9531e47d10 update example to test with mouse 2020-09-05 14:59:07 +07:00
hathach f7cf8cdf27 defer xfer_isr to xfer_cb 2020-09-05 14:41:31 +07:00
hathach 4d57b4ea33 clean up 2020-09-05 13:57:07 +07:00
Reinhard Panhuber 12562fc966 Merge remote-tracking branch 'upstream/master' into uac2 2020-09-04 16:23:39 +02:00
Jan Dümpelmann 9cc22b635c Add functionality to abort an ongoing transfer 2020-09-04 15:40:23 +02:00
hathach a8e538efe7 clean up 2020-09-04 01:35:32 +07:00
hathach 35aee4a6af more hid host work 2020-09-03 23:57:51 +07:00
Reinhard Panhuber 338e96fa82 Remove tud_audio_n_write_ep_in_buffer() as long as ISO EPs are not RBs. 2020-09-03 18:09:46 +02:00
Jan Dümpelmann 4071e490e2 New function to modify fifo overwritability 2020-09-03 17:21:32 +02:00
Jan Dümpelmann fd6cf9010b Turn transmit fifo overwritable in no DTR mode 2020-09-03 17:03:13 +02:00
Jan Dümpelmann d9eaa54e14 Remove connected check for write flushing 2020-09-03 16:40:53 +02:00
hathach ef651e0734 fix #449 remove obsolete pipehandle from hid host 2020-09-03 17:07:29 +07:00