| 
    Zephyr Project API
    3.3.0
    
   A Scalable Open Source RTOS 
   | 
 
USB host controller (UHC) driver API. More...
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_transfer * | uhc_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_buf * | uhc_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... | |
USB host controller (UHC) driver API.
| #define UHC_STATUS_ENABLED 1 | 
#include <include/zephyr/drivers/usb/uhc.h>
Controller is enabled and all API functions are available
| #define UHC_STATUS_INITIALIZED 0 | 
#include <include/zephyr/drivers/usb/uhc.h>
Controller is initialized by uhc_init()
| uhc_event_cb_t | 
#include <include/zephyr/drivers/usb/uhc.h>
Callback to submit UHC event to higher layer.
At the higher level, the event is to be inserted into a message queue.
| [in] | dev | Pointer to device struct of the driver instance | 
| [in] | event | Point to event structure | 
| enum uhc_event_type | 
#include <include/zephyr/drivers/usb/uhc.h>
USB host controller event types.
      
  | 
  inlinestatic | 
#include <include/zephyr/drivers/usb/uhc.h>
Reset USB bus.
Perform USB bus reset, controller may emit UHC_EVT_RESETED at the end of reset signaling.
| [in] | dev | Pointer to device struct of the driver instance | 
| -EBUSY | if the controller is already performing a bus operation | 
      
  | 
  inlinestatic | 
#include <include/zephyr/drivers/usb/uhc.h>
Resume USB bus.
Signal resume for at least 20ms, emit UHC_EVT_RESUMED at the end of USB bus resume signaling. The SoF generator should subsequently start within 3ms.
| [in] | dev | Pointer to device struct of the driver instance | 
| -EBUSY | if the controller is already performing a bus operation | 
      
  | 
  inlinestatic | 
#include <include/zephyr/drivers/usb/uhc.h>
Suspend USB bus.
Disable SOF generator and emit UHC_EVT_SUSPENDED event when USB bus is suspended.
| [in] | dev | Pointer to device struct of the driver instance | 
| -EALREADY | if already suspended | 
      
  | 
  inlinestatic | 
#include <include/zephyr/drivers/usb/uhc.h>
Get USB host controller capabilities.
Obtain the capabilities of the controller such as high speed (HS), and more.
| [in] | dev | Pointer to device struct of the driver instance | 
| int uhc_disable | ( | const struct device * | dev | ) | 
#include <include/zephyr/drivers/usb/uhc.h>
Disable USB host controller.
Disable enabled USB host controller.
| [in] | dev | Pointer to device struct of the driver instance | 
| -EALREADY | already disabled | 
| int uhc_enable | ( | const struct device * | dev | ) | 
#include <include/zephyr/drivers/usb/uhc.h>
Enable USB host controller.
Enable powered USB host controller and allow host stack to recognize and enumerate devices.
| [in] | dev | Pointer to device struct of the driver instance | 
| -EPERM | controller is not initialized | 
| -EALREADY | already enabled | 
| int uhc_ep_dequeue | ( | const struct device * | dev, | 
| struct uhc_transfer *const | xfer | ||
| ) | 
#include <include/zephyr/drivers/usb/uhc.h>
Remove a USB host controller transfers from queue.
Not implemented yet.
| [in] | dev | Pointer to device struct of the driver instance | 
| [in] | xfer | Pointer to UHC transfer | 
| -EPERM | controller is not initialized | 
| int uhc_ep_enqueue | ( | const struct device * | dev, | 
| struct uhc_transfer *const | xfer | ||
| ) | 
#include <include/zephyr/drivers/usb/uhc.h>
Queue USB host controller transfer.
Add transfer to the queue. If the queue is empty, the transfer can be claimed by the controller immediately.
| [in] | dev | Pointer to device struct of the driver instance | 
| [in] | xfer | Pointer to UHC transfer | 
| -EPERM | controller is not initialized | 
| int uhc_init | ( | const struct device * | dev, | 
| uhc_event_cb_t | event_cb | ||
| ) | 
#include <include/zephyr/drivers/usb/uhc.h>
Initialize USB host controller.
Initialize USB host controller.
| [in] | dev | Pointer to device struct of the driver instance | 
| [in] | event_cb | Event callback from the higher layer (USB host stack) | 
| -EINVAL | on parameter error (no callback is passed) | 
| -EALREADY | already initialized | 
#include <include/zephyr/drivers/usb/uhc.h>
Checks whether the controller is enabled.
| [in] | dev | Pointer to device struct of the driver instance | 
#include <include/zephyr/drivers/usb/uhc.h>
Checks whether the controller is initialized.
| [in] | dev | Pointer to device struct of the driver instance | 
| int uhc_shutdown | ( | const struct device * | dev | ) | 
#include <include/zephyr/drivers/usb/uhc.h>
Poweroff USB host controller.
Shut down the controller completely to reduce energy consumption or to change the role of the controller.
| [in] | dev | Pointer to device struct of the driver instance | 
| -EALREADY | controller is already uninitialized | 
      
  | 
  inlinestatic | 
#include <include/zephyr/drivers/usb/uhc.h>
Enable Start of Frame generator.
Enable SOF generator.
| [in] | dev | Pointer to device struct of the driver instance | 
| -EALREADY | if already enabled | 
| struct uhc_transfer * uhc_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 | ||
| ) | 
#include <include/zephyr/drivers/usb/uhc.h>
Allocate UHC transfer.
Allocate a new transfer from common transfer pool. Transfer has no buffers after allocation, these can be requested and assigned separately.
| [in] | dev | Pointer to device struct of the driver instance | 
| [in] | addr | Device (peripheral) address | 
| [in] | ep | Endpoint address | 
| [in] | attrib | Endpoint attributes | 
| [in] | mps | Maximum packet size of the endpoint | 
| [in] | timeout | Timeout in number of frames | 
| [in] | owner | Transfer owner | 
| struct net_buf * uhc_xfer_buf_alloc | ( | const struct device * | dev, | 
| struct uhc_transfer *const | xfer, | ||
| const size_t | size | ||
| ) | 
#include <include/zephyr/drivers/usb/uhc.h>
Allocate UHC transfer buffer.
Allocate a new buffer from common request buffer pool and assign it to the transfer.
| [in] | dev | Pointer to device struct of the driver instance | 
| [in] | xfer | Pointer to UHC transfer | 
| [in] | size | Size of the request buffer | 
#include <include/zephyr/drivers/usb/uhc.h>
Free UHC request buffer.
Put the buffer back into the request buffer pool.
| [in] | dev | Pointer to device struct of the driver instance | 
| [in] | buf | Pointer to UHC request buffer | 
| int uhc_xfer_free | ( | const struct device * | dev, | 
| struct uhc_transfer *const | xfer | ||
| ) | 
#include <include/zephyr/drivers/usb/uhc.h>
Free UHC transfer and any buffers.
Free any buffers and put the transfer back into the transfer pool.
| [in] | dev | Pointer to device struct of the driver instance | 
| [in] | xfer | Pointer to UHC transfer |