summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorReinhard Panhuber <[email protected]>2021-02-12 18:04:45 +0100
committerReinhard Panhuber <[email protected]>2021-02-12 18:04:45 +0100
commit185414721ff549058a199ade40966015e6260996 (patch)
treebac4cacffe92f67dce99b7d019136140bb63bb27 /src/class
parenta9fd0a454a96c599cb42f741c2e3e893b6c7306c (diff)
Formating
Diffstat (limited to 'src/class')
-rw-r--r--src/class/audio/audio.h10
-rw-r--r--src/class/audio/audio_device.c108
-rw-r--r--src/class/audio/audio_device.h2
3 files changed, 60 insertions, 60 deletions
diff --git a/src/class/audio/audio.h b/src/class/audio/audio.h
index 05e61f8df..af0e86e21 100644
--- a/src/class/audio/audio.h
+++ b/src/class/audio/audio.h
@@ -901,7 +901,7 @@ typedef struct TU_ATTR_PACKED {
} subrange[numSubRanges] ; \
}
- /// 5.2.3.2 2-byte Control RANGE Parameter Block
+/// 5.2.3.2 2-byte Control RANGE Parameter Block
#define audio_control_range_2_n_t(numSubRanges) \
struct TU_ATTR_PACKED { \
uint16_t wNumSubRanges; \
@@ -912,7 +912,7 @@ typedef struct TU_ATTR_PACKED {
} subrange[numSubRanges]; \
}
- // 5.2.3.3 4-byte Control RANGE Parameter Block
+// 5.2.3.3 4-byte Control RANGE Parameter Block
#define audio_control_range_4_n_t(numSubRanges) \
struct TU_ATTR_PACKED { \
uint16_t wNumSubRanges; \
@@ -923,12 +923,12 @@ typedef struct TU_ATTR_PACKED {
} subrange[numSubRanges]; \
}
- /** @} */
+/** @} */
#ifdef __cplusplus
- }
+}
#endif
#endif
- /** @} */
+/** @} */
diff --git a/src/class/audio/audio_device.c b/src/class/audio/audio_device.c
index d1666056f..622e6d113 100644
--- a/src/class/audio/audio_device.c
+++ b/src/class/audio/audio_device.c
@@ -240,21 +240,21 @@ uint16_t tud_audio_n_read_support_ff(uint8_t itf, uint8_t channelId, void* buffe
static bool audiod_rx_done_cb(uint8_t rhport, audiod_interface_t* audio)
{
- uint8_t idxDriver, idxItf;
- uint8_t const *dummy2;
+ uint8_t idxDriver, idxItf;
+ uint8_t const *dummy2;
- // If a callback is used determine current alternate setting of
- if (tud_audio_rx_done_pre_read_cb || tud_audio_rx_done_post_read_cb)
- {
- // Find index of audio streaming interface and index of interface
- TU_VERIFY(audiod_get_AS_interface_index(audio->ep_out_as_intf_num, &idxDriver, &idxItf, &dummy2));
- }
+ // If a callback is used determine current alternate setting of
+ if (tud_audio_rx_done_pre_read_cb || tud_audio_rx_done_post_read_cb)
+ {
+ // Find index of audio streaming interface and index of interface
+ TU_VERIFY(audiod_get_AS_interface_index(audio->ep_out_as_intf_num, &idxDriver, &idxItf, &dummy2));
+ }
- // Get number of bytes in EP OUT SW FIFO
- uint16_t n_bytes_received = tu_fifo_count(&audio->ep_out_ff);
+ // Get number of bytes in EP OUT SW FIFO
+ uint16_t n_bytes_received = tu_fifo_count(&audio->ep_out_ff);
- // Call a weak callback here - a possibility for user to get informed an audio packet was received and data gets now decoded into support RX software FIFO
- if (tud_audio_rx_done_pre_read_cb) TU_VERIFY(tud_audio_rx_done_pre_read_cb(rhport, n_bytes_received, idxDriver, audio->ep_out, audio->altSetting[idxItf]));
+ // Call a weak callback here - a possibility for user to get informed an audio packet was received and data gets now decoded into support RX software FIFO
+ if (tud_audio_rx_done_pre_read_cb) TU_VERIFY(tud_audio_rx_done_pre_read_cb(rhport, n_bytes_received, idxDriver, audio->ep_out, audio->altSetting[idxItf]));
#if CFG_TUD_AUDIO_RX_SUPPORT_SW_FIFO_SIZE
@@ -316,23 +316,23 @@ static bool audiod_decode_type_I_pcm(uint8_t rhport, audiod_interface_t* audio)
while (cnt <= n_bytes)
{
- for (uint8_t cntChannel = 0; cntChannel < CFG_TUD_AUDIO_N_CHANNELS_RX; cntChannel++)
- {
- // If 8, 16, or 32 bit values are to be copied
+ for (uint8_t cntChannel = 0; cntChannel < CFG_TUD_AUDIO_N_CHANNELS_RX; cntChannel++)
+ {
+ // If 8, 16, or 32 bit values are to be copied
#if CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX == CFG_TUD_AUDIO_RX_ITEMSIZE
- // If this aborts then the target buffer is full
- TU_VERIFY(tu_fifo_read_n_into_other_fifo(&audio->ep_out_ff, &audio->rx_ff[cntChannel], 0, CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX));
+ // If this aborts then the target buffer is full
+ TU_VERIFY(tu_fifo_read_n_into_other_fifo(&audio->ep_out_ff, &audio->rx_ff[cntChannel], 0, CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX));
#else
- // TODO: Implement a left and right justified 24 to 32 and vice versa copy process from FIFO to FIFO
- uint32_t sample = 0;
+ // TODO: Implement a left and right justified 24 to 32 and vice versa copy process from FIFO to FIFO
+ uint32_t sample = 0;
- // Get sample from buffer
- TU_VERIFY(tu_fifo_read_n(&audio->ep_out_ff, &sample, CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX));
- TU_VERIFY(tu_fifo_write_n(&audio->rx_ff[cntChannel], &sample, CFG_TUD_AUDIO_RX_ITEMSIZE));
+ // Get sample from buffer
+ TU_VERIFY(tu_fifo_read_n(&audio->ep_out_ff, &sample, CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX));
+ TU_VERIFY(tu_fifo_write_n(&audio->rx_ff[cntChannel], &sample, CFG_TUD_AUDIO_RX_ITEMSIZE));
#endif
- }
+ }
- cnt += CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX * CFG_TUD_AUDIO_N_CHANNELS_RX;
+ cnt += CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX * CFG_TUD_AUDIO_N_CHANNELS_RX;
}
// Number of bytes should be a multiple of CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX * CFG_TUD_AUDIO_N_CHANNELS_RX but checking makes no sense - no way to correct it
@@ -389,8 +389,8 @@ uint16_t tud_audio_n_flush_tx_support_ff(uint8_t itf) // Force a
bool tud_audio_n_clear_tx_support_ff(uint8_t itf, uint8_t channelId)
{
- TU_VERIFY(itf < CFG_TUD_AUDIO && _audiod_itf[itf].p_desc != NULL, channelId < CFG_TUD_AUDIO_N_CHANNELS_TX);
- return tu_fifo_clear(&_audiod_itf[itf].tx_ff[channelId]);
+ TU_VERIFY(itf < CFG_TUD_AUDIO && _audiod_itf[itf].p_desc != NULL, channelId < CFG_TUD_AUDIO_N_CHANNELS_TX);
+ return tu_fifo_clear(&_audiod_itf[itf].tx_ff[channelId]);
}
uint16_t tud_audio_n_write_support_ff(uint8_t itf, uint8_t channelId, const void * data, uint16_t len)
@@ -574,15 +574,15 @@ void audiod_init(void)
#if CFG_TUD_AUDIO_EP_IN_SW_BUFFER_SIZE
tu_fifo_config(&audio->ep_in_ff, &audio->ep_in_buf, CFG_TUD_AUDIO_EP_IN_SW_BUFFER_SIZE, 1, true);
#if CFG_FIFO_MUTEX
- tu_fifo_config_mutex(&audio->ep_in_ff, osal_mutex_create(&audio->ep_in_ff_mutex));
+ tu_fifo_config_mutex(&audio->ep_in_ff, osal_mutex_create(&audio->ep_in_ff_mutex));
#endif
#endif
// Initialize OUT EP FIFO if required
#if CFG_TUD_AUDIO_EP_OUT_SW_BUFFER_SIZE
- tu_fifo_config(&audio->ep_out_ff, &audio->ep_out_buf, CFG_TUD_AUDIO_EP_OUT_SW_BUFFER_SIZE, 1, true);
+ tu_fifo_config(&audio->ep_out_ff, &audio->ep_out_buf, CFG_TUD_AUDIO_EP_OUT_SW_BUFFER_SIZE, 1, true);
#if CFG_FIFO_MUTEX
- tu_fifo_config_mutex(&audio->ep_out_ff, osal_mutex_create(&audio->ep_out_ff_mutex));
+ tu_fifo_config_mutex(&audio->ep_out_ff, osal_mutex_create(&audio->ep_out_ff_mutex));
#endif
#endif
@@ -1105,8 +1105,8 @@ bool audiod_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint3
if (_audiod_itf[idxDriver].ep_out == ep_addr)
{
// Save into buffer - do whatever has to be done
-// TU_VERIFY(audiod_rx_done_cb(rhport, &_audiod_itf[idxDriver], _audiod_itf[idxDriver].ep_out_buf, xferred_bytes));
- TU_VERIFY(audiod_rx_done_cb(rhport, &_audiod_itf[idxDriver]));
+ // TU_VERIFY(audiod_rx_done_cb(rhport, &_audiod_itf[idxDriver], _audiod_itf[idxDriver].ep_out_buf, xferred_bytes));
+ TU_VERIFY(audiod_rx_done_cb(rhport, &_audiod_itf[idxDriver]));
return true;
}
@@ -1305,33 +1305,33 @@ static bool audiod_verify_ep_exists(uint8_t ep, uint8_t *idxDriver)
// Input value feedback has to be in 16.16 format - the format will be converted according to speed settings automatically
bool tud_audio_n_fb_set(uint8_t itf, uint32_t feedback)
{
- TU_VERIFY(itf < CFG_TUD_AUDIO && _audiod_itf[itf].p_desc != NULL);
+ TU_VERIFY(itf < CFG_TUD_AUDIO && _audiod_itf[itf].p_desc != NULL);
- // Format the feedback value
- if (_audiod_itf[itf].rhport == 0)
- {
- uint8_t * fb = (uint8_t *) &_audiod_itf[itf].fb_val;
+ // Format the feedback value
+ if (_audiod_itf[itf].rhport == 0)
+ {
+ uint8_t * fb = (uint8_t *) &_audiod_itf[itf].fb_val;
- // For FS format is 10.14
- *(fb++) = (feedback >> 2) & 0xFF;
- *(fb++) = (feedback >> 10) & 0xFF;
- *(fb++) = (feedback >> 18) & 0xFF;
- // 4th byte is needed to work correctly with MS Windows
- *fb = 0;
- }
- else
- {
- // For HS format is 16.16 as originally demanded
- _audiod_itf[itf].fb_val = feedback;
- }
+ // For FS format is 10.14
+ *(fb++) = (feedback >> 2) & 0xFF;
+ *(fb++) = (feedback >> 10) & 0xFF;
+ *(fb++) = (feedback >> 18) & 0xFF;
+ // 4th byte is needed to work correctly with MS Windows
+ *fb = 0;
+ }
+ else
+ {
+ // For HS format is 16.16 as originally demanded
+ _audiod_itf[itf].fb_val = feedback;
+ }
- // Schedule a transmit with the new value if EP is not busy - this triggers repetitive scheduling of the feedback value
- if (!usbd_edpt_busy(_audiod_itf[itf].rhport, _audiod_itf[itf].ep_fb))
- {
- return audiod_fb_send(_audiod_itf[itf].rhport, &_audiod_itf[itf]);
- }
+ // Schedule a transmit with the new value if EP is not busy - this triggers repetitive scheduling of the feedback value
+ if (!usbd_edpt_busy(_audiod_itf[itf].rhport, _audiod_itf[itf].ep_fb))
+ {
+ return audiod_fb_send(_audiod_itf[itf].rhport, &_audiod_itf[itf]);
+ }
- return true;
+ return true;
}
#endif
diff --git a/src/class/audio/audio_device.h b/src/class/audio/audio_device.h
index 6e0b3308e..34ba5bb55 100644
--- a/src/class/audio/audio_device.h
+++ b/src/class/audio/audio_device.h
@@ -447,7 +447,7 @@ static inline uint16_t tud_audio_int_ctr_write(uint8_t const* buffer, uint16_t l
#if CFG_TUD_AUDIO_EP_OUT_SW_BUFFER_SIZE && CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP
static inline bool tud_audio_fb_set(uint32_t feedback)
{
- return tud_audio_n_fb_set(0, feedback);
+ return tud_audio_n_fb_set(0, feedback);
}
#endif