Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
usb_dc.h File Reference

USB device controller APIs. More...

#include <zephyr/device.h>

Go to the source code of this file.

Data Structures

struct  usb_dc_ep_cfg_data
 USB Endpoint Configuration. More...
 

Typedefs

typedef void(* usb_dc_ep_callback) (uint8_t ep, enum usb_dc_ep_cb_status_code cb_status)
 Callback function signature for the USB Endpoint status.
 
typedef void(* usb_dc_status_callback) (enum usb_dc_status_code cb_status, const uint8_t *param)
 Callback function signature for the device.
 

Enumerations

enum  usb_dc_status_code {
  USB_DC_ERROR , USB_DC_RESET , USB_DC_CONNECTED , USB_DC_CONFIGURED ,
  USB_DC_DISCONNECTED , USB_DC_SUSPEND , USB_DC_RESUME , USB_DC_INTERFACE ,
  USB_DC_SET_HALT , USB_DC_CLEAR_HALT , USB_DC_SOF , USB_DC_UNKNOWN
}
 USB Driver Status Codes. More...
 
enum  usb_dc_ep_cb_status_code { USB_DC_EP_SETUP , USB_DC_EP_DATA_OUT , USB_DC_EP_DATA_IN }
 USB Endpoint Callback Status Codes. More...
 
enum  usb_dc_ep_transfer_type { USB_DC_EP_CONTROL = 0 , USB_DC_EP_ISOCHRONOUS , USB_DC_EP_BULK , USB_DC_EP_INTERRUPT }
 USB Endpoint Transfer Type. More...
 
enum  usb_dc_ep_synchronozation_type { USB_DC_EP_NO_SYNCHRONIZATION = (0U << 2U) , USB_DC_EP_ASYNCHRONOUS = (1U << 2U) , USB_DC_EP_ADAPTIVE = (2U << 2U) , USB_DC_EP_SYNCHRONOUS = (3U << 2U) }
 USB Endpoint Synchronization Type. More...
 

Functions

int usb_dc_attach (void)
 Attach USB for device connection.
 
int usb_dc_detach (void)
 Detach the USB device.
 
int usb_dc_reset (void)
 Reset the USB device.
 
int usb_dc_set_address (const uint8_t addr)
 Set USB device address.
 
void usb_dc_set_status_callback (const usb_dc_status_callback cb)
 Set USB device controller status callback.
 
int usb_dc_ep_check_cap (const struct usb_dc_ep_cfg_data *const cfg)
 check endpoint capabilities
 
int usb_dc_ep_configure (const struct usb_dc_ep_cfg_data *const cfg)
 Configure endpoint.
 
int usb_dc_ep_set_stall (const uint8_t ep)
 Set stall condition for the selected endpoint.
 
int usb_dc_ep_clear_stall (const uint8_t ep)
 Clear stall condition for the selected endpoint.
 
int usb_dc_ep_is_stalled (const uint8_t ep, uint8_t *const stalled)
 Check if the selected endpoint is stalled.
 
int usb_dc_ep_halt (const uint8_t ep)
 Halt the selected endpoint.
 
int usb_dc_ep_enable (const uint8_t ep)
 Enable the selected endpoint.
 
int usb_dc_ep_disable (const uint8_t ep)
 Disable the selected endpoint.
 
int usb_dc_ep_flush (const uint8_t ep)
 Flush the selected endpoint.
 
int usb_dc_ep_write (const uint8_t ep, const uint8_t *const data, const uint32_t data_len, uint32_t *const ret_bytes)
 Write data to the specified endpoint.
 
int usb_dc_ep_read (const uint8_t ep, uint8_t *const data, const uint32_t max_data_len, uint32_t *const read_bytes)
 Read data from the specified endpoint.
 
int usb_dc_ep_set_callback (const uint8_t ep, const usb_dc_ep_callback cb)
 Set callback function for the specified endpoint.
 
int usb_dc_ep_read_wait (uint8_t ep, uint8_t *data, uint32_t max_data_len, uint32_t *read_bytes)
 Read data from the specified endpoint.
 
int usb_dc_ep_read_continue (uint8_t ep)
 Continue reading data from the endpoint.
 
int usb_dc_ep_mps (uint8_t ep)
 Get endpoint max packet size.
 
int usb_dc_wakeup_request (void)
 Start the host wake up procedure.
 

Detailed Description

USB device controller APIs.

This file contains the USB device controller APIs. All device controller drivers should implement the APIs described in this file.