Zephyr API Documentation 3.7.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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
 UHC endpoint buffer info. More...
 
struct  uhc_event
 USB host controller event. More...
 
struct  uhc_device_caps
 USB host controller capabilities. More...
 
struct  uhc_data
 Common UHC driver data structure. More...
 

Macros

#define UHC_STATUS_INITIALIZED   0
 Controller is initialized by uhc_init()
 
#define UHC_STATUS_ENABLED   1
 Controller is enabled and all API functions are available.
 

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.
 

Enumerations

enum  uhc_control_stage { UHC_CONTROL_STAGE_SETUP = 0 , UHC_CONTROL_STAGE_DATA , UHC_CONTROL_STAGE_STATUS }
 USB control transfer stage. More...
 
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.
 
static bool uhc_is_enabled (const struct device *dev)
 Checks whether the controller is enabled.
 
static int uhc_bus_reset (const struct device *dev)
 Reset USB bus.
 
static int uhc_sof_enable (const struct device *dev)
 Enable Start of Frame generator.
 
static int uhc_bus_suspend (const struct device *dev)
 Suspend USB bus.
 
static int uhc_bus_resume (const struct device *dev)
 Resume USB bus.
 
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 udev, void *const cb)
 Allocate UHC transfer.
 
struct uhc_transferuhc_xfer_alloc_with_buf (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 udev, void *const cb, size_t size)
 Allocate UHC transfer with buffer.
 
int uhc_xfer_free (const struct device *dev, struct uhc_transfer *const xfer)
 Free UHC transfer and any buffers.
 
int uhc_xfer_buf_add (const struct device *dev, struct uhc_transfer *const xfer, struct net_buf *buf)
 Add UHC transfer buffer.
 
struct net_bufuhc_xfer_buf_alloc (const struct device *dev, const size_t size)
 Allocate UHC transfer buffer.
 
void uhc_xfer_buf_free (const struct device *dev, struct net_buf *const buf)
 Free UHC request buffer.
 
int uhc_ep_enqueue (const struct device *dev, struct uhc_transfer *const xfer)
 Queue USB host controller transfer.
 
int uhc_ep_dequeue (const struct device *dev, struct uhc_transfer *const xfer)
 Remove a USB host controller transfers from queue.
 
int uhc_init (const struct device *dev, uhc_event_cb_t event_cb)
 Initialize USB host controller.
 
int uhc_enable (const struct device *dev)
 Enable USB host controller.
 
int uhc_disable (const struct device *dev)
 Disable USB host controller.
 
int uhc_shutdown (const struct device *dev)
 Poweroff USB host controller.
 
static struct uhc_device_caps uhc_caps (const struct device *dev)
 Get USB host controller capabilities.
 

Detailed Description

USB host controller (UHC) driver API.