forked from len0rd/rockbox
Add experimental support for isochronous transfers in the usb ARC driver. There are several details to tweaks however.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25130 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
263e4d5cbf
commit
c7517f5662
2 changed files with 27 additions and 7 deletions
|
@ -882,6 +882,10 @@ Lyre prototype 1 */
|
|||
//#define USB_HAS_INTERRUPT -- seems to be broken
|
||||
#endif /* CONFIG_USBOTG */
|
||||
|
||||
#if CONFIG_USBOTG == USBOTG_ARC
|
||||
#define USB_HAS_ISOCHRONOUS
|
||||
#endif
|
||||
|
||||
/* define the class drivers to enable */
|
||||
#ifdef BOOTLOADER
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ static void prepare_td(struct transfer_descriptor* td,
|
|||
struct transfer_descriptor* previous_td, void *ptr, int len,int pipe);
|
||||
static void bus_reset(void);
|
||||
static void init_control_queue_heads(void);
|
||||
static void init_bulk_queue_heads(void);
|
||||
static void init_queue_heads(void);
|
||||
static void init_endpoints(void);
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static void usb_drv_stop(void)
|
||||
|
@ -645,7 +645,7 @@ bool usb_drv_powered(void)
|
|||
void usb_drv_set_address(int address)
|
||||
{
|
||||
REG_DEVICEADDR = address << USBDEVICEADDRESS_BIT_POS;
|
||||
init_bulk_queue_heads();
|
||||
init_queue_heads();
|
||||
init_endpoints();
|
||||
}
|
||||
|
||||
|
@ -862,6 +862,7 @@ static void prepare_td(struct transfer_descriptor* td,
|
|||
void *ptr, int len,int pipe)
|
||||
{
|
||||
//logf("adding a td : %d",len);
|
||||
/* FIXME td allow iso packets per frame override but we don't use it here */
|
||||
memset(td, 0, sizeof(struct transfer_descriptor));
|
||||
td->next_td_ptr = DTD_NEXT_TERMINATE;
|
||||
td->size_ioc_sts = (len<< DTD_LENGTH_BIT_POS) |
|
||||
|
@ -979,18 +980,33 @@ static void init_control_queue_heads(void)
|
|||
qh_array[EP_CONTROL+1].dtd.next_td_ptr = QH_NEXT_TERMINATE;
|
||||
}
|
||||
/* manual: 32.14.4.1 Queue Head Initialization */
|
||||
static void init_bulk_queue_heads(void)
|
||||
static void init_queue_heads(void)
|
||||
{
|
||||
/* FIXME the packetsize for isochronous transfers is 1023 : 1024 but
|
||||
* the current code only support one type of packet size so we restrict
|
||||
* isochronous packet size for now also */
|
||||
int packetsize = (usb_drv_port_speed() ? 512 : 64);
|
||||
int i;
|
||||
|
||||
/* TODO: this should take ep_allocation into account */
|
||||
for (i=1;i<USB_NUM_ENDPOINTS;i++) {
|
||||
qh_array[i*2].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS |
|
||||
QH_ZLT_SEL;
|
||||
|
||||
/* OUT */
|
||||
if(endpoints[i].type[DIR_OUT] == USB_ENDPOINT_XFER_ISOC)
|
||||
/* FIXME: we can adjust the number of packets per frame, currently use one */
|
||||
qh_array[i*2].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS | QH_ZLT_SEL | 1 << QH_MULT_POS;
|
||||
else
|
||||
qh_array[i*2].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS | QH_ZLT_SEL;
|
||||
|
||||
qh_array[i*2].dtd.next_td_ptr = QH_NEXT_TERMINATE;
|
||||
qh_array[i*2+1].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS |
|
||||
QH_ZLT_SEL;
|
||||
|
||||
/* IN */
|
||||
if(endpoints[i].type[DIR_IN] == USB_ENDPOINT_XFER_ISOC)
|
||||
/* FIXME: we can adjust the number of packets per frame, currently use one */
|
||||
qh_array[i*2+1].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS | QH_ZLT_SEL | 1 << QH_MULT_POS;
|
||||
else
|
||||
qh_array[i*2+1].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS | QH_ZLT_SEL;
|
||||
|
||||
qh_array[i*2+1].dtd.next_td_ptr = QH_NEXT_TERMINATE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue