Remove n from tu_fifo_get_write_info() and fix bug in vendor class
This commit is contained in:
@@ -654,15 +654,17 @@ static bool audiod_decode_type_I_pcm(uint8_t rhport, audiod_function_t* audio, u
|
||||
|
||||
for (cnt_ff = 0; cnt_ff < n_ff_used; cnt_ff++)
|
||||
{
|
||||
tu_fifo_get_write_info(&audio->rx_supp_ff[cnt_ff], &info, nBytesPerFFToRead);
|
||||
tu_fifo_get_write_info(&audio->rx_supp_ff[cnt_ff], &info);
|
||||
|
||||
if (info.len_lin != 0)
|
||||
{
|
||||
info.len_lin = tu_min16(nBytesPerFFToRead, info.len_lin);
|
||||
src = &audio->lin_buf_out[cnt_ff*audio->n_channels_per_ff_rx * audio->n_bytes_per_sampe_rx];
|
||||
dst_end = info.ptr_lin + info.len_lin;
|
||||
src = audiod_interleaved_copy_bytes_fast_decode(nBytesToCopy, info.ptr_lin, dst_end, src, n_ff_used);
|
||||
|
||||
// Handle wrapped part of FIFO
|
||||
info.len_wrap = tu_min16(nBytesPerFFToRead - info.len_lin, info.len_wrap);
|
||||
if (info.len_wrap != 0)
|
||||
{
|
||||
dst_end = info.ptr_wrap + info.len_wrap;
|
||||
@@ -987,11 +989,9 @@ static uint16_t audiod_encode_type_I_pcm(uint8_t rhport, audiod_function_t* audi
|
||||
|
||||
tu_fifo_get_read_info(&audio->tx_supp_ff[cnt_ff], &info);
|
||||
|
||||
// Limit up to desired length
|
||||
info.len_lin = tu_min16(nBytesPerFFToSend, info.len_lin);
|
||||
|
||||
if (info.len_lin != 0)
|
||||
{
|
||||
info.len_lin = tu_min16(nBytesPerFFToSend, info.len_lin); // Limit up to desired length
|
||||
src_end = info.ptr_lin + info.len_lin;
|
||||
dst = audiod_interleaved_copy_bytes_fast_encode(nBytesToCopy, info.ptr_lin, src_end, dst, n_ff_used);
|
||||
|
||||
|
||||
6
src/class/vendor/vendor_device.h
vendored
6
src/class/vendor/vendor_device.h
vendored
@@ -59,7 +59,7 @@ uint32_t tud_vendor_n_write_str (uint8_t itf, char const* str);
|
||||
static inline bool tud_vendor_mounted (void);
|
||||
static inline uint32_t tud_vendor_available (void);
|
||||
static inline uint32_t tud_vendor_read (void* buffer, uint32_t bufsize);
|
||||
static inline bool tud_vendor_peek (int pos, uint8_t* u8);
|
||||
static inline bool tud_vendor_peek (uint8_t* u8);
|
||||
static inline uint32_t tud_vendor_write (void const* buffer, uint32_t bufsize);
|
||||
static inline uint32_t tud_vendor_write_str (char const* str);
|
||||
static inline uint32_t tud_vendor_write_available (void);
|
||||
@@ -95,9 +95,9 @@ static inline uint32_t tud_vendor_read (void* buffer, uint32_t bufsize)
|
||||
return tud_vendor_n_read(0, buffer, bufsize);
|
||||
}
|
||||
|
||||
static inline bool tud_vendor_peek (int pos, uint8_t* u8)
|
||||
static inline bool tud_vendor_peek (uint8_t* u8)
|
||||
{
|
||||
return tud_vendor_n_peek(0, pos, u8);
|
||||
return tud_vendor_n_peek(0, u8);
|
||||
}
|
||||
|
||||
static inline uint32_t tud_vendor_write (void const* buffer, uint32_t bufsize)
|
||||
|
||||
Reference in New Issue
Block a user