1 /* 2 * Copyright (c) 2016, Freescale Semiconductor, Inc. 3 * Copyright 2016 NXP 4 * All rights reserved. 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 #ifndef __USB_OTG_PERIPHERAL_H__ 10 #define __USB_OTG_PERIPHERAL_H__ 11 12 #include "usb_otg_config.h" 13 14 /*! 15 * @addtogroup usb_otg_peripheral_driver 16 * @{ 17 */ 18 19 #if ((defined USB_OTG_KHCI_PERIPHERAL_ENABLE) && (USB_OTG_KHCI_PERIPHERAL_ENABLE)) 20 21 /*! 22 * @brief Enable OTG peripheral. 23 * 24 * This function enable OTG peripheral function. 25 * 26 * @retval kStatus_USB_Success success. 27 * @retval other values Fail. 28 */ 29 usb_status_t USB_OtgPeripheralEnable(void); 30 31 /*! 32 * @brief Disable OTG peripheral. 33 * 34 * This function disable OTG peripheral function. 35 * 36 * @retval kStatus_USB_Success success. 37 * @retval other values Fail. 38 */ 39 usb_status_t USB_OtgPeripheralDisable(void); 40 41 /*! 42 * @brief Get the peripheral status. 43 * 44 * This function is nonblocking, return the result immediately. 45 * 46 * @param[in] statusType Please reference to #usb_otg_status_type_t. 47 * @param[out] statusValue The status value. 48 * 49 * @retval kStatus_USB_Success success. 50 * @retval other values Fail. 51 */ 52 usb_status_t USB_OtgPeripheralGetStatus(uint32_t statusType, uint32_t *statusValue); 53 54 /*! 55 * @brief Control the peripheral. 56 * 57 * This function control the peripheral to implement the different functions. 58 * 59 * @param controllerHandle The controller instance handle. 60 * @param controlType The control type, please reference to #usb_otg_control_t. 61 * @param controlValue1 The control value, it is 0 or 1 usually. 62 * @param controlValue2 It only be used in the kOtg_ControlRequestStatus control now. 63 * 64 * @retval kStatus_USB_Success success. 65 * @retval other values Fail. 66 */ 67 usb_status_t USB_OtgPeripheralControl(usb_otg_controller_handle controllerHandle, 68 uint32_t controlType, 69 uint32_t controlValue1, 70 uint32_t controlValue2); 71 72 #endif 73 74 /*! @}*/ 75 76 #endif 77