nuttx: fix multiple 'FAR', 'CODE' and style issues

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko
2024-08-25 19:22:15 +08:00
committed by Xiang Xiao
parent 5d17e4795a
commit d499ac9d58
275 changed files with 2130 additions and 1986 deletions
+28 -27
View File
@@ -134,8 +134,8 @@ static void usbhost_destroy(FAR void *arg);
/* Helpers for usbhci_connect() */
static inline int usbhci_cfgdesc(FAR struct usbhost_state_s *priv,
FAR const uint8_t *configdesc,
int desclen);
FAR const uint8_t *configdesc,
int desclen);
static inline int usbhost_devinit(FAR struct usbhost_state_s *priv);
/* (Little Endian) Data helpers */
@@ -150,14 +150,14 @@ static inline void usbhost_tfree(FAR struct usbhost_state_s *priv);
/* struct usbhost_registry_s methods */
static struct usbhost_class_s *
static FAR struct usbhost_class_s *
usbhost_create(FAR struct usbhost_hubport_s *hport,
FAR const struct usbhost_id_s *id);
/* struct usbhost_class_s methods */
static int usbhci_connect(FAR struct usbhost_class_s *usbclass,
FAR const uint8_t *configdesc, int desclen);
FAR const uint8_t *configdesc, int desclen);
static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass);
/* Driver methods --
@@ -172,17 +172,17 @@ static void usbhost_event_callback(FAR void *arg, ssize_t nbytes);
static void usbhost_acl_callback(FAR void *arg, ssize_t nbytes);
static ssize_t usbhost_cmd_tx(FAR struct usbhost_state_s *priv,
FAR const void *buffer, size_t buflen);
FAR const void *buffer, size_t buflen);
static ssize_t usbhost_acl_tx(FAR struct usbhost_state_s *priv,
FAR const void *buffer, size_t buflen);
FAR const void *buffer, size_t buflen);
static int usbhost_bthci_send(FAR struct bt_driver_s *dev,
enum bt_buf_type_e type,
FAR void *data, size_t len);
enum bt_buf_type_e type,
FAR void *data, size_t len);
static int usbhost_bthci_open(FAR struct bt_driver_s *dev);
static void usbhost_bthci_close(FAR struct bt_driver_s *dev);
static int usbhost_bthci_ioctl(FAR struct bt_driver_s *dev,
int cmd, unsigned long arg);
int cmd, unsigned long arg);
/****************************************************************************
* Private Data
@@ -426,14 +426,14 @@ static void usbhost_destroy(FAR void *arg)
****************************************************************************/
static inline int usbhci_cfgdesc(FAR struct usbhost_state_s *priv,
FAR const uint8_t *configdesc, int desclen)
FAR const uint8_t *configdesc, int desclen)
{
FAR struct usbhost_hubport_s *hport;
FAR struct usb_cfgdesc_s *cfgdesc;
FAR struct usb_desc_s *desc;
FAR struct usbhost_epdesc_s bindesc;
FAR struct usbhost_epdesc_s boutdesc;
FAR struct usbhost_epdesc_s iindesc;
struct usbhost_epdesc_s bindesc;
struct usbhost_epdesc_s boutdesc;
struct usbhost_epdesc_s iindesc;
int remaining;
uint8_t found = 0;
int ret;
@@ -681,15 +681,16 @@ static inline int usbhci_cfgdesc(FAR struct usbhost_state_s *priv,
static int usbhost_ctrl_cmd(FAR struct usbhost_state_s *priv,
uint8_t type, uint8_t req, uint16_t value,
uint16_t indx, uint8_t *payload, uint16_t len)
uint16_t indx, FAR uint8_t *payload,
uint16_t len)
{
FAR struct usbhost_hubport_s *hport;
struct usb_ctrlreq_s *ctrlreq;
FAR struct usb_ctrlreq_s *ctrlreq;
int ret;
hport = priv->usbclass.hport;
ctrlreq = (struct usb_ctrlreq_s *)priv->ctrlreq;
ctrlreq = (FAR struct usb_ctrlreq_s *)priv->ctrlreq;
ctrlreq->type = type;
ctrlreq->req = req;
@@ -809,7 +810,7 @@ static void usbhost_event_work(FAR void *arg)
****************************************************************************/
static ssize_t usbhost_cmd_tx(FAR struct usbhost_state_s *priv,
FAR const void *buffer, size_t buflen)
FAR const void *buffer, size_t buflen)
{
int ret;
@@ -818,7 +819,7 @@ static ssize_t usbhost_cmd_tx(FAR struct usbhost_state_s *priv,
ret = usbhost_ctrl_cmd(priv,
USB_REQ_DIR_OUT | USB_REQ_TYPE_CLASS |
USB_REQ_RECIPIENT_DEVICE,
0, 0, 0, (uint8_t *)buffer, buflen);
0, 0, 0, (FAR uint8_t *)buffer, buflen);
nxmutex_unlock(&priv->lock);
@@ -923,7 +924,7 @@ static void usbhost_acl_callback(FAR void *arg, ssize_t nbytes)
****************************************************************************/
static ssize_t usbhost_acl_tx(FAR struct usbhost_state_s *priv,
FAR const void *buffer, size_t buflen)
FAR const void *buffer, size_t buflen)
{
ssize_t nwritten = 0;
FAR struct usbhost_hubport_s *hport;
@@ -933,7 +934,7 @@ static ssize_t usbhost_acl_tx(FAR struct usbhost_state_s *priv,
nxmutex_lock(&priv->lock);
nwritten = DRVR_TRANSFER(hport->drvr, priv->bulkout,
(uint8_t *)buffer, buflen);
(FAR uint8_t *)buffer, buflen);
if (nwritten < 0)
{
@@ -968,8 +969,8 @@ static ssize_t usbhost_acl_tx(FAR struct usbhost_state_s *priv,
****************************************************************************/
static int usbhost_bthci_send(FAR struct bt_driver_s *dev,
enum bt_buf_type_e type,
FAR void *data, size_t len)
enum bt_buf_type_e type,
FAR void *data, size_t len)
{
int ret;
FAR struct usbhost_state_s *priv;
@@ -1048,7 +1049,7 @@ static void usbhost_bthci_close(FAR struct bt_driver_s *dev)
****************************************************************************/
static int usbhost_bthci_ioctl(FAR struct bt_driver_s *dev,
int cmd, unsigned long arg)
int cmd, unsigned long arg)
{
return -ENOTTY;
}
@@ -1127,7 +1128,7 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv)
*
****************************************************************************/
static inline uint16_t usbhost_getle16(const uint8_t *val)
static inline uint16_t usbhost_getle16(FAR const uint8_t *val)
{
return (uint16_t)val[1] << 8 | (uint16_t)val[0];
}
@@ -1147,7 +1148,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val)
*
****************************************************************************/
static void usbhost_putle16(uint8_t *dest, uint16_t val)
static void usbhost_putle16(FAR uint8_t *dest, uint16_t val)
{
/* Little endian means LSB first in byte stream */
@@ -1375,7 +1376,7 @@ usbhost_create(FAR struct usbhost_hubport_s *hport,
****************************************************************************/
static int usbhci_connect(FAR struct usbhost_class_s *usbclass,
FAR const uint8_t *configdesc, int desclen)
FAR const uint8_t *configdesc, int desclen)
{
FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass;
int ret;
@@ -1434,7 +1435,7 @@ static int usbhci_connect(FAR struct usbhost_class_s *usbclass,
*
****************************************************************************/
static int usbhost_disconnected(struct usbhost_class_s *usbclass)
static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass)
{
FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass;
irqstate_t flags;
+82 -81
View File
@@ -225,7 +225,7 @@ struct usbhost_cdcmbim_s
uint16_t bulkmxpacket; /* Max packet size for Bulk OUT endpoint */
uint16_t ntbseq; /* NTB sequence number */
struct pollfd *fds[CONFIG_USBHOST_CDCMBIM_NPOLLWAITERS];
FAR struct pollfd *fds[CONFIG_USBHOST_CDCMBIM_NPOLLWAITERS];
/* Network device members */
@@ -268,10 +268,10 @@ static inline int usbhost_devinit(FAR struct usbhost_cdcmbim_s *priv);
/* (Little Endian) Data helpers */
static inline uint16_t usbhost_getle16(const uint8_t *val);
static inline void usbhost_putle16(uint8_t *dest, uint16_t val);
static inline uint32_t usbhost_getle32(const uint8_t *val);
static void usbhost_putle32(uint8_t *dest, uint32_t val);
static inline uint16_t usbhost_getle16(FAR const uint8_t *val);
static inline void usbhost_putle16(FAR uint8_t *dest, uint16_t val);
static inline uint32_t usbhost_getle32(FAR const FAR uint8_t *val);
static void usbhost_putle32(FAR uint8_t *dest, uint32_t val);
/* Buffer memory management */
@@ -280,9 +280,9 @@ static void usbhost_free_buffers(FAR struct usbhost_cdcmbim_s *priv);
/* struct usbhost_registry_s methods */
static struct usbhost_class_s
*usbhost_create(FAR struct usbhost_hubport_s *hport,
FAR const struct usbhost_id_s *id);
static FAR struct usbhost_class_s *
usbhost_create(FAR struct usbhost_hubport_s *hport,
FAR const struct usbhost_id_s *id);
/* struct usbhost_class_s methods */
@@ -301,16 +301,16 @@ static int cdcwdm_poll(FAR struct file *filep, FAR struct pollfd *fds,
/* NuttX network callback functions */
static int cdcmbim_ifup(struct net_driver_s *dev);
static int cdcmbim_ifdown(struct net_driver_s *dev);
static int cdcmbim_txavail(struct net_driver_s *dev);
static int cdcmbim_ifup(FAR struct net_driver_s *dev);
static int cdcmbim_ifdown(FAR struct net_driver_s *dev);
static int cdcmbim_txavail(FAR struct net_driver_s *dev);
/* Network support functions */
static void cdcmbim_receive(struct usbhost_cdcmbim_s *priv, uint8_t *buf,
size_t len);
static void cdcmbim_receive(FAR struct usbhost_cdcmbim_s *priv,
FAR uint8_t *buf, size_t len);
static int cdcmbim_txpoll(struct net_driver_s *dev);
static int cdcmbim_txpoll(FAR struct net_driver_s *dev);
/****************************************************************************
* Private Data
@@ -364,15 +364,16 @@ static uint32_t g_devinuse;
static int usbhost_ctrl_cmd(FAR struct usbhost_cdcmbim_s *priv,
uint8_t type, uint8_t req, uint16_t value,
uint16_t iface, uint8_t *payload, uint16_t len)
uint16_t iface, FAR uint8_t *payload,
uint16_t len)
{
FAR struct usbhost_hubport_s *hport;
struct usb_ctrlreq_s *ctrlreq;
FAR struct usb_ctrlreq_s *ctrlreq;
int ret;
hport = priv->usbclass.hport;
ctrlreq = (struct usb_ctrlreq_s *)priv->ctrlreq;
ctrlreq = (FAR struct usb_ctrlreq_s *)priv->ctrlreq;
ctrlreq->type = type;
ctrlreq->req = req;
@@ -508,7 +509,7 @@ static ssize_t cdcwdm_write(FAR struct file *filep, FAR const char *buffer,
USB_REQ_DIR_OUT | USB_REQ_TYPE_CLASS |
USB_REQ_RECIPIENT_INTERFACE,
USB_CDC_SEND_ENCAPSULATED_COMMAND,
0, priv->ctrlif, (uint8_t *)buffer, buflen);
0, priv->ctrlif, (FAR uint8_t *)buffer, buflen);
nxmutex_unlock(&priv->lock);
@@ -591,7 +592,7 @@ static int cdcwdm_poll(FAR struct file *filep, FAR struct pollfd *fds,
{
/* This is a request to tear down the poll. */
struct pollfd **slot = (struct pollfd **)fds->priv;
FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv;
DEBUGASSERT(slot);
/* Remove all memory of the poll setup */
@@ -710,7 +711,7 @@ static inline void usbhost_mkdevname(FAR struct usbhost_cdcmbim_s *priv,
static void usbhost_bulkin_callback(FAR void *arg, ssize_t nbytes)
{
struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *)arg;
FAR struct usbhost_cdcmbim_s *priv = (FAR struct usbhost_cdcmbim_s *)arg;
uint32_t delay = 0;
DEBUGASSERT(priv);
@@ -741,15 +742,15 @@ static void usbhost_bulkin_callback(FAR void *arg, ssize_t nbytes)
static void usbhost_bulkin_work(FAR void *arg)
{
struct usbhost_cdcmbim_s *priv;
struct usbhost_hubport_s *hport;
struct usb_cdc_ncm_nth16_s *nth;
FAR struct usbhost_cdcmbim_s *priv;
FAR struct usbhost_hubport_s *hport;
FAR struct usb_cdc_ncm_nth16_s *nth;
uint16_t ndpoffset;
uint16_t dgram_len;
uint16_t dgram_off;
uint16_t block_len;
priv = (struct usbhost_cdcmbim_s *)arg;
priv = (FAR struct usbhost_cdcmbim_s *)arg;
DEBUGASSERT(priv);
hport = priv->usbclass.hport;
@@ -770,7 +771,7 @@ static void usbhost_bulkin_work(FAR void *arg)
/* Parse the NTB header */
nth = (struct usb_cdc_ncm_nth16_s *)priv->rxnetbuf;
nth = (FAR struct usb_cdc_ncm_nth16_s *)priv->rxnetbuf;
if (usbhost_getle32(nth->signature) != USB_CDC_NCM_NTH16_SIGNATURE)
{
@@ -797,9 +798,9 @@ static void usbhost_bulkin_work(FAR void *arg)
do
{
struct usb_cdc_ncm_dpe16_s *dpe;
struct usb_cdc_ncm_ndp16_s *ndp
= (struct usb_cdc_ncm_ndp16_s *)(priv->rxnetbuf + ndpoffset);
FAR struct usb_cdc_ncm_dpe16_s *dpe;
FAR struct usb_cdc_ncm_ndp16_s *ndp
= (FAR struct usb_cdc_ncm_ndp16_s *)(priv->rxnetbuf + ndpoffset);
ndpoffset = usbhost_getle16(ndp->next_ndp_index);
@@ -820,7 +821,7 @@ static void usbhost_bulkin_work(FAR void *arg)
out:
DRVR_ASYNCH(hport->drvr, priv->bulkin,
(uint8_t *)priv->rxnetbuf, CDCMBIM_NETBUF_SIZE,
(FAR uint8_t *)priv->rxnetbuf, CDCMBIM_NETBUF_SIZE,
usbhost_bulkin_callback, priv);
nxmutex_unlock(&priv->lock);
}
@@ -853,7 +854,7 @@ static void usbhost_rxdata_work(FAR void *arg)
};
FAR struct usbhost_cdcmbim_s *priv;
struct mbim_header_s *hdr;
FAR struct mbim_header_s *hdr;
uint32_t len;
int ret;
@@ -881,7 +882,7 @@ static void usbhost_rxdata_work(FAR void *arg)
goto errout;
}
hdr = (struct mbim_header_s *)priv->comm_rxbuf;
hdr = (FAR struct mbim_header_s *)priv->comm_rxbuf;
len = usbhost_getle32(hdr->len);
if (len > priv->maxctrlsize)
@@ -1168,9 +1169,9 @@ static int usbhost_cfgdesc(FAR struct usbhost_cdcmbim_s *priv,
FAR struct usbhost_hubport_s *hport;
FAR struct usb_cfgdesc_s *cfgdesc;
FAR struct usb_desc_s *desc;
FAR struct usbhost_epdesc_s bindesc;
FAR struct usbhost_epdesc_s boutdesc;
FAR struct usbhost_epdesc_s iindesc;
struct usbhost_epdesc_s bindesc;
struct usbhost_epdesc_s boutdesc;
struct usbhost_epdesc_s iindesc;
int remaining;
uint8_t found = 0;
int ret;
@@ -1209,20 +1210,20 @@ static int usbhost_cfgdesc(FAR struct usbhost_cdcmbim_s *priv,
{
case USB_DESC_TYPE_CSINTERFACE:
{
FAR struct usb_csifdesc_s *csdesc = (FAR struct usb_csifdesc_s *)
desc;
FAR struct usb_csifdesc_s *csdesc =
(FAR struct usb_csifdesc_s *)desc;
/* MBIM functional descriptor */
if (csdesc->subtype == CDC_DSUBTYPE_MBIM)
{
FAR struct usb_mbim_desc_s *mbim =
(FAR struct usb_mbim_desc_s *)desc;
(FAR struct usb_mbim_desc_s *)desc;
priv->maxctrlsize = usbhost_getle16(mbim->max_ctrl_message);
uinfo("MBIM max control size: %u\n", priv->maxctrlsize);
uinfo("MBIM max segment size: %u\n",
usbhost_getle16(mbim->max_segment_size));
usbhost_getle16(mbim->max_segment_size));
}
}
break;
@@ -1233,8 +1234,8 @@ static int usbhost_cfgdesc(FAR struct usbhost_cdcmbim_s *priv,
case USB_DESC_TYPE_INTERFACE:
{
FAR struct usb_ifdesc_s *ifdesc = (FAR struct usb_ifdesc_s *)
configdesc;
FAR struct usb_ifdesc_s *ifdesc =
(FAR struct usb_ifdesc_s *)configdesc;
uinfo("Interface descriptor\n");
DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC);
@@ -1267,8 +1268,8 @@ static int usbhost_cfgdesc(FAR struct usbhost_cdcmbim_s *priv,
case USB_DESC_TYPE_ENDPOINT:
{
FAR struct usb_epdesc_s *epdesc = (FAR struct usb_epdesc_s *)
configdesc;
FAR struct usb_epdesc_s *epdesc =
(FAR struct usb_epdesc_s *)configdesc;
uinfo("Endpoint descriptor\n");
DEBUGASSERT(remaining >= USB_SIZEOF_EPDESC);
@@ -1479,7 +1480,7 @@ static int cdc_ncm_read_parameters(FAR struct usbhost_cdcmbim_s *priv)
USB_REQ_DIR_IN | USB_REQ_TYPE_CLASS |
USB_REQ_RECIPIENT_INTERFACE,
USB_CDC_GET_NTB_PARAMETERS,
0, priv->ctrlif, (uint8_t *)&params,
0, priv->ctrlif, (FAR uint8_t *)&params,
sizeof(params));
if (ret == OK)
{
@@ -1556,7 +1557,7 @@ static inline int usbhost_devinit(FAR struct usbhost_cdcmbim_s *priv)
printf("set NTB input size failed: %d\n", ret);
}
#if 0
#if 0
/* Set max datagram size to MTU */
ret = cdc_ncm_set_max_dgram_size(priv, 2048);
@@ -1564,7 +1565,7 @@ static inline int usbhost_devinit(FAR struct usbhost_cdcmbim_s *priv)
{
printf("Failed to set max dgram size: %d\n", ret);
}
#endif
#endif
/* Register the driver */
@@ -1656,7 +1657,7 @@ static inline int usbhost_devinit(FAR struct usbhost_cdcmbim_s *priv)
*
****************************************************************************/
static inline uint16_t usbhost_getle16(const uint8_t *val)
static inline uint16_t usbhost_getle16(FAR const uint8_t *val)
{
return (uint16_t)val[1] << 8 | (uint16_t)val[0];
}
@@ -1676,7 +1677,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val)
*
****************************************************************************/
static void usbhost_putle16(uint8_t *dest, uint16_t val)
static void usbhost_putle16(FAR uint8_t *dest, uint16_t val)
{
dest[0] = val & 0xff; /* Little endian means LS byte first in byte stream */
dest[1] = val >> 8;
@@ -1697,12 +1698,12 @@ static void usbhost_putle16(uint8_t *dest, uint16_t val)
*
****************************************************************************/
static inline uint32_t usbhost_getle32(const uint8_t *val)
static inline uint32_t usbhost_getle32(FAR const uint8_t *val)
{
/* Little endian means LS halfword first in byte stream */
return (uint32_t)usbhost_getle16(&val[2]) << 16 |
(uint32_t)usbhost_getle16(val);
(uint32_t)usbhost_getle16(val);
}
/****************************************************************************
@@ -1720,7 +1721,7 @@ static inline uint32_t usbhost_getle32(const uint8_t *val)
*
****************************************************************************/
static void usbhost_putle32(uint8_t *dest, uint32_t val)
static void usbhost_putle32(FAR uint8_t *dest, uint32_t val)
{
/* Little endian means LS halfword first in byte stream */
@@ -1890,9 +1891,9 @@ static void usbhost_free_buffers(FAR struct usbhost_cdcmbim_s *priv)
*
****************************************************************************/
static FAR struct usbhost_class_s
*usbhost_create(FAR struct usbhost_hubport_s *hport,
FAR const struct usbhost_id_s *id)
static FAR struct usbhost_class_s *
usbhost_create(FAR struct usbhost_hubport_s *hport,
FAR const struct usbhost_id_s *id)
{
FAR struct usbhost_cdcmbim_s *priv;
@@ -1979,8 +1980,8 @@ static FAR struct usbhost_class_s
static int usbhost_connect(FAR struct usbhost_class_s *usbclass,
FAR const uint8_t *configdesc, int desclen)
{
FAR struct usbhost_cdcmbim_s *priv = (FAR struct usbhost_cdcmbim_s *)
usbclass;
FAR struct usbhost_cdcmbim_s *priv =
(FAR struct usbhost_cdcmbim_s *)usbclass;
int ret;
DEBUGASSERT(priv != NULL &&
@@ -2030,10 +2031,10 @@ static int usbhost_connect(FAR struct usbhost_class_s *usbclass,
*
****************************************************************************/
static int usbhost_disconnected(struct usbhost_class_s *usbclass)
static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass)
{
FAR struct usbhost_cdcmbim_s *priv = (FAR struct usbhost_cdcmbim_s *)
usbclass;
FAR struct usbhost_cdcmbim_s *priv =
(FAR struct usbhost_cdcmbim_s *)usbclass;
irqstate_t flags;
DEBUGASSERT(priv != NULL);
@@ -2099,12 +2100,12 @@ static int usbhost_disconnected(struct usbhost_class_s *usbclass)
*
****************************************************************************/
static int cdcmbim_transmit(struct usbhost_cdcmbim_s *priv)
static int cdcmbim_transmit(FAR struct usbhost_cdcmbim_s *priv)
{
struct usbhost_hubport_s *hport;
struct usb_cdc_ncm_nth16_s *nth;
struct usb_cdc_ncm_ndp16_s *ndp;
struct usb_cdc_ncm_dpe16_s *dpe;
FAR struct usbhost_hubport_s *hport;
FAR struct usb_cdc_ncm_nth16_s *nth;
FAR struct usb_cdc_ncm_ndp16_s *ndp;
FAR struct usb_cdc_ncm_dpe16_s *dpe;
ssize_t ret;
uint16_t len = 0;
@@ -2117,7 +2118,7 @@ static int cdcmbim_transmit(struct usbhost_cdcmbim_s *priv)
NETDEV_TXPACKETS(&priv->netdev);
len = sizeof(struct usb_cdc_ncm_nth16_s);
nth = (struct usb_cdc_ncm_nth16_s *)priv->txnetbuf;
nth = (FAR struct usb_cdc_ncm_nth16_s *)priv->txnetbuf;
/* Begin filling NTH */
@@ -2192,8 +2193,8 @@ static int cdcmbim_transmit(struct usbhost_cdcmbim_s *priv)
*
****************************************************************************/
static void cdcmbim_receive(struct usbhost_cdcmbim_s *priv,
uint8_t *buf, size_t len)
static void cdcmbim_receive(FAR struct usbhost_cdcmbim_s *priv,
FAR uint8_t *buf, size_t len)
{
uinfo("received packet: %d len\n", len);
@@ -2263,10 +2264,10 @@ static void cdcmbim_receive(struct usbhost_cdcmbim_s *priv,
*
****************************************************************************/
static int cdcmbim_txpoll(struct net_driver_s *dev)
static int cdcmbim_txpoll(FAR struct net_driver_s *dev)
{
struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *)
dev->d_private;
FAR struct usbhost_cdcmbim_s *priv =
(FAR struct usbhost_cdcmbim_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
@@ -2302,11 +2303,11 @@ static int cdcmbim_txpoll(struct net_driver_s *dev)
*
****************************************************************************/
static int cdcmbim_ifup(struct net_driver_s *dev)
static int cdcmbim_ifup(FAR struct net_driver_s *dev)
{
struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *)
dev->d_private;
struct usbhost_hubport_s *hport = priv->usbclass.hport;
FAR struct usbhost_cdcmbim_s *priv =
(FAR struct usbhost_cdcmbim_s *)dev->d_private;
FAR struct usbhost_hubport_s *hport = priv->usbclass.hport;
int ret;
#ifdef CONFIG_NET_IPv4
@@ -2354,10 +2355,10 @@ static int cdcmbim_ifup(struct net_driver_s *dev)
*
****************************************************************************/
static int cdcmbim_ifdown(struct net_driver_s *dev)
static int cdcmbim_ifdown(FAR struct net_driver_s *dev)
{
struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *)
dev->d_private;
FAR struct usbhost_cdcmbim_s *priv =
(FAR struct usbhost_cdcmbim_s *)dev->d_private;
irqstate_t flags;
flags = enter_critical_section();
@@ -2389,9 +2390,9 @@ static int cdcmbim_ifdown(struct net_driver_s *dev)
*
****************************************************************************/
static void cdcmbim_txavail_work(void *arg)
static void cdcmbim_txavail_work(FAR void *arg)
{
struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *)arg;
FAR struct usbhost_cdcmbim_s *priv = (FAR struct usbhost_cdcmbim_s *)arg;
net_lock();
@@ -2424,10 +2425,10 @@ static void cdcmbim_txavail_work(void *arg)
*
****************************************************************************/
static int cdcmbim_txavail(struct net_driver_s *dev)
static int cdcmbim_txavail(FAR struct net_driver_s *dev)
{
struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *)
dev->d_private;
FAR struct usbhost_cdcmbim_s *priv =
(FAR struct usbhost_cdcmbim_s *)dev->d_private;
if (work_available(&priv->txpollwork))
{
+11 -10
View File
@@ -215,7 +215,7 @@ struct usbhost_state_s
* retained in the f_priv field of the 'struct file'.
*/
struct pollfd *fds[CONFIG_HIDKBD_NPOLLWAITERS];
FAR struct pollfd *fds[CONFIG_HIDKBD_NPOLLWAITERS];
/* Buffer used to collect and buffer incoming keyboard characters */
@@ -280,7 +280,7 @@ static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv,
uint8_t scancode,
uint8_t modifier);
#endif
static int usbhost_kbdpoll(int argc, char *argv[]);
static int usbhost_kbdpoll(int argc, FAR char *argv[]);
#ifdef CONFIG_HIDKBD_NOGETREPORT
static void usbhost_kbd_work(FAR void *arg);
@@ -291,7 +291,8 @@ static int usbhost_extract_keys(FAR struct usbhost_state_s *priv);
static int usbhost_send_request(FAR struct usbhost_state_s *priv,
uint8_t dir, uint8_t req, uint16_t value,
uint16_t index, uint16_t len, uint8_t *data);
uint16_t index, uint16_t len,
FAR uint8_t *data);
static inline bool usbhost_get_capslock(void);
static inline void usbhost_toggle_capslock(void);
@@ -305,8 +306,8 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv);
/* (Little Endian) Data helpers */
static inline uint16_t usbhost_getle16(const uint8_t *val);
static inline void usbhost_putle16(uint8_t *dest, uint16_t val);
static inline uint16_t usbhost_getle16(FAR const uint8_t *val);
static inline void usbhost_putle16(FAR uint8_t *dest, uint16_t val);
/* Transfer descriptor memory management */
@@ -1365,7 +1366,7 @@ static void usbhost_kbd_callback(FAR void *arg, ssize_t nbytes)
*
****************************************************************************/
static int usbhost_kbdpoll(int argc, char *argv[])
static int usbhost_kbdpoll(int argc, FAR char *argv[])
{
FAR struct usbhost_state_s *priv;
irqstate_t flags;
@@ -2035,7 +2036,7 @@ errout:
*
****************************************************************************/
static inline uint16_t usbhost_getle16(const uint8_t *val)
static inline uint16_t usbhost_getle16(FAR const uint8_t *val)
{
return (uint16_t)val[1] << 8 | (uint16_t)val[0];
}
@@ -2055,7 +2056,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val)
*
****************************************************************************/
static void usbhost_putle16(uint8_t *dest, uint16_t val)
static void usbhost_putle16(FAR uint8_t *dest, uint16_t val)
{
dest[0] = val & 0xff; /* Little endian means LS byte first in byte stream */
dest[1] = val >> 8;
@@ -2207,7 +2208,7 @@ static int usbhost_send_request(FAR struct usbhost_state_s *priv,
uint16_t value,
uint16_t index,
uint16_t len,
uint8_t *data)
FAR uint8_t *data)
{
FAR struct usbhost_hubport_s *hport;
int ret = OK;
@@ -2852,7 +2853,7 @@ static int usbhost_poll(FAR struct file *filep, FAR struct pollfd *fds,
{
/* This is a request to tear down the poll. */
struct pollfd **slot = (struct pollfd **)fds->priv;
FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv;
DEBUGASSERT(slot);
/* Remove all memory of the poll setup */
+5 -5
View File
@@ -242,7 +242,7 @@ struct usbhost_state_s
* bound to this class instance
*/
struct usbhost_driver_s *drvr;
FAR struct usbhost_driver_s *drvr;
/* The remainder of the fields are provide o the mouse class driver */
@@ -280,7 +280,7 @@ struct usbhost_state_s
* retained in the f_priv field of the 'struct file'.
*/
struct pollfd *fds[CONFIG_HIDMOUSE_NPOLLWAITERS];
FAR struct pollfd *fds[CONFIG_HIDMOUSE_NPOLLWAITERS];
};
/****************************************************************************
@@ -310,7 +310,7 @@ static bool usbhost_touchscreen(FAR struct usbhost_state_s *priv,
FAR struct usbhid_mousereport_s *rpt);
#endif
static bool usbhost_threshold(FAR struct usbhost_state_s *priv);
static int usbhost_mouse_poll(int argc, char *argv[]);
static int usbhost_mouse_poll(int argc, FAR char *argv[]);
static int usbhost_sample(FAR struct usbhost_state_s *priv,
FAR struct mouse_sample_s *sample);
static int usbhost_waitsample(FAR struct usbhost_state_s *priv,
@@ -939,7 +939,7 @@ static bool usbhost_threshold(FAR struct usbhost_state_s *priv)
*
****************************************************************************/
static int usbhost_mouse_poll(int argc, char *argv[])
static int usbhost_mouse_poll(int argc, FAR char *argv[])
{
FAR struct usbhost_state_s *priv;
FAR struct usbhost_hubport_s *hport;
@@ -2384,7 +2384,7 @@ static int usbhost_poll(FAR struct file *filep, FAR struct pollfd *fds,
{
/* This is a request to tear down the poll. */
struct pollfd **slot = (struct pollfd **)fds->priv;
FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv;
DEBUGASSERT(slot);
/* Remove all memory of the poll setup */
+19 -19
View File
@@ -176,7 +176,7 @@ struct usbhost_state_s
* retained in the f_priv field of the 'struct file'.
*/
struct pollfd *fds[CONFIG_XBOXCONTROLLER_NPOLLWAITERS];
FAR struct pollfd *fds[CONFIG_XBOXCONTROLLER_NPOLLWAITERS];
};
/****************************************************************************
@@ -202,7 +202,7 @@ static void usbhost_destroy(FAR void *arg);
/* Polling support */
static void usbhost_pollnotify(FAR struct usbhost_state_s *dev);
static int usbhost_xboxcontroller_poll(int argc, char *argv[]);
static int usbhost_xboxcontroller_poll(int argc, FAR char *argv[]);
/* Helpers for usbhost_connect() */
@@ -213,8 +213,8 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv);
/* (Little Endian) Data helpers */
static inline uint16_t usbhost_getle16(const uint8_t *val);
static inline void usbhost_putle16(uint8_t *dest, uint16_t val);
static inline uint16_t usbhost_getle16(FAR const uint8_t *val);
static inline void usbhost_putle16(FAR uint8_t *dest, uint16_t val);
/* Transfer descriptor memory management */
@@ -540,7 +540,7 @@ static void usbhost_pollnotify(FAR struct usbhost_state_s *priv)
*
****************************************************************************/
static int usbhost_xboxcontroller_poll(int argc, char *argv[])
static int usbhost_xboxcontroller_poll(int argc, FAR char *argv[])
{
FAR struct usbhost_state_s *priv;
FAR struct usbhost_hubport_s *hport;
@@ -791,18 +791,18 @@ static int usbhost_xboxcontroller_poll(int argc, char *argv[])
XBOX_BUTTON_STICK_RIGHT_INDEX,
XBOX_BUTTON_STICK_RIGHT_MASK);
priv->rpt.trigger_left =
((int16_t *)(priv->tbuffer))[XBOX_BUTTON_TRIGGER_LEFT];
priv->rpt.trigger_right =
((int16_t *)(priv->tbuffer))[XBOX_BUTTON_TRIGGER_RIGHT];
priv->rpt.stick_left_x =
((int16_t *)(priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_X];
priv->rpt.stick_left_y =
((int16_t *)(priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_Y];
priv->rpt.stick_right_x =
((int16_t *)(priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_X];
priv->rpt.stick_right_y =
((int16_t *)(priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_Y];
priv->rpt.trigger_left = ((FAR int16_t *)
(priv->tbuffer))[XBOX_BUTTON_TRIGGER_LEFT];
priv->rpt.trigger_right = ((FAR int16_t *)
(priv->tbuffer))[XBOX_BUTTON_TRIGGER_RIGHT];
priv->rpt.stick_left_x = ((FAR int16_t *)
(priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_X];
priv->rpt.stick_left_y = ((FAR int16_t *)
(priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_Y];
priv->rpt.stick_right_x = ((FAR int16_t *)
(priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_X];
priv->rpt.stick_right_y = ((FAR int16_t *)
(priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_Y];
priv->valid = true;
@@ -1381,7 +1381,7 @@ errout:
*
****************************************************************************/
static inline uint16_t usbhost_getle16(const uint8_t *val)
static inline uint16_t usbhost_getle16(FAR const uint8_t *val)
{
return (uint16_t)val[1] << 8 | (uint16_t)val[0];
}
@@ -1401,7 +1401,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val)
*
****************************************************************************/
static void usbhost_putle16(uint8_t *dest, uint16_t val)
static void usbhost_putle16(FAR uint8_t *dest, uint16_t val)
{
dest[0] = val & 0xff; /* Little endian means LS byte first in byte stream */
dest[1] = val >> 8;