Fixes for class driver i/f
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@967 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
1d38a19877
commit
e55508240a
@ -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;
|
||||
|
@ -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
|
||||
|
||||
#
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,15 +144,15 @@
|
||||
|
||||
/* 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 */
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user