STM32L443xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_ll_swpmi.h 00004 * @author MCD Application Team 00005 * @brief Header file of SWPMI LL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file 00013 * in the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 * 00016 ****************************************************************************** 00017 */ 00018 00019 /* Define to prevent recursive inclusion -------------------------------------*/ 00020 #ifndef STM32L4xx_LL_SWPMI_H 00021 #define STM32L4xx_LL_SWPMI_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32l4xx.h" 00029 00030 /** @addtogroup STM32L4xx_LL_Driver 00031 * @{ 00032 */ 00033 00034 #if defined(SWPMI1) 00035 00036 /** @defgroup SWPMI_LL SWPMI 00037 * @{ 00038 */ 00039 00040 /* Private types -------------------------------------------------------------*/ 00041 /* Private variables ---------------------------------------------------------*/ 00042 /* Private constants ---------------------------------------------------------*/ 00043 /* Private macros ------------------------------------------------------------*/ 00044 #if defined(USE_FULL_LL_DRIVER) 00045 /** @defgroup SWPMI_LL_Private_Macros SWPMI Private Macros 00046 * @{ 00047 */ 00048 /** 00049 * @} 00050 */ 00051 #endif /*USE_FULL_LL_DRIVER*/ 00052 00053 /* Exported types ------------------------------------------------------------*/ 00054 #if defined(USE_FULL_LL_DRIVER) 00055 /** @defgroup SWPMI_LL_ES_INIT SWPMI Exported Init structure 00056 * @{ 00057 */ 00058 00059 /** 00060 * @brief SWPMI Init structures definition 00061 */ 00062 typedef struct 00063 { 00064 uint32_t VoltageClass; /*!< Specifies the SWP Voltage Class. 00065 This parameter can be a value of @ref SWPMI_LL_EC_VOLTAGE_CLASS 00066 00067 This feature can be modified afterwards using unitary function @ref LL_SWPMI_SetVoltageClass. */ 00068 00069 uint32_t BitRatePrescaler; /*!< Specifies the SWPMI bitrate prescaler. 00070 This parameter must be a number between Min_Data=0 and Max_Data=63U. 00071 00072 The value can be calculated thanks to helper macro @ref __LL_SWPMI_CALC_BITRATE_PRESCALER 00073 00074 This feature can be modified afterwards using unitary function @ref LL_SWPMI_SetBitRatePrescaler. */ 00075 00076 uint32_t TxBufferingMode; /*!< Specifies the transmission buffering mode. 00077 This parameter can be a value of @ref SWPMI_LL_EC_SW_BUFFER_TX 00078 00079 This feature can be modified afterwards using unitary function @ref LL_SWPMI_SetTransmissionMode. */ 00080 00081 uint32_t RxBufferingMode; /*!< Specifies the reception buffering mode. 00082 This parameter can be a value of @ref SWPMI_LL_EC_SW_BUFFER_RX 00083 00084 This feature can be modified afterwards using unitary function @ref LL_SWPMI_SetReceptionMode. */ 00085 } LL_SWPMI_InitTypeDef; 00086 00087 /** 00088 * @} 00089 */ 00090 #endif /* USE_FULL_LL_DRIVER */ 00091 00092 /* Exported constants --------------------------------------------------------*/ 00093 /** @defgroup SWPMI_LL_Exported_Constants SWPMI Exported Constants 00094 * @{ 00095 */ 00096 00097 /** @defgroup SWPMI_LL_EC_CLEAR_FLAG Clear Flags Defines 00098 * @brief Flags defines which can be used with LL_SWPMI_WriteReg function 00099 * @{ 00100 */ 00101 #define LL_SWPMI_ICR_CRXBFF SWPMI_ICR_CRXBFF /*!< Clear receive buffer full flag */ 00102 #define LL_SWPMI_ICR_CTXBEF SWPMI_ICR_CTXBEF /*!< Clear transmit buffer empty flag */ 00103 #define LL_SWPMI_ICR_CRXBERF SWPMI_ICR_CRXBERF /*!< Clear receive CRC error flag */ 00104 #define LL_SWPMI_ICR_CRXOVRF SWPMI_ICR_CRXOVRF /*!< Clear receive overrun error flag */ 00105 #define LL_SWPMI_ICR_CTXUNRF SWPMI_ICR_CTXUNRF /*!< Clear transmit underrun error flag */ 00106 #define LL_SWPMI_ICR_CTCF SWPMI_ICR_CTCF /*!< Clear transfer complete flag */ 00107 #define LL_SWPMI_ICR_CSRF SWPMI_ICR_CSRF /*!< Clear slave resume flag */ 00108 /** 00109 * @} 00110 */ 00111 00112 /** @defgroup SWPMI_LL_EC_GET_FLAG Get Flags Defines 00113 * @brief Flags defines which can be used with LL_SWPMI_ReadReg function 00114 * @{ 00115 */ 00116 #define LL_SWPMI_ISR_RXBFF SWPMI_ISR_RXBFF /*!< Receive buffer full flag */ 00117 #define LL_SWPMI_ISR_TXBEF SWPMI_ISR_TXBEF /*!< Transmit buffer empty flag */ 00118 #define LL_SWPMI_ISR_RXBERF SWPMI_ISR_RXBERF /*!< Receive CRC error flag */ 00119 #define LL_SWPMI_ISR_RXOVRF SWPMI_ISR_RXOVRF /*!< Receive overrun error flag */ 00120 #define LL_SWPMI_ISR_TXUNRF SWPMI_ISR_TXUNRF /*!< Transmit underrun error flag */ 00121 #define LL_SWPMI_ISR_RXNE SWPMI_ISR_RXNE /*!< Receive data register not empty */ 00122 #define LL_SWPMI_ISR_TXE SWPMI_ISR_TXE /*!< Transmit data register empty */ 00123 #define LL_SWPMI_ISR_TCF SWPMI_ISR_TCF /*!< Transfer complete flag */ 00124 #define LL_SWPMI_ISR_SRF SWPMI_ISR_SRF /*!< Slave resume flag */ 00125 #define LL_SWPMI_ISR_SUSP SWPMI_ISR_SUSP /*!< SUSPEND flag */ 00126 #define LL_SWPMI_ISR_DEACTF SWPMI_ISR_DEACTF /*!< DEACTIVATED flag */ 00127 /** 00128 * @} 00129 */ 00130 00131 /** @defgroup SWPMI_LL_EC_IT IT Defines 00132 * @brief IT defines which can be used with LL_SWPMI_ReadReg and LL_SWPMI_WriteReg functions 00133 * @{ 00134 */ 00135 #define LL_SWPMI_IER_SRIE SWPMI_IER_SRIE /*!< Slave resume interrupt enable */ 00136 #define LL_SWPMI_IER_TCIE SWPMI_IER_TCIE /*!< Transmit complete interrupt enable */ 00137 #define LL_SWPMI_IER_TIE SWPMI_IER_TIE /*!< Transmit interrupt enable */ 00138 #define LL_SWPMI_IER_RIE SWPMI_IER_RIE /*!< Receive interrupt enable */ 00139 #define LL_SWPMI_IER_TXUNRIE SWPMI_IER_TXUNRIE /*!< Transmit underrun error interrupt enable */ 00140 #define LL_SWPMI_IER_RXOVRIE SWPMI_IER_RXOVRIE /*!< Receive overrun error interrupt enable */ 00141 #define LL_SWPMI_IER_RXBERIE SWPMI_IER_RXBERIE /*!< Receive CRC error interrupt enable */ 00142 #define LL_SWPMI_IER_TXBEIE SWPMI_IER_TXBEIE /*!< Transmit buffer empty interrupt enable */ 00143 #define LL_SWPMI_IER_RXBFIE SWPMI_IER_RXBFIE /*!< Receive buffer full interrupt enable */ 00144 /** 00145 * @} 00146 */ 00147 00148 /** @defgroup SWPMI_LL_EC_SW_BUFFER_RX SW BUFFER RX 00149 * @{ 00150 */ 00151 #define LL_SWPMI_SW_BUFFER_RX_SINGLE ((uint32_t)0x00000000) /*!< Single software buffer mode for reception */ 00152 #define LL_SWPMI_SW_BUFFER_RX_MULTI SWPMI_CR_RXMODE /*!< Multi software buffermode for reception */ 00153 /** 00154 * @} 00155 */ 00156 00157 /** @defgroup SWPMI_LL_EC_SW_BUFFER_TX SW BUFFER TX 00158 * @{ 00159 */ 00160 #define LL_SWPMI_SW_BUFFER_TX_SINGLE ((uint32_t)0x00000000) /*!< Single software buffer mode for transmission */ 00161 #define LL_SWPMI_SW_BUFFER_TX_MULTI SWPMI_CR_TXMODE /*!< Multi software buffermode for transmission */ 00162 /** 00163 * @} 00164 */ 00165 00166 /** @defgroup SWPMI_LL_EC_VOLTAGE_CLASS VOLTAGE CLASS 00167 * @{ 00168 */ 00169 #define LL_SWPMI_VOLTAGE_CLASS_C ((uint32_t)0x00000000) /*!< SWPMI_IO uses directly VDD voltage to operate in class C */ 00170 #define LL_SWPMI_VOLTAGE_CLASS_B SWPMI_OR_CLASS /*!< SWPMI_IO uses an internal voltage regulator to operate in class B */ 00171 /** 00172 * @} 00173 */ 00174 00175 /** @defgroup SWPMI_LL_EC_DMA_REG_DATA DMA register data 00176 * @{ 00177 */ 00178 #define LL_SWPMI_DMA_REG_DATA_TRANSMIT (uint32_t)0 /*!< Get address of data register used for transmission */ 00179 #define LL_SWPMI_DMA_REG_DATA_RECEIVE (uint32_t)1 /*!< Get address of data register used for reception */ 00180 /** 00181 * @} 00182 */ 00183 00184 /** 00185 * @} 00186 */ 00187 00188 /* Exported macro ------------------------------------------------------------*/ 00189 /** @defgroup SWPMI_LL_Exported_Macros SWPMI Exported Macros 00190 * @{ 00191 */ 00192 00193 /** @defgroup SWPMI_LL_EM_WRITE_READ Common Write and read registers Macros 00194 * @{ 00195 */ 00196 00197 /** 00198 * @brief Write a value in SWPMI register 00199 * @param __INSTANCE__ SWPMI Instance 00200 * @param __REG__ Register to be written 00201 * @param __VALUE__ Value to be written in the register 00202 * @retval None 00203 */ 00204 #define LL_SWPMI_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) 00205 00206 /** 00207 * @brief Read a value in SWPMI register 00208 * @param __INSTANCE__ SWPMI Instance 00209 * @param __REG__ Register to be read 00210 * @retval Register value 00211 */ 00212 #define LL_SWPMI_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) 00213 /** 00214 * @} 00215 */ 00216 00217 /** @defgroup SWPMI_LL_EM_BitRate Bit rate calculation helper Macros 00218 * @{ 00219 */ 00220 00221 /** 00222 * @brief Helper macro to calculate bit rate value to set in BRR register (@ref LL_SWPMI_SetBitRatePrescaler function) 00223 * @note ex: @ref __LL_SWPMI_CALC_BITRATE_PRESCALER(2000000, 80000000); 00224 * @param __FSWP__ Within the following range: from 100 Kbit/s up to 2Mbit/s (in bit/s) 00225 * @param __FSWPCLK__ PCLK or HSI frequency (in Hz) 00226 * @retval Bitrate prescaler (BRR register) 00227 */ 00228 #define __LL_SWPMI_CALC_BITRATE_PRESCALER(__FSWP__, __FSWPCLK__) ((uint32_t)(((__FSWPCLK__) / ((__FSWP__) * 4)) - 1)) 00229 00230 /** 00231 * @} 00232 */ 00233 00234 /** 00235 * @} 00236 */ 00237 00238 /* Exported functions --------------------------------------------------------*/ 00239 /** @defgroup SWPMI_LL_Exported_Functions SWPMI Exported Functions 00240 * @{ 00241 */ 00242 00243 /** @defgroup SWPMI_LL_EF_Configuration Configuration 00244 * @{ 00245 */ 00246 00247 /** 00248 * @brief Set Reception buffering mode 00249 * @note If Multi software buffer mode is chosen, RXDMA bits must also be set. 00250 * @rmtoll CR RXMODE LL_SWPMI_SetReceptionMode 00251 * @param SWPMIx SWPMI Instance 00252 * @param RxBufferingMode This parameter can be one of the following values: 00253 * @arg @ref LL_SWPMI_SW_BUFFER_RX_SINGLE 00254 * @arg @ref LL_SWPMI_SW_BUFFER_RX_MULTI 00255 * @retval None 00256 */ 00257 __STATIC_INLINE void LL_SWPMI_SetReceptionMode(SWPMI_TypeDef *SWPMIx, uint32_t RxBufferingMode) 00258 { 00259 MODIFY_REG(SWPMIx->CR, SWPMI_CR_RXMODE, RxBufferingMode); 00260 } 00261 00262 /** 00263 * @brief Get Reception buffering mode 00264 * @rmtoll CR RXMODE LL_SWPMI_GetReceptionMode 00265 * @param SWPMIx SWPMI Instance 00266 * @retval Returned value can be one of the following values: 00267 * @arg @ref LL_SWPMI_SW_BUFFER_RX_SINGLE 00268 * @arg @ref LL_SWPMI_SW_BUFFER_RX_MULTI 00269 */ 00270 __STATIC_INLINE uint32_t LL_SWPMI_GetReceptionMode(SWPMI_TypeDef *SWPMIx) 00271 { 00272 return (uint32_t)(READ_BIT(SWPMIx->CR, SWPMI_CR_RXMODE)); 00273 } 00274 00275 /** 00276 * @brief Set Transmission buffering mode 00277 * @note If Multi software buffer mode is chosen, TXDMA bits must also be set. 00278 * @rmtoll CR TXMODE LL_SWPMI_SetTransmissionMode 00279 * @param SWPMIx SWPMI Instance 00280 * @param TxBufferingMode This parameter can be one of the following values: 00281 * @arg @ref LL_SWPMI_SW_BUFFER_TX_SINGLE 00282 * @arg @ref LL_SWPMI_SW_BUFFER_TX_MULTI 00283 * @retval None 00284 */ 00285 __STATIC_INLINE void LL_SWPMI_SetTransmissionMode(SWPMI_TypeDef *SWPMIx, uint32_t TxBufferingMode) 00286 { 00287 MODIFY_REG(SWPMIx->CR, SWPMI_CR_TXMODE, TxBufferingMode); 00288 } 00289 00290 /** 00291 * @brief Get Transmission buffering mode 00292 * @rmtoll CR TXMODE LL_SWPMI_GetTransmissionMode 00293 * @param SWPMIx SWPMI Instance 00294 * @retval Returned value can be one of the following values: 00295 * @arg @ref LL_SWPMI_SW_BUFFER_TX_SINGLE 00296 * @arg @ref LL_SWPMI_SW_BUFFER_TX_MULTI 00297 */ 00298 __STATIC_INLINE uint32_t LL_SWPMI_GetTransmissionMode(SWPMI_TypeDef *SWPMIx) 00299 { 00300 return (uint32_t)(READ_BIT(SWPMIx->CR, SWPMI_CR_TXMODE)); 00301 } 00302 00303 /** 00304 * @brief Enable loopback mode 00305 * @rmtoll CR LPBK LL_SWPMI_EnableLoopback 00306 * @param SWPMIx SWPMI Instance 00307 * @retval None 00308 */ 00309 __STATIC_INLINE void LL_SWPMI_EnableLoopback(SWPMI_TypeDef *SWPMIx) 00310 { 00311 SET_BIT(SWPMIx->CR, SWPMI_CR_LPBK); 00312 } 00313 00314 /** 00315 * @brief Disable loopback mode 00316 * @rmtoll CR LPBK LL_SWPMI_DisableLoopback 00317 * @param SWPMIx SWPMI Instance 00318 * @retval None 00319 */ 00320 __STATIC_INLINE void LL_SWPMI_DisableLoopback(SWPMI_TypeDef *SWPMIx) 00321 { 00322 CLEAR_BIT(SWPMIx->CR, SWPMI_CR_LPBK); 00323 } 00324 00325 /** 00326 * @brief Activate Single wire protocol bus (SUSPENDED or ACTIVATED state) 00327 * @note SWP bus stays in the ACTIVATED state as long as there is a communication 00328 * with the slave, either in transmission or in reception. The SWP bus switches back 00329 * to the SUSPENDED state as soon as there is no more transmission or reception 00330 * activity, after 7 idle bits. 00331 * @rmtoll CR SWPACT LL_SWPMI_Activate 00332 * @param SWPMIx SWPMI Instance 00333 * @retval None 00334 */ 00335 __STATIC_INLINE void LL_SWPMI_Activate(SWPMI_TypeDef *SWPMIx) 00336 { 00337 /* In order to activate SWP again, the software must clear DEACT bit*/ 00338 CLEAR_BIT(SWPMIx->CR, SWPMI_CR_DEACT); 00339 00340 /* Set SWACT bit */ 00341 SET_BIT(SWPMIx->CR, SWPMI_CR_SWPACT); 00342 } 00343 00344 /** 00345 * @brief Check if Single wire protocol bus is in ACTIVATED state. 00346 * @rmtoll CR SWPACT LL_SWPMI_Activate 00347 * @param SWPMIx SWPMI Instance 00348 * @retval State of bit (1 or 0). 00349 */ 00350 __STATIC_INLINE uint32_t LL_SWPMI_IsActivated(SWPMI_TypeDef *SWPMIx) 00351 { 00352 return ((READ_BIT(SWPMIx->CR, SWPMI_CR_SWPACT) == (SWPMI_CR_SWPACT)) ? 1UL : 0UL); 00353 } 00354 00355 /** 00356 * @brief Deactivate immediately Single wire protocol bus (immediate transition to 00357 * DEACTIVATED state) 00358 * @rmtoll CR SWPACT LL_SWPMI_Deactivate 00359 * @param SWPMIx SWPMI Instance 00360 * @retval None 00361 */ 00362 __STATIC_INLINE void LL_SWPMI_Deactivate(SWPMI_TypeDef *SWPMIx) 00363 { 00364 CLEAR_BIT(SWPMIx->CR, SWPMI_CR_SWPACT); 00365 } 00366 00367 /** 00368 * @brief Request a deactivation of Single wire protocol bus (request to go in DEACTIVATED 00369 * state if no resume from slave) 00370 * @rmtoll CR DEACT LL_SWPMI_RequestDeactivation 00371 * @param SWPMIx SWPMI Instance 00372 * @retval None 00373 */ 00374 __STATIC_INLINE void LL_SWPMI_RequestDeactivation(SWPMI_TypeDef *SWPMIx) 00375 { 00376 SET_BIT(SWPMIx->CR, SWPMI_CR_DEACT); 00377 } 00378 00379 /** 00380 * @brief Set Bitrate prescaler SWPMI_freq = SWPMI_clk / (((BitRate) + 1) * 4) 00381 * @rmtoll BRR BR LL_SWPMI_SetBitRatePrescaler 00382 * @param SWPMIx SWPMI Instance 00383 * @param BitRatePrescaler A number between Min_Data=0 and Max_Data=63U 00384 * @retval None 00385 */ 00386 __STATIC_INLINE void LL_SWPMI_SetBitRatePrescaler(SWPMI_TypeDef *SWPMIx, uint32_t BitRatePrescaler) 00387 { 00388 WRITE_REG(SWPMIx->BRR, BitRatePrescaler); 00389 } 00390 00391 /** 00392 * @brief Get Bitrate prescaler 00393 * @rmtoll BRR BR LL_SWPMI_GetBitRatePrescaler 00394 * @param SWPMIx SWPMI Instance 00395 * @retval A number between Min_Data=0 and Max_Data=63U 00396 */ 00397 __STATIC_INLINE uint32_t LL_SWPMI_GetBitRatePrescaler(SWPMI_TypeDef *SWPMIx) 00398 { 00399 return (uint32_t)(READ_BIT(SWPMIx->BRR, SWPMI_BRR_BR)); 00400 } 00401 00402 /** 00403 * @brief Set SWP Voltage Class 00404 * @rmtoll OR CLASS LL_SWPMI_SetVoltageClass 00405 * @param SWPMIx SWPMI Instance 00406 * @param VoltageClass This parameter can be one of the following values: 00407 * @arg @ref LL_SWPMI_VOLTAGE_CLASS_C 00408 * @arg @ref LL_SWPMI_VOLTAGE_CLASS_B 00409 * @retval None 00410 */ 00411 __STATIC_INLINE void LL_SWPMI_SetVoltageClass(SWPMI_TypeDef *SWPMIx, uint32_t VoltageClass) 00412 { 00413 MODIFY_REG(SWPMIx->OR, SWPMI_OR_CLASS, VoltageClass); 00414 } 00415 00416 /** 00417 * @brief Get SWP Voltage Class 00418 * @rmtoll OR CLASS LL_SWPMI_GetVoltageClass 00419 * @param SWPMIx SWPMI Instance 00420 * @retval Returned value can be one of the following values: 00421 * @arg @ref LL_SWPMI_VOLTAGE_CLASS_C 00422 * @arg @ref LL_SWPMI_VOLTAGE_CLASS_B 00423 */ 00424 __STATIC_INLINE uint32_t LL_SWPMI_GetVoltageClass(SWPMI_TypeDef *SWPMIx) 00425 { 00426 return (uint32_t)(READ_BIT(SWPMIx->OR, SWPMI_OR_CLASS)); 00427 } 00428 00429 /** 00430 * @} 00431 */ 00432 00433 /** @defgroup SWPMI_LL_EF_FLAG_Management FLAG_Management 00434 * @{ 00435 */ 00436 00437 /** 00438 * @brief Check if the last word of the frame under reception has arrived in SWPMI_RDR. 00439 * @rmtoll ISR RXBFF LL_SWPMI_IsActiveFlag_RXBF 00440 * @param SWPMIx SWPMI Instance 00441 * @retval State of bit (1 or 0). 00442 */ 00443 __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXBF(SWPMI_TypeDef *SWPMIx) 00444 { 00445 return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXBFF) == (SWPMI_ISR_RXBFF)) ? 1UL : 0UL); 00446 } 00447 00448 /** 00449 * @brief Check if Frame transmission buffer has been emptied 00450 * @rmtoll ISR TXBEF LL_SWPMI_IsActiveFlag_TXBE 00451 * @param SWPMIx SWPMI Instance 00452 * @retval State of bit (1 or 0). 00453 */ 00454 __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TXBE(SWPMI_TypeDef *SWPMIx) 00455 { 00456 return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TXBEF) == (SWPMI_ISR_TXBEF)) ? 1UL : 0UL); 00457 } 00458 00459 /** 00460 * @brief Check if CRC error in reception has been detected 00461 * @rmtoll ISR RXBERF LL_SWPMI_IsActiveFlag_RXBER 00462 * @param SWPMIx SWPMI Instance 00463 * @retval State of bit (1 or 0). 00464 */ 00465 __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXBER(SWPMI_TypeDef *SWPMIx) 00466 { 00467 return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXBERF) == (SWPMI_ISR_RXBERF)) ? 1UL : 0UL); 00468 } 00469 00470 /** 00471 * @brief Check if Overrun in reception has been detected 00472 * @rmtoll ISR RXOVRF LL_SWPMI_IsActiveFlag_RXOVR 00473 * @param SWPMIx SWPMI Instance 00474 * @retval State of bit (1 or 0). 00475 */ 00476 __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXOVR(SWPMI_TypeDef *SWPMIx) 00477 { 00478 return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXOVRF) == (SWPMI_ISR_RXOVRF)) ? 1UL : 0UL); 00479 } 00480 00481 /** 00482 * @brief Check if underrun error in transmission has been detected 00483 * @rmtoll ISR TXUNRF LL_SWPMI_IsActiveFlag_TXUNR 00484 * @param SWPMIx SWPMI Instance 00485 * @retval State of bit (1 or 0). 00486 */ 00487 __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TXUNR(SWPMI_TypeDef *SWPMIx) 00488 { 00489 return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TXUNRF) == (SWPMI_ISR_TXUNRF)) ? 1UL : 0UL); 00490 } 00491 00492 /** 00493 * @brief Check if Receive data register not empty (it means that Received data is ready 00494 * to be read in the SWPMI_RDR register) 00495 * @rmtoll ISR RXNE LL_SWPMI_IsActiveFlag_RXNE 00496 * @param SWPMIx SWPMI Instance 00497 * @retval State of bit (1 or 0). 00498 */ 00499 __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXNE(SWPMI_TypeDef *SWPMIx) 00500 { 00501 return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXNE) == (SWPMI_ISR_RXNE)) ? 1UL : 0UL); 00502 } 00503 00504 /** 00505 * @brief Check if Transmit data register is empty (it means that Data written in transmit 00506 * data register SWPMI_TDR has been transmitted and SWPMI_TDR can be written to again) 00507 * @rmtoll ISR TXE LL_SWPMI_IsActiveFlag_TXE 00508 * @param SWPMIx SWPMI Instance 00509 * @retval State of bit (1 or 0). 00510 */ 00511 __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TXE(SWPMI_TypeDef *SWPMIx) 00512 { 00513 return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TXE) == (SWPMI_ISR_TXE)) ? 1UL : 0UL); 00514 } 00515 00516 /** 00517 * @brief Check if Both transmission and reception are completed and SWP is switched to 00518 * the SUSPENDED state 00519 * @rmtoll ISR TCF LL_SWPMI_IsActiveFlag_TC 00520 * @param SWPMIx SWPMI Instance 00521 * @retval State of bit (1 or 0). 00522 */ 00523 __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TC(SWPMI_TypeDef *SWPMIx) 00524 { 00525 return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TCF) == (SWPMI_ISR_TCF)) ? 1UL : 0UL); 00526 } 00527 00528 /** 00529 * @brief Check if a Resume by slave state has been detected during the SWP bus SUSPENDED 00530 * state 00531 * @rmtoll ISR SRF LL_SWPMI_IsActiveFlag_SR 00532 * @param SWPMIx SWPMI Instance 00533 * @retval State of bit (1 or 0). 00534 */ 00535 __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_SR(SWPMI_TypeDef *SWPMIx) 00536 { 00537 return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_SRF) == (SWPMI_ISR_SRF)) ? 1UL : 0UL); 00538 } 00539 00540 /** 00541 * @brief Check if SWP bus is in SUSPENDED or DEACTIVATED state 00542 * @rmtoll ISR SUSP LL_SWPMI_IsActiveFlag_SUSP 00543 * @param SWPMIx SWPMI Instance 00544 * @retval State of bit (1 or 0). 00545 */ 00546 __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_SUSP(SWPMI_TypeDef *SWPMIx) 00547 { 00548 return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_SUSP) == (SWPMI_ISR_SUSP)) ? 1UL : 0UL); 00549 } 00550 00551 /** 00552 * @brief Check if SWP bus is in DEACTIVATED state 00553 * @rmtoll ISR DEACTF LL_SWPMI_IsActiveFlag_DEACT 00554 * @param SWPMIx SWPMI Instance 00555 * @retval State of bit (1 or 0). 00556 */ 00557 __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_DEACT(SWPMI_TypeDef *SWPMIx) 00558 { 00559 return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_DEACTF) == (SWPMI_ISR_DEACTF)) ? 1UL : 0UL); 00560 } 00561 00562 /** 00563 * @brief Clear receive buffer full flag 00564 * @rmtoll ICR CRXBFF LL_SWPMI_ClearFlag_RXBF 00565 * @param SWPMIx SWPMI Instance 00566 * @retval None 00567 */ 00568 __STATIC_INLINE void LL_SWPMI_ClearFlag_RXBF(SWPMI_TypeDef *SWPMIx) 00569 { 00570 WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CRXBFF); 00571 } 00572 00573 /** 00574 * @brief Clear transmit buffer empty flag 00575 * @rmtoll ICR CTXBEF LL_SWPMI_ClearFlag_TXBE 00576 * @param SWPMIx SWPMI Instance 00577 * @retval None 00578 */ 00579 __STATIC_INLINE void LL_SWPMI_ClearFlag_TXBE(SWPMI_TypeDef *SWPMIx) 00580 { 00581 WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTXBEF); 00582 } 00583 00584 /** 00585 * @brief Clear receive CRC error flag 00586 * @rmtoll ICR CRXBERF LL_SWPMI_ClearFlag_RXBER 00587 * @param SWPMIx SWPMI Instance 00588 * @retval None 00589 */ 00590 __STATIC_INLINE void LL_SWPMI_ClearFlag_RXBER(SWPMI_TypeDef *SWPMIx) 00591 { 00592 WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CRXBERF); 00593 } 00594 00595 /** 00596 * @brief Clear receive overrun error flag 00597 * @rmtoll ICR CRXOVRF LL_SWPMI_ClearFlag_RXOVR 00598 * @param SWPMIx SWPMI Instance 00599 * @retval None 00600 */ 00601 __STATIC_INLINE void LL_SWPMI_ClearFlag_RXOVR(SWPMI_TypeDef *SWPMIx) 00602 { 00603 WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CRXOVRF); 00604 } 00605 00606 /** 00607 * @brief Clear transmit underrun error flag 00608 * @rmtoll ICR CTXUNRF LL_SWPMI_ClearFlag_TXUNR 00609 * @param SWPMIx SWPMI Instance 00610 * @retval None 00611 */ 00612 __STATIC_INLINE void LL_SWPMI_ClearFlag_TXUNR(SWPMI_TypeDef *SWPMIx) 00613 { 00614 WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTXUNRF); 00615 } 00616 00617 /** 00618 * @brief Clear transfer complete flag 00619 * @rmtoll ICR CTCF LL_SWPMI_ClearFlag_TC 00620 * @param SWPMIx SWPMI Instance 00621 * @retval None 00622 */ 00623 __STATIC_INLINE void LL_SWPMI_ClearFlag_TC(SWPMI_TypeDef *SWPMIx) 00624 { 00625 WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTCF); 00626 } 00627 00628 /** 00629 * @brief Clear slave resume flag 00630 * @rmtoll ICR CSRF LL_SWPMI_ClearFlag_SR 00631 * @param SWPMIx SWPMI Instance 00632 * @retval None 00633 */ 00634 __STATIC_INLINE void LL_SWPMI_ClearFlag_SR(SWPMI_TypeDef *SWPMIx) 00635 { 00636 WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CSRF); 00637 } 00638 00639 /** 00640 * @} 00641 */ 00642 00643 /** @defgroup SWPMI_LL_EF_IT_Management IT_Management 00644 * @{ 00645 */ 00646 00647 /** 00648 * @brief Enable Slave resume interrupt 00649 * @rmtoll IER SRIE LL_SWPMI_EnableIT_SR 00650 * @param SWPMIx SWPMI Instance 00651 * @retval None 00652 */ 00653 __STATIC_INLINE void LL_SWPMI_EnableIT_SR(SWPMI_TypeDef *SWPMIx) 00654 { 00655 SET_BIT(SWPMIx->IER, SWPMI_IER_SRIE); 00656 } 00657 00658 /** 00659 * @brief Enable Transmit complete interrupt 00660 * @rmtoll IER TCIE LL_SWPMI_EnableIT_TC 00661 * @param SWPMIx SWPMI Instance 00662 * @retval None 00663 */ 00664 __STATIC_INLINE void LL_SWPMI_EnableIT_TC(SWPMI_TypeDef *SWPMIx) 00665 { 00666 SET_BIT(SWPMIx->IER, SWPMI_IER_TCIE); 00667 } 00668 00669 /** 00670 * @brief Enable Transmit interrupt 00671 * @rmtoll IER TIE LL_SWPMI_EnableIT_TX 00672 * @param SWPMIx SWPMI Instance 00673 * @retval None 00674 */ 00675 __STATIC_INLINE void LL_SWPMI_EnableIT_TX(SWPMI_TypeDef *SWPMIx) 00676 { 00677 SET_BIT(SWPMIx->IER, SWPMI_IER_TIE); 00678 } 00679 00680 /** 00681 * @brief Enable Receive interrupt 00682 * @rmtoll IER RIE LL_SWPMI_EnableIT_RX 00683 * @param SWPMIx SWPMI Instance 00684 * @retval None 00685 */ 00686 __STATIC_INLINE void LL_SWPMI_EnableIT_RX(SWPMI_TypeDef *SWPMIx) 00687 { 00688 SET_BIT(SWPMIx->IER, SWPMI_IER_RIE); 00689 } 00690 00691 /** 00692 * @brief Enable Transmit underrun error interrupt 00693 * @rmtoll IER TXUNRIE LL_SWPMI_EnableIT_TXUNR 00694 * @param SWPMIx SWPMI Instance 00695 * @retval None 00696 */ 00697 __STATIC_INLINE void LL_SWPMI_EnableIT_TXUNR(SWPMI_TypeDef *SWPMIx) 00698 { 00699 SET_BIT(SWPMIx->IER, SWPMI_IER_TXUNRIE); 00700 } 00701 00702 /** 00703 * @brief Enable Receive overrun error interrupt 00704 * @rmtoll IER RXOVRIE LL_SWPMI_EnableIT_RXOVR 00705 * @param SWPMIx SWPMI Instance 00706 * @retval None 00707 */ 00708 __STATIC_INLINE void LL_SWPMI_EnableIT_RXOVR(SWPMI_TypeDef *SWPMIx) 00709 { 00710 SET_BIT(SWPMIx->IER, SWPMI_IER_RXOVRIE); 00711 } 00712 00713 /** 00714 * @brief Enable Receive CRC error interrupt 00715 * @rmtoll IER RXBERIE LL_SWPMI_EnableIT_RXBER 00716 * @param SWPMIx SWPMI Instance 00717 * @retval None 00718 */ 00719 __STATIC_INLINE void LL_SWPMI_EnableIT_RXBER(SWPMI_TypeDef *SWPMIx) 00720 { 00721 SET_BIT(SWPMIx->IER, SWPMI_IER_RXBERIE); 00722 } 00723 00724 /** 00725 * @brief Enable Transmit buffer empty interrupt 00726 * @rmtoll IER TXBEIE LL_SWPMI_EnableIT_TXBE 00727 * @param SWPMIx SWPMI Instance 00728 * @retval None 00729 */ 00730 __STATIC_INLINE void LL_SWPMI_EnableIT_TXBE(SWPMI_TypeDef *SWPMIx) 00731 { 00732 SET_BIT(SWPMIx->IER, SWPMI_IER_TXBEIE); 00733 } 00734 00735 /** 00736 * @brief Enable Receive buffer full interrupt 00737 * @rmtoll IER RXBFIE LL_SWPMI_EnableIT_RXBF 00738 * @param SWPMIx SWPMI Instance 00739 * @retval None 00740 */ 00741 __STATIC_INLINE void LL_SWPMI_EnableIT_RXBF(SWPMI_TypeDef *SWPMIx) 00742 { 00743 SET_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE); 00744 } 00745 00746 /** 00747 * @brief Disable Slave resume interrupt 00748 * @rmtoll IER SRIE LL_SWPMI_DisableIT_SR 00749 * @param SWPMIx SWPMI Instance 00750 * @retval None 00751 */ 00752 __STATIC_INLINE void LL_SWPMI_DisableIT_SR(SWPMI_TypeDef *SWPMIx) 00753 { 00754 CLEAR_BIT(SWPMIx->IER, SWPMI_IER_SRIE); 00755 } 00756 00757 /** 00758 * @brief Disable Transmit complete interrupt 00759 * @rmtoll IER TCIE LL_SWPMI_DisableIT_TC 00760 * @param SWPMIx SWPMI Instance 00761 * @retval None 00762 */ 00763 __STATIC_INLINE void LL_SWPMI_DisableIT_TC(SWPMI_TypeDef *SWPMIx) 00764 { 00765 CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TCIE); 00766 } 00767 00768 /** 00769 * @brief Disable Transmit interrupt 00770 * @rmtoll IER TIE LL_SWPMI_DisableIT_TX 00771 * @param SWPMIx SWPMI Instance 00772 * @retval None 00773 */ 00774 __STATIC_INLINE void LL_SWPMI_DisableIT_TX(SWPMI_TypeDef *SWPMIx) 00775 { 00776 CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TIE); 00777 } 00778 00779 /** 00780 * @brief Disable Receive interrupt 00781 * @rmtoll IER RIE LL_SWPMI_DisableIT_RX 00782 * @param SWPMIx SWPMI Instance 00783 * @retval None 00784 */ 00785 __STATIC_INLINE void LL_SWPMI_DisableIT_RX(SWPMI_TypeDef *SWPMIx) 00786 { 00787 CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RIE); 00788 } 00789 00790 /** 00791 * @brief Disable Transmit underrun error interrupt 00792 * @rmtoll IER TXUNRIE LL_SWPMI_DisableIT_TXUNR 00793 * @param SWPMIx SWPMI Instance 00794 * @retval None 00795 */ 00796 __STATIC_INLINE void LL_SWPMI_DisableIT_TXUNR(SWPMI_TypeDef *SWPMIx) 00797 { 00798 CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TXUNRIE); 00799 } 00800 00801 /** 00802 * @brief Disable Receive overrun error interrupt 00803 * @rmtoll IER RXOVRIE LL_SWPMI_DisableIT_RXOVR 00804 * @param SWPMIx SWPMI Instance 00805 * @retval None 00806 */ 00807 __STATIC_INLINE void LL_SWPMI_DisableIT_RXOVR(SWPMI_TypeDef *SWPMIx) 00808 { 00809 CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RXOVRIE); 00810 } 00811 00812 /** 00813 * @brief Disable Receive CRC error interrupt 00814 * @rmtoll IER RXBERIE LL_SWPMI_DisableIT_RXBER 00815 * @param SWPMIx SWPMI Instance 00816 * @retval None 00817 */ 00818 __STATIC_INLINE void LL_SWPMI_DisableIT_RXBER(SWPMI_TypeDef *SWPMIx) 00819 { 00820 CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RXBERIE); 00821 } 00822 00823 /** 00824 * @brief Disable Transmit buffer empty interrupt 00825 * @rmtoll IER TXBEIE LL_SWPMI_DisableIT_TXBE 00826 * @param SWPMIx SWPMI Instance 00827 * @retval None 00828 */ 00829 __STATIC_INLINE void LL_SWPMI_DisableIT_TXBE(SWPMI_TypeDef *SWPMIx) 00830 { 00831 CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TXBEIE); 00832 } 00833 00834 /** 00835 * @brief Disable Receive buffer full interrupt 00836 * @rmtoll IER RXBFIE LL_SWPMI_DisableIT_RXBF 00837 * @param SWPMIx SWPMI Instance 00838 * @retval None 00839 */ 00840 __STATIC_INLINE void LL_SWPMI_DisableIT_RXBF(SWPMI_TypeDef *SWPMIx) 00841 { 00842 CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE); 00843 } 00844 00845 /** 00846 * @brief Check if Slave resume interrupt is enabled 00847 * @rmtoll IER SRIE LL_SWPMI_IsEnabledIT_SR 00848 * @param SWPMIx SWPMI Instance 00849 * @retval State of bit (1 or 0). 00850 */ 00851 __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_SR(SWPMI_TypeDef *SWPMIx) 00852 { 00853 return ((READ_BIT(SWPMIx->IER, SWPMI_IER_SRIE) == (SWPMI_IER_SRIE)) ? 1UL : 0UL); 00854 } 00855 00856 /** 00857 * @brief Check if Transmit complete interrupt is enabled 00858 * @rmtoll IER TCIE LL_SWPMI_IsEnabledIT_TC 00859 * @param SWPMIx SWPMI Instance 00860 * @retval State of bit (1 or 0). 00861 */ 00862 __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TC(SWPMI_TypeDef *SWPMIx) 00863 { 00864 return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TCIE) == (SWPMI_IER_TCIE)) ? 1UL : 0UL); 00865 } 00866 00867 /** 00868 * @brief Check if Transmit interrupt is enabled 00869 * @rmtoll IER TIE LL_SWPMI_IsEnabledIT_TX 00870 * @param SWPMIx SWPMI Instance 00871 * @retval State of bit (1 or 0). 00872 */ 00873 __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TX(SWPMI_TypeDef *SWPMIx) 00874 { 00875 return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TIE) == (SWPMI_IER_TIE)) ? 1UL : 0UL); 00876 } 00877 00878 /** 00879 * @brief Check if Receive interrupt is enabled 00880 * @rmtoll IER RIE LL_SWPMI_IsEnabledIT_RX 00881 * @param SWPMIx SWPMI Instance 00882 * @retval State of bit (1 or 0). 00883 */ 00884 __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RX(SWPMI_TypeDef *SWPMIx) 00885 { 00886 return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RIE) == (SWPMI_IER_RIE)) ? 1UL : 0UL); 00887 } 00888 00889 /** 00890 * @brief Check if Transmit underrun error interrupt is enabled 00891 * @rmtoll IER TXUNRIE LL_SWPMI_IsEnabledIT_TXUNR 00892 * @param SWPMIx SWPMI Instance 00893 * @retval State of bit (1 or 0). 00894 */ 00895 __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TXUNR(SWPMI_TypeDef *SWPMIx) 00896 { 00897 return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TXUNRIE) == (SWPMI_IER_TXUNRIE)) ? 1UL : 0UL); 00898 } 00899 00900 /** 00901 * @brief Check if Receive overrun error interrupt is enabled 00902 * @rmtoll IER RXOVRIE LL_SWPMI_IsEnabledIT_RXOVR 00903 * @param SWPMIx SWPMI Instance 00904 * @retval State of bit (1 or 0). 00905 */ 00906 __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RXOVR(SWPMI_TypeDef *SWPMIx) 00907 { 00908 return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RXOVRIE) == (SWPMI_IER_RXOVRIE)) ? 1UL : 0UL); 00909 } 00910 00911 /** 00912 * @brief Check if Receive CRC error interrupt is enabled 00913 * @rmtoll IER RXBERIE LL_SWPMI_IsEnabledIT_RXBER 00914 * @param SWPMIx SWPMI Instance 00915 * @retval State of bit (1 or 0). 00916 */ 00917 __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RXBER(SWPMI_TypeDef *SWPMIx) 00918 { 00919 return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RXBERIE) == (SWPMI_IER_RXBERIE)) ? 1UL : 0UL); 00920 } 00921 00922 /** 00923 * @brief Check if Transmit buffer empty interrupt is enabled 00924 * @rmtoll IER TXBEIE LL_SWPMI_IsEnabledIT_TXBE 00925 * @param SWPMIx SWPMI Instance 00926 * @retval State of bit (1 or 0). 00927 */ 00928 __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TXBE(SWPMI_TypeDef *SWPMIx) 00929 { 00930 return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TXBEIE) == (SWPMI_IER_TXBEIE)) ? 1UL : 0UL); 00931 } 00932 00933 /** 00934 * @brief Check if Receive buffer full interrupt is enabled 00935 * @rmtoll IER RXBFIE LL_SWPMI_IsEnabledIT_RXBF 00936 * @param SWPMIx SWPMI Instance 00937 * @retval State of bit (1 or 0). 00938 */ 00939 __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RXBF(SWPMI_TypeDef *SWPMIx) 00940 { 00941 return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE) == (SWPMI_IER_RXBFIE)) ? 1UL : 0UL); 00942 } 00943 00944 /** 00945 * @} 00946 */ 00947 00948 /** @defgroup SWPMI_LL_EF_DMA_Management DMA_Management 00949 * @{ 00950 */ 00951 00952 /** 00953 * @brief Enable DMA mode for reception 00954 * @rmtoll CR RXDMA LL_SWPMI_EnableDMAReq_RX 00955 * @param SWPMIx SWPMI Instance 00956 * @retval None 00957 */ 00958 __STATIC_INLINE void LL_SWPMI_EnableDMAReq_RX(SWPMI_TypeDef *SWPMIx) 00959 { 00960 SET_BIT(SWPMIx->CR, SWPMI_CR_RXDMA); 00961 } 00962 00963 /** 00964 * @brief Disable DMA mode for reception 00965 * @rmtoll CR RXDMA LL_SWPMI_DisableDMAReq_RX 00966 * @param SWPMIx SWPMI Instance 00967 * @retval None 00968 */ 00969 __STATIC_INLINE void LL_SWPMI_DisableDMAReq_RX(SWPMI_TypeDef *SWPMIx) 00970 { 00971 CLEAR_BIT(SWPMIx->CR, SWPMI_CR_RXDMA); 00972 } 00973 00974 /** 00975 * @brief Check if DMA mode for reception is enabled 00976 * @rmtoll CR RXDMA LL_SWPMI_IsEnabledDMAReq_RX 00977 * @param SWPMIx SWPMI Instance 00978 * @retval State of bit (1 or 0). 00979 */ 00980 __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledDMAReq_RX(SWPMI_TypeDef *SWPMIx) 00981 { 00982 return ((READ_BIT(SWPMIx->CR, SWPMI_CR_RXDMA) == (SWPMI_CR_RXDMA)) ? 1UL : 0UL); 00983 } 00984 00985 /** 00986 * @brief Enable DMA mode for transmission 00987 * @rmtoll CR TXDMA LL_SWPMI_EnableDMAReq_TX 00988 * @param SWPMIx SWPMI Instance 00989 * @retval None 00990 */ 00991 __STATIC_INLINE void LL_SWPMI_EnableDMAReq_TX(SWPMI_TypeDef *SWPMIx) 00992 { 00993 SET_BIT(SWPMIx->CR, SWPMI_CR_TXDMA); 00994 } 00995 00996 /** 00997 * @brief Disable DMA mode for transmission 00998 * @rmtoll CR TXDMA LL_SWPMI_DisableDMAReq_TX 00999 * @param SWPMIx SWPMI Instance 01000 * @retval None 01001 */ 01002 __STATIC_INLINE void LL_SWPMI_DisableDMAReq_TX(SWPMI_TypeDef *SWPMIx) 01003 { 01004 CLEAR_BIT(SWPMIx->CR, SWPMI_CR_TXDMA); 01005 } 01006 01007 /** 01008 * @brief Check if DMA mode for transmission is enabled 01009 * @rmtoll CR TXDMA LL_SWPMI_IsEnabledDMAReq_TX 01010 * @param SWPMIx SWPMI Instance 01011 * @retval State of bit (1 or 0). 01012 */ 01013 __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledDMAReq_TX(SWPMI_TypeDef *SWPMIx) 01014 { 01015 return ((READ_BIT(SWPMIx->CR, SWPMI_CR_TXDMA) == (SWPMI_CR_TXDMA)) ? 1UL : 0UL); 01016 } 01017 01018 /** 01019 * @brief Get the data register address used for DMA transfer 01020 * @rmtoll TDR TD LL_SWPMI_DMA_GetRegAddr\n 01021 * RDR RD LL_SWPMI_DMA_GetRegAddr 01022 * @param SWPMIx SWPMI Instance 01023 * @param Direction This parameter can be one of the following values: 01024 * @arg @ref LL_SWPMI_DMA_REG_DATA_TRANSMIT 01025 * @arg @ref LL_SWPMI_DMA_REG_DATA_RECEIVE 01026 * @retval Address of data register 01027 */ 01028 __STATIC_INLINE uint32_t LL_SWPMI_DMA_GetRegAddr(SWPMI_TypeDef *SWPMIx, uint32_t Direction) 01029 { 01030 uint32_t data_reg_addr; 01031 01032 if (Direction == LL_SWPMI_DMA_REG_DATA_TRANSMIT) 01033 { 01034 /* return address of TDR register */ 01035 data_reg_addr = (uint32_t)&(SWPMIx->TDR); 01036 } 01037 else 01038 { 01039 /* return address of RDR register */ 01040 data_reg_addr = (uint32_t)&(SWPMIx->RDR); 01041 } 01042 01043 return data_reg_addr; 01044 } 01045 01046 /** 01047 * @} 01048 */ 01049 01050 /** @defgroup SWPMI_LL_EF_Data_Management Data_Management 01051 * @{ 01052 */ 01053 01054 /** 01055 * @brief Retrieve number of data bytes present in payload of received frame 01056 * @rmtoll RFL RFL LL_SWPMI_GetReceiveFrameLength 01057 * @param SWPMIx SWPMI Instance 01058 * @retval Value between Min_Data=0x00 and Max_Data=0x1F 01059 */ 01060 __STATIC_INLINE uint32_t LL_SWPMI_GetReceiveFrameLength(SWPMI_TypeDef *SWPMIx) 01061 { 01062 return (uint32_t)(READ_BIT(SWPMIx->RFL, SWPMI_RFL_RFL)); 01063 } 01064 01065 /** 01066 * @brief Transmit Data Register 01067 * @rmtoll TDR TD LL_SWPMI_TransmitData32 01068 * @param SWPMIx SWPMI Instance 01069 * @param TxData Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF 01070 * @retval None 01071 */ 01072 __STATIC_INLINE void LL_SWPMI_TransmitData32(SWPMI_TypeDef *SWPMIx, uint32_t TxData) 01073 { 01074 WRITE_REG(SWPMIx->TDR, TxData); 01075 } 01076 01077 /** 01078 * @brief Receive Data Register 01079 * @rmtoll RDR RD LL_SWPMI_ReceiveData32 01080 * @param SWPMIx SWPMI Instance 01081 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF 01082 */ 01083 __STATIC_INLINE uint32_t LL_SWPMI_ReceiveData32(SWPMI_TypeDef *SWPMIx) 01084 { 01085 return (uint32_t)(READ_BIT(SWPMIx->RDR, SWPMI_RDR_RD)); 01086 } 01087 01088 /** 01089 * @brief Enable SWP Transceiver Bypass 01090 * @note The external interface for SWPMI is SWPMI_IO 01091 * (SWPMI_RX, SWPMI_TX and SWPMI_SUSPEND signals are not available on GPIOs) 01092 * @rmtoll OR TBYP LL_SWPMI_EnableTXBypass 01093 * @param SWPMIx SWPMI Instance 01094 * @retval None 01095 */ 01096 __STATIC_INLINE void LL_SWPMI_EnableTXBypass(SWPMI_TypeDef *SWPMIx) 01097 { 01098 CLEAR_BIT(SWPMIx->OR, SWPMI_OR_TBYP); 01099 } 01100 01101 /** 01102 * @brief Disable SWP Transceiver Bypass 01103 * @note SWPMI_RX, SWPMI_TX and SWPMI_SUSPEND signals are available as alternate 01104 * function on GPIOs. This configuration is selected to connect an external transceiver 01105 * @rmtoll OR TBYP LL_SWPMI_DisableTXBypass 01106 * @param SWPMIx SWPMI Instance 01107 * @retval None 01108 */ 01109 __STATIC_INLINE void LL_SWPMI_DisableTXBypass(SWPMI_TypeDef *SWPMIx) 01110 { 01111 SET_BIT(SWPMIx->OR, SWPMI_OR_TBYP); 01112 } 01113 01114 /** 01115 * @} 01116 */ 01117 01118 #if defined(USE_FULL_LL_DRIVER) 01119 /** @defgroup SWPMI_LL_EF_Init Initialization and de-initialization functions 01120 * @{ 01121 */ 01122 01123 ErrorStatus LL_SWPMI_DeInit(SWPMI_TypeDef *SWPMIx); 01124 ErrorStatus LL_SWPMI_Init(SWPMI_TypeDef *SWPMIx, LL_SWPMI_InitTypeDef *SWPMI_InitStruct); 01125 void LL_SWPMI_StructInit(LL_SWPMI_InitTypeDef *SWPMI_InitStruct); 01126 01127 /** 01128 * @} 01129 */ 01130 #endif /*USE_FULL_LL_DRIVER*/ 01131 01132 /** 01133 * @} 01134 */ 01135 01136 /** 01137 * @} 01138 */ 01139 01140 #endif /* SWPMI1 */ 01141 01142 /** 01143 * @} 01144 */ 01145 01146 #ifdef __cplusplus 01147 } 01148 #endif 01149 01150 #endif /* STM32L4xx_LL_SWPMI_H */