1 /* 2 * Copyright (c) 2015, Freescale Semiconductor, Inc. 3 * Copyright 2016 NXP 4 * All rights reserved. 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 #ifndef __USB_DEVICE_CH9_H__ 10 #define __USB_DEVICE_CH9_H__ 11 12 /******************************************************************************* 13 * Definitions 14 ******************************************************************************/ 15 /*! 16 * @addtogroup usb_device_ch9 17 * @{ 18 */ 19 /*! @brief Defines USB device status size when the host request to get device status */ 20 #define USB_DEVICE_STATUS_SIZE (0x02U) 21 22 /*! @brief Defines USB device interface status size when the host request to get interface status */ 23 #define USB_INTERFACE_STATUS_SIZE (0x02U) 24 25 /*! @brief Defines USB device endpoint status size when the host request to get endpoint status */ 26 #define USB_ENDPOINT_STATUS_SIZE (0x02U) 27 28 /*! @brief Defines USB device configuration size when the host request to get current configuration */ 29 #define USB_CONFIGURE_SIZE (0X01U) 30 31 /*! @brief Defines USB device interface alternate setting size when the host request to get interface alternate setting 32 */ 33 #define USB_INTERFACE_SIZE (0X01U) 34 35 /*! @brief Defines USB device status mask */ 36 #define USB_GET_STATUS_DEVICE_MASK (0x03U) 37 38 /*! @brief Defines USB device interface status mask */ 39 #define USB_GET_STATUS_INTERFACE_MASK (0x03U) 40 41 /*! @brief Defines USB device endpoint status mask */ 42 #define USB_GET_STATUS_ENDPOINT_MASK (0x03U) 43 44 /*! @brief Control read and write sequence */ 45 typedef enum _usb_device_control_read_write_sequence 46 { 47 kUSB_DeviceControlPipeSetupStage = 0U, /*!< Setup stage */ 48 kUSB_DeviceControlPipeDataStage, /*!< Data stage */ 49 kUSB_DeviceControlPipeStatusStage, /*!< status stage */ 50 } usb_device_control_read_write_sequence_t; 51 52 #if defined(__cplusplus) 53 extern "C" { 54 #endif 55 56 /******************************************************************************* 57 * API 58 ******************************************************************************/ 59 60 /*! 61 * @brief Initializes the control pipes. 62 * 63 * The function is used to initialize the control pipes. This function should be called when event 64 * kUSB_DeviceEventBusReset is received. 65 * 66 * @param[in] handle The device handle. 67 * @param[in] param The event parameter. 68 * 69 * @return A USB error code or kStatus_USB_Success. 70 */ 71 extern usb_status_t USB_DeviceControlPipeInit(usb_device_handle handle, void *param); 72 73 #if defined(__cplusplus) 74 } 75 #endif 76 77 /*! @}*/ 78 79 #endif /* __USB_DEVICE_CH9_H__ */ 80