Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
USB Host Core API

USB HOST Core Layer API. More...

Data Structures

struct  usbh_status
 USB host support status. More...
struct  usbh_context
 USB host support runtime context. More...
struct  usbh_class_filter
 Information about a device, which is relevant for matching a particular class. More...
struct  usbh_class_api
 USB host class instance API. More...
struct  usbh_class_data
 USB host class instance data. More...

Macros

#define USBH_CONTROLLER_DEFINE(device_name, uhc_dev)
#define USBH_DEFINE_CLASS(class_name, class_api, class_priv, filt)
 Define USB host support class data.

Functions

int usbh_init (struct usbh_context *uhs_ctx)
 Initialize the USB host support;.
int usbh_enable (struct usbh_context *uhs_ctx)
 Enable the USB host support and class instances.
int usbh_disable (struct usbh_context *uhs_ctx)
 Disable the USB host support.
int usbh_shutdown (struct usbh_context *const uhs_ctx)
 Shutdown the USB host support.

Detailed Description

USB HOST Core Layer API.

Macro Definition Documentation

◆ USBH_CONTROLLER_DEFINE

#define USBH_CONTROLLER_DEFINE ( device_name,
uhc_dev )

#include <zephyr/usb/usbh.h>

Value:
SYS_BITARRAY_DEFINE_STATIC(ba_##device_name, 128); \
static STRUCT_SECTION_ITERABLE(usbh_context, device_name) = { \
.name = STRINGIFY(device_name), \
.mutex = Z_MUTEX_INITIALIZER(device_name.mutex), \
.dev = uhc_dev, \
.addr_ba = &ba_##device_name, \
}
#define SYS_BITARRAY_DEFINE_STATIC(name, total_bits)
Create a static bitarray object.
Definition bitarray.h:83
#define STRUCT_SECTION_ITERABLE(struct_type, varname)
Defines a new element for an iterable section.
Definition iterable_sections.h:216
#define STRINGIFY(s)
Definition common.h:165
USB host support runtime context.
Definition usbh.h:50

◆ USBH_DEFINE_CLASS

#define USBH_DEFINE_CLASS ( class_name,
class_api,
class_priv,
filt )

#include <zephyr/usb/usbh.h>

Value:
static struct usbh_class_data UTIL_CAT(class_data_, class_name) = { \
.name = STRINGIFY(class_name), \
.api = class_api, \
.priv = class_priv, \
}; \
static STRUCT_SECTION_ITERABLE(usbh_class_node, class_name) = { \
.c_data = &UTIL_CAT(class_data_, class_name), \
.filters = filt, \
};
USB host class instance data.
Definition usbh.h:121
#define UTIL_CAT(a,...)
Definition util_internal.h:145

Define USB host support class data.

Macro defines class (function) data, as well as corresponding node structures used internally by the stack.

Parameters
[in]class_nameClass name
[in]class_apiPointer to struct usbh_class_api
[in]class_privClass private data
[in]filtArray of usbh_class_filter to match this class or NULL to match everything. When non-NULL, then it has to be terminated by an entry with flags set to 0.

Function Documentation

◆ usbh_disable()

int usbh_disable ( struct usbh_context * uhs_ctx)

#include <zephyr/usb/usbh.h>

Disable the USB host support.

This function disables the USB host support.

Parameters
[in]uhs_ctxPointer to USB host support context
Returns
0 on success, other values on fail.

◆ usbh_enable()

int usbh_enable ( struct usbh_context * uhs_ctx)

#include <zephyr/usb/usbh.h>

Enable the USB host support and class instances.

This function enables the USB host support.

Parameters
[in]uhs_ctxPointer to USB host support context
Returns
0 on success, other values on fail.

◆ usbh_init()

int usbh_init ( struct usbh_context * uhs_ctx)

#include <zephyr/usb/usbh.h>

Initialize the USB host support;.

Parameters
[in]uhs_ctxPointer to USB host support context
Returns
0 on success, other values on fail.

◆ usbh_shutdown()

int usbh_shutdown ( struct usbh_context *const uhs_ctx)

#include <zephyr/usb/usbh.h>

Shutdown the USB host support.

This function completely disables the USB host support.

Parameters
[in]uhs_ctxPointer to USB host support context
Returns
0 on success, other values on fail.