Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/tinyusb
Submodule tinyusb updated 1534 files
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ CIRCUITPY_WIFI = 1

CIRCUITPY_PICODVI = 1

# No room: this board fills FLASH_FIRMWARE. Frees ~9kB. Not the board's I2S
# line-out/HDMI audio, which audiobusio still provides.
CIRCUITPY_USB_AUDIO = 0

CFLAGS += \
-DCYW43_PIN_WL_DYNAMIC=0 \
-DCYW43_DEFAULT_PIN_WL_HOST_WAKE=24 \
Expand Down
1 change: 1 addition & 0 deletions ports/stm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ endif
ifneq ($(CIRCUITPY_USB),0)
ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32L433xx))
SRC_C += lib/tinyusb/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
SRC_C += lib/tinyusb/src/portable/st/stm32_fsdev/fsdev_common.c
else
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c
Expand Down
2 changes: 2 additions & 0 deletions shared-module/usb/core/Device.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ static bool _wait_for_callback(void) {
switch (result) {
case XFER_RESULT_SUCCESS:
return true;
case XFER_RESULT_ABORTED:
case XFER_RESULT_FAILED:
mp_raise_usb_core_USBError(NULL);
break;
Expand Down Expand Up @@ -201,6 +202,7 @@ static size_t _handle_timed_transfer_callback(tuh_xfer_t *xfer, mp_int_t timeout
switch (result) {
case XFER_RESULT_SUCCESS:
return _actual_len;
case XFER_RESULT_ABORTED:
case XFER_RESULT_FAILED:
mp_raise_usb_core_USBError(NULL);
break;
Expand Down
122 changes: 61 additions & 61 deletions shared-module/usb_audio/__init__.c

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions shared-module/usb_audio/usb_audio_descriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ size_t usb_audio_descriptor_length(void);
#define USB_AUDIO_ISO_EP_NUM (0)
#endif

// Fixed UAC2 entity IDs baked into TUD_AUDIO_MIC_ONE_CH_DESCRIPTOR and the
// Fixed UAC2 entity IDs baked into TUD_AUDIO20_MIC_ONE_CH_DESCRIPTOR and the
// hand-rolled speaker descriptor (USB_AUDIO_SPEAKER_DESCRIPTOR in __init__.c).
// The speaker reuses the same IDs as the mic; only the terminal roles reverse
// (input terminal = USB streaming, output terminal = desktop speaker).
Expand All @@ -69,26 +69,26 @@ size_t usb_audio_descriptor_length(void);
#define USB_AUDIO_HS_ENTITY_MIC_OUTPUT_TERMINAL (0x07) // USB streaming out to host

// Length of the no-feedback mono speaker descriptor. It uses the same set of
// sub-descriptors as TUD_AUDIO_MIC_ONE_CH_DESCRIPTOR (one isochronous data
// sub-descriptors as TUD_AUDIO20_MIC_ONE_CH_DESCRIPTOR (one isochronous data
// endpoint, no feedback endpoint), so this is identical to
// TUD_AUDIO_MIC_ONE_CH_DESC_LEN -- but spell it out independently so the two
// TUD_AUDIO20_MIC_ONE_CH_DESC_LEN -- but spell it out independently so the two
// can diverge later (e.g. stereo) without silently mis-sizing the descriptor.
// These TUD_AUDIO_DESC_*_LEN macros come from TinyUSB's usbd.h; this expression
// These TUD_AUDIO20_DESC_*_LEN macros come from TinyUSB's usbd.h; this expression
// is only expanded where that header is already included (never at the point
// tusb_config.h includes us), so the header stays dependency-free.
#define USB_AUDIO_SPEAKER_DESC_LEN (TUD_AUDIO_DESC_IAD_LEN \
+ TUD_AUDIO_DESC_STD_AC_LEN \
+ TUD_AUDIO_DESC_CS_AC_LEN \
+ TUD_AUDIO_DESC_CLK_SRC_LEN \
+ TUD_AUDIO_DESC_INPUT_TERM_LEN \
+ TUD_AUDIO_DESC_OUTPUT_TERM_LEN \
+ TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL_LEN \
+ TUD_AUDIO_DESC_STD_AS_INT_LEN \
+ TUD_AUDIO_DESC_STD_AS_INT_LEN \
+ TUD_AUDIO_DESC_CS_AS_INT_LEN \
+ TUD_AUDIO_DESC_TYPE_I_FORMAT_LEN \
+ TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN \
+ TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN)
#define USB_AUDIO_SPEAKER_DESC_LEN (TUD_AUDIO20_DESC_IAD_LEN \
+ TUD_AUDIO20_DESC_STD_AC_LEN \
+ TUD_AUDIO20_DESC_CS_AC_LEN \
+ TUD_AUDIO20_DESC_CLK_SRC_LEN \
+ TUD_AUDIO20_DESC_INPUT_TERM_LEN \
+ TUD_AUDIO20_DESC_OUTPUT_TERM_LEN \
+ TUD_AUDIO20_DESC_FEATURE_UNIT_LEN(1) \
+ TUD_AUDIO20_DESC_STD_AS_LEN \
+ TUD_AUDIO20_DESC_STD_AS_LEN \
+ TUD_AUDIO20_DESC_CS_AS_INT_LEN \
+ TUD_AUDIO20_DESC_TYPE_I_FORMAT_LEN \
+ TUD_AUDIO20_DESC_STD_AS_ISO_EP_LEN \
+ TUD_AUDIO20_DESC_CS_AS_ISO_EP_LEN)

// Length of the combined headset descriptor (microphone + speaker both enabled): one IAD
// wrapping a single AudioControl interface plus two AudioStreaming interfaces
Expand All @@ -99,29 +99,29 @@ size_t usb_audio_descriptor_length(void);
// single-direction descriptors). See USB_AUDIO_HEADSET_DESCRIPTOR in __init__.c.
// Expanded only where TinyUSB's usbd.h is already included (never at the point
// tusb_config.h includes us), so this header stays dependency-free.
#define USB_AUDIO_HEADSET_DESC_LEN (TUD_AUDIO_DESC_IAD_LEN \
+ TUD_AUDIO_DESC_STD_AC_LEN \
+ TUD_AUDIO_DESC_CS_AC_LEN \
+ TUD_AUDIO_DESC_CLK_SRC_LEN \
#define USB_AUDIO_HEADSET_DESC_LEN (TUD_AUDIO20_DESC_IAD_LEN \
+ TUD_AUDIO20_DESC_STD_AC_LEN \
+ TUD_AUDIO20_DESC_CS_AC_LEN \
+ TUD_AUDIO20_DESC_CLK_SRC_LEN \
/* speaker chain: USB-streaming input terminal -> feature unit -> speaker */ \
+ TUD_AUDIO_DESC_INPUT_TERM_LEN \
+ TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL_LEN \
+ TUD_AUDIO_DESC_OUTPUT_TERM_LEN \
+ TUD_AUDIO20_DESC_INPUT_TERM_LEN \
+ TUD_AUDIO20_DESC_FEATURE_UNIT_LEN(1) \
+ TUD_AUDIO20_DESC_OUTPUT_TERM_LEN \
/* mic chain: microphone input terminal -> feature unit -> USB-streaming out */ \
+ TUD_AUDIO_DESC_INPUT_TERM_LEN \
+ TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL_LEN \
+ TUD_AUDIO_DESC_OUTPUT_TERM_LEN \
+ TUD_AUDIO20_DESC_INPUT_TERM_LEN \
+ TUD_AUDIO20_DESC_FEATURE_UNIT_LEN(1) \
+ TUD_AUDIO20_DESC_OUTPUT_TERM_LEN \
/* speaker AudioStreaming interface (alt 0 + alt 1 with OUT endpoint) */ \
+ TUD_AUDIO_DESC_STD_AS_INT_LEN \
+ TUD_AUDIO_DESC_STD_AS_INT_LEN \
+ TUD_AUDIO_DESC_CS_AS_INT_LEN \
+ TUD_AUDIO_DESC_TYPE_I_FORMAT_LEN \
+ TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN \
+ TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN \
+ TUD_AUDIO20_DESC_STD_AS_LEN \
+ TUD_AUDIO20_DESC_STD_AS_LEN \
+ TUD_AUDIO20_DESC_CS_AS_INT_LEN \
+ TUD_AUDIO20_DESC_TYPE_I_FORMAT_LEN \
+ TUD_AUDIO20_DESC_STD_AS_ISO_EP_LEN \
+ TUD_AUDIO20_DESC_CS_AS_ISO_EP_LEN \
/* mic AudioStreaming interface (alt 0 + alt 1 with IN endpoint) */ \
+ TUD_AUDIO_DESC_STD_AS_INT_LEN \
+ TUD_AUDIO_DESC_STD_AS_INT_LEN \
+ TUD_AUDIO_DESC_CS_AS_INT_LEN \
+ TUD_AUDIO_DESC_TYPE_I_FORMAT_LEN \
+ TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN \
+ TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN)
+ TUD_AUDIO20_DESC_STD_AS_LEN \
+ TUD_AUDIO20_DESC_STD_AS_LEN \
+ TUD_AUDIO20_DESC_CS_AS_INT_LEN \
+ TUD_AUDIO20_DESC_TYPE_I_FORMAT_LEN \
+ TUD_AUDIO20_DESC_STD_AS_ISO_EP_LEN \
+ TUD_AUDIO20_DESC_CS_AS_ISO_EP_LEN)
4 changes: 2 additions & 2 deletions supervisor/shared/usb/tusb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ extern "C" {
#define CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX USB_AUDIO_N_BYTES_PER_SAMPLE
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX USB_AUDIO_N_CHANNELS
// wMaxPacketSize, sized for the highest supported sample rate.
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX TUD_AUDIO_EP_SIZE(USB_AUDIO_MAX_SAMPLE_RATE, USB_AUDIO_N_BYTES_PER_SAMPLE, USB_AUDIO_N_CHANNELS)
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX TUD_AUDIO_EP_SIZE(TUD_OPT_HIGH_SPEED, USB_AUDIO_MAX_SAMPLE_RATE, USB_AUDIO_N_BYTES_PER_SAMPLE, USB_AUDIO_N_CHANNELS)
// Deep software FIFO so the 1 ms refill keeps clear of the underrun floor.
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ (16 * CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX)

Expand All @@ -156,7 +156,7 @@ extern "C" {
#define CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_RX USB_AUDIO_N_BYTES_PER_SAMPLE
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_RX USB_AUDIO_N_CHANNELS
// wMaxPacketSize, sized for the highest supported sample rate.
#define CFG_TUD_AUDIO_FUNC_1_EP_OUT_SZ_MAX TUD_AUDIO_EP_SIZE(USB_AUDIO_MAX_SAMPLE_RATE, USB_AUDIO_N_BYTES_PER_SAMPLE, USB_AUDIO_N_CHANNELS)
#define CFG_TUD_AUDIO_FUNC_1_EP_OUT_SZ_MAX TUD_AUDIO_EP_SIZE(TUD_OPT_HIGH_SPEED, USB_AUDIO_MAX_SAMPLE_RATE, USB_AUDIO_N_BYTES_PER_SAMPLE, USB_AUDIO_N_CHANNELS)
// Deep software FIFO so the 1 ms drain keeps clear of the overrun ceiling.
#define CFG_TUD_AUDIO_FUNC_1_EP_OUT_SW_BUF_SZ (16 * CFG_TUD_AUDIO_FUNC_1_EP_OUT_SZ_MAX)
#endif
Expand Down
2 changes: 1 addition & 1 deletion supervisor/shared/usb/usb_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
// size. Setting CFG_TUD_CDC_RX_BUFSIZE to the endpoint size and then sending
// any character will prevent ctrl-c from working. Require at least a 64
// character buffer.
#if CFG_TUD_CDC_RX_BUFSIZE < CFG_TUD_CDC_EP_BUFSIZE + 64
#if CFG_TUD_CDC_RX_BUFSIZE < CFG_TUD_CDC_RX_EPSIZE + 64
#error "CFG_TUD_CDC_RX_BUFSIZE must be 64 bytes bigger than endpoint size."
#endif

Expand Down
1 change: 0 additions & 1 deletion supervisor/supervisor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ ifeq ($(CIRCUITPY_TINYUSB),1)
SRC_SUPERVISOR += \
lib/tinyusb/src/class/cdc/cdc_device.c \
lib/tinyusb/src/device/usbd.c \
lib/tinyusb/src/device/usbd_control.c \
supervisor/shared/usb/usb_desc.c \
supervisor/shared/usb/usb_device.c \

Expand Down
Loading