mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
Misc fixes from test and integration
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@997 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -129,28 +129,27 @@
|
|||||||
#define LPC214X_TRACEERR_BADGETCONFIG 0x0007
|
#define LPC214X_TRACEERR_BADGETCONFIG 0x0007
|
||||||
#define LPC214X_TRACEERR_BADGETSETDESC 0x0008
|
#define LPC214X_TRACEERR_BADGETSETDESC 0x0008
|
||||||
#define LPC214X_TRACEERR_BADGETSTATUS 0x0009
|
#define LPC214X_TRACEERR_BADGETSTATUS 0x0009
|
||||||
#define LPC214X_TRACEERR_BADREQUEST 0x000a
|
#define LPC214X_TRACEERR_BADSETADDRESS 0x000a
|
||||||
#define LPC214X_TRACEERR_BADSETADDRESS 0x000b
|
#define LPC214X_TRACEERR_BADSETCONFIG 0x000b
|
||||||
#define LPC214X_TRACEERR_BADSETCONFIG 0x000c
|
#define LPC214X_TRACEERR_BADSETFEATURE 0x000c
|
||||||
#define LPC214X_TRACEERR_BADSETFEATURE 0x000d
|
#define LPC214X_TRACEERR_BINDFAILED 0x000d
|
||||||
#define LPC214X_TRACEERR_BINDFAILED 0x000e
|
#define LPC214X_TRACEERR_DMABUSY 0x000e
|
||||||
#define LPC214X_TRACEERR_DMABUSY 0x000f
|
#define LPC214X_TRACEERR_DRIVER 0x000f
|
||||||
#define LPC214X_TRACEERR_DRIVER 0x0010
|
#define LPC214X_TRACEERR_DRIVERREGISTERED 0x0010
|
||||||
#define LPC214X_TRACEERR_DRIVERREGISTERED 0x0011
|
#define LPC214X_TRACEERR_EP0INSTALLED 0x0011
|
||||||
#define LPC214X_TRACEERR_EP0INSTALLED 0x0012
|
#define LPC214X_TRACEERR_EP0OUTSTALLED 0x0012
|
||||||
#define LPC214X_TRACEERR_EP0OUTSTALLED 0x0013
|
#define LPC214X_TRACEERR_EP0SETUPSTALLED 0x0013
|
||||||
#define LPC214X_TRACEERR_EP0SETUPSTALLED 0x0014
|
#define LPC214X_TRACEERR_EPINNULLPACKET 0x0014
|
||||||
#define LPC214X_TRACEERR_EPINNULLPACKET 0x0015
|
#define LPC214X_TRACEERR_EPOUTNULLPACKET 0x0015
|
||||||
#define LPC214X_TRACEERR_EPOUTNULLPACKET 0x0016
|
#define LPC214X_TRACEERR_EPREAD 0x0016
|
||||||
#define LPC214X_TRACEERR_EPREAD 0x0017
|
#define LPC214X_TRACEERR_INVALIDCMD 0x0017
|
||||||
#define LPC214X_TRACEERR_INVALIDCMD 0x0018
|
#define LPC214X_TRACEERR_INVALIDCTRLREQ 0x0018
|
||||||
#define LPC214X_TRACEERR_INVALIDCTRLREQ 0x0019
|
#define LPC214X_TRACEERR_INVALIDPARMS 0x0019
|
||||||
#define LPC214X_TRACEERR_INVALIDPARMS 0x001a
|
#define LPC214X_TRACEERR_IRQREGISTRATION 0x001a
|
||||||
#define LPC214X_TRACEERR_IRQREGISTRATION 0x001b
|
#define LPC214X_TRACEERR_NODMADESC 0x001b
|
||||||
#define LPC214X_TRACEERR_NODMADESC 0x001c
|
#define LPC214X_TRACEERR_NOEP 0x001c
|
||||||
#define LPC214X_TRACEERR_NOEP 0x001d
|
#define LPC214X_TRACEERR_NOTCONFIGURED 0x001d
|
||||||
#define LPC214X_TRACEERR_NOTCONFIGURED 0x001e
|
#define LPC214X_TRACEERR_REQABORTED 0x001e
|
||||||
#define LPC214X_TRACEERR_REQABORTED 0x001f
|
|
||||||
|
|
||||||
/* Trace interrupt codes */
|
/* Trace interrupt codes */
|
||||||
|
|
||||||
@@ -356,9 +355,8 @@ struct lpc214x_usbdev_s
|
|||||||
ubyte paddrset:1; /* 1: Peripheral addr has been set */
|
ubyte paddrset:1; /* 1: Peripheral addr has been set */
|
||||||
ubyte attached:1; /* 1: Host attached */
|
ubyte attached:1; /* 1: Host attached */
|
||||||
ubyte rxpending:1; /* 1: RX pending */
|
ubyte rxpending:1; /* 1: RX pending */
|
||||||
uint32 epavail; /* Available endpoints */
|
|
||||||
uint32 softprio; /* Bitset of high priority interrupts */
|
uint32 softprio; /* Bitset of high priority interrupts */
|
||||||
uint32 wravail; /* Bitset of available endpoints */
|
uint32 epavail; /* Bitset of available endpoints */
|
||||||
#ifdef CONFIG_LPC214X_USBDEV_FRAME_INTERRUPT
|
#ifdef CONFIG_LPC214X_USBDEV_FRAME_INTERRUPT
|
||||||
uint32 sof; /* Last start-of-frame */
|
uint32 sof; /* Last start-of-frame */
|
||||||
#endif
|
#endif
|
||||||
@@ -2186,7 +2184,7 @@ static int lpc214x_usbinterrupt(int irq, FAR void *context)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uvdbg("Pending interrupt\n");
|
uvdbg("Pending data on OUT endpoint\n");
|
||||||
priv->rxpending = 1;
|
priv->rxpending = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2650,33 +2648,30 @@ static int lpc214x_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
|
|||||||
|
|
||||||
else if (LPC214X_EPPHYIN(privep->epphy))
|
else if (LPC214X_EPPHYIN(privep->epphy))
|
||||||
{
|
{
|
||||||
/* Add the new request to the request queue for the endpoint */
|
/* Add the new request to the request queue for the IN endpoint */
|
||||||
|
|
||||||
lpc214x_rqenqueue(privep, privreq);
|
lpc214x_rqenqueue(privep, privreq);
|
||||||
usbtrace(TRACE_INREQQUEUED(privep->epphy), privreq->req.len);
|
usbtrace(TRACE_INREQQUEUED(privep->epphy), privreq->req.len);
|
||||||
ret = lpc214x_wrrequest(privep);
|
ret = lpc214x_wrrequest(privep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle OUT (host-to-device) requests -- but only if one is expected*/
|
/* Handle OUT (host-to-device) requests */
|
||||||
|
|
||||||
else if (priv->rxpending)
|
else
|
||||||
{
|
{
|
||||||
/* Add the new request to the request queue for the endpoint */
|
/* Add the new request to the request queue for the OUT endpoint */
|
||||||
|
|
||||||
privep->txnullpkt = 0;
|
privep->txnullpkt = 0;
|
||||||
lpc214x_rqenqueue(privep, privreq);
|
lpc214x_rqenqueue(privep, privreq);
|
||||||
usbtrace(TRACE_OUTREQQUEUED(privep->epphy), privreq->req.len);
|
usbtrace(TRACE_OUTREQQUEUED(privep->epphy), privreq->req.len);
|
||||||
ret = lpc214x_rdrequest(privep);
|
|
||||||
priv->rxpending = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unexpected or illformed request */
|
/* This there a incoming data pending the availability of a request? */
|
||||||
|
|
||||||
else
|
if (priv->rxpending)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_DEVERROR(LPC214X_TRACEERR_BADREQUEST), (uint16)privep->epphy);
|
ret = lpc214x_rdrequest(privep);
|
||||||
lpc214x_abortrequest(privep, privreq, -EBUSY);
|
priv->rxpending = 0;
|
||||||
ret = -EINVAL;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
irqrestore(flags);
|
irqrestore(flags);
|
||||||
@@ -2795,7 +2790,7 @@ static FAR struct usbdev_ep_s *lcp214x_allocep(FAR struct usbdev_s *dev, ubyte e
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case USB_EP_ATTR_XFER_ISOC: /* Isochronous endpoint */
|
case USB_EP_ATTR_XFER_ISOC: /* Isochronous endpoint */
|
||||||
epset &= LPC214X_EPBULKSET;
|
epset &= LPC214X_EPISOCSET;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USB_EP_ATTR_XFER_CONTROL: /* Control endpoint -- not a valid choice */
|
case USB_EP_ATTR_XFER_CONTROL: /* Control endpoint -- not a valid choice */
|
||||||
@@ -2819,11 +2814,11 @@ static FAR struct usbdev_ep_s *lcp214x_allocep(FAR struct usbdev_s *dev, ubyte e
|
|||||||
for (epndx = 2; epndx < LPC214X_NPHYSENDPOINTS; epndx++)
|
for (epndx = 2; epndx < LPC214X_NPHYSENDPOINTS; epndx++)
|
||||||
{
|
{
|
||||||
uint32 bit = 1 << epndx;
|
uint32 bit = 1 << epndx;
|
||||||
if ((epset & bit) == 0)
|
if ((epset & bit) != 0)
|
||||||
{
|
{
|
||||||
/* Mark the endpoint no longer available */
|
/* Mark the endpoint no longer available */
|
||||||
|
|
||||||
priv->wravail &= ~bit;
|
priv->epavail &= ~bit;
|
||||||
irqrestore(flags);
|
irqrestore(flags);
|
||||||
|
|
||||||
/* And return the pointer to the standard endpoint structure */
|
/* And return the pointer to the standard endpoint structure */
|
||||||
@@ -2861,7 +2856,7 @@ static void lpc214x_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
|
|||||||
/* Mark the endpoint as available */
|
/* Mark the endpoint as available */
|
||||||
|
|
||||||
flags = irqsave();
|
flags = irqsave();
|
||||||
priv->wravail &= ~(1 << privep->epphy);
|
priv->epavail |= (1 << privep->epphy);
|
||||||
irqrestore(flags);
|
irqrestore(flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2999,7 +2994,7 @@ void up_usbinitialize(void)
|
|||||||
memset(priv, 0, sizeof(struct lpc214x_usbdev_s));
|
memset(priv, 0, sizeof(struct lpc214x_usbdev_s));
|
||||||
priv->usbdev.ops = &g_devops;
|
priv->usbdev.ops = &g_devops;
|
||||||
priv->usbdev.ep0 = &priv->eplist[LPC214X_EP0_IN].ep;
|
priv->usbdev.ep0 = &priv->eplist[LPC214X_EP0_IN].ep;
|
||||||
priv->wravail = LPC214X_EPALLSET;
|
priv->epavail = LPC214X_EPALLSET;
|
||||||
|
|
||||||
/* Initialize the endpoint list */
|
/* Initialize the endpoint list */
|
||||||
|
|
||||||
|
|||||||
@@ -196,6 +196,21 @@
|
|||||||
# define max(a,b) ((a)>(b)?(a):(b))
|
# define max(a,b) ((a)>(b)?(a):(b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Trace values *************************************************************/
|
||||||
|
|
||||||
|
#define USBSER_CLASSAPI_SETUP TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_SETUP)
|
||||||
|
#define USBSER_CLASSAPI_SHUTDOWN TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_SHUTDOWN)
|
||||||
|
#define USBSER_CLASSAPI_ATTACH TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_ATTACH)
|
||||||
|
#define USBSER_CLASSAPI_DETACH TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_DETACH)
|
||||||
|
#define USBSER_CLASSAPI_IOCTL TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_IOCTL)
|
||||||
|
#define USBSER_CLASSAPI_RECEIVE TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_RECEIVE)
|
||||||
|
#define USBSER_CLASSAPI_RXINT TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_RXINT)
|
||||||
|
#define USBSER_CLASSAPI_RXAVAILABLE TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_RXAVAILABLE)
|
||||||
|
#define USBSER_CLASSAPI_SEND TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_SEND)
|
||||||
|
#define USBSER_CLASSAPI_TXINT TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_TXINT)
|
||||||
|
#define USBSER_CLASSAPI_TXREADY TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_TXREADY)
|
||||||
|
#define USBSER_CLASSAPI_TXEMPTY TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_TXEMPTY)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -940,14 +955,16 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, ubyte config)
|
|||||||
#if CONFIG_DEBUG
|
#if CONFIG_DEBUG
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
{
|
{
|
||||||
return -ENODEV;
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INVALIDARG), 0);
|
||||||
|
return -EIO;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (config == priv->config)
|
if (config == priv->config)
|
||||||
{
|
{
|
||||||
/* Already configured */
|
/* Already configured -- Do nothing */
|
||||||
|
|
||||||
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_ALREADYCONFIGURED), 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -957,15 +974,17 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, ubyte config)
|
|||||||
|
|
||||||
/* Was this a request to simply discard the current configuration? */
|
/* Was this a request to simply discard the current configuration? */
|
||||||
|
|
||||||
if (config != USBSER_CONFIGIDNONE)
|
if (config == USBSER_CONFIGIDNONE)
|
||||||
{
|
{
|
||||||
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_CONFIGNONE), 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The only configuration that we accept is ourt BULK configuration */
|
/* We only accept one configuration */
|
||||||
|
|
||||||
if (config != USBSER_CONFIGID)
|
if (config != USBSER_CONFIGID)
|
||||||
{
|
{
|
||||||
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_CONFIGIDBAD), 0);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -974,7 +993,7 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, ubyte config)
|
|||||||
priv->epintin = DEV_ALLOCEP(dev, 0, TRUE, USB_EP_ATTR_XFER_INT);
|
priv->epintin = DEV_ALLOCEP(dev, 0, TRUE, USB_EP_ATTR_XFER_INT);
|
||||||
if (!priv->epintin)
|
if (!priv->epintin)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INALLOCEPFAIL), 0);
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_EPINTINALLOCFAIL), 0);
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
@@ -982,7 +1001,7 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, ubyte config)
|
|||||||
ret = EP_CONFIGURE(priv->epintin, &g_epintindesc);
|
ret = EP_CONFIGURE(priv->epintin, &g_epintindesc);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INCONFIGEPFAIL), 0);
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_EPINTINCONFIGFAIL), 0);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -993,7 +1012,7 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, ubyte config)
|
|||||||
priv->epbulkin = DEV_ALLOCEP(dev, 0, TRUE, USB_EP_ATTR_XFER_BULK);
|
priv->epbulkin = DEV_ALLOCEP(dev, 0, TRUE, USB_EP_ATTR_XFER_BULK);
|
||||||
if (!priv->epbulkin)
|
if (!priv->epbulkin)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INALLOCEPFAIL), 0);
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_EPBULKINALLOCFAIL), 0);
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
@@ -1015,7 +1034,7 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, ubyte config)
|
|||||||
#endif
|
#endif
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INCONFIGEPFAIL), 0);
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_EPBULKINCONFIGFAIL), 0);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1026,7 +1045,7 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, ubyte config)
|
|||||||
priv->epbulkout = DEV_ALLOCEP(dev, 0, FALSE, USB_EP_ATTR_XFER_BULK);
|
priv->epbulkout = DEV_ALLOCEP(dev, 0, FALSE, USB_EP_ATTR_XFER_BULK);
|
||||||
if (!priv->epbulkout)
|
if (!priv->epbulkout)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_OUTALLOCEPFAIL), 0);
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_EPBULKOUTALLOCFAIL), 0);
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
@@ -1039,7 +1058,7 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, ubyte config)
|
|||||||
#endif
|
#endif
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_OUTCONFIGEPFAIL), 0);
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_EPBULKOUTCONFIGFAIL), 0);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1308,7 +1327,7 @@ static int usbclass_setup(FAR struct usbdev_s *dev, const struct usb_ctrlreq_s *
|
|||||||
if (!dev || !dev->ep0 || !ctrl)
|
if (!dev || !dev->ep0 || !ctrl)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INVALIDARG), 0);
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INVALIDARG), 0);
|
||||||
return -EINVAL;
|
return -EIO;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
usbtrace(TRACE_CLASSSETUP, ctrl->req);
|
usbtrace(TRACE_CLASSSETUP, ctrl->req);
|
||||||
@@ -1593,18 +1612,21 @@ static int usbser_setup(FAR struct uart_dev_s *dev)
|
|||||||
{
|
{
|
||||||
struct usbser_dev_s *priv = (FAR struct usbser_dev_s*)dev->priv;
|
struct usbser_dev_s *priv = (FAR struct usbser_dev_s*)dev->priv;
|
||||||
|
|
||||||
|
usbtrace(USBSER_CLASSAPI_SETUP, 0);
|
||||||
|
|
||||||
#if CONFIG_DEBUG
|
#if CONFIG_DEBUG
|
||||||
if (!priv)
|
if (!priv)
|
||||||
{
|
{
|
||||||
return -EIO;
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INVALIDARG), 0);
|
||||||
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (priv->config == USBSER_CONFIGIDNONE)
|
if (priv->config == USBSER_CONFIGIDNONE)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_SETUPNOTCONNECTED), 0);
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_SETUPNOTCONNECTED), 0);
|
||||||
return -ENODEV;
|
return -ENOTCONN;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
priv->open = TRUE;
|
priv->open = TRUE;
|
||||||
return OK;
|
return OK;
|
||||||
@@ -1627,6 +1649,8 @@ static void usbser_shutdown(FAR struct uart_dev_s *dev)
|
|||||||
struct usbser_dev_s *priv = (FAR struct usbser_dev_s*)dev->priv;
|
struct usbser_dev_s *priv = (FAR struct usbser_dev_s*)dev->priv;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
|
usbtrace(USBSER_CLASSAPI_SHUTDOWN, 0);
|
||||||
|
|
||||||
#if CONFIG_DEBUG
|
#if CONFIG_DEBUG
|
||||||
if (!priv)
|
if (!priv)
|
||||||
{
|
{
|
||||||
@@ -1641,7 +1665,8 @@ static void usbser_shutdown(FAR struct uart_dev_s *dev)
|
|||||||
if (!priv->open)
|
if (!priv->open)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_ALREADYCLOSED), 0);
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_ALREADYCLOSED), 0);
|
||||||
goto errout;
|
irqrestore(flags);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1649,8 +1674,6 @@ static void usbser_shutdown(FAR struct uart_dev_s *dev)
|
|||||||
|
|
||||||
usbclass_resetconfig(priv);
|
usbclass_resetconfig(priv);
|
||||||
priv->open = FALSE;
|
priv->open = FALSE;
|
||||||
|
|
||||||
errout:
|
|
||||||
irqrestore(flags);
|
irqrestore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1664,6 +1687,7 @@ errout:
|
|||||||
|
|
||||||
static int usbser_attach(FAR struct uart_dev_s *dev)
|
static int usbser_attach(FAR struct uart_dev_s *dev)
|
||||||
{
|
{
|
||||||
|
usbtrace(USBSER_CLASSAPI_ATTACH, 0);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1677,6 +1701,7 @@ static int usbser_attach(FAR struct uart_dev_s *dev)
|
|||||||
|
|
||||||
static void usbser_detach(FAR struct uart_dev_s *dev)
|
static void usbser_detach(FAR struct uart_dev_s *dev)
|
||||||
{
|
{
|
||||||
|
usbtrace(USBSER_CLASSAPI_DETACH, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -1700,9 +1725,12 @@ static void usbser_rxint(FAR struct uart_dev_s *dev, boolean enable)
|
|||||||
{
|
{
|
||||||
struct usbser_dev_s *priv = (FAR struct usbser_dev_s*)dev->priv;
|
struct usbser_dev_s *priv = (FAR struct usbser_dev_s*)dev->priv;
|
||||||
|
|
||||||
|
usbtrace(USBSER_CLASSAPI_RXINT, (uint16)enable);
|
||||||
|
|
||||||
#if CONFIG_DEBUG
|
#if CONFIG_DEBUG
|
||||||
if (!priv)
|
if (!priv)
|
||||||
{
|
{
|
||||||
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INVALIDARG), 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1739,9 +1767,12 @@ static void usbser_txint(FAR struct uart_dev_s *dev, boolean enable)
|
|||||||
{
|
{
|
||||||
struct usbser_dev_s *priv = (FAR struct usbser_dev_s*)dev->priv;
|
struct usbser_dev_s *priv = (FAR struct usbser_dev_s*)dev->priv;
|
||||||
|
|
||||||
|
usbtrace(USBSER_CLASSAPI_TXINT, (uint16)enable);
|
||||||
|
|
||||||
#if CONFIG_DEBUG
|
#if CONFIG_DEBUG
|
||||||
if (!priv)
|
if (!priv)
|
||||||
{
|
{
|
||||||
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INVALIDARG), 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1776,10 +1807,13 @@ static boolean usbser_txempty(FAR struct uart_dev_s *dev)
|
|||||||
{
|
{
|
||||||
struct usbser_dev_s *priv = (FAR struct usbser_dev_s*)dev->priv;
|
struct usbser_dev_s *priv = (FAR struct usbser_dev_s*)dev->priv;
|
||||||
|
|
||||||
|
usbtrace(USBSER_CLASSAPI_TXEMPTY, 0);
|
||||||
|
|
||||||
#if CONFIG_DEBUG
|
#if CONFIG_DEBUG
|
||||||
if (!priv)
|
if (!priv)
|
||||||
{
|
{
|
||||||
return TRUE;
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INVALIDARG), 0);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1815,6 +1849,7 @@ int usbdev_serialinitialize(int minor)
|
|||||||
alloc = (FAR struct usbser_alloc_s*)malloc(sizeof(struct usbser_alloc_s));
|
alloc = (FAR struct usbser_alloc_s*)malloc(sizeof(struct usbser_alloc_s));
|
||||||
if (!alloc)
|
if (!alloc)
|
||||||
{
|
{
|
||||||
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_ALLOCDEVSTRUCT), 0);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1845,6 +1880,7 @@ int usbdev_serialinitialize(int minor)
|
|||||||
priv->serdev.xmit.size = CONFIG_USBSER_RXBUFSIZE;
|
priv->serdev.xmit.size = CONFIG_USBSER_RXBUFSIZE;
|
||||||
priv->serdev.xmit.buffer = priv->rxbuffer;
|
priv->serdev.xmit.buffer = priv->rxbuffer;
|
||||||
priv->serdev.ops = &g_uartops;
|
priv->serdev.ops = &g_uartops;
|
||||||
|
priv->serdev.priv = priv;
|
||||||
|
|
||||||
/* Initialize the USB class driver structure */
|
/* Initialize the USB class driver structure */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user