From 3714af88c2950c2a432a5c9fc6d17513bc95b1c6 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 30 Sep 2008 20:53:58 +0000 Subject: Fixes for class driver i/f git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@967 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c | 76 +++++++++++++-------------- nuttx/configs/mcu123-lpc214x/nsh/defconfig | 44 ++++++++-------- nuttx/configs/mcu123-lpc214x/ostest/defconfig | 42 +++++++-------- nuttx/configs/ntosd-dm320/nettest/defconfig | 42 +++++++-------- nuttx/configs/ntosd-dm320/nsh/defconfig | 42 +++++++-------- nuttx/configs/ntosd-dm320/ostest/defconfig | 42 +++++++-------- nuttx/configs/ntosd-dm320/udp/defconfig | 42 +++++++-------- nuttx/configs/ntosd-dm320/uip/defconfig | 42 +++++++-------- nuttx/include/nuttx/usbdev.h | 64 +++++++++++----------- 9 files changed, 211 insertions(+), 225 deletions(-) diff --git a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c index f934d3d2d..571fab82e 100644 --- a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c +++ b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c @@ -360,7 +360,7 @@ static inline void lpc214x_dmareset(uint32 enable); #endif static void lpc214x_usbreset(struct lpc214x_usbdev_s *priv); static void lpc214x_dispatchrequest(struct lpc214x_usbdev_s *priv, - const struct usb_ctrlreq_s *req); + const struct usb_ctrlreq_s *ctrl); static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv); static inline void lpc214x_ep0dataoutinterrupt(struct lpc214x_usbdev_s *priv); static inline void lpc214x_ep0dataininterrupt(struct lpc214x_usbdev_s *priv); @@ -1046,14 +1046,14 @@ static void lpc214x_usbreset(struct lpc214x_usbdev_s *priv) *******************************************************************************/ static void lpc214x_dispatchrequest(struct lpc214x_usbdev_s *priv, - const struct usb_ctrlreq_s *req) + const struct usb_ctrlreq_s *ctrl) { int ret; usbtrace(TRACE_INTDECODE(LPC214X_TRACEINTID_DISPATCH), 0); if (priv && priv->driver) { - ret = CLASS_SETUP(priv->driver, &priv->usbdev, req); + ret = CLASS_SETUP(priv->driver, &priv->usbdev, ctrl); if (ret < 0) { /* Stall on failure */ @@ -1081,7 +1081,7 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv) { struct lpc214x_ep_s *ep0 = &priv->eplist[LPC214X_EP0_OUT]; struct lpc214x_req_s *privreq = (struct lpc214x_req_s *)sq_peek(&ep0->reqlist); - struct usb_ctrlreq_s req; + struct usb_ctrlreq_s ctrl; uint16 index; ubyte epphy; ubyte response[2]; @@ -1116,7 +1116,7 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv) /* Read EP0 data */ - ret = lpc214x_epread(LPC214X_EP0_OUT, (ubyte*)&req, sizeof(struct usb_ctrlreq_s)); + ret = lpc214x_epread(LPC214X_EP0_OUT, (ubyte*)&ctrl, sizeof(struct usb_ctrlreq_s)); if (ret <= 0) { return; @@ -1124,10 +1124,10 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv) /* Dispatch any non-standard requests */ - ep0->in = (req.type & USB_DIR_IN) != 0; - if ((req.type & USB_REQ_TYPE_MASK) != USB_REQ_TYPE_STANDARD) + ep0->in = (ctrl.type & USB_DIR_IN) != 0; + if ((ctrl.type & USB_REQ_TYPE_MASK) != USB_REQ_TYPE_STANDARD) { - lpc214x_dispatchrequest(priv, &req); + lpc214x_dispatchrequest(priv, &ctrl); return; } @@ -1135,25 +1135,25 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv) * USB device controller driver; pass what is left to the class driver */ - switch (req.req) + switch (ctrl.req) { case USB_REQ_GETSTATUS: { /* Length must be 2, from device, and value == 0 */ - if (!priv->paddrset || GETUINT16(req.len) != 2 || - (req.type & USB_REQ_DIR_IN) == 0 || GETUINT16(req.value) != 0) + if (!priv->paddrset || GETUINT16(ctrl.len) != 2 || + (ctrl.type & USB_REQ_DIR_IN) == 0 || GETUINT16(ctrl.value) != 0) { priv->stalled = 1; } else { - switch (req.type & USB_REQ_RECIPIENT_MASK) + switch (ctrl.type & USB_REQ_RECIPIENT_MASK) { case USB_REQ_RECIPIENT_ENDPOINT: { usbtrace(TRACE_INTDECODE(LPC214X_TRACEINTID_EPGETSTATUS), 0); - epphy = USB_EPNO(GETUINT16(req.index)) << 1; + epphy = USB_EPNO(GETUINT16(ctrl.index)) << 1; if (epphy < LPC214X_NPHYSENDPOINTS) { if ((lpc214x_usbcmd(CMD_USB_EP_SELECT|epphy, 0) & CMD_USB_EPSELECT_ST) != 0) @@ -1177,7 +1177,7 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv) case USB_REQ_RECIPIENT_DEVICE: { - index = GETUINT16(req.index); + index = GETUINT16(ctrl.index); if (index == 0) { usbtrace(TRACE_INTDECODE(LPC214X_TRACEINTID_DEVGETSTATUS), 0); @@ -1220,14 +1220,14 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv) case USB_REQ_CLEARFEATURE: { usbtrace(TRACE_INTDECODE(LPC214X_TRACEINTID_CLEARFEATURE), 0); - if (req.type != USB_REQ_RECIPIENT_ENDPOINT) + if (ctrl.type != USB_REQ_RECIPIENT_ENDPOINT) { - lpc214x_dispatchrequest(priv, &req); + lpc214x_dispatchrequest(priv, &ctrl); } - else if (priv->paddrset && GETUINT16(req.value) == USB_ENDPOINT_HALT && - GETUINT16(req.index) < LPC214X_NLOGENDPOINTS && GETUINT16(req.len) == 0) + else if (priv->paddrset && GETUINT16(ctrl.value) == USB_ENDPOINT_HALT && + GETUINT16(ctrl.index) < LPC214X_NLOGENDPOINTS && GETUINT16(ctrl.len) == 0) { - ubyte epphys = LPC214X_EP_LOG2PHY(GETUINT16(req.index)); + ubyte epphys = LPC214X_EP_LOG2PHY(GETUINT16(ctrl.index)); priv->eplist[epphys].halted = 0; lpc214x_epwrite(LPC214X_EP0_IN, NULL, 0); priv->ep0state = LPC214X_EP0STATUSIN; @@ -1242,19 +1242,19 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv) case USB_REQ_SETFEATURE: { usbtrace(TRACE_INTDECODE(LPC214X_TRACEINTID_SETFEATURE), 0); - if (req.type == USB_REQ_RECIPIENT_DEVICE && - GETUINT16(req.value) == USB_FEATURE_TESTMODE) + if (ctrl.type == USB_REQ_RECIPIENT_DEVICE && + GETUINT16(ctrl.value) == USB_FEATURE_TESTMODE) { - uvdbg("test mode: %d\n", GETUINT16(req.index)); + uvdbg("test mode: %d\n", GETUINT16(ctrl.index)); } - else if (req.type != USB_REQ_RECIPIENT_ENDPOINT) + else if (ctrl.type != USB_REQ_RECIPIENT_ENDPOINT) { - lpc214x_dispatchrequest(priv, &req); + lpc214x_dispatchrequest(priv, &ctrl); } - else if (priv->paddrset && GETUINT16(req.value) == USB_ENDPOINT_HALT && - GETUINT16(req.index) < LPC214X_NLOGENDPOINTS && GETUINT16(req.len) == 0) + else if (priv->paddrset && GETUINT16(ctrl.value) == USB_ENDPOINT_HALT && + GETUINT16(ctrl.index) < LPC214X_NLOGENDPOINTS && GETUINT16(ctrl.len) == 0) { - ubyte epphys = LPC214X_EP_LOG2PHY(GETUINT16(req.index)); + ubyte epphys = LPC214X_EP_LOG2PHY(GETUINT16(ctrl.index)); priv->eplist[epphys].halted = 1; lpc214x_epwrite(LPC214X_EP0_IN, NULL, 0); priv->ep0state = LPC214X_EP0STATUSIN; @@ -1269,13 +1269,13 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv) case USB_REQ_SETADDRESS: { usbtrace(TRACE_INTDECODE(LPC214X_TRACEINTID_SETADDRESS), 0); - if ((req.type == USB_REQ_RECIPIENT_DEVICE) && - (GETUINT16(req.index) == 0) && (GETUINT16(req.len) == 0) && - (GETUINT16(req.value) < 128)) + if ((ctrl.type == USB_REQ_RECIPIENT_DEVICE) && + (GETUINT16(ctrl.index) == 0) && (GETUINT16(ctrl.len) == 0) && + (GETUINT16(ctrl.value) < 128)) { lpc214x_epwrite(LPC214X_EP0_IN, NULL, 0); - priv->eplist[LPC214X_EP0_OUT].eplog = req.value[0]; - priv->eplist[LPC214X_EP0_IN].eplog = req.value[0]; + priv->eplist[LPC214X_EP0_OUT].eplog = ctrl.value[0]; + priv->eplist[LPC214X_EP0_IN].eplog = ctrl.value[0]; priv->ep0state = LPC214X_EP0SETADDRESS; } else @@ -1289,10 +1289,10 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv) case USB_REQ_SETDESCRIPTOR: case USB_REQ_GETCONFIGURATION: { - if (priv->paddrset && (GETUINT16(req.value) == 0) && - (GETUINT16(req.index) == 0) && (GETUINT16(req.len) == 1)) + if (priv->paddrset && (GETUINT16(ctrl.value) == 0) && + (GETUINT16(ctrl.index) == 0) && (GETUINT16(ctrl.len) == 1)) { - lpc214x_dispatchrequest(priv, &req); + lpc214x_dispatchrequest(priv, &ctrl); } else { @@ -1306,7 +1306,7 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv) case USB_REQ_GETINTERFACE: case USB_REQ_SETINTERFACE: { - lpc214x_dispatchrequest(priv, &req); + lpc214x_dispatchrequest(priv, &ctrl); } break; @@ -2637,8 +2637,8 @@ int usbdev_register(struct usbdevclass_driver_s *driver) usbtrace(TRACE_DEVREGISTER, 0); #ifdef CONFIG_DEBUG - if (!driver || !driver->ops.bind || !driver->ops.unbind || - !driver->ops.disconnect || !driver->ops.setup) + if (!driver || !driver->ops->bind || !driver->ops->unbind || + !driver->ops->disconnect || !driver->ops->setup) { usbtrace(TRACE_ERROR(LPC214X_TRACEERR_INVALIDPARMS), 0); return -EINVAL; diff --git a/nuttx/configs/mcu123-lpc214x/nsh/defconfig b/nuttx/configs/mcu123-lpc214x/nsh/defconfig index cc1ded74a..8c0cb137e 100644 --- a/nuttx/configs/mcu123-lpc214x/nsh/defconfig +++ b/nuttx/configs/mcu123-lpc214x/nsh/defconfig @@ -379,36 +379,34 @@ CONFIG_LPC214X_USBDEV_DMAINTMASK=0 # # USB Serial Device Configuration # -# CONFIG_USBSERIAL_EPOUT -# CONFIG_USBSERIAL_EPIN -# CONFIG_USBSERIAL_NWRREQS -# The number of write requests that can be in flight -# CONFIG_USBSERIAL_NRDREQS -# The number of read requests that can be in flight -# CONFIG_USBSERIAL_RXBUFSIZE -# Size of the serial receive buffer -# CONFIG_USBSERIAL_TXBUFSIZE -# Size of the serial transmit buffer -# CONFIG_USBSER_VENDORID -# The vendor ID code -# CONFIG_USBSER_PRODUCTID -# The product ID code -CONFIG_USBSERIAL_EPOUT=1 -CONFIG_USBSERIAL_EPIN=2 -CONFIG_USBSERIAL_NWRREQS=4 -CONFIG_USBSERIAL_NRDREQS=4 +# CONFIG_USBSER_EPOUT and CONFIG_USBSER_EPIN +# Logical endoint addresses +# CONFIG_USBSER_NWRREQS and CONFIG_USBSER_NRDREQS +# The number of write/read requests that can be in flight +# CONFIG_USBSER_VENDORID and CONFIG_USBSER_VENDORSTR +# The vendor ID code/string +# CONFIG_USBSER_PRODUCTID and CONFIG_USBSER_PRODUCTSTR +# The product ID code/string +# CONFIG_USBSER_RXBUFSIZE and CONFIG_USBSER_TXBUFSIZE +# Size of the serial receive/transmit buffers +CONFIG_USBSER_EPOUT=1 +CONFIG_USBSER_EPIN=2 +CONFIG_USBSER_NWRREQS=4 +CONFIG_USBSER_NRDREQS=4 CONFIG_USBSER_VENDORID=0x0525 CONFIG_USBSER_PRODUCTID=0xa4a6 -CONFIG_USBSERIAL_RXBUFSIZE=512 -CONFIG_USBSERIAL_TXBUFSIZE=512 +CONFIG_USBSER_VENDORSTR="Nuttx" +CONFIG_USBSER_PRODUCTSTR="USBdev Serial" +CONFIG_USBSER_RXBUFSIZE=512 +CONFIG_USBSER_TXBUFSIZE=512 # # USB Device Zero Configuration -# CONFIG_USBSER_VENDORID +# CONFIG_USBZERO_VENDORID # The vendor ID code -# CONFIG_USBSER_PRODUCTID +# CONFIG_USBZERO_PRODUCTID # The product ID code -CONFIG_USBZERO_VENDORID=0x0525 +ONFIG_USBZERO_VENDORID=0x0525 CONFIG_USBZERO_PRODUCTID=0xa4a0 # diff --git a/nuttx/configs/mcu123-lpc214x/ostest/defconfig b/nuttx/configs/mcu123-lpc214x/ostest/defconfig index 57f146d2e..1d284076b 100644 --- a/nuttx/configs/mcu123-lpc214x/ostest/defconfig +++ b/nuttx/configs/mcu123-lpc214x/ostest/defconfig @@ -379,34 +379,32 @@ CONFIG_LPC214X_USBDEV_DMAINTMASK=0 # # USB Serial Device Configuration # -# CONFIG_USBSERIAL_EPOUT -# CONFIG_USBSERIAL_EPIN -# CONFIG_USBSERIAL_NWRREQS -# The number of write requests that can be in flight -# CONFIG_USBSERIAL_NRDREQS -# The number of read requests that can be in flight -# CONFIG_USBSERIAL_RXBUFSIZE -# Size of the serial receive buffer -# CONFIG_USBSERIAL_TXBUFSIZE -# Size of the serial transmit buffer -# CONFIG_USBSER_VENDORID -# The vendor ID code -# CONFIG_USBSER_PRODUCTID -# The product ID code -CONFIG_USBSERIAL_EPOUT=1 -CONFIG_USBSERIAL_EPIN=2 -CONFIG_USBSERIAL_NWRREQS=4 -CONFIG_USBSERIAL_NRDREQS=4 +# CONFIG_USBSER_EPOUT and CONFIG_USBSER_EPIN +# Logical endoint addresses +# CONFIG_USBSER_NWRREQS and CONFIG_USBSER_NRDREQS +# The number of write/read requests that can be in flight +# CONFIG_USBSER_VENDORID and CONFIG_USBSER_VENDORSTR +# The vendor ID code/string +# CONFIG_USBSER_PRODUCTID and CONFIG_USBSER_PRODUCTSTR +# The product ID code/string +# CONFIG_USBSER_RXBUFSIZE and CONFIG_USBSER_TXBUFSIZE +# Size of the serial receive/transmit buffers +CONFIG_USBSER_EPOUT=1 +CONFIG_USBSER_EPIN=2 +CONFIG_USBSER_NWRREQS=4 +CONFIG_USBSER_NRDREQS=4 CONFIG_USBSER_VENDORID=0x0525 CONFIG_USBSER_PRODUCTID=0xa4a6 -CONFIG_USBSERIAL_RXBUFSIZE=512 -CONFIG_USBSERIAL_TXBUFSIZE=512 +CONFIG_USBSER_VENDORSTR="Nuttx" +CONFIG_USBSER_PRODUCTSTR="USBdev Serial" +CONFIG_USBSER_RXBUFSIZE=512 +CONFIG_USBSER_TXBUFSIZE=512 # # USB Device Zero Configuration -# CONFIG_USBSER_VENDORID +# CONFIG_USBZERO_VENDORID # The vendor ID code -# CONFIG_USBSER_PRODUCTID +# CONFIG_USBZERO_PRODUCTID # The product ID code CONFIG_USBZERO_VENDORID=0x0525 CONFIG_USBZERO_PRODUCTID=0xa4a0 diff --git a/nuttx/configs/ntosd-dm320/nettest/defconfig b/nuttx/configs/ntosd-dm320/nettest/defconfig index b49c1757f..491e7a8a8 100644 --- a/nuttx/configs/ntosd-dm320/nettest/defconfig +++ b/nuttx/configs/ntosd-dm320/nettest/defconfig @@ -356,34 +356,32 @@ CONFIG_DM320_USBDEV_DMA=n # # USB Serial Device Configuration # -# CONFIG_USBSERIAL_EPOUT -# CONFIG_USBSERIAL_EPIN -# CONFIG_USBSERIAL_NWRREQS -# The number of write requests that can be in flight -# CONFIG_USBSERIAL_NRDREQS -# The number of read requests that can be in flight -# CONFIG_USBSERIAL_RXBUFSIZE -# Size of the serial receive buffer -# CONFIG_USBSERIAL_TXBUFSIZE -# Size of the serial transmit buffer -# CONFIG_USBSER_VENDORID -# The vendor ID code -# CONFIG_USBSER_PRODUCTID -# The product ID code -CONFIG_USBSERIAL_EPOUT=1 -CONFIG_USBSERIAL_EPIN=2 -CONFIG_USBSERIAL_NWRREQS=4 -CONFIG_USBSERIAL_NRDREQS=4 +# CONFIG_USBSER_EPOUT and CONFIG_USBSER_EPIN +# Logical endoint addresses +# CONFIG_USBSER_NWRREQS and CONFIG_USBSER_NRDREQS +# The number of write/read requests that can be in flight +# CONFIG_USBSER_VENDORID and CONFIG_USBSER_VENDORSTR +# The vendor ID code/string +# CONFIG_USBSER_PRODUCTID and CONFIG_USBSER_PRODUCTSTR +# The product ID code/string +# CONFIG_USBSER_RXBUFSIZE and CONFIG_USBSER_TXBUFSIZE +# Size of the serial receive/transmit buffers +CONFIG_USBSER_EPOUT=1 +CONFIG_USBSER_EPIN=2 +CONFIG_USBSER_NWRREQS=4 +CONFIG_USBSER_NRDREQS=4 CONFIG_USBSER_VENDORID=0x0525 CONFIG_USBSER_PRODUCTID=0xa4a6 -CONFIG_USBSERIAL_RXBUFSIZE=512 -CONFIG_USBSERIAL_TXBUFSIZE=512 +CONFIG_USBSER_VENDORSTR="Nuttx" +CONFIG_USBSER_PRODUCTSTR="USBdev Serial" +CONFIG_USBSER_RXBUFSIZE=512 +CONFIG_USBSER_TXBUFSIZE=512 # # USB Device Zero Configuration -# CONFIG_USBSER_VENDORID +# CONFIG_USBZERO_VENDORID # The vendor ID code -# CONFIG_USBSER_PRODUCTID +# CONFIG_USBZERO_PRODUCTID # The product ID code CONFIG_USBZERO_VENDORID=0x0525 CONFIG_USBZERO_PRODUCTID=0xa4a0 diff --git a/nuttx/configs/ntosd-dm320/nsh/defconfig b/nuttx/configs/ntosd-dm320/nsh/defconfig index 1b4f0fb19..0b2486383 100644 --- a/nuttx/configs/ntosd-dm320/nsh/defconfig +++ b/nuttx/configs/ntosd-dm320/nsh/defconfig @@ -364,34 +364,32 @@ CONFIG_DM320_USBDEV_DMA=n # # USB Serial Device Configuration # -# CONFIG_USBSERIAL_EPOUT -# CONFIG_USBSERIAL_EPIN -# CONFIG_USBSERIAL_NWRREQS -# The number of write requests that can be in flight -# CONFIG_USBSERIAL_NRDREQS -# The number of read requests that can be in flight -# CONFIG_USBSERIAL_RXBUFSIZE -# Size of the serial receive buffer -# CONFIG_USBSERIAL_TXBUFSIZE -# Size of the serial transmit buffer -# CONFIG_USBSER_VENDORID -# The vendor ID code -# CONFIG_USBSER_PRODUCTID -# The product ID code -CONFIG_USBSERIAL_EPOUT=1 -CONFIG_USBSERIAL_EPIN=2 -CONFIG_USBSERIAL_NWRREQS=4 -CONFIG_USBSERIAL_NRDREQS=4 +# CONFIG_USBSER_EPOUT and CONFIG_USBSER_EPIN +# Logical endoint addresses +# CONFIG_USBSER_NWRREQS and CONFIG_USBSER_NRDREQS +# The number of write/read requests that can be in flight +# CONFIG_USBSER_VENDORID and CONFIG_USBSER_VENDORSTR +# The vendor ID code/string +# CONFIG_USBSER_PRODUCTID and CONFIG_USBSER_PRODUCTSTR +# The product ID code/string +# CONFIG_USBSER_RXBUFSIZE and CONFIG_USBSER_TXBUFSIZE +# Size of the serial receive/transmit buffers +CONFIG_USBSER_EPOUT=1 +CONFIG_USBSER_EPIN=2 +CONFIG_USBSER_NWRREQS=4 +CONFIG_USBSER_NRDREQS=4 CONFIG_USBSER_VENDORID=0x0525 CONFIG_USBSER_PRODUCTID=0xa4a6 -CONFIG_USBSERIAL_RXBUFSIZE=512 -CONFIG_USBSERIAL_TXBUFSIZE=512 +CONFIG_USBSER_VENDORSTR="Nuttx" +CONFIG_USBSER_PRODUCTSTR="USBdev Serial" +CONFIG_USBSER_RXBUFSIZE=512 +CONFIG_USBSER_TXBUFSIZE=512 # # USB Device Zero Configuration -# CONFIG_USBSER_VENDORID +# CONFIG_USBZERO_VENDORID # The vendor ID code -# CONFIG_USBSER_PRODUCTID +# CONFIG_USBZERO_PRODUCTID # The product ID code CONFIG_USBZERO_VENDORID=0x0525 CONFIG_USBZERO_PRODUCTID=0xa4a0 diff --git a/nuttx/configs/ntosd-dm320/ostest/defconfig b/nuttx/configs/ntosd-dm320/ostest/defconfig index ecb23733f..54d71af12 100644 --- a/nuttx/configs/ntosd-dm320/ostest/defconfig +++ b/nuttx/configs/ntosd-dm320/ostest/defconfig @@ -356,34 +356,32 @@ CONFIG_DM320_USBDEV_DMA=n # # USB Serial Device Configuration # -# CONFIG_USBSERIAL_EPOUT -# CONFIG_USBSERIAL_EPIN -# CONFIG_USBSERIAL_NWRREQS -# The number of write requests that can be in flight -# CONFIG_USBSERIAL_NRDREQS -# The number of read requests that can be in flight -# CONFIG_USBSERIAL_RXBUFSIZE -# Size of the serial receive buffer -# CONFIG_USBSERIAL_TXBUFSIZE -# Size of the serial transmit buffer -# CONFIG_USBSER_VENDORID -# The vendor ID code -# CONFIG_USBSER_PRODUCTID -# The product ID code -CONFIG_USBSERIAL_EPOUT=1 -CONFIG_USBSERIAL_EPIN=2 -CONFIG_USBSERIAL_NWRREQS=4 -CONFIG_USBSERIAL_NRDREQS=4 +# CONFIG_USBSER_EPOUT and CONFIG_USBSER_EPIN +# Logical endoint addresses +# CONFIG_USBSER_NWRREQS and CONFIG_USBSER_NRDREQS +# The number of write/read requests that can be in flight +# CONFIG_USBSER_VENDORID and CONFIG_USBSER_VENDORSTR +# The vendor ID code/string +# CONFIG_USBSER_PRODUCTID and CONFIG_USBSER_PRODUCTSTR +# The product ID code/string +# CONFIG_USBSER_RXBUFSIZE and CONFIG_USBSER_TXBUFSIZE +# Size of the serial receive/transmit buffers +CONFIG_USBSER_EPOUT=1 +CONFIG_USBSER_EPIN=2 +CONFIG_USBSER_NWRREQS=4 +CONFIG_USBSER_NRDREQS=4 CONFIG_USBSER_VENDORID=0x0525 CONFIG_USBSER_PRODUCTID=0xa4a6 -CONFIG_USBSERIAL_RXBUFSIZE=512 -CONFIG_USBSERIAL_TXBUFSIZE=512 +CONFIG_USBSER_VENDORSTR="Nuttx" +CONFIG_USBSER_PRODUCTSTR="USBdev Serial" +CONFIG_USBSER_RXBUFSIZE=512 +CONFIG_USBSER_TXBUFSIZE=512 # # USB Device Zero Configuration -# CONFIG_USBSER_VENDORID +# CONFIG_USBZERO_VENDORID # The vendor ID code -# CONFIG_USBSER_PRODUCTID +# CONFIG_USBZERO_PRODUCTID # The product ID code CONFIG_USBZERO_VENDORID=0x0525 CONFIG_USBZERO_PRODUCTID=0xa4a0 diff --git a/nuttx/configs/ntosd-dm320/udp/defconfig b/nuttx/configs/ntosd-dm320/udp/defconfig index bd3da28ef..b3c0633f9 100644 --- a/nuttx/configs/ntosd-dm320/udp/defconfig +++ b/nuttx/configs/ntosd-dm320/udp/defconfig @@ -356,34 +356,32 @@ CONFIG_DM320_USBDEV_DMA=n # # USB Serial Device Configuration # -# CONFIG_USBSERIAL_EPOUT -# CONFIG_USBSERIAL_EPIN -# CONFIG_USBSERIAL_NWRREQS -# The number of write requests that can be in flight -# CONFIG_USBSERIAL_NRDREQS -# The number of read requests that can be in flight -# CONFIG_USBSERIAL_RXBUFSIZE -# Size of the serial receive buffer -# CONFIG_USBSERIAL_TXBUFSIZE -# Size of the serial transmit buffer -# CONFIG_USBSER_VENDORID -# The vendor ID code -# CONFIG_USBSER_PRODUCTID -# The product ID code -CONFIG_USBSERIAL_EPOUT=1 -CONFIG_USBSERIAL_EPIN=2 -CONFIG_USBSERIAL_NWRREQS=4 -CONFIG_USBSERIAL_NRDREQS=4 +# CONFIG_USBSER_EPOUT and CONFIG_USBSER_EPIN +# Logical endoint addresses +# CONFIG_USBSER_NWRREQS and CONFIG_USBSER_NRDREQS +# The number of write/read requests that can be in flight +# CONFIG_USBSER_VENDORID and CONFIG_USBSER_VENDORSTR +# The vendor ID code/string +# CONFIG_USBSER_PRODUCTID and CONFIG_USBSER_PRODUCTSTR +# The product ID code/string +# CONFIG_USBSER_RXBUFSIZE and CONFIG_USBSER_TXBUFSIZE +# Size of the serial receive/transmit buffers +CONFIG_USBSER_EPOUT=1 +CONFIG_USBSER_EPIN=2 +CONFIG_USBSER_NWRREQS=4 +CONFIG_USBSER_NRDREQS=4 CONFIG_USBSER_VENDORID=0x0525 CONFIG_USBSER_PRODUCTID=0xa4a6 -CONFIG_USBSERIAL_RXBUFSIZE=512 -CONFIG_USBSERIAL_TXBUFSIZE=512 +CONFIG_USBSER_VENDORSTR="Nuttx" +CONFIG_USBSER_PRODUCTSTR="USBdev Serial" +CONFIG_USBSER_RXBUFSIZE=512 +CONFIG_USBSER_TXBUFSIZE=512 # # USB Device Zero Configuration -# CONFIG_USBSER_VENDORID +# CONFIG_USBZERO_VENDORID # The vendor ID code -# CONFIG_USBSER_PRODUCTID +# CONFIG_USBZERO_PRODUCTID # The product ID code CONFIG_USBZERO_VENDORID=0x0525 CONFIG_USBZERO_PRODUCTID=0xa4a0 diff --git a/nuttx/configs/ntosd-dm320/uip/defconfig b/nuttx/configs/ntosd-dm320/uip/defconfig index f0066d33f..ace6d935a 100644 --- a/nuttx/configs/ntosd-dm320/uip/defconfig +++ b/nuttx/configs/ntosd-dm320/uip/defconfig @@ -356,34 +356,32 @@ CONFIG_DM320_USBDEV_DMA=n # # USB Serial Device Configuration # -# CONFIG_USBSERIAL_EPOUT -# CONFIG_USBSERIAL_EPIN -# CONFIG_USBSERIAL_NWRREQS -# The number of write requests that can be in flight -# CONFIG_USBSERIAL_NRDREQS -# The number of read requests that can be in flight -# CONFIG_USBSERIAL_RXBUFSIZE -# Size of the serial receive buffer -# CONFIG_USBSERIAL_TXBUFSIZE -# Size of the serial transmit buffer -# CONFIG_USBSER_VENDORID -# The vendor ID code -# CONFIG_USBSER_PRODUCTID -# The product ID code -CONFIG_USBSERIAL_EPOUT=1 -CONFIG_USBSERIAL_EPIN=2 -CONFIG_USBSERIAL_NWRREQS=4 -CONFIG_USBSERIAL_NRDREQS=4 +# CONFIG_USBSER_EPOUT and CONFIG_USBSER_EPIN +# Logical endoint addresses +# CONFIG_USBSER_NWRREQS and CONFIG_USBSER_NRDREQS +# The number of write/read requests that can be in flight +# CONFIG_USBSER_VENDORID and CONFIG_USBSER_VENDORSTR +# The vendor ID code/string +# CONFIG_USBSER_PRODUCTID and CONFIG_USBSER_PRODUCTSTR +# The product ID code/string +# CONFIG_USBSER_RXBUFSIZE and CONFIG_USBSER_TXBUFSIZE +# Size of the serial receive/transmit buffers +CONFIG_USBSER_EPOUT=1 +CONFIG_USBSER_EPIN=2 +CONFIG_USBSER_NWRREQS=4 +CONFIG_USBSER_NRDREQS=4 CONFIG_USBSER_VENDORID=0x0525 CONFIG_USBSER_PRODUCTID=0xa4a6 -CONFIG_USBSERIAL_RXBUFSIZE=512 -CONFIG_USBSERIAL_TXBUFSIZE=512 +CONFIG_USBSER_VENDORSTR="Nuttx" +CONFIG_USBSER_PRODUCTSTR="USBdev Serial" +CONFIG_USBSER_RXBUFSIZE=512 +CONFIG_USBSER_TXBUFSIZE=512 # # USB Device Zero Configuration -# CONFIG_USBSER_VENDORID +# CONFIG_USBZERO_VENDORID # The vendor ID code -# CONFIG_USBSER_PRODUCTID +# CONFIG_USBZERO_PRODUCTID # The product ID code CONFIG_USBZERO_VENDORID=0x0525 CONFIG_USBZERO_PRODUCTID=0xa4a0 diff --git a/nuttx/include/nuttx/usbdev.h b/nuttx/include/nuttx/usbdev.h index 0bf9afb23..8f26628be 100644 --- a/nuttx/include/nuttx/usbdev.h +++ b/nuttx/include/nuttx/usbdev.h @@ -53,39 +53,39 @@ * the 'desc' structure after returning */ -#define EP_CONFIGURE(ep,desc) ep->ops->configure(ep,desc) +#define EP_CONFIGURE(ep,desc) (ep)->ops->configure(ep,desc) /* The endpoint will no longer be used */ -#define EP_DISABLE(ep) ep->ops->disable(ep) +#define EP_DISABLE(ep) (ep)->ops->disable(ep) /* Allocate/free I/O requests */ -#define EP_ALLOCREQ(ep,nytes) ep->ops->allocreq(ep) -#define EP_FREEREQ(ep,buff) ep->ops->freereq(ep,req) +#define EP_ALLOCREQ(ep) (ep)->ops->allocreq(ep) +#define EP_FREEREQ(ep,req) (ep)->ops->freereq(ep,req) /* Allocate/free an I/O buffer */ #ifdef CONFIG_ARCH_USBDEV_DMA -# define EP_ALLOCBUFFER(ep,nytes) ep->ops->alloc(ep,nbytes) -# define EP_FREEBUFFER(ep,buff) ep->ops->free(ep,buf) +# define EP_ALLOCBUFFER(ep,nb) (ep)->ops->alloc(ep,nb) +# define EP_FREEBUFFER(ep,buff) (ep)->ops->free(ep,buf) #else -# define EP_ALLOCBUFFER(ep,nytes) malloc(nbytes) -# define EP_FREEBUFFER(ep,buff) free(buf) +# define EP_ALLOCBUFFER(ep,nb) malloc(nb) +# define EP_FREEBUFFER(ep,buf) free(buf) #endif /* Submit an I/O request to the endpoint */ -#define EP_SUBMIT(ep,req) ep->ops->submit(ep,req) +#define EP_SUBMIT(ep,req) (ep)->ops->submit(ep,req) /* Cancel an I/O request previously sent to an endpoint */ -#define EP_CANCEL(ep,req) ep->ops->cancel(ep,req) +#define EP_CANCEL(ep,req) (ep)->ops->cancel(ep,req) /* Stall or resume an endpoint */ -#define EP_STALL(ep) ep->ops->stall(ep,FALSE) -#define EP_RESUME(ep) ep->ops->stall(ep,TRUE) +#define EP_STALL(ep) (ep)->ops->stall(ep,FALSE) +#define EP_RESUME(ep) (ep)->ops->stall(ep,TRUE) /* USB Device Driver Helpers ********************************************************/ @@ -98,45 +98,45 @@ * USB_EP_ATTR_XFER_INT} */ -#define DEV_ALLOCEP(dev,epno,in,type) dev->ops->allocep(dev, epphy, in, type) +#define DEV_ALLOCEP(dev,ep,in,type) (dev)->ops->allocep(dev,ep,in,type) /* Release an endpoint */ -#define DEV_FREEP(dev,epno,in) dev->ops->allocep(dev, ep) +#define DEV_FREEEP(dev,ep) (dev)->ops->freeep(dev,ep) /* Returns the current frame number */ -#define DEV_GETFRAME(dev) dev->ops->getframe(dev) +#define DEV_GETFRAME(dev) (dev)->ops->getframe(dev) /* Tries to wake up the host connected to this device */ -#define DEV_WAKEUP(dev) dev->ops->wakeup(dev) +#define DEV_WAKEUP(dev) (dev)->ops->wakeup(dev) /* Sets the device selfpowered feature */ -#define DEV_SETSELFPOWERED(dev) dev->ops->selfpowered(dev, TRUE) +#define DEV_SETSELFPOWERED(dev) (dev)->ops->selfpowered(dev,TRUE) /* Clears the device selfpowered feature */ -#define DEV_CLRSELFPOWERED(dev) dev->ops->selfpowered(dev, FALSE) +#define DEV_CLRSELFPOWERED(dev) (dev)->ops->selfpowered(dev, FALSE) /* Software-controlled connect to USB host */ -#define DEV_CONNECT(dev) dev->ops->pullup ? dev->ops->pullup(dev, TRUE) : -EOPNOTSUPP +#define DEV_CONNECT(dev) (dev)->ops->pullup ? (dev)->ops->pullup(dev,TRUE) : -EOPNOTSUPP /* Software-controlled disconnect from USB host */ -#define DEV_DISCONNECT(dev) dev->ops->pullup ? dev->ops->pullup(dev, FALSE) : -EOPNOTSUPP +#define DEV_DISCONNECT(dev) (dev)->ops->pullup ? (dev)->ops->pullup(dev,FALSE) : -EOPNOTSUPP /* USB Class Driver Helpsers ********************************************************/ /* Invoked when the driver is bound to a USB device driver */ -#define CLASS_BIND(drvr,dev) (drvr)->ops.bind(dev, drvr) +#define CLASS_BIND(drvr,dev) (drvr)->ops->bind(dev, drvr) /* Invoked when the driver is unbound from a USB device driver */ -#define CLASS_UNBIND(drvr,dev) (drvr)->ops.unbind(dev) +#define CLASS_UNBIND(drvr,dev) (drvr)->ops->unbind(dev) /* Invoked after all transfers have been stopped, when the host is disconnected. */ @@ -144,23 +144,23 @@ /* Invoked for ep0 control requests */ -#define CLASS_SETUP(drvr,dev,req) (drvr)->ops.setup(dev, req) +#define CLASS_SETUP(drvr,dev,ctrl) (drvr)->ops->setup(dev, ctrl) /* Invoked on USB suspend. */ -#define CLASS_SUSPEND(drvr,dev) (drvr)->ops.suspend ? (drvr)->ops->suspend(dev) : (void) +#define CLASS_SUSPEND(drvr,dev) (drvr)->ops->suspend ? (drvr)->ops->suspend(dev) : (void) /* Invoked on USB resume */ -#define CLASS_RESUME(drvr,dev) (drvr)->ops.resume ? (drvr)->ops->resume(dev) : (void) +#define CLASS_RESUME(drvr,dev) (drvr)->ops->resume ? (drvr)->ops->resume(dev) : (void) /* Device speeds */ -#define USB_SPEED_UNKNOWN 0 /* Transfer rate not yet set */ -#define USB_SPEED_LOW 1 /* USB 1.1 */ -#define USB_SPEED_FULL 2 /* USB 1.1 */ -#define USB_SPEED_HIGH 3 /* USB 2.0 */ -#define USB_SPEED_VARIABLE 4 /* Wireless USB 2.5 */ +#define USB_SPEED_UNKNOWN 0 /* Transfer rate not yet set */ +#define USB_SPEED_LOW 1 /* USB 1.1 */ +#define USB_SPEED_FULL 2 /* USB 1.1 */ +#define USB_SPEED_HIGH 3 /* USB 2.0 */ +#define USB_SPEED_VARIABLE 4 /* Wireless USB 2.5 */ /************************************************************************************ * Public Types @@ -263,7 +263,7 @@ struct usbdevclass_driverops_s { int (*bind)(FAR struct usbdev_s *dev, FAR struct usbdevclass_driver_s *driver); void (*unbind)(FAR struct usbdev_s *dev); - int (*setup)(FAR struct usbdev_s *dev, const struct usb_ctrlreq_s *req); + int (*setup)(FAR struct usbdev_s *dev, const struct usb_ctrlreq_s *ctrl); void (*disconnect)(FAR struct usbdev_s *dev); void (*suspend)(FAR struct usbdev_s *dev); void (*resume)(FAR struct usbdev_s *dev); @@ -271,7 +271,7 @@ struct usbdevclass_driverops_s struct usbdevclass_driver_s { - const struct usbdevclass_driverops_s ops; + const struct usbdevclass_driverops_s *ops; ubyte speed; /* Highest speed that the driver handles */ }; -- cgit v1.2.3