5144d0f65f
USB High-Speed devices must be able to operate at both High-Speed and Full-Speed. The USB specification allows the device to have different configurations depending on connection speed. Modify the API to reflect USB Specification requirements on what can (e.g. configurations) and what cannot (e.g. VID, PID) be speed dependent. While the class configurations for different speeds are completely independent, the actual class instances are shared between operating speeds (because only one speed can be active at a time). Classes are free to provide different number of interfaces and/or endpoints for different speeds. The endpoints are assigned for all operating speeds during initialization. Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
54 lines
1.5 KiB
C
54 lines
1.5 KiB
C
/*
|
|
* Copyright (c) 2022 Nordic Semiconductor ASA
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef ZEPHYR_INCLUDE_USBD_INTERFACE_H
|
|
#define ZEPHYR_INCLUDE_USBD_INTERFACE_H
|
|
|
|
#include <zephyr/usb/usbd.h>
|
|
|
|
/**
|
|
* @brief Shutdown all interfaces in a configuration.
|
|
*
|
|
* @param[in] uds_ctx Pointer to USB device support context
|
|
* @param[in] cfg_nd Pointer to configuration node
|
|
*
|
|
* @return 0 on success, other values on fail.
|
|
*/
|
|
int usbd_interface_shutdown(struct usbd_contex *const uds_ctx,
|
|
struct usbd_config_node *const cfg_nd);
|
|
|
|
/**
|
|
* @brief Setup all interfaces in a configuration to default alternate.
|
|
*
|
|
* @note Used only for configuration change.
|
|
*
|
|
* @param[in] uds_ctx Pointer to USB device support context
|
|
* @param[in] speed Configuration speed
|
|
* @param[in] cfg_nd Pointer to configuration node
|
|
*
|
|
* @return 0 on success, other values on fail.
|
|
*/
|
|
int usbd_interface_default(struct usbd_contex *const uds_ctx,
|
|
const enum usbd_speed speed,
|
|
struct usbd_config_node *const cfg_nd);
|
|
|
|
/**
|
|
* @brief Set interface alternate
|
|
*
|
|
* @note Used only for configuration change.
|
|
*
|
|
* @param[in] uds_ctx Pointer to USB device support context
|
|
* @param[in] iface Interface number (bInterfaceNumber)
|
|
* @param[in] alternate Interface alternate (bAlternateSetting)
|
|
*
|
|
* @return 0 on success, other values on fail.
|
|
*/
|
|
int usbd_interface_set(struct usbd_contex *uds_ctx,
|
|
const uint8_t iface,
|
|
const uint8_t alternate);
|
|
|
|
#endif /* ZEPHYR_INCLUDE_USBD_INTERFACE_H */
|