Zephyr Project API  3.3.0
A Scalable Open Source RTOS
uhc.h File Reference

USB host controller (UHC) driver API. More...

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/net/buf.h>
#include <zephyr/usb/usb_ch9.h>
#include <zephyr/sys/dlist.h>

Go to the source code of this file.

Data Structures

struct  uhc_transfer
 
struct  uhc_event
 
struct  uhc_device_caps
 
struct  uhc_data
 

Macros

#define UHC_STATUS_INITIALIZED   0
 
#define UHC_STATUS_ENABLED   1
 

Typedefs

typedef int(* uhc_event_cb_t) (const struct device *dev, const struct uhc_event *const event)
 Callback to submit UHC event to higher layer. More...
 

Enumerations

enum  uhc_event_type {
  UHC_EVT_DEV_CONNECTED_LS , UHC_EVT_DEV_CONNECTED_FS , UHC_EVT_DEV_CONNECTED_HS , UHC_EVT_DEV_REMOVED ,
  UHC_EVT_RESETED , UHC_EVT_SUSPENDED , UHC_EVT_RESUMED , UHC_EVT_RWUP ,
  UHC_EVT_EP_REQUEST , UHC_EVT_ERROR
}
 USB host controller event types. More...
 

Functions

static bool uhc_is_initialized (const struct device *dev)
 Checks whether the controller is initialized. More...
 
static bool uhc_is_enabled (const struct device *dev)
 Checks whether the controller is enabled. More...
 
static int uhc_bus_reset (const struct device *dev)
 Reset USB bus. More...
 
static int uhc_sof_enable (const struct device *dev)
 Enable Start of Frame generator. More...
 
static int uhc_bus_suspend (const struct device *dev)
 Suspend USB bus. More...
 
static int uhc_bus_resume (const struct device *dev)
 Resume USB bus. More...
 
struct uhc_transferuhc_xfer_alloc (const struct device *dev, const uint8_t addr, const uint8_t ep, const uint8_t attrib, const uint16_t mps, const uint16_t timeout, void *const owner)
 Allocate UHC transfer. More...
 
int uhc_xfer_free (const struct device *dev, struct uhc_transfer *const xfer)
 Free UHC transfer and any buffers. More...
 
struct net_bufuhc_xfer_buf_alloc (const struct device *dev, struct uhc_transfer *const xfer, const size_t size)
 Allocate UHC transfer buffer. More...
 
int uhc_xfer_buf_free (const struct device *dev, struct net_buf *const buf)
 Free UHC request buffer. More...
 
int uhc_ep_enqueue (const struct device *dev, struct uhc_transfer *const xfer)
 Queue USB host controller transfer. More...
 
int uhc_ep_dequeue (const struct device *dev, struct uhc_transfer *const xfer)
 Remove a USB host controller transfers from queue. More...
 
int uhc_init (const struct device *dev, uhc_event_cb_t event_cb)
 Initialize USB host controller. More...
 
int uhc_enable (const struct device *dev)
 Enable USB host controller. More...
 
int uhc_disable (const struct device *dev)
 Disable USB host controller. More...
 
int uhc_shutdown (const struct device *dev)
 Poweroff USB host controller. More...
 
static struct uhc_device_caps uhc_caps (const struct device *dev)
 Get USB host controller capabilities. More...
 

Detailed Description

USB host controller (UHC) driver API.