stm32g4xx_ll_ucpd.h 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874
  1. /**
  2. ******************************************************************************
  3. * @file stm32g4xx_ll_ucpd.h
  4. * @author MCD Application Team
  5. * @brief Header file of UCPD LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2019 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 STM32G4xx_LL_UCPD_H
  20. #define STM32G4xx_LL_UCPD_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32g4xx.h"
  26. /** @addtogroup STM32G4xx_LL_Driver
  27. * @{
  28. */
  29. #if defined (UCPD1)
  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 reset 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 reset 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 reset 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 reset 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 Event Flag is active
  1304. * @rmtoll SR FRSEVT LL_UCPD_IsActiveFlag_FRS
  1305. * @param UCPDx UCPD Instance
  1306. * @retval State of bit (1 or 0).
  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 State of bit (1 or 0).
  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 State of bit (1 or 0).
  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 error flag is active
  1334. * @rmtoll SR RXERR LL_UCPD_IsActiveFlag_RxErr
  1335. * @param UCPDx UCPD Instance
  1336. * @retval State of bit (1 or 0).
  1337. */
  1338. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_RxErr(UCPD_TypeDef const *const UCPDx)
  1339. {
  1340. return ((READ_BIT(UCPDx->SR, UCPD_SR_RXERR) == UCPD_SR_RXERR) ? 1UL : 0UL);
  1341. }
  1342. /**
  1343. * @brief Check if Rx message end flag is active
  1344. * @rmtoll SR RXMSGEND LL_UCPD_IsActiveFlag_RxMsgEnd
  1345. * @param UCPDx UCPD Instance
  1346. * @retval State of bit (1 or 0).
  1347. */
  1348. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_RxMsgEnd(UCPD_TypeDef const *const UCPDx)
  1349. {
  1350. return ((READ_BIT(UCPDx->SR, UCPD_SR_RXMSGEND) == UCPD_SR_RXMSGEND) ? 1UL : 0UL);
  1351. }
  1352. /**
  1353. * @brief Check if Rx overrun flag is active
  1354. * @rmtoll SR RXOVR LL_UCPD_IsActiveFlag_RxOvr
  1355. * @param UCPDx UCPD Instance
  1356. * @retval State of bit (1 or 0).
  1357. */
  1358. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_RxOvr(UCPD_TypeDef const *const UCPDx)
  1359. {
  1360. return ((READ_BIT(UCPDx->SR, UCPD_SR_RXOVR) == UCPD_SR_RXOVR) ? 1UL : 0UL);
  1361. }
  1362. /**
  1363. * @brief Check if Rx hard reset flag is active
  1364. * @rmtoll SR RXHRSTDET LL_UCPD_IsActiveFlag_RxHRST
  1365. * @param UCPDx UCPD Instance
  1366. * @retval State of bit (1 or 0).
  1367. */
  1368. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_RxHRST(UCPD_TypeDef const *const UCPDx)
  1369. {
  1370. return ((READ_BIT(UCPDx->SR, UCPD_SR_RXHRSTDET) == UCPD_SR_RXHRSTDET) ? 1UL : 0UL);
  1371. }
  1372. /**
  1373. * @brief Check if Rx orderset flag is active
  1374. * @rmtoll SR RXORDDET LL_UCPD_IsActiveFlag_RxOrderSet
  1375. * @param UCPDx UCPD Instance
  1376. * @retval State of bit (1 or 0).
  1377. */
  1378. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_RxOrderSet(UCPD_TypeDef const *const UCPDx)
  1379. {
  1380. return ((READ_BIT(UCPDx->SR, UCPD_SR_RXORDDET) == UCPD_SR_RXORDDET) ? 1UL : 0UL);
  1381. }
  1382. /**
  1383. * @brief Check if Rx non empty flag is active
  1384. * @rmtoll SR RXNE LL_UCPD_IsActiveFlag_RxNE
  1385. * @param UCPDx UCPD Instance
  1386. * @retval State of bit (1 or 0).
  1387. */
  1388. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_RxNE(UCPD_TypeDef const *const UCPDx)
  1389. {
  1390. return ((READ_BIT(UCPDx->SR, UCPD_SR_RXNE) == UCPD_SR_RXNE) ? 1UL : 0UL);
  1391. }
  1392. /**
  1393. * @brief Check if TX underrun flag is active
  1394. * @rmtoll SR TXUND LL_UCPD_IsActiveFlag_TxUND
  1395. * @param UCPDx UCPD Instance
  1396. * @retval State of bit (1 or 0).
  1397. */
  1398. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxUND(UCPD_TypeDef const *const UCPDx)
  1399. {
  1400. return ((READ_BIT(UCPDx->SR, UCPD_SR_TXUND) == UCPD_SR_TXUND) ? 1UL : 0UL);
  1401. }
  1402. /**
  1403. * @brief Check if hard reset sent flag is active
  1404. * @rmtoll SR HRSTSENT LL_UCPD_IsActiveFlag_TxHRSTSENT
  1405. * @param UCPDx UCPD Instance
  1406. * @retval State of bit (1 or 0).
  1407. */
  1408. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxHRSTSENT(UCPD_TypeDef const *const UCPDx)
  1409. {
  1410. return ((READ_BIT(UCPDx->SR, UCPD_SR_HRSTSENT) == UCPD_SR_HRSTSENT) ? 1UL : 0UL);
  1411. }
  1412. /**
  1413. * @brief Check if hard reset discard flag is active
  1414. * @rmtoll SR HRSTDISC LL_UCPD_IsActiveFlag_TxHRSTDISC
  1415. * @param UCPDx UCPD Instance
  1416. * @retval State of bit (1 or 0).
  1417. */
  1418. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxHRSTDISC(UCPD_TypeDef const *const UCPDx)
  1419. {
  1420. return ((READ_BIT(UCPDx->SR, UCPD_SR_HRSTDISC) == UCPD_SR_HRSTDISC) ? 1UL : 0UL);
  1421. }
  1422. /**
  1423. * @brief Check if Tx message abort flag is active
  1424. * @rmtoll SR TXMSGABT LL_UCPD_IsActiveFlag_TxMSGABT
  1425. * @param UCPDx UCPD Instance
  1426. * @retval State of bit (1 or 0).
  1427. */
  1428. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxMSGABT(UCPD_TypeDef const *const UCPDx)
  1429. {
  1430. return ((READ_BIT(UCPDx->SR, UCPD_SR_TXMSGABT) == UCPD_SR_TXMSGABT) ? 1UL : 0UL);
  1431. }
  1432. /**
  1433. * @brief Check if Tx message sent flag is active
  1434. * @rmtoll SR TXMSGSENT LL_UCPD_IsActiveFlag_TxMSGSENT
  1435. * @param UCPDx UCPD Instance
  1436. * @retval State of bit (1 or 0).
  1437. */
  1438. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxMSGSENT(UCPD_TypeDef const *const UCPDx)
  1439. {
  1440. return ((READ_BIT(UCPDx->SR, UCPD_SR_TXMSGSENT) == UCPD_SR_TXMSGSENT) ? 1UL : 0UL);
  1441. }
  1442. /**
  1443. * @brief Check if Tx message discarded flag is active
  1444. * @rmtoll SR TXMSGDISC LL_UCPD_IsActiveFlag_TxMSGDISC
  1445. * @param UCPDx UCPD Instance
  1446. * @retval State of bit (1 or 0).
  1447. */
  1448. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxMSGDISC(UCPD_TypeDef const *const UCPDx)
  1449. {
  1450. return ((READ_BIT(UCPDx->SR, UCPD_SR_TXMSGDISC) == UCPD_SR_TXMSGDISC) ? 1UL : 0UL);
  1451. }
  1452. /**
  1453. * @brief Check if Tx data interrupt flag is active
  1454. * @rmtoll SR TXIS LL_UCPD_IsActiveFlag_TxIS
  1455. * @param UCPDx UCPD Instance
  1456. * @retval State of bit (1 or 0).
  1457. */
  1458. __STATIC_INLINE uint32_t LL_UCPD_IsActiveFlag_TxIS(UCPD_TypeDef const *const UCPDx)
  1459. {
  1460. return ((READ_BIT(UCPDx->SR, UCPD_SR_TXIS) == UCPD_SR_TXIS) ? 1UL : 0UL);
  1461. }
  1462. /**
  1463. * @brief return the vstate value for CC2
  1464. * @rmtoll SR TXIS LL_UCPD_GetTypeCVstateCC2
  1465. * @param UCPDx UCPD Instance
  1466. * @retval val
  1467. */
  1468. __STATIC_INLINE uint32_t LL_UCPD_GetTypeCVstateCC2(UCPD_TypeDef const *const UCPDx)
  1469. {
  1470. return UCPDx->SR & UCPD_SR_TYPEC_VSTATE_CC2;
  1471. }
  1472. /**
  1473. * @brief return the vstate value for CC1
  1474. * @rmtoll SR TXIS LL_UCPD_GetTypeCVstateCC1
  1475. * @param UCPDx UCPD Instance
  1476. * @retval val
  1477. */
  1478. __STATIC_INLINE uint32_t LL_UCPD_GetTypeCVstateCC1(UCPD_TypeDef const *const UCPDx)
  1479. {
  1480. return UCPDx->SR & UCPD_SR_TYPEC_VSTATE_CC1;
  1481. }
  1482. /**
  1483. * @}
  1484. */
  1485. /** @defgroup UCPD_LL_EF_DMA_Management DMA Management
  1486. * @{
  1487. */
  1488. /**
  1489. * @brief Rx DMA Enable
  1490. * @rmtoll CFG1 RXDMAEN LL_UCPD_RxDMAEnable
  1491. * @param UCPDx UCPD Instance
  1492. * @retval None
  1493. */
  1494. __STATIC_INLINE void LL_UCPD_RxDMAEnable(UCPD_TypeDef *UCPDx)
  1495. {
  1496. SET_BIT(UCPDx->CFG1, UCPD_CFG1_RXDMAEN);
  1497. }
  1498. /**
  1499. * @brief Rx DMA Disable
  1500. * @rmtoll CFG1 RXDMAEN LL_UCPD_RxDMADisable
  1501. * @param UCPDx UCPD Instance
  1502. * @retval None
  1503. */
  1504. __STATIC_INLINE void LL_UCPD_RxDMADisable(UCPD_TypeDef *UCPDx)
  1505. {
  1506. CLEAR_BIT(UCPDx->CFG1, UCPD_CFG1_RXDMAEN);
  1507. }
  1508. /**
  1509. * @brief Tx DMA Enable
  1510. * @rmtoll CFG1 TXDMAEN LL_UCPD_TxDMAEnable
  1511. * @param UCPDx UCPD Instance
  1512. * @retval None
  1513. */
  1514. __STATIC_INLINE void LL_UCPD_TxDMAEnable(UCPD_TypeDef *UCPDx)
  1515. {
  1516. SET_BIT(UCPDx->CFG1, UCPD_CFG1_TXDMAEN);
  1517. }
  1518. /**
  1519. * @brief Tx DMA Disable
  1520. * @rmtoll CFG1 TXDMAEN LL_UCPD_TxDMADisable
  1521. * @param UCPDx UCPD Instance
  1522. * @retval None
  1523. */
  1524. __STATIC_INLINE void LL_UCPD_TxDMADisable(UCPD_TypeDef *UCPDx)
  1525. {
  1526. CLEAR_BIT(UCPDx->CFG1, UCPD_CFG1_TXDMAEN);
  1527. }
  1528. /**
  1529. * @brief Check if DMA Tx is enabled
  1530. * @rmtoll CR2 TXDMAEN LL_UCPD_IsEnabledTxDMA
  1531. * @param UCPDx UCPD Instance
  1532. * @retval State of bit (1 or 0).
  1533. */
  1534. __STATIC_INLINE uint32_t LL_UCPD_IsEnabledTxDMA(UCPD_TypeDef const *const UCPDx)
  1535. {
  1536. return ((READ_BIT(UCPDx->CFG1, UCPD_CFG1_TXDMAEN) == (UCPD_CFG1_TXDMAEN)) ? 1UL : 0UL);
  1537. }
  1538. /**
  1539. * @brief Check if DMA Rx is enabled
  1540. * @rmtoll CR2 RXDMAEN LL_UCPD_IsEnabledRxDMA
  1541. * @param UCPDx UCPD Instance
  1542. * @retval State of bit (1 or 0).
  1543. */
  1544. __STATIC_INLINE uint32_t LL_UCPD_IsEnabledRxDMA(UCPD_TypeDef const *const UCPDx)
  1545. {
  1546. return ((READ_BIT(UCPDx->CFG1, UCPD_CFG1_RXDMAEN) == (UCPD_CFG1_RXDMAEN)) ? 1UL : 0UL);
  1547. }
  1548. /**
  1549. * @}
  1550. */
  1551. /** @defgroup UCPD_LL_EF_DATA_Management DATA Management
  1552. * @{
  1553. */
  1554. /**
  1555. * @brief write the orderset for Tx message
  1556. * @rmtoll TX_ORDSET TXORDSET LL_UCPD_WriteTxOrderSet
  1557. * @param UCPDx UCPD Instance
  1558. * @param TxOrderSet one of the following value
  1559. * @arg @ref LL_UCPD_ORDERED_SET_SOP
  1560. * @arg @ref LL_UCPD_ORDERED_SET_SOP1
  1561. * @arg @ref LL_UCPD_ORDERED_SET_SOP2
  1562. * @arg @ref LL_UCPD_ORDERED_SET_HARD_RESET
  1563. * @arg @ref LL_UCPD_ORDERED_SET_CABLE_RESET
  1564. * @arg @ref LL_UCPD_ORDERED_SET_SOP1_DEBUG
  1565. * @arg @ref LL_UCPD_ORDERED_SET_SOP2_DEBUG
  1566. * @retval None
  1567. */
  1568. __STATIC_INLINE void LL_UCPD_WriteTxOrderSet(UCPD_TypeDef *UCPDx, uint32_t TxOrderSet)
  1569. {
  1570. WRITE_REG(UCPDx->TX_ORDSET, TxOrderSet);
  1571. }
  1572. /**
  1573. * @brief write the Tx paysize
  1574. * @rmtoll TX_PAYSZ TXPAYSZ LL_UCPD_WriteTxPaySize
  1575. * @param UCPDx UCPD Instance
  1576. * @param TxPaySize
  1577. * @retval None.
  1578. */
  1579. __STATIC_INLINE void LL_UCPD_WriteTxPaySize(UCPD_TypeDef *UCPDx, uint32_t TxPaySize)
  1580. {
  1581. WRITE_REG(UCPDx->TX_PAYSZ, TxPaySize);
  1582. }
  1583. /**
  1584. * @brief Write data
  1585. * @rmtoll TXDR DR LL_UCPD_WriteData
  1586. * @param UCPDx UCPD Instance
  1587. * @param Data Value between Min_Data=0x00 and Max_Data=0xFF
  1588. * @retval None.
  1589. */
  1590. __STATIC_INLINE void LL_UCPD_WriteData(UCPD_TypeDef *UCPDx, uint8_t Data)
  1591. {
  1592. WRITE_REG(UCPDx->TXDR, Data);
  1593. }
  1594. /**
  1595. * @brief read RX the orderset
  1596. * @rmtoll RX_ORDSET RXORDSET LL_UCPD_ReadRxOrderSet
  1597. * @param UCPDx UCPD Instance
  1598. * @retval RxOrderSet one of the following value
  1599. * @arg @ref LL_UCPD_RXORDSET_SOP
  1600. * @arg @ref LL_UCPD_RXORDSET_SOP1
  1601. * @arg @ref LL_UCPD_RXORDSET_SOP2
  1602. * @arg @ref LL_UCPD_RXORDSET_SOP1_DEBUG
  1603. * @arg @ref LL_UCPD_RXORDSET_SOP2_DEBUG
  1604. * @arg @ref LL_UCPD_RXORDSET_CABLE_RESET
  1605. * @arg @ref LL_UCPD_RXORDSET_SOPEXT1
  1606. * @arg @ref LL_UCPD_RXORDSET_SOPEXT2
  1607. */
  1608. __STATIC_INLINE uint32_t LL_UCPD_ReadRxOrderSet(UCPD_TypeDef const *const UCPDx)
  1609. {
  1610. return READ_BIT(UCPDx->RX_ORDSET, UCPD_RX_ORDSET_RXORDSET);
  1611. }
  1612. /**
  1613. * @brief Read the Rx paysize
  1614. * @rmtoll RX_PAYSZ RXPAYSZ LL_UCPD_ReadRxPaySize
  1615. * @param UCPDx UCPD Instance
  1616. * @retval RXPaysize.
  1617. */
  1618. __STATIC_INLINE uint32_t LL_UCPD_ReadRxPaySize(UCPD_TypeDef const *const UCPDx)
  1619. {
  1620. return READ_BIT(UCPDx->RX_PAYSZ, UCPD_RX_PAYSZ_RXPAYSZ);
  1621. }
  1622. /**
  1623. * @brief Read data
  1624. * @rmtoll RXDR RXDATA LL_UCPD_ReadData
  1625. * @param UCPDx UCPD Instance
  1626. * @retval RxData Value between Min_Data=0x00 and Max_Data=0xFF
  1627. */
  1628. __STATIC_INLINE uint32_t LL_UCPD_ReadData(UCPD_TypeDef const *const UCPDx)
  1629. {
  1630. return READ_REG(UCPDx->RXDR);
  1631. }
  1632. /**
  1633. * @brief Set Rx OrderSet Ext1
  1634. * @rmtoll RX_ORDEXT1 RXSOPX1 LL_UCPD_SetRxOrdExt1
  1635. * @param UCPDx UCPD Instance
  1636. * @param SOPExt Value between Min_Data=0x00000 and Max_Data=0xFFFFF
  1637. * @retval None
  1638. */
  1639. __STATIC_INLINE void LL_UCPD_SetRxOrdExt1(UCPD_TypeDef *UCPDx, uint32_t SOPExt)
  1640. {
  1641. WRITE_REG(UCPDx->RX_ORDEXT1, SOPExt);
  1642. }
  1643. /**
  1644. * @brief Set Rx OrderSet Ext2
  1645. * @rmtoll RX_ORDEXT2 RXSOPX2 LL_UCPD_SetRxOrdExt2
  1646. * @param UCPDx UCPD Instance
  1647. * @param SOPExt Value between Min_Data=0x00000 and Max_Data=0xFFFFF
  1648. * @retval None
  1649. */
  1650. __STATIC_INLINE void LL_UCPD_SetRxOrdExt2(UCPD_TypeDef *UCPDx, uint32_t SOPExt)
  1651. {
  1652. WRITE_REG(UCPDx->RX_ORDEXT2, SOPExt);
  1653. }
  1654. /**
  1655. * @}
  1656. */
  1657. #if defined(USE_FULL_LL_DRIVER)
  1658. /** @defgroup UCPD_LL_EF_Init Initialization and de-initialization functions
  1659. * @{
  1660. */
  1661. ErrorStatus LL_UCPD_DeInit(UCPD_TypeDef *UCPDx);
  1662. ErrorStatus LL_UCPD_Init(UCPD_TypeDef *UCPDx, const LL_UCPD_InitTypeDef *UCPD_InitStruct);
  1663. void LL_UCPD_StructInit(LL_UCPD_InitTypeDef *UCPD_InitStruct);
  1664. /**
  1665. * @}
  1666. */
  1667. #endif /* USE_FULL_LL_DRIVER */
  1668. /**
  1669. * @}
  1670. */
  1671. #endif /* defined (UCPD1) */
  1672. /**
  1673. * @}
  1674. */
  1675. /**
  1676. * @}
  1677. */
  1678. #ifdef __cplusplus
  1679. }
  1680. #endif
  1681. #endif /* STM32G4xx_LL_UCPD_H */