Zephyr API Documentation  3.6.99
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
58};
59
72};
73
86};
87
99 USB_DC_EP_ADAPTIVE = (2U << 2U),
101 USB_DC_EP_SYNCHRONOUS = (3U << 2U)
103
122};
123
127typedef void (*usb_dc_ep_callback)(uint8_t ep,
128 enum usb_dc_ep_cb_status_code cb_status);
129
133typedef void (*usb_dc_status_callback)(enum usb_dc_status_code cb_status,
134 const uint8_t *param);
135
146
156
165int usb_dc_reset(void);
166
175
186
200int usb_dc_ep_check_cap(const struct usb_dc_ep_cfg_data * const cfg);
201
213int usb_dc_ep_configure(const struct usb_dc_ep_cfg_data * const cfg);
214
224
234
244int usb_dc_ep_is_stalled(const uint8_t ep, uint8_t *const stalled);
245
255
269
283
295
314int usb_dc_ep_write(const uint8_t ep, const uint8_t *const data,
315 const uint32_t data_len, uint32_t * const ret_bytes);
316
336int usb_dc_ep_read(const uint8_t ep, uint8_t *const data,
337 const uint32_t max_data_len, uint32_t *const read_bytes);
338
354
373int usb_dc_ep_read_wait(uint8_t ep, uint8_t *data, uint32_t max_data_len,
374 uint32_t *read_bytes);
375
390
400
409
414#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:133
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:33
usb_dc_ep_transfer_type
USB Endpoint Transfer Type.
Definition: usb_dc.h:77
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:127
usb_dc_ep_synchronozation_type
USB Endpoint Synchronization Type.
Definition: usb_dc.h:93
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:65
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:53
@ USB_DC_RESUME
USB connection resumed by the HOST.
Definition: usb_dc.h:47
@ USB_DC_DISCONNECTED
USB connection lost.
Definition: usb_dc.h:43
@ USB_DC_SET_HALT
Set Feature ENDPOINT_HALT received.
Definition: usb_dc.h:51
@ USB_DC_CONFIGURED
USB configuration done.
Definition: usb_dc.h:41
@ USB_DC_CONNECTED
USB connection established, hardware enumeration is completed.
Definition: usb_dc.h:39
@ USB_DC_RESET
USB reset.
Definition: usb_dc.h:37
@ USB_DC_INTERFACE
USB interface selected.
Definition: usb_dc.h:49
@ USB_DC_UNKNOWN
Initial USB connection status.
Definition: usb_dc.h:57
@ USB_DC_ERROR
USB error reported by the controller.
Definition: usb_dc.h:35
@ USB_DC_SOF
Start of Frame received.
Definition: usb_dc.h:55
@ USB_DC_SUSPEND
USB connection suspended by the HOST.
Definition: usb_dc.h:45
@ USB_DC_EP_CONTROL
Control type endpoint.
Definition: usb_dc.h:79
@ USB_DC_EP_ISOCHRONOUS
Isochronous type endpoint.
Definition: usb_dc.h:81
@ USB_DC_EP_BULK
Bulk type endpoint.
Definition: usb_dc.h:83
@ USB_DC_EP_INTERRUPT
Interrupt type endpoint
Definition: usb_dc.h:85
@ USB_DC_EP_ADAPTIVE
Adaptive.
Definition: usb_dc.h:99
@ USB_DC_EP_SYNCHRONOUS
Synchronous.
Definition: usb_dc.h:101
@ USB_DC_EP_ASYNCHRONOUS
Asynchronous.
Definition: usb_dc.h:97
@ USB_DC_EP_NO_SYNCHRONIZATION
No Synchronization.
Definition: usb_dc.h:95
@ USB_DC_EP_DATA_OUT
Out transaction on this EP, data is available for read.
Definition: usb_dc.h:69
@ USB_DC_EP_SETUP
SETUP received.
Definition: usb_dc.h:67
@ USB_DC_EP_DATA_IN
In transaction done on this EP.
Definition: usb_dc.h:71
__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:109
uint16_t ep_mps
Endpoint max packet size.
Definition: usb_dc.h:117
enum usb_dc_ep_transfer_type ep_type
Endpoint Transfer Type.
Definition: usb_dc.h:121
uint8_t ep_addr
The number associated with the EP in the device configuration structure IN EP = 0x80 | <endpoint numb...
Definition: usb_dc.h:115