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