mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
M:Robe 500: Make endpoint requests more flexible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22262 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
cc4be72d15
commit
771b35b7be
1 changed files with 24 additions and 20 deletions
|
@ -575,37 +575,41 @@ int usb_drv_request_endpoint(int type, int dir) {
|
||||||
int ep;
|
int ep;
|
||||||
int pipecfg = 0;
|
int pipecfg = 0;
|
||||||
|
|
||||||
/* The endpoint/pipes are hard coded: This could be more flexible */
|
|
||||||
if (type == USB_ENDPOINT_XFER_BULK) {
|
if (type == USB_ENDPOINT_XFER_BULK) {
|
||||||
/* Enalbe double buffer mode */
|
/* Enable double buffer mode (only used for ep 1 and 2) */
|
||||||
pipecfg |= 1<<9;
|
pipecfg |= 1<<9;
|
||||||
|
|
||||||
if (dir == USB_DIR_IN) {
|
/* Bulk endpoints must be between 1 and 4 inclusive */
|
||||||
pipecfg |= (1<<4);
|
ep=1;
|
||||||
ep = 2;
|
|
||||||
} else {
|
while(M66591_eps[ep].busy && ep++<5);
|
||||||
ep = 1;
|
|
||||||
|
/* If this reached 5 the endpoints were all busy */
|
||||||
|
if(ep==5) {
|
||||||
|
logf("mxx: ep %d busy", ep);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (type == USB_ENDPOINT_XFER_INT) {
|
} else if (type == USB_ENDPOINT_XFER_INT) {
|
||||||
if (dir == USB_DIR_IN) {
|
ep=5;
|
||||||
pipecfg |= (1<<4);
|
|
||||||
ep = 6;
|
while(M66591_eps[ep].busy && ep++<7);
|
||||||
} else {
|
|
||||||
ep = 5;
|
/* If this reached 7 the endpoints were all busy */
|
||||||
|
if(ep==7) {
|
||||||
|
logf("mxx: ep %d busy", ep);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Not a supported type */
|
/* Not a supported type */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dir == USB_DIR_IN) {
|
||||||
|
pipecfg |= (1<<4);
|
||||||
|
}
|
||||||
|
|
||||||
if (!M66591_eps[ep].busy) {
|
|
||||||
M66591_eps[ep].busy = true;
|
M66591_eps[ep].busy = true;
|
||||||
M66591_eps[ep].dir = dir;
|
M66591_eps[ep].dir = dir;
|
||||||
} else {
|
|
||||||
logf("mxx: ep %d busy", ep);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
M66591_PIPE_CFGSEL=ep;
|
M66591_PIPE_CFGSEL=ep;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue