Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
usb_dc.h
Go to the documentation of this file.
1/* usb_dc.h - USB device controller driver interface */
2
3/*
4 * Copyright (c) 2016 Intel Corporation.
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
17#ifndef ZEPHYR_INCLUDE_DRIVERS_USB_USB_DC_H_
18#define ZEPHYR_INCLUDE_DRIVERS_USB_USB_DC_H_
19
20#include <zephyr/device.h>
21
61
75
89
105
125
129typedef void (*usb_dc_ep_callback)(uint8_t ep,
130 enum usb_dc_ep_cb_status_code cb_status);
131
135typedef void (*usb_dc_status_callback)(enum usb_dc_status_code cb_status,
136 const uint8_t *param);
137
148
158
167int usb_dc_reset(void);
168
177
188
202int usb_dc_ep_check_cap(const struct usb_dc_ep_cfg_data * const cfg);
203
215int usb_dc_ep_configure(const struct usb_dc_ep_cfg_data * const cfg);
216
226
236
246int usb_dc_ep_is_stalled(const uint8_t ep, uint8_t *const stalled);
247
257
271
285
297
316int usb_dc_ep_write(const uint8_t ep, const uint8_t *const data,
317 const uint32_t data_len, uint32_t * const ret_bytes);
318
338int usb_dc_ep_read(const uint8_t ep, uint8_t *const data,
339 const uint32_t max_data_len, uint32_t *const read_bytes);
340
356
375int usb_dc_ep_read_wait(uint8_t ep, uint8_t *data, uint32_t max_data_len,
376 uint32_t *read_bytes);
377
392
402
411
416#endif /* ZEPHYR_INCLUDE_DRIVERS_USB_USB_DC_H_ */
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_disable(const uint8_t ep)
Disable the selected endpoint.
int usb_dc_detach(void)
Detach the USB device.
int usb_dc_ep_enable(const uint8_t ep)
Enable the selected endpoint.
void(* usb_dc_status_callback)(enum usb_dc_status_code cb_status, const uint8_t *param)
Callback function signature for the device.
Definition usb_dc.h:135
int usb_dc_wakeup_request(void)
Start the host wake up procedure.
void usb_dc_set_status_callback(const usb_dc_status_callback cb)
Set USB device controller status callback.
int usb_dc_set_address(const uint8_t addr)
Set USB device address.
int usb_dc_ep_set_stall(const uint8_t ep)
Set stall condition for the selected endpoint.
int usb_dc_ep_mps(uint8_t ep)
Get endpoint max packet size.
int usb_dc_ep_halt(const uint8_t ep)
Halt the selected endpoint.
int usb_dc_ep_configure(const struct usb_dc_ep_cfg_data *const cfg)
Configure endpoint.
int usb_dc_reset(void)
Reset the USB device.
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_flush(const uint8_t ep)
Flush the selected endpoint.
int usb_dc_ep_read_continue(uint8_t ep)
Continue reading data from the endpoint.
int usb_dc_ep_check_cap(const struct usb_dc_ep_cfg_data *const cfg)
check endpoint capabilities
int usb_dc_ep_clear_stall(const uint8_t ep)
Clear stall condition for the selected endpoint.
int usb_dc_ep_set_callback(const uint8_t ep, const usb_dc_ep_callback cb)
Set callback function for the specified endpoint.
usb_dc_status_code
USB Driver Status Codes.
Definition usb_dc.h:35
usb_dc_ep_transfer_type
USB Endpoint Transfer Type.
Definition usb_dc.h:79
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.
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.
Definition usb_dc.h:129
usb_dc_ep_synchronozation_type
USB Endpoint Synchronization Type.
Definition usb_dc.h:95
int usb_dc_attach(void)
Attach USB for device connection.
usb_dc_ep_cb_status_code
USB Endpoint Callback Status Codes.
Definition usb_dc.h:67
int usb_dc_ep_is_stalled(const uint8_t ep, uint8_t *const stalled)
Check if the selected endpoint is stalled.
@ USB_DC_CLEAR_HALT
Clear Feature ENDPOINT_HALT received.
Definition usb_dc.h:55
@ USB_DC_RESUME
USB connection resumed by the HOST.
Definition usb_dc.h:49
@ USB_DC_DISCONNECTED
USB connection lost.
Definition usb_dc.h:45
@ USB_DC_SET_HALT
Set Feature ENDPOINT_HALT received.
Definition usb_dc.h:53
@ USB_DC_CONFIGURED
USB configuration done.
Definition usb_dc.h:43
@ USB_DC_CONNECTED
USB connection established, hardware enumeration is completed.
Definition usb_dc.h:41
@ USB_DC_RESET
USB reset.
Definition usb_dc.h:39
@ USB_DC_INTERFACE
USB interface selected.
Definition usb_dc.h:51
@ USB_DC_UNKNOWN
Initial USB connection status.
Definition usb_dc.h:59
@ USB_DC_ERROR
USB error reported by the controller.
Definition usb_dc.h:37
@ USB_DC_SOF
Start of Frame received.
Definition usb_dc.h:57
@ USB_DC_SUSPEND
USB connection suspended by the HOST.
Definition usb_dc.h:47
@ USB_DC_EP_CONTROL
Control type endpoint.
Definition usb_dc.h:81
@ USB_DC_EP_ISOCHRONOUS
Isochronous type endpoint.
Definition usb_dc.h:83
@ USB_DC_EP_BULK
Bulk type endpoint.
Definition usb_dc.h:85
@ USB_DC_EP_INTERRUPT
Interrupt type endpoint
Definition usb_dc.h:87
@ USB_DC_EP_ADAPTIVE
Adaptive.
Definition usb_dc.h:101
@ USB_DC_EP_SYNCHRONOUS
Synchronous.
Definition usb_dc.h:103
@ USB_DC_EP_ASYNCHRONOUS
Asynchronous.
Definition usb_dc.h:99
@ USB_DC_EP_NO_SYNCHRONIZATION
No Synchronization.
Definition usb_dc.h:97
@ USB_DC_EP_DATA_OUT
Out transaction on this EP, data is available for read.
Definition usb_dc.h:71
@ USB_DC_EP_SETUP
SETUP received.
Definition usb_dc.h:69
@ USB_DC_EP_DATA_IN
In transaction done on this EP.
Definition usb_dc.h:73
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
USB Endpoint Configuration.
Definition usb_dc.h:111
uint16_t ep_mps
Endpoint max packet size.
Definition usb_dc.h:119
enum usb_dc_ep_transfer_type ep_type
Endpoint Transfer Type.
Definition usb_dc.h:123
uint8_t ep_addr
The number associated with the EP in the device configuration structure IN EP = 0x80 | <endpoint numb...
Definition usb_dc.h:117