nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches
audio_usb.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
16#ifndef _AUDIO_USB_H_
17#define _AUDIO_USB_H_
18
19#include <zephyr/kernel.h>
20#include <zephyr/usb/usbd.h>
21
22#if (CONFIG_AUDIO_SOURCE_USB && !CONFIG_AUDIO_SAMPLE_RATE_48000_HZ && \
23 MAX(CONFIG_AUDIO_INPUT_CHANNELS, CONFIG_AUDIO_OUTPUT_CHANNELS) != 2)
24/* Only 48kHz stereo is supported when using USB */
25#error USB only supports 48kHz stereo
26#endif /* (CONFIG_AUDIO_SOURCE_USB && !CONFIG_AUDIO_SAMPLE_RATE_48000_HZ) */
27
28#define USB_BLOCK_SIZE_MULTI_CHAN \
29 (((CONFIG_AUDIO_SAMPLE_RATE_HZ * CONFIG_AUDIO_BIT_DEPTH_OCTETS) / 1000) * \
30 MAX(CONFIG_AUDIO_INPUT_CHANNELS, CONFIG_AUDIO_OUTPUT_CHANNELS))
31
32struct usbd_context *audio_usbd_init_device(usbd_msg_cb_t msg_cb);
33
42int audio_usb_start(struct k_msgq *queue_tx_in, struct k_msgq *queue_rx_in);
43
50void audio_usb_stop(void);
51
58
69int audio_usb_init(bool host_in, bool host_out);
70
75#endif /* _AUDIO_USB_H_ */
int audio_usb_start(struct k_msgq *queue_tx_in, struct k_msgq *queue_rx_in)
Set pointers to the queues to be used by the USB module and start sending/receiving data.
int audio_usb_disable(void)
Stop and disable USB device.
int audio_usb_init(bool host_in, bool host_out)
Register and enable USB device.
void audio_usb_stop(void)
Stop sending/receiving data.
struct usbd_context * audio_usbd_init_device(usbd_msg_cb_t msg_cb)