Index: firmware/target/arm/usb-s3c6400x.c =================================================================== --- firmware/target/arm/usb-s3c6400x.c (Revision 24215) +++ firmware/target/arm/usb-s3c6400x.c (Arbeitskopie) @@ -50,6 +50,7 @@ static struct ep_type endpoints[5]; static struct usb_ctrlrequest ctrlreq USB_DEVBSS_ATTR; +static unsigned char dummy_data[32] USB_DEVBSS_ATTR; int usb_drv_port_speed(void) { @@ -291,7 +292,7 @@ DOEPCTL(ep) |= 0x8000; /* EPx OUT ACTIVE */ int blocksize = usb_drv_port_speed() ? 512 : 64; int packets = (length + blocksize - 1) / blocksize; - if (!length) DIEPTSIZ(ep) = 1 << 19; /* one empty packet */ + if (!length) DOEPTSIZ(ep) = 1 << 19; /* one empty packet */ else DOEPTSIZ(ep) = length | (packets << 19); DOEPDMA(ep) = (uint32_t)ptr; clean_dcache(); @@ -301,6 +302,7 @@ int usb_drv_send(int endpoint, void *ptr, int length) { endpoint &= 0x7f; + while(!endpoints[endpoint].done && endpoints[endpoint].busy); endpoints[endpoint].done = false; ep_send(endpoint, ptr, length); while (!endpoints[endpoint].done && endpoints[endpoint].busy) @@ -310,12 +312,15 @@ int usb_drv_send_nonblocking(int endpoint, void *ptr, int length) { + while(!endpoints[endpoint].done && endpoints[endpoint].busy); ep_send(endpoint & 0x7f, ptr, length); return 0; } int usb_drv_recv(int endpoint, void* ptr, int length) { + if(ptr==NULL) ptr = dummy_data; + while(!endpoints[endpoint].done && endpoints[endpoint].busy); ep_recv(endpoint & 0x7f, ptr, length); return 0; }