2 * The Clear BSD License
3 * Copyright (c) 2015, Freescale Semiconductor, Inc.
4 * Copyright 2016-2017 NXP
7 * Redistribution and use in source and binary forms, with or without modification,
8 * are permitted (subject to the limitations in the disclaimer below) provided
9 * that the following conditions are met:
11 * o Redistributions of source code must retain the above copyright notice, this list
12 * of conditions and the following disclaimer.
14 * o Redistributions in binary form must reproduce the above copyright notice, this
15 * list of conditions and the following disclaimer in the documentation and/or
16 * other materials provided with the distribution.
18 * o Neither the name of the copyright holder nor the names of its
19 * contributors may be used to endorse or promote products derived from this
20 * software without specific prior written permission.
22 * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #ifndef __USB_DEVICE_CH9_H__
36 #define __USB_DEVICE_CH9_H__
38 /*******************************************************************************
40 ******************************************************************************/
42 * @addtogroup usb_device_ch9
46 /*******************************************************************************
48 ******************************************************************************/
50 /*! @brief Defines USB device status size when the host request to get device status */
51 #define USB_DEVICE_STATUS_SIZE (0x02U)
53 /*! @brief Defines USB device interface status size when the host request to get interface status */
54 #define USB_INTERFACE_STATUS_SIZE (0x02U)
56 /*! @brief Defines USB device endpoint status size when the host request to get endpoint status */
57 #define USB_ENDPOINT_STATUS_SIZE (0x02U)
59 /*! @brief Defines USB device configuration size when the host request to get current configuration */
60 #define USB_CONFIGURE_SIZE (0X01U)
62 /*! @brief Defines USB device interface alternate setting size when the host request to get interface alternate setting
64 #define USB_INTERFACE_SIZE (0X01U)
66 /*! @brief Defines USB device status mask */
67 #define USB_GET_STATUS_DEVICE_MASK (0x03U)
69 /*! @brief Defines USB device interface status mask */
70 #define USB_GET_STATUS_INTERFACE_MASK (0x03U)
72 /*! @brief Defines USB device endpoint status mask */
73 #define USB_GET_STATUS_ENDPOINT_MASK (0x03U)
75 /*! @brief Control read and write sequence */
76 typedef enum _usb_device_control_read_write_sequence
78 kUSB_DeviceControlPipeSetupStage = 0U, /*!< Setup stage */
79 kUSB_DeviceControlPipeDataStage, /*!< Data stage */
80 kUSB_DeviceControlPipeStatusStage, /*!< status stage */
81 } usb_device_control_read_write_sequence_t;
83 /*******************************************************************************
85 ******************************************************************************/
86 #if defined(__cplusplus)
90 /*******************************************************************************
92 ******************************************************************************/
95 * @brief Initialize the control pipes.
97 * The function is used to initialize the control pipes. This function should be called when event
98 * kUSB_DeviceEventBusReset is received.
100 * @param handle The device handle.
102 * @return A USB error code or kStatus_USB_Success.
104 extern usb_status_t USB_DeviceControlPipeInit(usb_device_handle handle);
106 #if defined(__cplusplus)
112 #endif /* __USB_DEVICE_CH9_H__ */