mirror of
https://github.com/hathach/tinyusb.git
synced 2026-08-18 02:53:35 +00:00
misc fixes
This commit is contained in:
@ -33,3 +33,14 @@ Reference: `CH32V30X Reference Manual`_ USBFS/USBHS controller chapter
|
||||
Data corruption may occur on isochronous endpoints. Due to the lacking of FIFO for interrupt status registers, later completed transfer will overwrite `INT_ST` and `RX_LEN` register if previous transfer processing is not completed.
|
||||
|
||||
Other types of transfers are not affected.
|
||||
|
||||
Puya PY32F071/072
|
||||
---------------------------------
|
||||
**Severity: Very Low**
|
||||
|
||||
Reference: `PY32F07x Reference Manual` USBD chapter
|
||||
|
||||
The USB device controller (MUSB-like) has 5 application endpoints EP1-EP5 with fixed FIFO sizes
|
||||
shared between IN and OUT of the same endpoint number: EP1 = 512 B, EP2-4 = 128 B, EP5 = 64 B.
|
||||
This is much lower than the max ISO ep size of 1024 for high EP numbers.
|
||||
Place large isochronous endpoints on EP1 and size descriptors accordingly.
|
||||
|
||||
@ -109,8 +109,10 @@ extern "C" {
|
||||
#define CFG_TUD_AUDIO_FUNC_1_N_FORMATS 2
|
||||
|
||||
// Audio format type I specifications
|
||||
#if defined(__RX__)
|
||||
#define CFG_TUD_AUDIO_FUNC_1_MAX_SAMPLE_RATE 48000 // 16bit/48kHz is the best quality for Renesas RX
|
||||
#if defined(__RX__) || (CFG_TUSB_MCU == OPT_MCU_PY32F0)
|
||||
// RX : 16bit/48kHz is the best quality for Renesas RX
|
||||
// PY32F0 : 48kHz/16bit keeps ISO packets <= 98 B so both directions fit the fixed EP FIFOs (EP1 512 B, EP2 128 B)
|
||||
#define CFG_TUD_AUDIO_FUNC_1_MAX_SAMPLE_RATE 48000
|
||||
#else
|
||||
#define CFG_TUD_AUDIO_FUNC_1_MAX_SAMPLE_RATE 96000 // 24bit/96kHz is the best quality for full-speed, high-speed is needed beyond this
|
||||
#endif
|
||||
@ -123,7 +125,7 @@ extern "C" {
|
||||
#define CFG_TUD_AUDIO_FUNC_1_FORMAT_1_N_BYTES_PER_SAMPLE_RX 2
|
||||
#define CFG_TUD_AUDIO_FUNC_1_FORMAT_1_RESOLUTION_RX 16
|
||||
|
||||
#if defined(__RX__)
|
||||
#if defined(__RX__) || (CFG_TUSB_MCU == OPT_MCU_PY32F0)
|
||||
// 8bit in 8bit slots
|
||||
#define CFG_TUD_AUDIO_FUNC_1_FORMAT_2_N_BYTES_PER_SAMPLE_TX 1
|
||||
#define CFG_TUD_AUDIO_FUNC_1_FORMAT_2_RESOLUTION_TX 8
|
||||
|
||||
@ -98,6 +98,11 @@ uint8_t const * tud_descriptor_device_cb(void)
|
||||
#define EPNUM_AUDIO_OUT 0x0A
|
||||
#define EPNUM_AUDIO_IN 0x0B
|
||||
#define EPNUM_AUDIO_INT 0x01
|
||||
#elif TU_CHECK_MCU(OPT_MCU_PY32F0)
|
||||
// Speaker OUT (196 B) only fits EP1 (512 B FIFO); mic IN (98 B) fits EP2 (128 B)
|
||||
#define EPNUM_AUDIO_OUT 0x01
|
||||
#define EPNUM_AUDIO_IN 0x02
|
||||
#define EPNUM_AUDIO_INT 0x03
|
||||
#else
|
||||
#define EPNUM_AUDIO_IN 0x01
|
||||
#define EPNUM_AUDIO_OUT 0x02
|
||||
|
||||
@ -5,6 +5,7 @@ set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/py32f071xb.ld)
|
||||
function(update_board TARGET)
|
||||
target_compile_definitions(${TARGET} PUBLIC
|
||||
PY32F071xB
|
||||
CFG_EXAMPLE_MSC_READONLY
|
||||
CFG_EXAMPLE_MSC_DUAL_READONLY
|
||||
CFG_EXAMPLE_VIDEO_READONLY
|
||||
)
|
||||
|
||||
@ -2,6 +2,7 @@ PY32_SERIES = PY32F071
|
||||
|
||||
CFLAGS += \
|
||||
-DPY32F071xB \
|
||||
-DCFG_EXAMPLE_MSC_READONLY \
|
||||
-DCFG_EXAMPLE_MSC_DUAL_READONLY \
|
||||
-DCFG_EXAMPLE_VIDEO_READONLY
|
||||
|
||||
|
||||
@ -235,7 +235,10 @@ TU_ATTR_ALWAYS_INLINE static inline bool hwfifo_config(musb_regs_t* musb, unsign
|
||||
(void) mps;
|
||||
|
||||
#if defined(TUP_USBIP_MUSB_PY32)
|
||||
(void) musb; (void) epnum; (void) is_rx; (void) double_packet;
|
||||
(void) musb; (void) epnum; (void) is_rx; (void) mps; (void) double_packet;
|
||||
// Puya FIFO sizes: EP0 = 64 B, EP1 = 512 B, EP2..4 = 128 B, EP5 = 64 B, shared between IN and OUT.
|
||||
//static const uint16_t py32_fifo_size[] = { 64, 512, 128, 128, 128, 64 };
|
||||
//TU_VERIFY(epnum < TU_ARRAY_SIZE(py32_fifo_size) && mps <= py32_fifo_size[epnum]);
|
||||
#elif defined(TUP_USBIP_MUSB_ADI)
|
||||
// AnalogDevice FIFO sizes: EP1..7 = 512 B, EP8..9 = 2048 B, EP10..11 = 4096 B.
|
||||
// DPB requires FIFO >= 2 * MPS. For HS bulk (MPS=512) only EP >= 8 qualifies.
|
||||
|
||||
Reference in New Issue
Block a user