A copy of the mbed USBDevice with USBSerial library

Dependents:   STM32L0_LoRa Smartage STM32L0_LoRa Turtle_RadioShuttle

Committer:
Helmut64
Date:
Mon Feb 05 10:22:57 2018 +0000
Revision:
0:a3ea811f80f2
Inital checkin after copied from mbed.

Who changed what in which revision?

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