Partial review of last PR

This commit is contained in:
Gregory Nutt 2016-07-11 16:28:54 -06:00
parent a48fb1e41c
commit c80b627e8d

View File

@ -1007,6 +1007,7 @@ static bool stm32l4_req_addlast(FAR struct stm32l4_ep_s *privep,
privep->tail->flink = req;
privep->tail = req;
}
return is_empty;
}
@ -1605,7 +1606,8 @@ static void stm32l4_epout_complete(FAR struct stm32l4_usbdev_s *priv,
*
****************************************************************************/
static inline void stm32l4_ep0out_receive(FAR struct stm32l4_ep_s *privep, int bcnt)
static inline void stm32l4_ep0out_receive(FAR struct stm32l4_ep_s *privep,
int bcnt)
{
FAR struct stm32l4_usbdev_s *priv;
@ -1663,7 +1665,8 @@ static inline void stm32l4_ep0out_receive(FAR struct stm32l4_ep_s *privep, int b
*
****************************************************************************/
static inline void stm32l4_epout_receive(FAR struct stm32l4_ep_s *privep, int bcnt)
static inline void stm32l4_epout_receive(FAR struct stm32l4_ep_s *privep,
int bcnt)
{
struct stm32l4_req_s *privreq;
uint8_t *dest;
@ -2627,7 +2630,8 @@ static inline void stm32l4_ep0out_setup(struct stm32l4_usbdev_s *priv)
*
****************************************************************************/
static inline void stm32l4_epout(FAR struct stm32l4_usbdev_s *priv, uint8_t epno)
static inline void stm32l4_epout(FAR struct stm32l4_usbdev_s *priv,
uint8_t epno)
{
FAR struct stm32l4_ep_s *privep;
@ -2755,7 +2759,8 @@ static inline void stm32l4_epout_interrupt(FAR struct stm32l4_usbdev_s *priv)
if ((doepint & OTGFS_DOEPINT_XFRC) != 0)
{
usbtrace(TRACE_INTDECODE(STM32L4_TRACEINTID_EPOUT_XFRC), (uint16_t)doepint);
usbtrace(TRACE_INTDECODE(STM32L4_TRACEINTID_EPOUT_XFRC),
(uint16_t)doepint);
/* Clear the bit in DOEPINTn for this interrupt */
@ -2773,7 +2778,8 @@ static inline void stm32l4_epout_interrupt(FAR struct stm32l4_usbdev_s *priv)
/* REVISIT: */
if ((doepint & OTGFS_DOEPINT_EPDISD) != 0)
{
usbtrace(TRACE_INTDECODE(STM32L4_TRACEINTID_EPOUT_EPDISD), (uint16_t)doepint);
usbtrace(TRACE_INTDECODE(STM32L4_TRACEINTID_EPOUT_EPDISD),
(uint16_t)doepint);
/* Clear the bit in DOEPINTn for this interrupt */
@ -2784,7 +2790,8 @@ static inline void stm32l4_epout_interrupt(FAR struct stm32l4_usbdev_s *priv)
if ((doepint & OTGFS_DOEPINT_SETUP) != 0)
{
usbtrace(TRACE_INTDECODE(STM32L4_TRACEINTID_EPOUT_SETUP), priv->ep0state);
usbtrace(TRACE_INTDECODE(STM32L4_TRACEINTID_EPOUT_SETUP),
priv->ep0state);
/* Handle the receipt of the IN SETUP packets now (OUT setup
* packet processing may be delayed until the accompanying
@ -2795,6 +2802,7 @@ static inline void stm32l4_epout_interrupt(FAR struct stm32l4_usbdev_s *priv)
{
stm32l4_ep0out_setup(priv);
}
stm32l4_putreg(OTGFS_DOEPINT_SETUP, STM32L4_OTGFS_DOEPINT(epno));
}
}
@ -2832,7 +2840,8 @@ static inline void stm32l4_epin_runtestmode(FAR struct stm32l4_usbdev_s *priv)
*
****************************************************************************/
static inline void stm32l4_epin(FAR struct stm32l4_usbdev_s *priv, uint8_t epno)
static inline void stm32l4_epin(FAR struct stm32l4_usbdev_s *priv,
uint8_t epno)
{
FAR struct stm32l4_ep_s *privep = &priv->epin[epno];
@ -2889,7 +2898,8 @@ static inline void stm32l4_epin(FAR struct stm32l4_usbdev_s *priv, uint8_t epno)
*
****************************************************************************/
static inline void stm32l4_epin_txfifoempty(FAR struct stm32l4_usbdev_s *priv, int epno)
static inline void stm32l4_epin_txfifoempty(FAR struct stm32l4_usbdev_s *priv,
int epno)
{
FAR struct stm32l4_ep_s *privep = &priv->epin[epno];
@ -3595,7 +3605,8 @@ static int stm32l4_usbinterrupt(int irq, FAR void *context)
/* At present, there is only a single OTG FS device support. Hence it is
* pre-allocated as g_otgfsdev. However, in most code, the private data
* structure will be referenced using the 'priv' pointer (rather than the
* global data) in order to simplify any future support for multiple devices.
* global data) in order to simplify any future support for multiple
* devices.
*/
FAR struct stm32l4_usbdev_s *priv = &g_otgfsdev;
@ -3605,7 +3616,8 @@ static int stm32l4_usbinterrupt(int irq, FAR void *context)
/* Assure that we are in device mode */
DEBUGASSERT((stm32l4_getreg(STM32L4_OTGFS_GINTSTS) & OTGFS_GINTSTS_CMOD) == OTGFS_GINTSTS_DEVMODE);
DEBUGASSERT((stm32l4_getreg(STM32L4_OTGFS_GINTSTS) & OTGFS_GINTSTS_CMOD) ==
OTGFS_GINTSTS_DEVMODE);
/* Get the state of all enabled interrupts. We will do this repeatedly
* some interrupts (like RXFLVL) will generate additional interrupting
@ -3627,6 +3639,7 @@ static int stm32l4_usbinterrupt(int irq, FAR void *context)
{
break;
}
usbtrace(TRACE_INTDECODE(STM32L4_TRACEINTID_INTPENDING), (uint16_t)regval);
/* OUT endpoint interrupt. The core sets this bit to indicate that an
@ -3862,8 +3875,8 @@ static void stm32l4_disablegonak(FAR struct stm32l4_ep_s *privep)
*
****************************************************************************/
static int stm32l4_epout_configure(FAR struct stm32l4_ep_s *privep, uint8_t eptype,
uint16_t maxpacket)
static int stm32l4_epout_configure(FAR struct stm32l4_ep_s *privep,
uint8_t eptype, uint16_t maxpacket)
{
uint32_t mpsiz;
uint32_t regaddr;
@ -4417,7 +4430,8 @@ static void stm32l4_ep_freebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
*
****************************************************************************/
static int stm32l4_ep_submit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
static int stm32l4_ep_submit(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *req)
{
FAR struct stm32l4_req_s *privreq = (FAR struct stm32l4_req_s *)req;
FAR struct stm32l4_ep_s *privep = (FAR struct stm32l4_ep_s *)ep;
@ -4511,7 +4525,8 @@ static int stm32l4_ep_submit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
*
****************************************************************************/
static int stm32l4_ep_cancel(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
static int stm32l4_ep_cancel(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *req)
{
FAR struct stm32l4_ep_s *privep = (FAR struct stm32l4_ep_s *)ep;
irqstate_t flags;
@ -4874,7 +4889,8 @@ static FAR struct usbdev_ep_s *stm32l4_ep_alloc(FAR struct usbdev_s *dev,
*
****************************************************************************/
static void stm32l4_ep_free(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
static void stm32l4_ep_free(FAR struct usbdev_s *dev,
FAR struct usbdev_ep_s *ep)
{
FAR struct stm32l4_usbdev_s *priv = (FAR struct stm32l4_usbdev_s *)dev;
FAR struct stm32l4_ep_s *privep = (FAR struct stm32l4_ep_s *)ep;
@ -5032,7 +5048,8 @@ static int stm32l4_pullup(struct usbdev_s *dev, bool enable)
*
****************************************************************************/
static void stm32l4_setaddress(struct stm32l4_usbdev_s *priv, uint16_t address)
static void stm32l4_setaddress(struct stm32l4_usbdev_s *priv,
uint16_t address)
{
uint32_t regval;