STM32G474xx HAL用户手册
stm32g4xx_ll_ucpd.h
转至该文件的文档。
00001 /**
00002   ******************************************************************************
00003   * @file    stm32g4xx_ll_ucpd.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of UCPD LL module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2019 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32G4xx_LL_UCPD_H
00021 #define STM32G4xx_LL_UCPD_H
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 /* Includes ------------------------------------------------------------------*/
00028 #include "stm32g4xx.h"
00029 
00030 /** @addtogroup STM32G4xx_LL_Driver
00031   * @{
00032   */
00033 
00034 #if defined (UCPD1)
00035 
00036 /** @defgroup UCPD_LL UCPD
00037   * @{
00038   */
00039 
00040 /* Private types -------------------------------------------------------------*/
00041 /* Private variables ---------------------------------------------------------*/
00042 /* Private macros ------------------------------------------------------------*/
00043 
00044 /* Exported types ------------------------------------------------------------*/
00045 #if defined(USE_FULL_LL_DRIVER)
00046 /** @defgroup UCPD_LL_ES_INIT UCPD Exported Init structure
00047   * @{
00048   */
00049 
00050 /**
00051   * @brief  UCPD Init structures definition
00052   */
00053 typedef struct
00054 {
00055   uint32_t psc_ucpdclk;         /*!< Specify the prescaler for the UCPD clock.
00056                                      This parameter can be a value of @ref UCPD_LL_EC_PSC.
00057                                      This feature can be modified afterwards using function @ref LL_UCPD_SetPSCClk().
00058                                 */
00059 
00060   uint32_t transwin;            /*!< Specify the number of cycles (minus 1) of the half bit clock (see HBITCLKDIV)
00061                                    to achieve a legal tTransitionWindow (set according to peripheral clock to define
00062                                     an interval of between 12 and 20 us).
00063                                     This parameter can be a value between Min_Data=0x1 and Max_Data=0x1F
00064                                     This value can be modified afterwards using function @ref LL_UCPD_SetTransWin().
00065                                 */
00066 
00067   uint32_t IfrGap;              /*!< Specify the definition of the clock divider (minus 1) in order to generate
00068                                     tInterframeGap from the peripheral clock.
00069                                     This parameter can be a value between Min_Data=0x1 and Max_Data=0x1F
00070                                     This feature can be modified afterwards using function @ref LL_UCPD_SetIfrGap().
00071                                 */
00072 
00073   uint32_t HbitClockDiv;        /*!< Specify the number of cycles (minus one) at UCPD peripheral for a half bit clock
00074                                      e.g. program 3 for a bit clock that takes 8 cycles of the peripheral clock :
00075                                      "UCPD1_CLK".
00076                                      This parameter can be a value between Min_Data=0x0 and Max_Data=0x3F.
00077                                      This feature can be modified using function @ref LL_UCPD_SetHbitClockDiv().
00078                                 */
00079 
00080 } LL_UCPD_InitTypeDef;
00081 
00082 /**
00083   * @}
00084   */
00085 #endif /* USE_FULL_LL_DRIVER */
00086 
00087 /* Exported constants --------------------------------------------------------*/
00088 /** @defgroup UCPD_LL_Exported_Constants UCPD Exported Constants
00089   * @{
00090   */
00091 
00092 /** @defgroup UCPD_LL_EC_GET_FLAG Get Flags Defines
00093   * @brief    Flags defines which can be used with LL_ucpd_ReadReg function
00094   * @{
00095   */
00096 #define LL_UCPD_SR_TXIS             UCPD_SR_TXIS                  /*!< Transmit interrupt status                      */
00097 #define LL_UCPD_SR_TXMSGDISC        UCPD_SR_TXMSGDISC             /*!< Transmit message discarded interrupt           */
00098 #define LL_UCPD_SR_TXMSGSENT        UCPD_SR_TXMSGSENT             /*!< Transmit message sent interrupt                */
00099 #define LL_UCPD_SR_TXMSGABT         UCPD_SR_TXMSGABT              /*!< Transmit message abort interrupt               */
00100 #define LL_UCPD_SR_HRSTDISC         UCPD_SR_HRSTDISC              /*!< HRST discarded interrupt                       */
00101 #define LL_UCPD_SR_HRSTSENT         UCPD_SR_HRSTSENT              /*!< HRST sent interrupt                            */
00102 #define LL_UCPD_SR_TXUND            UCPD_SR_TXUND                 /*!< Tx data underrun condition interrupt           */
00103 #define LL_UCPD_SR_RXNE             UCPD_SR_RXNE                  /*!< Receive data register not empty interrupt      */
00104 #define LL_UCPD_SR_RXORDDET         UCPD_SR_RXORDDET              /*!< Rx ordered set (4 K-codes) detected interrupt  */
00105 #define LL_UCPD_SR_RXHRSTDET        UCPD_SR_RXHRSTDET             /*!< Rx Hard Reset detect interrupt                 */
00106 #define LL_UCPD_SR_RXOVR            UCPD_SR_RXOVR                 /*!< Rx data overflow interrupt                     */
00107 #define LL_UCPD_SR_RXMSGEND         UCPD_SR_RXMSGEND              /*!< Rx message received                            */
00108 #define LL_UCPD_SR_RXERR            UCPD_SR_RXERR                 /*!< Rx error                                       */
00109 #define LL_UCPD_SR_TYPECEVT1        UCPD_SR_TYPECEVT1             /*!< Type C voltage level event on CC1              */
00110 #define LL_UCPD_SR_TYPECEVT2        UCPD_SR_TYPECEVT2             /*!< Type C voltage level event on CC2              */
00111 #define LL_UCPD_SR_TYPEC_VSTATE_CC1 UCPD_SR_TYPEC_VSTATE_CC1      /*!<Status of DC level on CC1 pin                   */
00112 #define LL_UCPD_SR_TYPEC_VSTATE_CC2 UCPD_SR_TYPEC_VSTATE_CC2      /*!<Status of DC level on CC2 pin                   */
00113 #define LL_UCPD_SR_FRSEVT           UCPD_SR_FRSEVT                /*!<Fast Role Swap detection event                  */
00114 
00115 /**
00116   * @}
00117   */
00118 
00119 /** @defgroup UCPD_LL_EC_IT IT Defines
00120   * @brief    IT defines which can be used with LL_UCPD_ReadReg and  LL_UCPD_WriteReg functions
00121   * @{
00122   */
00123 #define LL_UCPD_IMR_TXIS             UCPD_IMR_TXISIE              /*!< Enable transmit interrupt status                     */
00124 #define LL_UCPD_IMR_TXMSGDISC        UCPD_IMR_TXMSGDISCIE         /*!< Enable transmit message discarded interrupt          */
00125 #define LL_UCPD_IMR_TXMSGSENT        UCPD_IMR_TXMSGSENTIE         /*!< Enable transmit message sent interrupt               */
00126 #define LL_UCPD_IMR_TXMSGABT         UCPD_IMR_TXMSGABTIE          /*!< Enable transmit message abort interrupt              */
00127 #define LL_UCPD_IMR_HRSTDISC         UCPD_IMR_HRSTDISCIE          /*!< Enable HRST discarded interrupt                      */
00128 #define LL_UCPD_IMR_HRSTSENT         UCPD_IMR_HRSTSENTIE          /*!< Enable HRST sent interrupt                           */
00129 #define LL_UCPD_IMR_TXUND            UCPD_IMR_TXUNDIE             /*!< Enable tx data underrun condition interrupt          */
00130 #define LL_UCPD_IMR_RXNE             UCPD_IMR_RXNEIE              /*!< Enable Receive data register not empty interrupt     */
00131 #define LL_UCPD_IMR_RXORDDET         UCPD_IMR_RXORDDETIE          /*!< Enable Rx ordered set (4 K-codes) detected interrupt */
00132 #define LL_UCPD_IMR_RXHRSTDET        UCPD_IMR_RXHRSTDETIE         /*!< Enable Rx Hard Reset detect interrupt                */
00133 #define LL_UCPD_IMR_RXOVR            UCPD_IMR_RXOVRIE             /*!< Enable Rx data overflow interrupt                    */
00134 #define LL_UCPD_IMR_RXMSGEND         UCPD_IMR_RXMSGENDIE          /*!< Enable Rx message received                           */
00135 #define LL_UCPD_IMR_TYPECEVT1        UCPD_IMR_TYPECEVT1IE         /*!< Enable Type C voltage level event on CC1             */
00136 #define LL_UCPD_IMR_TYPECEVT2        UCPD_IMR_TYPECEVT2IE         /*!< Enable Type C voltage level event on CC2             */
00137 #define LL_UCPD_IMR_FRSEVT           UCPD_IMR_FRSEVTIE            /*!< Enable fast Role Swap detection event                */
00138 
00139 /**
00140   * @}
00141   */
00142 
00143 /** @defgroup UCPD_LL_EC_ORDERSET Ordered sets value
00144   * @brief    definition of the usual Ordered sets
00145   * @{
00146   */
00147 #define LL_UCPD_SYNC1 0x18u                                       /*!< K-code for Startsynch #1                             */
00148 #define LL_UCPD_SYNC2 0x11u                                       <