diff options
author | Amaury Pouly <pamaury@rockbox.org> | 2010-03-12 10:59:34 +0000 |
---|---|---|
committer | Amaury Pouly <pamaury@rockbox.org> | 2010-03-12 10:59:34 +0000 |
commit | c7517f5662eda9af236e6206af6f8b02e77bf118 (patch) | |
tree | 23ebc53fa6965d398315c154c988f1ddd1413c93 /firmware/target/arm | |
parent | 263e4d5cbfc32eda780f8f9f35930e1ac2b5dada (diff) |
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
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/usb-drv-arc.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/firmware/target/arm/usb-drv-arc.c b/firmware/target/arm/usb-drv-arc.c index a96b8a67e8..94dc9b7b5e 100644 --- a/firmware/target/arm/usb-drv-arc.c +++ b/firmware/target/arm/usb-drv-arc.c @@ -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; } } |