Cosmetic changes after PR 94

This commit is contained in:
Sebastien Lorquet 2016-07-12 00:57:18 +02:00
parent 749b54fbda
commit 5e12d6203e
6 changed files with 279 additions and 247 deletions

View File

@ -468,7 +468,7 @@ struct stm32l4_ctrlreq_s
struct stm32l4_req_s struct stm32l4_req_s
{ {
struct usbdev_req_s req; /* Standard USB request */ struct usbdev_req_s req; /* Standard USB request */
struct stm32l4_req_s *flink; /* Supports a singly linked list */ FAR struct stm32l4_req_s *flink; /* Supports a singly linked list */
}; };
/* This is the internal representation of an endpoint */ /* This is the internal representation of an endpoint */
@ -484,9 +484,9 @@ struct stm32l4_ep_s
/* STM32-specific fields */ /* STM32-specific fields */
struct stm32l4_usbdev_s *dev; /* Reference to private driver data */ FAR struct stm32l4_usbdev_s *dev; /* Reference to private driver data */
struct stm32l4_req_s *head; /* Request list for this endpoint */ FAR struct stm32l4_req_s *head; /* Request list for this endpoint */
struct stm32l4_req_s *tail; FAR struct stm32l4_req_s *tail;
uint8_t epphy; /* Physical EP address */ uint8_t epphy; /* Physical EP address */
uint8_t eptype:2; /* Endpoint type */ uint8_t eptype:2; /* Endpoint type */
uint8_t active:1; /* 1: A request is being processed */ uint8_t active:1; /* 1: A request is being processed */
@ -509,7 +509,7 @@ struct stm32l4_usbdev_s
/* The bound device class driver */ /* The bound device class driver */
struct usbdevclass_driver_s *driver; FAR struct usbdevclass_driver_s *driver;
/* STM32-specific fields */ /* STM32-specific fields */
@ -573,13 +573,14 @@ static void stm32l4_putreg(uint32_t val, uint32_t addr);
static FAR struct stm32l4_req_s *stm32l4_req_remfirst(FAR struct stm32l4_ep_s *privep); static FAR struct stm32l4_req_s *stm32l4_req_remfirst(FAR struct stm32l4_ep_s *privep);
static bool stm32l4_req_addlast(FAR struct stm32l4_ep_s *privep, static bool stm32l4_req_addlast(FAR struct stm32l4_ep_s *privep,
FAR struct stm32l4_req_s *req); FAR struct stm32l4_req_s *req);
/* Low level data transfers and request operations *****************************/ /* Low level data transfers and request operations *****************************/
/* Special endpoint 0 data transfer logic */ /* Special endpoint 0 data transfer logic */
static void stm32l4_ep0in_setupresponse(FAR struct stm32l4_usbdev_s *priv, static void stm32l4_ep0in_setupresponse(FAR struct stm32l4_usbdev_s *priv,
FAR uint8_t *data, uint32_t nbytes); FAR uint8_t *data,
uint32_t nbytes);
static inline void stm32l4_ep0in_transmitzlp(FAR struct stm32l4_usbdev_s *priv); static inline void stm32l4_ep0in_transmitzlp(FAR struct stm32l4_usbdev_s *priv);
static void stm32l4_ep0in_activate(void); static void stm32l4_ep0in_activate(void);
@ -588,56 +589,61 @@ static void stm32l4_ep0out_ctrlsetup(FAR struct stm32l4_usbdev_s *priv);
/* IN request and TxFIFO handling */ /* IN request and TxFIFO handling */
static void stm32l4_txfifo_write(FAR struct stm32l4_ep_s *privep, static void stm32l4_txfifo_write(FAR struct stm32l4_ep_s *privep,
FAR uint8_t *buf, int nbytes); FAR uint8_t *buf, int nbytes);
static void stm32l4_epin_transfer(FAR struct stm32l4_ep_s *privep, static void stm32l4_epin_transfer(FAR struct stm32l4_ep_s *privep,
FAR uint8_t *buf, int nbytes); FAR uint8_t *buf, int nbytes);
static void stm32l4_epin_request(FAR struct stm32l4_usbdev_s *priv, static void stm32l4_epin_request(FAR struct stm32l4_usbdev_s *priv,
FAR struct stm32l4_ep_s *privep); FAR struct stm32l4_ep_s *privep);
/* OUT request and RxFIFO handling */ /* OUT request and RxFIFO handling */
static void stm32l4_rxfifo_read(FAR struct stm32l4_ep_s *privep, static void stm32l4_rxfifo_read(FAR struct stm32l4_ep_s *privep,
FAR uint8_t *dest, uint16_t len); FAR uint8_t *dest, uint16_t len);
static void stm32l4_rxfifo_discard(FAR struct stm32l4_ep_s *privep, int len); static void stm32l4_rxfifo_discard(FAR struct stm32l4_ep_s *privep,
int len);
static void stm32l4_epout_complete(FAR struct stm32l4_usbdev_s *priv, static void stm32l4_epout_complete(FAR struct stm32l4_usbdev_s *priv,
FAR struct stm32l4_ep_s *privep); FAR struct stm32l4_ep_s *privep);
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,
static inline void stm32l4_epout_receive(FAR struct stm32l4_ep_s *privep, int bcnt); int bcnt);
static inline void stm32l4_epout_receive(FAR struct stm32l4_ep_s *privep,
int bcnt);
static void stm32l4_epout_request(FAR struct stm32l4_usbdev_s *priv, static void stm32l4_epout_request(FAR struct stm32l4_usbdev_s *priv,
FAR struct stm32l4_ep_s *privep); FAR struct stm32l4_ep_s *privep);
/* General request handling */ /* General request handling */
static void stm32l4_ep_flush(FAR struct stm32l4_ep_s *privep); static void stm32l4_ep_flush(FAR struct stm32l4_ep_s *privep);
static void stm32l4_req_complete(FAR struct stm32l4_ep_s *privep, static void stm32l4_req_complete(FAR struct stm32l4_ep_s *privep,
int16_t result); int16_t result);
static void stm32l4_req_cancel(FAR struct stm32l4_ep_s *privep, static void stm32l4_req_cancel(FAR struct stm32l4_ep_s *privep,
int16_t status); int16_t status);
/* Interrupt handling **********************************************************/ /* Interrupt handling **********************************************************/
static struct stm32l4_ep_s *stm32l4_ep_findbyaddr(struct stm32l4_usbdev_s *priv, static struct stm32l4_ep_s *stm32l4_ep_findbyaddr(struct stm32l4_usbdev_s *priv,
uint16_t eplog); uint16_t eplog);
static int stm32l4_req_dispatch(FAR struct stm32l4_usbdev_s *priv, static int stm32l4_req_dispatch(FAR struct stm32l4_usbdev_s *priv,
FAR const struct usb_ctrlreq_s *ctrl); FAR const struct usb_ctrlreq_s *ctrl);
static void stm32l4_usbreset(FAR struct stm32l4_usbdev_s *priv); static void stm32l4_usbreset(FAR struct stm32l4_usbdev_s *priv);
/* Second level OUT endpoint interrupt processing */ /* Second level OUT endpoint interrupt processing */
static inline void stm32l4_ep0out_testmode(FAR struct stm32l4_usbdev_s *priv, static inline void stm32l4_ep0out_testmode(FAR struct stm32l4_usbdev_s *priv,
uint16_t index); uint16_t index);
static inline void stm32l4_ep0out_stdrequest(struct stm32l4_usbdev_s *priv, static inline void stm32l4_ep0out_stdrequest(FAR struct stm32l4_usbdev_s *priv,
FAR struct stm32l4_ctrlreq_s *ctrlreq); FAR struct stm32l4_ctrlreq_s *ctrlreq);
static inline void stm32l4_ep0out_setup(struct stm32l4_usbdev_s *priv); static inline void stm32l4_ep0out_setup(struct stm32l4_usbdev_s *priv);
static inline void stm32l4_epout(FAR struct stm32l4_usbdev_s *priv, static inline void stm32l4_epout(FAR struct stm32l4_usbdev_s *priv,
uint8_t epno); uint8_t epno);
static inline void stm32l4_epout_interrupt(FAR struct stm32l4_usbdev_s *priv); static inline void stm32l4_epout_interrupt(FAR struct stm32l4_usbdev_s *priv);
/* Second level IN endpoint interrupt processing */ /* Second level IN endpoint interrupt processing */
static inline void stm32l4_epin_runtestmode(FAR struct stm32l4_usbdev_s *priv); 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,
static inline void stm32l4_epin_txfifoempty(FAR struct stm32l4_usbdev_s *priv, int epno); uint8_t epno);
static inline void stm32l4_epin_txfifoempty(FAR struct stm32l4_usbdev_s *priv,
int epno);
static inline void stm32l4_epin_interrupt(FAR struct stm32l4_usbdev_s *priv); static inline void stm32l4_epin_interrupt(FAR struct stm32l4_usbdev_s *priv);
/* Other second level interrupt processing */ /* Other second level interrupt processing */
@ -668,11 +674,12 @@ static void stm32l4_disablegonak(FAR struct stm32l4_ep_s *privep);
/* Endpoint configuration */ /* Endpoint configuration */
static int stm32l4_epout_configure(FAR struct stm32l4_ep_s *privep, static int stm32l4_epout_configure(FAR struct stm32l4_ep_s *privep,
uint8_t eptype, uint16_t maxpacket); uint8_t eptype, uint16_t maxpacket);
static int stm32l4_epin_configure(FAR struct stm32l4_ep_s *privep, static int stm32l4_epin_configure(FAR struct stm32l4_ep_s *privep,
uint8_t eptype, uint16_t maxpacket); uint8_t eptype, uint16_t maxpacket);
static int stm32l4_ep_configure(FAR struct usbdev_ep_s *ep, static int stm32l4_ep_configure(FAR struct usbdev_ep_s *ep,
FAR const struct usb_epdesc_s *desc, bool last); FAR const struct usb_epdesc_s *desc,
bool last);
static void stm32l4_ep0_configure(FAR struct stm32l4_usbdev_s *priv); static void stm32l4_ep0_configure(FAR struct stm32l4_usbdev_s *priv);
/* Endpoint disable */ /* Endpoint disable */
@ -685,24 +692,26 @@ static int stm32l4_ep_disable(FAR struct usbdev_ep_s *ep);
static FAR struct usbdev_req_s *stm32l4_ep_allocreq(FAR struct usbdev_ep_s *ep); static FAR struct usbdev_req_s *stm32l4_ep_allocreq(FAR struct usbdev_ep_s *ep);
static void stm32l4_ep_freereq(FAR struct usbdev_ep_s *ep, static void stm32l4_ep_freereq(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *); FAR struct usbdev_req_s *);
/* Endpoint buffer management */ /* Endpoint buffer management */
#ifdef CONFIG_USBDEV_DMA #ifdef CONFIG_USBDEV_DMA
static void *stm32l4_ep_allocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes); static void *stm32l4_ep_allocbuffer(FAR struct usbdev_ep_s *ep,
static void stm32l4_ep_freebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf); unsigned bytes);
static void stm32l4_ep_freebuffer(FAR struct usbdev_ep_s *ep,
FAR void *buf);
#endif #endif
/* Endpoint request submission */ /* Endpoint request submission */
static int stm32l4_ep_submit(FAR struct usbdev_ep_s *ep, static int stm32l4_ep_submit(FAR struct usbdev_ep_s *ep,
struct usbdev_req_s *req); FAR struct usbdev_req_s *req);
/* Endpoint request cancellation */ /* Endpoint request cancellation */
static int stm32l4_ep_cancel(FAR struct usbdev_ep_s *ep, static int stm32l4_ep_cancel(FAR struct usbdev_ep_s *ep,
struct usbdev_req_s *req); FAR struct usbdev_req_s *req);
/* Stall handling */ /* Stall handling */
@ -716,18 +725,19 @@ static void stm32l4_ep0_stall(FAR struct stm32l4_usbdev_s *priv);
/* Endpoint allocation */ /* Endpoint allocation */
static FAR struct usbdev_ep_s *stm32l4_ep_alloc(FAR struct usbdev_s *dev, static FAR struct usbdev_ep_s *stm32l4_ep_alloc(FAR struct usbdev_s *dev,
uint8_t epno, bool in, uint8_t eptype); uint8_t epno, bool in,
uint8_t eptype);
static void stm32l4_ep_free(FAR struct usbdev_s *dev, static void stm32l4_ep_free(FAR struct usbdev_s *dev,
FAR struct usbdev_ep_s *ep); FAR struct usbdev_ep_s *ep);
/* USB device controller operations ********************************************/ /* USB device controller operations ********************************************/
static int stm32l4_getframe(struct usbdev_s *dev); static int stm32l4_getframe(FAR struct usbdev_s *dev);
static int stm32l4_wakeup(struct usbdev_s *dev); static int stm32l4_wakeup(FAR struct usbdev_s *dev);
static int stm32l4_selfpowered(struct usbdev_s *dev, bool selfpowered); static int stm32l4_selfpowered(FAR struct usbdev_s *dev, bool selfpowered);
static int stm32l4_pullup(struct usbdev_s *dev, bool enable); static int stm32l4_pullup(FAR struct usbdev_s *dev, bool enable);
static void stm32l4_setaddress(struct stm32l4_usbdev_s *priv, static void stm32l4_setaddress(FAR struct stm32l4_usbdev_s *priv,
uint16_t address); uint16_t address);
static int stm32l4_txfifo_flush(uint32_t txfnum); static int stm32l4_txfifo_flush(uint32_t txfnum);
static int stm32l4_rxfifo_flush(void); static int stm32l4_rxfifo_flush(void);
@ -992,7 +1002,7 @@ static FAR struct stm32l4_req_s *stm32l4_req_remfirst(FAR struct stm32l4_ep_s *p
****************************************************************************/ ****************************************************************************/
static bool stm32l4_req_addlast(FAR struct stm32l4_ep_s *privep, static bool stm32l4_req_addlast(FAR struct stm32l4_ep_s *privep,
FAR struct stm32l4_req_s *req) FAR struct stm32l4_req_s *req)
{ {
bool is_empty = !privep->head; bool is_empty = !privep->head;
@ -1019,7 +1029,7 @@ static bool stm32l4_req_addlast(FAR struct stm32l4_ep_s *privep,
****************************************************************************/ ****************************************************************************/
static void stm32l4_ep0in_setupresponse(FAR struct stm32l4_usbdev_s *priv, static void stm32l4_ep0in_setupresponse(FAR struct stm32l4_usbdev_s *priv,
FAR uint8_t *buf, uint32_t nbytes) FAR uint8_t *buf, uint32_t nbytes)
{ {
stm32l4_epin_transfer(&priv->epin[EP0], buf, nbytes); stm32l4_epin_transfer(&priv->epin[EP0], buf, nbytes);
priv->ep0state = EP0STATE_SETUPRESPONSE; priv->ep0state = EP0STATE_SETUPRESPONSE;
@ -1112,7 +1122,7 @@ static void stm32l4_ep0out_ctrlsetup(FAR struct stm32l4_usbdev_s *priv)
****************************************************************************/ ****************************************************************************/
static void stm32l4_txfifo_write(FAR struct stm32l4_ep_s *privep, static void stm32l4_txfifo_write(FAR struct stm32l4_ep_s *privep,
FAR uint8_t *buf, int nbytes) FAR uint8_t *buf, int nbytes)
{ {
uint32_t regaddr; uint32_t regaddr;
uint32_t regval; uint32_t regval;
@ -1157,7 +1167,7 @@ static void stm32l4_txfifo_write(FAR struct stm32l4_ep_s *privep,
****************************************************************************/ ****************************************************************************/
static void stm32l4_epin_transfer(FAR struct stm32l4_ep_s *privep, static void stm32l4_epin_transfer(FAR struct stm32l4_ep_s *privep,
FAR uint8_t *buf, int nbytes) FAR uint8_t *buf, int nbytes)
{ {
uint32_t pktcnt; uint32_t pktcnt;
uint32_t regval; uint32_t regval;
@ -1257,7 +1267,7 @@ static void stm32l4_epin_transfer(FAR struct stm32l4_ep_s *privep,
****************************************************************************/ ****************************************************************************/
static void stm32l4_epin_request(FAR struct stm32l4_usbdev_s *priv, static void stm32l4_epin_request(FAR struct stm32l4_usbdev_s *priv,
FAR struct stm32l4_ep_s *privep) FAR struct stm32l4_ep_s *privep)
{ {
struct stm32l4_req_s *privreq; struct stm32l4_req_s *privreq;
uint32_t regaddr; uint32_t regaddr;
@ -1477,7 +1487,7 @@ static void stm32l4_epin_request(FAR struct stm32l4_usbdev_s *priv,
****************************************************************************/ ****************************************************************************/
static void stm32l4_rxfifo_read(FAR struct stm32l4_ep_s *privep, static void stm32l4_rxfifo_read(FAR struct stm32l4_ep_s *privep,
FAR uint8_t *dest, uint16_t len) FAR uint8_t *dest, uint16_t len)
{ {
uint32_t regaddr; uint32_t regaddr;
int i; int i;
@ -1557,9 +1567,9 @@ static void stm32l4_rxfifo_discard(FAR struct stm32l4_ep_s *privep, int len)
****************************************************************************/ ****************************************************************************/
static void stm32l4_epout_complete(FAR struct stm32l4_usbdev_s *priv, static void stm32l4_epout_complete(FAR struct stm32l4_usbdev_s *priv,
FAR struct stm32l4_ep_s *privep) FAR struct stm32l4_ep_s *privep)
{ {
struct stm32l4_req_s *privreq; FAR struct stm32l4_req_s *privreq;
/* Since a transfer just completed, there must be a read request at the head of /* Since a transfer just completed, there must be a read request at the head of
* the endpoint request queue. * the endpoint request queue.
@ -1605,7 +1615,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; FAR struct stm32l4_usbdev_s *priv;
@ -1663,10 +1674,11 @@ 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; FAR struct stm32l4_req_s *privreq;
uint8_t *dest; FAR uint8_t *dest;
int buflen; int buflen;
int readlen; int readlen;
@ -1746,9 +1758,9 @@ static inline void stm32l4_epout_receive(FAR struct stm32l4_ep_s *privep, int bc
****************************************************************************/ ****************************************************************************/
static void stm32l4_epout_request(FAR struct stm32l4_usbdev_s *priv, static void stm32l4_epout_request(FAR struct stm32l4_usbdev_s *priv,
FAR struct stm32l4_ep_s *privep) FAR struct stm32l4_ep_s *privep)
{ {
struct stm32l4_req_s *privreq; FAR struct stm32l4_req_s *privreq;
uint32_t regaddr; uint32_t regaddr;
uint32_t regval; uint32_t regval;
uint32_t xfrsize; uint32_t xfrsize;
@ -1882,7 +1894,7 @@ static void stm32l4_epout_request(FAR struct stm32l4_usbdev_s *priv,
* *
****************************************************************************/ ****************************************************************************/
static void stm32l4_ep_flush(struct stm32l4_ep_s *privep) static void stm32l4_ep_flush(FAR struct stm32l4_ep_s *privep)
{ {
if (privep->isin) if (privep->isin)
{ {
@ -1902,7 +1914,8 @@ static void stm32l4_ep_flush(struct stm32l4_ep_s *privep)
* *
****************************************************************************/ ****************************************************************************/
static void stm32l4_req_complete(struct stm32l4_ep_s *privep, int16_t result) static void stm32l4_req_complete(FAR struct stm32l4_ep_s *privep,
int16_t result)
{ {
FAR struct stm32l4_req_s *privreq; FAR struct stm32l4_req_s *privreq;
@ -1942,7 +1955,7 @@ static void stm32l4_req_complete(struct stm32l4_ep_s *privep, int16_t result)
* *
****************************************************************************/ ****************************************************************************/
static void stm32l4_req_cancel(struct stm32l4_ep_s *privep, int16_t status) static void stm32l4_req_cancel(FAR struct stm32l4_ep_s *privep, int16_t status)
{ {
if (!stm32l4_rqempty(privep)) if (!stm32l4_rqempty(privep))
{ {
@ -1966,8 +1979,8 @@ static void stm32l4_req_cancel(struct stm32l4_ep_s *privep, int16_t status)
* *
****************************************************************************/ ****************************************************************************/
static struct stm32l4_ep_s *stm32l4_ep_findbyaddr(struct stm32l4_usbdev_s *priv, static FAR struct stm32l4_ep_s *stm32l4_ep_findbyaddr(FAR struct stm32l4_usbdev_s *priv,
uint16_t eplog) uint16_t eplog)
{ {
struct stm32l4_ep_s *privep; struct stm32l4_ep_s *privep;
uint8_t epphy = USB_EPNO(eplog); uint8_t epphy = USB_EPNO(eplog);
@ -2003,8 +2016,8 @@ static struct stm32l4_ep_s *stm32l4_ep_findbyaddr(struct stm32l4_usbdev_s *priv,
* *
****************************************************************************/ ****************************************************************************/
static int stm32l4_req_dispatch(struct stm32l4_usbdev_s *priv, static int stm32l4_req_dispatch(FAR struct stm32l4_usbdev_s *priv,
const struct usb_ctrlreq_s *ctrl) FAR const struct usb_ctrlreq_s *ctrl)
{ {
int ret = -EIO; int ret = -EIO;
@ -2036,7 +2049,7 @@ static int stm32l4_req_dispatch(struct stm32l4_usbdev_s *priv,
* *
****************************************************************************/ ****************************************************************************/
static void stm32l4_usbreset(struct stm32l4_usbdev_s *priv) static void stm32l4_usbreset(FAR struct stm32l4_usbdev_s *priv)
{ {
FAR struct stm32l4_ep_s *privep; FAR struct stm32l4_ep_s *privep;
uint32_t regval; uint32_t regval;
@ -2135,7 +2148,7 @@ static void stm32l4_usbreset(struct stm32l4_usbdev_s *priv)
****************************************************************************/ ****************************************************************************/
static inline void stm32l4_ep0out_testmode(FAR struct stm32l4_usbdev_s *priv, static inline void stm32l4_ep0out_testmode(FAR struct stm32l4_usbdev_s *priv,
uint16_t index) uint16_t index)
{ {
uint8_t testmode; uint8_t testmode;
@ -2182,8 +2195,8 @@ static inline void stm32l4_ep0out_testmode(FAR struct stm32l4_usbdev_s *priv,
* *
****************************************************************************/ ****************************************************************************/
static inline void stm32l4_ep0out_stdrequest(struct stm32l4_usbdev_s *priv, static inline void stm32l4_ep0out_stdrequest(FAR struct stm32l4_usbdev_s *priv,
FAR struct stm32l4_ctrlreq_s *ctrlreq) FAR struct stm32l4_ctrlreq_s *ctrlreq)
{ {
FAR struct stm32l4_ep_s *privep; FAR struct stm32l4_ep_s *privep;
@ -2552,7 +2565,7 @@ static inline void stm32l4_ep0out_stdrequest(struct stm32l4_usbdev_s *priv,
* *
****************************************************************************/ ****************************************************************************/
static inline void stm32l4_ep0out_setup(struct stm32l4_usbdev_s *priv) static inline void stm32l4_ep0out_setup(FAR struct stm32l4_usbdev_s *priv)
{ {
struct stm32l4_ctrlreq_s ctrlreq; struct stm32l4_ctrlreq_s ctrlreq;
@ -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, static int stm32l4_epout_configure(FAR struct stm32l4_ep_s *privep,
uint16_t maxpacket) uint8_t eptype, uint16_t maxpacket)
{ {
uint32_t mpsiz; uint32_t mpsiz;
uint32_t regaddr; uint32_t regaddr;
@ -3957,8 +3970,8 @@ static int stm32l4_epout_configure(FAR struct stm32l4_ep_s *privep, uint8_t epty
* *
****************************************************************************/ ****************************************************************************/
static int stm32l4_epin_configure(FAR struct stm32l4_ep_s *privep, uint8_t eptype, static int stm32l4_epin_configure(FAR struct stm32l4_ep_s *privep,
uint16_t maxpacket) uint8_t eptype, uint16_t maxpacket)
{ {
uint32_t mpsiz; uint32_t mpsiz;
uint32_t regaddr; uint32_t regaddr;
@ -4058,8 +4071,8 @@ static int stm32l4_epin_configure(FAR struct stm32l4_ep_s *privep, uint8_t eptyp
****************************************************************************/ ****************************************************************************/
static int stm32l4_ep_configure(FAR struct usbdev_ep_s *ep, static int stm32l4_ep_configure(FAR struct usbdev_ep_s *ep,
FAR const struct usb_epdesc_s *desc, FAR const struct usb_epdesc_s *desc,
bool last) bool last)
{ {
FAR struct stm32l4_ep_s *privep = (FAR struct stm32l4_ep_s *)ep; FAR struct stm32l4_ep_s *privep = (FAR struct stm32l4_ep_s *)ep;
uint16_t maxpacket; uint16_t maxpacket;
@ -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_req_s *privreq = (FAR struct stm32l4_req_s *)req;
FAR struct stm32l4_ep_s *privep = (FAR struct stm32l4_ep_s *)ep; 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; FAR struct stm32l4_ep_s *privep = (FAR struct stm32l4_ep_s *)ep;
irqstate_t flags; irqstate_t flags;
@ -4790,8 +4805,8 @@ static void stm32l4_ep0_stall(FAR struct stm32l4_usbdev_s *priv)
****************************************************************************/ ****************************************************************************/
static FAR struct usbdev_ep_s *stm32l4_ep_alloc(FAR struct usbdev_s *dev, static FAR struct usbdev_ep_s *stm32l4_ep_alloc(FAR struct usbdev_s *dev,
uint8_t eplog, bool in, uint8_t eplog, bool in,
uint8_t eptype) uint8_t eptype)
{ {
FAR struct stm32l4_usbdev_s *priv = (FAR struct stm32l4_usbdev_s *)dev; FAR struct stm32l4_usbdev_s *priv = (FAR struct stm32l4_usbdev_s *)dev;
uint8_t epavail; uint8_t epavail;
@ -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_usbdev_s *priv = (FAR struct stm32l4_usbdev_s *)dev;
FAR struct stm32l4_ep_s *privep = (FAR struct stm32l4_ep_s *)ep; FAR struct stm32l4_ep_s *privep = (FAR struct stm32l4_ep_s *)ep;
@ -4900,7 +4916,7 @@ static void stm32l4_ep_free(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep
* *
****************************************************************************/ ****************************************************************************/
static int stm32l4_getframe(struct usbdev_s *dev) static int stm32l4_getframe(FAR struct usbdev_s *dev)
{ {
uint32_t regval; uint32_t regval;
@ -4920,7 +4936,7 @@ static int stm32l4_getframe(struct usbdev_s *dev)
* *
****************************************************************************/ ****************************************************************************/
static int stm32l4_wakeup(struct usbdev_s *dev) static int stm32l4_wakeup(FAR struct usbdev_s *dev)
{ {
FAR struct stm32l4_usbdev_s *priv = (FAR struct stm32l4_usbdev_s *)dev; FAR struct stm32l4_usbdev_s *priv = (FAR struct stm32l4_usbdev_s *)dev;
uint32_t regval; uint32_t regval;
@ -4968,7 +4984,7 @@ static int stm32l4_wakeup(struct usbdev_s *dev)
* *
****************************************************************************/ ****************************************************************************/
static int stm32l4_selfpowered(struct usbdev_s *dev, bool selfpowered) static int stm32l4_selfpowered(FAR struct usbdev_s *dev, bool selfpowered)
{ {
FAR struct stm32l4_usbdev_s *priv = (FAR struct stm32l4_usbdev_s *)dev; FAR struct stm32l4_usbdev_s *priv = (FAR struct stm32l4_usbdev_s *)dev;
@ -4994,7 +5010,7 @@ static int stm32l4_selfpowered(struct usbdev_s *dev, bool selfpowered)
* *
****************************************************************************/ ****************************************************************************/
static int stm32l4_pullup(struct usbdev_s *dev, bool enable) static int stm32l4_pullup(FAR struct usbdev_s *dev, bool enable)
{ {
uint32_t regval; uint32_t regval;
@ -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(FAR struct stm32l4_usbdev_s *priv,
uint16_t address)
{ {
uint32_t regval; uint32_t regval;
@ -5655,7 +5672,7 @@ void up_usbuninitialize(void)
* *
****************************************************************************/ ****************************************************************************/
int usbdev_register(struct usbdevclass_driver_s *driver) int usbdev_register(FAR struct usbdevclass_driver_s *driver)
{ {
/* At present, there is only a single OTG FS device support. Hence it is /* 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 * pre-allocated as g_otgfsdev. However, in most code, the private data
@ -5726,7 +5743,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
* *
****************************************************************************/ ****************************************************************************/
int usbdev_unregister(struct usbdevclass_driver_s *driver) int usbdev_unregister(FAR struct usbdevclass_driver_s *driver)
{ {
/* At present, there is only a single OTG FS device support. Hence it is /* 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 * pre-allocated as g_otgfsdev. However, in most code, the private data

View File

@ -295,7 +295,7 @@ static void stm32l4_putreg(uint32_t addr, uint32_t value);
#endif #endif
static inline void stm32l4_modifyreg(uint32_t addr, uint32_t clrbits, static inline void stm32l4_modifyreg(uint32_t addr, uint32_t clrbits,
uint32_t setbits); uint32_t setbits);
#ifdef CONFIG_STM32L4_USBHOST_PKTDUMP #ifdef CONFIG_STM32L4_USBHOST_PKTDUMP
# define stm32l4_pktdump(m,b,n) lib_dumpbuffer(m,b,n) # define stm32l4_pktdump(m,b,n) lib_dumpbuffer(m,b,n)
@ -305,12 +305,12 @@ static inline void stm32l4_modifyreg(uint32_t addr, uint32_t clrbits,
/* Semaphores ******************************************************************/ /* Semaphores ******************************************************************/
static void stm32l4_takesem(sem_t *sem); static void stm32l4_takesem(FAR sem_t *sem);
#define stm32l4_givesem(s) sem_post(s); #define stm32l4_givesem(s) sem_post(s);
/* Byte stream access helper functions *****************************************/ /* Byte stream access helper functions *****************************************/
static inline uint16_t stm32l4_getle16(const uint8_t *val); static inline uint16_t stm32l4_getle16(FAR const uint8_t *val);
/* Channel management **********************************************************/ /* Channel management **********************************************************/
@ -319,27 +319,27 @@ static inline void stm32l4_chan_free(FAR struct stm32l4_usbhost_s *priv, int chi
static inline void stm32l4_chan_freeall(FAR struct stm32l4_usbhost_s *priv); static inline void stm32l4_chan_freeall(FAR struct stm32l4_usbhost_s *priv);
static void stm32l4_chan_configure(FAR struct stm32l4_usbhost_s *priv, int chidx); static void stm32l4_chan_configure(FAR struct stm32l4_usbhost_s *priv, int chidx);
static void stm32l4_chan_halt(FAR struct stm32l4_usbhost_s *priv, int chidx, static void stm32l4_chan_halt(FAR struct stm32l4_usbhost_s *priv, int chidx,
enum stm32l4_chreason_e chreason); enum stm32l4_chreason_e chreason);
static int stm32l4_chan_waitsetup(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_chan_waitsetup(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan); FAR struct stm32l4_chan_s *chan);
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
static int stm32l4_chan_asynchsetup(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_chan_asynchsetup(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan, FAR struct stm32l4_chan_s *chan,
usbhost_asynch_t callback, FAR void *arg); usbhost_asynch_t callback, FAR void *arg);
#endif #endif
static int stm32l4_chan_wait(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_chan_wait(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan); FAR struct stm32l4_chan_s *chan);
static void stm32l4_chan_wakeup(FAR struct stm32l4_usbhost_s *priv, static void stm32l4_chan_wakeup(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan); FAR struct stm32l4_chan_s *chan);
static int stm32l4_ctrlchan_alloc(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_ctrlchan_alloc(FAR struct stm32l4_usbhost_s *priv,
uint8_t epno, uint8_t funcaddr, uint8_t speed, uint8_t epno, uint8_t funcaddr, uint8_t speed,
FAR struct stm32l4_ctrlinfo_s *ctrlep); FAR struct stm32l4_ctrlinfo_s *ctrlep);
static int stm32l4_ctrlep_alloc(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_ctrlep_alloc(FAR struct stm32l4_usbhost_s *priv,
FAR const struct usbhost_epdesc_s *epdesc, FAR const struct usbhost_epdesc_s *epdesc,
FAR usbhost_ep_t *ep); FAR usbhost_ep_t *ep);
static int stm32l4_xfrep_alloc(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_xfrep_alloc(FAR struct stm32l4_usbhost_s *priv,
FAR const struct usbhost_epdesc_s *epdesc, FAR const struct usbhost_epdesc_s *epdesc,
FAR usbhost_ep_t *ep); FAR usbhost_ep_t *ep);
/* Control/data transfer logic *************************************************/ /* Control/data transfer logic *************************************************/
@ -348,44 +348,44 @@ static void stm32l4_transfer_start(FAR struct stm32l4_usbhost_s *priv, int chidx
static inline uint16_t stm32l4_getframe(void); static inline uint16_t stm32l4_getframe(void);
#endif #endif
static int stm32l4_ctrl_sendsetup(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_ctrl_sendsetup(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_ctrlinfo_s *ep0, FAR struct stm32l4_ctrlinfo_s *ep0,
FAR const struct usb_ctrlreq_s *req); FAR const struct usb_ctrlreq_s *req);
static int stm32l4_ctrl_senddata(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_ctrl_senddata(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_ctrlinfo_s *ep0, FAR struct stm32l4_ctrlinfo_s *ep0,
FAR uint8_t *buffer, unsigned int buflen); FAR uint8_t *buffer, unsigned int buflen);
static int stm32l4_ctrl_recvdata(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_ctrl_recvdata(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_ctrlinfo_s *ep0, FAR struct stm32l4_ctrlinfo_s *ep0,
FAR uint8_t *buffer, unsigned int buflen); FAR uint8_t *buffer, unsigned int buflen);
static int stm32l4_in_setup(FAR struct stm32l4_usbhost_s *priv, int chidx); static int stm32l4_in_setup(FAR struct stm32l4_usbhost_s *priv, int chidx);
static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv, int chidx, static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv, int chidx,
FAR uint8_t *buffer, size_t buflen); FAR uint8_t *buffer, size_t buflen);
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
static void stm32l4_in_next(FAR struct stm32l4_usbhost_s *priv, static void stm32l4_in_next(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan); FAR struct stm32l4_chan_s *chan);
static int stm32l4_in_asynch(FAR struct stm32l4_usbhost_s *priv, int chidx, static int stm32l4_in_asynch(FAR struct stm32l4_usbhost_s *priv, int chidx,
FAR uint8_t *buffer, size_t buflen, FAR uint8_t *buffer, size_t buflen,
usbhost_asynch_t callback, FAR void *arg); usbhost_asynch_t callback, FAR void *arg);
#endif #endif
static int stm32l4_out_setup(FAR struct stm32l4_usbhost_s *priv, int chidx); static int stm32l4_out_setup(FAR struct stm32l4_usbhost_s *priv, int chidx);
static ssize_t stm32l4_out_transfer(FAR struct stm32l4_usbhost_s *priv, int chidx, static ssize_t stm32l4_out_transfer(FAR struct stm32l4_usbhost_s *priv, int chidx,
FAR uint8_t *buffer, size_t buflen); FAR uint8_t *buffer, size_t buflen);
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
static void stm32l4_out_next(FAR struct stm32l4_usbhost_s *priv, static void stm32l4_out_next(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan); FAR struct stm32l4_chan_s *chan);
static int stm32l4_out_asynch(FAR struct stm32l4_usbhost_s *priv, int chidx, static int stm32l4_out_asynch(FAR struct stm32l4_usbhost_s *priv, int chidx,
FAR uint8_t *buffer, size_t buflen, FAR uint8_t *buffer, size_t buflen,
usbhost_asynch_t callback, FAR void *arg); usbhost_asynch_t callback, FAR void *arg);
#endif #endif
/* Interrupt handling **********************************************************/ /* Interrupt handling **********************************************************/
/* Lower level interrupt handlers */ /* Lower level interrupt handlers */
static void stm32l4_gint_wrpacket(FAR struct stm32l4_usbhost_s *priv, static void stm32l4_gint_wrpacket(FAR struct stm32l4_usbhost_s *priv,
FAR uint8_t *buffer, int chidx, int buflen); FAR uint8_t *buffer, int chidx, int buflen);
static inline void stm32l4_gint_hcinisr(FAR struct stm32l4_usbhost_s *priv, static inline void stm32l4_gint_hcinisr(FAR struct stm32l4_usbhost_s *priv,
int chidx); int chidx);
static inline void stm32l4_gint_hcoutisr(FAR struct stm32l4_usbhost_s *priv, static inline void stm32l4_gint_hcoutisr(FAR struct stm32l4_usbhost_s *priv,
int chidx); int chidx);
static void stm32l4_gint_connected(FAR struct stm32l4_usbhost_s *priv); static void stm32l4_gint_connected(FAR struct stm32l4_usbhost_s *priv);
static void stm32l4_gint_disconnected(FAR struct stm32l4_usbhost_s *priv); static void stm32l4_gint_disconnected(FAR struct stm32l4_usbhost_s *priv);
@ -416,47 +416,47 @@ static void stm32l4_txfe_enable(FAR struct stm32l4_usbhost_s *priv, int chidx);
/* USB host controller operations **********************************************/ /* USB host controller operations **********************************************/
static int stm32l4_wait(FAR struct usbhost_connection_s *conn, static int stm32l4_wait(FAR struct usbhost_connection_s *conn,
FAR struct usbhost_hubport_s **hport); FAR struct usbhost_hubport_s **hport);
static int stm32l4_rh_enumerate(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_rh_enumerate(FAR struct stm32l4_usbhost_s *priv,
FAR struct usbhost_connection_s *conn, FAR struct usbhost_connection_s *conn,
FAR struct usbhost_hubport_s *hport); FAR struct usbhost_hubport_s *hport);
static int stm32l4_enumerate(FAR struct usbhost_connection_s *conn, static int stm32l4_enumerate(FAR struct usbhost_connection_s *conn,
FAR struct usbhost_hubport_s *hport); FAR struct usbhost_hubport_s *hport);
static int stm32l4_ep0configure(FAR struct usbhost_driver_s *drvr, static int stm32l4_ep0configure(FAR struct usbhost_driver_s *drvr,
usbhost_ep_t ep0, uint8_t funcaddr, uint8_t speed, usbhost_ep_t ep0, uint8_t funcaddr, uint8_t speed,
uint16_t maxpacketsize); uint16_t maxpacketsize);
static int stm32l4_epalloc(FAR struct usbhost_driver_s *drvr, static int stm32l4_epalloc(FAR struct usbhost_driver_s *drvr,
FAR const FAR struct usbhost_epdesc_s *epdesc, FAR const FAR struct usbhost_epdesc_s *epdesc,
FAR usbhost_ep_t *ep); FAR usbhost_ep_t *ep);
static int stm32l4_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep); static int stm32l4_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep);
static int stm32l4_alloc(FAR struct usbhost_driver_s *drvr, static int stm32l4_alloc(FAR struct usbhost_driver_s *drvr,
FAR uint8_t **buffer, FAR size_t *maxlen); FAR uint8_t **buffer, FAR size_t *maxlen);
static int stm32l4_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer); static int stm32l4_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer);
static int stm32l4_ioalloc(FAR struct usbhost_driver_s *drvr, static int stm32l4_ioalloc(FAR struct usbhost_driver_s *drvr,
FAR uint8_t **buffer, size_t buflen); FAR uint8_t **buffer, size_t buflen);
static int stm32l4_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer); static int stm32l4_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer);
static int stm32l4_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, static int stm32l4_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
const struct usb_ctrlreq_s *req, FAR const struct usb_ctrlreq_s *req,
FAR uint8_t *buffer); FAR uint8_t *buffer);
static int stm32l4_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, static int stm32l4_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
FAR const struct usb_ctrlreq_s *req, FAR const struct usb_ctrlreq_s *req,
FAR const uint8_t *buffer); FAR const uint8_t *buffer);
static ssize_t stm32l4_transfer(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep, static ssize_t stm32l4_transfer(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep,
FAR uint8_t *buffer, size_t buflen); FAR uint8_t *buffer, size_t buflen);
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
static int stm32l4_asynch(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep, static int stm32l4_asynch(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep,
FAR uint8_t *buffer, size_t buflen, FAR uint8_t *buffer, size_t buflen,
usbhost_asynch_t callback, FAR void *arg); usbhost_asynch_t callback, FAR void *arg);
#endif #endif
static int stm32l4_cancel(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep); static int stm32l4_cancel(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep);
#ifdef CONFIG_USBHOST_HUB #ifdef CONFIG_USBHOST_HUB
static int stm32l4_connect(FAR struct usbhost_driver_s *drvr, static int stm32l4_connect(FAR struct usbhost_driver_s *drvr,
FAR struct usbhost_hubport_s *hport, FAR struct usbhost_hubport_s *hport,
bool connected); bool connected);
#endif #endif
static void stm32l4_disconnect(FAR struct usbhost_driver_s *drvr, static void stm32l4_disconnect(FAR struct usbhost_driver_s *drvr,
FAR struct usbhost_hubport_s *hport); FAR struct usbhost_hubport_s *hport);
/* Initialization **************************************************************/ /* Initialization **************************************************************/
@ -626,7 +626,8 @@ static void stm32l4_putreg(uint32_t addr, uint32_t val)
* *
****************************************************************************/ ****************************************************************************/
static inline void stm32l4_modifyreg(uint32_t addr, uint32_t clrbits, uint32_t setbits) static inline void stm32l4_modifyreg(uint32_t addr, uint32_t clrbits,
uint32_t setbits)
{ {
stm32l4_putreg(addr, (((stm32l4_getreg(addr)) & ~clrbits) | setbits)); stm32l4_putreg(addr, (((stm32l4_getreg(addr)) & ~clrbits) | setbits));
} }
@ -640,7 +641,7 @@ static inline void stm32l4_modifyreg(uint32_t addr, uint32_t clrbits, uint32_t s
* *
****************************************************************************/ ****************************************************************************/
static void stm32l4_takesem(sem_t *sem) static void stm32l4_takesem(FAR sem_t *sem)
{ {
/* Take the semaphore (perhaps waiting) */ /* Take the semaphore (perhaps waiting) */
@ -662,7 +663,7 @@ static void stm32l4_takesem(sem_t *sem)
* *
****************************************************************************/ ****************************************************************************/
static inline uint16_t stm32l4_getle16(const uint8_t *val) static inline uint16_t stm32l4_getle16(FAR const uint8_t *val)
{ {
return (uint16_t)val[1] << 8 | (uint16_t)val[0]; return (uint16_t)val[1] << 8 | (uint16_t)val[0];
} }
@ -909,7 +910,7 @@ static void stm32l4_chan_configure(FAR struct stm32l4_usbhost_s *priv, int chidx
****************************************************************************/ ****************************************************************************/
static void stm32l4_chan_halt(FAR struct stm32l4_usbhost_s *priv, int chidx, static void stm32l4_chan_halt(FAR struct stm32l4_usbhost_s *priv, int chidx,
enum stm32l4_chreason_e chreason) enum stm32l4_chreason_e chreason)
{ {
uint32_t hcchar; uint32_t hcchar;
uint32_t intmsk; uint32_t intmsk;
@ -999,7 +1000,7 @@ static void stm32l4_chan_halt(FAR struct stm32l4_usbhost_s *priv, int chidx,
****************************************************************************/ ****************************************************************************/
static int stm32l4_chan_waitsetup(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_chan_waitsetup(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan) FAR struct stm32l4_chan_s *chan)
{ {
irqstate_t flags = enter_critical_section(); irqstate_t flags = enter_critical_section();
int ret = -ENODEV; int ret = -ENODEV;
@ -1040,8 +1041,8 @@ static int stm32l4_chan_waitsetup(FAR struct stm32l4_usbhost_s *priv,
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
static int stm32l4_chan_asynchsetup(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_chan_asynchsetup(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan, FAR struct stm32l4_chan_s *chan,
usbhost_asynch_t callback, FAR void *arg) usbhost_asynch_t callback, FAR void *arg)
{ {
irqstate_t flags = enter_critical_section(); irqstate_t flags = enter_critical_section();
int ret = -ENODEV; int ret = -ENODEV;
@ -1077,7 +1078,7 @@ static int stm32l4_chan_asynchsetup(FAR struct stm32l4_usbhost_s *priv,
****************************************************************************/ ****************************************************************************/
static int stm32l4_chan_wait(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_chan_wait(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan) FAR struct stm32l4_chan_s *chan)
{ {
irqstate_t flags; irqstate_t flags;
int ret; int ret;
@ -1134,7 +1135,7 @@ static int stm32l4_chan_wait(FAR struct stm32l4_usbhost_s *priv,
****************************************************************************/ ****************************************************************************/
static void stm32l4_chan_wakeup(FAR struct stm32l4_usbhost_s *priv, static void stm32l4_chan_wakeup(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan) FAR struct stm32l4_chan_s *chan)
{ {
/* Is the transfer complete? */ /* Is the transfer complete? */
@ -1190,8 +1191,8 @@ static void stm32l4_chan_wakeup(FAR struct stm32l4_usbhost_s *priv,
****************************************************************************/ ****************************************************************************/
static int stm32l4_ctrlchan_alloc(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_ctrlchan_alloc(FAR struct stm32l4_usbhost_s *priv,
uint8_t epno, uint8_t funcaddr, uint8_t speed, uint8_t epno, uint8_t funcaddr, uint8_t speed,
FAR struct stm32l4_ctrlinfo_s *ctrlep) FAR struct stm32l4_ctrlinfo_s *ctrlep)
{ {
FAR struct stm32l4_chan_s *chan; FAR struct stm32l4_chan_s *chan;
int inndx; int inndx;
@ -1266,8 +1267,8 @@ static int stm32l4_ctrlchan_alloc(FAR struct stm32l4_usbhost_s *priv,
****************************************************************************/ ****************************************************************************/
static int stm32l4_ctrlep_alloc(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_ctrlep_alloc(FAR struct stm32l4_usbhost_s *priv,
FAR const struct usbhost_epdesc_s *epdesc, FAR const struct usbhost_epdesc_s *epdesc,
FAR usbhost_ep_t *ep) FAR usbhost_ep_t *ep)
{ {
FAR struct usbhost_hubport_s *hport; FAR struct usbhost_hubport_s *hport;
FAR struct stm32l4_ctrlinfo_s *ctrlep; FAR struct stm32l4_ctrlinfo_s *ctrlep;
@ -1328,8 +1329,8 @@ static int stm32l4_ctrlep_alloc(FAR struct stm32l4_usbhost_s *priv,
************************************************************************************/ ************************************************************************************/
static int stm32l4_xfrep_alloc(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_xfrep_alloc(FAR struct stm32l4_usbhost_s *priv,
FAR const struct usbhost_epdesc_s *epdesc, FAR const struct usbhost_epdesc_s *epdesc,
FAR usbhost_ep_t *ep) FAR usbhost_ep_t *ep)
{ {
struct usbhost_hubport_s *hport; struct usbhost_hubport_s *hport;
FAR struct stm32l4_chan_s *chan; FAR struct stm32l4_chan_s *chan;
@ -1385,7 +1386,8 @@ static int stm32l4_xfrep_alloc(FAR struct stm32l4_usbhost_s *priv,
* *
****************************************************************************/ ****************************************************************************/
static void stm32l4_transfer_start(FAR struct stm32l4_usbhost_s *priv, int chidx) static void stm32l4_transfer_start(FAR struct stm32l4_usbhost_s *priv,
int chidx)
{ {
FAR struct stm32l4_chan_s *chan; FAR struct stm32l4_chan_s *chan;
uint32_t regval; uint32_t regval;
@ -1593,8 +1595,8 @@ static inline uint16_t stm32l4_getframe(void)
****************************************************************************/ ****************************************************************************/
static int stm32l4_ctrl_sendsetup(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_ctrl_sendsetup(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_ctrlinfo_s *ep0, FAR struct stm32l4_ctrlinfo_s *ep0,
FAR const struct usb_ctrlreq_s *req) FAR const struct usb_ctrlreq_s *req)
{ {
FAR struct stm32l4_chan_s *chan; FAR struct stm32l4_chan_s *chan;
systime_t start; systime_t start;
@ -1670,8 +1672,8 @@ static int stm32l4_ctrl_sendsetup(FAR struct stm32l4_usbhost_s *priv,
****************************************************************************/ ****************************************************************************/
static int stm32l4_ctrl_senddata(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_ctrl_senddata(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_ctrlinfo_s *ep0, FAR struct stm32l4_ctrlinfo_s *ep0,
FAR uint8_t *buffer, unsigned int buflen) FAR uint8_t *buffer, unsigned int buflen)
{ {
FAR struct stm32l4_chan_s *chan = &priv->chan[ep0->outndx]; FAR struct stm32l4_chan_s *chan = &priv->chan[ep0->outndx];
int ret; int ret;
@ -1723,8 +1725,8 @@ static int stm32l4_ctrl_senddata(FAR struct stm32l4_usbhost_s *priv,
****************************************************************************/ ****************************************************************************/
static int stm32l4_ctrl_recvdata(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_ctrl_recvdata(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_ctrlinfo_s *ep0, FAR struct stm32l4_ctrlinfo_s *ep0,
FAR uint8_t *buffer, unsigned int buflen) FAR uint8_t *buffer, unsigned int buflen)
{ {
FAR struct stm32l4_chan_s *chan = &priv->chan[ep0->inndx]; FAR struct stm32l4_chan_s *chan = &priv->chan[ep0->inndx];
int ret; int ret;
@ -1823,8 +1825,9 @@ static int stm32l4_in_setup(FAR struct stm32l4_usbhost_s *priv, int chidx)
* *
****************************************************************************/ ****************************************************************************/
static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv, int chidx, static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv,
FAR uint8_t *buffer, size_t buflen) int chidx, FAR uint8_t *buffer,
size_t buflen)
{ {
FAR struct stm32l4_chan_s *chan; FAR struct stm32l4_chan_s *chan;
systime_t start; systime_t start;
@ -1910,7 +1913,7 @@ static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv, int chidx
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
static void stm32l4_in_next(FAR struct stm32l4_usbhost_s *priv, static void stm32l4_in_next(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan) FAR struct stm32l4_chan_s *chan)
{ {
usbhost_asynch_t callback; usbhost_asynch_t callback;
FAR void *arg; FAR void *arg;
@ -1975,8 +1978,8 @@ static void stm32l4_in_next(FAR struct stm32l4_usbhost_s *priv,
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
static int stm32l4_in_asynch(FAR struct stm32l4_usbhost_s *priv, int chidx, static int stm32l4_in_asynch(FAR struct stm32l4_usbhost_s *priv, int chidx,
FAR uint8_t *buffer, size_t buflen, FAR uint8_t *buffer, size_t buflen,
usbhost_asynch_t callback, FAR void *arg) usbhost_asynch_t callback, FAR void *arg)
{ {
FAR struct stm32l4_chan_s *chan; FAR struct stm32l4_chan_s *chan;
int ret; int ret;
@ -2082,8 +2085,9 @@ static int stm32l4_out_setup(FAR struct stm32l4_usbhost_s *priv, int chidx)
* *
****************************************************************************/ ****************************************************************************/
static ssize_t stm32l4_out_transfer(FAR struct stm32l4_usbhost_s *priv, int chidx, static ssize_t stm32l4_out_transfer(FAR struct stm32l4_usbhost_s *priv,
FAR uint8_t *buffer, size_t buflen) int chidx, FAR uint8_t *buffer,
size_t buflen)
{ {
FAR struct stm32l4_chan_s *chan; FAR struct stm32l4_chan_s *chan;
systime_t start; systime_t start;
@ -2196,7 +2200,7 @@ static ssize_t stm32l4_out_transfer(FAR struct stm32l4_usbhost_s *priv, int chid
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
static void stm32l4_out_next(FAR struct stm32l4_usbhost_s *priv, static void stm32l4_out_next(FAR struct stm32l4_usbhost_s *priv,
FAR struct stm32l4_chan_s *chan) FAR struct stm32l4_chan_s *chan)
{ {
usbhost_asynch_t callback; usbhost_asynch_t callback;
FAR void *arg; FAR void *arg;
@ -2261,8 +2265,8 @@ static void stm32l4_out_next(FAR struct stm32l4_usbhost_s *priv,
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
static int stm32l4_out_asynch(FAR struct stm32l4_usbhost_s *priv, int chidx, static int stm32l4_out_asynch(FAR struct stm32l4_usbhost_s *priv, int chidx,
FAR uint8_t *buffer, size_t buflen, FAR uint8_t *buffer, size_t buflen,
usbhost_asynch_t callback, FAR void *arg) usbhost_asynch_t callback, FAR void *arg)
{ {
FAR struct stm32l4_chan_s *chan; FAR struct stm32l4_chan_s *chan;
int ret; int ret;
@ -2305,7 +2309,7 @@ static int stm32l4_out_asynch(FAR struct stm32l4_usbhost_s *priv, int chidx,
****************************************************************************/ ****************************************************************************/
static void stm32l4_gint_wrpacket(FAR struct stm32l4_usbhost_s *priv, static void stm32l4_gint_wrpacket(FAR struct stm32l4_usbhost_s *priv,
FAR uint8_t *buffer, int chidx, int buflen) FAR uint8_t *buffer, int chidx, int buflen)
{ {
FAR uint32_t *src; FAR uint32_t *src;
uint32_t fifo; uint32_t fifo;
@ -2355,7 +2359,7 @@ static void stm32l4_gint_wrpacket(FAR struct stm32l4_usbhost_s *priv,
****************************************************************************/ ****************************************************************************/
static inline void stm32l4_gint_hcinisr(FAR struct stm32l4_usbhost_s *priv, static inline void stm32l4_gint_hcinisr(FAR struct stm32l4_usbhost_s *priv,
int chidx) int chidx)
{ {
FAR struct stm32l4_chan_s *chan = &priv->chan[chidx]; FAR struct stm32l4_chan_s *chan = &priv->chan[chidx];
uint32_t regval; uint32_t regval;
@ -2616,7 +2620,7 @@ static inline void stm32l4_gint_hcinisr(FAR struct stm32l4_usbhost_s *priv,
****************************************************************************/ ****************************************************************************/
static inline void stm32l4_gint_hcoutisr(FAR struct stm32l4_usbhost_s *priv, static inline void stm32l4_gint_hcoutisr(FAR struct stm32l4_usbhost_s *priv,
int chidx) int chidx)
{ {
FAR struct stm32l4_chan_s *chan = &priv->chan[chidx]; FAR struct stm32l4_chan_s *chan = &priv->chan[chidx];
uint32_t regval; uint32_t regval;
@ -3732,7 +3736,7 @@ static void stm32l4_txfe_enable(FAR struct stm32l4_usbhost_s *priv, int chidx)
****************************************************************************/ ****************************************************************************/
static int stm32l4_wait(FAR struct usbhost_connection_s *conn, static int stm32l4_wait(FAR struct usbhost_connection_s *conn,
FAR struct usbhost_hubport_s **hport) FAR struct usbhost_hubport_s **hport)
{ {
FAR struct stm32l4_usbhost_s *priv = &g_usbhost; FAR struct stm32l4_usbhost_s *priv = &g_usbhost;
struct usbhost_hubport_s *connport; struct usbhost_hubport_s *connport;
@ -3819,8 +3823,8 @@ static int stm32l4_wait(FAR struct usbhost_connection_s *conn,
****************************************************************************/ ****************************************************************************/
static int stm32l4_rh_enumerate(FAR struct stm32l4_usbhost_s *priv, static int stm32l4_rh_enumerate(FAR struct stm32l4_usbhost_s *priv,
FAR struct usbhost_connection_s *conn, FAR struct usbhost_connection_s *conn,
FAR struct usbhost_hubport_s *hport) FAR struct usbhost_hubport_s *hport)
{ {
uint32_t regval; uint32_t regval;
int ret; int ret;
@ -3873,7 +3877,7 @@ static int stm32l4_rh_enumerate(FAR struct stm32l4_usbhost_s *priv,
} }
static int stm32l4_enumerate(FAR struct usbhost_connection_s *conn, static int stm32l4_enumerate(FAR struct usbhost_connection_s *conn,
FAR struct usbhost_hubport_s *hport) FAR struct usbhost_hubport_s *hport)
{ {
FAR struct stm32l4_usbhost_s *priv = &g_usbhost; FAR struct stm32l4_usbhost_s *priv = &g_usbhost;
int ret; int ret;
@ -3946,9 +3950,9 @@ static int stm32l4_enumerate(FAR struct usbhost_connection_s *conn,
* *
************************************************************************************/ ************************************************************************************/
static int stm32l4_ep0configure(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, static int stm32l4_ep0configure(FAR struct usbhost_driver_s *drvr,
uint8_t funcaddr, uint8_t speed, usbhost_ep_t ep0, uint8_t funcaddr,
uint16_t maxpacketsize) uint8_t speed, uint16_t maxpacketsize)
{ {
FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr; FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr;
FAR struct stm32l4_ctrlinfo_s *ep0info = (FAR struct stm32l4_ctrlinfo_s *)ep0; FAR struct stm32l4_ctrlinfo_s *ep0info = (FAR struct stm32l4_ctrlinfo_s *)ep0;
@ -4006,8 +4010,8 @@ static int stm32l4_ep0configure(FAR struct usbhost_driver_s *drvr, usbhost_ep_t
************************************************************************************/ ************************************************************************************/
static int stm32l4_epalloc(FAR struct usbhost_driver_s *drvr, static int stm32l4_epalloc(FAR struct usbhost_driver_s *drvr,
FAR const struct usbhost_epdesc_s *epdesc, FAR const struct usbhost_epdesc_s *epdesc,
FAR usbhost_ep_t *ep) FAR usbhost_ep_t *ep)
{ {
FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr; FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr;
int ret; int ret;
@ -4129,9 +4133,9 @@ static int stm32l4_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep)
* - Never called from an interrupt handler. * - Never called from an interrupt handler.
* *
****************************************************************************/ ****************************************************************************/
#warning this function name is too generic
static int stm32l4_alloc(FAR struct usbhost_driver_s *drvr, static int stm32l4_alloc(FAR struct usbhost_driver_s *drvr,
FAR uint8_t **buffer, FAR size_t *maxlen) FAR uint8_t **buffer, FAR size_t *maxlen)
{ {
FAR uint8_t *alloc; FAR uint8_t *alloc;
@ -4174,7 +4178,7 @@ static int stm32l4_alloc(FAR struct usbhost_driver_s *drvr,
* - Never called from an interrupt handler. * - Never called from an interrupt handler.
* *
****************************************************************************/ ****************************************************************************/
#warning this function name is too generic
static int stm32l4_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) static int stm32l4_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer)
{ {
/* There is no special memory requirement */ /* There is no special memory requirement */
@ -4210,9 +4214,9 @@ static int stm32l4_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer)
* This function will *not* be called from an interrupt handler. * This function will *not* be called from an interrupt handler.
* *
************************************************************************************/ ************************************************************************************/
#warning this function name is too generic
static int stm32l4_ioalloc(FAR struct usbhost_driver_s *drvr, static int stm32l4_ioalloc(FAR struct usbhost_driver_s *drvr,
FAR uint8_t **buffer, size_t buflen) FAR uint8_t **buffer, size_t buflen)
{ {
FAR uint8_t *alloc; FAR uint8_t *alloc;
@ -4254,7 +4258,7 @@ static int stm32l4_ioalloc(FAR struct usbhost_driver_s *drvr,
* This function will *not* be called from an interrupt handler. * This function will *not* be called from an interrupt handler.
* *
************************************************************************************/ ************************************************************************************/
#warning this function name is too generic
static int stm32l4_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer) static int stm32l4_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer)
{ {
/* There is no special memory requirement */ /* There is no special memory requirement */
@ -4300,8 +4304,8 @@ static int stm32l4_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer
****************************************************************************/ ****************************************************************************/
static int stm32l4_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, static int stm32l4_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
FAR const struct usb_ctrlreq_s *req, FAR const struct usb_ctrlreq_s *req,
FAR uint8_t *buffer) FAR uint8_t *buffer)
{ {
FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr; FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr;
FAR struct stm32l4_ctrlinfo_s *ep0info = (FAR struct stm32l4_ctrlinfo_s *)ep0; FAR struct stm32l4_ctrlinfo_s *ep0info = (FAR struct stm32l4_ctrlinfo_s *)ep0;
@ -4385,8 +4389,8 @@ static int stm32l4_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
} }
static int stm32l4_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, static int stm32l4_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
FAR const struct usb_ctrlreq_s *req, FAR const struct usb_ctrlreq_s *req,
FAR const uint8_t *buffer) FAR const uint8_t *buffer)
{ {
FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr; FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr;
FAR struct stm32l4_ctrlinfo_s *ep0info = (FAR struct stm32l4_ctrlinfo_s *)ep0; FAR struct stm32l4_ctrlinfo_s *ep0info = (FAR struct stm32l4_ctrlinfo_s *)ep0;
@ -4510,7 +4514,7 @@ static int stm32l4_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
****************************************************************************/ ****************************************************************************/
static ssize_t stm32l4_transfer(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep, static ssize_t stm32l4_transfer(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep,
FAR uint8_t *buffer, size_t buflen) FAR uint8_t *buffer, size_t buflen)
{ {
FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr; FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr;
unsigned int chidx = (unsigned int)ep; unsigned int chidx = (unsigned int)ep;
@ -4576,8 +4580,8 @@ static ssize_t stm32l4_transfer(FAR struct usbhost_driver_s *drvr, usbhost_ep_t
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
static int stm32l4_asynch(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep, static int stm32l4_asynch(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep,
FAR uint8_t *buffer, size_t buflen, FAR uint8_t *buffer, size_t buflen,
usbhost_asynch_t callback, FAR void *arg) usbhost_asynch_t callback, FAR void *arg)
{ {
FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr; FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr;
unsigned int chidx = (unsigned int)ep; unsigned int chidx = (unsigned int)ep;
@ -4717,8 +4721,8 @@ static int stm32l4_cancel(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep)
#ifdef CONFIG_USBHOST_HUB #ifdef CONFIG_USBHOST_HUB
static int stm32l4_connect(FAR struct usbhost_driver_s *drvr, static int stm32l4_connect(FAR struct usbhost_driver_s *drvr,
FAR struct usbhost_hubport_s *hport, FAR struct usbhost_hubport_s *hport,
bool connected) bool connected)
{ {
FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr; FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr;
irqstate_t flags; irqstate_t flags;
@ -4771,7 +4775,7 @@ static int stm32l4_connect(FAR struct usbhost_driver_s *drvr,
****************************************************************************/ ****************************************************************************/
static void stm32l4_disconnect(FAR struct usbhost_driver_s *drvr, static void stm32l4_disconnect(FAR struct usbhost_driver_s *drvr,
FAR struct usbhost_hubport_s *hport) FAR struct usbhost_hubport_s *hport)
{ {
DEBUGASSERT(hport != NULL); DEBUGASSERT(hport != NULL);
hport->devclass = NULL; hport->devclass = NULL;

View File

@ -535,7 +535,7 @@ static void rtc_resume(void)
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_RTC_ALARM #ifdef CONFIG_RTC_ALARM
static int stm32l4_rtc_alarm_handler(int irq, void *context) static int stm32l4_rtc_alarm_handler(int irq, FAR void *context)
{ {
FAR struct alm_cbinfo_s *cbinfo; FAR struct alm_cbinfo_s *cbinfo;
alm_callback_t cb; alm_callback_t cb;

View File

@ -152,7 +152,7 @@ static struct stm32l4_tickless_s g_tickless;
* *
****************************************************************************/ ****************************************************************************/
static void stm32l4_oneshot_handler(void *arg) static void stm32l4_oneshot_handler(FAR void *arg)
{ {
tmrinfo("Expired...\n"); tmrinfo("Expired...\n");
sched_timer_expiration(); sched_timer_expiration();

View File

@ -217,7 +217,7 @@
struct stm32l4_tim_priv_s struct stm32l4_tim_priv_s
{ {
const struct stm32l4_tim_ops_s *ops; FAR const struct stm32l4_tim_ops_s *ops;
stm32l4_tim_mode_t mode; stm32l4_tim_mode_t mode;
uint32_t base; /* TIMn base address */ uint32_t base; /* TIMn base address */
}; };
@ -229,16 +229,16 @@ struct stm32l4_tim_priv_s
/* Register helpers */ /* Register helpers */
static inline uint16_t stm32l4_getreg16(FAR struct stm32l4_tim_dev_s *dev, static inline uint16_t stm32l4_getreg16(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset); uint8_t offset);
static inline void stm32l4_putreg16(FAR struct stm32l4_tim_dev_s *dev, uint8_t offset, static inline void stm32l4_putreg16(FAR struct stm32l4_tim_dev_s *dev,
uint16_t value); uint8_t offset, uint16_t value);
static inline void stm32l4_modifyreg16(FAR struct stm32l4_tim_dev_s *dev, static inline void stm32l4_modifyreg16(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset, uint16_t clearbits, uint8_t offset, uint16_t clearbits,
uint16_t setbits); uint16_t setbits);
static inline uint32_t stm32l4_getreg32(FAR struct stm32l4_tim_dev_s *dev, static inline uint32_t stm32l4_getreg32(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset); uint8_t offset);
static inline void stm32l4_putreg32(FAR struct stm32l4_tim_dev_s *dev, uint8_t offset, static inline void stm32l4_putreg32(FAR struct stm32l4_tim_dev_s *dev,
uint32_t value); uint8_t offset, uint32_t value);
/* Timer helpers */ /* Timer helpers */
@ -254,21 +254,26 @@ static void stm32l4_tim_gpioconfig(uint32_t cfg, stm32l4_tim_channel_t mode);
/* Timer methods */ /* Timer methods */
static int stm32l4_tim_setmode(FAR struct stm32l4_tim_dev_s *dev, stm32l4_tim_mode_t mode); static int stm32l4_tim_setmode(FAR struct stm32l4_tim_dev_s *dev,
static int stm32l4_tim_setclock(FAR struct stm32l4_tim_dev_s *dev, uint32_t freq); stm32l4_tim_mode_t mode);
static int stm32l4_tim_setclock(FAR struct stm32l4_tim_dev_s *dev,
uint32_t freq);
static void stm32l4_tim_setperiod(FAR struct stm32l4_tim_dev_s *dev, static void stm32l4_tim_setperiod(FAR struct stm32l4_tim_dev_s *dev,
uint32_t period); uint32_t period);
static uint32_t stm32l4_tim_getcounter(FAR struct stm32l4_tim_dev_s *dev); static uint32_t stm32l4_tim_getcounter(FAR struct stm32l4_tim_dev_s *dev);
static int stm32l4_tim_setchannel(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel, static int stm32l4_tim_setchannel(FAR struct stm32l4_tim_dev_s *dev,
stm32l4_tim_channel_t mode); uint8_t channel, stm32l4_tim_channel_t mode);
static int stm32l4_tim_setcompare(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel, static int stm32l4_tim_setcompare(FAR struct stm32l4_tim_dev_s *dev,
uint32_t compare); uint8_t channel, uint32_t compare);
static int stm32l4_tim_getcapture(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel); static int stm32l4_tim_getcapture(FAR struct stm32l4_tim_dev_s *dev,
uint8_t channel);
static int stm32l4_tim_setisr(FAR struct stm32l4_tim_dev_s *dev, static int stm32l4_tim_setisr(FAR struct stm32l4_tim_dev_s *dev,
int (*handler)(int irq, void *context), int (*handler)(int irq, FAR void *context),
int source); int source);
static void stm32l4_tim_enableint(FAR struct stm32l4_tim_dev_s *dev, int source); static void stm32l4_tim_enableint(FAR struct stm32l4_tim_dev_s *dev,
static void stm32l4_tim_disableint(FAR struct stm32l4_tim_dev_s *dev, int source); int source);
static void stm32l4_tim_disableint(FAR struct stm32l4_tim_dev_s *dev,
int source);
static void stm32l4_tim_ackint(FAR struct stm32l4_tim_dev_s *dev, int source); static void stm32l4_tim_ackint(FAR struct stm32l4_tim_dev_s *dev, int source);
static int stm32l4_tim_checkint(FAR struct stm32l4_tim_dev_s *dev, int source); static int stm32l4_tim_checkint(FAR struct stm32l4_tim_dev_s *dev, int source);
@ -403,7 +408,7 @@ struct stm32l4_tim_priv_s stm32l4_tim17_priv =
************************************************************************************/ ************************************************************************************/
static inline uint16_t stm32l4_getreg16(FAR struct stm32l4_tim_dev_s *dev, static inline uint16_t stm32l4_getreg16(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset) uint8_t offset)
{ {
return getreg16(((struct stm32l4_tim_priv_s *)dev)->base + offset); return getreg16(((struct stm32l4_tim_priv_s *)dev)->base + offset);
} }
@ -416,8 +421,8 @@ static inline uint16_t stm32l4_getreg16(FAR struct stm32l4_tim_dev_s *dev,
* *
************************************************************************************/ ************************************************************************************/
static inline void stm32l4_putreg16(FAR struct stm32l4_tim_dev_s *dev, uint8_t offset, static inline void stm32l4_putreg16(FAR struct stm32l4_tim_dev_s *dev,
uint16_t value) uint8_t offset, uint16_t value)
{ {
putreg16(value, ((struct stm32l4_tim_priv_s *)dev)->base + offset); putreg16(value, ((struct stm32l4_tim_priv_s *)dev)->base + offset);
} }
@ -431,10 +436,11 @@ static inline void stm32l4_putreg16(FAR struct stm32l4_tim_dev_s *dev, uint8_t o
************************************************************************************/ ************************************************************************************/
static inline void stm32l4_modifyreg16(FAR struct stm32l4_tim_dev_s *dev, static inline void stm32l4_modifyreg16(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset, uint16_t clearbits, uint8_t offset, uint16_t clearbits,
uint16_t setbits) uint16_t setbits)
{ {
modifyreg16(((struct stm32l4_tim_priv_s *)dev)->base + offset, clearbits, setbits); modifyreg16(((struct stm32l4_tim_priv_s *)dev)->base + offset, clearbits,
setbits);
} }
/************************************************************************************ /************************************************************************************
@ -447,7 +453,7 @@ static inline void stm32l4_modifyreg16(FAR struct stm32l4_tim_dev_s *dev,
************************************************************************************/ ************************************************************************************/
static inline uint32_t stm32l4_getreg32(FAR struct stm32l4_tim_dev_s *dev, static inline uint32_t stm32l4_getreg32(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset) uint8_t offset)
{ {
return getreg32(((struct stm32l4_tim_priv_s *)dev)->base + offset); return getreg32(((struct stm32l4_tim_priv_s *)dev)->base + offset);
} }
@ -461,8 +467,8 @@ static inline uint32_t stm32l4_getreg32(FAR struct stm32l4_tim_dev_s *dev,
* *
************************************************************************************/ ************************************************************************************/
static inline void stm32l4_putreg32(FAR struct stm32l4_tim_dev_s *dev, uint8_t offset, static inline void stm32l4_putreg32(FAR struct stm32l4_tim_dev_s *dev,
uint32_t value) uint8_t offset, uint32_t value)
{ {
putreg32(value, ((struct stm32l4_tim_priv_s *)dev)->base + offset); putreg32(value, ((struct stm32l4_tim_priv_s *)dev)->base + offset);
} }
@ -541,7 +547,8 @@ static void stm32l4_tim_gpioconfig(uint32_t cfg, stm32l4_tim_channel_t mode)
* Name: stm32l4_tim_setmode * Name: stm32l4_tim_setmode
************************************************************************************/ ************************************************************************************/
static int stm32l4_tim_setmode(FAR struct stm32l4_tim_dev_s *dev, stm32l4_tim_mode_t mode) static int stm32l4_tim_setmode(FAR struct stm32l4_tim_dev_s *dev,
stm32l4_tim_mode_t mode)
{ {
uint16_t val = ATIM_CR1_CEN | ATIM_CR1_ARPE; uint16_t val = ATIM_CR1_CEN | ATIM_CR1_ARPE;
@ -611,7 +618,8 @@ static int stm32l4_tim_setmode(FAR struct stm32l4_tim_dev_s *dev, stm32l4_tim_mo
* Name: stm32l4_tim_setclock * Name: stm32l4_tim_setclock
************************************************************************************/ ************************************************************************************/
static int stm32l4_tim_setclock(FAR struct stm32l4_tim_dev_s *dev, uint32_t freq) static int stm32l4_tim_setclock(FAR struct stm32l4_tim_dev_s *dev,
uint32_t freq)
{ {
uint32_t freqin; uint32_t freqin;
int prescaler; int prescaler;
@ -747,8 +755,8 @@ static uint32_t stm32l4_tim_getcounter(FAR struct stm32l4_tim_dev_s *dev)
* Name: stm32l4_tim_setchannel * Name: stm32l4_tim_setchannel
************************************************************************************/ ************************************************************************************/
static int stm32l4_tim_setchannel(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel, static int stm32l4_tim_setchannel(FAR struct stm32l4_tim_dev_s *dev,
stm32l4_tim_channel_t mode) uint8_t channel, stm32l4_tim_channel_t mode)
{ {
uint16_t ccmr_orig = 0; uint16_t ccmr_orig = 0;
uint16_t ccmr_val = 0; uint16_t ccmr_val = 0;
@ -1096,8 +1104,8 @@ static int stm32l4_tim_setchannel(FAR struct stm32l4_tim_dev_s *dev, uint8_t cha
* Name: stm32l4_tim_setcompare * Name: stm32l4_tim_setcompare
************************************************************************************/ ************************************************************************************/
static int stm32l4_tim_setcompare(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel, static int stm32l4_tim_setcompare(FAR struct stm32l4_tim_dev_s *dev,
uint32_t compare) uint8_t channel, uint32_t compare)
{ {
DEBUGASSERT(dev != NULL); DEBUGASSERT(dev != NULL);
@ -1125,7 +1133,8 @@ static int stm32l4_tim_setcompare(FAR struct stm32l4_tim_dev_s *dev, uint8_t cha
* Name: stm32l4_tim_getcapture * Name: stm32l4_tim_getcapture
************************************************************************************/ ************************************************************************************/
static int stm32l4_tim_getcapture(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel) static int stm32l4_tim_getcapture(FAR struct stm32l4_tim_dev_s *dev,
uint8_t channel)
{ {
DEBUGASSERT(dev != NULL); DEBUGASSERT(dev != NULL);
@ -1149,8 +1158,8 @@ static int stm32l4_tim_getcapture(FAR struct stm32l4_tim_dev_s *dev, uint8_t cha
************************************************************************************/ ************************************************************************************/
static int stm32l4_tim_setisr(FAR struct stm32l4_tim_dev_s *dev, static int stm32l4_tim_setisr(FAR struct stm32l4_tim_dev_s *dev,
int (*handler)(int irq, void *context), int (*handler)(int irq, FAR void *context),
int source) int source)
{ {
int vectorno; int vectorno;
@ -1256,7 +1265,8 @@ static void stm32l4_tim_enableint(FAR struct stm32l4_tim_dev_s *dev, int source)
* Name: stm32l4_tim_disableint * Name: stm32l4_tim_disableint
************************************************************************************/ ************************************************************************************/
static void stm32l4_tim_disableint(FAR struct stm32l4_tim_dev_s *dev, int source) static void stm32l4_tim_disableint(FAR struct stm32l4_tim_dev_s *dev,
int source)
{ {
DEBUGASSERT(dev != NULL); DEBUGASSERT(dev != NULL);
stm32l4_modifyreg16(dev, STM32L4_BTIM_DIER_OFFSET, ATIM_DIER_UIE, 0); stm32l4_modifyreg16(dev, STM32L4_BTIM_DIER_OFFSET, ATIM_DIER_UIE, 0);
@ -1386,7 +1396,7 @@ FAR struct stm32l4_tim_dev_s *stm32l4_tim_init(int timer)
* *
************************************************************************************/ ************************************************************************************/
int stm32l4_tim_deinit(FAR struct stm32l4_tim_dev_s * dev) int stm32l4_tim_deinit(FAR struct stm32l4_tim_dev_s *dev)
{ {
DEBUGASSERT(dev != NULL); DEBUGASSERT(dev != NULL);

View File

@ -144,9 +144,9 @@ static int stm32l4_timer_handler(FAR struct stm32l4_lowerhalf_s *lower);
static int stm32l4_start(FAR struct timer_lowerhalf_s *lower); static int stm32l4_start(FAR struct timer_lowerhalf_s *lower);
static int stm32l4_stop(FAR struct timer_lowerhalf_s *lower); static int stm32l4_stop(FAR struct timer_lowerhalf_s *lower);
static int stm32l4_settimeout(FAR struct timer_lowerhalf_s *lower, static int stm32l4_settimeout(FAR struct timer_lowerhalf_s *lower,
uint32_t timeout); uint32_t timeout);
static tccb_t stm32l4_sethandler(FAR struct timer_lowerhalf_s *lower, static tccb_t stm32l4_sethandler(FAR struct timer_lowerhalf_s *lower,
tccb_t handler); tccb_t handler);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@ -437,9 +437,9 @@ static int stm32l4_start(FAR struct timer_lowerhalf_s *lower)
* *
****************************************************************************/ ****************************************************************************/
static int stm32l4_stop(struct timer_lowerhalf_s *lower) static int stm32l4_stop(FAR struct timer_lowerhalf_s *lower)
{ {
struct stm32l4_lowerhalf_s *priv = (struct stm32l4_lowerhalf_s *)lower; FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)lower;
if (priv->started) if (priv->started)
{ {
@ -471,7 +471,8 @@ static int stm32l4_stop(struct timer_lowerhalf_s *lower)
* *
****************************************************************************/ ****************************************************************************/
static int stm32l4_settimeout(FAR struct timer_lowerhalf_s *lower, uint32_t timeout) static int stm32l4_settimeout(FAR struct timer_lowerhalf_s *lower,
uint32_t timeout)
{ {
FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)lower; FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)lower;
uint64_t maxtimeout; uint64_t maxtimeout;
@ -517,7 +518,7 @@ static int stm32l4_settimeout(FAR struct timer_lowerhalf_s *lower, uint32_t time
****************************************************************************/ ****************************************************************************/
static tccb_t stm32l4_sethandler(FAR struct timer_lowerhalf_s *lower, static tccb_t stm32l4_sethandler(FAR struct timer_lowerhalf_s *lower,
tccb_t newhandler) tccb_t newhandler)
{ {
FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)lower; FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)lower;