stm32l4xx_ll_swpmi.h 38 KB

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