stm32l4xx_ll_swpmi.h 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_ll_swpmi.h
  4. * @author MCD Application Team
  5. * @brief Header file of SWPMI LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32L4xx_LL_SWPMI_H
  20. #define STM32L4xx_LL_SWPMI_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32l4xx.h"
  26. /** @addtogroup STM32L4xx_LL_Driver
  27. * @{
  28. */
  29. #if defined(SWPMI1)
  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=63U.
  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(const 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(const 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 Activate Single wire protocol bus (SUSPENDED or ACTIVATED state)
  283. * @note SWP bus stays in the ACTIVATED state as long as there is a communication
  284. * with the slave, either in transmission or in reception. The SWP bus switches back
  285. * to the SUSPENDED state as soon as there is no more transmission or reception
  286. * activity, after 7 idle bits.
  287. * @rmtoll CR SWPACT LL_SWPMI_Activate
  288. * @param SWPMIx SWPMI Instance
  289. * @retval None
  290. */
  291. __STATIC_INLINE void LL_SWPMI_Activate(SWPMI_TypeDef *SWPMIx)
  292. {
  293. /* In order to activate SWP again, the software must clear DEACT bit*/
  294. CLEAR_BIT(SWPMIx->CR, SWPMI_CR_DEACT);
  295. /* Set SWACT bit */
  296. SET_BIT(SWPMIx->CR, SWPMI_CR_SWPACT);
  297. }
  298. /**
  299. * @brief Check if Single wire protocol bus is in ACTIVATED state.
  300. * @rmtoll CR SWPACT LL_SWPMI_Activate
  301. * @param SWPMIx SWPMI Instance
  302. * @retval State of bit (1 or 0).
  303. */
  304. __STATIC_INLINE uint32_t LL_SWPMI_IsActivated(const SWPMI_TypeDef *SWPMIx)
  305. {
  306. return ((READ_BIT(SWPMIx->CR, SWPMI_CR_SWPACT) == (SWPMI_CR_SWPACT)) ? 1UL : 0UL);
  307. }
  308. /**
  309. * @brief Deactivate immediately Single wire protocol bus (immediate transition to
  310. * DEACTIVATED state)
  311. * @rmtoll CR SWPACT LL_SWPMI_Deactivate
  312. * @param SWPMIx SWPMI Instance
  313. * @retval None
  314. */
  315. __STATIC_INLINE void LL_SWPMI_Deactivate(SWPMI_TypeDef *SWPMIx)
  316. {
  317. CLEAR_BIT(SWPMIx->CR, SWPMI_CR_SWPACT);
  318. }
  319. /**
  320. * @brief Request a deactivation of Single wire protocol bus (request to go in DEACTIVATED
  321. * state if no resume from slave)
  322. * @rmtoll CR DEACT LL_SWPMI_RequestDeactivation
  323. * @param SWPMIx SWPMI Instance
  324. * @retval None
  325. */
  326. __STATIC_INLINE void LL_SWPMI_RequestDeactivation(SWPMI_TypeDef *SWPMIx)
  327. {
  328. SET_BIT(SWPMIx->CR, SWPMI_CR_DEACT);
  329. }
  330. /**
  331. * @brief Set Bitrate prescaler SWPMI_freq = SWPMI_clk / (((BitRate) + 1) * 4)
  332. * @rmtoll BRR BR LL_SWPMI_SetBitRatePrescaler
  333. * @param SWPMIx SWPMI Instance
  334. * @param BitRatePrescaler A number between Min_Data=0 and Max_Data=63U
  335. * @retval None
  336. */
  337. __STATIC_INLINE void LL_SWPMI_SetBitRatePrescaler(SWPMI_TypeDef *SWPMIx, uint32_t BitRatePrescaler)
  338. {
  339. WRITE_REG(SWPMIx->BRR, BitRatePrescaler);
  340. }
  341. /**
  342. * @brief Get Bitrate prescaler
  343. * @rmtoll BRR BR LL_SWPMI_GetBitRatePrescaler
  344. * @param SWPMIx SWPMI Instance
  345. * @retval A number between Min_Data=0 and Max_Data=63U
  346. */
  347. __STATIC_INLINE uint32_t LL_SWPMI_GetBitRatePrescaler(const SWPMI_TypeDef *SWPMIx)
  348. {
  349. return (uint32_t)(READ_BIT(SWPMIx->BRR, SWPMI_BRR_BR));
  350. }
  351. /**
  352. * @brief Set SWP Voltage Class
  353. * @rmtoll OR CLASS LL_SWPMI_SetVoltageClass
  354. * @param SWPMIx SWPMI Instance
  355. * @param VoltageClass This parameter can be one of the following values:
  356. * @arg @ref LL_SWPMI_VOLTAGE_CLASS_C
  357. * @arg @ref LL_SWPMI_VOLTAGE_CLASS_B
  358. * @retval None
  359. */
  360. __STATIC_INLINE void LL_SWPMI_SetVoltageClass(SWPMI_TypeDef *SWPMIx, uint32_t VoltageClass)
  361. {
  362. MODIFY_REG(SWPMIx->OR, SWPMI_OR_CLASS, VoltageClass);
  363. }
  364. /**
  365. * @brief Get SWP Voltage Class
  366. * @rmtoll OR CLASS LL_SWPMI_GetVoltageClass
  367. * @param SWPMIx SWPMI Instance
  368. * @retval Returned value can be one of the following values:
  369. * @arg @ref LL_SWPMI_VOLTAGE_CLASS_C
  370. * @arg @ref LL_SWPMI_VOLTAGE_CLASS_B
  371. */
  372. __STATIC_INLINE uint32_t LL_SWPMI_GetVoltageClass(const SWPMI_TypeDef *SWPMIx)
  373. {
  374. return (uint32_t)(READ_BIT(SWPMIx->OR, SWPMI_OR_CLASS));
  375. }
  376. /**
  377. * @}
  378. */
  379. /** @defgroup SWPMI_LL_EF_FLAG_Management FLAG_Management
  380. * @{
  381. */
  382. /**
  383. * @brief Check if the last word of the frame under reception has arrived in SWPMI_RDR.
  384. * @rmtoll ISR RXBFF LL_SWPMI_IsActiveFlag_RXBF
  385. * @param SWPMIx SWPMI Instance
  386. * @retval State of bit (1 or 0).
  387. */
  388. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXBF(const SWPMI_TypeDef *SWPMIx)
  389. {
  390. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXBFF) == (SWPMI_ISR_RXBFF)) ? 1UL : 0UL);
  391. }
  392. /**
  393. * @brief Check if Frame transmission buffer has been emptied
  394. * @rmtoll ISR TXBEF LL_SWPMI_IsActiveFlag_TXBE
  395. * @param SWPMIx SWPMI Instance
  396. * @retval State of bit (1 or 0).
  397. */
  398. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TXBE(const SWPMI_TypeDef *SWPMIx)
  399. {
  400. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TXBEF) == (SWPMI_ISR_TXBEF)) ? 1UL : 0UL);
  401. }
  402. /**
  403. * @brief Check if CRC error in reception has been detected
  404. * @rmtoll ISR RXBERF LL_SWPMI_IsActiveFlag_RXBER
  405. * @param SWPMIx SWPMI Instance
  406. * @retval State of bit (1 or 0).
  407. */
  408. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXBER(const SWPMI_TypeDef *SWPMIx)
  409. {
  410. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXBERF) == (SWPMI_ISR_RXBERF)) ? 1UL : 0UL);
  411. }
  412. /**
  413. * @brief Check if Overrun in reception has been detected
  414. * @rmtoll ISR RXOVRF LL_SWPMI_IsActiveFlag_RXOVR
  415. * @param SWPMIx SWPMI Instance
  416. * @retval State of bit (1 or 0).
  417. */
  418. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXOVR(const SWPMI_TypeDef *SWPMIx)
  419. {
  420. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXOVRF) == (SWPMI_ISR_RXOVRF)) ? 1UL : 0UL);
  421. }
  422. /**
  423. * @brief Check if underrun error in transmission has been detected
  424. * @rmtoll ISR TXUNRF LL_SWPMI_IsActiveFlag_TXUNR
  425. * @param SWPMIx SWPMI Instance
  426. * @retval State of bit (1 or 0).
  427. */
  428. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TXUNR(const SWPMI_TypeDef *SWPMIx)
  429. {
  430. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TXUNRF) == (SWPMI_ISR_TXUNRF)) ? 1UL : 0UL);
  431. }
  432. /**
  433. * @brief Check if Receive data register not empty (it means that Received data is ready
  434. * to be read in the SWPMI_RDR register)
  435. * @rmtoll ISR RXNE LL_SWPMI_IsActiveFlag_RXNE
  436. * @param SWPMIx SWPMI Instance
  437. * @retval State of bit (1 or 0).
  438. */
  439. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_RXNE(const SWPMI_TypeDef *SWPMIx)
  440. {
  441. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXNE) == (SWPMI_ISR_RXNE)) ? 1UL : 0UL);
  442. }
  443. /**
  444. * @brief Check if Transmit data register is empty (it means that Data written in transmit
  445. * data register SWPMI_TDR has been transmitted and SWPMI_TDR can be written to again)
  446. * @rmtoll ISR TXE LL_SWPMI_IsActiveFlag_TXE
  447. * @param SWPMIx SWPMI Instance
  448. * @retval State of bit (1 or 0).
  449. */
  450. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TXE(const SWPMI_TypeDef *SWPMIx)
  451. {
  452. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TXE) == (SWPMI_ISR_TXE)) ? 1UL : 0UL);
  453. }
  454. /**
  455. * @brief Check if Both transmission and reception are completed and SWP is switched to
  456. * the SUSPENDED state
  457. * @rmtoll ISR TCF LL_SWPMI_IsActiveFlag_TC
  458. * @param SWPMIx SWPMI Instance
  459. * @retval State of bit (1 or 0).
  460. */
  461. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_TC(const SWPMI_TypeDef *SWPMIx)
  462. {
  463. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TCF) == (SWPMI_ISR_TCF)) ? 1UL : 0UL);
  464. }
  465. /**
  466. * @brief Check if a Resume by slave state has been detected during the SWP bus SUSPENDED
  467. * state
  468. * @rmtoll ISR SRF LL_SWPMI_IsActiveFlag_SR
  469. * @param SWPMIx SWPMI Instance
  470. * @retval State of bit (1 or 0).
  471. */
  472. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_SR(const SWPMI_TypeDef *SWPMIx)
  473. {
  474. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_SRF) == (SWPMI_ISR_SRF)) ? 1UL : 0UL);
  475. }
  476. /**
  477. * @brief Check if SWP bus is in SUSPENDED or DEACTIVATED state
  478. * @rmtoll ISR SUSP LL_SWPMI_IsActiveFlag_SUSP
  479. * @param SWPMIx SWPMI Instance
  480. * @retval State of bit (1 or 0).
  481. */
  482. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_SUSP(const SWPMI_TypeDef *SWPMIx)
  483. {
  484. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_SUSP) == (SWPMI_ISR_SUSP)) ? 1UL : 0UL);
  485. }
  486. /**
  487. * @brief Check if SWP bus is in DEACTIVATED state
  488. * @rmtoll ISR DEACTF LL_SWPMI_IsActiveFlag_DEACT
  489. * @param SWPMIx SWPMI Instance
  490. * @retval State of bit (1 or 0).
  491. */
  492. __STATIC_INLINE uint32_t LL_SWPMI_IsActiveFlag_DEACT(const SWPMI_TypeDef *SWPMIx)
  493. {
  494. return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_DEACTF) == (SWPMI_ISR_DEACTF)) ? 1UL : 0UL);
  495. }
  496. /**
  497. * @brief Clear receive buffer full flag
  498. * @rmtoll ICR CRXBFF LL_SWPMI_ClearFlag_RXBF
  499. * @param SWPMIx SWPMI Instance
  500. * @retval None
  501. */
  502. __STATIC_INLINE void LL_SWPMI_ClearFlag_RXBF(SWPMI_TypeDef *SWPMIx)
  503. {
  504. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CRXBFF);
  505. }
  506. /**
  507. * @brief Clear transmit buffer empty flag
  508. * @rmtoll ICR CTXBEF LL_SWPMI_ClearFlag_TXBE
  509. * @param SWPMIx SWPMI Instance
  510. * @retval None
  511. */
  512. __STATIC_INLINE void LL_SWPMI_ClearFlag_TXBE(SWPMI_TypeDef *SWPMIx)
  513. {
  514. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTXBEF);
  515. }
  516. /**
  517. * @brief Clear receive CRC error flag
  518. * @rmtoll ICR CRXBERF LL_SWPMI_ClearFlag_RXBER
  519. * @param SWPMIx SWPMI Instance
  520. * @retval None
  521. */
  522. __STATIC_INLINE void LL_SWPMI_ClearFlag_RXBER(SWPMI_TypeDef *SWPMIx)
  523. {
  524. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CRXBERF);
  525. }
  526. /**
  527. * @brief Clear receive overrun error flag
  528. * @rmtoll ICR CRXOVRF LL_SWPMI_ClearFlag_RXOVR
  529. * @param SWPMIx SWPMI Instance
  530. * @retval None
  531. */
  532. __STATIC_INLINE void LL_SWPMI_ClearFlag_RXOVR(SWPMI_TypeDef *SWPMIx)
  533. {
  534. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CRXOVRF);
  535. }
  536. /**
  537. * @brief Clear transmit underrun error flag
  538. * @rmtoll ICR CTXUNRF LL_SWPMI_ClearFlag_TXUNR
  539. * @param SWPMIx SWPMI Instance
  540. * @retval None
  541. */
  542. __STATIC_INLINE void LL_SWPMI_ClearFlag_TXUNR(SWPMI_TypeDef *SWPMIx)
  543. {
  544. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTXUNRF);
  545. }
  546. /**
  547. * @brief Clear transfer complete flag
  548. * @rmtoll ICR CTCF LL_SWPMI_ClearFlag_TC
  549. * @param SWPMIx SWPMI Instance
  550. * @retval None
  551. */
  552. __STATIC_INLINE void LL_SWPMI_ClearFlag_TC(SWPMI_TypeDef *SWPMIx)
  553. {
  554. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTCF);
  555. }
  556. /**
  557. * @brief Clear slave resume flag
  558. * @rmtoll ICR CSRF LL_SWPMI_ClearFlag_SR
  559. * @param SWPMIx SWPMI Instance
  560. * @retval None
  561. */
  562. __STATIC_INLINE void LL_SWPMI_ClearFlag_SR(SWPMI_TypeDef *SWPMIx)
  563. {
  564. WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CSRF);
  565. }
  566. /**
  567. * @}
  568. */
  569. /** @defgroup SWPMI_LL_EF_IT_Management IT_Management
  570. * @{
  571. */
  572. /**
  573. * @brief Enable Slave resume interrupt
  574. * @rmtoll IER SRIE LL_SWPMI_EnableIT_SR
  575. * @param SWPMIx SWPMI Instance
  576. * @retval None
  577. */
  578. __STATIC_INLINE void LL_SWPMI_EnableIT_SR(SWPMI_TypeDef *SWPMIx)
  579. {
  580. SET_BIT(SWPMIx->IER, SWPMI_IER_SRIE);
  581. }
  582. /**
  583. * @brief Enable Transmit complete interrupt
  584. * @rmtoll IER TCIE LL_SWPMI_EnableIT_TC
  585. * @param SWPMIx SWPMI Instance
  586. * @retval None
  587. */
  588. __STATIC_INLINE void LL_SWPMI_EnableIT_TC(SWPMI_TypeDef *SWPMIx)
  589. {
  590. SET_BIT(SWPMIx->IER, SWPMI_IER_TCIE);
  591. }
  592. /**
  593. * @brief Enable Transmit interrupt
  594. * @rmtoll IER TIE LL_SWPMI_EnableIT_TX
  595. * @param SWPMIx SWPMI Instance
  596. * @retval None
  597. */
  598. __STATIC_INLINE void LL_SWPMI_EnableIT_TX(SWPMI_TypeDef *SWPMIx)
  599. {
  600. SET_BIT(SWPMIx->IER, SWPMI_IER_TIE);
  601. }
  602. /**
  603. * @brief Enable Receive interrupt
  604. * @rmtoll IER RIE LL_SWPMI_EnableIT_RX
  605. * @param SWPMIx SWPMI Instance
  606. * @retval None
  607. */
  608. __STATIC_INLINE void LL_SWPMI_EnableIT_RX(SWPMI_TypeDef *SWPMIx)
  609. {
  610. SET_BIT(SWPMIx->IER, SWPMI_IER_RIE);
  611. }
  612. /**
  613. * @brief Enable Transmit underrun error interrupt
  614. * @rmtoll IER TXUNRIE LL_SWPMI_EnableIT_TXUNR
  615. * @param SWPMIx SWPMI Instance
  616. * @retval None
  617. */
  618. __STATIC_INLINE void LL_SWPMI_EnableIT_TXUNR(SWPMI_TypeDef *SWPMIx)
  619. {
  620. SET_BIT(SWPMIx->IER, SWPMI_IER_TXUNRIE);
  621. }
  622. /**
  623. * @brief Enable Receive overrun error interrupt
  624. * @rmtoll IER RXOVRIE LL_SWPMI_EnableIT_RXOVR
  625. * @param SWPMIx SWPMI Instance
  626. * @retval None
  627. */
  628. __STATIC_INLINE void LL_SWPMI_EnableIT_RXOVR(SWPMI_TypeDef *SWPMIx)
  629. {
  630. SET_BIT(SWPMIx->IER, SWPMI_IER_RXOVRIE);
  631. }
  632. /**
  633. * @brief Enable Receive CRC error interrupt
  634. * @rmtoll IER RXBERIE LL_SWPMI_EnableIT_RXBER
  635. * @param SWPMIx SWPMI Instance
  636. * @retval None
  637. */
  638. __STATIC_INLINE void LL_SWPMI_EnableIT_RXBER(SWPMI_TypeDef *SWPMIx)
  639. {
  640. SET_BIT(SWPMIx->IER, SWPMI_IER_RXBERIE);
  641. }
  642. /**
  643. * @brief Enable Transmit buffer empty interrupt
  644. * @rmtoll IER TXBEIE LL_SWPMI_EnableIT_TXBE
  645. * @param SWPMIx SWPMI Instance
  646. * @retval None
  647. */
  648. __STATIC_INLINE void LL_SWPMI_EnableIT_TXBE(SWPMI_TypeDef *SWPMIx)
  649. {
  650. SET_BIT(SWPMIx->IER, SWPMI_IER_TXBEIE);
  651. }
  652. /**
  653. * @brief Enable Receive buffer full interrupt
  654. * @rmtoll IER RXBFIE LL_SWPMI_EnableIT_RXBF
  655. * @param SWPMIx SWPMI Instance
  656. * @retval None
  657. */
  658. __STATIC_INLINE void LL_SWPMI_EnableIT_RXBF(SWPMI_TypeDef *SWPMIx)
  659. {
  660. SET_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE);
  661. }
  662. /**
  663. * @brief Disable Slave resume interrupt
  664. * @rmtoll IER SRIE LL_SWPMI_DisableIT_SR
  665. * @param SWPMIx SWPMI Instance
  666. * @retval None
  667. */
  668. __STATIC_INLINE void LL_SWPMI_DisableIT_SR(SWPMI_TypeDef *SWPMIx)
  669. {
  670. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_SRIE);
  671. }
  672. /**
  673. * @brief Disable Transmit complete interrupt
  674. * @rmtoll IER TCIE LL_SWPMI_DisableIT_TC
  675. * @param SWPMIx SWPMI Instance
  676. * @retval None
  677. */
  678. __STATIC_INLINE void LL_SWPMI_DisableIT_TC(SWPMI_TypeDef *SWPMIx)
  679. {
  680. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TCIE);
  681. }
  682. /**
  683. * @brief Disable Transmit interrupt
  684. * @rmtoll IER TIE LL_SWPMI_DisableIT_TX
  685. * @param SWPMIx SWPMI Instance
  686. * @retval None
  687. */
  688. __STATIC_INLINE void LL_SWPMI_DisableIT_TX(SWPMI_TypeDef *SWPMIx)
  689. {
  690. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TIE);
  691. }
  692. /**
  693. * @brief Disable Receive interrupt
  694. * @rmtoll IER RIE LL_SWPMI_DisableIT_RX
  695. * @param SWPMIx SWPMI Instance
  696. * @retval None
  697. */
  698. __STATIC_INLINE void LL_SWPMI_DisableIT_RX(SWPMI_TypeDef *SWPMIx)
  699. {
  700. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RIE);
  701. }
  702. /**
  703. * @brief Disable Transmit underrun error interrupt
  704. * @rmtoll IER TXUNRIE LL_SWPMI_DisableIT_TXUNR
  705. * @param SWPMIx SWPMI Instance
  706. * @retval None
  707. */
  708. __STATIC_INLINE void LL_SWPMI_DisableIT_TXUNR(SWPMI_TypeDef *SWPMIx)
  709. {
  710. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TXUNRIE);
  711. }
  712. /**
  713. * @brief Disable Receive overrun error interrupt
  714. * @rmtoll IER RXOVRIE LL_SWPMI_DisableIT_RXOVR
  715. * @param SWPMIx SWPMI Instance
  716. * @retval None
  717. */
  718. __STATIC_INLINE void LL_SWPMI_DisableIT_RXOVR(SWPMI_TypeDef *SWPMIx)
  719. {
  720. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RXOVRIE);
  721. }
  722. /**
  723. * @brief Disable Receive CRC error interrupt
  724. * @rmtoll IER RXBERIE LL_SWPMI_DisableIT_RXBER
  725. * @param SWPMIx SWPMI Instance
  726. * @retval None
  727. */
  728. __STATIC_INLINE void LL_SWPMI_DisableIT_RXBER(SWPMI_TypeDef *SWPMIx)
  729. {
  730. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RXBERIE);
  731. }
  732. /**
  733. * @brief Disable Transmit buffer empty interrupt
  734. * @rmtoll IER TXBEIE LL_SWPMI_DisableIT_TXBE
  735. * @param SWPMIx SWPMI Instance
  736. * @retval None
  737. */
  738. __STATIC_INLINE void LL_SWPMI_DisableIT_TXBE(SWPMI_TypeDef *SWPMIx)
  739. {
  740. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_TXBEIE);
  741. }
  742. /**
  743. * @brief Disable Receive buffer full interrupt
  744. * @rmtoll IER RXBFIE LL_SWPMI_DisableIT_RXBF
  745. * @param SWPMIx SWPMI Instance
  746. * @retval None
  747. */
  748. __STATIC_INLINE void LL_SWPMI_DisableIT_RXBF(SWPMI_TypeDef *SWPMIx)
  749. {
  750. CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE);
  751. }
  752. /**
  753. * @brief Check if Slave resume interrupt is enabled
  754. * @rmtoll IER SRIE LL_SWPMI_IsEnabledIT_SR
  755. * @param SWPMIx SWPMI Instance
  756. * @retval State of bit (1 or 0).
  757. */
  758. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_SR(const SWPMI_TypeDef *SWPMIx)
  759. {
  760. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_SRIE) == (SWPMI_IER_SRIE)) ? 1UL : 0UL);
  761. }
  762. /**
  763. * @brief Check if Transmit complete interrupt is enabled
  764. * @rmtoll IER TCIE LL_SWPMI_IsEnabledIT_TC
  765. * @param SWPMIx SWPMI Instance
  766. * @retval State of bit (1 or 0).
  767. */
  768. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TC(const SWPMI_TypeDef *SWPMIx)
  769. {
  770. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TCIE) == (SWPMI_IER_TCIE)) ? 1UL : 0UL);
  771. }
  772. /**
  773. * @brief Check if Transmit interrupt is enabled
  774. * @rmtoll IER TIE LL_SWPMI_IsEnabledIT_TX
  775. * @param SWPMIx SWPMI Instance
  776. * @retval State of bit (1 or 0).
  777. */
  778. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TX(const SWPMI_TypeDef *SWPMIx)
  779. {
  780. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TIE) == (SWPMI_IER_TIE)) ? 1UL : 0UL);
  781. }
  782. /**
  783. * @brief Check if Receive interrupt is enabled
  784. * @rmtoll IER RIE LL_SWPMI_IsEnabledIT_RX
  785. * @param SWPMIx SWPMI Instance
  786. * @retval State of bit (1 or 0).
  787. */
  788. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RX(const SWPMI_TypeDef *SWPMIx)
  789. {
  790. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RIE) == (SWPMI_IER_RIE)) ? 1UL : 0UL);
  791. }
  792. /**
  793. * @brief Check if Transmit underrun error interrupt is enabled
  794. * @rmtoll IER TXUNRIE LL_SWPMI_IsEnabledIT_TXUNR
  795. * @param SWPMIx SWPMI Instance
  796. * @retval State of bit (1 or 0).
  797. */
  798. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TXUNR(const SWPMI_TypeDef *SWPMIx)
  799. {
  800. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TXUNRIE) == (SWPMI_IER_TXUNRIE)) ? 1UL : 0UL);
  801. }
  802. /**
  803. * @brief Check if Receive overrun error interrupt is enabled
  804. * @rmtoll IER RXOVRIE LL_SWPMI_IsEnabledIT_RXOVR
  805. * @param SWPMIx SWPMI Instance
  806. * @retval State of bit (1 or 0).
  807. */
  808. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RXOVR(const SWPMI_TypeDef *SWPMIx)
  809. {
  810. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RXOVRIE) == (SWPMI_IER_RXOVRIE)) ? 1UL : 0UL);
  811. }
  812. /**
  813. * @brief Check if Receive CRC error interrupt is enabled
  814. * @rmtoll IER RXBERIE LL_SWPMI_IsEnabledIT_RXBER
  815. * @param SWPMIx SWPMI Instance
  816. * @retval State of bit (1 or 0).
  817. */
  818. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RXBER(const SWPMI_TypeDef *SWPMIx)
  819. {
  820. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RXBERIE) == (SWPMI_IER_RXBERIE)) ? 1UL : 0UL);
  821. }
  822. /**
  823. * @brief Check if Transmit buffer empty interrupt is enabled
  824. * @rmtoll IER TXBEIE LL_SWPMI_IsEnabledIT_TXBE
  825. * @param SWPMIx SWPMI Instance
  826. * @retval State of bit (1 or 0).
  827. */
  828. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_TXBE(const SWPMI_TypeDef *SWPMIx)
  829. {
  830. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TXBEIE) == (SWPMI_IER_TXBEIE)) ? 1UL : 0UL);
  831. }
  832. /**
  833. * @brief Check if Receive buffer full interrupt is enabled
  834. * @rmtoll IER RXBFIE LL_SWPMI_IsEnabledIT_RXBF
  835. * @param SWPMIx SWPMI Instance
  836. * @retval State of bit (1 or 0).
  837. */
  838. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledIT_RXBF(const SWPMI_TypeDef *SWPMIx)
  839. {
  840. return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE) == (SWPMI_IER_RXBFIE)) ? 1UL : 0UL);
  841. }
  842. /**
  843. * @}
  844. */
  845. /** @defgroup SWPMI_LL_EF_DMA_Management DMA_Management
  846. * @{
  847. */
  848. /**
  849. * @brief Enable DMA mode for reception
  850. * @rmtoll CR RXDMA LL_SWPMI_EnableDMAReq_RX
  851. * @param SWPMIx SWPMI Instance
  852. * @retval None
  853. */
  854. __STATIC_INLINE void LL_SWPMI_EnableDMAReq_RX(SWPMI_TypeDef *SWPMIx)
  855. {
  856. SET_BIT(SWPMIx->CR, SWPMI_CR_RXDMA);
  857. }
  858. /**
  859. * @brief Disable DMA mode for reception
  860. * @rmtoll CR RXDMA LL_SWPMI_DisableDMAReq_RX
  861. * @param SWPMIx SWPMI Instance
  862. * @retval None
  863. */
  864. __STATIC_INLINE void LL_SWPMI_DisableDMAReq_RX(SWPMI_TypeDef *SWPMIx)
  865. {
  866. CLEAR_BIT(SWPMIx->CR, SWPMI_CR_RXDMA);
  867. }
  868. /**
  869. * @brief Check if DMA mode for reception is enabled
  870. * @rmtoll CR RXDMA LL_SWPMI_IsEnabledDMAReq_RX
  871. * @param SWPMIx SWPMI Instance
  872. * @retval State of bit (1 or 0).
  873. */
  874. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledDMAReq_RX(const SWPMI_TypeDef *SWPMIx)
  875. {
  876. return ((READ_BIT(SWPMIx->CR, SWPMI_CR_RXDMA) == (SWPMI_CR_RXDMA)) ? 1UL : 0UL);
  877. }
  878. /**
  879. * @brief Enable DMA mode for transmission
  880. * @rmtoll CR TXDMA LL_SWPMI_EnableDMAReq_TX
  881. * @param SWPMIx SWPMI Instance
  882. * @retval None
  883. */
  884. __STATIC_INLINE void LL_SWPMI_EnableDMAReq_TX(SWPMI_TypeDef *SWPMIx)
  885. {
  886. SET_BIT(SWPMIx->CR, SWPMI_CR_TXDMA);
  887. }
  888. /**
  889. * @brief Disable DMA mode for transmission
  890. * @rmtoll CR TXDMA LL_SWPMI_DisableDMAReq_TX
  891. * @param SWPMIx SWPMI Instance
  892. * @retval None
  893. */
  894. __STATIC_INLINE void LL_SWPMI_DisableDMAReq_TX(SWPMI_TypeDef *SWPMIx)
  895. {
  896. CLEAR_BIT(SWPMIx->CR, SWPMI_CR_TXDMA);
  897. }
  898. /**
  899. * @brief Check if DMA mode for transmission is enabled
  900. * @rmtoll CR TXDMA LL_SWPMI_IsEnabledDMAReq_TX
  901. * @param SWPMIx SWPMI Instance
  902. * @retval State of bit (1 or 0).
  903. */
  904. __STATIC_INLINE uint32_t LL_SWPMI_IsEnabledDMAReq_TX(const SWPMI_TypeDef *SWPMIx)
  905. {
  906. return ((READ_BIT(SWPMIx->CR, SWPMI_CR_TXDMA) == (SWPMI_CR_TXDMA)) ? 1UL : 0UL);
  907. }
  908. /**
  909. * @brief Get the data register address used for DMA transfer
  910. * @rmtoll TDR TD LL_SWPMI_DMA_GetRegAddr\n
  911. * RDR RD LL_SWPMI_DMA_GetRegAddr
  912. * @param SWPMIx SWPMI Instance
  913. * @param Direction This parameter can be one of the following values:
  914. * @arg @ref LL_SWPMI_DMA_REG_DATA_TRANSMIT
  915. * @arg @ref LL_SWPMI_DMA_REG_DATA_RECEIVE
  916. * @retval Address of data register
  917. */
  918. __STATIC_INLINE uint32_t LL_SWPMI_DMA_GetRegAddr(const SWPMI_TypeDef *SWPMIx, uint32_t Direction)
  919. {
  920. uint32_t data_reg_addr;
  921. if (Direction == LL_SWPMI_DMA_REG_DATA_TRANSMIT)
  922. {
  923. /* return address of TDR register */
  924. data_reg_addr = (uint32_t)&(SWPMIx->TDR);
  925. }
  926. else
  927. {
  928. /* return address of RDR register */
  929. data_reg_addr = (uint32_t)&(SWPMIx->RDR);
  930. }
  931. return data_reg_addr;
  932. }
  933. /**
  934. * @}
  935. */
  936. /** @defgroup SWPMI_LL_EF_Data_Management Data_Management
  937. * @{
  938. */
  939. /**
  940. * @brief Retrieve number of data bytes present in payload of received frame
  941. * @rmtoll RFL RFL LL_SWPMI_GetReceiveFrameLength
  942. * @param SWPMIx SWPMI Instance
  943. * @retval Value between Min_Data=0x00 and Max_Data=0x1F
  944. */
  945. __STATIC_INLINE uint32_t LL_SWPMI_GetReceiveFrameLength(const SWPMI_TypeDef *SWPMIx)
  946. {
  947. return (uint32_t)(READ_BIT(SWPMIx->RFL, SWPMI_RFL_RFL));
  948. }
  949. /**
  950. * @brief Transmit Data Register
  951. * @rmtoll TDR TD LL_SWPMI_TransmitData32
  952. * @param SWPMIx SWPMI Instance
  953. * @param TxData Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
  954. * @retval None
  955. */
  956. __STATIC_INLINE void LL_SWPMI_TransmitData32(SWPMI_TypeDef *SWPMIx, uint32_t TxData)
  957. {
  958. WRITE_REG(SWPMIx->TDR, TxData);
  959. }
  960. /**
  961. * @brief Receive Data Register
  962. * @rmtoll RDR RD LL_SWPMI_ReceiveData32
  963. * @param SWPMIx SWPMI Instance
  964. * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
  965. */
  966. __STATIC_INLINE uint32_t LL_SWPMI_ReceiveData32(SWPMI_TypeDef *SWPMIx)
  967. {
  968. return (uint32_t)(READ_BIT(SWPMIx->RDR, SWPMI_RDR_RD));
  969. }
  970. /**
  971. * @brief Enable SWP Transceiver Bypass
  972. * @note The external interface for SWPMI is SWPMI_IO
  973. * (SWPMI_RX, SWPMI_TX and SWPMI_SUSPEND signals are not available on GPIOs)
  974. * @rmtoll OR TBYP LL_SWPMI_EnableTXBypass
  975. * @param SWPMIx SWPMI Instance
  976. * @retval None
  977. */
  978. __STATIC_INLINE void LL_SWPMI_EnableTXBypass(SWPMI_TypeDef *SWPMIx)
  979. {
  980. CLEAR_BIT(SWPMIx->OR, SWPMI_OR_TBYP);
  981. }
  982. /**
  983. * @brief Disable SWP Transceiver Bypass
  984. * @note SWPMI_RX, SWPMI_TX and SWPMI_SUSPEND signals are available as alternate
  985. * function on GPIOs. This configuration is selected to connect an external transceiver
  986. * @rmtoll OR TBYP LL_SWPMI_DisableTXBypass
  987. * @param SWPMIx SWPMI Instance
  988. * @retval None
  989. */
  990. __STATIC_INLINE void LL_SWPMI_DisableTXBypass(SWPMI_TypeDef *SWPMIx)
  991. {
  992. SET_BIT(SWPMIx->OR, SWPMI_OR_TBYP);
  993. }
  994. /**
  995. * @}
  996. */
  997. #if defined(USE_FULL_LL_DRIVER)
  998. /** @defgroup SWPMI_LL_EF_Init Initialization and de-initialization functions
  999. * @{
  1000. */
  1001. ErrorStatus LL_SWPMI_DeInit(const SWPMI_TypeDef *SWPMIx);
  1002. ErrorStatus LL_SWPMI_Init(SWPMI_TypeDef *SWPMIx, const LL_SWPMI_InitTypeDef *SWPMI_InitStruct);
  1003. void LL_SWPMI_StructInit(LL_SWPMI_InitTypeDef *SWPMI_InitStruct);
  1004. /**
  1005. * @}
  1006. */
  1007. #endif /*USE_FULL_LL_DRIVER*/
  1008. /**
  1009. * @}
  1010. */
  1011. /**
  1012. * @}
  1013. */
  1014. #endif /* SWPMI1 */
  1015. /**
  1016. * @}
  1017. */
  1018. #ifdef __cplusplus
  1019. }
  1020. #endif
  1021. #endif /* STM32L4xx_LL_SWPMI_H */