Commit Graph

30 Commits

Author SHA1 Message Date
Reinhard Panhuber a9fd0a454a Complete redesign of audio driver. 2021-02-12 16:28:41 +01:00
Reinhard Panhuber 84406f1654 Rework audio driver 2021-01-31 19:08:23 +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 3a3ada0c57 Implement the usage of usbd_edpt_ISO_xfer() 2021-01-18 17:07:15 +01:00
hathach cebb375eac migrate audio device to new control xfer cb 2020-11-20 17:20:05 +07: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 3f54c27afa fix audio_test build 2020-10-07 13:36:03 +07:00
Reinhard Panhuber 529622710c Cleanup for PR. 2020-09-28 18:10:57 +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 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
Reinhard Panhuber 4e789b240d Start of sampling works. 2020-09-06 11:37:59 +02: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
Reinhard Panhuber 8f0693346c Allow epin_buf to be written directly into in case no TX FIFOs are used.
This is helpful if you have already encoded audio data and want an
efficient way to send it. However, this approach is NOT THREADSAFE so
far and works realiably ONLY IF tud_audio_n_write_ep_in_buffer() is NOT
called form an interrupt!
2020-09-01 11:26:16 +02:00
Reinhard Panhuber b9c9cfdbac Change min to tu_min16. 2020-08-29 13:22:21 +02:00
Jerzy Kasenberg a3eff0c51a audio_device: Fix NULL pointer access in audiod_xfer_cb
b_bytes_copied was pointer with NULL value instead of
plain variable.
NULL pointer was passed to audio_tx_done_cb() and dereference
as well.

Now variable is not a pointer.
2020-08-25 14:35:05 +02:00
Jerzy Kasenberg a4c096be37 audio_device: Fix FIFO element size discrepancies
Buffer for TX and RX FIFO was not taking into account
size of element leading to out of bound access.

audio_tx_done_type_I_pcm_ff_cb() reported copied bytes was not returning
correct value number if channels was omitted in computation.

Transfer size calculation uses simpler arithmetic.
2020-08-25 14:35:05 +02:00
Jerzy Kasenberg c61e9fb96d audio_device: Fix descriptor limit calculation
In several place p_desc_end calculation was not taking into account
that starting pointer (_audiod_itf[idxDriver].p_desc) was pointing
past interface association descriptor.
It would result in accessing random memory.
2020-08-24 09:04:42 +02:00
Reinhard Panhuber 37be0ca732 Fix formatting, get rid of all tabs. 2020-08-20 20:09:44 +02: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 444e4d2821 Add EP close. Fix bug in set_interface within audio. 2020-08-16 13:48:25 +02:00
Reinhard Panhuber 1269bb440a Fix structure definition audio_control_range_X_n_t 2020-07-25 14:31:25 +02:00
Reinhard Panhuber d91843bcd2 Get and set requests work 2020-07-25 11:18:50 +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
Reinhard Panhuber d0f3d03933 Intermediate commit. 2020-07-17 08:40:10 +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 9be2f1bf3d Add basic UAC2 structure - untested 2020-05-22 12:09:34 +02:00