usb: document revision and typo fixing

This slightly revised the USB host documentation and fixed typos
encountered in the document and some source files.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
Yanfeng Liu 2024-01-19 10:00:44 +08:00 committed by Xiang Xiao
parent 85238fa4de
commit c3aab93e5f
4 changed files with 39 additions and 40 deletions

View File

@ -2,36 +2,36 @@
USB Host-Side Drivers
=====================
- ``include/nuttx/usb/usbhost.h``. All structures and APIs
needed to work with USB host-side drivers are provided in this
header file.
- **USB host controller driver** abstracts the host controller
device in the target chip. Each USB host controller driver
must implement an instance of ``struct usbhost_driver_s`` and
``struct usbhost_connection_s`` defined in
``include/nuttx/usb/usbhost.h``.
- ``struct usbhost_driver_s`` provides the interface between
the USB host driver and the USB host class driver.
- ``struct usbhost_connection_s`` provides the interface between
the USB host driver and platform-specific connection management
and device enumeration logic.
- ``struct usbhost_driver_s`` and
``struct usbhost_connection_s``. Each USB host controller
driver must implement an instance of
``struct usbhost_driver_s`` and
``struct usbhost_connection_s``: ``struct usbhost_driver_s``
provides the interface between the USB host driver and the USB
class driver; ``struct usbhost_connection_s`` provides the
interface between the USB host driver and platform-specific
connection management and device enumeration logic. These
structures are defined in ``include/nuttx/usb/usbhost.h``.
**Examples**: ``arch/arm/src/lpc17xx_40xx/lpc17_40_usbhost.c``,
``arch/arm/src/stm32/stm32_otgfshost.c``,
``arch/arm/src/sama5/sam_ohci.c``, and
``arch/arm/src/sama5/sam_ehci.c``.
- ``struct usbhost_class_s``. Each USB host class driver must
implement an instance of ``struct usbhost_class_s``. This
structure is also defined in ``include/nuttx/usb/usbhost.h``.
- **USB host class driver** abstracts USB peripherals conected to
the USB host controller. Each USB host class driver must implement
an instance of ``struct usbhost_class_s`` defined also in
``include/nuttx/usb/usbhost.h``.
**Examples**: ``drivers/usbhost/usbhost_storage.c``
- **USB Host Class Driver Registry**. The NuttX USB host
infrastructure includes a *registry*. During its
initialization, each USB host class driver must call the
interface, ``usbhost_registerclass()`` in order add its
interface, ``usbhost_registerclass()`` in order to add its
interface to the registry. Later, when a USB device is
connected, the USB host controller will look up the USB host
class driver that is needed to support the connected device in
@ -84,7 +84,7 @@ USB Host-Side Drivers
**Examples**: The function ``usbhost_msc_initialize()`` in
the file ``drivers/usbhost/usbhost_storage.c``
#. Each application must include a *waiter* thread thread that
#. Each application must include a *waiter* thread that
(1) calls the USB host controller driver's ``wait()`` to
detect the connection of a device, and then (2) call the USB
host controller driver's ``enumerate`` method to bind the

View File

@ -348,8 +348,8 @@ static int cdcecm_txpoll(FAR struct net_driver_s *dev)
*
* Description:
* After a packet has been received and dispatched to the network, it
* may return return with an outgoing packet. This function checks for
* that case and performs the transmission if necessary.
* may return with an outgoing packet. This function checks for that
* case and performs the transmission if necessary.
*
* Input Parameters:
* priv - Reference to the driver state structure
@ -401,7 +401,7 @@ static void cdcecm_receive(FAR struct cdcecm_driver_s *self)
* configuration.
*/
/* Copy the data data from the hardware to self->dev.d_buf. Set
/* Copy the data from the hardware to self->dev.d_buf. Set
* amount of data in self->dev.d_len
*/

View File

@ -256,6 +256,7 @@ static void usbhost_notification_work(FAR void *arg);
static void usbhost_notification_callback(FAR void *arg, ssize_t nbytes);
static void usbhost_rxdata_work(FAR void *arg);
static void usbhost_bulkin_work(FAR void *arg);
static void usbhost_bulkin_callback(FAR void *arg, ssize_t nbytes);
static void usbhost_destroy(FAR void *arg);

View File

@ -53,8 +53,8 @@
/* Driver support ***********************************************************/
/* This format is used to construct the /dev/skel[n] device driver path. It
* defined here so that it will be used consistently in all places.
/* The format used to construct device file path, defined for consistent use
* from all places.
*/
#define DEV_FORMAT "/dev/skel%c"
@ -73,9 +73,7 @@
* Private Types
****************************************************************************/
/* This structure contains the internal, private state of the USB host class
* driver.
*/
/* This is the internal, private state of the USB host class driver. */
struct usbhost_state_s
{
@ -85,16 +83,16 @@ struct usbhost_state_s
/* The remainder of the fields are provide to the class driver */
char devchar; /* Character identifying the /dev/skel[n] device */
volatile bool disconnected; /* TRUE: Device has been disconnected */
uint8_t ifno; /* Interface number */
int16_t crefs; /* Reference count on the driver instance */
mutex_t lock; /* Used to maintain mutual exclusive access */
struct work_s work; /* For interacting with the worker thread */
FAR uint8_t *tbuffer; /* The allocated transfer buffer */
size_t tbuflen; /* Size of the allocated transfer buffer */
usbhost_ep_t epin; /* IN endpoint */
usbhost_ep_t epout; /* OUT endpoint */
char devchar; /* char in /dev/skel[n] format name */
volatile bool disconnected; /* TRUE: Device has been disconnected */
uint8_t ifno; /* Interface number */
int16_t crefs; /* Reference count on the driver instance */
mutex_t lock; /* Used for mutual exclusive access */
struct work_s work; /* For interacting with the worker thread */
FAR uint8_t *tbuffer; /* The allocated transfer buffer */
size_t tbuflen; /* Size of the allocated transfer buffer */
usbhost_ep_t epin; /* IN endpoint */
usbhost_ep_t epout; /* OUT endpoint */
};
/****************************************************************************
@ -156,8 +154,8 @@ static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass);
* Private Data
****************************************************************************/
/* This structure provides the registry entry ID information that will be
* used to associate the USB class driver to a connected USB device.
/* This structure provides the registry entry ID information that will be
* used to associate the USB host class driver to a connected USB device.
*/
static const struct usbhost_id_s g_id =
@ -169,7 +167,7 @@ static const struct usbhost_id_s g_id =
0 /* pid */
};
/* This is the USB host storage class's registry entry */
/* This is the USB host class' registry entry */
static struct usbhost_registry_s g_skeleton =
{
@ -179,7 +177,7 @@ static struct usbhost_registry_s g_skeleton =
&g_id /* id[] */
};
/* This is a bitmap that is used to allocate device names /dev/skela-z. */
/* The bitmap depicting allocated device names in "/dev/skel[a-z]". */
static uint32_t g_devinuse;