USBDevice with Nucleo 32L476RG support

Dependents:   ObCP_ENSMM_V2020_Test_Accelero

Committer:
jimbaud
Date:
Wed Sep 30 11:26:16 2020 +0000
Revision:
72:14a22343c610
Parent:
71:53949e6131f6
USBDevice with Nucleo 32L476RG support

Who changed what in which revision?

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