1
0
Fork 0
forked from len0rd/rockbox

implement usb_drv_release_endpoint() and usb_drv_request_endpoint() (a.k.a. fix red)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18705 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Frank Gevaerts 2008-10-03 23:08:11 +00:00
parent 20e704ba78
commit d16fe2d36a

View file

@ -51,6 +51,7 @@ struct usb_endpoint
unsigned char enabled[2]; unsigned char enabled[2];
short max_pkt_size[2]; short max_pkt_size[2];
short type; short type;
char allocation;
}; };
static unsigned char setup_pkt_buf[8]; static unsigned char setup_pkt_buf[8];
@ -601,6 +602,30 @@ void usb_drv_cancel_all_transfers(void)
endpoints[i].halt[0] = endpoints[i].halt[1] = 1; endpoints[i].halt[0] = endpoints[i].halt[1] = 1;
} }
int usb_drv_request_endpoint(int dir)
{
int i, bit;
bit=(dir & USB_DIR_IN)? 2:1;
for (i=1; i < NUM_ENDPOINTS; i++) {
if((endpoints[i].allocation & bit)!=0)
continue;
endpoints[i].allocation |= bit;
return i | dir;
}
return -1;
}
void usb_drv_release_endpoint(int ep)
{
int mask = (ep & USB_DIR_IN)? ~2:~1;
endpoints[ep & 0x7f].allocation &= mask;
}
static void bus_reset(void) static void bus_reset(void)
{ {
/* Enable CLKAON & GLINTENA */ /* Enable CLKAON & GLINTENA */