diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-08-12 02:29:07 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-08-12 02:29:07 +0000 |
commit | 771b35b7be669148955abf20512338693832bbdf (patch) | |
tree | 3948f6d24960036f2d21aa234925c8979f0f8ea3 | |
parent | cc4be72d152942c60c54407da3b1be24f5b50b72 (diff) | |
download | rockbox-771b35b7be669148955abf20512338693832bbdf.tar.gz rockbox-771b35b7be669148955abf20512338693832bbdf.zip |
M:Robe 500: Make endpoint requests more flexible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22262 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/drivers/m66591.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/firmware/drivers/m66591.c b/firmware/drivers/m66591.c index 06d42b55c2..fca995c154 100644 --- a/firmware/drivers/m66591.c +++ b/firmware/drivers/m66591.c | |||
@@ -575,38 +575,42 @@ int usb_drv_request_endpoint(int type, int dir) { | |||
575 | int ep; | 575 | int ep; |
576 | int pipecfg = 0; | 576 | int pipecfg = 0; |
577 | 577 | ||
578 | /* The endpoint/pipes are hard coded: This could be more flexible */ | ||
579 | if (type == USB_ENDPOINT_XFER_BULK) { | 578 | if (type == USB_ENDPOINT_XFER_BULK) { |
580 | /* Enalbe double buffer mode */ | 579 | /* Enable double buffer mode (only used for ep 1 and 2) */ |
581 | pipecfg |= 1<<9; | 580 | pipecfg |= 1<<9; |
582 | 581 | ||
583 | if (dir == USB_DIR_IN) { | 582 | /* Bulk endpoints must be between 1 and 4 inclusive */ |
584 | pipecfg |= (1<<4); | 583 | ep=1; |
585 | ep = 2; | 584 | |
586 | } else { | 585 | while(M66591_eps[ep].busy && ep++<5); |
587 | ep = 1; | 586 | |
587 | /* If this reached 5 the endpoints were all busy */ | ||
588 | if(ep==5) { | ||
589 | logf("mxx: ep %d busy", ep); | ||
590 | return -1; | ||
588 | } | 591 | } |
589 | } else if (type == USB_ENDPOINT_XFER_INT) { | 592 | } else if (type == USB_ENDPOINT_XFER_INT) { |
590 | if (dir == USB_DIR_IN) { | 593 | ep=5; |
591 | pipecfg |= (1<<4); | 594 | |
592 | ep = 6; | 595 | while(M66591_eps[ep].busy && ep++<7); |
593 | } else { | 596 | |
594 | ep = 5; | 597 | /* If this reached 7 the endpoints were all busy */ |
598 | if(ep==7) { | ||
599 | logf("mxx: ep %d busy", ep); | ||
600 | return -1; | ||
595 | } | 601 | } |
596 | } else { | 602 | } else { |
597 | /* Not a supported type */ | 603 | /* Not a supported type */ |
598 | return -1; | 604 | return -1; |
599 | } | 605 | } |
600 | 606 | ||
601 | 607 | if (dir == USB_DIR_IN) { | |
602 | if (!M66591_eps[ep].busy) { | 608 | pipecfg |= (1<<4); |
603 | M66591_eps[ep].busy = true; | ||
604 | M66591_eps[ep].dir = dir; | ||
605 | } else { | ||
606 | logf("mxx: ep %d busy", ep); | ||
607 | return -1; | ||
608 | } | 609 | } |
609 | 610 | ||
611 | M66591_eps[ep].busy = true; | ||
612 | M66591_eps[ep].dir = dir; | ||
613 | |||
610 | M66591_PIPE_CFGSEL=ep; | 614 | M66591_PIPE_CFGSEL=ep; |
611 | 615 | ||
612 | /* Enable pipe (15) and continuous transfer mode (8) */ | 616 | /* Enable pipe (15) and continuous transfer mode (8) */ |