stm32g0xx_ll_ucpd.h 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863
  1. /**
  2. ******************************************************************************
  3. * @file stm32g0xx_ll_ucpd.h
  4. * @author MCD Application Team
  5. * @brief Header file of UCPD LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2018 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32G0xx_LL_UCPD_H
  20. #define STM32G0xx_LL_UCPD_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32g0xx.h"
  26. /** @addtogroup STM32G0xx_LL_Driver
  27. * @{
  28. */
  29. #if defined (UCPD1) || defined (UCPD2)
  30. /** @defgroup UCPD_LL UCPD
  31. * @{
  32. */
  33. /* Private types -------------------------------------------------------------*/
  34. /* Private variables ---------------------------------------------------------*/
  35. /* Private macros ------------------------------------------------------------*/
  36. /* Exported types ------------------------------------------------------------*/
  37. #if defined(USE_FULL_LL_DRIVER)
  38. /** @defgroup UCPD_LL_ES_INIT UCPD Exported Init structure
  39. * @{
  40. */
  41. /**
  42. * @brief UCPD Init structures definition
  43. */
  44. typedef struct
  45. {
  46. uint32_t psc_ucpdclk; /*!< Specify the prescaler for the UCPD clock.
  47. This parameter can be a value of @ref UCPD_LL_EC_PSC.
  48. This feature can be modified afterwards using function @ref LL_UCPD_SetPSCClk().
  49. */
  50. uint32_t transwin; /*!< Specify the number of cycles (minus 1) of the half bit clock (see HBITCLKDIV)
  51. to achieve a legal tTransitionWindow (set according to peripheral clock to define
  52. an interval of between 12 and 20 us).
  53. This parameter can be a value between Min_Data=0x1 and Max_Data=0x1F
  54. This value can be modified afterwards using function @ref LL_UCPD_SetTransWin().
  55. */
  56. uint32_t IfrGap; /*!< Specify the definition of the clock divider (minus 1) in order to generate
  57. tInterframeGap from the peripheral clock.
  58. This parameter can be a value between Min_Data=0x1 and Max_Data=0x1F
  59. This feature can be modified afterwards using function @ref LL_UCPD_SetIfrGap().
  60. */
  61. uint32_t HbitClockDiv; /*!< Specify the number of cycles (minus one) at UCPD peripheral for a half bit clock
  62. e.g. program 3 for a bit clock that takes 8 cycles of the peripheral clock :
  63. "UCPD1_CLK".
  64. This parameter can be a value between Min_Data=0x0 and Max_Data=0x3F.
  65. This feature can be modified using function @ref LL_UCPD_SetHbitClockDiv().
  66. */
  67. } LL_UCPD_InitTypeDef;
  68. /**
  69. * @}
  70. */
  71. #endif /* USE_FULL_LL_DRIVER */
  72. /* Exported constants --------------------------------------------------------*/
  73. /** @defgroup UCPD_LL_Exported_Constants UCPD Exported Constants
  74. * @{
  75. */
  76. /** @defgroup UCPD_LL_EC_GET_FLAG Get Flags Defines
  77. * @brief Flags defines which can be used with LL_ucpd_ReadReg function
  78. * @{
  79. */
  80. #define LL_UCPD_SR_TXIS UCPD_SR_TXIS /*!< Transmit interrupt status */
  81. #define LL_UCPD_SR_TXMSGDISC UCPD_SR_TXMSGDISC /*!< Transmit message discarded interrupt */
  82. #define LL_UCPD_SR_TXMSGSENT UCPD_SR_TXMSGSENT /*!< Transmit message sent interrupt */
  83. #define LL_UCPD_SR_TXMSGABT UCPD_SR_TXMSGABT /*!< Transmit message abort interrupt */
  84. #define LL_UCPD_SR_HRSTDISC UCPD_SR_HRSTDISC /*!< HRST discarded interrupt */
  85. #define LL_UCPD_SR_HRSTSENT UCPD_SR_HRSTSENT /*!< HRST sent interrupt */
  86. #define LL_UCPD_SR_TXUND UCPD_SR_TXUND /*!< Tx data underrun condition interrupt */
  87. #define LL_UCPD_SR_RXNE UCPD_SR_RXNE /*!< Receive data register not empty interrupt */
  88. #define LL_UCPD_SR_RXORDDET UCPD_SR_RXORDDET /*!< Rx ordered set (4 K-codes) detected interrupt */
  89. #define LL_UCPD_SR_RXHRSTDET UCPD_SR_RXHRSTDET /*!< Rx Hard Reset detect interrupt */
  90. #define LL_UCPD_SR_RXOVR UCPD_SR_RXOVR /*!< Rx data overflow interrupt */
  91. #define LL_UCPD_SR_RXMSGEND UCPD_SR_RXMSGEND /*!< Rx message received */
  92. #define LL_UCPD_SR_RXERR UCPD_SR_RXERR /*!< Rx error */
  93. #define LL_UCPD_SR_TYPECEVT1 UCPD_SR_TYPECEVT1 /*!< Type C voltage level event on CC1 */
  94. #define LL_UCPD_SR_TYPECEVT2 UCPD_SR_TYPECEVT2 /*!< Type C voltage level event on CC2 */
  95. #define LL_UCPD_SR_TYPEC_VSTATE_CC1 UCPD_SR_TYPEC_VSTATE_CC1 /*!<Status of DC level on CC1 pin */
  96. #define LL_UCPD_SR_TYPEC_VSTATE_CC2 UCPD_SR_TYPEC_VSTATE_CC2 /*!<Status of DC level on CC2 pin */
  97. #define LL_UCPD_SR_FRSEVT UCPD_SR_FRSEVT /*!<Fast Role Swap detection event */
  98. /**
  99. * @}
  100. */
  101. /** @defgroup UCPD_LL_EC_IT IT Defines
  102. * @brief IT defines which can be used with LL_UCPD_ReadReg and LL_UCPD_WriteReg functions
  103. * @{
  104. */
  105. #define LL_UCPD_IMR_TXIS UCPD_IMR_TXISIE /*!< Enable transmit interrupt status */
  106. #define LL_UCPD_IMR_TXMSGDISC UCPD_IMR_TXMSGDISCIE /*!< Enable transmit message discarded interrupt */
  107. #define LL_UCPD_IMR_TXMSGSENT UCPD_IMR_TXMSGSENTIE /*!< Enable transmit message sent interrupt */
  108. #define LL_UCPD_IMR_TXMSGABT UCPD_IMR_TXMSGABTIE /*!< Enable transmit message abort interrupt */
  109. #define LL_UCPD_IMR_HRSTDISC UCPD_IMR_HRSTDISCIE /*!< Enable HRST discarded interrupt */
  110. #define LL_UCPD_IMR_HRSTSENT UCPD_IMR_HRSTSENTIE /*!< Enable HRST sent interrupt */
  111. #define LL_UCPD_IMR_TXUND UCPD_IMR_TXUNDIE /*!< Enable tx data underrun condition interrupt */
  112. #define LL_UCPD_IMR_RXNE UCPD_IMR_RXNEIE /*!< Enable Receive data register not empty interrupt */
  113. #define LL_UCPD_IMR_RXORDDET UCPD_IMR_RXORDDETIE /*!< Enable Rx ordered set (4 K-codes) detected interrupt */
  114. #define LL_UCPD_IMR_RXHRSTDET UCPD_IMR_RXHRSTDETIE /*!< Enable Rx Hard Reset detect interrupt */
  115. #define LL_UCPD_IMR_RXOVR UCPD_IMR_RXOVRIE /*!< Enable Rx data overflow interrupt */
  116. #define LL_UCPD_IMR_RXMSGEND UCPD_IMR_RXMSGENDIE /*!< Enable Rx message received */
  117. #define LL_UCPD_IMR_TYPECEVT1 UCPD_IMR_TYPECEVT1IE /*!< Enable Type C voltage level event on CC1 */
  118. #define LL_UCPD_IMR_TYPECEVT2 UCPD_IMR_TYPECEVT2IE /*!< Enable Type C voltage level event on CC2 */
  119. #define LL_UCPD_IMR_FRSEVT UCPD_IMR_FRSEVTIE /*!< Enable fast Role Swap detection event */
  120. /**
  121. * @}
  122. */
  123. /** @defgroup UCPD_LL_EC_ORDERSET Ordered sets value
  124. * @brief definition of the usual Ordered sets
  125. * @{
  126. */
  127. #define LL_UCPD_SYNC1 0x18u /*!< K-code for Startsynch #1 */
  128. #define LL_UCPD_SYNC2 0x11u /*!< K-code for Startsynch #2 */
  129. #define LL_UCPD_SYNC3 0x06u /*!< K-code for Startsynch #3 */
  130. #define LL_UCPD_RST1 0x07u /*!< K-code for Hard Reset #1 */
  131. #define LL_UCPD_RST2 0x19u /*!< K-code for Hard Reset #2 */
  132. #define LL_UCPD_EOP 0x0Du /*!< K-code for EOP End of Packet */
  133. #define LL_UCPD_ORDERED_SET_SOP (LL_UCPD_SYNC1 | (LL_UCPD_SYNC1<<5u) | (LL_UCPD_SYNC1<<10u) | (LL_UCPD_SYNC2<<15u)) /*!< SOP Ordered set coding */
  134. #define LL_UCPD_ORDERED_SET_SOP1 (LL_UCPD_SYNC1 | (LL_UCPD_SYNC1<<5u) | (LL_UCPD_SYNC3<<10u) | (LL_UCPD_SYNC3<<15u)) /*!< SOP' Ordered set coding */
  135. #define LL_UCPD_ORDERED_SET_SOP2 (LL_UCPD_SYNC1 | (LL_UCPD_SYNC3<<5u) | (LL_UCPD_SYNC1<<10u) | (LL_UCPD_SYNC3<<15u)) /*!< SOP'' Ordered set coding */
  136. #define LL_UCPD_ORDERED_SET_HARD_RESET (LL_UCPD_RST1 | (LL_UCPD_RST1<<5u) | (LL_UCPD_RST1<<10u) | (LL_UCPD_RST2<<15u )) /*!< Hard Reset Ordered set coding */
  137. #define LL_UCPD_ORDERED_SET_CABLE_RESET (LL_UCPD_RST1 | (LL_UCPD_SYNC1<<5u) | (LL_UCPD_RST1<<10u) | (LL_UCPD_SYNC3<<15u)) /*!< Cable Reset Ordered set coding */
  138. #define LL_UCPD_ORDERED_SET_SOP1_DEBUG (LL_UCPD_SYNC1 | (LL_UCPD_RST2<<5u) | (LL_UCPD_RST2<<10u) | (LL_UCPD_SYNC3<<15u)) /*!< SOP' Debug Ordered set coding */
  139. #define LL_UCPD_ORDERED_SET_SOP2_DEBUG (LL_UCPD_SYNC1 | (LL_UCPD_RST2<<5u) | (LL_UCPD_SYNC3<<10u) | (LL_UCPD_SYNC2<<15u)) /*!< SOP'' Debug Ordered set coding */
  140. /**
  141. * @}
  142. */
  143. /** @defgroup UCPD_LL_EC_MODE Role Mode
  144. * @{
  145. */
  146. #define LL_UCPD_ROLE_SNK UCPD_CR_ANAMODE /*!< Mode SNK Rd */
  147. #define LL_UCPD_ROLE_SRC 0x0U /*!< Mode SRC Rp */
  148. /**
  149. * @}
  150. */
  151. /** @defgroup UCPD_LL_EC_RESISTOR Resistor value
  152. * @{
  153. */
  154. #define LL_UCPD_RESISTOR_DEFAULT UCPD_CR_ANASUBMODE_0 /*!< Rp default */
  155. #define LL_UCPD_RESISTOR_1_5A UCPD_CR_ANASUBMODE_1 /*!< Rp 1.5 A */
  156. #define LL_UCPD_RESISTOR_3_0A UCPD_CR_ANASUBMODE /*!< Rp 3.0 A */
  157. #define LL_UCPD_RESISTOR_NONE 0x0U /*!< No resistor */
  158. /**
  159. * @}
  160. */
  161. /** @defgroup UCPD_LL_EC_CFG1_ORDERSET ordered set configuration
  162. * @{
  163. */
  164. #define LL_UCPD_ORDERSET_SOP UCPD_CFG1_RXORDSETEN_0 /*!< SOP Ordered set detection enabled */
  165. #define LL_UCPD_ORDERSET_SOP1 UCPD_CFG1_RXORDSETEN_1 /*!< SOP' Ordered set detection enabled */
  166. #define LL_UCPD_ORDERSET_SOP2 UCPD_CFG1_RXORDSETEN_2 /*!< SOP'' Ordered set detection enabled */
  167. #define LL_UCPD_ORDERSET_HARDRST UCPD_CFG1_RXORDSETEN_3 /*!< Hard Reset Ordered set detection enabled */
  168. #define LL_UCPD_ORDERSET_CABLERST UCPD_CFG1_RXORDSETEN_4 /*!< Cable Reset Ordered set detection enabled */
  169. #define LL_UCPD_ORDERSET_SOP1_DEBUG UCPD_CFG1_RXORDSETEN_5 /*!< SOP' Debug Ordered set detection enabled */
  170. #define LL_UCPD_ORDERSET_SOP2_DEBUG UCPD_CFG1_RXORDSETEN_6 /*!< SOP'' Debug Ordered set detection enabled */
  171. #define LL_UCPD_ORDERSET_SOP_EXT1 UCPD_CFG1_RXORDSETEN_7 /*!< SOP extension#1 Ordered set detection enabled */
  172. #define LL_UCPD_ORDERSET_SOP_EXT2 UCPD_CFG1_RXORDSETEN_8 /*!< SOP extension#2 Ordered set detection enabled */
  173. /**
  174. * @}
  175. */
  176. /** @defgroup UCPD_LL_EC_CCxEVT CCx event
  177. * @{
  178. */
  179. #define LL_UCPD_SNK_CC1_VOPEN 0x00u /*!< CC1 Sink Open state */
  180. #define LL_UCPD_SNK_CC1_VRP UCPD_SR_TYPEC_VSTATE_CC1_0 /*!< CC1 Sink vRP default state */
  181. #define LL_UCPD_SNK_CC1_VRP15A UCPD_SR_TYPEC_VSTATE_CC1_1 /*!< CC1 Sink vRP 1.5A state */
  182. #define LL_UCPD_SNK_CC1_VRP30A (UCPD_SR_TYPEC_VSTATE_CC1_0 | UCPD_SR_TYPEC_VSTATE_CC1_1) /*!< CC1 Sink vRP 3.0A state */
  183. #define LL_UCPD_SNK_CC2_VOPEN 0x00u /*!< CC2 Sink Open state */
  184. #define LL_UCPD_SNK_CC2_VRP UCPD_SR_TYPEC_VSTATE_CC2_0 /*!< CC2 Sink vRP default state */
  185. #define LL_UCPD_SNK_CC2_VRP15A UCPD_SR_TYPEC_VSTATE_CC2_1 /*!< CC2 Sink vRP 1.5A state */
  186. #define LL_UCPD_SNK_CC2_VRP30A (UCPD_SR_TYPEC_VSTATE_CC2_0 | UCPD_SR_TYPEC_VSTATE_CC2_1) /*!< CC2 Sink vRP 3.0A state */
  187. #define LL_UCPD_SRC_CC1_VRA 0x0U /*!< CC1 Source vRA state */
  188. #define LL_UCPD_SRC_CC1_VRD UCPD_SR_TYPEC_VSTATE_CC1_0 /*!< CC1 Source vRD state */
  189. #define LL_UCPD_SRC_CC1_OPEN UCPD_SR_TYPEC_VSTATE_CC1_1 /*!< CC1 Source Open state */
  190. #define LL_UCPD_SRC_CC2_VRA 0x0U /*!< CC2 Source vRA state */
  191. #define LL_UCPD_SRC_CC2_VRD UCPD_SR_TYPEC_VSTATE_CC2_0 /*!< CC2 Source vRD state */
  192. #define LL_UCPD_SRC_CC2_OPEN UCPD_SR_TYPEC_VSTATE_CC2_1 /*!< CC2 Source Open state */
  193. /**
  194. * @}
  195. */
  196. /** @defgroup UCPD_LL_EC_PSC prescaler for UCPDCLK
  197. * @{
  198. */
  199. #define LL_UCPD_PSC_DIV1 0x0u /*!< Bypass pre-scaling / divide by 1 */
  200. #define LL_UCPD_PSC_DIV2 UCPD_CFG1_PSC_UCPDCLK_0 /*!< Pre-scale clock by dividing by 2 */
  201. #define LL_UCPD_PSC_DIV4 UCPD_CFG1_PSC_UCPDCLK_1 /*!< Pre-scale clock by dividing by 4 */
  202. #define LL_UCPD_PSC_DIV8 (UCPD_CFG1_PSC_UCPDCLK_1 | UCPD_CFG1_PSC_UCPDCLK_0) /*!< Pre-scale clock by dividing by 8 */
  203. #define LL_UCPD_PSC_DIV16 UCPD_CFG1_PSC_UCPDCLK_2 /*!< Pre-scale clock by dividing by 16 */
  204. /**
  205. * @}
  206. */
  207. /** @defgroup UCPD_LL_EC_CCENABLE CC pin enable
  208. * @{
  209. */
  210. #define LL_UCPD_CCENABLE_NONE 0x0U /*!< Neither PHY is activated (e.g. disabled state of source) */
  211. #define LL_UCPD_CCENABLE_CC1 UCPD_CR_CCENABLE_0 /*!< Controls apply to only CC1 */
  212. #define LL_UCPD_CCENABLE_CC2 UCPD_CR_CCENABLE_1 /*!< Controls apply to only CC1 */
  213. #define LL_UCPD_CCENABLE_CC1CC2 (UCPD_CR_CCENABLE_0 | UCPD_CR_CCENABLE_1) /*!< Controls apply to both CC1 and CC2 (normal usage for sink/source) */
  214. /**
  215. * @}
  216. */
  217. /** @defgroup UCPD_LL_EC_CCPIN CC pin selection
  218. * @{
  219. */
  220. #define LL_UCPD_CCPIN_CC1 0x0U /*!< Use CC1 IO for power delivery communication */
  221. #define LL_UCPD_CCPIN_CC2 UCPD_CR_PHYCCSEL /*!< Use CC2 IO for power delivery communication */
  222. /**
  223. * @}
  224. */
  225. /** @defgroup UCPD_LL_EC_RXMODE Receiver mode
  226. * @{
  227. */
  228. #define LL_UCPD_RXMODE_NORMAL 0x0U /*!< Normal receive mode */
  229. #define LL_UCPD_RXMODE_BIST_TEST_DATA UCPD_CR_RXMODE /*!< BIST receive mode (BIST Test Data Mode) */
  230. /**
  231. * @}
  232. */
  233. /** @defgroup UCPD_LL_EC_TXMODE Type of Tx packet
  234. * @{
  235. */
  236. #define LL_UCPD_TXMODE_NORMAL 0x0U /*!< Initiate the transfer of a Tx message */
  237. #define LL_UCPD_TXMODE_CABLE_RESET UCPD_CR_TXMODE_0 /*!< Trigger a the transfer of a Cable Reset sequence */
  238. #define LL_UCPD_TXMODE_BIST_CARRIER2 UCPD_CR_TXMODE_1 /*!< Trigger a BIST test sequence send (BIST Carrier Mode 2) */
  239. /**
  240. * @}
  241. */
  242. /** @defgroup UCPD_LL_EC_RXORDSET Rx ordered set code detected
  243. * @{
  244. */
  245. #define LL_UCPD_RXORDSET_SOP 0x0U /*!< SOP code detected in receiver */
  246. #define LL_UCPD_RXORDSET_SOP1 UCPD_RX_ORDSET_RXORDSET_0 /*!< SOP' code detected in receiver */
  247. #define LL_UCPD_RXORDSET_SOP2 UCPD_RX_ORDSET_RXORDSET_1 /*!< SOP'' code detected in receiver */
  248. #define LL_UCPD_RXORDSET_SOP1_DEBUG (UCPD_RX_ORDSET_RXORDSET_0 | UCPD_RX_ORDSET_RXORDSET_1) /*!< SOP' Debug code detected in receiver */
  249. #define LL_UCPD_RXORDSET_SOP2_DEBUG UCPD_RX_ORDSET_RXORDSET_2 /*!< SOP'' Debug code detected in receiver */
  250. #define LL_UCPD_RXORDSET_CABLE_RESET (UCPD_RX_ORDSET_RXORDSET_2 | UCPD_RX_ORDSET_RXORDSET_0) /*!< Cable Reset code detected in receiver */
  251. #define LL_UCPD_RXORDSET_SOPEXT1 (UCPD_RX_ORDSET_RXORDSET_2 | UCPD_RX_ORDSET_RXORDSET_1) /*!< SOP extension#1 code detected in receiver */
  252. #define LL_UCPD_RXORDSET_SOPEXT2 (UCPD_RX_ORDSET_RXORDSET_2 | UCPD_RX_ORDSET_RXORDSET_1 | UCPD_RX_ORDSET_RXORDSET_0) /*!< SOP extension#2 code detected in receiver */
  253. /**
  254. * @}
  255. */
  256. /**
  257. * @}
  258. */
  259. /* Exported macro ------------------------------------------------------------*/
  260. /** @defgroup UCPD_LL_Exported_Macros UCPD Exported Macros
  261. * @{
  262. */
  263. /** @defgroup UCPD_LL_EM_WRITE_READ Common Write and read registers Macros
  264. * @{
  265. */
  266. /**
  267. * @brief Write a value in UCPD register
  268. * @param __INSTANCE__ UCPD Instance
  269. * @param __REG__ Register to be written
  270. * @param __VALUE__ Value to be written in the register
  271. * @retval None
  272. */
  273. #define LL_UCPD_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG((__INSTANCE__)->__REG__, (__VALUE__))
  274. /**
  275. * @brief Read a value in UCPD register
  276. * @param __INSTANCE__ UCPD Instance
  277. * @param __REG__ Register to be read
  278. * @retval Register value
  279. */
  280. #define LL_UCPD_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__)
  281. /**
  282. * @}
  283. */
  284. /**
  285. * @}
  286. */
  287. /* Exported functions --------------------------------------------------------*/
  288. /** @defgroup UCPD_LL_Exported_Functions UCPD Exported Functions
  289. * @{
  290. */
  291. /** @defgroup UCPD_LL_EF_Configuration Configuration
  292. * @{
  293. */
  294. /** @defgroup UCPD_LL_EF_CFG1 CFG1 register
  295. * @{
  296. */
  297. /**
  298. * @brief Enable UCPD peripheral
  299. * @rmtoll CFG1 UCPDEN LL_UCPD_Enable
  300. * @param UCPDx UCPD Instance
  301. * @retval None
  302. */
  303. __STATIC_INLINE void LL_UCPD_Enable(UCPD_TypeDef *UCPDx)
  304. {
  305. SET_BIT(UCPDx->CFG1, UCPD_CFG1_UCPDEN);
  306. }
  307. /**
  308. * @brief Disable UCPD peripheral
  309. * @note When disabling the UCPD, follow the procedure described in the Reference Manual.
  310. * @rmtoll CFG1 UCPDEN LL_UCPD_Disable
  311. * @param UCPDx UCPD Instance
  312. * @retval None
  313. */
  314. __STATIC_INLINE void LL_UCPD_Disable(UCPD_TypeDef *UCPDx)
  315. {
  316. CLEAR_BIT(UCPDx->CFG1, UCPD_CFG1_UCPDEN);
  317. }
  318. /**
  319. * @brief Check if UCPD peripheral is enabled
  320. * @rmtoll CFG1 UCPDEN LL_UCPD_IsEnabled
  321. * @param UCPDx UCPD Instance
  322. * @retval State of bit (1 or 0).
  323. */
  324. __STATIC_INLINE uint32_t LL_UCPD_IsEnabled(UCPD_TypeDef const *const UCPDx)
  325. {
  326. return ((READ_BIT(UCPDx->CFG1, UCPD_CFG1_UCPDEN) == (UCPD_CFG1_UCPDEN)) ? 1UL : 0UL);
  327. }
  328. /**
  329. * @brief Set the receiver ordered set detection enable
  330. * @rmtoll CFG1 RXORDSETEN LL_UCPD_SetRxOrderSet
  331. * @param UCPDx UCPD Instance
  332. * @param OrderSet This parameter can be combination of the following values:
  333. * @arg @ref LL_UCPD_ORDERSET_SOP
  334. * @arg @ref LL_UCPD_ORDERSET_SOP1
  335. * @arg @ref LL_UCPD_ORDERSET_SOP2
  336. * @arg @ref LL_UCPD_ORDERSET_HARDRST
  337. * @arg @ref LL_UCPD_ORDERSET_CABLERST
  338. * @arg @ref LL_UCPD_ORDERSET_SOP1_DEBUG
  339. * @arg @ref LL_UCPD_ORDERSET_SOP2_DEBUG
  340. * @arg @ref LL_UCPD_ORDERSET_SOP_EXT1
  341. * @arg @ref LL_UCPD_ORDERSET_SOP_EXT2
  342. * @retval None
  343. */
  344. __STATIC_INLINE void LL_UCPD_SetRxOrderSet(UCPD_TypeDef *UCPDx, uint32_t OrderSet)
  345. {
  346. MODIFY_REG(UCPDx->CFG1, UCPD_CFG1_RXORDSETEN, OrderSet);
  347. }
  348. /**
  349. * @brief Set the prescaler for ucpd clock
  350. * @rmtoll CFG1 UCPDCLK LL_UCPD_SetPSCClk
  351. * @param UCPDx UCPD Instance
  352. * @param Psc This parameter can be one of the following values:
  353. * @arg @ref LL_UCPD_PSC_DIV1
  354. * @arg @ref LL_UCPD_PSC_DIV2
  355. * @arg @ref LL_UCPD_PSC_DIV4
  356. * @arg @ref LL_UCPD_PSC_DIV8
  357. * @arg @ref LL_UCPD_PSC_DIV16
  358. * @retval None
  359. */
  360. __STATIC_INLINE void LL_UCPD_SetPSCClk(UCPD_TypeDef *UCPDx, uint32_t Psc)
  361. {
  362. MODIFY_REG(UCPDx->CFG1, UCPD_CFG1_PSC_UCPDCLK, Psc);
  363. }
  364. /**
  365. * @brief Set the number of cycles (minus 1) of the half bit clock
  366. * @rmtoll CFG1 TRANSWIN LL_UCPD_SetTransWin
  367. * @param UCPDx UCPD Instance
  368. * @param TransWin a value between Min_Data=0x1 and Max_Data=0x1F
  369. * @retval None
  370. */
  371. __STATIC_INLINE void LL_UCPD_SetTransWin(UCPD_TypeDef *UCPDx, uint32_t TransWin)
  372. {
  373. MODIFY_REG(UCPDx->CFG1, UCPD_CFG1_TRANSWIN, TransWin << UCPD_CFG1_TRANSWIN_Pos);
  374. }
  375. /**
  376. * @brief Set the clock divider value to generate an interframe gap
  377. * @rmtoll CFG1 IFRGAP LL_UCPD_SetIfrGap
  378. * @param UCPDx UCPD Instance
  379. * @param IfrGap a value between Min_Data=0x1 and Max_Data=0x1F
  380. * @retval None
  381. */
  382. __STATIC_INLINE void LL_UCPD_SetIfrGap(UCPD_TypeDef *UCPDx, uint32_t IfrGap)
  383. {
  384. MODIFY_REG(UCPDx->CFG1, UCPD_CFG1_IFRGAP, IfrGap << UCPD_CFG1_IFRGAP_Pos);
  385. }
  386. /**
  387. * @brief Set the clock divider value to generate an interframe gap
  388. * @rmtoll CFG1 HBITCLKDIV LL_UCPD_SetHbitClockDiv
  389. * @param UCPDx UCPD Instance
  390. * @param HbitClock a value between Min_Data=0x0 and Max_Data=0x3F
  391. * @retval None
  392. */
  393. __STATIC_INLINE void LL_UCPD_SetHbitClockDiv(UCPD_TypeDef *UCPDx, uint32_t HbitClock)
  394. {
  395. MODIFY_REG(UCPDx->CFG1, UCPD_CFG1_HBITCLKDIV, HbitClock << UCPD_CFG1_HBITCLKDIV_Pos);
  396. }
  397. /**
  398. * @}
  399. */
  400. /** @defgroup UCPD_LL_EF_CFG2 CFG2 register
  401. * @{
  402. */
  403. /**
  404. * @brief Enable the wakeup mode
  405. * @rmtoll CFG2 WUPEN LL_UCPD_WakeUpEnable
  406. * @param UCPDx UCPD Instance
  407. * @retval None
  408. */
  409. __STATIC_INLINE void LL_UCPD_WakeUpEnable(UCPD_TypeDef *UCPDx)
  410. {
  411. SET_BIT(UCPDx->CFG2, UCPD_CFG2_WUPEN);
  412. }
  413. /**
  414. * @brief Disable the wakeup mode
  415. * @rmtoll CFG2 WUPEN LL_UCPD_WakeUpDisable
  416. * @param UCPDx UCPD Instance
  417. * @retval None
  418. */
  419. __STATIC_INLINE void LL_UCPD_WakeUpDisable(UCPD_TypeDef *UCPDx)
  420. {
  421. CLEAR_BIT(UCPDx->CFG2, UCPD_CFG2_WUPEN);
  422. }
  423. /**
  424. * @brief Force clock enable
  425. * @rmtoll CFG2 FORCECLK LL_UCPD_ForceClockEnable
  426. * @param UCPDx UCPD Instance
  427. * @retval None
  428. */
  429. __STATIC_INLINE void LL_UCPD_ForceClockEnable(UCPD_TypeDef *UCPDx)
  430. {
  431. SET_BIT(UCPDx->CFG2, UCPD_CFG2_FORCECLK);
  432. }
  433. /**
  434. * @brief Force clock disable
  435. * @rmtoll CFG2 FORCECLK LL_UCPD_ForceClockDisable
  436. * @param UCPDx UCPD Instance
  437. * @retval None
  438. */
  439. __STATIC_INLINE void LL_UCPD_ForceClockDisable(UCPD_TypeDef *UCPDx)
  440. {
  441. CLEAR_BIT(UCPDx->CFG2, UCPD_CFG2_FORCECLK);
  442. }
  443. /**
  444. * @brief RxFilter enable
  445. * @rmtoll CFG2 RXFILTDIS LL_UCPD_RxFilterEnable
  446. * @param UCPDx UCPD Instance
  447. * @retval None
  448. */
  449. __STATIC_INLINE void LL_UCPD_RxFilterEnable(UCPD_TypeDef *UCPDx)
  450. {
  451. CLEAR_BIT(UCPDx->CFG2, UCPD_CFG2_RXFILTDIS);
  452. }
  453. /**
  454. * @brief RxFilter disable
  455. * @rmtoll CFG2 RXFILTDIS LL_UCPD_RxFilterDisable
  456. * @param UCPDx UCPD Instance
  457. * @retval None
  458. */
  459. __STATIC_INLINE void LL_UCPD_RxFilterDisable(UCPD_TypeDef *UCPDx)
  460. {
  461. SET_BIT(UCPDx->CFG2, UCPD_CFG2_RXFILTDIS);
  462. }
  463. /**
  464. * @}
  465. */
  466. /**
  467. * @}
  468. */
  469. /** @defgroup UCPD_LL_EF_CR CR register
  470. * @{
  471. */
  472. /**
  473. * @brief Type C detector for CC2 enable
  474. * @rmtoll CR CC2TCDIS LL_UCPD_TypeCDetectionCC2Enable
  475. * @param UCPDx UCPD Instance
  476. * @retval None
  477. */
  478. __STATIC_INLINE void LL_UCPD_TypeCDetectionCC2Enable(UCPD_TypeDef *UCPDx)
  479. {
  480. CLEAR_BIT(UCPDx->CR, UCPD_CR_CC2TCDIS);
  481. }
  482. /**
  483. * @brief Type C detector for CC2 disable
  484. * @rmtoll CR CC2TCDIS LL_UCPD_TypeCDetectionCC2Disable
  485. * @param UCPDx UCPD Instance
  486. * @retval None
  487. */
  488. __STATIC_INLINE void LL_UCPD_TypeCDetectionCC2Disable(UCPD_TypeDef *UCPDx)
  489. {
  490. SET_BIT(UCPDx->CR, UCPD_CR_CC2TCDIS);
  491. }
  492. /**
  493. * @brief Type C detector for CC1 enable
  494. * @rmtoll CR CC1TCDIS LL_UCPD_TypeCDetectionCC1Enable
  495. * @param UCPDx UCPD Instance
  496. * @retval None
  497. */
  498. __STATIC_INLINE void LL_UCPD_TypeCDetectionCC1Enable(UCPD_TypeDef *UCPDx)
  499. {
  500. CLEAR_BIT(UCPDx->CR, UCPD_CR_CC1TCDIS);
  501. }
  502. /**
  503. * @brief Type C detector for CC1 disable
  504. * @rmtoll CR CC1TCDIS LL_UCPD_TypeCDetectionCC1Disable
  505. * @param UCPDx UCPD Instance
  506. * @retval None
  507. */
  508. __STATIC_INLINE void LL_UCPD_TypeCDetectionCC1Disable(UCPD_TypeDef *UCPDx)
  509. {
  510. SET_BIT(UCPDx->CR, UCPD_CR_CC1TCDIS);
  511. }
  512. /**
  513. * @brief Source Vconn discharge enable
  514. * @rmtoll CR RDCH LL_UCPD_VconnDischargeEnable
  515. * @param UCPDx UCPD Instance
  516. * @retval None
  517. */
  518. __STATIC_INLINE void LL_UCPD_VconnDischargeEnable(UCPD_TypeDef *UCPDx)
  519. {
  520. SET_BIT(UCPDx->CR, UCPD_CR_RDCH);
  521. }
  522. /**
  523. * @brief Source Vconn discharge disable
  524. * @rmtoll CR RDCH LL_UCPD_VconnDischargeDisable
  525. * @param UCPDx UCPD Instance
  526. * @retval None
  527. */
  528. __STATIC_INLINE void LL_UCPD_VconnDischargeDisable(UCPD_TypeDef *UCPDx)
  529. {
  530. CLEAR_BIT(UCPDx->CR, UCPD_CR_RDCH);
  531. }
  532. /**
  533. * @brief Signal Fast Role Swap request
  534. * @rmtoll CR FRSTX LL_UCPD_VconnDischargeDisable
  535. * @param UCPDx UCPD Instance
  536. * @retval None
  537. */
  538. __STATIC_INLINE void LL_UCPD_SignalFRSTX(UCPD_TypeDef *UCPDx)
  539. {
  540. SET_BIT(UCPDx->CR, UCPD_CR_FRSTX);
  541. }
  542. /**
  543. * @brief Fast Role swap RX detection enable
  544. * @rmtoll CR FRSRXEN LL_UCPD_FRSDetectionEnable
  545. * @param UCPDx UCPD Instance
  546. * @retval None
  547. */
  548. __STATIC_INLINE void LL_UCPD_FRSDetectionEnable(UCPD_TypeDef *UCPDx)
  549. {
  550. SET_BIT(UCPDx->CR, UCPD_CR_FRSRXEN);
  551. }
  552. /**
  553. * @brief Fast Role swap RX detection disable
  554. * @rmtoll CR FRSRXEN LL_UCPD_FRSDetectionDisable
  555. * @param UCPDx UCPD Instance
  556. * @retval None
  557. */
  558. __STATIC_INLINE void LL_UCPD_FRSDetectionDisable(UCPD_TypeDef *UCPDx)
  559. {
  560. CLEAR_BIT(UCPDx->CR, UCPD_CR_FRSRXEN);
  561. }
  562. /**
  563. * @brief Set cc enable
  564. * @rmtoll CR CC1VCONNEN LL_UCPD_SetccEnable
  565. * @param UCPDx UCPD Instance
  566. * @param CCEnable This parameter can be one of the following values:
  567. * @arg @ref LL_UCPD_CCENABLE_NONE
  568. * @arg @ref LL_UCPD_CCENABLE_CC1
  569. * @arg @ref LL_UCPD_CCENABLE_CC2
  570. * @arg @ref LL_UCPD_CCENABLE_CC1CC2
  571. * @retval None
  572. */
  573. __STATIC_INLINE void LL_UCPD_SetccEnable(UCPD_TypeDef *UCPDx, uint32_t CCEnable)
  574. {
  575. MODIFY_REG(UCPDx->CR, UCPD_CR_CCENABLE, CCEnable);
  576. }
  577. /**
  578. * @brief Set UCPD SNK role
  579. * @rmtoll CR ANAMODE LL_UCPD_SetSNKRole
  580. * @param UCPDx UCPD Instance
  581. * @retval None
  582. */
  583. __STATIC_INLINE void LL_UCPD_SetSNKRole(UCPD_TypeDef *UCPDx)
  584. {
  585. SET_BIT(UCPDx->CR, UCPD_CR_ANAMODE);
  586. }
  587. /**
  588. * @brief Set UCPD SRC role
  589. * @rmtoll CR ANAMODE LL_UCPD_SetSRCRole
  590. * @param UCPDx UCPD Instance
  591. * @retval None
  592. */
  593. __STATIC_INLINE void LL_UCPD_SetSRCRole(UCPD_TypeDef *UCPDx)
  594. {
  595. CLEAR_BIT(UCPDx->CR, UCPD_CR_ANAMODE);
  596. }
  597. /**
  598. * @brief Get UCPD Role
  599. * @rmtoll CR ANAMODE LL_UCPD_GetRole
  600. * @param UCPDx UCPD Instance
  601. * @retval Returned value can be one of the following values:
  602. * @arg @ref LL_UCPD_ROLE_SNK
  603. * @arg @ref LL_UCPD_ROLE_SRC
  604. */
  605. __STATIC_INLINE uint32_t LL_UCPD_GetRole(UCPD_TypeDef const *const UCPDx)
  606. {
  607. return (uint32_t)(READ_BIT(UCPDx->CR, UCPD_CR_ANAMODE));
  608. }
  609. /**
  610. * @brief Set Rp resistor
  611. * @rmtoll CR ANASUBMODE LL_UCPD_SetRpResistor
  612. * @param UCPDx UCPD Instance
  613. * @param Resistor This parameter can be one of the following values:
  614. * @arg @ref LL_UCPD_RESISTOR_DEFAULT
  615. * @arg @ref LL_UCPD_RESISTOR_1_5A
  616. * @arg @ref LL_UCPD_RESISTOR_3_0A
  617. * @arg @ref LL_UCPD_RESISTOR_NONE
  618. * @retval None
  619. */
  620. __STATIC_INLINE void LL_UCPD_SetRpResistor(UCPD_TypeDef *UCPDx, uint32_t Resistor)
  621. {
  622. MODIFY_REG(UCPDx->CR, UCPD_CR_ANASUBMODE, Resistor);
  623. }
  624. /**
  625. * @brief Set CC pin
  626. * @rmtoll CR PHYCCSEL LL_UCPD_SetCCPin
  627. * @param UCPDx UCPD Instance
  628. * @param CCPin This parameter can be one of the following values:
  629. * @arg @ref LL_UCPD_CCPIN_CC1
  630. * @arg @ref LL_UCPD_CCPIN_CC2
  631. * @retval None
  632. */
  633. __STATIC_INLINE void LL_UCPD_SetCCPin(UCPD_TypeDef *UCPDx, uint32_t CCPin)
  634. {
  635. MODIFY_REG(UCPDx->CR, UCPD_CR_PHYCCSEL, CCPin);
  636. }
  637. /**
  638. * @brief Rx enable
  639. * @rmtoll CR PHYRXEN LL_UCPD_RxEnable
  640. * @param UCPDx UCPD Instance
  641. * @retval None
  642. */
  643. __STATIC_INLINE void LL_UCPD_RxEnable(UCPD_TypeDef *UCPDx)
  644. {
  645. SET_BIT(UCPDx->CR, UCPD_CR_PHYRXEN);
  646. }
  647. /**
  648. * @brief Rx disable
  649. * @rmtoll CR PHYRXEN LL_UCPD_RxDisable
  650. * @param UCPDx UCPD Instance
  651. * @retval None
  652. */
  653. __STATIC_INLINE void LL_UCPD_RxDisable(UCPD_TypeDef *UCPDx)
  654. {
  655. CLEAR_BIT(UCPDx->CR, UCPD_CR_PHYRXEN);
  656. }
  657. /**
  658. * @brief Set Rx mode
  659. * @rmtoll CR RXMODE LL_UCPD_SetRxMode
  660. * @param UCPDx UCPD Instance
  661. * @param RxMode This parameter can be one of the following values:
  662. * @arg @ref LL_UCPD_RXMODE_NORMAL
  663. * @arg @ref LL_UCPD_RXMODE_BIST_TEST_DATA
  664. * @retval None
  665. */
  666. __STATIC_INLINE void LL_UCPD_SetRxMode(UCPD_TypeDef *UCPDx, uint32_t RxMode)
  667. {
  668. MODIFY_REG(UCPDx->CR, UCPD_CR_RXMODE, RxMode);
  669. }
  670. /**
  671. * @brief Send Hard Reset
  672. * @rmtoll CR TXHRST LL_UCPD_SendHardReset
  673. * @param UCPDx UCPD Instance
  674. * @retval None
  675. */
  676. __STATIC_INLINE void LL_UCPD_SendHardReset(UCPD_TypeDef *UCPDx)
  677. {
  678. SET_BIT(UCPDx->CR, UCPD_CR_TXHRST);
  679. }
  680. /**
  681. * @brief Send message
  682. * @rmtoll CR TXSEND LL_UCPD_SendMessage
  683. * @param UCPDx UCPD Instance
  684. * @retval None
  685. */
  686. __STATIC_INLINE void LL_UCPD_SendMessage(UCPD_TypeDef *UCPDx)
  687. {
  688. SET_BIT(UCPDx->CR, UCPD_CR_TXSEND);
  689. }
  690. /**
  691. * @brief Set Tx mode
  692. * @rmtoll CR TXMODE LL_UCPD_SetTxMode
  693. * @param UCPDx UCPD Instance
  694. * @param TxMode This parameter can be one of the following values:
  695. * @arg @ref LL_UCPD_TXMODE_NORMAL
  696. * @arg @ref LL_UCPD_TXMODE_CABLE_RESET
  697. * @arg @ref LL_UCPD_TXMODE_BIST_CARRIER2
  698. * @retval None
  699. */
  700. __STATIC_INLINE void LL_UCPD_SetTxMode(UCPD_TypeDef *UCPDx, uint32_t TxMode)
  701. {
  702. MODIFY_REG(UCPDx->CR, UCPD_CR_TXMODE, TxMode);
  703. }
  704. /**
  705. * @}
  706. */
  707. /** @defgroup UCPD_LL_EF_IT_Management Interrupt Management
  708. * @{
  709. */
  710. /**
  711. * @brief Enable FRS interrupt
  712. * @rmtoll IMR FRSEVTIE LL_UCPD_EnableIT_FRS
  713. * @param UCPDx UCPD Instance
  714. * @retval None
  715. */
  716. __STATIC_INLINE void LL_UCPD_EnableIT_FRS(UCPD_TypeDef *UCPDx)
  717. {
  718. SET_BIT(UCPDx->IMR, UCPD_IMR_FRSEVTIE);
  719. }
  720. /**
  721. * @brief Enable type c event on CC2
  722. * @rmtoll IMR TYPECEVT2IE LL_UCPD_EnableIT_TypeCEventCC2
  723. * @param UCPDx UCPD Instance
  724. * @retval None
  725. */
  726. __STATIC_INLINE void LL_UCPD_EnableIT_TypeCEventCC2(UCPD_TypeDef *UCPDx)
  727. {
  728. SET_BIT(UCPDx->IMR, UCPD_IMR_TYPECEVT2IE);
  729. }
  730. /**
  731. * @brief Enable type c event on CC1
  732. * @rmtoll IMR TYPECEVT1IE LL_UCPD_EnableIT_TypeCEventCC1
  733. * @param UCPDx UCPD Instance
  734. * @retval None
  735. */
  736. __STATIC_INLINE void LL_UCPD_EnableIT_TypeCEventCC1(UCPD_TypeDef *UCPDx)
  737. {
  738. SET_BIT(UCPDx->IMR, UCPD_IMR_TYPECEVT1IE);
  739. }
  740. /**
  741. * @brief Enable Rx message end interrupt
  742. * @rmtoll IMR RXMSGENDIE LL_UCPD_EnableIT_RxMsgEnd
  743. * @param UCPDx UCPD Instance
  744. * @retval None
  745. */
  746. __STATIC_INLINE void LL_UCPD_EnableIT_RxMsgEnd(UCPD_TypeDef *UCPDx)
  747. {
  748. SET_BIT(UCPDx->IMR, UCPD_IMR_RXMSGENDIE);
  749. }
  750. /**
  751. * @brief Enable Rx overrun interrupt
  752. * @rmtoll IMR RXOVRIE LL_UCPD_EnableIT_RxOvr
  753. * @param UCPDx UCPD Instance
  754. * @retval None
  755. */
  756. __STATIC_INLINE void LL_UCPD_EnableIT_RxOvr(UCPD_TypeDef *UCPDx)
  757. {
  758. SET_BIT(UCPDx->IMR, UCPD_IMR_RXOVRIE);
  759. }
  760. /**
  761. * @brief Enable Rx hard resrt interrupt
  762. * @rmtoll IMR RXHRSTDETIE LL_UCPD_EnableIT_RxHRST
  763. * @param UCPDx UCPD Instance
  764. * @retval None
  765. */
  766. __STATIC_INLINE void LL_UCPD_EnableIT_RxHRST(UCPD_TypeDef *UCPDx)
  767. {
  768. SET_BIT(UCPDx->IMR, UCPD_IMR_RXHRSTDETIE);
  769. }
  770. /**
  771. * @brief Enable Rx orderset interrupt
  772. * @rmtoll IMR RXORDDETIE LL_UCPD_EnableIT_RxOrderSet
  773. * @param UCPDx UCPD Instance
  774. * @retval None
  775. */
  776. __STATIC_INLINE void LL_UCPD_EnableIT_RxOrderSet(UCPD_TypeDef *UCPDx)
  777. {
  778. SET_BIT(UCPDx->IMR, UCPD_IMR_RXORDDETIE);
  779. }
  780. /**
  781. * @brief Enable Rx non empty interrupt
  782. * @rmtoll IMR RXNEIE LL_UCPD_EnableIT_RxNE
  783. * @param UCPDx UCPD Instance
  784. * @retval None
  785. */
  786. __STATIC_INLINE void LL_UCPD_EnableIT_RxNE(UCPD_TypeDef *UCPDx)
  787. {
  788. SET_BIT(UCPDx->IMR, UCPD_IMR_RXNEIE);
  789. }
  790. /**
  791. * @brief Enable TX underrun interrupt
  792. * @rmtoll IMR TXUNDIE LL_UCPD_EnableIT_TxUND
  793. * @param UCPDx UCPD Instance
  794. * @retval None
  795. */
  796. __STATIC_INLINE void LL_UCPD_EnableIT_TxUND(UCPD_TypeDef *UCPDx)
  797. {
  798. SET_BIT(UCPDx->IMR, UCPD_IMR_TXUNDIE);
  799. }
  800. /**
  801. * @brief Enable hard reset sent interrupt
  802. * @rmtoll IMR HRSTSENTIE LL_UCPD_EnableIT_TxHRSTSENT
  803. * @param UCPDx UCPD Instance
  804. * @retval None
  805. */
  806. __STATIC_INLINE void LL_UCPD_EnableIT_TxHRSTSENT(UCPD_TypeDef *UCPDx)
  807. {
  808. SET_BIT(UCPDx->IMR, UCPD_IMR_HRSTSENTIE);
  809. }
  810. /**
  811. * @brief Enable hard reset discard interrupt
  812. * @rmtoll IMR HRSTDISCIE LL_UCPD_EnableIT_TxHRSTDISC
  813. * @param UCPDx UCPD Instance
  814. * @retval None
  815. */
  816. __STATIC_INLINE void LL_UCPD_EnableIT_TxHRSTDISC(UCPD_TypeDef *UCPDx)
  817. {
  818. SET_BIT(UCPDx->IMR, UCPD_IMR_HRSTDISCIE);
  819. }
  820. /**
  821. * @brief Enable Tx message abort interrupt
  822. * @rmtoll IMR TXMSGABTIE LL_UCPD_EnableIT_TxMSGABT
  823. * @param UCPDx UCPD Instance
  824. * @retval None
  825. */
  826. __STATIC_INLINE void LL_UCPD_EnableIT_TxMSGABT(UCPD_TypeDef *UCPDx)
  827. {
  828. SET_BIT(UCPDx->IMR, UCPD_IMR_TXMSGABTIE);
  829. }
  830. /**
  831. * @brief Enable Tx message sent interrupt
  832. * @rmtoll IMR TXMSGSENTIE LL_UCPD_EnableIT_TxMSGSENT
  833. * @param UCPDx UCPD Instance
  834. * @retval None
  835. */
  836. __STATIC_INLINE void LL_UCPD_EnableIT_TxMSGSENT(UCPD_TypeDef *UCPDx)
  837. {
  838. SET_BIT(UCPDx->IMR, UCPD_IMR_TXMSGSENTIE);
  839. }
  840. /**
  841. * @brief Enable Tx message discarded interrupt
  842. * @rmtoll IMR TXMSGDISCIE LL_UCPD_EnableIT_TxMSGDISC
  843. * @param UCPDx UCPD Instance
  844. * @retval None
  845. */
  846. __STATIC_INLINE void LL_UCPD_EnableIT_TxMSGDISC(UCPD_TypeDef *UCPDx)
  847. {
  848. SET_BIT(UCPDx->IMR, UCPD_IMR_TXMSGDISCIE);
  849. }
  850. /**
  851. * @brief Enable Tx data receive interrupt
  852. * @rmtoll IMR TXISIE LL_UCPD_EnableIT_TxIS
  853. * @param UCPDx UCPD Instance
  854. * @retval None
  855. */
  856. __STATIC_INLINE void LL_UCPD_EnableIT_TxIS(UCPD_TypeDef *UCPDx)
  857. {
  858. SET_BIT(UCPDx->IMR, UCPD_IMR_TXISIE);
  859. }
  860. /**
  861. * @brief Disable FRS interrupt
  862. * @rmtoll IMR FRSEVTIE LL_UCPD_DisableIT_FRS
  863. * @param UCPDx UCPD Instance
  864. * @retval None
  865. */
  866. __STATIC_INLINE void LL_UCPD_DisableIT_FRS(UCPD_TypeDef *UCPDx)
  867. {
  868. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_FRSEVTIE);
  869. }
  870. /**
  871. * @brief Disable type c event on CC2
  872. * @rmtoll IMR TYPECEVT2IE LL_UCPD_DisableIT_TypeCEventCC2
  873. * @param UCPDx UCPD Instance
  874. * @retval None
  875. */
  876. __STATIC_INLINE void LL_UCPD_DisableIT_TypeCEventCC2(UCPD_TypeDef *UCPDx)
  877. {
  878. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_TYPECEVT2IE);
  879. }
  880. /**
  881. * @brief Disable type c event on CC1
  882. * @rmtoll IMR TYPECEVT1IE LL_UCPD_DisableIT_TypeCEventCC1
  883. * @param UCPDx UCPD Instance
  884. * @retval None
  885. */
  886. __STATIC_INLINE void LL_UCPD_DisableIT_TypeCEventCC1(UCPD_TypeDef *UCPDx)
  887. {
  888. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_TYPECEVT1IE);
  889. }
  890. /**
  891. * @brief Disable Rx message end interrupt
  892. * @rmtoll IMR RXMSGENDIE LL_UCPD_DisableIT_RxMsgEnd
  893. * @param UCPDx UCPD Instance
  894. * @retval None
  895. */
  896. __STATIC_INLINE void LL_UCPD_DisableIT_RxMsgEnd(UCPD_TypeDef *UCPDx)
  897. {
  898. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_RXMSGENDIE);
  899. }
  900. /**
  901. * @brief Disable Rx overrun interrupt
  902. * @rmtoll IMR RXOVRIE LL_UCPD_DisableIT_RxOvr
  903. * @param UCPDx UCPD Instance
  904. * @retval None
  905. */
  906. __STATIC_INLINE void LL_UCPD_DisableIT_RxOvr(UCPD_TypeDef *UCPDx)
  907. {
  908. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_RXOVRIE);
  909. }
  910. /**
  911. * @brief Disable Rx hard resrt interrupt
  912. * @rmtoll IMR RXHRSTDETIE LL_UCPD_DisableIT_RxHRST
  913. * @param UCPDx UCPD Instance
  914. * @retval None
  915. */
  916. __STATIC_INLINE void LL_UCPD_DisableIT_RxHRST(UCPD_TypeDef *UCPDx)
  917. {
  918. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_RXHRSTDETIE);
  919. }
  920. /**
  921. * @brief Disable Rx orderset interrupt
  922. * @rmtoll IMR RXORDDETIE LL_UCPD_DisableIT_RxOrderSet
  923. * @param UCPDx UCPD Instance
  924. * @retval None
  925. */
  926. __STATIC_INLINE void LL_UCPD_DisableIT_RxOrderSet(UCPD_TypeDef *UCPDx)
  927. {
  928. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_RXORDDETIE);
  929. }
  930. /**
  931. * @brief Disable Rx non empty interrupt
  932. * @rmtoll IMR RXNEIE LL_UCPD_DisableIT_RxNE
  933. * @param UCPDx UCPD Instance
  934. * @retval None
  935. */
  936. __STATIC_INLINE void LL_UCPD_DisableIT_RxNE(UCPD_TypeDef *UCPDx)
  937. {
  938. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_RXNEIE);
  939. }
  940. /**
  941. * @brief Disable TX underrun interrupt
  942. * @rmtoll IMR TXUNDIE LL_UCPD_DisableIT_TxUND
  943. * @param UCPDx UCPD Instance
  944. * @retval None
  945. */
  946. __STATIC_INLINE void LL_UCPD_DisableIT_TxUND(UCPD_TypeDef *UCPDx)
  947. {
  948. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_TXUNDIE);
  949. }
  950. /**
  951. * @brief Disable hard reset sent interrupt
  952. * @rmtoll IMR HRSTSENTIE LL_UCPD_DisableIT_TxHRSTSENT
  953. * @param UCPDx UCPD Instance
  954. * @retval None
  955. */
  956. __STATIC_INLINE void LL_UCPD_DisableIT_TxHRSTSENT(UCPD_TypeDef *UCPDx)
  957. {
  958. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_HRSTSENTIE);
  959. }
  960. /**
  961. * @brief Disable hard reset discard interrupt
  962. * @rmtoll IMR HRSTDISCIE LL_UCPD_DisableIT_TxHRSTDISC
  963. * @param UCPDx UCPD Instance
  964. * @retval None
  965. */
  966. __STATIC_INLINE void LL_UCPD_DisableIT_TxHRSTDISC(UCPD_TypeDef *UCPDx)
  967. {
  968. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_HRSTDISCIE);
  969. }
  970. /**
  971. * @brief Disable Tx message abort interrupt
  972. * @rmtoll IMR TXMSGABTIE LL_UCPD_DisableIT_TxMSGABT
  973. * @param UCPDx UCPD Instance
  974. * @retval None
  975. */
  976. __STATIC_INLINE void LL_UCPD_DisableIT_TxMSGABT(UCPD_TypeDef *UCPDx)
  977. {
  978. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_TXMSGABTIE);
  979. }
  980. /**
  981. * @brief Disable Tx message sent interrupt
  982. * @rmtoll IMR TXMSGSENTIE LL_UCPD_DisableIT_TxMSGSENT
  983. * @param UCPDx UCPD Instance
  984. * @retval None
  985. */
  986. __STATIC_INLINE void LL_UCPD_DisableIT_TxMSGSENT(UCPD_TypeDef *UCPDx)
  987. {
  988. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_TXMSGSENTIE);
  989. }
  990. /**
  991. * @brief Disable Tx message discarded interrupt
  992. * @rmtoll IMR TXMSGDISCIE LL_UCPD_DisableIT_TxMSGDISC
  993. * @param UCPDx UCPD Instance
  994. * @retval None
  995. */
  996. __STATIC_INLINE void LL_UCPD_DisableIT_TxMSGDISC(UCPD_TypeDef *UCPDx)
  997. {
  998. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_TXMSGDISCIE);
  999. }
  1000. /**
  1001. * @brief Disable Tx data receive interrupt
  1002. * @rmtoll IMR TXISIE LL_UCPD_DisableIT_TxIS
  1003. * @param UCPDx UCPD Instance
  1004. * @retval None
  1005. */
  1006. __STATIC_INLINE void LL_UCPD_DisableIT_TxIS(UCPD_TypeDef *UCPDx)
  1007. {
  1008. CLEAR_BIT(UCPDx->IMR, UCPD_IMR_TXISIE);
  1009. }
  1010. /**
  1011. * @brief Check if FRS interrupt enabled
  1012. * @rmtoll IMR FRSEVTIE LL_UCPD_DisableIT_FRS
  1013. * @param UCPDx UCPD Instance
  1014. * @retval State of bit (1 or 0).
  1015. */
  1016. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_FRS(UCPD_TypeDef const *const UCPDx)
  1017. {
  1018. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_FRSEVTIE) == UCPD_IMR_FRSEVTIE) ? 1UL : 0UL);
  1019. }
  1020. /**
  1021. * @brief Check if type c event on CC2 enabled
  1022. * @rmtoll IMR TYPECEVT2IE LL_UCPD_DisableIT_TypeCEventCC2
  1023. * @param UCPDx UCPD Instance
  1024. * @retval State of bit (1 or 0).
  1025. */
  1026. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_TypeCEventCC2(UCPD_TypeDef const *const UCPDx)
  1027. {
  1028. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_TYPECEVT2IE) == UCPD_IMR_TYPECEVT2IE) ? 1UL : 0UL);
  1029. }
  1030. /**
  1031. * @brief Check if type c event on CC1 enabled
  1032. * @rmtoll IMR2 TYPECEVT1IE LL_UCPD_IsEnableIT_TypeCEventCC1
  1033. * @param UCPDx UCPD Instance
  1034. * @retval State of bit (1 or 0).
  1035. */
  1036. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_TypeCEventCC1(UCPD_TypeDef const *const UCPDx)
  1037. {
  1038. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_TYPECEVT1IE) == UCPD_IMR_TYPECEVT1IE) ? 1UL : 0UL);
  1039. }
  1040. /**
  1041. * @brief Check if Rx message end interrupt enabled
  1042. * @rmtoll IMR RXMSGENDIE LL_UCPD_IsEnableIT_RxMsgEnd
  1043. * @param UCPDx UCPD Instance
  1044. * @retval State of bit (1 or 0).
  1045. */
  1046. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_RxMsgEnd(UCPD_TypeDef const *const UCPDx)
  1047. {
  1048. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_RXMSGENDIE) == UCPD_IMR_RXMSGENDIE) ? 1UL : 0UL);
  1049. }
  1050. /**
  1051. * @brief Check if Rx overrun interrupt enabled
  1052. * @rmtoll IMR RXOVRIE LL_UCPD_IsEnableIT_RxOvr
  1053. * @param UCPDx UCPD Instance
  1054. * @retval State of bit (1 or 0).
  1055. */
  1056. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_RxOvr(UCPD_TypeDef const *const UCPDx)
  1057. {
  1058. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_RXOVRIE) == UCPD_IMR_RXOVRIE) ? 1UL : 0UL);
  1059. }
  1060. /**
  1061. * @brief Check if Rx hard resrt interrupt enabled
  1062. * @rmtoll IMR RXHRSTDETIE LL_UCPD_IsEnableIT_RxHRST
  1063. * @param UCPDx UCPD Instance
  1064. * @retval State of bit (1 or 0).
  1065. */
  1066. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_RxHRST(UCPD_TypeDef const *const UCPDx)
  1067. {
  1068. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_RXHRSTDETIE) == UCPD_IMR_RXHRSTDETIE) ? 1UL : 0UL);
  1069. }
  1070. /**
  1071. * @brief Check if Rx orderset interrupt enabled
  1072. * @rmtoll IMR RXORDDETIE LL_UCPD_IsEnableIT_RxOrderSet
  1073. * @param UCPDx UCPD Instance
  1074. * @retval State of bit (1 or 0).
  1075. */
  1076. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_RxOrderSet(UCPD_TypeDef const *const UCPDx)
  1077. {
  1078. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_RXORDDETIE) == UCPD_IMR_RXORDDETIE) ? 1UL : 0UL);
  1079. }
  1080. /**
  1081. * @brief Check if Rx non empty interrupt enabled
  1082. * @rmtoll IMR RXNEIE LL_UCPD_IsEnableIT_RxNE
  1083. * @param UCPDx UCPD Instance
  1084. * @retval State of bit (1 or 0).
  1085. */
  1086. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_RxNE(UCPD_TypeDef const *const UCPDx)
  1087. {
  1088. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_RXNEIE) == UCPD_IMR_RXNEIE) ? 1UL : 0UL);
  1089. }
  1090. /**
  1091. * @brief Check if TX underrun interrupt enabled
  1092. * @rmtoll IMR TXUNDIE LL_UCPD_IsEnableIT_TxUND
  1093. * @param UCPDx UCPD Instance
  1094. * @retval State of bit (1 or 0).
  1095. */
  1096. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_TxUND(UCPD_TypeDef const *const UCPDx)
  1097. {
  1098. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_TXUNDIE) == UCPD_IMR_TXUNDIE) ? 1UL : 0UL);
  1099. }
  1100. /**
  1101. * @brief Check if hard reset sent interrupt enabled
  1102. * @rmtoll IMR HRSTSENTIE LL_UCPD_IsEnableIT_TxHRSTSENT
  1103. * @param UCPDx UCPD Instance
  1104. * @retval State of bit (1 or 0).
  1105. */
  1106. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_TxHRSTSENT(UCPD_TypeDef const *const UCPDx)
  1107. {
  1108. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_HRSTSENTIE) == UCPD_IMR_HRSTSENTIE) ? 1UL : 0UL);
  1109. }
  1110. /**
  1111. * @brief Check if hard reset discard interrupt enabled
  1112. * @rmtoll IMR HRSTDISCIE LL_UCPD_IsEnableIT_TxHRSTDISC
  1113. * @param UCPDx UCPD Instance
  1114. * @retval State of bit (1 or 0).
  1115. */
  1116. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_TxHRSTDISC(UCPD_TypeDef const *const UCPDx)
  1117. {
  1118. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_HRSTDISCIE) == UCPD_IMR_HRSTDISCIE) ? 1UL : 0UL);
  1119. }
  1120. /**
  1121. * @brief Check if Tx message abort interrupt enabled
  1122. * @rmtoll IMR TXMSGABTIE LL_UCPD_IsEnableIT_TxMSGABT
  1123. * @param UCPDx UCPD Instance
  1124. * @retval State of bit (1 or 0).
  1125. */
  1126. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_TxMSGABT(UCPD_TypeDef const *const UCPDx)
  1127. {
  1128. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_TXMSGABTIE) == UCPD_IMR_TXMSGABTIE) ? 1UL : 0UL);
  1129. }
  1130. /**
  1131. * @brief Check if Tx message sent interrupt enabled
  1132. * @rmtoll IMR TXMSGSENTIE LL_UCPD_IsEnableIT_TxMSGSENT
  1133. * @param UCPDx UCPD Instance
  1134. * @retval State of bit (1 or 0).
  1135. */
  1136. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_TxMSGSENT(UCPD_TypeDef const *const UCPDx)
  1137. {
  1138. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_TXMSGSENTIE) == UCPD_IMR_TXMSGSENTIE) ? 1UL : 0UL);
  1139. }
  1140. /**
  1141. * @brief Check if Tx message discarded interrupt enabled
  1142. * @rmtoll IMR TXMSGDISCIE LL_UCPD_IsEnableIT_TxMSGDISC
  1143. * @param UCPDx UCPD Instance
  1144. * @retval State of bit (1 or 0).
  1145. */
  1146. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_TxMSGDISC(UCPD_TypeDef const *const UCPDx)
  1147. {
  1148. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_TXMSGDISCIE) == UCPD_IMR_TXMSGDISCIE) ? 1UL : 0UL);
  1149. }
  1150. /**
  1151. * @brief Check if Tx data receive interrupt enabled
  1152. * @rmtoll IMR TXISIE LL_UCPD_IsEnableIT_TxIS
  1153. * @param UCPDx UCPD Instance
  1154. * @retval State of bit (1 or 0).
  1155. */
  1156. __STATIC_INLINE uint32_t LL_UCPD_IsEnableIT_TxIS(UCPD_TypeDef const *const UCPDx)
  1157. {
  1158. return ((READ_BIT(UCPDx->IMR, UCPD_IMR_TXISIE) == UCPD_IMR_TXISIE) ? 1UL : 0UL);
  1159. }
  1160. /**
  1161. * @}
  1162. */
  1163. /** @defgroup UCPD_LL_EF_IT_Clear Interrupt Clear
  1164. * @{
  1165. */
  1166. /**
  1167. * @brief Clear FRS interrupt
  1168. * @rmtoll ICR FRSEVTIE LL_UCPD_ClearFlag_FRS
  1169. * @param UCPDx UCPD Instance
  1170. * @retval None
  1171. */
  1172. __STATIC_INLINE void LL_UCPD_ClearFlag_FRS(UCPD_TypeDef *UCPDx)
  1173. {
  1174. SET_BIT(UCPDx->ICR, UCPD_ICR_FRSEVTCF);
  1175. }
  1176. /**
  1177. * @brief Clear type c event on CC2
  1178. * @rmtoll IIMR TYPECEVT2IE LL_UCPD_ClearFlag_TypeCEventCC2
  1179. * @param UCPDx UCPD Instance
  1180. * @retval None
  1181. */
  1182. __STATIC_INLINE void LL_UCPD_ClearFlag_TypeCEventCC2(UCPD_TypeDef *UCPDx)
  1183. {
  1184. SET_BIT(UCPDx->ICR, UCPD_ICR_TYPECEVT2CF);
  1185. }
  1186. /**
  1187. * @brief Clear type c event on CC1
  1188. * @rmtoll IIMR TYPECEVT1IE LL_UCPD_ClearFlag_TypeCEventCC1
  1189. * @param UCPDx UCPD Instance
  1190. * @retval None
  1191. */
  1192. __STATIC_INLINE void LL_UCPD_ClearFlag_TypeCEventCC1(UCPD_TypeDef *UCPDx)
  1193. {
  1194. SET_BIT(UCPDx->ICR, UCPD_ICR_TYPECEVT1CF);
  1195. }
  1196. /**
  1197. * @brief Clear Rx message end interrupt
  1198. * @rmtoll ICR RXMSGENDIE LL_UCPD_ClearFlag_RxMsgEnd
  1199. * @param UCPDx UCPD Instance
  1200. * @retval None
  1201. */
  1202. __STATIC_INLINE void LL_UCPD_ClearFlag_RxMsgEnd(UCPD_TypeDef *UCPDx)
  1203. {
  1204. SET_BIT(UCPDx->ICR, UCPD_ICR_RXMSGENDCF);
  1205. }
  1206. /**
  1207. * @brief Clear Rx overrun interrupt
  1208. * @rmtoll ICR RXOVRIE LL_UCPD_ClearFlag_RxOvr
  1209. * @param UCPDx UCPD Instance
  1210. * @retval None
  1211. */
  1212. __STATIC_INLINE void LL_UCPD_ClearFlag_RxOvr(UCPD_TypeDef *UCPDx)
  1213. {
  1214. SET_BIT(UCPDx->ICR, UCPD_ICR_RXOVRCF);
  1215. }
  1216. /**
  1217. * @brief Clear Rx hard resrt interrupt
  1218. * @rmtoll ICR RXHRSTDETIE LL_UCPD_ClearFlag_RxHRST
  1219. * @param UCPDx UCPD Instance
  1220. * @retval None
  1221. */
  1222. __STATIC_INLINE void LL_UCPD_ClearFlag_RxHRST(UCPD_TypeDef *UCPDx)
  1223. {
  1224. SET_BIT(UCPDx->ICR, UCPD_ICR_RXHRSTDETCF);
  1225. }
  1226. /**
  1227. * @brief Clear Rx orderset interrupt
  1228. * @rmtoll ICR RXORDDETIE LL_UCPD_ClearFlag_RxOrderSet
  1229. * @param UCPDx UCPD Instance
  1230. * @retval None
  1231. */
  1232. __STATIC_INLINE void LL_UCPD_ClearFlag_RxOrderSet(UCPD_TypeDef *UCPDx)
  1233. {
  1234. SET_BIT(UCPDx->ICR, UCPD_ICR_RXORDDETCF);
  1235. }
  1236. /**
  1237. * @brief Clear TX underrun interrupt
  1238. * @rmtoll ICR TXUNDIE LL_UCPD_ClearFlag_TxUND
  1239. * @param UCPDx UCPD Instance
  1240. * @retval None
  1241. */
  1242. __STATIC_INLINE void LL_UCPD_ClearFlag_TxUND(UCPD_TypeDef *UCPDx)
  1243. {
  1244. SET_BIT(UCPDx->ICR, UCPD_ICR_TXUNDCF);
  1245. }
  1246. /**
  1247. * @brief Clear hard reset sent interrupt
  1248. * @rmtoll ICR HRSTSENTIE LL_UCPD_ClearFlag_TxHRSTSENT
  1249. * @param UCPDx UCPD Instance
  1250. * @retval None
  1251. */
  1252. __STATIC_INLINE void LL_UCPD_ClearFlag_TxHRSTSENT(UCPD_TypeDef *UCPDx)
  1253. {
  1254. SET_BIT(UCPDx->ICR, UCPD_ICR_HRSTSENTCF);
  1255. }
  1256. /**
  1257. * @brief Clear hard reset discard interrupt
  1258. * @rmtoll ICR HRSTDISCIE LL_UCPD_ClearFlag_TxHRSTDISC
  1259. * @param UCPDx UCPD Instance
  1260. * @retval None
  1261. */
  1262. __STATIC_INLINE void LL_UCPD_ClearFlag_TxHRSTDISC(UCPD_TypeDef *UCPDx)
  1263. {
  1264. SET_BIT(UCPDx->ICR, UCPD_ICR_HRSTDISCCF);
  1265. }
  1266. /**
  1267. * @brief Clear Tx message abort interrupt
  1268. * @rmtoll ICR TXMSGABTIE LL_UCPD_ClearFlag_TxMSGABT
  1269. * @param UCPDx UCPD Instance
  1270. * @retval None
  1271. */
  1272. __STATIC_INLINE void LL_UCPD_ClearFlag_TxMSGABT(UCPD_TypeDef *UCPDx)
  1273. {
  1274. SET_BIT(UCPDx->ICR, UCPD_ICR_TXMSGABTCF);
  1275. }
  1276. /**
  1277. * @brief Clear Tx message sent interrupt
  1278. * @rmtoll ICR TXMSGSENTIE LL_UCPD_ClearFlag_TxMSGSENT
  1279. * @param UCPDx UCPD Instance
  1280. * @retval None
  1281. */
  1282. __STATIC_INLINE void LL_UCPD_ClearFlag_TxMSGSENT(UCPD_TypeDef *UCPDx)
  1283. {
  1284. SET_BIT(UCPDx->ICR, UCPD_ICR_TXMSGSENTCF);
  1285. }
  1286. /**
  1287. * @brief Clear Tx message discarded interrupt
  1288. * @rmtoll ICR TXMSGDISCIE LL_UCPD_ClearFlag_TxMSGDISC
  1289. * @param UCPDx UCPD Instance
  1290. * @retval None
  1291. */
  1292. __STATIC_INLINE void LL_UCPD_ClearFlag_TxMSGDISC(UCPD_TypeDef *UCPDx)
  1293. {
  1294. SET_BIT(UCPDx->ICR, UCPD_ICR_TXMSGDISCCF);
  1295. }
  1296. /**
  1297. * @}
  1298. */
  1299. /** @defgroup UCPD_LL_EF_FLAG_Management FLAG Management
  1300. * @{
  1301. */
  1302. /**
  1303. * @brief Check if FRS interrupt
  1304. * @rmtoll SR FRSEVT LL_UCPD_IsActiveFlag_FRS
  1305. * @param UCPDx UCPD Instance
  1306. * @retval None
  1307. */
  1308. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_FRS(UCPD_TypeDef const *const UCPDx)
  1309. {
  1310. return ((READ_BIT(UCPDx->SR, UCPD_SR_FRSEVT) == UCPD_SR_FRSEVT) ? 1UL : 0UL);
  1311. }
  1312. /**
  1313. * @brief Check if type c event on CC2
  1314. * @rmtoll SR TYPECEVT2 LL_UCPD_IsActiveFlag_TypeCEventCC2
  1315. * @param UCPDx UCPD Instance
  1316. * @retval None
  1317. */
  1318. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TypeCEventCC2(UCPD_TypeDef const *const UCPDx)
  1319. {
  1320. return ((READ_BIT(UCPDx->SR, UCPD_SR_TYPECEVT2) == UCPD_SR_TYPECEVT2) ? 1UL : 0UL);
  1321. }
  1322. /**
  1323. * @brief Check if type c event on CC1
  1324. * @rmtoll SR TYPECEVT1 LL_UCPD_IsActiveFlag_TypeCEventCC1
  1325. * @param UCPDx UCPD Instance
  1326. * @retval None
  1327. */
  1328. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TypeCEventCC1(UCPD_TypeDef const *const UCPDx)
  1329. {
  1330. return ((READ_BIT(UCPDx->SR, UCPD_SR_TYPECEVT1) == UCPD_SR_TYPECEVT1) ? 1UL : 0UL);
  1331. }
  1332. /**
  1333. * @brief Check if Rx message end interrupt
  1334. * @rmtoll SR RXMSGEND LL_UCPD_IsActiveFlag_RxMsgEnd
  1335. * @param UCPDx UCPD Instance
  1336. * @retval None
  1337. */
  1338. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_RxMsgEnd(UCPD_TypeDef const *const UCPDx)
  1339. {
  1340. return ((READ_BIT(UCPDx->SR, UCPD_SR_RXMSGEND) == UCPD_SR_RXMSGEND) ? 1UL : 0UL);
  1341. }
  1342. /**
  1343. * @brief Check if Rx overrun interrupt
  1344. * @rmtoll SR RXOVR LL_UCPD_IsActiveFlag_RxOvr
  1345. * @param UCPDx UCPD Instance
  1346. * @retval None
  1347. */
  1348. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_RxOvr(UCPD_TypeDef const *const UCPDx)
  1349. {
  1350. return ((READ_BIT(UCPDx->SR, UCPD_SR_RXOVR) == UCPD_SR_RXOVR) ? 1UL : 0UL);
  1351. }
  1352. /**
  1353. * @brief Check if Rx hard resrt interrupt
  1354. * @rmtoll SR RXHRSTDET LL_UCPD_IsActiveFlag_RxHRST
  1355. * @param UCPDx UCPD Instance
  1356. * @retval None
  1357. */
  1358. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_RxHRST(UCPD_TypeDef const *const UCPDx)
  1359. {
  1360. return ((READ_BIT(UCPDx->SR, UCPD_SR_RXHRSTDET) == UCPD_SR_RXHRSTDET) ? 1UL : 0UL);
  1361. }
  1362. /**
  1363. * @brief Check if Rx orderset interrupt
  1364. * @rmtoll SR RXORDDET LL_UCPD_IsActiveFlag_RxOrderSet
  1365. * @param UCPDx UCPD Instance
  1366. * @retval State of bit (1 or 0).
  1367. */
  1368. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_RxOrderSet(UCPD_TypeDef const *const UCPDx)
  1369. {
  1370. return ((READ_BIT(UCPDx->SR, UCPD_SR_RXORDDET) == UCPD_SR_RXORDDET) ? 1UL : 0UL);
  1371. }
  1372. /**
  1373. * @brief Check if Rx non empty interrupt
  1374. * @rmtoll SR RXNE LL_UCPD_IsActiveFlag_RxNE
  1375. * @param UCPDx UCPD Instance
  1376. * @retval State of bit (1 or 0).
  1377. */
  1378. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_RxNE(UCPD_TypeDef const *const UCPDx)
  1379. {
  1380. return ((READ_BIT(UCPDx->SR, UCPD_SR_RXNE) == UCPD_SR_RXNE) ? 1UL : 0UL);
  1381. }
  1382. /**
  1383. * @brief Check if TX underrun interrupt
  1384. * @rmtoll SR TXUND LL_UCPD_IsActiveFlag_TxUND
  1385. * @param UCPDx UCPD Instance
  1386. * @retval State of bit (1 or 0).
  1387. */
  1388. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxUND(UCPD_TypeDef const *const UCPDx)
  1389. {
  1390. return ((READ_BIT(UCPDx->SR, UCPD_SR_TXUND) == UCPD_SR_TXUND) ? 1UL : 0UL);
  1391. }
  1392. /**
  1393. * @brief Check if hard reset sent interrupt
  1394. * @rmtoll SR HRSTSENT LL_UCPD_IsActiveFlag_TxHRSTSENT
  1395. * @param UCPDx UCPD Instance
  1396. * @retval State of bit (1 or 0).
  1397. */
  1398. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxHRSTSENT(UCPD_TypeDef const *const UCPDx)
  1399. {
  1400. return ((READ_BIT(UCPDx->SR, UCPD_SR_HRSTSENT) == UCPD_SR_HRSTSENT) ? 1UL : 0UL);
  1401. }
  1402. /**
  1403. * @brief Check if hard reset discard interrupt
  1404. * @rmtoll SR HRSTDISC LL_UCPD_IsActiveFlag_TxHRSTDISC
  1405. * @param UCPDx UCPD Instance
  1406. * @retval State of bit (1 or 0).
  1407. */
  1408. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxHRSTDISC(UCPD_TypeDef const *const UCPDx)
  1409. {
  1410. return ((READ_BIT(UCPDx->SR, UCPD_SR_HRSTDISC) == UCPD_SR_HRSTDISC) ? 1UL : 0UL);
  1411. }
  1412. /**
  1413. * @brief Check if Tx message abort interrupt
  1414. * @rmtoll SR TXMSGABT LL_UCPD_IsActiveFlag_TxMSGABT
  1415. * @param UCPDx UCPD Instance
  1416. * @retval State of bit (1 or 0).
  1417. */
  1418. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxMSGABT(UCPD_TypeDef const *const UCPDx)
  1419. {
  1420. return ((READ_BIT(UCPDx->SR, UCPD_SR_TXMSGABT) == UCPD_SR_TXMSGABT) ? 1UL : 0UL);
  1421. }
  1422. /**
  1423. * @brief Check if Tx message sent interrupt
  1424. * @rmtoll SR TXMSGSENT LL_UCPD_IsActiveFlag_TxMSGSENT
  1425. * @param UCPDx UCPD Instance
  1426. * @retval State of bit (1 or 0).
  1427. */
  1428. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxMSGSENT(UCPD_TypeDef const *const UCPDx)
  1429. {
  1430. return ((READ_BIT(UCPDx->SR, UCPD_SR_TXMSGSENT) == UCPD_SR_TXMSGSENT) ? 1UL : 0UL);
  1431. }
  1432. /**
  1433. * @brief Check if Tx message discarded interrupt
  1434. * @rmtoll SR TXMSGDISC LL_UCPD_IsActiveFlag_TxMSGDISC
  1435. * @param UCPDx UCPD Instance
  1436. * @retval State of bit (1 or 0).
  1437. */
  1438. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxMSGDISC(UCPD_TypeDef const *const UCPDx)
  1439. {
  1440. return ((READ_BIT(UCPDx->SR, UCPD_SR_TXMSGDISC) == UCPD_SR_TXMSGDISC) ? 1UL : 0UL);
  1441. }
  1442. /**
  1443. * @brief Check if Tx data receive interrupt
  1444. * @rmtoll SR TXIS LL_UCPD_IsActiveFlag_TxIS
  1445. * @param UCPDx UCPD Instance
  1446. * @retval State of bit (1 or 0).
  1447. */
  1448. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxIS(UCPD_TypeDef const *const UCPDx)
  1449. {
  1450. return ((READ_BIT(UCPDx->SR, UCPD_SR_TXIS) == UCPD_SR_TXIS) ? 1UL : 0UL);
  1451. }
  1452. /**
  1453. * @brief return the vstate value for CC2
  1454. * @rmtoll SR TXIS LL_UCPD_GetTypeCVstateCC2
  1455. * @param UCPDx UCPD Instance
  1456. * @retval val
  1457. */
  1458. __STATIC_INLINE uint32_t LL_UCPD_GetTypeCVstateCC2(UCPD_TypeDef const *const UCPDx)
  1459. {
  1460. return UCPDx->SR & UCPD_SR_TYPEC_VSTATE_CC2;
  1461. }
  1462. /**
  1463. * @brief return the vstate value for CC1
  1464. * @rmtoll SR TXIS LL_UCPD_GetTypeCVstateCC1
  1465. * @param UCPDx UCPD Instance
  1466. * @retval val
  1467. */
  1468. __STATIC_INLINE uint32_t LL_UCPD_GetTypeCVstateCC1(UCPD_TypeDef const *const UCPDx)
  1469. {
  1470. return UCPDx->SR & UCPD_SR_TYPEC_VSTATE_CC1;
  1471. }
  1472. /**
  1473. * @}
  1474. */
  1475. /** @defgroup UCPD_LL_EF_DMA_Management DMA Management
  1476. * @{
  1477. */
  1478. /**
  1479. * @brief Rx DMA Enable
  1480. * @rmtoll CFG1 RXDMAEN LL_UCPD_RxDMAEnable
  1481. * @param UCPDx UCPD Instance
  1482. * @retval None
  1483. */
  1484. __STATIC_INLINE void LL_UCPD_RxDMAEnable(UCPD_TypeDef *UCPDx)
  1485. {
  1486. SET_BIT(UCPDx->CFG1, UCPD_CFG1_RXDMAEN);
  1487. }
  1488. /**
  1489. * @brief Rx DMA Disable
  1490. * @rmtoll CFG1 RXDMAEN LL_UCPD_RxDMADisable
  1491. * @param UCPDx UCPD Instance
  1492. * @retval None
  1493. */
  1494. __STATIC_INLINE void LL_UCPD_RxDMADisable(UCPD_TypeDef *UCPDx)
  1495. {
  1496. CLEAR_BIT(UCPDx->CFG1, UCPD_CFG1_RXDMAEN);
  1497. }
  1498. /**
  1499. * @brief Tx DMA Enable
  1500. * @rmtoll CFG1 TXDMAEN LL_UCPD_TxDMAEnable
  1501. * @param UCPDx UCPD Instance
  1502. * @retval None
  1503. */
  1504. __STATIC_INLINE void LL_UCPD_TxDMAEnable(UCPD_TypeDef *UCPDx)
  1505. {
  1506. SET_BIT(UCPDx->CFG1, UCPD_CFG1_TXDMAEN);
  1507. }
  1508. /**
  1509. * @brief Tx DMA Disable
  1510. * @rmtoll CFG1 TXDMAEN LL_UCPD_TxDMADisable
  1511. * @param UCPDx UCPD Instance
  1512. * @retval None
  1513. */
  1514. __STATIC_INLINE void LL_UCPD_TxDMADisable(UCPD_TypeDef *UCPDx)
  1515. {
  1516. CLEAR_BIT(UCPDx->CFG1, UCPD_CFG1_TXDMAEN);
  1517. }
  1518. /**
  1519. * @brief Check if DMA Tx is enabled
  1520. * @rmtoll CR2 TXDMAEN LL_UCPD_IsEnabledTxDMA
  1521. * @param UCPDx UCPD Instance
  1522. * @retval State of bit (1 or 0).
  1523. */
  1524. __STATIC_INLINE uint32_t LL_UCPD_IsEnabledTxDMA(UCPD_TypeDef const *const UCPDx)
  1525. {
  1526. return ((READ_BIT(UCPDx->CFG1, UCPD_CFG1_TXDMAEN) == (UCPD_CFG1_TXDMAEN)) ? 1UL : 0UL);
  1527. }
  1528. /**
  1529. * @brief Check if DMA Rx is enabled
  1530. * @rmtoll CR2 RXDMAEN LL_UCPD_IsEnabledRxDMA
  1531. * @param UCPDx UCPD Instance
  1532. * @retval State of bit (1 or 0).
  1533. */
  1534. __STATIC_INLINE uint32_t LL_UCPD_IsEnabledRxDMA(UCPD_TypeDef const *const UCPDx)
  1535. {
  1536. return ((READ_BIT(UCPDx->CFG1, UCPD_CFG1_RXDMAEN) == (UCPD_CFG1_RXDMAEN)) ? 1UL : 0UL);
  1537. }
  1538. /**
  1539. * @}
  1540. */
  1541. /** @defgroup UCPD_LL_EF_DATA_Management DATA Management
  1542. * @{
  1543. */
  1544. /**
  1545. * @brief write the orderset for Tx message
  1546. * @rmtoll TX_ORDSET TXORDSET LL_UCPD_WriteTxOrderSet
  1547. * @param UCPDx UCPD Instance
  1548. * @param TxOrderSet one of the following value
  1549. * @arg @ref LL_UCPD_ORDERED_SET_SOP
  1550. * @arg @ref LL_UCPD_ORDERED_SET_SOP1
  1551. * @arg @ref LL_UCPD_ORDERED_SET_SOP2
  1552. * @arg @ref LL_UCPD_ORDERED_SET_HARD_RESET
  1553. * @arg @ref LL_UCPD_ORDERED_SET_CABLE_RESET
  1554. * @arg @ref LL_UCPD_ORDERED_SET_SOP1_DEBUG
  1555. * @arg @ref LL_UCPD_ORDERED_SET_SOP2_DEBUG
  1556. * @retval None
  1557. */
  1558. __STATIC_INLINE void LL_UCPD_WriteTxOrderSet(UCPD_TypeDef *UCPDx, uint32_t TxOrderSet)
  1559. {
  1560. WRITE_REG(UCPDx->TX_ORDSET, TxOrderSet);
  1561. }
  1562. /**
  1563. * @brief write the Tx paysize
  1564. * @rmtoll TX_PAYSZ TXPAYSZ LL_UCPD_WriteTxPaySize
  1565. * @param UCPDx UCPD Instance
  1566. * @param TxPaySize
  1567. * @retval None.
  1568. */
  1569. __STATIC_INLINE void LL_UCPD_WriteTxPaySize(UCPD_TypeDef *UCPDx, uint32_t TxPaySize)
  1570. {
  1571. WRITE_REG(UCPDx->TX_PAYSZ, TxPaySize);
  1572. }
  1573. /**
  1574. * @brief Write data
  1575. * @rmtoll TXDR DR LL_UCPD_WriteData
  1576. * @param UCPDx UCPD Instance
  1577. * @param Data Value between Min_Data=0x00 and Max_Data=0xFF
  1578. * @retval None.
  1579. */
  1580. __STATIC_INLINE void LL_UCPD_WriteData(UCPD_TypeDef *UCPDx, uint8_t Data)
  1581. {
  1582. WRITE_REG(UCPDx->TXDR, Data);
  1583. }
  1584. /**
  1585. * @brief read RX the orderset
  1586. * @rmtoll RX_ORDSET RXORDSET LL_UCPD_ReadRxOrderSet
  1587. * @param UCPDx UCPD Instance
  1588. * @retval RxOrderSet one of the following value
  1589. * @arg @ref LL_UCPD_RXORDSET_SOP
  1590. * @arg @ref LL_UCPD_RXORDSET_SOP1
  1591. * @arg @ref LL_UCPD_RXORDSET_SOP2
  1592. * @arg @ref LL_UCPD_RXORDSET_SOP1_DEBUG
  1593. * @arg @ref LL_UCPD_RXORDSET_SOP2_DEBUG
  1594. * @arg @ref LL_UCPD_RXORDSET_CABLE_RESET
  1595. * @arg @ref LL_UCPD_RXORDSET_SOPEXT1
  1596. * @arg @ref LL_UCPD_RXORDSET_SOPEXT2
  1597. */
  1598. __STATIC_INLINE uint32_t LL_UCPD_ReadRxOrderSet(UCPD_TypeDef const *const UCPDx)
  1599. {
  1600. return READ_BIT(UCPDx->RX_ORDSET, UCPD_RX_ORDSET_RXORDSET);
  1601. }
  1602. /**
  1603. * @brief Read the Rx paysize
  1604. * @rmtoll RX_PAYSZ RXPAYSZ LL_UCPD_ReadRxPaySize
  1605. * @param UCPDx UCPD Instance
  1606. * @retval RXPaysize.
  1607. */
  1608. __STATIC_INLINE uint32_t LL_UCPD_ReadRxPaySize(UCPD_TypeDef const *const UCPDx)
  1609. {
  1610. return READ_BIT(UCPDx->RX_PAYSZ, UCPD_RX_PAYSZ_RXPAYSZ);
  1611. }
  1612. /**
  1613. * @brief Read data
  1614. * @rmtoll RXDR RXDATA LL_UCPD_ReadData
  1615. * @param UCPDx UCPD Instance
  1616. * @retval RxData Value between Min_Data=0x00 and Max_Data=0xFF
  1617. */
  1618. __STATIC_INLINE uint32_t LL_UCPD_ReadData(UCPD_TypeDef const *const UCPDx)
  1619. {
  1620. return READ_REG(UCPDx->RXDR);
  1621. }
  1622. /**
  1623. * @brief Set Rx OrderSet Ext1
  1624. * @rmtoll RX_ORDEXT1 RXSOPX1 LL_UCPD_SetRxOrdExt1
  1625. * @param UCPDx UCPD Instance
  1626. * @param SOPExt Value between Min_Data=0x00000 and Max_Data=0xFFFFF
  1627. * @retval None
  1628. */
  1629. __STATIC_INLINE void LL_UCPD_SetRxOrdExt1(UCPD_TypeDef *UCPDx, uint32_t SOPExt)
  1630. {
  1631. WRITE_REG(UCPDx->RX_ORDEXT1, SOPExt);
  1632. }
  1633. /**
  1634. * @brief Set Rx OrderSet Ext2
  1635. * @rmtoll RX_ORDEXT2 RXSOPX2 LL_UCPD_SetRxOrdExt2
  1636. * @param UCPDx UCPD Instance
  1637. * @param SOPExt Value between Min_Data=0x00000 and Max_Data=0xFFFFF
  1638. * @retval None
  1639. */
  1640. __STATIC_INLINE void LL_UCPD_SetRxOrdExt2(UCPD_TypeDef *UCPDx, uint32_t SOPExt)
  1641. {
  1642. WRITE_REG(UCPDx->RX_ORDEXT2, SOPExt);
  1643. }
  1644. /**
  1645. * @}
  1646. */
  1647. #if defined(USE_FULL_LL_DRIVER)
  1648. /** @defgroup UCPD_LL_EF_Init Initialization and de-initialization functions
  1649. * @{
  1650. */
  1651. ErrorStatus LL_UCPD_DeInit(UCPD_TypeDef *UCPDx);
  1652. ErrorStatus LL_UCPD_Init(UCPD_TypeDef *UCPDx, LL_UCPD_InitTypeDef *UCPD_InitStruct);
  1653. void LL_UCPD_StructInit(LL_UCPD_InitTypeDef *UCPD_InitStruct);
  1654. /**
  1655. * @}
  1656. */
  1657. #endif /* USE_FULL_LL_DRIVER */
  1658. /**
  1659. * @}
  1660. */
  1661. #endif /* defined (UCPD1) || defined (UCPD2) */
  1662. /**
  1663. * @}
  1664. */
  1665. /**
  1666. * @}
  1667. */
  1668. #ifdef __cplusplus
  1669. }
  1670. #endif
  1671. #endif /* STM32G0xx_LL_UCPD_H */