USBDevice for STM support

Dependents:   DISCO-F429ZI_LCDTS_demo_richard

Fork of USBDEVICE by ST

Committer:
pierrebizouard
Date:
Tue Jun 27 13:11:46 2017 +0000
Revision:
6:5a6efd08d588
Parent:
1:2a3ae13b45ef
fixup in definition

Who changed what in which revision?

UserRevisionLine numberNew contents of line
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 1 /***************************************************************************//**
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 2 * @file em_usbh.h
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 3 * @brief USB protocol stack library API for EFM32.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 4 * @version 3.20.14
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 5 *******************************************************************************
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 6 * @section License
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 8 *******************************************************************************
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 9 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 10 * Licensed under the Apache License, Version 2.0 (the "License");
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 11 * you may not use this file except in compliance with the License.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 12 * You may obtain a copy of the License at
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 13 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 14 * http://www.apache.org/licenses/LICENSE-2.0
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 15 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 16 * Unless required by applicable law or agreed to in writing, software
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 17 * distributed under the License is distributed on an "AS IS" BASIS,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 19 * See the License for the specific language governing permissions and
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 20 * limitations under the License.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 21 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 22 ******************************************************************************/
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 23
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 24 #ifndef __EM_USBH_H
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 25 #define __EM_USBH_H
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 26
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 27 #include "em_device.h"
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 28 #if defined( USB_PRESENT ) && ( USB_COUNT == 1 )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 29 #include "em_usb.h"
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 30 #if defined( USB_HOST )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 31
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 32 #ifdef __cplusplus
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 33 extern "C" {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 34 #endif
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 35
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 36 /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 37
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 38 extern USBH_Hc_TypeDef hcs[];
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 39 extern int USBH_attachRetryCount;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 40 extern const USBH_AttachTiming_TypeDef USBH_attachTiming[];
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 41 extern USBH_Init_TypeDef USBH_initData;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 42 extern volatile USBH_PortState_TypeDef USBH_portStatus;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 43
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 44 USB_Status_TypeDef USBH_CtlSendSetup( USBH_Ep_TypeDef *ep );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 45 USB_Status_TypeDef USBH_CtlSendData( USBH_Ep_TypeDef *ep, uint16_t length );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 46 USB_Status_TypeDef USBH_CtlReceiveData( USBH_Ep_TypeDef *ep, uint16_t length );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 47
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 48 #if defined( USB_RAW_API )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 49 int USBH_CtlRxRaw( uint8_t pid, USBH_Ep_TypeDef *ep, void *data, int byteCount );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 50 int USBH_CtlTxRaw( uint8_t pid, USBH_Ep_TypeDef *ep, void *data, int byteCount );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 51 #endif
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 52
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 53 void USBHEP_EpHandler( USBH_Ep_TypeDef *ep, USB_Status_TypeDef result );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 54 void USBHEP_CtrlEpHandler( USBH_Ep_TypeDef *ep, USB_Status_TypeDef result );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 55 void USBHEP_TransferDone( USBH_Ep_TypeDef *ep, USB_Status_TypeDef result );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 56
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 57 __STATIC_INLINE uint16_t USBH_GetFrameNum( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 58 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 59 return USBHHAL_GetFrameNum();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 60 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 61
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 62 __STATIC_INLINE bool USBH_FrameNumIsEven( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 63 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 64 return ( USBHHAL_GetFrameNum() & 1 ) == 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 65 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 66
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 67 /** @endcond */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 68
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 69 #ifdef __cplusplus
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 70 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 71 #endif
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 72
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 73 #endif /* defined( USB_HOST ) */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 74 #endif /* defined( USB_PRESENT ) && ( USB_COUNT == 1 ) */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 75 #endif /* __EM_USBH_H */