Add USB UGEN support for RTEMS

This commit is contained in:
Kevin Kirspel
2017-05-17 08:40:29 -04:00
committed by Sebastian Huber
parent 3e7de301c1
commit a7415b7f2f
2 changed files with 11 additions and 1 deletions

View File

@@ -804,9 +804,11 @@ usb_fifo_close(struct usb_fifo *f, int fflags)
} }
/* check if a thread wants SIGIO */ /* check if a thread wants SIGIO */
if (f->async_p != NULL) { if (f->async_p != NULL) {
#ifndef __rtems__
PROC_LOCK(f->async_p); PROC_LOCK(f->async_p);
kern_psignal(f->async_p, SIGIO); kern_psignal(f->async_p, SIGIO);
PROC_UNLOCK(f->async_p); PROC_UNLOCK(f->async_p);
#endif /* __rtems__ */
f->async_p = NULL; f->async_p = NULL;
} }
/* remove FWRITE and FREAD flags */ /* remove FWRITE and FREAD flags */
@@ -1025,6 +1027,7 @@ usb_ioctl_f_sub(struct usb_fifo *f, u_long cmd, void *addr,
break; break;
case FIOASYNC: case FIOASYNC:
#ifndef __rtems__
if (*(int *)addr) { if (*(int *)addr) {
if (f->async_p != NULL) { if (f->async_p != NULL) {
error = EBUSY; error = EBUSY;
@@ -1034,6 +1037,9 @@ usb_ioctl_f_sub(struct usb_fifo *f, u_long cmd, void *addr,
} else { } else {
f->async_p = NULL; f->async_p = NULL;
} }
#else /* __rtems__ */
f->async_p = NULL;
#endif /* __rtems__ */
break; break;
/* XXX this is not the most general solution */ /* XXX this is not the most general solution */
@@ -1042,10 +1048,12 @@ usb_ioctl_f_sub(struct usb_fifo *f, u_long cmd, void *addr,
error = EINVAL; error = EINVAL;
break; break;
} }
#ifndef __rtems__
if (*(int *)addr != USB_PROC_GET_GID(f->async_p)) { if (*(int *)addr != USB_PROC_GET_GID(f->async_p)) {
error = EPERM; error = EPERM;
break; break;
} }
#endif /* __rtems__ */
break; break;
default: default:
return (ENOIOCTL); return (ENOIOCTL);
@@ -1769,11 +1777,13 @@ usb_fifo_wakeup(struct usb_fifo *f)
selwakeup(&f->selinfo); selwakeup(&f->selinfo);
f->flag_isselect = 0; f->flag_isselect = 0;
} }
#ifndef __rtems__
if (f->async_p != NULL) { if (f->async_p != NULL) {
PROC_LOCK(f->async_p); PROC_LOCK(f->async_p);
kern_psignal(f->async_p, SIGIO); kern_psignal(f->async_p, SIGIO);
PROC_UNLOCK(f->async_p); PROC_UNLOCK(f->async_p);
} }
#endif /* __rtems__ */
} }
static int static int

View File

@@ -1,6 +1,6 @@
#define USB_HAVE_CONDVAR 1 #define USB_HAVE_CONDVAR 1
#define USB_HAVE_UGEN 0 #define USB_HAVE_UGEN 1
#define USB_HAVE_BUSDMA 1 #define USB_HAVE_BUSDMA 1