USBDevice for STM support

Dependents:   Nucleo_Usb_JoyMouse Nucleo_usbmouse ELEC350_1-referral-2018-usb-hid USBJoystick_HelloWorld2_wip ... more

This library contains all mbed usb device library (mbed-os\features\unsupported\USBDevice).

Committer:
frq08711@LMECWL0871.LME.ST.COM
Date:
Thu Dec 15 17:40:59 2016 +0100
Revision:
1:2a3ae13b45ef
copy of git hub directory unsupported/USBDevice

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_usbhal.h
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 3 * @brief USB protocol stack library, low level USB peripheral access.
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_USBHAL_H
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 25 #define __EM_USBHAL_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_DEVICE ) || 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 #define USB_PID_DATA0 0
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 39 #define USB_PID_DATA2 1
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 40 #define USB_PID_DATA1 2
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 41 #define USB_PID_SETUP 3
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 42
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 43 #define HPRT_F_SPEED ( 1 << _USB_HPRT_PRTSPD_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 44 #define HPRT_L_SPEED ( 2 << _USB_HPRT_PRTSPD_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 45 #define HCFG_PHYCLK_48MHZ 1
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 46 #define HCFG_PHYCLK_6MHZ 2
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 47
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 48 #define DOEP0_XFERSIZE_PKTCNT_MASK ( _USB_DOEP0TSIZ_XFERSIZE_MASK | \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 49 _USB_DOEP0TSIZ_PKTCNT_MASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 50 #define DOEP_XFERSIZE_PKTCNT_MASK ( _USB_DOEP_TSIZ_XFERSIZE_MASK | \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 51 _USB_DOEP_TSIZ_PKTCNT_MASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 52
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 53 #define DIEP0_XFERSIZE_PKTCNT_MASK ( _USB_DIEP0TSIZ_XFERSIZE_MASK | \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 54 _USB_DIEP0TSIZ_PKTCNT_MASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 55 #define DIEP_XFERSIZE_PKTCNT_MASK ( _USB_DIEP_TSIZ_XFERSIZE_MASK | \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 56 _USB_DIEP_TSIZ_PKTCNT_MASK | \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 57 _USB_DIEP_TSIZ_MC_MASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 58
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 59 #define DIEPCTL_EPTYPE_CONTROL (0 << _USB_DIEP_CTL_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 60 #define DIEPCTL_EPTYPE_ISOC (1 << _USB_DIEP_CTL_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 61 #define DIEPCTL_EPTYPE_BULK (2 << _USB_DIEP_CTL_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 62 #define DIEPCTL_EPTYPE_INTR (3 << _USB_DIEP_CTL_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 63
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 64 #define DOEPCTL_EPTYPE_CONTROL (0 << _USB_DOEP_CTL_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 65 #define DOEPCTL_EPTYPE_ISOC (1 << _USB_DOEP_CTL_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 66 #define DOEPCTL_EPTYPE_BULK (2 << _USB_DOEP_CTL_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 67 #define DOEPCTL_EPTYPE_INTR (3 << _USB_DOEP_CTL_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 68
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 69 #define HCCHAR_EPTYPE_CTRL (0 << _USB_HC_CHAR_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 70 #define HCCHAR_EPTYPE_ISOC (1 << _USB_HC_CHAR_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 71 #define HCCHAR_EPTYPE_BULK (2 << _USB_HC_CHAR_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 72 #define HCCHAR_EPTYPE_INTR (3 << _USB_HC_CHAR_EPTYPE_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 73
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 74 #define GRXSTSP_PKTSTS_DEVICE_GOTNAK ( 1 << _USB_GRXSTSP_PKTSTS_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 75 #define GRXSTSP_PKTSTS_DEVICE_DATAOUTRECEIVED ( 2 << _USB_GRXSTSP_PKTSTS_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 76 #define GRXSTSP_PKTSTS_DEVICE_DATAOUTCOMPLETE ( 3 << _USB_GRXSTSP_PKTSTS_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 77 #define GRXSTSP_PKTSTS_DEVICE_SETUPCOMPLETE ( 4 << _USB_GRXSTSP_PKTSTS_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 78 #define GRXSTSP_PKTSTS_DEVICE_SETUPRECEIVED ( 6 << _USB_GRXSTSP_PKTSTS_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 79
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 80 #define GRXSTSP_PKTSTS_HOST_DATAINRECEIVED ( 2 << _USB_GRXSTSP_PKTSTS_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 81 #define GRXSTSP_PKTSTS_HOST_DATAINCOMPLETE ( 3 << _USB_GRXSTSP_PKTSTS_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 82 #define GRXSTSP_PKTSTS_HOST_DATATOGGLEERROR ( 5 << _USB_GRXSTSP_PKTSTS_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 83 #define GRXSTSP_PKTSTS_HOST_CHANNELHALTED ( 7 << _USB_GRXSTSP_PKTSTS_SHIFT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 84
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 85 #define DCTL_WO_BITMASK \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 86 ( _USB_DCTL_CGOUTNAK_MASK | _USB_DCTL_SGOUTNAK_MASK | \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 87 _USB_DCTL_CGNPINNAK_MASK | _USB_DCTL_SGNPINNAK_MASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 88 #define GUSBCFG_WO_BITMASK ( USB_GUSBCFG_CORRUPTTXPKT )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 89 #define DEPCTL_WO_BITMASK \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 90 ( USB_DIEP_CTL_CNAK | USB_DIEP_CTL_SNAK | \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 91 USB_DIEP_CTL_SETD0PIDEF | USB_DIEP_CTL_SETD1PIDOF )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 92
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 93 #define HPRT_WC_MASK ( USB_HPRT_PRTCONNDET | USB_HPRT_PRTENA | \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 94 USB_HPRT_PRTENCHNG | USB_HPRT_PRTOVRCURRCHNG )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 95
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 96 typedef __IO uint32_t USB_FIFO_TypeDef[ 0x1000 / sizeof( uint32_t ) ];
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 97 typedef __IO uint32_t USB_DIEPTXF_TypeDef;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 98
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 99 #define USB_DINEPS ((USB_DIEP_TypeDef *) &USB->DIEP0CTL )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 100 #define USB_DOUTEPS ((USB_DOEP_TypeDef *) &USB->DOEP0CTL )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 101 #define USB_FIFOS ((USB_FIFO_TypeDef *) &USB->FIFO0D )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 102 #define USB_DIEPTXFS ((USB_DIEPTXF_TypeDef *) &USB->DIEPTXF1 )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 103
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 104 void USBHAL_CoreReset( void );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 105
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 106 #if defined( USB_DEVICE )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 107 void USBDHAL_AbortAllTransfers( USB_Status_TypeDef reason );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 108 USB_Status_TypeDef USBDHAL_CoreInit( const uint32_t totalRxFifoSize,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 109 const uint32_t totalTxFifoSize );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 110 void USBDHAL_Connect( void );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 111 void USBDHAL_Disconnect( void );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 112 void USBDHAL_AbortAllEps( void );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 113 void USBDHAL_AbortEpIn( USBD_Ep_TypeDef *ep );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 114 void USBDHAL_AbortEpOut( USBD_Ep_TypeDef *ep );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 115
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 116 __STATIC_INLINE USB_Status_TypeDef USBDHAL_GetStallStatusEp(
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 117 USBD_Ep_TypeDef *ep, uint16_t *halt );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 118 __STATIC_INLINE uint32_t USBDHAL_GetInEpInts( USBD_Ep_TypeDef *ep );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 119 __STATIC_INLINE uint32_t USBDHAL_GetOutEpInts( USBD_Ep_TypeDef *ep );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 120 __STATIC_INLINE void USBDHAL_SetEPDISNAK( USBD_Ep_TypeDef *ep );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 121 #endif /* defined( USB_DEVICE ) */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 122
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 123 #if defined( USB_HOST )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 124 USB_Status_TypeDef USBHHAL_CoreInit( const uint32_t rxFifoSize,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 125 const uint32_t nptxFifoSize,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 126 const uint32_t ptxFifoSize );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 127 void USBHHAL_HCHalt( int hcnum, uint32_t hcchar );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 128 void USBHHAL_HCInit( int hcnum );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 129 void USBHHAL_HCStart( int hcnum );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 130 #endif /* defined( USB_HOST ) */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 131
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 132 __STATIC_INLINE void USBHAL_DisableGlobalInt( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 133 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 134 USB->GAHBCFG &= ~USB_GAHBCFG_GLBLINTRMSK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 135 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 136
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 137 __STATIC_INLINE void USBHAL_DisablePhyPins( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 138 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 139 USB->ROUTE = _USB_ROUTE_RESETVALUE;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 140 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 141
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 142 __STATIC_INLINE void USBHAL_DisableUsbInt( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 143 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 144 USB->IEN = _USB_IEN_RESETVALUE;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 145 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 146
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 147 __STATIC_INLINE void USBHAL_EnableGlobalInt( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 148 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 149 USB->GAHBCFG |= USB_GAHBCFG_GLBLINTRMSK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 150 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 151
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 152 __STATIC_INLINE void USBHAL_FlushRxFifo( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 153 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 154 USB->GRSTCTL = USB_GRSTCTL_RXFFLSH;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 155 while ( USB->GRSTCTL & USB_GRSTCTL_RXFFLSH ) {}
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 156 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 157
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 158 __STATIC_INLINE void USBHAL_FlushTxFifo( uint8_t fifoNum )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 159 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 160 USB->GRSTCTL = USB_GRSTCTL_TXFFLSH | ( fifoNum << _USB_GRSTCTL_TXFNUM_SHIFT );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 161 while ( USB->GRSTCTL & USB_GRSTCTL_TXFFLSH ) {}
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 162 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 163
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 164 __STATIC_INLINE uint32_t USBHAL_GetCoreInts( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 165 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 166 uint32_t retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 167
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 168 retVal = USB->GINTSTS;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 169 retVal &= USB->GINTMSK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 170
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 171 return retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 172 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 173
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 174 __STATIC_INLINE bool USBHAL_VbusIsOn( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 175 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 176 return ( USB->STATUS & USB_STATUS_VREGOS ) != 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 177 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 178
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 179 #if defined( USB_DEVICE )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 180 __STATIC_INLINE void USBDHAL_ActivateEp( USBD_Ep_TypeDef *ep, bool forceIdle )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 181 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 182 #define DIEP_MPS_EPTYPE_TXFNUM_MASK ( _USB_DIEP_CTL_MPS_MASK | \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 183 _USB_DIEP_CTL_EPTYPE_MASK | \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 184 _USB_DIEP_CTL_TXFNUM_MASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 185 #define DOEP_MPS_EPTYPE_MASK ( _USB_DOEP_CTL_MPS_MASK | \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 186 _USB_DOEP_CTL_EPTYPE_MASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 187 uint32_t daintmask, depctl;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 188
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 189 if ( forceIdle )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 190 ep->state = D_EP_IDLE;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 191
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 192 if ( ep->in )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 193 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 194 daintmask = ep->mask;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 195 depctl = USB_DINEPS[ ep->num ].CTL & ~DEPCTL_WO_BITMASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 196
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 197 if ( !( depctl & USB_DIEP_CTL_USBACTEP ) )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 198 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 199 depctl = ( depctl &
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 200 ~( DIEP_MPS_EPTYPE_TXFNUM_MASK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 201 USB_DIEP_CTL_STALL ) ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 202 ( ep->packetSize << _USB_DIEP_CTL_MPS_SHIFT ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 203 ( ep->type << _USB_DIEP_CTL_EPTYPE_SHIFT ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 204 ( ep->txFifoNum << _USB_DIEP_CTL_TXFNUM_SHIFT ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 205 USB_DIEP_CTL_SETD0PIDEF |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 206 USB_DIEP_CTL_USBACTEP |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 207 USB_DIEP_CTL_SNAK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 208 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 209 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 210 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 211 depctl |= USB_DIEP_CTL_SETD0PIDEF;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 212 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 213 USB_DINEPS[ ep->num ].CTL = depctl;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 214 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 215 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 216 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 217 daintmask = ep->mask << _USB_DAINTMSK_OUTEPMSK0_SHIFT;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 218 depctl = USB_DOUTEPS[ ep->num ].CTL & ~DEPCTL_WO_BITMASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 219
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 220 if ( !( depctl & USB_DOEP_CTL_USBACTEP ) )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 221 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 222 depctl = ( depctl &
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 223 ~( DOEP_MPS_EPTYPE_MASK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 224 USB_DOEP_CTL_STALL ) ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 225 ( ep->packetSize << _USB_DOEP_CTL_MPS_SHIFT ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 226 ( ep->type << _USB_DOEP_CTL_EPTYPE_SHIFT ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 227 USB_DOEP_CTL_SETD0PIDEF |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 228 USB_DOEP_CTL_USBACTEP |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 229 USB_DOEP_CTL_SNAK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 230 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 231 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 232 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 233 depctl |= USB_DOEP_CTL_SETD0PIDEF;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 234 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 235 USB_DOUTEPS[ ep->num ].CTL = depctl;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 236 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 237
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 238 /* Enable interrupt for this EP */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 239 USB->DAINTMSK |= daintmask;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 240
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 241 #undef DIEP_MPS_EPTYPE_TXFNUM_MASK
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 242 #undef DOEP_MPS_EPTYPE_MASK
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 243 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 244
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 245 __STATIC_INLINE void USBDHAL_ClearRemoteWakeup( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 246 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 247 USB->DCTL &= ~( DCTL_WO_BITMASK | USB_DCTL_RMTWKUPSIG );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 248 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 249
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 250 __STATIC_INLINE void USBDHAL_DeactivateEp( USBD_Ep_TypeDef *ep )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 251 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 252 uint32_t daintmask;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 253
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 254 if ( ep->in )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 255 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 256 USB_DINEPS[ ep->num ].CTL = 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 257 daintmask = ep->mask;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 258 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 259 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 260 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 261 USB_DOUTEPS[ ep->num ].CTL = 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 262 daintmask = ep->mask << _USB_DAINTMSK_OUTEPMSK0_SHIFT;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 263 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 264
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 265 /* Disable interrupt for this EP */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 266 USB->DAINTMSK &= ~daintmask;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 267 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 268
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 269 __STATIC_INLINE void USBDHAL_EnableInts( USBD_Device_TypeDef *dev )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 270 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 271 uint32_t mask;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 272
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 273 /* Disable all interrupts. */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 274 USB->GINTMSK = 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 275
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 276 /* Clear pending interrupts */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 277 USB->GINTSTS = 0xFFFFFFFF;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 278
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 279 mask = USB_GINTMSK_USBSUSPMSK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 280 USB_GINTMSK_USBRSTMSK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 281 USB_GINTMSK_ENUMDONEMSK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 282 USB_GINTMSK_IEPINTMSK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 283 USB_GINTMSK_OEPINTMSK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 284 USB_GINTMSK_WKUPINTMSK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 285
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 286 if ( dev->callbacks->sofInt )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 287 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 288 mask |= USB_GINTMSK_SOFMSK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 289 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 290
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 291 USB->GINTMSK = mask;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 292 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 293
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 294 __STATIC_INLINE void USBDHAL_EnableUsbResetAndSuspendInt( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 295 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 296 /* Disable all interrupts. */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 297 USB->GINTMSK = 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 298
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 299 USB->GINTMSK = USB_GINTMSK_USBRSTMSK | USB_GINTMSK_USBSUSPMSK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 300 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 301
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 302 __STATIC_INLINE void USBDHAL_Ep0Activate( uint32_t ep0mps )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 303 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 304 USB->DCTL = ( USB->DCTL & ~DCTL_WO_BITMASK ) | USB_DCTL_CGNPINNAK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 305
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 306 USB->DOEP0CTL = ( USB->DOEP0CTL & ~DEPCTL_WO_BITMASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 307 | USB_DOEP0CTL_CNAK | USB_DOEP0CTL_EPENA
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 308 | ep0mps;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 309 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 310
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 311 __STATIC_INLINE bool USBDHAL_EpIsStalled( USBD_Ep_TypeDef *ep )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 312 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 313 bool retVal = false;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 314 uint16_t stallStatus;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 315
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 316 if ( USBDHAL_GetStallStatusEp( ep, &stallStatus ) == USB_STATUS_OK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 317 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 318 retVal = stallStatus & 1 ? true : false;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 319 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 320 return retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 321 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 322
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 323 __STATIC_INLINE uint32_t USBDHAL_GetAllInEpInts( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 324 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 325 uint32_t retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 326
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 327 retVal = USB->DAINT;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 328 retVal &= USB->DAINTMSK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 329 return retVal & 0xFFFF;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 330 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 331
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 332 __STATIC_INLINE uint32_t USBDHAL_GetAllOutEpInts( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 333 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 334 uint32_t retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 335
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 336 retVal = USB->DAINT;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 337 retVal &= USB->DAINTMSK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 338 return retVal >> 16;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 339 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 340
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 341 __STATIC_INLINE uint32_t USBDHAL_GetInEpInts( USBD_Ep_TypeDef *ep )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 342 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 343 uint32_t retVal, msk;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 344
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 345 msk = USB->DIEPMSK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 346 retVal = USB_DINEPS[ ep->num ].INT;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 347
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 348 return retVal & msk;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 349 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 350
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 351 __STATIC_INLINE uint32_t USBDHAL_GetOutEpInts( USBD_Ep_TypeDef *ep )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 352 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 353 uint32_t retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 354
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 355 retVal = USB_DOUTEPS[ ep->num ].INT;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 356 #if defined( USB_DOEP0INT_STUPPKTRCVD )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 357 retVal &= USB->DOEPMSK | USB_DOEP0INT_STUPPKTRCVD;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 358 #else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 359 retVal &= USB->DOEPMSK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 360 #endif
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 361
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 362 return retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 363 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 364
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 365 __STATIC_INLINE USB_Status_TypeDef USBDHAL_GetStallStatusEp(
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 366 USBD_Ep_TypeDef *ep, uint16_t *halt )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 367 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 368 uint32_t depctl, eptype;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 369 USB_Status_TypeDef retVal = USB_STATUS_REQ_ERR;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 370
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 371 if ( ep->in == true )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 372 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 373 depctl = USB_DINEPS[ ep->num ].CTL;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 374 eptype = depctl & _USB_DIEP_CTL_EPTYPE_MASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 375
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 376 if (( eptype == DIEPCTL_EPTYPE_INTR ) || ( eptype == DIEPCTL_EPTYPE_BULK ))
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 377 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 378 *halt = depctl & USB_DIEP_CTL_STALL ? 1 : 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 379 retVal = USB_STATUS_OK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 380 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 381 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 382 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 383 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 384 depctl = USB_DOUTEPS[ ep->num ].CTL;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 385 eptype = depctl & _USB_DOEP_CTL_EPTYPE_MASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 386
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 387 if (( eptype == DOEPCTL_EPTYPE_INTR ) || ( eptype == DOEPCTL_EPTYPE_BULK ))
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 388 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 389 *halt = depctl & USB_DOEP_CTL_STALL ? 1 : 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 390 retVal = USB_STATUS_OK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 391 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 392 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 393
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 394 return retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 395 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 396
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 397 __STATIC_INLINE void USBDHAL_ReenableEp0Setup( USBD_Device_TypeDef *dev )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 398
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 399 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 400 USB->DOEP0DMAADDR = (uint32_t)dev->setupPkt;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 401 USB->DOEP0CTL = ( USB->DOEP0CTL & ~DEPCTL_WO_BITMASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 402 | USB_DOEP0CTL_EPENA
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 403 | dev->ep0MpsCode;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 404 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 405
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 406 __STATIC_INLINE void USBDHAL_SetAddr( uint8_t addr )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 407 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 408 USB->DCFG = ( USB->DCFG &
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 409 ~_USB_DCFG_DEVADDR_MASK ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 410 (addr << _USB_DCFG_DEVADDR_SHIFT );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 411 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 412
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 413 __STATIC_INLINE void USBDHAL_SetEp0InDmaPtr( uint8_t* addr )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 414 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 415 USB->DIEP0DMAADDR = (uint32_t)addr;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 416 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 417
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 418 __STATIC_INLINE void USBDHAL_SetEp0OutDmaPtr( uint8_t* addr )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 419 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 420 USB->DOEP0DMAADDR = (uint32_t)addr;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 421 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 422
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 423 __STATIC_INLINE void USBDHAL_SetEPDISNAK( USBD_Ep_TypeDef *ep )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 424 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 425 if ( ep->in )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 426 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 427 USB_DINEPS[ ep->num ].CTL = ( USB_DINEPS[ ep->num ].CTL &
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 428 ~DEPCTL_WO_BITMASK ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 429 USB_DIEP_CTL_SNAK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 430 USB_DIEP_CTL_EPDIS;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 431 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 432 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 433 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 434 USB_DOUTEPS[ ep->num ].CTL = ( USB_DOUTEPS[ ep->num ].CTL &
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 435 ~DEPCTL_WO_BITMASK ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 436 USB_DOEP_CTL_EPENA;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 437
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 438 USB_DOUTEPS[ ep->num ].CTL = ( USB_DOUTEPS[ ep->num ].CTL &
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 439 ~DEPCTL_WO_BITMASK ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 440 USB_DOEP_CTL_SNAK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 441 USB_DOEP_CTL_EPDIS;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 442 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 443 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 444
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 445 __STATIC_INLINE void USBDHAL_SetRemoteWakeup( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 446 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 447 USB->DCTL = ( USB->DCTL & ~DCTL_WO_BITMASK ) | USB_DCTL_RMTWKUPSIG;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 448 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 449
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 450 __STATIC_INLINE USB_Status_TypeDef USBDHAL_StallEp( USBD_Ep_TypeDef *ep )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 451 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 452 uint32_t depctl, eptype;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 453 USB_Status_TypeDef retVal = USB_STATUS_REQ_ERR;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 454
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 455 if ( ep->in == true )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 456 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 457 depctl = USB_DINEPS[ ep->num ].CTL & ~DEPCTL_WO_BITMASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 458 eptype = depctl & _USB_DIEP_CTL_EPTYPE_MASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 459
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 460 if ( eptype != DIEPCTL_EPTYPE_ISOC )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 461 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 462 if ( depctl & USB_DIEP_CTL_EPENA )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 463 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 464 depctl |= USB_DIEP_CTL_EPDIS;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 465 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 466 USB_DINEPS[ ep->num ].CTL = depctl | USB_DIEP_CTL_STALL;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 467 retVal = USB_STATUS_OK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 468 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 469 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 470 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 471 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 472 depctl = USB_DOUTEPS[ ep->num ].CTL & ~DEPCTL_WO_BITMASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 473 eptype = depctl & _USB_DOEP_CTL_EPTYPE_MASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 474
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 475 if ( eptype != DIEPCTL_EPTYPE_ISOC )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 476 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 477 USB_DOUTEPS[ ep->num ].CTL = depctl | USB_DOEP_CTL_STALL;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 478 retVal = USB_STATUS_OK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 479 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 480 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 481
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 482 return retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 483 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 484
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 485 __STATIC_INLINE void USBDHAL_StartEp0In( uint32_t len, uint32_t ep0mps )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 486 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 487 USB->DIEP0TSIZ = ( len << _USB_DIEP0TSIZ_XFERSIZE_SHIFT ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 488 ( 1 << _USB_DIEP0TSIZ_PKTCNT_SHIFT );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 489
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 490 USB->DIEP0CTL = ( USB->DIEP0CTL & ~DEPCTL_WO_BITMASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 491 | USB_DIEP0CTL_CNAK | USB_DIEP0CTL_EPENA
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 492 | ep0mps;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 493 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 494
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 495 __STATIC_INLINE void USBDHAL_StartEp0Out( uint32_t len, uint32_t ep0mps )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 496 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 497 USB->DOEP0TSIZ = ( len << _USB_DOEP0TSIZ_XFERSIZE_SHIFT ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 498 ( 1 << _USB_DOEP0TSIZ_PKTCNT_SHIFT );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 499
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 500 USB->DOEP0CTL = ( USB->DOEP0CTL & ~DEPCTL_WO_BITMASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 501 | USB_DOEP0CTL_CNAK | USB_DOEP0CTL_EPENA
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 502 | ep0mps;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 503 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 504
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 505 __STATIC_INLINE void USBDHAL_StartEp0Setup( USBD_Device_TypeDef *dev )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 506 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 507 dev->ep[ 0 ].in = false;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 508
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 509 #if defined( USB_DOEP0INT_STUPPKTRCVD )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 510 USB->DOEP0TSIZ = ( 8*3 << _USB_DOEP0TSIZ_XFERSIZE_SHIFT ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 511 ( 1 << _USB_DOEP0TSIZ_PKTCNT_SHIFT ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 512 ( 3 << _USB_DOEP0TSIZ_SUPCNT_SHIFT );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 513 #else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 514 USB->DOEP0TSIZ = 3 << _USB_DOEP0TSIZ_SUPCNT_SHIFT;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 515 #endif
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 516
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 517 dev->setup = dev->setupPkt;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 518 USB->DOEP0DMAADDR = (uint32_t)dev->setup;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 519
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 520 #if defined( USB_DOEP0INT_STUPPKTRCVD )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 521 USB->DOEP0CTL = ( USB->DOEP0CTL & ~DEPCTL_WO_BITMASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 522 | USB_DOEP0CTL_EPENA
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 523 | dev->ep0MpsCode;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 524 #else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 525 USB->DOEP0CTL = ( USB->DOEP0CTL & ~DEPCTL_WO_BITMASK )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 526 | USB_DOEP0CTL_CNAK | USB_DOEP0CTL_EPENA
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 527 | dev->ep0MpsCode;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 528 #endif
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 529 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 530
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 531 __STATIC_INLINE void USBDHAL_StartEpIn( USBD_Ep_TypeDef *ep )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 532 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 533 uint32_t pktcnt, xfersize;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 534
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 535 if ( ep->remaining == 0 ) /* ZLP ? */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 536 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 537 pktcnt = 1;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 538 xfersize = 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 539 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 540 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 541 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 542 pktcnt = ( ep->remaining - 1 + ep->packetSize ) / ep->packetSize;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 543 xfersize = ep->remaining;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 544 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 545
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 546 USB_DINEPS[ ep->num ].TSIZ =
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 547 ( USB_DINEPS[ ep->num ].TSIZ &
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 548 ~DIEP_XFERSIZE_PKTCNT_MASK ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 549 ( xfersize << _USB_DIEP_TSIZ_XFERSIZE_SHIFT ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 550 ( pktcnt << _USB_DIEP_TSIZ_PKTCNT_SHIFT );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 551
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 552 USB_DINEPS[ ep->num ].DMAADDR = (uint32_t)ep->buf;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 553 USB_DINEPS[ ep->num ].CTL =
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 554 ( USB_DINEPS[ ep->num ].CTL & ~DEPCTL_WO_BITMASK ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 555 USB_DIEP_CTL_CNAK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 556 USB_DIEP_CTL_EPENA;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 557 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 558
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 559 __STATIC_INLINE void USBDHAL_StartEpOut( USBD_Ep_TypeDef *ep )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 560 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 561 uint32_t pktcnt, xfersize;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 562
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 563 if ( ep->remaining == 0 ) /* ZLP ? */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 564 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 565 pktcnt = 1;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 566 xfersize = ep->packetSize;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 567 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 568 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 569 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 570 pktcnt = ( ep->remaining - 1 + ep->packetSize ) / ep->packetSize;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 571 xfersize = pktcnt * ep->packetSize;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 572 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 573
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 574 USB_DOUTEPS[ ep->num ].TSIZ =
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 575 ( USB_DOUTEPS[ ep->num ].TSIZ &
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 576 ~DOEP_XFERSIZE_PKTCNT_MASK ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 577 ( xfersize << _USB_DOEP_TSIZ_XFERSIZE_SHIFT ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 578 ( pktcnt << _USB_DOEP_TSIZ_PKTCNT_SHIFT );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 579
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 580 ep->hwXferSize = xfersize;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 581 USB_DOUTEPS[ ep->num ].DMAADDR = (uint32_t)ep->buf;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 582 USB_DOUTEPS[ ep->num ].CTL =
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 583 ( USB_DOUTEPS[ ep->num ].CTL &
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 584 ~DEPCTL_WO_BITMASK ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 585 USB_DOEP_CTL_CNAK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 586 USB_DOEP_CTL_EPENA;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 587 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 588
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 589 __STATIC_INLINE USB_Status_TypeDef USBDHAL_UnStallEp( USBD_Ep_TypeDef *ep )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 590 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 591 uint32_t depctl, eptype;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 592 USB_Status_TypeDef retVal = USB_STATUS_REQ_ERR;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 593
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 594 if ( ep->in == true )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 595 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 596 depctl = USB_DINEPS[ ep->num ].CTL & ~DEPCTL_WO_BITMASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 597 eptype = depctl & _USB_DIEP_CTL_EPTYPE_MASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 598
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 599 if (( eptype == DIEPCTL_EPTYPE_INTR ) || ( eptype == DIEPCTL_EPTYPE_BULK ))
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 600 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 601 depctl |= USB_DIEP_CTL_SETD0PIDEF;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 602 depctl &= ~USB_DIEP_CTL_STALL;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 603 USB_DINEPS[ ep->num ].CTL = depctl;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 604 retVal = USB_STATUS_OK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 605 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 606 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 607 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 608 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 609 depctl = USB_DOUTEPS[ ep->num ].CTL & ~DEPCTL_WO_BITMASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 610 eptype = depctl & _USB_DOEP_CTL_EPTYPE_MASK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 611
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 612 if (( eptype == DIEPCTL_EPTYPE_INTR ) || ( eptype == DIEPCTL_EPTYPE_BULK ))
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 613 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 614 depctl |= USB_DOEP_CTL_SETD0PIDEF;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 615 depctl &= ~USB_DOEP_CTL_STALL;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 616 USB_DOUTEPS[ ep->num ].CTL = depctl;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 617 retVal = USB_STATUS_OK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 618 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 619 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 620
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 621 return retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 622 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 623 #endif /* defined( USB_DEVICE ) */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 624
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 625 #if defined( USB_HOST )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 626 __STATIC_INLINE void USBHHAL_HCActivate( int hcnum, uint32_t hcchar, bool intep )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 627 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 628 uint32_t oddframe;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 629
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 630 if ( intep )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 631 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 632 oddframe = USB->HFNUM & 1;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 633
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 634 USB->HC[ hcnum ].CHAR =
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 635 ( hcchar &
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 636 ~( USB_HC_CHAR_CHDIS | _USB_HC_CHAR_ODDFRM_MASK ) ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 637
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 638 /* Schedule INT transfers to start in next frame. */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 639 ( oddframe & 1 ? 0 : USB_HC_CHAR_ODDFRM ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 640
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 641 USB_HC_CHAR_CHENA;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 642 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 643 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 644 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 645 USB->HC[ hcnum ].CHAR = ( hcchar & ~USB_HC_CHAR_CHDIS ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 646 USB_HC_CHAR_CHENA;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 647 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 648 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 649
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 650 __STATIC_INLINE bool USBHHAL_InitializedAndPowered( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 651 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 652 if ( ( USB->ROUTE & USB_ROUTE_PHYPEN ) &&
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 653 ( USB->HPRT & USB_HPRT_PRTPWR ) )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 654 return true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 655 return false;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 656 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 657
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 658 __STATIC_INLINE void USBHHAL_EnableInts( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 659 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 660 /* Disable all interrupts. */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 661 USB->GINTMSK = 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 662
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 663 /* Clear pending OTG interrupts */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 664 USB->GOTGINT = 0xFFFFFFFF;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 665
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 666 /* Clear pending interrupts */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 667 USB->GINTSTS = 0xFFFFFFFF;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 668
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 669 USB->GINTMSK = USB_GINTMSK_PRTINTMSK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 670 USB_GINTMSK_HCHINTMSK |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 671 USB_GINTMSK_DISCONNINTMSK;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 672 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 673
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 674 __STATIC_INLINE uint16_t USBHHAL_GetFrameNum( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 675 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 676 return USB->HFNUM;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 677 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 678
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 679 __STATIC_INLINE uint32_t USBHHAL_GetHcChar( uint8_t hcnum )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 680 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 681 return USB->HC[ hcnum ].CHAR;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 682 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 683
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 684 __STATIC_INLINE uint32_t USBHHAL_GetHcInts( uint8_t hcnum )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 685 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 686 uint32_t retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 687
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 688 retVal = USB->HC[ hcnum ].INT;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 689 return retVal;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 690 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 691
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 692 __STATIC_INLINE uint32_t USBHHAL_GetHostChannelInts( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 693 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 694 return USB->HAINT;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 695 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 696
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 697 __STATIC_INLINE uint8_t USBHHAL_GetPortSpeed( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 698 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 699 return ( USB->HPRT & _USB_HPRT_PRTSPD_MASK ) >> _USB_HPRT_PRTSPD_SHIFT;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 700 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 701
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 702 __STATIC_INLINE void USBHHAL_PortReset( bool on )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 703 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 704 if ( on )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 705 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 706 DEBUG_USB_INT_LO_PUTCHAR( '+' );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 707 USB->HPRT = ( USB->HPRT & ~HPRT_WC_MASK ) | USB_HPRT_PRTRST;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 708 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 709 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 710 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 711 DEBUG_USB_INT_LO_PUTCHAR( '-' );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 712 USB->HPRT &= ~( HPRT_WC_MASK | USB_HPRT_PRTRST );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 713 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 714 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 715
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 716 __STATIC_INLINE void USBHHAL_PortResume( bool on )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 717 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 718 if ( on )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 719 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 720 USB->HPRT = ( USB->HPRT & ~( HPRT_WC_MASK | USB_HPRT_PRTSUSP ) ) |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 721 USB_HPRT_PRTRES;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 722 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 723 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 724 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 725 USB->HPRT &= ~( HPRT_WC_MASK | USB_HPRT_PRTSUSP | USB_HPRT_PRTRES );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 726 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 727 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 728
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 729 __STATIC_INLINE void USBHHAL_PortSuspend( void )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 730 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 731 USB->HPRT = ( USB->HPRT & ~HPRT_WC_MASK ) | USB_HPRT_PRTSUSP;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 732 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 733
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 734 __STATIC_INLINE void USBHHAL_VbusOn( bool on )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 735 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 736 if ( on )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 737 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 738 USB->HPRT = ( USB->HPRT & ~HPRT_WC_MASK ) | USB_HPRT_PRTPWR;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 739 DEBUG_USB_INT_LO_PUTCHAR( '/' );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 740 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 741 else
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 742 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 743 USB->HPRT &= ~( HPRT_WC_MASK | USB_HPRT_PRTPWR );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 744 DEBUG_USB_INT_LO_PUTCHAR( '\\' );
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 745 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 746 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 747 #endif /* defined( USB_HOST ) */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 748
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 749 /** @endcond */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 750
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 751 #ifdef __cplusplus
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 752 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 753 #endif
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 754
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 755 #endif /* defined( USB_DEVICE ) || defined( USB_HOST ) */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 756 #endif /* defined( USB_PRESENT ) && ( USB_COUNT == 1 ) */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 757 #endif /* __EM_USBHAL_H */