mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-23 13:20:54 +00:00
Fix ISO support.
This commit is contained in:
parent
b194aa240b
commit
7e3e41952f
@ -79,12 +79,20 @@ uint8_t const * tud_descriptor_device_cb(void)
|
|||||||
#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
|
#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
|
||||||
// LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
|
// LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
|
||||||
// 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ...
|
// 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ...
|
||||||
#define EPNUM_AUDIO 0x03
|
#define EPNUM_AUDIO_IN 0x03
|
||||||
|
#define EPNUM_AUDIO_OUT 0x03
|
||||||
#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
|
#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
|
||||||
// ISO endpoints for NRF5x are fixed to 0x08 (0x88)
|
// ISO endpoints for NRF5x are fixed to 0x08 (0x88)
|
||||||
#define EPNUM_AUDIO 0x08
|
#define EPNUM_AUDIO_IN 0x08
|
||||||
|
#define EPNUM_AUDIO_OUT 0x08
|
||||||
|
#elif CFG_TUSB_MCU == OPT_MCU_SAMG || CFG_TUSB_MCU == OPT_MCU_SAMX7X
|
||||||
|
// SAMG & SAME70 don't support a same endpoint number with different direction IN and OUT
|
||||||
|
// e.g EP1 OUT & EP1 IN cannot exist together
|
||||||
|
#define EPNUM_AUDIO_IN 0x01
|
||||||
|
#define EPNUM_AUDIO_OUT 0x02
|
||||||
#else
|
#else
|
||||||
#define EPNUM_AUDIO 0x01
|
#define EPNUM_AUDIO_IN 0x01
|
||||||
|
#define EPNUM_AUDIO_OUT 0x01
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t const desc_configuration[] =
|
uint8_t const desc_configuration[] =
|
||||||
@ -93,7 +101,7 @@ uint8_t const desc_configuration[] =
|
|||||||
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
|
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
|
||||||
|
|
||||||
// Interface number, string index, EP Out & EP In address, EP size
|
// Interface number, string index, EP Out & EP In address, EP size
|
||||||
TUD_AUDIO_HEADSET_STEREO_DESCRIPTOR(2, EPNUM_AUDIO, EPNUM_AUDIO | 0x80)
|
TUD_AUDIO_HEADSET_STEREO_DESCRIPTOR(2, EPNUM_AUDIO_OUT, EPNUM_AUDIO_IN | 0x80)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Invoked when received GET CONFIGURATION DESCRIPTOR
|
// Invoked when received GET CONFIGURATION DESCRIPTOR
|
||||||
|
@ -83,11 +83,8 @@ typedef struct {
|
|||||||
static tusb_speed_t get_speed(void);
|
static tusb_speed_t get_speed(void);
|
||||||
static void dcd_transmit_packet(xfer_ctl_t * xfer, uint8_t ep_ix);
|
static void dcd_transmit_packet(xfer_ctl_t * xfer, uint8_t ep_ix);
|
||||||
|
|
||||||
// DMA descriptors shouldn't be placed in ITCM
|
// DMA descriptors shouldn't be placed in ITCM !
|
||||||
#if defined(USB_DMA_DESC_SECTION)
|
CFG_TUSB_MEM_SECTION dma_desc_t dma_desc[6];
|
||||||
TU_ATTR_SECTION(TU_XSTRING(USB_DMA_DESC_SECTION))
|
|
||||||
#endif
|
|
||||||
dma_desc_t dma_desc[6];
|
|
||||||
|
|
||||||
xfer_ctl_t xfer_status[EP_MAX+1];
|
xfer_ctl_t xfer_status[EP_MAX+1];
|
||||||
|
|
||||||
@ -531,6 +528,17 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * ep_desc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dcd_edpt_close(uint8_t rhport, uint8_t ep_addr)
|
||||||
|
{
|
||||||
|
uint8_t const epnum = tu_edpt_number(ep_addr);
|
||||||
|
uint8_t const dir = tu_edpt_dir(ep_addr);
|
||||||
|
|
||||||
|
// Disable endpoint interrupt
|
||||||
|
USBHS->USBHS_DEVIDR = 1 << (USBHS_DEVIDR_PEP_0_Pos + epnum);
|
||||||
|
// Disable EP
|
||||||
|
USBHS->USBHS_DEVEPT &=~(1 << (USBHS_DEVEPT_EPEN0_Pos + epnum));
|
||||||
|
}
|
||||||
|
|
||||||
static void dcd_transmit_packet(xfer_ctl_t * xfer, uint8_t ep_ix)
|
static void dcd_transmit_packet(xfer_ctl_t * xfer, uint8_t ep_ix)
|
||||||
{
|
{
|
||||||
uint16_t len = (uint16_t)(xfer->total_len - xfer->queued_len);
|
uint16_t len = (uint16_t)(xfer->total_len - xfer->queued_len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user