You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1243 lines
38 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32h7xx_ll_swpmi.h
  4. * @author MCD Application Team
  5. * @brief Header file of SWPMI LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32H7xx_LL_SWPMI_H
  21. #define STM32H7xx_LL_SWPMI_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32h7xx.h"
  27. /** @addtogroup STM32H7xx_LL_Driver
  28. * @{
  29. */
  30. /** @defgroup SWPMI_LL SWPMI
  31. * @{
  32. */
  33. /* Private types -------------------------------------------------------------*/
  34. /* Private variables ---------------------------------------------------------*/
  35. /* Private constants ---------------------------------------------------------*/
  36. /* Private macros ------------------------------------------------------------*/
  37. #if defined(USE_FULL_LL_DRIVER)
  38. /** @defgroup SWPMI_LL_Private_Macros SWPMI Private Macros
  39. * @{
  40. */
  41. /**
  42. * @}
  43. */
  44. #endif /*USE_FULL_LL_DRIVER*/
  45. /* Exported types ------------------------------------------------------------*/
  46. #if defined(USE_FULL_LL_DRIVER)
  47. /** @defgroup SWPMI_LL_ES_INIT SWPMI Exported Init structure
  48. * @{
  49. */
  50. /**
  51. * @brief SWPMI Init structures definition
  52. */
  53. typedef struct
  54. {
  55. uint32_t VoltageClass; /*!< Specifies the SWP Voltage Class.
  56. This parameter can be a value of @ref SWPMI_LL_EC_VOLTAGE_CLASS
  57. This feature can be modified afterwards using unitary function @ref LL_SWPMI_SetVoltageClass. */
  58. uint32_t BitRatePrescaler; /*!< Specifies the SWPMI bitrate prescaler.
  59. This parameter must be a number between Min_Data=0 and Max_Data=255U.
  60. The value can be calculated thanks to helper macro @ref __LL_SWPMI_CALC_BITRATE_PRESCALER
  61. This feature can be modified afterwards using unitary function @ref LL_SWPMI_SetBitRatePrescaler. */
  62. uint32_t TxBufferingMode; /*!< Specifies the transmission buffering mode.
  63. This parameter can be a value of @ref SWPMI_LL_EC_SW_BUFFER_TX
  64. This feature can be modified afterwards using unitary function @ref LL_SWPMI_SetTransmissionMode. */
  65. uint32_t RxBufferingMode; /*!< Specifies the reception buffering mode.
  66. This parameter can be a value of @ref SWPMI_LL_EC_SW_BUFFER_RX
  67. This feature can be modified afterwards using unitary function @ref LL_SWPMI_SetReceptionMode. */
  68. } LL_SWPMI_InitTypeDef;
  69. /**
  70. * @}
  71. */
  72. #endif /* USE_FULL_LL_DRIVER */
  73. /* Exported constants --------------------------------------------------------*/
  74. /** @defgroup SWPMI_LL_Exported_Constants SWPMI Exported Constants
  75. * @{
  76. */
  77. /** @defgroup SWPMI_LL_EC_CLEAR_FLAG Clear Flags Defines
  78. * @brief Flags defines which can be used with LL_SWPMI_WriteReg function
  79. * @{
  80. */
  81. #define LL_SWPMI_ICR_CRXBFF SWPMI_ICR_CRXBFF /*!< Clear receive buffer full flag */
  82. #define LL_SWPMI_ICR_CTXBEF SWPMI_ICR_CTXBEF /*!< Clear transmit buffer empty flag */
  83. #define LL_SWPMI_ICR_CRXBERF SWPMI_ICR_CRXBERF /*!< Clear receive CRC error flag */
  84. #define LL_SWPMI_ICR_CRXOVRF SWPMI_ICR_CRXOVRF /*!< Clear receive overrun error flag */
  85. #define LL_SWPMI_ICR_CTXUNRF SWPMI_ICR_CTXUNRF /*!< Clear transmit underrun error flag */
  86. #define LL_SWPMI_ICR_CTCF SWPMI_ICR_CTCF /*!< Clear transfer complete flag */
  87. #define LL_SWPMI_ICR_CSRF SWPMI_ICR_CSRF /*!< Clear slave resume flag */
  88. /**
  89. * @}
  90. */
  91. /** @defgroup SWPMI_LL_EC_GET_FLAG Get Flags Defines
  92. * @brief Flags defines which can be used with LL_SWPMI_ReadReg function
  93. * @{
  94. */
  95. #define LL_SWPMI_ISR_RXBFF SWPMI_ISR_RXBFF /*!< Receive buffer full flag */
  96. #define LL_SWPMI_ISR_TXBEF SWPMI_ISR_TXBEF /*!< Transmit buffer empty flag */
  97. #define LL_SWPMI_ISR_RXBERF SWPMI_ISR_RXBERF /*!< Receive CRC error flag */
  98. #define LL_SWPMI_ISR_RXOVRF SWPMI_ISR_RXOVRF /*!< Receive overrun error flag */
  99. #define LL_SWPMI_ISR_TXUNRF SWPMI_ISR_TXUNRF /*!< Transmit underrun error flag */
  100. #define LL_SWPMI_ISR_RXNE SWPMI_ISR_RXNE /*!< Receive data register not empty */
  101. #define LL_SWPMI_ISR_TXE SWPMI_ISR_TXE /*!< Transmit data register empty */
  102. #define LL_SWPMI_ISR_TCF SWPMI_ISR_TCF /*!< Transfer complete flag */
  103. #define LL_SWPMI_ISR_SRF SWPMI_ISR_SRF /*!< Slave resume flag */
  104. #define LL_SWPMI_ISR_SUSP SWPMI_ISR_SUSP /*!< SUSPEND flag */
  105. #define LL_SWPMI_ISR_DEACTF SWPMI_ISR_DEACTF /*!< DEACTIVATED flag */
  106. /**
  107. * @}
  108. */
  109. /** @defgroup SWPMI_LL_EC_IT IT Defines
  110. * @brief IT defines which can be used with LL_SWPMI_ReadReg and LL_SWPMI_WriteReg functions
  111. * @{
  112. */
  113. #define LL_SWPMI_IER_SRIE SWPMI_IER_SRIE /*!< Slave resume interrupt enable */
  114. #define LL_SWPMI_IER_TCIE SWPMI_IER_TCIE /*!< Transmit complete interrupt enable */
  115. #define LL_SWPMI_IER_TIE SWPMI_IER_TIE /*!< Transmit interrupt enable */
  116. #define LL_SWPMI_IER_RIE SWPMI_IER_RIE /*!< Receive interrupt enable */
  117. #define LL_SWPMI_IER_TXUNRIE SWPMI_IER_TXUNRIE /*!< Transmit underrun error interrupt enable */
  118. #define LL_SWPMI_IER_RXOVRIE SWPMI_IER_RXOVRIE /*!< Receive overrun error interrupt enable */
  119. #define LL_SWPMI_IER_RXBERIE SWPMI_IER_RXBERIE /*!< Receive CRC error interrupt enable */
  120. #define LL_SWPMI_IER_TXBEIE SWPMI_IER_TXBEIE /*!< Transmit buffer empty interrupt enable */
  121. #define LL_SWPMI_IER_RXBFIE SWPMI_IER_RXBFIE /*!< Receive buffer full interrupt enable */
  122. /**
  123. * @}
  124. */
  125. /** @defgroup SWPMI_LL_EC_SW_BUFFER_RX SW BUFFER RX
  126. * @{
  127. */
  128. #define LL_SWPMI_SW_BUFFER_RX_SINGLE ((uint32_t)0x00000000) /*!< Single software buffer mode for reception */
  129. #define LL_SWPMI_SW_BUFFER_RX_MULTI SWPMI_CR_RXMODE /*!< Multi software buffermode for reception */
  130. /**
  131. * @}
  132. */
  133. /** @defgroup SWPMI_LL_EC_SW_BUFFER_TX SW BUFFER TX
  134. * @{
  135. */
  136. #define LL_SWPMI_SW_BUFFER_TX_SINGLE ((uint32_t)0x00000000) /*!< Single software buffer mode for transmission */
  137. #define LL_SWPMI_SW_BUFFER_TX_MULTI SWPMI_CR_TXMODE /*!< Multi software buffermode for transmission */
  138. /**
  139. * @}
  140. */
  141. /** @defgroup SWPMI_LL_EC_VOLTAGE_CLASS VOLTAGE CLASS
  142. * @{
  143. */
  144. #define LL_SWPMI_VOLTAGE_CLASS_C ((uint32_t)0x00000000) /*!< SWPMI_IO uses directly VDD voltage to operate in class C */
  145. #define LL_SWPMI_VOLTAGE_CLASS_B SWPMI_OR_CLASS /*!< SWPMI_IO uses an internal voltage regulator to operate in class B */
  146. /**
  147. * @}
  148. */
  149. /** @defgroup SWPMI_LL_EC_DMA_REG_DATA DMA register data
  150. * @{
  151. */
  152. #define LL_SWPMI_DMA_REG_DATA_TRANSMIT (uint32_t)0 /*!< Get address of data register used for transmission */
  153. #define LL_SWPMI_DMA_REG_DATA_RECEIVE (uint32_t)1 /*!< Get address of data register used for reception */
  154. /**
  155. * @}
  156. */
  157. /**
  158. * @}
  159. */
  160. /* Exported macro ------------------------------------------------------------*/
  161. /** @defgroup SWPMI_LL_Exported_Macros SWPMI Exported Macros
  162. * @{
  163. */
  164. /** @defgroup SWPMI_LL_EM_WRITE_READ Common Write and read registers Macros
  165. * @{
  166. */
  167. /**
  168. * @brief Write a value in SWPMI register
  169. * @param __INSTANCE__ SWPMI Instance
  170. * @param __REG__ Register to be written
  171. * @param __VALUE__ Value to be written in the register
  172. * @retval None
  173. */
  174. #define LL_SWPMI_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
  175. /**
  176. * @brief Read a value in SWPMI register
  177. * @param __INSTANCE__ SWPMI Instance
  178. * @param __REG__ Register to be read
  179. * @retval Register value
  180. */
  181. #define LL_SWPMI_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
  182. /**
  183. * @}
  184. */
  185. /** @defgroup SWPMI_LL_EM_BitRate Bit rate calculation helper Macros
  186. * @{
  187. */
  188. /**
  189. * @brief Helper macro to calculate bit rate value to set in BRR register (@ref LL_SWPMI_SetBitRatePrescaler function)
  190. * @note ex: @ref __LL_SWPMI_CALC_BITRATE_PRESCALER(2000000, 80000000);
  191. * @param __FSWP__ Within the following range: from 100 Kbit/s up to 2Mbit/s (in bit/s)
  192. * @param __FSWPCLK__ PCLK or HSI frequency (in Hz)
  193. * @retval Bitrate prescaler (BRR register)
  194. */
  195. #define __LL_SWPMI_CALC_BITRATE_PRESCALER(__FSWP__, __FSWPCLK__) ((uint32_t)(((__FSWPCLK__) / ((__FSWP__) * 4)) - 1))
  196. /**
  197. * @}
  198. */
  199. /**
  200. * @}
  201. */
  202. /* Exported functions --------------------------------------------------------*/
  203. /** @defgroup SWPMI_LL_Exported_Functions SWPMI Exported Functions
  204. * @{
  205. */
  206. /** @defgroup SWPMI_LL_EF_Configuration Configuration
  207. * @{
  208. */
  209. /**
  210. * @brief Set Reception buffering mode
  211. * @note If Multi software buffer mode is chosen, RXDMA bits must also be set.
  212. * @rmtoll CR RXMODE LL_SWPMI_SetReceptionMode
  213. * @param SWPMIx SWPMI Instance
  214. * @param RxBufferingMode This parameter can be one of the following values:
  215. * @arg @ref LL_SWPMI_SW_BUFFER_RX_SINGLE
  216. * @arg @ref LL_SWPMI_SW_BUFFER_RX_MULTI
  217. * @retval None
  218. */
  219. __STATIC_INLINE void LL_SWPMI_SetReceptionMode(SWPMI_TypeDef *SWPMIx, uint32_t RxBufferingMode)
  220. {
  221. MODIFY_REG(SWPMIx->CR, SWPMI_CR_RXMODE, RxBufferingMode);
  222. }
  223. /**
  224. * @brief Get Reception buffering mode
  225. * @rmtoll CR RXMODE LL_SWPMI_GetReceptionMode
  226. * @param SWPMIx SWPMI Instance
  227. * @retval Returned value can be one of the following values:
  228. * @arg @ref LL_SWPMI_SW_BUFFER_RX_SINGLE
  229. * @arg @ref LL_SWPMI_SW_BUFFER_RX_MULTI
  230. */
  231. __STATIC_INLINE uint32_t LL_SWPMI_GetReceptionMode(SWPMI_TypeDef *SWPMIx)
  232. {
  233. return (uint32_t)(READ_BIT(SWPMIx->CR, SWPMI_CR_RXMODE));
  234. }
  235. /**
  236. * @brief Set Transmission buffering mode
  237. * @note If Multi software buffer mode is chosen, TXDMA bits must also be set.
  238. * @rmtoll CR TXMODE LL_SWPMI_SetTransmissionMode
  239. * @param SWPMIx SWPMI Instance
  240. * @param TxBufferingMode This parameter can be one of the following values:
  241. * @arg @ref LL_SWPMI_SW_BUFFER_TX_SINGLE
  242. * @arg @ref LL_SWPMI_SW_BUFFER_TX_MULTI
  243. * @retval None
  244. */
  245. __STATIC_INLINE void LL_SWPMI_SetTransmissionMode(SWPMI_TypeDef *SWPMIx, uint32_t TxBufferingMode)
  246. {
  247. MODIFY_REG(SWPMIx->CR, SWPMI_CR_TXMODE, TxBufferingMode);
  248. }
  249. /**
  250. * @brief Get Transmission buffering mode
  251. * @rmtoll CR TXMODE LL_SWPMI_GetTransmissionMode
  252. * @param SWPMIx SWPMI Instance
  253. * @retval Returned value can be one of the following values:
  254. * @arg @ref LL_SWPMI_SW_BUFFER_TX_SINGLE
  255. * @arg @ref LL_SWPMI_SW_BUFFER_TX_MULTI
  256. */
  257. __STATIC_INLINE uint32_t LL_SWPMI_GetTransmissionMode(SWPMI_TypeDef *SWPMIx)
  258. {
  259. return (uint32_t)(READ_BIT(SWPMIx->CR, SWPMI_CR_TXMODE));
  260. }
  261. /**
  262. * @brief Enable loopback mode
  263. * @rmtoll CR LPBK LL_SWPMI_EnableLoopback
  264. * @param SWPMIx SWPMI Instance
  265. * @retval None
  266. */
  267. __STATIC_INLINE void LL_SWPMI_EnableLoopback(SWPMI_TypeDef *SWPMIx)
  268. {
  269. SET_BIT(SWPMIx->CR, SWPMI_CR_LPBK);
  270. }
  271. /**
  272. * @brief Disable loopback mode
  273. * @rmtoll CR LPBK LL_SWPMI_DisableLoopback
  274. * @param SWPMIx SWPMI Instance
  275. * @retval None
  276. */
  277. __STATIC_INLINE void LL_SWPMI_DisableLoopback(SWPMI_TypeDef *SWPMIx)
  278. {
  279. CLEAR_BIT(SWPMIx->CR, SWPMI_CR_LPBK);
  280. }
  281. /**
  282. * @brief Enable SWPMI transceiver
  283. * @note SWPMI_IO pin is controlled by SWPMI
  284. * @rmtoll CR SWPEN LL_SWPMI_EnableTransceiver
  285. * @param SWPMIx SWPMI Instance
  286. * @retval None
  287. */
  288. __STATIC_INLINE void LL_SWPMI_EnableTransceiver(SWPMI_TypeDef *SWPMIx)
  289. {
  290. SET_BIT(SWPMIx->CR, SWPMI_CR_SWPEN);
  291. }
  292. /**
  293. * @brief Disable SWPMI transceiver
  294. * @note SWPMI_IO pin is controlled by GPIO controller
  295. * @rmtoll CR SWPEN LL_SWPMI_DisableTransceiver
  296. * @param SWPMIx SWPMI Instance
  297. * @retval None
  298. */
  299. __STATIC_INLINE void LL_SWPMI_DisableTransceiver(SWPMI_TypeDef *SWPMIx)
  300. {
  301. CLEAR_BIT(SWPMIx->CR, SWPMI_CR_SWPEN);
  302. }
  303. /**
  304. * @brief Check if SWPMI transceiver is enabled
  305. * @rmtoll CR SWPEN LL_SWPMI_IsEnabledTransceiver
  306. * @param SWPMIx SWPMI Instance
  307. * @retval State of bit (1 or 0).
  308. */
  309. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledTransceiver(SWPMI_TypeDef *SWPMIx)
  310. {
  311. return ((READ_BIT(SWPMIx->CR, SWPMI_CR_SWPEN) == (SWPMI_CR_SWPEN)) ? 1UL : 0UL);
  312. }
  313. /**
  314. * @brief Activate Single wire protocol bus (SUSPENDED or ACTIVATED state)
  315. * @note SWP bus stays in the ACTIVATED state as long as there is a communication
  316. * with the slave, either in transmission or in reception. The SWP bus switches back
  317. * to the SUSPENDED state as soon as there is no more transmission or reception
  318. * activity, after 7 idle bits.
  319. * @rmtoll CR SWPACT LL_SWPMI_Activate
  320. * @param SWPMIx SWPMI Instance
  321. * @retval None
  322. */
  323. __STATIC_INLINE void LL_SWPMI_Activate(SWPMI_TypeDef *SWPMIx)
  324. {
  325. /* In order to activate SWP again, the software must clear DEACT bit*/
  326. CLEAR_BIT(SWPMIx->CR, SWPMI_CR_DEACT);
  327. /* Set SWACT bit */
  328. SET_BIT(SWPMIx->CR, SWPMI_CR_SWPACT);
  329. }
  330. /**
  331. * @brief Check if Single wire protocol bus is in ACTIVATED state.
  332. * @rmtoll CR SWPACT LL_SWPMI_Activate
  333. * @param SWPMIx SWPMI Instance
  334. * @retval State of bit (1 or 0).
  335. */
  336. __STATIC_INLINE uint32_t LL_SWPMI_IsActivated(SWPMI_TypeDef *SWPMIx)
  337. {
  338. return ((READ_BIT(SWPMIx->CR, SWPMI_CR_SWPACT) == (SWPMI_CR_SWPACT)) ? 1UL : 0UL);
  339. }
  340. /**
  341. * @brief Deactivate immediately Single wire protocol bus (immediate transition to
  342. * DEACTIVATED state)
  343. * @rmtoll CR SWPACT LL_SWPMI_Deactivate
  344. * @param SWPMIx SWPMI Instance
  345. * @retval None
  346. */
  347. __STATIC_INLINE void LL_SWPMI_Deactivate(SWPMI_TypeDef *SWPMIx)
  348. {
  349. CLEAR_BIT(SWPMIx->CR, SWPMI_CR_SWPACT);
  350. }
  351. /**
  352. * @brief Request a deactivation of Single wire protocol bus (request to go in DEACTIVATED
  353. * state if no resume from slave)
  354. * @rmtoll CR DEACT LL_SWPMI_RequestDeactivation
  355. * @param SWPMIx SWPMI Instance
  356. * @retval None
  357. */
  358. __STATIC_INLINE void LL_SWPMI_RequestDeactivation(SWPMI_TypeDef *SWPMIx)
  359. {
  360. SET_BIT(SWPMIx->CR, SWPMI_CR_DEACT);
  361. }
  362. /**
  363. * @brief Set Bitrate prescaler SWPMI_freq = SWPMI_clk / (((BitRate) + 1) * 4)
  364. * @rmtoll BRR BR LL_SWPMI_SetBitRatePrescaler
  365. * @param SWPMIx SWPMI Instance
  366. * @param BitRatePrescaler A number between Min_Data=0 and Max_Data=255U
  367. * @retval None
  368. */
  369. __STATIC_INLINE void LL_SWPMI_SetBitRatePrescaler(SWPMI_TypeDef *SWPMIx, uint32_t BitRatePrescaler)
  370. {
  371. WRITE_REG(SWPMIx->BRR, BitRatePrescaler);
  372. }
  373. /**
  374. * @brief Get Bitrate prescaler
  375. * @rmtoll BRR BR LL_SWPMI_GetBitRatePrescaler
  376. * @param SWPMIx SWPMI Instance
  377. * @retval A number between Min_Data=0 and Max_Data=255U
  378. */
  379. __STATIC_INLINE uint32_t LL_SWPMI_GetBitRatePrescaler(SWPMI_TypeDef *SWPMIx)
  380. {
  381. return (uint32_t)(READ_BIT(SWPMIx->BRR, SWPMI_BRR_BR));
  382. }
  383. /**
  384. * @brief Set SWP Voltage Class
  385. * @rmtoll OR CLASS LL_SWPMI_SetVoltageClass
  386. * @param SWPMIx SWPMI Instance
  387. * @param VoltageClass This parameter can be one of the following values:
  388. * @arg @ref LL_SWPMI_VOLTAGE_CLASS_C
  389. * @arg @ref LL_SWPMI_VOLTAGE_CLASS_B
  390. * @retval None
  391. */
  392. __STATIC_INLINE void LL_SWPMI_SetVoltageClass(SWPMI_TypeDef *SWPMIx, uint32_t VoltageClass)
  393. {
  394. MODIFY_REG(SWPMIx->OR, SWPMI_OR_CLASS, VoltageClass);
  395. }
  396. /**
  397. * @brief Get SWP Voltage Class
  398. * @rmtoll OR CLASS LL_SWPMI_GetVoltageClass
  399. * @param SWPMIx SWPMI Instance
  400. * @retval Returned value can be one of the following values:
  401. * @arg @ref LL_SWPMI_VOLTAGE_CLASS_C
  402. * @arg @ref LL_SWPMI_VOLTAGE_CLASS_B
  403. */
  404. __STATIC_INLINE uint32_t LL_SWPMI_GetVoltageClass(SWPMI_TypeDef *SWPMIx)
  405. {
  406. return (uint32_t)(READ_BIT(SWPMIx->OR, SWPMI_OR_CLASS));
  407. }
  408. /**
  409. * @}
  410. */
  411. /** @defgroup SWPMI_LL_EF_FLAG_Management FLAG_Management
  412. * @{
  413. */
  414. /**
  415. * @brief Check if the last word of the frame under reception has arrived in SWPMI_RDR.
  416. * @rmtoll ISR RXBFF LL_SWPMI_IsActiveFlag_RXBF
  417. * @param SWPMIx SWPMI Instance
  418. * @retval State of bit (1 or 0).
  419. */
  420. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXBF(SWPMI_TypeDef *SWPMIx)
  421. {
  422. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXBFF) == (SWPMI_ISR_RXBFF)) ? 1UL : 0UL);
  423. }
  424. /**
  425. * @brief Check if Frame transmission buffer has been emptied
  426. * @rmtoll ISR TXBEF LL_SWPMI_IsActiveFlag_TXBE
  427. * @param SWPMIx SWPMI Instance
  428. * @retval State of bit (1 or 0).
  429. */
  430. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TXBE(SWPMI_TypeDef *SWPMIx)
  431. {
  432. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TXBEF) == (SWPMI_ISR_TXBEF)) ? 1UL : 0UL);
  433. }
  434. /**
  435. * @brief Check if CRC error in reception has been detected
  436. * @rmtoll ISR RXBERF LL_SWPMI_IsActiveFlag_RXBER
  437. * @param SWPMIx SWPMI Instance
  438. * @retval State of bit (1 or 0).
  439. */
  440. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXBER(SWPMI_TypeDef *SWPMIx)
  441. {
  442. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXBERF) == (SWPMI_ISR_RXBERF)) ? 1UL : 0UL);
  443. }
  444. /**
  445. * @brief Check if Overrun in reception has been detected
  446. * @rmtoll ISR RXOVRF LL_SWPMI_IsActiveFlag_RXOVR
  447. * @param SWPMIx SWPMI Instance
  448. * @retval State of bit (1 or 0).
  449. */
  450. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXOVR(SWPMI_TypeDef *SWPMIx)
  451. {
  452. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXOVRF) == (SWPMI_ISR_RXOVRF)) ? 1UL : 0UL);
  453. }
  454. /**
  455. * @brief Check if underrun error in transmission has been detected
  456. * @rmtoll ISR TXUNRF LL_SWPMI_IsActiveFlag_TXUNR
  457. * @param SWPMIx SWPMI Instance
  458. * @retval State of bit (1 or 0).
  459. */
  460. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TXUNR(SWPMI_TypeDef *SWPMIx)
  461. {
  462. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TXUNRF) == (SWPMI_ISR_TXUNRF)) ? 1UL : 0UL);
  463. }
  464. /**
  465. * @brief Check if Receive data register not empty (it means that Received data is ready
  466. * to be read in the SWPMI_RDR register)
  467. * @rmtoll ISR RXNE LL_SWPMI_IsActiveFlag_RXNE
  468. * @param SWPMIx SWPMI Instance
  469. * @retval State of bit (1 or 0).
  470. */
  471. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXNE(SWPMI_TypeDef *SWPMIx)
  472. {
  473. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXNE) == (SWPMI_ISR_RXNE)) ? 1UL : 0UL);
  474. }
  475. /**
  476. * @brief Check if Transmit data register is empty (it means that Data written in transmit
  477. * data register SWPMI_TDR has been transmitted and SWPMI_TDR can be written to again)
  478. * @rmtoll ISR TXE LL_SWPMI_IsActiveFlag_TXE
  479. * @param SWPMIx SWPMI Instance
  480. * @retval State of bit (1 or 0).
  481. */
  482. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TXE(SWPMI_TypeDef *SWPMIx)
  483. {
  484. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TXE) == (SWPMI_ISR_TXE)) ? 1UL : 0UL);
  485. }
  486. /**
  487. * @brief Check if Both transmission and reception are completed and SWP is switched to
  488. * the SUSPENDED state
  489. * @rmtoll ISR TCF LL_SWPMI_IsActiveFlag_TC
  490. * @param SWPMIx SWPMI Instance
  491. * @retval State of bit (1 or 0).
  492. */
  493. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TC(SWPMI_TypeDef *SWPMIx)
  494. {
  495. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TCF) == (SWPMI_ISR_TCF)) ? 1UL : 0UL);
  496. }
  497. /**
  498. * @brief Check if a Resume by slave state has been detected during the SWP bus SUSPENDED
  499. * state
  500. * @rmtoll ISR SRF LL_SWPMI_IsActiveFlag_SR
  501. * @param SWPMIx SWPMI Instance
  502. * @retval State of bit (1 or 0).
  503. */
  504. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_SR(SWPMI_TypeDef *SWPMIx)
  505. {
  506. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_SRF) == (SWPMI_ISR_SRF)) ? 1UL : 0UL);
  507. }
  508. /**
  509. * @brief Check if SWP bus is in SUSPENDED or DEACTIVATED state
  510. * @rmtoll ISR SUSP LL_SWPMI_IsActiveFlag_SUSP
  511. * @param SWPMIx SWPMI Instance
  512. * @retval State of bit (1 or 0).
  513. */
  514. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_SUSP(SWPMI_TypeDef *SWPMIx)
  515. {
  516. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_SUSP) == (SWPMI_ISR_SUSP)) ? 1UL : 0UL);
  517. }
  518. /**
  519. * @brief Check if SWP bus is in DEACTIVATED state
  520. * @rmtoll ISR DEACTF LL_SWPMI_IsActiveFlag_DEACT
  521. * @param SWPMIx SWPMI Instance
  522. * @retval State of bit (1 or 0).
  523. */
  524. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_DEACT(SWPMI_TypeDef *SWPMIx)
  525. {
  526. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_DEACTF) == (SWPMI_ISR_DEACTF)) ? 1UL : 0UL);
  527. }
  528. /**
  529. * @brief Check if SWPMI transceiver is ready
  530. * @rmtoll ISR RDYF LL_SWPMI_IsActiveFlag_RDYF
  531. * @param SWPMIx SWPMI Instance
  532. * @retval State of bit (1 or 0).
  533. */
  534. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RDYF(SWPMI_TypeDef *SWPMIx)
  535. {
  536. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RDYF) == (SWPMI_ISR_RDYF)) ? 1UL : 0UL);
  537. }
  538. /**
  539. * @brief Clear receive buffer full flag
  540. * @rmtoll ICR CRXBFF LL_SWPMI_ClearFlag_RXBF
  541. * @param SWPMIx SWPMI Instance
  542. * @retval None
  543. */
  544. __STATIC_INLINE void LL_SWPMI_ClearFlag_RXBF(SWPMI_TypeDef *SWPMIx)
  545. {
  546. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CRXBFF);
  547. }
  548. /**
  549. * @brief Clear transmit buffer empty flag
  550. * @rmtoll ICR CTXBEF LL_SWPMI_ClearFlag_TXBE
  551. * @param SWPMIx SWPMI Instance
  552. * @retval None
  553. */
  554. __STATIC_INLINE void LL_SWPMI_ClearFlag_TXBE(SWPMI_TypeDef *SWPMIx)
  555. {
  556. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTXBEF);
  557. }
  558. /**
  559. * @brief Clear receive CRC error flag
  560. * @rmtoll ICR CRXBERF LL_SWPMI_ClearFlag_RXBER
  561. * @param SWPMIx SWPMI Instance
  562. * @retval None
  563. */
  564. __STATIC_INLINE void LL_SWPMI_ClearFlag_RXBER(SWPMI_TypeDef *SWPMIx)
  565. {
  566. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CRXBERF);
  567. }
  568. /**
  569. * @brief Clear receive overrun error flag
  570. * @rmtoll ICR CRXOVRF LL_SWPMI_ClearFlag_RXOVR
  571. * @param SWPMIx SWPMI Instance
  572. * @retval None
  573. */
  574. __STATIC_INLINE void LL_SWPMI_ClearFlag_RXOVR(SWPMI_TypeDef *SWPMIx)
  575. {
  576. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CRXOVRF);
  577. }
  578. /**
  579. * @brief Clear transmit underrun error flag
  580. * @rmtoll ICR CTXUNRF LL_SWPMI_ClearFlag_TXUNR
  581. * @param SWPMIx SWPMI Instance
  582. * @retval None
  583. */
  584. __STATIC_INLINE void LL_SWPMI_ClearFlag_TXUNR(SWPMI_TypeDef *SWPMIx)
  585. {
  586. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTXUNRF);
  587. }
  588. /**
  589. * @brief Clear transfer complete flag
  590. * @rmtoll ICR CTCF LL_SWPMI_ClearFlag_TC
  591. * @param SWPMIx SWPMI Instance
  592. * @retval None
  593. */
  594. __STATIC_INLINE void LL_SWPMI_ClearFlag_TC(SWPMI_TypeDef *SWPMIx)
  595. {
  596. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTCF);
  597. }
  598. /**
  599. * @brief Clear slave resume flag
  600. * @rmtoll ICR CSRF LL_SWPMI_ClearFlag_SR
  601. * @param SWPMIx SWPMI Instance
  602. * @retval None
  603. */
  604. __STATIC_INLINE void LL_SWPMI_ClearFlag_SR(SWPMI_TypeDef *SWPMIx)
  605. {
  606. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CSRF);
  607. }
  608. /**
  609. * @brief Clear SWPMI transceiver ready flag
  610. * @rmtoll ISR CRDYF LL_SWPMI_ClearFlag_RDY
  611. * @param SWPMIx SWPMI Instance
  612. * @retval None
  613. */
  614. __STATIC_INLINE void LL_SWPMI_ClearFlag_RDY(SWPMI_TypeDef *SWPMIx)
  615. {
  616. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CRDYF);
  617. }
  618. /**
  619. * @}
  620. */
  621. /** @defgroup SWPMI_LL_EF_IT_Management IT_Management
  622. * @{
  623. */
  624. /**
  625. * @brief Enable SWPMI transceiver ready interrupt
  626. * @rmtoll IER RDYIE LL_SWPMI_EnableIT_RDY
  627. * @param SWPMIx SWPMI Instance
  628. * @retval None
  629. */
  630. __STATIC_INLINE void LL_SWPMI_EnableIT_RDY(SWPMI_TypeDef *SWPMIx)
  631. {
  632. SET_BIT(SWPMIx->IER, SWPMI_IER_RDYIE);
  633. }
  634. /**
  635. * @brief Enable Slave resume interrupt
  636. * @rmtoll IER SRIE LL_SWPMI_EnableIT_SR
  637. * @param SWPMIx SWPMI Instance
  638. * @retval None
  639. */
  640. __STATIC_INLINE void LL_SWPMI_EnableIT_SR(SWPMI_TypeDef *SWPMIx)
  641. {
  642. SET_BIT(SWPMIx->IER, SWPMI_IER_SRIE);
  643. }
  644. /**
  645. * @brief Enable Transmit complete interrupt
  646. * @rmtoll IER TCIE LL_SWPMI_EnableIT_TC
  647. * @param SWPMIx SWPMI Instance
  648. * @retval None
  649. */
  650. __STATIC_INLINE void LL_SWPMI_EnableIT_TC(SWPMI_TypeDef *SWPMIx)
  651. {
  652. SET_BIT(SWPMIx->IER, SWPMI_IER_TCIE);
  653. }
  654. /**
  655. * @brief Enable Transmit interrupt
  656. * @rmtoll IER TIE LL_SWPMI_EnableIT_TX
  657. * @param SWPMIx SWPMI Instance
  658. * @retval None
  659. */
  660. __STATIC_INLINE void LL_SWPMI_EnableIT_TX(SWPMI_TypeDef *SWPMIx)
  661. {
  662. SET_BIT(SWPMIx->IER, SWPMI_IER_TIE);
  663. }
  664. /**
  665. * @brief Enable Receive interrupt
  666. * @rmtoll IER RIE LL_SWPMI_EnableIT_RX
  667. * @param SWPMIx SWPMI Instance
  668. * @retval None
  669. */
  670. __STATIC_INLINE void LL_SWPMI_EnableIT_RX(SWPMI_TypeDef *SWPMIx)
  671. {
  672. SET_BIT(SWPMIx->IER, SWPMI_IER_RIE);
  673. }
  674. /**
  675. * @brief Enable Transmit underrun error interrupt
  676. * @rmtoll IER TXUNRIE LL_SWPMI_EnableIT_TXUNR
  677. * @param SWPMIx SWPMI Instance
  678. * @retval None
  679. */
  680. __STATIC_INLINE void LL_SWPMI_EnableIT_TXUNR(SWPMI_TypeDef *SWPMIx)
  681. {
  682. SET_BIT(SWPMIx->IER, SWPMI_IER_TXUNRIE);
  683. }
  684. /**
  685. * @brief Enable Receive overrun error interrupt
  686. * @rmtoll IER RXOVRIE LL_SWPMI_EnableIT_RXOVR
  687. * @param SWPMIx SWPMI Instance
  688. * @retval None
  689. */
  690. __STATIC_INLINE void LL_SWPMI_EnableIT_RXOVR(SWPMI_TypeDef *SWPMIx)
  691. {
  692. SET_BIT(SWPMIx->IER, SWPMI_IER_RXOVRIE);
  693. }
  694. /**
  695. * @brief Enable Receive CRC error interrupt
  696. * @rmtoll IER RXBERIE LL_SWPMI_EnableIT_RXBER
  697. * @param SWPMIx SWPMI Instance
  698. * @retval None
  699. */
  700. __STATIC_INLINE void LL_SWPMI_EnableIT_RXBER(SWPMI_TypeDef *SWPMIx)
  701. {
  702. SET_BIT(SWPMIx->IER, SWPMI_IER_RXBERIE);
  703. }
  704. /**
  705. * @brief Enable Transmit buffer empty interrupt
  706. * @rmtoll IER TXBEIE LL_SWPMI_EnableIT_TXBE
  707. * @param SWPMIx SWPMI Instance
  708. * @retval None
  709. */
  710. __STATIC_INLINE void LL_SWPMI_EnableIT_TXBE(SWPMI_TypeDef *SWPMIx)
  711. {
  712. SET_BIT(SWPMIx->IER, SWPMI_IER_TXBEIE);
  713. }
  714. /**
  715. * @brief Enable Receive buffer full interrupt
  716. * @rmtoll IER RXBFIE LL_SWPMI_EnableIT_RXBF
  717. * @param SWPMIx SWPMI Instance
  718. * @retval None
  719. */
  720. __STATIC_INLINE void LL_SWPMI_EnableIT_RXBF(SWPMI_TypeDef *SWPMIx)
  721. {
  722. SET_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE);
  723. }
  724. /**
  725. * @brief Disable SWPMI transceiver ready interrupt
  726. * @rmtoll IER RDYIE LL_SWPMI_DisableIT_RDY
  727. * @param SWPMIx SWPMI Instance
  728. * @retval None
  729. */
  730. __STATIC_INLINE void LL_SWPMI_DisableIT_RDY(SWPMI_TypeDef *SWPMIx)
  731. {
  732. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RDYIE);
  733. }
  734. /**
  735. * @brief Disable Slave resume interrupt
  736. * @rmtoll IER SRIE LL_SWPMI_DisableIT_SR
  737. * @param SWPMIx SWPMI Instance
  738. * @retval None
  739. */
  740. __STATIC_INLINE void LL_SWPMI_DisableIT_SR(SWPMI_TypeDef *SWPMIx)
  741. {
  742. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_SRIE);
  743. }
  744. /**
  745. * @brief Disable Transmit complete interrupt
  746. * @rmtoll IER TCIE LL_SWPMI_DisableIT_TC
  747. * @param SWPMIx SWPMI Instance
  748. * @retval None
  749. */
  750. __STATIC_INLINE void LL_SWPMI_DisableIT_TC(SWPMI_TypeDef *SWPMIx)
  751. {
  752. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TCIE);
  753. }
  754. /**
  755. * @brief Disable Transmit interrupt
  756. * @rmtoll IER TIE LL_SWPMI_DisableIT_TX
  757. * @param SWPMIx SWPMI Instance
  758. * @retval None
  759. */
  760. __STATIC_INLINE void LL_SWPMI_DisableIT_TX(SWPMI_TypeDef *SWPMIx)
  761. {
  762. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TIE);
  763. }
  764. /**
  765. * @brief Disable Receive interrupt
  766. * @rmtoll IER RIE LL_SWPMI_DisableIT_RX
  767. * @param SWPMIx SWPMI Instance
  768. * @retval None
  769. */
  770. __STATIC_INLINE void LL_SWPMI_DisableIT_RX(SWPMI_TypeDef *SWPMIx)
  771. {
  772. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RIE);
  773. }
  774. /**
  775. * @brief Disable Transmit underrun error interrupt
  776. * @rmtoll IER TXUNRIE LL_SWPMI_DisableIT_TXUNR
  777. * @param SWPMIx SWPMI Instance
  778. * @retval None
  779. */
  780. __STATIC_INLINE void LL_SWPMI_DisableIT_TXUNR(SWPMI_TypeDef *SWPMIx)
  781. {
  782. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TXUNRIE);
  783. }
  784. /**
  785. * @brief Disable Receive overrun error interrupt
  786. * @rmtoll IER RXOVRIE LL_SWPMI_DisableIT_RXOVR
  787. * @param SWPMIx SWPMI Instance
  788. * @retval None
  789. */
  790. __STATIC_INLINE void LL_SWPMI_DisableIT_RXOVR(SWPMI_TypeDef *SWPMIx)
  791. {
  792. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RXOVRIE);
  793. }
  794. /**
  795. * @brief Disable Receive CRC error interrupt
  796. * @rmtoll IER RXBERIE LL_SWPMI_DisableIT_RXBER
  797. * @param SWPMIx SWPMI Instance
  798. * @retval None
  799. */
  800. __STATIC_INLINE void LL_SWPMI_DisableIT_RXBER(SWPMI_TypeDef *SWPMIx)
  801. {
  802. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RXBERIE);
  803. }
  804. /**
  805. * @brief Disable Transmit buffer empty interrupt
  806. * @rmtoll IER TXBEIE LL_SWPMI_DisableIT_TXBE
  807. * @param SWPMIx SWPMI Instance
  808. * @retval None
  809. */
  810. __STATIC_INLINE void LL_SWPMI_DisableIT_TXBE(SWPMI_TypeDef *SWPMIx)
  811. {
  812. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TXBEIE);
  813. }
  814. /**
  815. * @brief Disable Receive buffer full interrupt
  816. * @rmtoll IER RXBFIE LL_SWPMI_DisableIT_RXBF
  817. * @param SWPMIx SWPMI Instance
  818. * @retval None
  819. */
  820. __STATIC_INLINE void LL_SWPMI_DisableIT_RXBF(SWPMI_TypeDef *SWPMIx)
  821. {
  822. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE);
  823. }
  824. /**
  825. * @brief Check if SWPMI transceiver ready interrupt is enabled
  826. * @rmtoll IER RDYIE LL_SWPMI_IsEnabledIT_RDY
  827. * @param SWPMIx SWPMI Instance
  828. * @retval State of bit (1 or 0).
  829. */
  830. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RDY(SWPMI_TypeDef *SWPMIx)
  831. {
  832. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RDYIE) == (SWPMI_IER_RDYIE)) ? 1UL : 0UL);
  833. }
  834. /**
  835. * @brief Check if Slave resume interrupt is enabled
  836. * @rmtoll IER SRIE LL_SWPMI_IsEnabledIT_SR
  837. * @param SWPMIx SWPMI Instance
  838. * @retval State of bit (1 or 0).
  839. */
  840. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_SR(SWPMI_TypeDef *SWPMIx)
  841. {
  842. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_SRIE) == (SWPMI_IER_SRIE)) ? 1UL : 0UL);
  843. }
  844. /**
  845. * @brief Check if Transmit complete interrupt is enabled
  846. * @rmtoll IER TCIE LL_SWPMI_IsEnabledIT_TC
  847. * @param SWPMIx SWPMI Instance
  848. * @retval State of bit (1 or 0).
  849. */
  850. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TC(SWPMI_TypeDef *SWPMIx)
  851. {
  852. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TCIE) == (SWPMI_IER_TCIE)) ? 1UL : 0UL);
  853. }
  854. /**
  855. * @brief Check if Transmit interrupt is enabled
  856. * @rmtoll IER TIE LL_SWPMI_IsEnabledIT_TX
  857. * @param SWPMIx SWPMI Instance
  858. * @retval State of bit (1 or 0).
  859. */
  860. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TX(SWPMI_TypeDef *SWPMIx)
  861. {
  862. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TIE) == (SWPMI_IER_TIE)) ? 1UL : 0UL);
  863. }
  864. /**
  865. * @brief Check if Receive interrupt is enabled
  866. * @rmtoll IER RIE LL_SWPMI_IsEnabledIT_RX
  867. * @param SWPMIx SWPMI Instance
  868. * @retval State of bit (1 or 0).
  869. */
  870. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RX(SWPMI_TypeDef *SWPMIx)
  871. {
  872. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RIE) == (SWPMI_IER_RIE)) ? 1UL : 0UL);
  873. }
  874. /**
  875. * @brief Check if Transmit underrun error interrupt is enabled
  876. * @rmtoll IER TXUNRIE LL_SWPMI_IsEnabledIT_TXUNR
  877. * @param SWPMIx SWPMI Instance
  878. * @retval State of bit (1 or 0).
  879. */
  880. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TXUNR(SWPMI_TypeDef *SWPMIx)
  881. {
  882. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TXUNRIE) == (SWPMI_IER_TXUNRIE)) ? 1UL : 0UL);
  883. }
  884. /**
  885. * @brief Check if Receive overrun error interrupt is enabled
  886. * @rmtoll IER RXOVRIE LL_SWPMI_IsEnabledIT_RXOVR
  887. * @param SWPMIx SWPMI Instance
  888. * @retval State of bit (1 or 0).
  889. */
  890. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RXOVR(SWPMI_TypeDef *SWPMIx)
  891. {
  892. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RXOVRIE) == (SWPMI_IER_RXOVRIE)) ? 1UL : 0UL);
  893. }
  894. /**
  895. * @brief Check if Receive CRC error interrupt is enabled
  896. * @rmtoll IER RXBERIE LL_SWPMI_IsEnabledIT_RXBER
  897. * @param SWPMIx SWPMI Instance
  898. * @retval State of bit (1 or 0).
  899. */
  900. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RXBER(SWPMI_TypeDef *SWPMIx)
  901. {
  902. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RXBERIE) == (SWPMI_IER_RXBERIE)) ? 1UL : 0UL);
  903. }
  904. /**
  905. * @brief Check if Transmit buffer empty interrupt is enabled
  906. * @rmtoll IER TXBEIE LL_SWPMI_IsEnabledIT_TXBE
  907. * @param SWPMIx SWPMI Instance
  908. * @retval State of bit (1 or 0).
  909. */
  910. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TXBE(SWPMI_TypeDef *SWPMIx)
  911. {
  912. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TXBEIE) == (SWPMI_IER_TXBEIE)) ? 1UL : 0UL);
  913. }
  914. /**
  915. * @brief Check if Receive buffer full interrupt is enabled
  916. * @rmtoll IER RXBFIE LL_SWPMI_IsEnabledIT_RXBF
  917. * @param SWPMIx SWPMI Instance
  918. * @retval State of bit (1 or 0).
  919. */
  920. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RXBF(SWPMI_TypeDef *SWPMIx)
  921. {
  922. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE) == (SWPMI_IER_RXBFIE)) ? 1UL : 0UL);
  923. }
  924. /**
  925. * @}
  926. */
  927. /** @defgroup SWPMI_LL_EF_DMA_Management DMA_Management
  928. * @{
  929. */
  930. /**
  931. * @brief Enable DMA mode for reception
  932. * @rmtoll CR RXDMA LL_SWPMI_EnableDMAReq_RX
  933. * @param SWPMIx SWPMI Instance
  934. * @retval None
  935. */
  936. __STATIC_INLINE void LL_SWPMI_EnableDMAReq_RX(SWPMI_TypeDef *SWPMIx)
  937. {
  938. SET_BIT(SWPMIx->CR, SWPMI_CR_RXDMA);
  939. }
  940. /**
  941. * @brief Disable DMA mode for reception
  942. * @rmtoll CR RXDMA LL_SWPMI_DisableDMAReq_RX
  943. * @param SWPMIx SWPMI Instance
  944. * @retval None
  945. */
  946. __STATIC_INLINE void LL_SWPMI_DisableDMAReq_RX(SWPMI_TypeDef *SWPMIx)
  947. {
  948. CLEAR_BIT(SWPMIx->CR, SWPMI_CR_RXDMA);
  949. }
  950. /**
  951. * @brief Check if DMA mode for reception is enabled
  952. * @rmtoll CR RXDMA LL_SWPMI_IsEnabledDMAReq_RX
  953. * @param SWPMIx SWPMI Instance
  954. * @retval State of bit (1 or 0).
  955. */
  956. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledDMAReq_RX(SWPMI_TypeDef *SWPMIx)
  957. {
  958. return ((READ_BIT(SWPMIx->CR, SWPMI_CR_RXDMA) == (SWPMI_CR_RXDMA)) ? 1UL : 0UL);
  959. }
  960. /**
  961. * @brief Enable DMA mode for transmission
  962. * @rmtoll CR TXDMA LL_SWPMI_EnableDMAReq_TX
  963. * @param SWPMIx SWPMI Instance
  964. * @retval None
  965. */
  966. __STATIC_INLINE void LL_SWPMI_EnableDMAReq_TX(SWPMI_TypeDef *SWPMIx)
  967. {
  968. SET_BIT(SWPMIx->CR, SWPMI_CR_TXDMA);
  969. }
  970. /**
  971. * @brief Disable DMA mode for transmission
  972. * @rmtoll CR TXDMA LL_SWPMI_DisableDMAReq_TX
  973. * @param SWPMIx SWPMI Instance
  974. * @retval None
  975. */
  976. __STATIC_INLINE void LL_SWPMI_DisableDMAReq_TX(SWPMI_TypeDef *SWPMIx)
  977. {
  978. CLEAR_BIT(SWPMIx->CR, SWPMI_CR_TXDMA);
  979. }
  980. /**
  981. * @brief Check if DMA mode for transmission is enabled
  982. * @rmtoll CR TXDMA LL_SWPMI_IsEnabledDMAReq_TX
  983. * @param SWPMIx SWPMI Instance
  984. * @retval State of bit (1 or 0).
  985. */
  986. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledDMAReq_TX(SWPMI_TypeDef *SWPMIx)
  987. {
  988. return ((READ_BIT(SWPMIx->CR, SWPMI_CR_TXDMA) == (SWPMI_CR_TXDMA)) ? 1UL : 0UL);
  989. }
  990. /**
  991. * @brief Get the data register address used for DMA transfer
  992. * @rmtoll TDR TD LL_SWPMI_DMA_GetRegAddr\n
  993. * RDR RD LL_SWPMI_DMA_GetRegAddr
  994. * @param SWPMIx SWPMI Instance
  995. * @param Direction This parameter can be one of the following values:
  996. * @arg @ref LL_SWPMI_DMA_REG_DATA_TRANSMIT
  997. * @arg @ref LL_SWPMI_DMA_REG_DATA_RECEIVE
  998. * @retval Address of data register
  999. */
  1000. __STATIC_INLINE uint32_t LL_SWPMI_DMA_GetRegAddr(SWPMI_TypeDef *SWPMIx, uint32_t Direction)
  1001. {
  1002. uint32_t data_reg_addr;
  1003. if (Direction == LL_SWPMI_DMA_REG_DATA_TRANSMIT)
  1004. {
  1005. /* return address of TDR register */
  1006. data_reg_addr = (uint32_t)&(SWPMIx->TDR);
  1007. }
  1008. else
  1009. {
  1010. /* return address of RDR register */
  1011. data_reg_addr = (uint32_t)&(SWPMIx->RDR);
  1012. }
  1013. return data_reg_addr;
  1014. }
  1015. /**
  1016. * @}
  1017. */
  1018. /** @defgroup SWPMI_LL_EF_Data_Management Data_Management
  1019. * @{
  1020. */
  1021. /**
  1022. * @brief Retrieve number of data bytes present in payload of received frame
  1023. * @rmtoll RFL RFL LL_SWPMI_GetReceiveFrameLength
  1024. * @param SWPMIx SWPMI Instance
  1025. * @retval Value between Min_Data=0x00 and Max_Data=0x1F
  1026. */
  1027. __STATIC_INLINE uint32_t LL_SWPMI_GetReceiveFrameLength(SWPMI_TypeDef *SWPMIx)
  1028. {
  1029. return (uint32_t)(READ_BIT(SWPMIx->RFL, SWPMI_RFL_RFL));
  1030. }
  1031. /**
  1032. * @brief Transmit Data Register
  1033. * @rmtoll TDR TD LL_SWPMI_TransmitData32
  1034. * @param SWPMIx SWPMI Instance
  1035. * @param TxData Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
  1036. * @retval None
  1037. */
  1038. __STATIC_INLINE void LL_SWPMI_TransmitData32(SWPMI_TypeDef *SWPMIx, uint32_t TxData)
  1039. {
  1040. WRITE_REG(SWPMIx->TDR, TxData);
  1041. }
  1042. /**
  1043. * @brief Receive Data Register
  1044. * @rmtoll RDR RD LL_SWPMI_ReceiveData32
  1045. * @param SWPMIx SWPMI Instance
  1046. * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
  1047. */
  1048. __STATIC_INLINE uint32_t LL_SWPMI_ReceiveData32(SWPMI_TypeDef *SWPMIx)
  1049. {
  1050. return (uint32_t)(READ_BIT(SWPMIx->RDR, SWPMI_RDR_RD));
  1051. }
  1052. /**
  1053. * @brief Enable SWP Transceiver Bypass
  1054. * @note The external interface for SWPMI is SWPMI_IO
  1055. * (SWPMI_RX, SWPMI_TX and SWPMI_SUSPEND signals are not available on GPIOs)
  1056. * @rmtoll OR TBYP LL_SWPMI_EnableTXBypass
  1057. * @param SWPMIx SWPMI Instance
  1058. * @retval None
  1059. */
  1060. __STATIC_INLINE void LL_SWPMI_EnableTXBypass(SWPMI_TypeDef *SWPMIx)
  1061. {
  1062. CLEAR_BIT(SWPMIx->OR, SWPMI_OR_TBYP);
  1063. }
  1064. /**
  1065. * @brief Disable SWP Transceiver Bypass
  1066. * @note SWPMI_RX, SWPMI_TX and SWPMI_SUSPEND signals are available as alternate
  1067. * function on GPIOs. This configuration is selected to connect an external transceiver
  1068. * @note In SWPMI_IO bypass mode, SWPEN bit in SWPMI_CR register must be kept cleared
  1069. * @rmtoll OR TBYP LL_SWPMI_DisableTXBypass
  1070. * @param SWPMIx SWPMI Instance
  1071. * @retval None
  1072. */
  1073. __STATIC_INLINE void LL_SWPMI_DisableTXBypass(SWPMI_TypeDef *SWPMIx)
  1074. {
  1075. SET_BIT(SWPMIx->OR, SWPMI_OR_TBYP);
  1076. }
  1077. /**
  1078. * @}
  1079. */
  1080. #if defined(USE_FULL_LL_DRIVER)
  1081. /** @defgroup SWPMI_LL_EF_Init Initialization and de-initialization functions
  1082. * @{
  1083. */
  1084. ErrorStatus LL_SWPMI_DeInit(SWPMI_TypeDef *SWPMIx);
  1085. ErrorStatus LL_SWPMI_Init(SWPMI_TypeDef *SWPMIx, LL_SWPMI_InitTypeDef *SWPMI_InitStruct);
  1086. void LL_SWPMI_StructInit(LL_SWPMI_InitTypeDef *SWPMI_InitStruct);
  1087. /**
  1088. * @}
  1089. */
  1090. #endif /*USE_FULL_LL_DRIVER*/
  1091. /**
  1092. * @}
  1093. */
  1094. /**
  1095. * @}
  1096. */
  1097. /**
  1098. * @}
  1099. */
  1100. #ifdef __cplusplus
  1101. }
  1102. #endif
  1103. #endif /* STM32H7xx_LL_SWPMI_H */
  1104. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/