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 | |
parent | 263e4d5cbfc32eda780f8f9f35930e1ac2b5dada (diff) | |
download | rockbox-c7517f5662eda9af236e6206af6f8b02e77bf118.tar.gz rockbox-c7517f5662eda9af236e6206af6f8b02e77bf118.zip |
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
-rw-r--r-- | firmware/export/config.h | 4 | ||||
-rw-r--r-- | firmware/target/arm/usb-drv-arc.c | 30 |
2 files changed, 27 insertions, 7 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h index 5af75f51f0..e678590b44 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -882,6 +882,10 @@ Lyre prototype 1 */ | |||
882 | //#define USB_HAS_INTERRUPT -- seems to be broken | 882 | //#define USB_HAS_INTERRUPT -- seems to be broken |
883 | #endif /* CONFIG_USBOTG */ | 883 | #endif /* CONFIG_USBOTG */ |
884 | 884 | ||
885 | #if CONFIG_USBOTG == USBOTG_ARC | ||
886 | #define USB_HAS_ISOCHRONOUS | ||
887 | #endif | ||
888 | |||
885 | /* define the class drivers to enable */ | 889 | /* define the class drivers to enable */ |
886 | #ifdef BOOTLOADER | 890 | #ifdef BOOTLOADER |
887 | 891 | ||
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, | |||
368 | struct transfer_descriptor* previous_td, void *ptr, int len,int pipe); | 368 | struct transfer_descriptor* previous_td, void *ptr, int len,int pipe); |
369 | static void bus_reset(void); | 369 | static void bus_reset(void); |
370 | static void init_control_queue_heads(void); | 370 | static void init_control_queue_heads(void); |
371 | static void init_bulk_queue_heads(void); | 371 | static void init_queue_heads(void); |
372 | static void init_endpoints(void); | 372 | static void init_endpoints(void); |
373 | /*-------------------------------------------------------------------------*/ | 373 | /*-------------------------------------------------------------------------*/ |
374 | static void usb_drv_stop(void) | 374 | static void usb_drv_stop(void) |
@@ -645,7 +645,7 @@ bool usb_drv_powered(void) | |||
645 | void usb_drv_set_address(int address) | 645 | void usb_drv_set_address(int address) |
646 | { | 646 | { |
647 | REG_DEVICEADDR = address << USBDEVICEADDRESS_BIT_POS; | 647 | REG_DEVICEADDR = address << USBDEVICEADDRESS_BIT_POS; |
648 | init_bulk_queue_heads(); | 648 | init_queue_heads(); |
649 | init_endpoints(); | 649 | init_endpoints(); |
650 | } | 650 | } |
651 | 651 | ||
@@ -862,6 +862,7 @@ static void prepare_td(struct transfer_descriptor* td, | |||
862 | void *ptr, int len,int pipe) | 862 | void *ptr, int len,int pipe) |
863 | { | 863 | { |
864 | //logf("adding a td : %d",len); | 864 | //logf("adding a td : %d",len); |
865 | /* FIXME td allow iso packets per frame override but we don't use it here */ | ||
865 | memset(td, 0, sizeof(struct transfer_descriptor)); | 866 | memset(td, 0, sizeof(struct transfer_descriptor)); |
866 | td->next_td_ptr = DTD_NEXT_TERMINATE; | 867 | td->next_td_ptr = DTD_NEXT_TERMINATE; |
867 | td->size_ioc_sts = (len<< DTD_LENGTH_BIT_POS) | | 868 | td->size_ioc_sts = (len<< DTD_LENGTH_BIT_POS) | |
@@ -979,18 +980,33 @@ static void init_control_queue_heads(void) | |||
979 | qh_array[EP_CONTROL+1].dtd.next_td_ptr = QH_NEXT_TERMINATE; | 980 | qh_array[EP_CONTROL+1].dtd.next_td_ptr = QH_NEXT_TERMINATE; |
980 | } | 981 | } |
981 | /* manual: 32.14.4.1 Queue Head Initialization */ | 982 | /* manual: 32.14.4.1 Queue Head Initialization */ |
982 | static void init_bulk_queue_heads(void) | 983 | static void init_queue_heads(void) |
983 | { | 984 | { |
985 | /* FIXME the packetsize for isochronous transfers is 1023 : 1024 but | ||
986 | * the current code only support one type of packet size so we restrict | ||
987 | * isochronous packet size for now also */ | ||
984 | int packetsize = (usb_drv_port_speed() ? 512 : 64); | 988 | int packetsize = (usb_drv_port_speed() ? 512 : 64); |
985 | int i; | 989 | int i; |
986 | 990 | ||
987 | /* TODO: this should take ep_allocation into account */ | 991 | /* TODO: this should take ep_allocation into account */ |
988 | for (i=1;i<USB_NUM_ENDPOINTS;i++) { | 992 | for (i=1;i<USB_NUM_ENDPOINTS;i++) { |
989 | qh_array[i*2].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS | | 993 | |
990 | QH_ZLT_SEL; | 994 | /* OUT */ |
995 | if(endpoints[i].type[DIR_OUT] == USB_ENDPOINT_XFER_ISOC) | ||
996 | /* FIXME: we can adjust the number of packets per frame, currently use one */ | ||
997 | qh_array[i*2].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS | QH_ZLT_SEL | 1 << QH_MULT_POS; | ||
998 | else | ||
999 | qh_array[i*2].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS | QH_ZLT_SEL; | ||
1000 | |||
991 | qh_array[i*2].dtd.next_td_ptr = QH_NEXT_TERMINATE; | 1001 | qh_array[i*2].dtd.next_td_ptr = QH_NEXT_TERMINATE; |
992 | qh_array[i*2+1].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS | | 1002 | |
993 | QH_ZLT_SEL; | 1003 | /* IN */ |
1004 | if(endpoints[i].type[DIR_IN] == USB_ENDPOINT_XFER_ISOC) | ||
1005 | /* FIXME: we can adjust the number of packets per frame, currently use one */ | ||
1006 | qh_array[i*2+1].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS | QH_ZLT_SEL | 1 << QH_MULT_POS; | ||
1007 | else | ||
1008 | qh_array[i*2+1].max_pkt_length = packetsize << QH_MAX_PKT_LEN_POS | QH_ZLT_SEL; | ||
1009 | |||
994 | qh_array[i*2+1].dtd.next_td_ptr = QH_NEXT_TERMINATE; | 1010 | qh_array[i*2+1].dtd.next_td_ptr = QH_NEXT_TERMINATE; |
995 | } | 1011 | } |
996 | } | 1012 | } |