TUKS MCU Introductory course / TUKS-COURSE-2-LED
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32l4xx_ll_usb.h Source File

stm32l4xx_ll_usb.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4xx_ll_usb.h
00004   * @author  MCD Application Team
00005   * @version V1.5.1
00006   * @date    31-May-2016
00007   * @brief   Header file of USB Core HAL module.
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
00012   *
00013   * Redistribution and use in source and binary forms, with or without modification,
00014   * are permitted provided that the following conditions are met:
00015   *   1. Redistributions of source code must retain the above copyright notice,
00016   *      this list of conditions and the following disclaimer.
00017   *   2. Redistributions in binary form must reproduce the above copyright notice,
00018   *      this list of conditions and the following disclaimer in the documentation
00019   *      and/or other materials provided with the distribution.
00020   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00021   *      may be used to endorse or promote products derived from this software
00022   *      without specific prior written permission.
00023   *
00024   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00025   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00026   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00027   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00028   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00029   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00030   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00032   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00033   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034   *
00035   ******************************************************************************
00036   */ 
00037 
00038 /* Define to prevent recursive inclusion -------------------------------------*/
00039 #ifndef __STM32L4xx_LL_USB_H
00040 #define __STM32L4xx_LL_USB_H
00041 
00042 #ifdef __cplusplus
00043  extern "C" {
00044 #endif
00045 
00046 #if defined(STM32L475xx) || defined(STM32L476xx) || \
00047     defined(STM32L485xx) || defined(STM32L486xx) || \
00048     defined(STM32L432xx) || defined(STM32L433xx) || \
00049     defined(STM32L442xx) || defined(STM32L443xx)
00050       
00051 /* Includes ------------------------------------------------------------------*/
00052 #include "stm32l4xx_hal_def.h"
00053 
00054 /** @addtogroup STM32L4xx_HAL
00055   * @{
00056   */
00057 
00058 /** @addtogroup USB_Core
00059   * @{
00060   */ 
00061 
00062 /* Exported types ------------------------------------------------------------*/ 
00063 
00064 /** 
00065   * @brief  USB Mode definition  
00066   */  
00067 typedef enum 
00068 {
00069    USB_DEVICE_MODE  = 0,
00070    USB_HOST_MODE    = 1,
00071    USB_DRD_MODE     = 2
00072    
00073 }USB_ModeTypeDef;
00074 
00075 #if defined (USB_OTG_FS)
00076 /** 
00077   * @brief  URB States definition  
00078   */ 
00079 typedef enum {
00080   URB_IDLE = 0,
00081   URB_DONE,
00082   URB_NOTREADY,
00083   URB_NYET,
00084   URB_ERROR,
00085   URB_STALL
00086     
00087 }USB_OTG_URBStateTypeDef;
00088 
00089 /** 
00090   * @brief  Host channel States  definition  
00091   */ 
00092 typedef enum {
00093   HC_IDLE = 0,
00094   HC_XFRC,
00095   HC_HALTED,
00096   HC_NAK,
00097   HC_NYET,
00098   HC_STALL,
00099   HC_XACTERR,  
00100   HC_BBLERR,   
00101   HC_DATATGLERR
00102     
00103 }USB_OTG_HCStateTypeDef;
00104 
00105 /** 
00106   * @brief  PCD Initialization Structure definition  
00107   */
00108 typedef struct
00109 {
00110   uint32_t dev_endpoints;        /*!< Device Endpoints number.
00111                                       This parameter depends on the used USB core.   
00112                                       This parameter must be a number between Min_Data = 1 and Max_Data = 15 */    
00113   
00114   uint32_t Host_channels;        /*!< Host Channels number.
00115                                       This parameter Depends on the used USB core.   
00116                                       This parameter must be a number between Min_Data = 1 and Max_Data = 15 */       
00117 
00118   uint32_t speed;                /*!< USB Core speed.
00119                                       This parameter can be any value of @ref USB_Core_Speed_                */        
00120                                
00121   uint32_t dma_enable ;           /*!< Enable or disable of the USB embedded DMA.                             */            
00122 
00123   uint32_t ep0_mps;              /*!< Set the Endpoint 0 Max Packet size. 
00124                                       This parameter can be any value of @ref USB_EP0_MPS_                   */              
00125                        
00126   uint32_t phy_itface;           /*!< Select the used PHY interface.
00127                                       This parameter can be any value of @ref USB_Core_PHY_                  */ 
00128                                 
00129   uint32_t Sof_enable ;           /*!< Enable or disable the output of the SOF signal.                        */     
00130                                
00131   uint32_t low_power_enable ;     /*!< Enable or disable the low power mode.                                  */     
00132                           
00133   uint32_t lpm_enable ;           /*!< Enable or disable Battery charging.                                    */    
00134 
00135   uint32_t battery_charging_enable ; /*!< Enable or disable Battery charging.                                 */   
00136   
00137   uint32_t vbus_sensing_enable ;  /*!< Enable or disable the VBUS Sensing feature.                            */ 
00138 
00139   uint32_t use_dedicated_ep1 ;    /*!< Enable or disable the use of the dedicated EP1 interrupt.              */      
00140   
00141   uint32_t use_external_vbus ;    /*!< Enable or disable the use of the external VBUS.                        */   
00142   
00143 }USB_OTG_CfgTypeDef;
00144 
00145 typedef struct
00146 {
00147   uint8_t   num;            /*!< Endpoint number
00148                                 This parameter must be a number between Min_Data = 1 and Max_Data = 15    */ 
00149                                 
00150   uint8_t   is_in;          /*!< Endpoint direction
00151                                 This parameter must be a number between Min_Data = 0 and Max_Data = 1     */ 
00152   
00153   uint8_t   is_stall;       /*!< Endpoint stall condition
00154                                 This parameter must be a number between Min_Data = 0 and Max_Data = 1     */ 
00155   
00156   uint8_t   type;           /*!< Endpoint type
00157                                  This parameter can be any value of @ref USB_EP_Type_                     */ 
00158                                 
00159   uint8_t   data_pid_start; /*!< Initial data PID
00160                                 This parameter must be a number between Min_Data = 0 and Max_Data = 1     */
00161                                 
00162   uint8_t   even_odd_frame; /*!< IFrame parity
00163                                  This parameter must be a number between Min_Data = 0 and Max_Data = 1    */
00164                                 
00165   uint16_t  tx_fifo_num;    /*!< Transmission FIFO number
00166                                  This parameter must be a number between Min_Data = 1 and Max_Data = 15   */
00167                                 
00168   uint32_t  maxpacket;      /*!< Endpoint Max packet size
00169                                  This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
00170 
00171   uint8_t   *xfer_buff;     /*!< Pointer to transfer buffer                                               */
00172                                 
00173   uint32_t  dma_addr;       /*!< 32 bits aligned transfer buffer address                                  */
00174   
00175   uint32_t  xfer_len;       /*!< Current transfer length                                                  */
00176   
00177   uint32_t  xfer_count;     /*!< Partial transfer length in case of multi packet transfer                 */
00178 
00179 }USB_OTG_EPTypeDef;
00180 
00181 typedef struct
00182 {
00183   uint8_t   dev_addr ;     /*!< USB device address.
00184                                 This parameter must be a number between Min_Data = 1 and Max_Data = 255    */ 
00185 
00186   uint8_t   ch_num;        /*!< Host channel number.
00187                                 This parameter must be a number between Min_Data = 1 and Max_Data = 15     */ 
00188                                 
00189   uint8_t   ep_num;        /*!< Endpoint number.
00190                                 This parameter must be a number between Min_Data = 1 and Max_Data = 15     */ 
00191                                 
00192   uint8_t   ep_is_in;      /*!< Endpoint direction
00193                                 This parameter must be a number between Min_Data = 0 and Max_Data = 1      */ 
00194                                 
00195   uint8_t   speed;         /*!< USB Host speed.
00196                                 This parameter can be any value of @ref USB_Core_Speed_                    */
00197                                 
00198   uint8_t   do_ping;       /*!< Enable or disable the use of the PING protocol for HS mode.                */
00199   
00200   uint8_t   process_ping;  /*!< Execute the PING protocol for HS mode.                                     */
00201 
00202   uint8_t   ep_type;       /*!< Endpoint Type.
00203                                 This parameter can be any value of @ref USB_EP_Type_                       */
00204                                 
00205   uint16_t  max_packet;    /*!< Endpoint Max packet size.
00206                                 This parameter must be a number between Min_Data = 0 and Max_Data = 64KB   */
00207                                 
00208   uint8_t   data_pid;      /*!< Initial data PID.
00209                                 This parameter must be a number between Min_Data = 0 and Max_Data = 1      */
00210                                 
00211   uint8_t   *xfer_buff;    /*!< Pointer to transfer buffer.                                                */
00212   
00213   uint32_t  xfer_len;      /*!< Current transfer length.                                                   */
00214   
00215   uint32_t  xfer_count;    /*!< Partial transfer length in case of multi packet transfer.                  */
00216   
00217   uint8_t   toggle_in;     /*!< IN transfer current toggle flag.
00218                                 This parameter must be a number between Min_Data = 0 and Max_Data = 1      */
00219                                 
00220   uint8_t   toggle_out;    /*!< OUT transfer current toggle flag
00221                                 This parameter must be a number between Min_Data = 0 and Max_Data = 1      */
00222   
00223   uint32_t  dma_addr;      /*!< 32 bits aligned transfer buffer address.                                   */
00224   
00225   uint32_t  ErrCnt;        /*!< Host channel error count.*/
00226   
00227   USB_OTG_URBStateTypeDef  urb_state;  /*!< URB state. 
00228                                            This parameter can be any value of @ref USB_OTG_URBStateTypeDef */ 
00229   
00230   USB_OTG_HCStateTypeDef   state;     /*!< Host Channel state. 
00231                                            This parameter can be any value of @ref USB_OTG_HCStateTypeDef  */ 
00232                                              
00233 }USB_OTG_HCTypeDef;
00234 #endif /* USB_OTG_FS */
00235 
00236 #if defined (USB)
00237 /** 
00238   * @brief  USB Initialization Structure definition  
00239   */
00240 typedef struct
00241 {
00242   uint32_t dev_endpoints;        /*!< Device Endpoints number.
00243                                       This parameter depends on the used USB core.   
00244                                       This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
00245   
00246   uint32_t speed;                /*!< USB Core speed.
00247                                       This parameter can be any value of @ref USB_Core_Speed                 */
00248   
00249   uint32_t dma_enable ;           /*!< Enable or disable of the USB embedded DMA.                             */              
00250   
00251   uint32_t ep0_mps;              /*!< Set the Endpoint 0 Max Packet size. 
00252                                       This parameter can be any value of @ref USB_EP0_MPS                    */
00253   
00254   uint32_t phy_itface;           /*!< Select the used PHY interface.
00255                                       This parameter can be any value of @ref USB_Core_PHY                   */
00256   
00257   uint32_t Sof_enable ;           /*!< Enable or disable the output of the SOF signal.                        */
00258   
00259   uint32_t low_power_enable ;       /*!< Enable or disable Low Power mode                                      */
00260   
00261   uint32_t lpm_enable ;             /*!< Enable or disable Battery charging.                                  */
00262   
00263   uint32_t battery_charging_enable ; /*!< Enable or disable Battery charging.                                  */
00264 } USB_CfgTypeDef;
00265 
00266 typedef struct
00267 {
00268   uint8_t   num;            /*!< Endpoint number
00269                                 This parameter must be a number between Min_Data = 1 and Max_Data = 15    */
00270   
00271   uint8_t   is_in;          /*!< Endpoint direction
00272                                 This parameter must be a number between Min_Data = 0 and Max_Data = 1     */
00273   
00274   uint8_t   is_stall;       /*!< Endpoint stall condition
00275                                 This parameter must be a number between Min_Data = 0 and Max_Data = 1     */
00276   
00277   uint8_t   type;           /*!< Endpoint type
00278                                  This parameter can be any value of @ref USB_EP_Type                      */
00279   
00280   uint16_t  pmaadress;      /*!< PMA Address
00281                                  This parameter can be any value between Min_addr = 0 and Max_addr = 1K   */
00282   
00283   uint16_t  pmaaddr0;       /*!< PMA Address0
00284                                  This parameter can be any value between Min_addr = 0 and Max_addr = 1K   */
00285   
00286   uint16_t  pmaaddr1;        /*!< PMA Address1
00287                                  This parameter can be any value between Min_addr = 0 and Max_addr = 1K   */
00288   
00289   uint8_t   doublebuffer;    /*!< Double buffer enable
00290                                  This parameter can be 0 or 1                                             */
00291   
00292   uint16_t  tx_fifo_num;    /*!< This parameter is not required by USB Device FS peripheral, it is used 
00293                                  only by USB OTG FS peripheral    
00294                                  This parameter is added to ensure compatibility across USB peripherals   */
00295   
00296   uint32_t  maxpacket;      /*!< Endpoint Max packet size
00297                                  This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
00298   
00299   uint8_t   *xfer_buff;     /*!< Pointer to transfer buffer                                               */
00300   
00301   uint32_t  xfer_len;       /*!< Current transfer length                                                  */
00302   
00303   uint32_t  xfer_count;     /*!< Partial transfer length in case of multi packet transfer                 */
00304 
00305 } USB_EPTypeDef;
00306 #endif /* USB */
00307 
00308 /* Exported constants --------------------------------------------------------*/
00309 
00310 /** @defgroup PCD_Exported_Constants PCD Exported Constants
00311   * @{
00312   */
00313 #if defined (USB_OTG_FS)
00314 /** @defgroup USB_Core_Mode_ USB Core Mode
00315   * @{
00316   */
00317 #define USB_OTG_MODE_DEVICE                    0
00318 #define USB_OTG_MODE_HOST                      1
00319 #define USB_OTG_MODE_DRD                       2
00320 /**
00321   * @}
00322   */
00323 
00324 /** @defgroup USB_Core_Speed_   USB Core Speed
00325   * @{
00326   */  
00327 #define USB_OTG_SPEED_HIGH                     0
00328 #define USB_OTG_SPEED_HIGH_IN_FULL             1
00329 #define USB_OTG_SPEED_LOW                      2  
00330 #define USB_OTG_SPEED_FULL                     3
00331 /**
00332   * @}
00333   */
00334   
00335 /** @defgroup USB_Core_PHY_   USB Core PHY
00336   * @{
00337   */   
00338 #define USB_OTG_EMBEDDED_PHY                   1
00339 /**
00340   * @}
00341   */
00342   
00343 /** @defgroup USB_Core_MPS_   USB Core MPS
00344   * @{
00345   */
00346 #define USB_OTG_FS_MAX_PACKET_SIZE           64
00347 #define USB_OTG_MAX_EP0_SIZE                 64
00348 /**
00349   * @}
00350   */
00351 
00352 /** @defgroup USB_Core_Phy_Frequency_   USB Core Phy Frequency
00353   * @{
00354   */
00355 #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ     (0 << 1)
00356 #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ     (1 << 1)
00357 #define DSTS_ENUMSPD_LS_PHY_6MHZ               (2 << 1)
00358 #define DSTS_ENUMSPD_FS_PHY_48MHZ              (3 << 1)
00359 /**
00360   * @}
00361   */
00362   
00363 /** @defgroup USB_CORE_Frame_Interval_   USB CORE Frame Interval
00364   * @{
00365   */  
00366 #define DCFG_FRAME_INTERVAL_80                 0
00367 #define DCFG_FRAME_INTERVAL_85                 1
00368 #define DCFG_FRAME_INTERVAL_90                 2
00369 #define DCFG_FRAME_INTERVAL_95                 3
00370 /**
00371   * @}
00372   */
00373 
00374 /** @defgroup USB_EP0_MPS_  USB EP0 MPS
00375   * @{
00376   */
00377 #define DEP0CTL_MPS_64                         0
00378 #define DEP0CTL_MPS_32                         1
00379 #define DEP0CTL_MPS_16                         2
00380 #define DEP0CTL_MPS_8                          3
00381 /**
00382   * @}
00383   */
00384 
00385 /** @defgroup USB_EP_Speed_  USB EP Speed
00386   * @{
00387   */
00388 #define EP_SPEED_LOW                           0
00389 #define EP_SPEED_FULL                          1
00390 #define EP_SPEED_HIGH                          2
00391 /**
00392   * @}
00393   */
00394 
00395 /** @defgroup USB_EP_Type_  USB EP Type
00396   * @{
00397   */
00398 #define EP_TYPE_CTRL                           0
00399 #define EP_TYPE_ISOC                           1
00400 #define EP_TYPE_BULK                           2
00401 #define EP_TYPE_INTR                           3
00402 #define EP_TYPE_MSK                            3
00403 /**
00404   * @}
00405   */
00406 
00407 /** @defgroup USB_STS_Defines_   USB STS Defines
00408   * @{
00409   */
00410 #define STS_GOUT_NAK                           1
00411 #define STS_DATA_UPDT                          2
00412 #define STS_XFER_COMP                          3
00413 #define STS_SETUP_COMP                         4
00414 #define STS_SETUP_UPDT                         6
00415 /**
00416   * @}
00417   */
00418 
00419 /** @defgroup HCFG_SPEED_Defines_   HCFG SPEED Defines
00420   * @{
00421   */  
00422 #define HCFG_30_60_MHZ                         0
00423 #define HCFG_48_MHZ                            1
00424 #define HCFG_6_MHZ                             2
00425 /**
00426   * @}
00427   */
00428     
00429 /** @defgroup HPRT0_PRTSPD_SPEED_Defines_  HPRT0 PRTSPD SPEED Defines
00430   * @{
00431   */    
00432 #define HPRT0_PRTSPD_HIGH_SPEED                0
00433 #define HPRT0_PRTSPD_FULL_SPEED                1
00434 #define HPRT0_PRTSPD_LOW_SPEED                 2
00435 /**
00436   * @}
00437   */  
00438    
00439 #define HCCHAR_CTRL                            0
00440 #define HCCHAR_ISOC                            1
00441 #define HCCHAR_BULK                            2
00442 #define HCCHAR_INTR                            3
00443        
00444 #define HC_PID_DATA0                           0
00445 #define HC_PID_DATA2                           1
00446 #define HC_PID_DATA1                           2
00447 #define HC_PID_SETUP                           3
00448 
00449 #define GRXSTS_PKTSTS_IN                       2
00450 #define GRXSTS_PKTSTS_IN_XFER_COMP             3
00451 #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR          5
00452 #define GRXSTS_PKTSTS_CH_HALTED                7
00453     
00454 #define USBx_PCGCCTL    *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_PCGCCTL_BASE)
00455 #define USBx_HPRT0      *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_HOST_PORT_BASE)
00456 
00457 #define USBx_DEVICE     ((USB_OTG_DeviceTypeDef *)((uint32_t )USBx + USB_OTG_DEVICE_BASE)) 
00458 #define USBx_INEP(i)    ((USB_OTG_INEndpointTypeDef *)((uint32_t)USBx + USB_OTG_IN_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE))        
00459 #define USBx_OUTEP(i)   ((USB_OTG_OUTEndpointTypeDef *)((uint32_t)USBx + USB_OTG_OUT_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE))        
00460 #define USBx_DFIFO(i)   *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_FIFO_BASE + (i) * USB_OTG_FIFO_SIZE)
00461 
00462 #define USBx_HOST       ((USB_OTG_HostTypeDef *)((uint32_t )USBx + USB_OTG_HOST_BASE))  
00463 #define USBx_HC(i)      ((USB_OTG_HostChannelTypeDef *)((uint32_t)USBx + USB_OTG_HOST_CHANNEL_BASE + (i)*USB_OTG_HOST_CHANNEL_SIZE))
00464 
00465 #endif /* USB_OTG_FS */
00466 
00467 #if defined (USB)  
00468 /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS
00469   * @{
00470   */
00471 #define DEP0CTL_MPS_64                         0
00472 #define DEP0CTL_MPS_32                         1
00473 #define DEP0CTL_MPS_16                         2
00474 #define DEP0CTL_MPS_8                          3
00475 /**
00476   * @}
00477   */ 
00478 
00479 /** @defgroup USB_LL_EP_Type USB Low Layer EP Type
00480   * @{
00481   */
00482 #define EP_TYPE_CTRL                           0
00483 #define EP_TYPE_ISOC                           1
00484 #define EP_TYPE_BULK                           2
00485 #define EP_TYPE_INTR                           3
00486 #define EP_TYPE_MSK                            3
00487 /**
00488   * @}
00489   */ 
00490 
00491 #define BTABLE_ADDRESS                         (0x000)
00492 #endif /* USB */
00493 
00494 /**
00495   * @}
00496   */
00497 
00498 /* Exported macro ------------------------------------------------------------*/
00499 #if defined (USB_OTG_FS)
00500 #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__)     ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__))
00501 #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__)   ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__))
00502     
00503 #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__)          (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__))
00504 #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__)         (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__))  
00505 #endif /* USB_OTG_FS */
00506 
00507 /* Exported functions --------------------------------------------------------*/
00508 #if defined (USB_OTG_FS)
00509 HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef Init);
00510 HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef Init);
00511 HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
00512 HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
00513 HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx , USB_ModeTypeDef mode);
00514 HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx , uint8_t speed);
00515 HAL_StatusTypeDef USB_FlushRxFifo (USB_OTG_GlobalTypeDef *USBx);
00516 HAL_StatusTypeDef USB_FlushTxFifo (USB_OTG_GlobalTypeDef *USBx, uint32_t num );
00517 HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
00518 HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
00519 HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
00520 HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
00521 HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep, uint8_t dma);
00522 HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep, uint8_t dma);
00523 HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len, uint8_t dma);
00524 void *            USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len);
00525 HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep);
00526 HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep);
00527 HAL_StatusTypeDef USB_SetDevAddress (USB_OTG_GlobalTypeDef *USBx, uint8_t address);
00528 HAL_StatusTypeDef USB_DevConnect (USB_OTG_GlobalTypeDef *USBx);
00529 HAL_StatusTypeDef USB_DevDisconnect (USB_OTG_GlobalTypeDef *USBx);
00530 HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx);
00531 HAL_StatusTypeDef USB_ActivateSetup (USB_OTG_GlobalTypeDef *USBx);
00532 HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t dma, uint8_t *psetup);
00533 uint8_t           USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx);
00534 uint32_t          USB_GetMode(USB_OTG_GlobalTypeDef *USBx);
00535 uint32_t          USB_ReadInterrupts (USB_OTG_GlobalTypeDef *USBx);
00536 uint32_t          USB_ReadDevAllOutEpInterrupt (USB_OTG_GlobalTypeDef *USBx);
00537 uint32_t          USB_ReadDevOutEPInterrupt (USB_OTG_GlobalTypeDef *USBx , uint8_t epnum);
00538 uint32_t          USB_ReadDevAllInEpInterrupt (USB_OTG_GlobalTypeDef *USBx);
00539 uint32_t          USB_ReadDevInEPInterrupt (USB_OTG_GlobalTypeDef *USBx , uint8_t epnum);
00540 void              USB_ClearInterrupts (USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt);
00541 
00542 HAL_StatusTypeDef USB_HostInit (USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
00543 HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx , uint8_t freq);
00544 HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx);
00545 HAL_StatusTypeDef USB_DriveVbus (USB_OTG_GlobalTypeDef *USBx, uint8_t state);
00546 uint32_t          USB_GetHostSpeed (USB_OTG_GlobalTypeDef *USBx);
00547 uint32_t          USB_GetCurrentFrame (USB_OTG_GlobalTypeDef *USBx);
00548 HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx,  
00549                                   uint8_t ch_num,
00550                                   uint8_t epnum,
00551                                   uint8_t dev_address,
00552                                   uint8_t speed,
00553                                   uint8_t ep_type,
00554                                   uint16_t mps);
00555 HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc, uint8_t dma);
00556 uint32_t          USB_HC_ReadInterrupt (USB_OTG_GlobalTypeDef *USBx);
00557 HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx , uint8_t hc_num);
00558 HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx , uint8_t ch_num);
00559 HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx);
00560 HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
00561 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
00562 #endif /* USB_OTG_FS */
00563 
00564 #if defined (USB)
00565 HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef Init);
00566 HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef Init);
00567 HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx);
00568 HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx);
00569 HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx , USB_ModeTypeDef mode);
00570 HAL_StatusTypeDef USB_SetDevSpeed(USB_TypeDef *USBx , uint8_t speed);
00571 HAL_StatusTypeDef USB_FlushRxFifo (USB_TypeDef *USBx);
00572 HAL_StatusTypeDef USB_FlushTxFifo (USB_TypeDef *USBx, uint32_t num );
00573 HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep);
00574 HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep);
00575 HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx , USB_EPTypeDef *ep ,uint8_t dma);
00576 HAL_StatusTypeDef USB_WritePacket(USB_TypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len);
00577 void *            USB_ReadPacket(USB_TypeDef *USBx, uint8_t *dest, uint16_t len);
00578 HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx , USB_EPTypeDef *ep);
00579 HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx , USB_EPTypeDef *ep);
00580 HAL_StatusTypeDef USB_SetDevAddress (USB_TypeDef *USBx, uint8_t address);
00581 HAL_StatusTypeDef USB_DevConnect (USB_TypeDef *USBx);
00582 HAL_StatusTypeDef USB_DevDisconnect (USB_TypeDef *USBx);
00583 HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx);
00584 HAL_StatusTypeDef USB_EP0_OutStart(USB_TypeDef *USBx, uint8_t dma, uint8_t *psetup);
00585 uint32_t          USB_ReadInterrupts (USB_TypeDef *USBx);
00586 uint32_t          USB_ReadDevAllOutEpInterrupt (USB_TypeDef *USBx);
00587 uint32_t          USB_ReadDevOutEPInterrupt (USB_TypeDef *USBx , uint8_t epnum);
00588 uint32_t          USB_ReadDevAllInEpInterrupt (USB_TypeDef *USBx);
00589 uint32_t          USB_ReadDevInEPInterrupt (USB_TypeDef *USBx , uint8_t epnum);
00590 void              USB_ClearInterrupts (USB_TypeDef *USBx, uint32_t interrupt);
00591 
00592 HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx);
00593 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx);
00594 void USB_WritePMA(USB_TypeDef  *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
00595 void USB_ReadPMA(USB_TypeDef  *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
00596 #endif /* USB */
00597 /**
00598   * @}
00599   */ 
00600 
00601 /**
00602   * @}
00603   */
00604 
00605 #endif /* STM32L475xx || STM32L476xx || */
00606        /* STM32L485xx || STM32L486xx || */
00607        /* STM32L432xx || STM32L433xx || */
00608        /* STM32L442xx || STM32L443xx    */
00609   
00610 #ifdef __cplusplus
00611 }
00612 #endif
00613 
00614 
00615 #endif /* __STM32L4xx_LL_USB_H */
00616 
00617 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/