summaryrefslogtreecommitdiff
path: root/nuttx/drivers/usbhost/usbhost_skeleton.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/drivers/usbhost/usbhost_skeleton.c')
-rw-r--r--nuttx/drivers/usbhost/usbhost_skeleton.c69
1 files changed, 37 insertions, 32 deletions
diff --git a/nuttx/drivers/usbhost/usbhost_skeleton.c b/nuttx/drivers/usbhost/usbhost_skeleton.c
index b1af20f11..8a0ee452a 100644
--- a/nuttx/drivers/usbhost/usbhost_skeleton.c
+++ b/nuttx/drivers/usbhost/usbhost_skeleton.c
@@ -94,7 +94,7 @@ struct usbhost_state_s
{
/* This is the externally visible portion of the state */
- struct usbhost_class_s class;
+ struct usbhost_class_s usbclass;
/* This is an instance of the USB host driver bound to this class instance */
@@ -126,13 +126,14 @@ static void usbhost_takesem(sem_t *sem);
/* Memory allocation services */
static inline FAR struct usbhost_state_s *usbhost_allocclass(void);
-static inline void usbhost_freeclass(FAR struct usbhost_state_s *class);
+static inline void usbhost_freeclass(FAR struct usbhost_state_s *usbclass);
/* Device name management */
static int usbhost_allocdevno(FAR struct usbhost_state_s *priv);
static void usbhost_freedevno(FAR struct usbhost_state_s *priv);
-static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv, char *devname);
+static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv,
+ FAR char *devname);
/* Worker thread actions */
@@ -141,8 +142,8 @@ static void usbhost_destroy(FAR void *arg);
/* Helpers for usbhost_connect() */
static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
- FAR const uint8_t *configdesc, int desclen,
- uint8_t funcaddr);
+ FAR const uint8_t *configdesc,
+ int desclen, uint8_t funcaddr);
static inline int usbhost_devinit(FAR struct usbhost_state_s *priv);
/* (Little Endian) Data helpers */
@@ -164,10 +165,10 @@ static struct usbhost_class_s *usbhost_create(FAR struct usbhost_driver_s *drvr,
/* struct usbhost_class_s methods */
-static int usbhost_connect(FAR struct usbhost_class_s *class,
+static int usbhost_connect(FAR struct usbhost_class_s *usbclass,
FAR const uint8_t *configdesc, int desclen,
uint8_t funcaddr);
-static int usbhost_disconnected(FAR struct usbhost_class_s *class);
+static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass);
/* Driver methods -- depend upon the type of NuttX driver interface exported */
@@ -221,7 +222,7 @@ static void usbhost_takesem(sem_t *sem)
while (sem_wait(sem) != 0)
{
- /* The only case that an error should occr here is if the wait was
+ /* The only case that an error should occur here is if the wait was
* awakened by a signal.
*/
@@ -265,23 +266,23 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void)
* Free a class instance previously allocated by usbhost_allocclass().
*
* Input Parameters:
- * class - A reference to the class instance to be freed.
+ * usbclass - A reference to the class instance to be freed.
*
* Returned Values:
* None
*
****************************************************************************/
-static inline void usbhost_freeclass(FAR struct usbhost_state_s *class)
+static inline void usbhost_freeclass(FAR struct usbhost_state_s *usbclass)
{
- DEBUGASSERT(class != NULL);
+ DEBUGASSERT(usbclass != NULL);
/* Free the class instance (perhaps calling sched_kmm_free() in case we are
* executing from an interrupt handler.
*/
- uvdbg("Freeing: %p\n", class);;
- kmm_free(class);
+ uvdbg("Freeing: %p\n", usbclass);;
+ kmm_free(usbclass);
}
/****************************************************************************
@@ -326,7 +327,8 @@ static void usbhost_freedevno(FAR struct usbhost_state_s *priv)
}
}
-static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv, char *devname)
+static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv,
+ FAR char *devname)
{
(void)snprintf(devname, DEV_NAMELEN, DEV_FORMAT, priv->devchar);
}
@@ -335,7 +337,7 @@ static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv, char *dev
* Name: usbhost_destroy
*
* Description:
- * The USB device has been disconnected and the refernce count on the USB
+ * The USB device has been disconnected and the reference count on the USB
* host class instance has gone to 1.. Time to destroy the USB host class
* instance.
*
@@ -390,10 +392,11 @@ static void usbhost_destroy(FAR void *arg)
*
* Input Parameters:
* priv - The USB host class instance.
- * configdesc - A pointer to a uint8_t buffer container the configuration descripor.
+ * configdesc - A pointer to a uint8_t buffer container the configuration
+ * descriptor.
* desclen - The length in bytes of the configuration descriptor.
- * funcaddr - The USB address of the function containing the endpoint that EP0
- * controls
+ * funcaddr - The USB address of the function containing the endpoint that
+ * EP0 controls
*
* Returned Values:
* On success, zero (OK) is returned. On a failure, a negated errno value is
@@ -863,12 +866,12 @@ static FAR struct usbhost_class_s *usbhost_create(FAR struct usbhost_driver_s *d
{
/* Initialize class method function pointers */
- priv->class.connect = usbhost_connect;
- priv->class.disconnected = usbhost_disconnected;
+ priv->usbclass.connect = usbhost_connect;
+ priv->usbclass.disconnected = usbhost_disconnected;
/* The initial reference count is 1... One reference is held by the driver */
- priv->crefs = 1;
+ priv->crefs = 1;
/* Initialize semphores (this works okay in the interrupt context) */
@@ -876,11 +879,11 @@ static FAR struct usbhost_class_s *usbhost_create(FAR struct usbhost_driver_s *d
/* Bind the driver to the storage class instance */
- priv->drvr = drvr;
+ priv->drvr = drvr;
/* Return the instance of the USB class driver */
- return &priv->class;
+ return &priv->usbclass;
}
}
@@ -906,11 +909,13 @@ static FAR struct usbhost_class_s *usbhost_create(FAR struct usbhost_driver_s *d
* descriptor to the class so that the class may initialize properly
*
* Input Parameters:
- * class - The USB host class entry previously obtained from a call to create().
- * configdesc - A pointer to a uint8_t buffer container the configuration descripor.
+ * usbclass - The USB host class entry previously obtained from a call to
+ * create().
+ * configdesc - A pointer to a uint8_t buffer container the configuration
+ * descriptor.
* desclen - The length in bytes of the configuration descriptor.
- * funcaddr - The USB address of the function containing the endpoint that EP0
- * controls
+ * funcaddr - The USB address of the function containing the endpoint
+ * that EP0 controls
*
* Returned Values:
* On success, zero (OK) is returned. On a failure, a negated errno value is
@@ -927,11 +932,11 @@ static FAR struct usbhost_class_s *usbhost_create(FAR struct usbhost_driver_s *d
*
****************************************************************************/
-static int usbhost_connect(FAR struct usbhost_class_s *class,
+static int usbhost_connect(FAR struct usbhost_class_s *usbclass,
FAR const uint8_t *configdesc, int desclen,
uint8_t funcaddr)
{
- FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)class;
+ FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass;
int ret;
DEBUGASSERT(priv != NULL &&
@@ -969,7 +974,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *class,
* been disconnected.
*
* Input Parameters:
- * class - The USB host class entry previously obtained from a call to
+ * usbclass - The USB host class entry previously obtained from a call to
* create().
*
* Returned Values:
@@ -981,9 +986,9 @@ static int usbhost_connect(FAR struct usbhost_class_s *class,
*
****************************************************************************/
-static int usbhost_disconnected(struct usbhost_class_s *class)
+static int usbhost_disconnected(struct usbhost_class_s *usbclass)
{
- FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)class;
+ FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass;
irqstate_t flags;
DEBUGASSERT(priv != NULL);