Commit Graph

311 Commits

Author SHA1 Message Date
Reinhard Panhuber 5f88def9c9 Comment cleanup 2021-04-30 15:14:27 +02:00
Reinhard Panhuber 14e2c004cd Remove variable n in tu_fifo_get_read_info() 2021-04-30 15:08:14 +02:00
Reinhard Panhuber de933c45bc Remove all remainings with peek_at 2021-04-30 14:56:14 +02:00
Reinhard Panhuber 5f268608d7 Remove offset feature from fifo.c 2021-04-30 13:39:55 +02:00
Reinhard Panhuber 8f72c97f7b Change read infos to pointer type 2021-04-30 12:59:12 +02:00
hathach c26875e70d add TUP_MCU_STRICT_ALIGN macro that manually pick bytes for lpc55 port1 that is m4 but cannot unaligned acces on usb ram 2021-04-26 17:42:49 +07:00
hathach 8ebdf2b097 ip3511 correct buffer offset, nbytes layout for highspeed port1
able to get passed enumeration and up to READ10
2021-04-26 14:43:58 +07:00
Reinhard Panhuber 7072f0155e Change tu_fifo_get_linear_write/read_info() to return a struct
Compilers always complain that variables set by function via pointer
might be uninitialized so to avoid that return values are now delivered
via struct.
2021-04-23 11:48:54 +02:00
Reinhard Panhuber 03f974c9b9 Implement functions to allow for DMA usage in audio driver.
- Add tud_audio_n_get_ep_out_ff(), tud_audio_n_get_ep_in_ff(),
tud_audio_n_get_rx_support_ff(), and tud_audio_n_get_tx_support_ff()
- Change get_linear_read/write_info() to return linear and wrapped part
at once
- Adjusted affected code in audio_device.c and tested with
audio_4_channel.
2021-04-23 10:27:48 +02:00
Jeremiah McCarthy 2e2dc7bdc5 Revise per initial comments
Returns the RT driver to the function state of previous iteration, which
did not support the will_detach.  Behavior should be fine without this
feature.  This removes much of the added bloat to track state, and
handle requests in the APP_DETACH state which is no longer required.

Removes the optional bloat added to the RT driver, such as responding to
GETSTATE requests.

Fixes the DFU Mode to extract the attr bits from the functional
descriptor when opened.

Fixes some incorrect bitwise if checks.

Also, updates some naming of functions to be consistent with the rest of
the library.
2021-04-07 17:05:04 -04:00
hathach d9a0cc9e9f
more cleanup 2021-04-07 16:50:45 +07:00
hathach 893919a848 remove tu_fifo_backward_write/read_pointer API
since it is illegal from fifo perspective
2021-04-07 13:27:28 +07:00
hathach 2468f9e26d more _ff_pull/push clean up 2021-04-07 13:15:25 +07:00
hathach 9042e973d3 clean up _ff_push_n 2021-04-07 12:52:57 +07:00
hathach d6737fb5fe use tu_unaligned_write32() for _ff_push_const_addr 2021-04-07 12:34:00 +07:00
hathach d0fa4d5189 rename 2021-04-07 12:24:24 +07:00
hathach 8ac156622d fix cast-align warning 2021-04-07 00:38:12 +07:00
hathach a3c06aa7bc more clean up for _ff_pull_const_addr_in_full_words() 2021-04-06 23:39:39 +07:00
hathach d82ee2f8c0 refactor _ff_pull_n() with const addr 2021-04-06 23:12:04 +07:00
hathach c5db2282ad Merge branch 'master' of github.com:hathach/tinyusb into edpt_ISO_xfer 2021-04-06 19:35:01 +07:00
Ha Thach 1d20c84798
add tu_unaligned_read32/write32 (#772)
* add tu_unaligned_read32/write32
* added tu_unaligned_read16/write16
* add TU_ATTR_ALWAYS_INLINE, add to most of simple inline function
2021-04-06 19:32:01 +07:00
Jeremiah McCarthy c5b8ef1529 Separate DFU RT and Mode. Untested 2021-04-05 16:32:58 -04:00
Reinhard Panhuber 9b2ddd9cc6 Generalize audio driver for 3 audio functions plus a lot more.
- Audio format and parameters are parsed from descriptors thus user no
longer needs to give them explicitely

- Tested for 4 channel software type I PCM encoding with 16 bit with 1
channel per FIFO and 2 channels per FIFO (this is I2S specific)
2021-04-03 09:49:27 +02:00
Jeremiah McCarthy 1138f8cc70 Add DFU Class per Version 1.1 Spec 2021-03-26 15:30:43 -04:00
Reinhard Panhuber 994dddc231 Fix shadowing parameter in fifo.c 2021-03-25 14:38:55 +01:00
Reinhard Panhuber bfddfbadc7 Implement unaligned word copy. 2021-03-25 14:28:59 +01:00
Reinhard Panhuber 1e4e87de51 Rework to copy wrapped word bytes by byte in copy_to_cont_dst etc. 2021-03-25 13:53:26 +01:00
Reinhard Panhuber a60bd0c8ac Fix bug in writing to constant src/dst address.
Copying has to be conduct in full words (at least for STM32). Renamed
copy function to tu_fifo_write_n_const_addr_full_words()
2021-03-23 19:33:04 +01:00
hathach 4ee1216aaf fix fifo unlock typo, also clean up a bit 2021-03-13 00:22:04 +07:00
Reinhard Panhuber 8cb3bd3cd3 Merge remote-tracking branch 'upstream/edpt_ISO_xfer' into edpt_ISO_xfer 2021-03-10 19:33:11 +01:00
Reinhard Panhuber d5a5a1cab6 Implement audio PCM type I enc./decoding acc. to 2.3.1.5 Audio Streams
Extending capabilities of support FIFOs
Removing copy from to FIFO
Adjusting audio examples
Remove peek/read into other FIFO
2021-03-10 19:32:13 +01:00
hathach a397353916 fix ci build with rp2040 2021-03-10 17:58:39 +07:00
hathach e864bda627 fix build with freertos 2021-03-10 17:21:59 +07:00
Reinhard Panhuber de1f36f2b0 Adapt mutexes in fifo.c 2021-03-04 19:52:48 +01:00
Reinhard Panhuber 2e28861cf8 Remove TODOs done. 2021-03-04 18:20:22 +01:00
Reinhard Panhuber 7e56f46957 Extend FIFO mutex to use separate write and read mutexes.
Adjust all USB drivers using FIFO and mutexes.
2021-03-04 13:52:14 +01:00
Reinhard Panhuber 848e403e37 Fix unused parameter in _ff_push_copy_fct() and _ff_pull_copy_fct 2021-03-03 08:18:57 +01:00
Reinhard Panhuber bd2bab7aff Remove set_copy_modes(), implement:
tu_fifo_read_n_const_addr(), tu_fifo_write_n_const_addr()
2021-03-02 21:41:51 +01:00
Reinhard Panhuber cc948288bd Revert tusb_fifo.h include form to original. 2021-02-25 11:18:37 +01:00
Reinhard Panhuber 387bf1478e Fix missing , in tusb_fifo.h 2021-02-23 19:52:31 +01:00
Reinhard Panhuber e223d46033 Merge remote-tracking branch 'upstream/master' into edpt_ISO_xfer
Conflicts:
	src/common/tusb_fifo.h
	src/osal/osal_none.h
2021-02-23 19:47:57 +01:00
hathach 2a04ee68b8 add TU_FIFO_INIT() to help with tu_fifo declaration
tu_fifo_clear() also reset max_pointer_idx and non_used_index_space
2021-02-19 11:57:56 +07:00
Ha Thach 044d29c927
Merge pull request #654 from xmos-jmccarthy/master
Add alternate bitfield padding option
2021-02-19 11:03:53 +07:00
Reinhard Panhuber 8904874f76 Exclude #include "osal/osal.h" for OPT_OS_NONE 2021-02-18 20:52:57 +01:00
Reinhard Panhuber 31bf73517e Add #include "osal/osal.h" in tu_fifo.h 2021-02-18 20:16:57 +01:00
Jeremiah McCarthy 21f1cd4ec7 Implement requested PR changes
Removes CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT, and makes the manual padding
behavior standard.  Replaced unused variable name with TU_RESERVED.
2021-02-18 13:26:03 -05:00
Reinhard Panhuber 681cfd0bf2 Correct for wrong pointer type in audio_device.c 2021-02-18 11:12:16 +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 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 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 cdf600048f Merge remote-tracking branch 'upstream/master' into edpt_ISO_xfer 2021-02-12 18:05:20 +01:00
hathach ec458292fe fix host build 2021-01-25 13:25:47 +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
Reinhard Panhuber 99e6bc3720 Explicitly add cast to uint32_t before shifting uint8 to left 2021-01-18 17:54:08 +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 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
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
HiFiPhile b3c0d417ef Fix error if "Required Prototype" is selected.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2020-12-20 23:10:34 +01:00
hathach f5e13d5898 msc only invoke scsi complete callback after status transaction is complete 2020-11-24 23:42:30 +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 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 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
Ha Thach a708ab6254
Merge pull request #553 from hathach/host-async-control
Host async control
2020-11-07 10:52:14 +07:00
Jan Dümpelmann af9f0f1cd6 Merge remote-tracking branch 'hathach/master' into cdc_without_dtr 2020-11-04 17:11:01 +01:00
hathach 67ac40b98d house keeping: make tu_print_mem format easier to compare with hex2dump 2020-11-01 13:37:56 +07:00
hathach b5d4c8185d Merge branch 'master' into host-async-control 2020-10-11 16:22:12 +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
hathach 3f54c27afa fix audio_test build 2020-10-07 13:36:03 +07: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 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
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
Reinhard Panhuber 349c0f640e Implementation done, yet to be tested. 2020-09-14 18:24:08 +02: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
Jan Dümpelmann 4071e490e2 New function to modify fifo overwritability 2020-09-03 17:21:32 +02: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
hathach ab75998316 Merge branch 'master' into add-stm-hs 2020-06-30 01:55:57 +07:00
hathach 5ffba8536d able to detect as hs 2020-05-31 19:41:22 +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 1a8ce043ed enable -Wcast-align
suppress vendor sdk driver at board.mk
2020-05-17 14:24:15 +07: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
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
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
hathach e4570c35f7 add uart for ea4357 2020-04-20 00:27:35 +07:00
hathach 593fe154ec
adding subclass & protocol to class driver structure 2020-04-14 18:00:59 +07:00
Nathan Conrad 84a9715958 tu_verify: Change some define functions use do-while statement. 2020-04-02 23:22:48 -04:00
Nathan Conrad 7f6316dbe1 Use CRLF on UART. 2020-03-14 14:26:14 -04:00
Nathan Conrad 25c1bea782 Normalize line endings 2020-01-15 14:47:43 -05:00
majbthrd 6b3eb5f173 fix missing parentheses in TU_MIN and TU_MAX macros (#256) 2019-12-30 23:12:18 +07:00
hathach bbada1d3e6 adding lookup table for debugging
add msc scsi command list
2019-12-23 18:54:06 +07:00
hathach 050fa2fd39
able to response to scsi inquiry, but failed to response to test unit ready 2019-12-21 19:33:41 +07:00
hathach 6bc245cb36 add dcd_edpt0_status_complete() which is useful for several mcu port 2019-11-28 11:46:36 +07:00
hathach 40b454cf28 get passed first get device descriptor 2019-11-27 23:20:48 +07:00
hathach c2fb813658
Merge pull request #217 from xobs/valentyusb-eptri
WIP: Add Valentyusb eptri
2019-11-18 12:37:34 +07:00
Sean Cross 359189ea2d tusb_verify: add riscv assert support
This simply executes an "ebreak" instruction.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-13 09:08:01 -08:00
hathach 838173efc3
remove TEST_FAIL() from TU_ASSERT, since it prevents we testing how stack response with failed assert 2019-11-01 18:27:15 +07:00
hathach 5b68cc91ad
adding TEST_FAIL() for TU_ASSERT() 2019-11-01 17:50:40 +07:00
hathach 78523301bb
Merge pull request #202 from smunaut/dfu-rt
Add support for DFU Runtime class for devices
2019-10-28 22:56:14 +07:00
Sylvain Munaut ec4ecfa817 Add support for DFU Runtime class for devices
This is really just a few descriptors and then answering to the
request from the host to reboot into DFU mode.

That latter part is delegated to the app since this is platform
specific.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-10-28 16:11:08 +01:00
hathach 661515a807 adding debug log function 2019-10-23 21:18:46 +07:00
hathach 90b6b5d137 clean up tusb_verify 2019-10-18 16:38:02 +07:00
hathach 195d0f5a14 adding log support with uart
started with pca10056
2019-10-12 00:02:51 +07:00
Nathan Conrad dfe92542e6 Change inline functions to macros, and make all parameter names uniform. 2019-09-16 11:27:05 -04:00
Nathan Conrad 889c17a442 Merge branch 'master' into TI_compiler_quirks 2019-09-16 09:24:27 -04:00
hathach 88dd83ae5c
Merge pull request #159 from pigrew/assert_documentation
Documentation: assert vs verify.
2019-09-16 11:29:39 +07:00
hathach 9c5ae0369b follow up to suggestion to pr 155 2019-09-16 11:13:17 +07:00
Nathan Conrad 9593463367 Massive copy&paste typo of mine in the 32-bit byte swapping function.... 2019-09-15 15:20:01 -04:00
Nathan Conrad 21ba37aec6 Interpretation of assert vs verify. 2019-09-14 11:25:40 -04:00
Nathan Conrad bb7f581b6d TI compiler quirks, and le byte swapping functions. 2019-09-13 20:28:26 -04:00
hathach ac8c343fef fix #154 forward all endpoint recipeint request to class driver
fix typo
remove magic number 0xff of driver id
2019-09-13 22:16:24 +07:00
Nathan Conrad bc2a65b20b A few bug fixes, remove the unstested device notices, note supported boards in READMEs, and implement PMA
access stride (used on MCU's with 512 byte USB buffers).
2019-09-10 01:03:24 -04:00
Nathan Conrad 75a3f791e3 Remove some type conversion warnings (using GCC pedantic warnings) 2019-09-09 13:35:41 -04:00
Nathan Conrad 96bead4b2a Add dummy arguments to GET_NTH_ARG to make GCC happy (removes pedantic warnings) 2019-09-09 13:24:08 -04:00
hathach 2d041aaa1d clean up 2019-09-01 08:11:22 +07:00
hathach bac75a81fd support LPC51u68 #100 2019-08-31 22:44:08 +07:00
hathach 30de17a830 clean up
- remove TUD_WEBUSB_URL_DESCRIPTOR to avoid flexible array member (C++
forbid in strict mode)
- remove unused TUD_DESC_STRLEN/TUD_DESC_STR_HEADER/TUD_DESC_STR_HEADER
2019-08-01 13:20:00 +07:00
hathach 2c2db31b09 clean up 2019-07-30 20:28:39 +07:00
hathach af3c301ea5 added BOS MS OS 2.0 descriptor to webusb example, it work with windows 2019-07-30 00:34:25 +07:00
hathach 83f7aacbb1 clean up 2019-07-16 18:43:06 +07:00
hathach cb4e6837e9 clean up, rename internal driver control_request_complete to simply control_complete 2019-07-12 22:03:40 +07:00
hathach 164b26ee6b change TUD_HID_INOUT_DESCRIPTOR epout & epin order
clean up, adding template for BOS & BOS platform descriptor
2019-07-12 14:53:11 +07:00
hathach 3b6013e78f clean up 2019-07-12 14:43:01 +07:00
hathach e74aa41552 added tud_descriptor_bos_cb(), add support for BOS get descriptor 2019-07-12 00:12:14 +07:00
hathach 5ebb606ecd add BOS descriptor and device capability constant 2019-07-11 22:35:17 +07:00
hathach 6991b28532 improving midi support, adding midi exmaple
rename TUSB_DESC_CLASS_SPECIFIC to TUSB_DESC_CS_INTERFACE
2019-07-01 22:38:06 +07:00
hathach 13e01c7dca
add TU_ prefix to compiler ATTR to prevent name conflict with application 2019-06-06 10:39:37 +07:00
hathach a0307bafda added usbd_edpt_xfer/usbd_edpt_busy to replace dcd_edpt_transfer/dcd_edpt_busy()
- improve fifo write/read_n with only one lock
- use usbd_edpt_xfer/usbd_edpt_busy for hid/cdc/msc class driver
- replace cdc read's pending_read_from_host by usbd_edpt_busy()
2019-05-29 16:55:15 +07:00
hathach 6e443d1918
enable CFG_TUSB_DEBUG on DEBUG build 2019-05-14 17:36:03 +07:00
hathach 910a94e9ca
clean up 2019-05-14 13:12:16 +07:00
hathach 3e6d911ce9
more clean up use inline bit funciton instead of macros 2019-05-14 12:54:29 +07:00
hathach 81fc7b7e2b
clean up endian convert function 2019-05-14 12:14:51 +07:00
hathach 3e24daac79
remove deprecated tusb_task, clean up tusb compiler 2019-05-14 12:03:06 +07:00
hathach 61ec407752
update license year to 2019 2019-05-14 11:48:05 +07:00
hathach 6135019230
clean up 2019-05-14 11:46:22 +07:00
hathach 1174949308
change tud_descriptor_string_cb() to be consistent with other descriptor callback 2019-05-12 15:38:15 +07:00
hathach de56a0ca89 add tud_descriptor_string_cb() for getting string descriptor from application
- remove tud_desc_set.string_arr/string_count
2019-05-11 16:31:52 +07:00
hathach f9d9eebfe1 support hid generic inout #58
- add report descriptor template TUD_HID_REPORT_DESC_GENERIC_INOUT
- add TUD_HID_INOUT_DESCRIPTOR & TUD_HID_INOUT_DESC_LEN
- add hid_generic_inout example
2019-05-02 14:30:49 +07:00