stm32g4xx_ll_fmac.h 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  1. /**
  2. ******************************************************************************
  3. * @file stm32g4xx_ll_fmac.h
  4. * @author MCD Application Team
  5. * @brief Header file of FMAC LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2019 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 STM32G4xx_LL_FMAC_H
  20. #define STM32G4xx_LL_FMAC_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32g4xx.h"
  26. /** @addtogroup STM32G4xx_LL_Driver
  27. * @{
  28. */
  29. #if defined(FMAC)
  30. /** @defgroup FMAC_LL FMAC
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /* Exported constants --------------------------------------------------------*/
  35. /** @defgroup FMAC_LL_Exported_Constants FMAC Exported Constants
  36. * @{
  37. */
  38. /** @defgroup FMAC_LL_EC_GET_FLAG Get Flag Defines
  39. * @brief Flag defines which can be used with LL_FMAC_ReadReg function
  40. * @{
  41. */
  42. #define LL_FMAC_SR_SAT FMAC_SR_SAT /*!< Saturation Error Flag
  43. (this helps in debugging a filter) */
  44. #define LL_FMAC_SR_UNFL FMAC_SR_UNFL /*!< Underflow Error Flag */
  45. #define LL_FMAC_SR_OVFL FMAC_SR_OVFL /*!< Overflow Error Flag */
  46. #define LL_FMAC_SR_X1FULL FMAC_SR_X1FULL /*!< X1 Buffer Full Flag */
  47. #define LL_FMAC_SR_YEMPTY FMAC_SR_YEMPTY /*!< Y Buffer Empty Flag */
  48. /**
  49. * @}
  50. */
  51. /** @defgroup FMAC_LL_EC_IT IT Defines
  52. * @brief IT defines which can be used with LL_FMAC_ReadReg and LL_FMAC_WriteReg functions
  53. * @{
  54. */
  55. #define LL_FMAC_CR_SATIEN FMAC_CR_SATIEN /*!< Saturation Error Interrupt Enable
  56. (this helps in debugging a filter) */
  57. #define LL_FMAC_CR_UNFLIEN FMAC_CR_UNFLIEN /*!< Underflow Error Interrupt Enable */
  58. #define LL_FMAC_CR_OVFLIEN FMAC_CR_OVFLIEN /*!< Overflow Error Interrupt Enable */
  59. #define LL_FMAC_CR_WIEN FMAC_CR_WIEN /*!< Write Interrupt Enable */
  60. #define LL_FMAC_CR_RIEN FMAC_CR_RIEN /*!< Read Interrupt Enable */
  61. /**
  62. * @}
  63. */
  64. /** @defgroup FMAC_LL_EC_WM FMAC watermarks
  65. * @brief Watermark defines that can be used for buffer full (input) or buffer empty (output)
  66. * @{
  67. */
  68. #define LL_FMAC_WM_0_THRESHOLD_1 0x00000000U /*!< Buffer full/empty flag set if there
  69. is less than 1 free/unread space. */
  70. #define LL_FMAC_WM_1_THRESHOLD_2 0x01000000U /*!< Buffer full/empty flag set if there
  71. are less than 2 free/unread spaces. */
  72. #define LL_FMAC_WM_2_THRESHOLD_4 0x02000000U /*!< Buffer full/empty flag set if there
  73. are less than 4 free/unread spaces. */
  74. #define LL_FMAC_WM_3_THRESHOLD_8 0x03000000U /*!< Buffer full/empty flag set if there
  75. are less than 8 free/empty spaces. */
  76. /**
  77. * @}
  78. */
  79. /** @defgroup FMAC_LL_EC_FUNC FMAC functions
  80. * @{
  81. */
  82. #define LL_FMAC_FUNC_LOAD_X1 (FMAC_PARAM_FUNC_0) /*!< Load X1 buffer */
  83. #define LL_FMAC_FUNC_LOAD_X2 (FMAC_PARAM_FUNC_1) /*!< Load X2 buffer */
  84. #define LL_FMAC_FUNC_LOAD_Y (FMAC_PARAM_FUNC_1 | FMAC_PARAM_FUNC_0) /*!< Load Y buffer */
  85. #define LL_FMAC_FUNC_CONVO_FIR (FMAC_PARAM_FUNC_3) /*!< Convolution (FIR filter) */
  86. #define LL_FMAC_FUNC_IIR_DIRECT_FORM_1 (FMAC_PARAM_FUNC_3 | FMAC_PARAM_FUNC_0) /*!< IIR filter (direct form 1) */
  87. /**
  88. * @}
  89. */
  90. /** @defgroup FMAC_LL_EC_PROCESSING FMAC processing
  91. * @{
  92. */
  93. #define LL_FMAC_PROCESSING_STOP 0x00U /*!< Stop FMAC Processing */
  94. #define LL_FMAC_PROCESSING_START 0x01U /*!< Start FMAC Processing */
  95. /**
  96. * @}
  97. */
  98. /**
  99. * @}
  100. */
  101. /* External variables --------------------------------------------------------*/
  102. /* Exported macros -----------------------------------------------------------*/
  103. /** @defgroup FMAC_LL_Exported_Macros FMAC Exported Macros
  104. * @{
  105. */
  106. /** @defgroup FMAC_LL_EM_WRITE_READ Common Write and read registers Macros
  107. * @{
  108. */
  109. /**
  110. * @brief Write a value in FMAC register
  111. * @param __INSTANCE__ FMAC Instance
  112. * @param __REG__ Register to be written
  113. * @param __VALUE__ Value to be written in the register
  114. * @retval None
  115. */
  116. #define LL_FMAC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
  117. /**
  118. * @brief Read a value in FMAC register
  119. * @param __INSTANCE__ FMAC Instance
  120. * @param __REG__ Register to be read
  121. * @retval Register value
  122. */
  123. #define LL_FMAC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
  124. /**
  125. * @}
  126. */
  127. /**
  128. * @}
  129. */
  130. /* Exported functions --------------------------------------------------------*/
  131. /** @defgroup FMAC_LL_Exported_Functions FMAC Exported Functions
  132. * @{
  133. */
  134. /** @defgroup FMAC_LL_EF_Configuration FMAC Configuration functions
  135. * @{
  136. */
  137. /**
  138. * @brief Configure X1 full watermark.
  139. * @rmtoll X1BUFCFG FULL_WM LL_FMAC_SetX1FullWatermark
  140. * @param FMACx FMAC instance
  141. * @param Watermark This parameter can be one of the following values:
  142. * @arg @ref LL_FMAC_WM_0_THRESHOLD_1
  143. * @arg @ref LL_FMAC_WM_1_THRESHOLD_2
  144. * @arg @ref LL_FMAC_WM_2_THRESHOLD_4
  145. * @arg @ref LL_FMAC_WM_3_THRESHOLD_8
  146. * @retval None
  147. */
  148. __STATIC_INLINE void LL_FMAC_SetX1FullWatermark(FMAC_TypeDef *FMACx, uint32_t Watermark)
  149. {
  150. MODIFY_REG(FMACx->X1BUFCFG, FMAC_X1BUFCFG_FULL_WM, Watermark);
  151. }
  152. /**
  153. * @brief Return X1 full watermark.
  154. * @rmtoll X1BUFCFG FULL_WM LL_FMAC_GetX1FullWatermark
  155. * @param FMACx FMAC instance
  156. * @retval uint32_t Returned value can be one of the following values:
  157. * @arg @ref LL_FMAC_WM_0_THRESHOLD_1
  158. * @arg @ref LL_FMAC_WM_1_THRESHOLD_2
  159. * @arg @ref LL_FMAC_WM_2_THRESHOLD_4
  160. * @arg @ref LL_FMAC_WM_3_THRESHOLD_8
  161. */
  162. __STATIC_INLINE uint32_t LL_FMAC_GetX1FullWatermark(const FMAC_TypeDef *FMACx)
  163. {
  164. return (uint32_t)(READ_BIT(FMACx->X1BUFCFG, FMAC_X1BUFCFG_FULL_WM));
  165. }
  166. /**
  167. * @brief Configure X1 buffer size.
  168. * @rmtoll X1BUFCFG X1_BUF_SIZE LL_FMAC_SetX1BufferSize
  169. * @param FMACx FMAC instance
  170. * @param BufferSize Number of 16-bit words allocated to the input buffer (including the optional "headroom").
  171. * This parameter must be a number between Min_Data=0x01 and Max_Data=0xFF.
  172. * @retval None
  173. */
  174. __STATIC_INLINE void LL_FMAC_SetX1BufferSize(FMAC_TypeDef *FMACx, uint8_t BufferSize)
  175. {
  176. MODIFY_REG(FMACx->X1BUFCFG, FMAC_X1BUFCFG_X1_BUF_SIZE, ((uint32_t)BufferSize) << FMAC_X1BUFCFG_X1_BUF_SIZE_Pos);
  177. }
  178. /**
  179. * @brief Return X1 buffer size.
  180. * @rmtoll X1BUFCFG X1_BUF_SIZE LL_FMAC_GetX1BufferSize
  181. * @param FMACx FMAC instance
  182. * @retval uint8_t Number of 16-bit words allocated to the input buffer
  183. * (including the optional "headroom") (value between Min_Data=0x01 and Max_Data=0xFF).
  184. */
  185. __STATIC_INLINE uint8_t LL_FMAC_GetX1BufferSize(const FMAC_TypeDef *FMACx)
  186. {
  187. return (uint8_t)(READ_BIT(FMACx->X1BUFCFG, FMAC_X1BUFCFG_X1_BUF_SIZE) >> FMAC_X1BUFCFG_X1_BUF_SIZE_Pos);
  188. }
  189. /**
  190. * @brief Configure X1 base.
  191. * @rmtoll X1BUFCFG X1_BASE LL_FMAC_SetX1Base
  192. * @param FMACx FMAC instance
  193. * @param Base Base address of the input buffer (X1) within the internal memory.
  194. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  195. * @retval None
  196. */
  197. __STATIC_INLINE void LL_FMAC_SetX1Base(FMAC_TypeDef *FMACx, uint8_t Base)
  198. {
  199. MODIFY_REG(FMACx->X1BUFCFG, FMAC_X1BUFCFG_X1_BASE, ((uint32_t)Base) << FMAC_X1BUFCFG_X1_BASE_Pos);
  200. }
  201. /**
  202. * @brief Return X1 base.
  203. * @rmtoll X1BUFCFG X1_BASE LL_FMAC_GetX1Base
  204. * @param FMACx FMAC instance
  205. * @retval uint8_t Base address of the input buffer (X1) within the internal memory
  206. * (value between Min_Data=0x00 and Max_Data=0xFF).
  207. */
  208. __STATIC_INLINE uint8_t LL_FMAC_GetX1Base(const FMAC_TypeDef *FMACx)
  209. {
  210. return (uint8_t)(READ_BIT(FMACx->X1BUFCFG, FMAC_X1BUFCFG_X1_BASE) >> FMAC_X1BUFCFG_X1_BASE_Pos);
  211. }
  212. /**
  213. * @brief Configure X2 buffer size.
  214. * @rmtoll X2BUFCFG X2_BUF_SIZE LL_FMAC_SetX2BufferSize
  215. * @param FMACx FMAC instance
  216. * @param BufferSize Number of 16-bit words allocated to the coefficient buffer.
  217. * This parameter must be a number between Min_Data=0x01 and Max_Data=0xFF.
  218. * @retval None
  219. */
  220. __STATIC_INLINE void LL_FMAC_SetX2BufferSize(FMAC_TypeDef *FMACx, uint8_t BufferSize)
  221. {
  222. MODIFY_REG(FMACx->X2BUFCFG, FMAC_X2BUFCFG_X2_BUF_SIZE, ((uint32_t)BufferSize) << FMAC_X2BUFCFG_X2_BUF_SIZE_Pos);
  223. }
  224. /**
  225. * @brief Return X2 buffer size.
  226. * @rmtoll X2BUFCFG X2_BUF_SIZE LL_FMAC_GetX2BufferSize
  227. * @param FMACx FMAC instance
  228. * @retval uint8_t Number of 16-bit words allocated to the coefficient buffer
  229. * (value between Min_Data=0x01 and Max_Data=0xFF).
  230. */
  231. __STATIC_INLINE uint8_t LL_FMAC_GetX2BufferSize(const FMAC_TypeDef *FMACx)
  232. {
  233. return (uint8_t)(READ_BIT(FMACx->X2BUFCFG, FMAC_X2BUFCFG_X2_BUF_SIZE) >> FMAC_X2BUFCFG_X2_BUF_SIZE_Pos);
  234. }
  235. /**
  236. * @brief Configure X2 base.
  237. * @rmtoll X2BUFCFG X2_BASE LL_FMAC_SetX2Base
  238. * @param FMACx FMAC instance
  239. * @param Base Base address of the coefficient buffer (X2) within the internal memory.
  240. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  241. * @retval None
  242. */
  243. __STATIC_INLINE void LL_FMAC_SetX2Base(FMAC_TypeDef *FMACx, uint8_t Base)
  244. {
  245. MODIFY_REG(FMACx->X2BUFCFG, FMAC_X2BUFCFG_X2_BASE, ((uint32_t)Base) << FMAC_X2BUFCFG_X2_BASE_Pos);
  246. }
  247. /**
  248. * @brief Return X2 base.
  249. * @rmtoll X2BUFCFG X2_BASE LL_FMAC_GetX2Base
  250. * @param FMACx FMAC instance
  251. * @retval uint8_t Base address of the coefficient buffer (X2) within the internal memory
  252. * (value between Min_Data=0x00 and Max_Data=0xFF).
  253. */
  254. __STATIC_INLINE uint8_t LL_FMAC_GetX2Base(const FMAC_TypeDef *FMACx)
  255. {
  256. return (uint8_t)(READ_BIT(FMACx->X2BUFCFG, FMAC_X2BUFCFG_X2_BASE) >> FMAC_X2BUFCFG_X2_BASE_Pos);
  257. }
  258. /**
  259. * @brief Configure Y empty watermark.
  260. * @rmtoll YBUFCFG EMPTY_WM LL_FMAC_SetYEmptyWatermark
  261. * @param FMACx FMAC instance
  262. * @param Watermark This parameter can be one of the following values:
  263. * @arg @ref LL_FMAC_WM_0_THRESHOLD_1
  264. * @arg @ref LL_FMAC_WM_1_THRESHOLD_2
  265. * @arg @ref LL_FMAC_WM_2_THRESHOLD_4
  266. * @arg @ref LL_FMAC_WM_3_THRESHOLD_8
  267. * @retval None
  268. */
  269. __STATIC_INLINE void LL_FMAC_SetYEmptyWatermark(FMAC_TypeDef *FMACx, uint32_t Watermark)
  270. {
  271. MODIFY_REG(FMACx->YBUFCFG, FMAC_YBUFCFG_EMPTY_WM, Watermark);
  272. }
  273. /**
  274. * @brief Return Y empty watermark.
  275. * @rmtoll YBUFCFG EMPTY_WM LL_FMAC_GetYEmptyWatermark
  276. * @param FMACx FMAC instance
  277. * @retval uint32_t Returned value can be one of the following values:
  278. * @arg @ref LL_FMAC_WM_0_THRESHOLD_1
  279. * @arg @ref LL_FMAC_WM_1_THRESHOLD_2
  280. * @arg @ref LL_FMAC_WM_2_THRESHOLD_4
  281. * @arg @ref LL_FMAC_WM_3_THRESHOLD_8
  282. */
  283. __STATIC_INLINE uint32_t LL_FMAC_GetYEmptyWatermark(const FMAC_TypeDef *FMACx)
  284. {
  285. return (uint32_t)(READ_BIT(FMACx->YBUFCFG, FMAC_YBUFCFG_EMPTY_WM));
  286. }
  287. /**
  288. * @brief Configure Y buffer size.
  289. * @rmtoll YBUFCFG Y_BUF_SIZE LL_FMAC_SetYBufferSize
  290. * @param FMACx FMAC instance
  291. * @param BufferSize Number of 16-bit words allocated to the output buffer (including the optional "headroom").
  292. * This parameter must be a number between Min_Data=0x01 and Max_Data=0xFF.
  293. * @retval None
  294. */
  295. __STATIC_INLINE void LL_FMAC_SetYBufferSize(FMAC_TypeDef *FMACx, uint8_t BufferSize)
  296. {
  297. MODIFY_REG(FMACx->YBUFCFG, FMAC_YBUFCFG_Y_BUF_SIZE, ((uint32_t)BufferSize) << FMAC_YBUFCFG_Y_BUF_SIZE_Pos);
  298. }
  299. /**
  300. * @brief Return Y buffer size.
  301. * @rmtoll YBUFCFG Y_BUF_SIZE LL_FMAC_GetYBufferSize
  302. * @param FMACx FMAC instance
  303. * @retval uint8_t Number of 16-bit words allocated to the output buffer
  304. * (including the optional "headroom" - value between Min_Data=0x01 and Max_Data=0xFF).
  305. */
  306. __STATIC_INLINE uint8_t LL_FMAC_GetYBufferSize(const FMAC_TypeDef *FMACx)
  307. {
  308. return (uint8_t)(READ_BIT(FMACx->YBUFCFG, FMAC_YBUFCFG_Y_BUF_SIZE) >> FMAC_YBUFCFG_Y_BUF_SIZE_Pos);
  309. }
  310. /**
  311. * @brief Configure Y base.
  312. * @rmtoll YBUFCFG Y_BASE LL_FMAC_SetYBase
  313. * @param FMACx FMAC instance
  314. * @param Base Base address of the output buffer (Y) within the internal memory.
  315. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  316. * @retval None
  317. */
  318. __STATIC_INLINE void LL_FMAC_SetYBase(FMAC_TypeDef *FMACx, uint8_t Base)
  319. {
  320. MODIFY_REG(FMACx->YBUFCFG, FMAC_YBUFCFG_Y_BASE, ((uint32_t)Base) << FMAC_YBUFCFG_Y_BASE_Pos);
  321. }
  322. /**
  323. * @brief Return Y base.
  324. * @rmtoll YBUFCFG Y_BASE LL_FMAC_GetYBase
  325. * @param FMACx FMAC instance
  326. * @retval uint8_t Base address of the output buffer (Y) within the internal memory
  327. * (value between Min_Data=0x00 and Max_Data=0xFF).
  328. */
  329. __STATIC_INLINE uint8_t LL_FMAC_GetYBase(const FMAC_TypeDef *FMACx)
  330. {
  331. return (uint8_t)(READ_BIT(FMACx->YBUFCFG, FMAC_YBUFCFG_Y_BASE) >> FMAC_YBUFCFG_Y_BASE_Pos);
  332. }
  333. /**
  334. * @brief Start FMAC processing.
  335. * @rmtoll PARAM START LL_FMAC_EnableStart
  336. * @param FMACx FMAC instance
  337. * @retval None
  338. */
  339. __STATIC_INLINE void LL_FMAC_EnableStart(FMAC_TypeDef *FMACx)
  340. {
  341. SET_BIT(FMACx->PARAM, FMAC_PARAM_START);
  342. }
  343. /**
  344. * @brief Stop FMAC processing.
  345. * @rmtoll PARAM START LL_FMAC_DisableStart
  346. * @param FMACx FMAC instance
  347. * @retval None
  348. */
  349. __STATIC_INLINE void LL_FMAC_DisableStart(FMAC_TypeDef *FMACx)
  350. {
  351. CLEAR_BIT(FMACx->PARAM, FMAC_PARAM_START);
  352. }
  353. /**
  354. * @brief Check the state of FMAC processing.
  355. * @rmtoll PARAM START LL_FMAC_IsEnabledStart
  356. * @param FMACx FMAC instance
  357. * @retval uint32_t State of bit (1 or 0).
  358. */
  359. __STATIC_INLINE uint32_t LL_FMAC_IsEnabledStart(const FMAC_TypeDef *FMACx)
  360. {
  361. return ((READ_BIT(FMACx->PARAM, FMAC_PARAM_START) == (FMAC_PARAM_START)) ? 1UL : 0UL);
  362. }
  363. /**
  364. * @brief Configure function.
  365. * @rmtoll PARAM FUNC LL_FMAC_SetFunction
  366. * @param FMACx FMAC instance
  367. * @param Function This parameter can be one of the following values:
  368. * @arg @ref LL_FMAC_FUNC_LOAD_X1
  369. * @arg @ref LL_FMAC_FUNC_LOAD_X2
  370. * @arg @ref LL_FMAC_FUNC_LOAD_Y
  371. * @arg @ref LL_FMAC_FUNC_CONVO_FIR
  372. * @arg @ref LL_FMAC_FUNC_IIR_DIRECT_FORM_1
  373. * @retval None
  374. */
  375. __STATIC_INLINE void LL_FMAC_SetFunction(FMAC_TypeDef *FMACx, uint32_t Function)
  376. {
  377. MODIFY_REG(FMACx->PARAM, FMAC_PARAM_FUNC, Function);
  378. }
  379. /**
  380. * @brief Return function.
  381. * @rmtoll PARAM FUNC LL_FMAC_GetFunction
  382. * @param FMACx FMAC instance
  383. * @retval uint32_t Returned value can be one of the following values:
  384. * @arg @ref LL_FMAC_FUNC_LOAD_X1
  385. * @arg @ref LL_FMAC_FUNC_LOAD_X2
  386. * @arg @ref LL_FMAC_FUNC_LOAD_Y
  387. * @arg @ref LL_FMAC_FUNC_CONVO_FIR
  388. * @arg @ref LL_FMAC_FUNC_IIR_DIRECT_FORM_1
  389. */
  390. __STATIC_INLINE uint32_t LL_FMAC_GetFunction(const FMAC_TypeDef *FMACx)
  391. {
  392. return (uint32_t)(READ_BIT(FMACx->PARAM, FMAC_PARAM_FUNC));
  393. }
  394. /**
  395. * @brief Configure input parameter R.
  396. * @rmtoll PARAM R LL_FMAC_SetParamR
  397. * @param FMACx FMAC instance
  398. * @param Param Parameter R (gain, etc.).
  399. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  400. * @retval None
  401. */
  402. __STATIC_INLINE void LL_FMAC_SetParamR(FMAC_TypeDef *FMACx, uint8_t Param)
  403. {
  404. MODIFY_REG(FMACx->PARAM, FMAC_PARAM_R, ((uint32_t)Param) << FMAC_PARAM_R_Pos);
  405. }
  406. /**
  407. * @brief Return input parameter R.
  408. * @rmtoll PARAM R LL_FMAC_GetParamR
  409. * @param FMACx FMAC instance
  410. * @retval uint8_t Parameter R (gain, etc.) (value between Min_Data=0x00 and Max_Data=0xFF).
  411. */
  412. __STATIC_INLINE uint8_t LL_FMAC_GetParamR(const FMAC_TypeDef *FMACx)
  413. {
  414. return (uint8_t)(READ_BIT(FMACx->PARAM, FMAC_PARAM_R) >> FMAC_PARAM_R_Pos);
  415. }
  416. /**
  417. * @brief Configure input parameter Q.
  418. * @rmtoll PARAM Q LL_FMAC_SetParamQ
  419. * @param FMACx FMAC instance
  420. * @param Param Parameter Q (vector length, etc.).
  421. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  422. * @retval None
  423. */
  424. __STATIC_INLINE void LL_FMAC_SetParamQ(FMAC_TypeDef *FMACx, uint8_t Param)
  425. {
  426. MODIFY_REG(FMACx->PARAM, FMAC_PARAM_Q, ((uint32_t)Param) << FMAC_PARAM_Q_Pos);
  427. }
  428. /**
  429. * @brief Return input parameter Q.
  430. * @rmtoll PARAM Q LL_FMAC_GetParamQ
  431. * @param FMACx FMAC instance
  432. * @retval uint8_t Parameter Q (vector length, etc.) (value between Min_Data=0x00 and Max_Data=0xFF).
  433. */
  434. __STATIC_INLINE uint8_t LL_FMAC_GetParamQ(const FMAC_TypeDef *FMACx)
  435. {
  436. return (uint8_t)(READ_BIT(FMACx->PARAM, FMAC_PARAM_Q) >> FMAC_PARAM_Q_Pos);
  437. }
  438. /**
  439. * @brief Configure input parameter P.
  440. * @rmtoll PARAM P LL_FMAC_SetParamP
  441. * @param FMACx FMAC instance
  442. * @param Param Parameter P (vector length, number of filter taps, etc.).
  443. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  444. * @retval None
  445. */
  446. __STATIC_INLINE void LL_FMAC_SetParamP(FMAC_TypeDef *FMACx, uint8_t Param)
  447. {
  448. MODIFY_REG(FMACx->PARAM, FMAC_PARAM_P, ((uint32_t)Param));
  449. }
  450. /**
  451. * @brief Return input parameter P.
  452. * @rmtoll PARAM P LL_FMAC_GetParamP
  453. * @param FMACx FMAC instance
  454. * @retval uint8_t Parameter P (vector length, number of filter taps, etc.)
  455. * (value between Min_Data=0x00 and Max_Data=0xFF).
  456. */
  457. __STATIC_INLINE uint8_t LL_FMAC_GetParamP(const FMAC_TypeDef *FMACx)
  458. {
  459. return (uint8_t)(READ_BIT(FMACx->PARAM, FMAC_PARAM_P));
  460. }
  461. /**
  462. * @}
  463. */
  464. /** @defgroup FMAC_LL_EF_Reset_Management Reset_Management
  465. * @{
  466. */
  467. /**
  468. * @brief Start the FMAC reset.
  469. * @rmtoll CR RESET LL_FMAC_EnableReset
  470. * @param FMACx FMAC instance
  471. * @retval None
  472. */
  473. __STATIC_INLINE void LL_FMAC_EnableReset(FMAC_TypeDef *FMACx)
  474. {
  475. SET_BIT(FMACx->CR, FMAC_CR_RESET);
  476. }
  477. /**
  478. * @brief Check the state of the FMAC reset.
  479. * @rmtoll CR RESET LL_FMAC_IsEnabledReset
  480. * @param FMACx FMAC instance
  481. * @retval uint32_t State of bit (1 or 0).
  482. */
  483. __STATIC_INLINE uint32_t LL_FMAC_IsEnabledReset(const FMAC_TypeDef *FMACx)
  484. {
  485. return ((READ_BIT(FMACx->CR, FMAC_CR_RESET) == (FMAC_CR_RESET)) ? 1UL : 0UL);
  486. }
  487. /**
  488. * @}
  489. */
  490. /** @defgroup FMAC_LL_EF_Configuration FMAC Configuration functions
  491. * @{
  492. */
  493. /**
  494. * @brief Enable Clipping.
  495. * @rmtoll CR CLIPEN LL_FMAC_EnableClipping
  496. * @param FMACx FMAC instance
  497. * @retval None
  498. */
  499. __STATIC_INLINE void LL_FMAC_EnableClipping(FMAC_TypeDef *FMACx)
  500. {
  501. SET_BIT(FMACx->CR, FMAC_CR_CLIPEN);
  502. }
  503. /**
  504. * @brief Disable Clipping.
  505. * @rmtoll CR CLIPEN LL_FMAC_DisableClipping
  506. * @param FMACx FMAC instance
  507. * @retval None
  508. */
  509. __STATIC_INLINE void LL_FMAC_DisableClipping(FMAC_TypeDef *FMACx)
  510. {
  511. CLEAR_BIT(FMACx->CR, FMAC_CR_CLIPEN);
  512. }
  513. /**
  514. * @brief Check Clipping State.
  515. * @rmtoll CR CLIPEN LL_FMAC_IsEnabledClipping
  516. * @param FMACx FMAC instance
  517. * @retval uint32_t State of bit (1 or 0).
  518. */
  519. __STATIC_INLINE uint32_t LL_FMAC_IsEnabledClipping(const FMAC_TypeDef *FMACx)
  520. {
  521. return ((READ_BIT(FMACx->CR, FMAC_CR_CLIPEN) == (FMAC_CR_CLIPEN)) ? 1UL : 0UL);
  522. }
  523. /**
  524. * @}
  525. */
  526. /** @defgroup FMAC_LL_EF_DMA_Management DMA_Management
  527. * @{
  528. */
  529. /**
  530. * @brief Enable FMAC DMA write channel request.
  531. * @rmtoll CR DMAWEN LL_FMAC_EnableDMAReq_WRITE
  532. * @param FMACx FMAC instance
  533. * @retval None
  534. */
  535. __STATIC_INLINE void LL_FMAC_EnableDMAReq_WRITE(FMAC_TypeDef *FMACx)
  536. {
  537. SET_BIT(FMACx->CR, FMAC_CR_DMAWEN);
  538. }
  539. /**
  540. * @brief Disable FMAC DMA write channel request.
  541. * @rmtoll CR DMAWEN LL_FMAC_DisableDMAReq_WRITE
  542. * @param FMACx FMAC instance
  543. * @retval None
  544. */
  545. __STATIC_INLINE void LL_FMAC_DisableDMAReq_WRITE(FMAC_TypeDef *FMACx)
  546. {
  547. CLEAR_BIT(FMACx->CR, FMAC_CR_DMAWEN);
  548. }
  549. /**
  550. * @brief Check FMAC DMA write channel request state.
  551. * @rmtoll CR DMAWEN LL_FMAC_IsEnabledDMAReq_WRITE
  552. * @param FMACx FMAC instance
  553. * @retval uint32_t State of bit (1 or 0).
  554. */
  555. __STATIC_INLINE uint32_t LL_FMAC_IsEnabledDMAReq_WRITE(const FMAC_TypeDef *FMACx)
  556. {
  557. return ((READ_BIT(FMACx->CR, FMAC_CR_DMAWEN) == (FMAC_CR_DMAWEN)) ? 1UL : 0UL);
  558. }
  559. /**
  560. * @brief Enable FMAC DMA read channel request.
  561. * @rmtoll CR DMAREN LL_FMAC_EnableDMAReq_READ
  562. * @param FMACx FMAC instance
  563. * @retval None
  564. */
  565. __STATIC_INLINE void LL_FMAC_EnableDMAReq_READ(FMAC_TypeDef *FMACx)
  566. {
  567. SET_BIT(FMACx->CR, FMAC_CR_DMAREN);
  568. }
  569. /**
  570. * @brief Disable FMAC DMA read channel request.
  571. * @rmtoll CR DMAREN LL_FMAC_DisableDMAReq_READ
  572. * @param FMACx FMAC instance
  573. * @retval None
  574. */
  575. __STATIC_INLINE void LL_FMAC_DisableDMAReq_READ(FMAC_TypeDef *FMACx)
  576. {
  577. CLEAR_BIT(FMACx->CR, FMAC_CR_DMAREN);
  578. }
  579. /**
  580. * @brief Check FMAC DMA read channel request state.
  581. * @rmtoll CR DMAREN LL_FMAC_IsEnabledDMAReq_READ
  582. * @param FMACx FMAC instance
  583. * @retval uint32_t State of bit (1 or 0).
  584. */
  585. __STATIC_INLINE uint32_t LL_FMAC_IsEnabledDMAReq_READ(const FMAC_TypeDef *FMACx)
  586. {
  587. return ((READ_BIT(FMACx->CR, FMAC_CR_DMAREN) == (FMAC_CR_DMAREN)) ? 1UL : 0UL);
  588. }
  589. /**
  590. * @}
  591. */
  592. /** @defgroup FMAC_LL_EF_IT_Management IT_Management
  593. * @{
  594. */
  595. /**
  596. * @brief Enable FMAC saturation error interrupt.
  597. * @rmtoll CR SATIEN LL_FMAC_EnableIT_SAT
  598. * @param FMACx FMAC instance
  599. * @retval None
  600. */
  601. __STATIC_INLINE void LL_FMAC_EnableIT_SAT(FMAC_TypeDef *FMACx)
  602. {
  603. SET_BIT(FMACx->CR, FMAC_CR_SATIEN);
  604. }
  605. /**
  606. * @brief Disable FMAC saturation error interrupt.
  607. * @rmtoll CR SATIEN LL_FMAC_DisableIT_SAT
  608. * @param FMACx FMAC instance
  609. * @retval None
  610. */
  611. __STATIC_INLINE void LL_FMAC_DisableIT_SAT(FMAC_TypeDef *FMACx)
  612. {
  613. CLEAR_BIT(FMACx->CR, FMAC_CR_SATIEN);
  614. }
  615. /**
  616. * @brief Check FMAC saturation error interrupt state.
  617. * @rmtoll CR SATIEN LL_FMAC_IsEnabledIT_SAT
  618. * @param FMACx FMAC instance
  619. * @retval uint32_t State of bit (1 or 0).
  620. */
  621. __STATIC_INLINE uint32_t LL_FMAC_IsEnabledIT_SAT(const FMAC_TypeDef *FMACx)
  622. {
  623. return ((READ_BIT(FMACx->CR, FMAC_CR_SATIEN) == (FMAC_CR_SATIEN)) ? 1UL : 0UL);
  624. }
  625. /**
  626. * @brief Enable FMAC underflow error interrupt.
  627. * @rmtoll CR UNFLIEN LL_FMAC_EnableIT_UNFL
  628. * @param FMACx FMAC instance
  629. * @retval None
  630. */
  631. __STATIC_INLINE void LL_FMAC_EnableIT_UNFL(FMAC_TypeDef *FMACx)
  632. {
  633. SET_BIT(FMACx->CR, FMAC_CR_UNFLIEN);
  634. }
  635. /**
  636. * @brief Disable FMAC underflow error interrupt.
  637. * @rmtoll CR UNFLIEN LL_FMAC_DisableIT_UNFL
  638. * @param FMACx FMAC instance
  639. * @retval None
  640. */
  641. __STATIC_INLINE void LL_FMAC_DisableIT_UNFL(FMAC_TypeDef *FMACx)
  642. {
  643. CLEAR_BIT(FMACx->CR, FMAC_CR_UNFLIEN);
  644. }
  645. /**
  646. * @brief Check FMAC underflow error interrupt state.
  647. * @rmtoll CR UNFLIEN LL_FMAC_IsEnabledIT_UNFL
  648. * @param FMACx FMAC instance
  649. * @retval uint32_t State of bit (1 or 0).
  650. */
  651. __STATIC_INLINE uint32_t LL_FMAC_IsEnabledIT_UNFL(const FMAC_TypeDef *FMACx)
  652. {
  653. return ((READ_BIT(FMACx->CR, FMAC_CR_UNFLIEN) == (FMAC_CR_UNFLIEN)) ? 1UL : 0UL);
  654. }
  655. /**
  656. * @brief Enable FMAC overflow error interrupt.
  657. * @rmtoll CR OVFLIEN LL_FMAC_EnableIT_OVFL
  658. * @param FMACx FMAC instance
  659. * @retval None
  660. */
  661. __STATIC_INLINE void LL_FMAC_EnableIT_OVFL(FMAC_TypeDef *FMACx)
  662. {
  663. SET_BIT(FMACx->CR, FMAC_CR_OVFLIEN);
  664. }
  665. /**
  666. * @brief Disable FMAC overflow error interrupt.
  667. * @rmtoll CR OVFLIEN LL_FMAC_DisableIT_OVFL
  668. * @param FMACx FMAC instance
  669. * @retval None
  670. */
  671. __STATIC_INLINE void LL_FMAC_DisableIT_OVFL(FMAC_TypeDef *FMACx)
  672. {
  673. CLEAR_BIT(FMACx->CR, FMAC_CR_OVFLIEN);
  674. }
  675. /**
  676. * @brief Check FMAC overflow error interrupt state.
  677. * @rmtoll CR OVFLIEN LL_FMAC_IsEnabledIT_OVFL
  678. * @param FMACx FMAC instance
  679. * @retval uint32_t State of bit (1 or 0).
  680. */
  681. __STATIC_INLINE uint32_t LL_FMAC_IsEnabledIT_OVFL(const FMAC_TypeDef *FMACx)
  682. {
  683. return ((READ_BIT(FMACx->CR, FMAC_CR_OVFLIEN) == (FMAC_CR_OVFLIEN)) ? 1UL : 0UL);
  684. }
  685. /**
  686. * @brief Enable FMAC write interrupt.
  687. * @rmtoll CR WIEN LL_FMAC_EnableIT_WR
  688. * @param FMACx FMAC instance
  689. * @retval None
  690. */
  691. __STATIC_INLINE void LL_FMAC_EnableIT_WR(FMAC_TypeDef *FMACx)
  692. {
  693. SET_BIT(FMACx->CR, FMAC_CR_WIEN);
  694. }
  695. /**
  696. * @brief Disable FMAC write interrupt.
  697. * @rmtoll CR WIEN LL_FMAC_DisableIT_WR
  698. * @param FMACx FMAC instance
  699. * @retval None
  700. */
  701. __STATIC_INLINE void LL_FMAC_DisableIT_WR(FMAC_TypeDef *FMACx)
  702. {
  703. CLEAR_BIT(FMACx->CR, FMAC_CR_WIEN);
  704. }
  705. /**
  706. * @brief Check FMAC write interrupt state.
  707. * @rmtoll CR WIEN LL_FMAC_IsEnabledIT_WR
  708. * @param FMACx FMAC instance
  709. * @retval uint32_t State of bit (1 or 0).
  710. */
  711. __STATIC_INLINE uint32_t LL_FMAC_IsEnabledIT_WR(const FMAC_TypeDef *FMACx)
  712. {
  713. return ((READ_BIT(FMACx->CR, FMAC_CR_WIEN) == (FMAC_CR_WIEN)) ? 1UL : 0UL);
  714. }
  715. /**
  716. * @brief Enable FMAC read interrupt.
  717. * @rmtoll CR RIEN LL_FMAC_EnableIT_RD
  718. * @param FMACx FMAC instance
  719. * @retval None
  720. */
  721. __STATIC_INLINE void LL_FMAC_EnableIT_RD(FMAC_TypeDef *FMACx)
  722. {
  723. SET_BIT(FMACx->CR, FMAC_CR_RIEN);
  724. }
  725. /**
  726. * @brief Disable FMAC read interrupt.
  727. * @rmtoll CR RIEN LL_FMAC_DisableIT_RD
  728. * @param FMACx FMAC instance
  729. * @retval None
  730. */
  731. __STATIC_INLINE void LL_FMAC_DisableIT_RD(FMAC_TypeDef *FMACx)
  732. {
  733. CLEAR_BIT(FMACx->CR, FMAC_CR_RIEN);
  734. }
  735. /**
  736. * @brief Check FMAC read interrupt state.
  737. * @rmtoll CR RIEN LL_FMAC_IsEnabledIT_RD
  738. * @param FMACx FMAC instance
  739. * @retval uint32_t State of bit (1 or 0).
  740. */
  741. __STATIC_INLINE uint32_t LL_FMAC_IsEnabledIT_RD(const FMAC_TypeDef *FMACx)
  742. {
  743. return ((READ_BIT(FMACx->CR, FMAC_CR_RIEN) == (FMAC_CR_RIEN)) ? 1UL : 0UL);
  744. }
  745. /**
  746. * @}
  747. */
  748. /** @defgroup FMAC_LL_EF_FLAG_Management FLAG_Management
  749. * @{
  750. */
  751. /**
  752. * @brief Check FMAC saturation error flag state.
  753. * @rmtoll SR SAT LL_FMAC_IsActiveFlag_SAT
  754. * @param FMACx FMAC instance
  755. * @retval uint32_t State of bit (1 or 0).
  756. */
  757. __STATIC_INLINE uint32_t LL_FMAC_IsActiveFlag_SAT(const FMAC_TypeDef *FMACx)
  758. {
  759. return ((READ_BIT(FMACx->SR, FMAC_SR_SAT) == (FMAC_SR_SAT)) ? 1UL : 0UL);
  760. }
  761. /**
  762. * @brief Check FMAC underflow error flag state.
  763. * @rmtoll SR UNFL LL_FMAC_IsActiveFlag_UNFL
  764. * @param FMACx FMAC instance
  765. * @retval uint32_t State of bit (1 or 0).
  766. */
  767. __STATIC_INLINE uint32_t LL_FMAC_IsActiveFlag_UNFL(const FMAC_TypeDef *FMACx)
  768. {
  769. return ((READ_BIT(FMACx->SR, FMAC_SR_UNFL) == (FMAC_SR_UNFL)) ? 1UL : 0UL);
  770. }
  771. /**
  772. * @brief Check FMAC overflow error flag state.
  773. * @rmtoll SR OVFL LL_FMAC_IsActiveFlag_OVFL
  774. * @param FMACx FMAC instance
  775. * @retval uint32_t State of bit (1 or 0).
  776. */
  777. __STATIC_INLINE uint32_t LL_FMAC_IsActiveFlag_OVFL(const FMAC_TypeDef *FMACx)
  778. {
  779. return ((READ_BIT(FMACx->SR, FMAC_SR_OVFL) == (FMAC_SR_OVFL)) ? 1UL : 0UL);
  780. }
  781. /**
  782. * @brief Check FMAC X1 buffer full flag state.
  783. * @rmtoll SR X1FULL LL_FMAC_IsActiveFlag_X1FULL
  784. * @param FMACx FMAC instance
  785. * @retval uint32_t State of bit (1 or 0).
  786. */
  787. __STATIC_INLINE uint32_t LL_FMAC_IsActiveFlag_X1FULL(const FMAC_TypeDef *FMACx)
  788. {
  789. return ((READ_BIT(FMACx->SR, FMAC_SR_X1FULL) == (FMAC_SR_X1FULL)) ? 1UL : 0UL);
  790. }
  791. /**
  792. * @brief Check FMAC Y buffer empty flag state.
  793. * @rmtoll SR YEMPTY LL_FMAC_IsActiveFlag_YEMPTY
  794. * @param FMACx FMAC instance
  795. * @retval uint32_t State of bit (1 or 0).
  796. */
  797. __STATIC_INLINE uint32_t LL_FMAC_IsActiveFlag_YEMPTY(const FMAC_TypeDef *FMACx)
  798. {
  799. return ((READ_BIT(FMACx->SR, FMAC_SR_YEMPTY) == (FMAC_SR_YEMPTY)) ? 1UL : 0UL);
  800. }
  801. /**
  802. * @}
  803. */
  804. /** @defgroup FMAC_LL_EF_Data_Management Data_Management
  805. * @{
  806. */
  807. /**
  808. * @brief Write 16-bit input data for the FMAC processing.
  809. * @rmtoll WDATA WDATA LL_FMAC_WriteData
  810. * @param FMACx FMAC instance
  811. * @param InData 16-bit value to be provided as input data for FMAC processing.
  812. * This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
  813. * @retval None
  814. */
  815. __STATIC_INLINE void LL_FMAC_WriteData(FMAC_TypeDef *FMACx, uint16_t InData)
  816. {
  817. WRITE_REG(FMACx->WDATA, InData);
  818. }
  819. /**
  820. * @brief Return 16-bit output data of FMAC processing.
  821. * @rmtoll RDATA RDATA LL_FMAC_ReadData
  822. * @param FMACx FMAC instance
  823. * @retval uint16_t 16-bit output data of FMAC processing (value between Min_Data=0x0000 and Max_Data=0xFFFF).
  824. */
  825. __STATIC_INLINE uint16_t LL_FMAC_ReadData(const FMAC_TypeDef *FMACx)
  826. {
  827. return (uint16_t)(READ_REG(FMACx->RDATA));
  828. }
  829. /**
  830. * @}
  831. */
  832. /** @defgroup FMAC_LL_EF_Configuration FMAC Configuration functions
  833. * @{
  834. */
  835. /**
  836. * @brief Configure memory for X1 buffer.
  837. * @rmtoll X1BUFCFG FULL_WM LL_FMAC_ConfigX1\n
  838. * X1BUFCFG X1_BASE LL_FMAC_ConfigX1\n
  839. * X1BUFCFG X1_BUF_SIZE LL_FMAC_ConfigX1
  840. * @param FMACx FMAC instance
  841. * @param Watermark This parameter can be one of the following values:
  842. * @arg @ref LL_FMAC_WM_0_THRESHOLD_1
  843. * @arg @ref LL_FMAC_WM_1_THRESHOLD_2
  844. * @arg @ref LL_FMAC_WM_2_THRESHOLD_4
  845. * @arg @ref LL_FMAC_WM_3_THRESHOLD_8
  846. * @param Base Base address of the input buffer (X1) within the internal memory.
  847. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  848. * @param BufferSize Number of 16-bit words allocated to the input buffer (including the optional "headroom").
  849. * This parameter must be a number between Min_Data=0x01 and Max_Data=0xFF.
  850. * @retval None
  851. */
  852. __STATIC_INLINE void LL_FMAC_ConfigX1(FMAC_TypeDef *FMACx, uint32_t Watermark, uint8_t Base, uint8_t BufferSize)
  853. {
  854. MODIFY_REG(FMACx->X1BUFCFG, FMAC_X1BUFCFG_FULL_WM | FMAC_X1BUFCFG_X1_BASE | FMAC_X1BUFCFG_X1_BUF_SIZE,
  855. Watermark | (((uint32_t)Base) << FMAC_X1BUFCFG_X1_BASE_Pos) |
  856. (((uint32_t)BufferSize) << FMAC_X1BUFCFG_X1_BUF_SIZE_Pos));
  857. }
  858. /**
  859. * @brief Configure memory for X2 buffer.
  860. * @rmtoll X2BUFCFG X2_BASE LL_FMAC_ConfigX2\n
  861. * X2BUFCFG X2_BUF_SIZE LL_FMAC_ConfigX2
  862. * @param FMACx FMAC instance
  863. * @param Base Base address of the coefficient buffer (X2) within the internal memory.
  864. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  865. * @param BufferSize Number of 16-bit words allocated to the coefficient buffer.
  866. * This parameter must be a number between Min_Data=0x01 and Max_Data=0xFF.
  867. * @retval None
  868. */
  869. __STATIC_INLINE void LL_FMAC_ConfigX2(FMAC_TypeDef *FMACx, uint8_t Base, uint8_t BufferSize)
  870. {
  871. MODIFY_REG(FMACx->X2BUFCFG, FMAC_X2BUFCFG_X2_BASE | FMAC_X2BUFCFG_X2_BUF_SIZE,
  872. (((uint32_t)Base) << FMAC_X2BUFCFG_X2_BASE_Pos) |
  873. (((uint32_t)BufferSize) << FMAC_X2BUFCFG_X2_BUF_SIZE_Pos));
  874. }
  875. /**
  876. * @brief Configure memory for Y buffer.
  877. * @rmtoll YBUFCFG EMPTY_WM LL_FMAC_ConfigY\n
  878. * YBUFCFG Y_BASE LL_FMAC_ConfigY\n
  879. * YBUFCFG Y_BUF_SIZE LL_FMAC_ConfigY
  880. * @param FMACx FMAC instance
  881. * @param Watermark This parameter can be one of the following values:
  882. * @arg @ref LL_FMAC_WM_0_THRESHOLD_1
  883. * @arg @ref LL_FMAC_WM_1_THRESHOLD_2
  884. * @arg @ref LL_FMAC_WM_2_THRESHOLD_4
  885. * @arg @ref LL_FMAC_WM_3_THRESHOLD_8
  886. * @param Base Base address of the output buffer (Y) within the internal memory.
  887. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  888. * @param BufferSize Number of 16-bit words allocated to the output buffer (including the optional "headroom").
  889. * This parameter must be a number between Min_Data=0x01 and Max_Data=0xFF.
  890. * @retval None
  891. */
  892. __STATIC_INLINE void LL_FMAC_ConfigY(FMAC_TypeDef *FMACx, uint32_t Watermark, uint8_t Base, uint8_t BufferSize)
  893. {
  894. MODIFY_REG(FMACx->YBUFCFG, FMAC_YBUFCFG_EMPTY_WM | FMAC_YBUFCFG_Y_BASE | FMAC_YBUFCFG_Y_BUF_SIZE,
  895. Watermark | (((uint32_t)Base) << FMAC_YBUFCFG_Y_BASE_Pos) |
  896. (((uint32_t)BufferSize) << FMAC_YBUFCFG_Y_BUF_SIZE_Pos));
  897. }
  898. /**
  899. * @brief Configure the FMAC processing.
  900. * @rmtoll PARAM START LL_FMAC_ConfigFunc\n
  901. * PARAM FUNC LL_FMAC_ConfigFunc\n
  902. * PARAM P LL_FMAC_ConfigFunc\n
  903. * PARAM Q LL_FMAC_ConfigFunc\n
  904. * PARAM R LL_FMAC_ConfigFunc
  905. * @param FMACx FMAC instance
  906. * @param Start This parameter can be one of the following values:
  907. * @arg @ref LL_FMAC_PROCESSING_STOP
  908. * @arg @ref LL_FMAC_PROCESSING_START
  909. * @param Function This parameter can be one of the following values:
  910. * @arg @ref LL_FMAC_FUNC_LOAD_X1
  911. * @arg @ref LL_FMAC_FUNC_LOAD_X2
  912. * @arg @ref LL_FMAC_FUNC_LOAD_Y
  913. * @arg @ref LL_FMAC_FUNC_CONVO_FIR
  914. * @arg @ref LL_FMAC_FUNC_IIR_DIRECT_FORM_1
  915. * @param ParamP Parameter P (vector length, number of filter taps, etc.).
  916. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  917. * @param ParamQ Parameter Q (vector length, etc.).
  918. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  919. * @param ParamR Parameter R (gain, etc.).
  920. * This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
  921. * @retval None
  922. */
  923. __STATIC_INLINE void LL_FMAC_ConfigFunc(FMAC_TypeDef *FMACx, uint8_t Start, uint32_t Function, uint8_t ParamP,
  924. uint8_t ParamQ, uint8_t ParamR)
  925. {
  926. MODIFY_REG(FMACx->PARAM, FMAC_PARAM_START | FMAC_PARAM_FUNC | FMAC_PARAM_P | FMAC_PARAM_Q | FMAC_PARAM_R,
  927. (((uint32_t)Start) << FMAC_PARAM_START_Pos) | Function | (((uint32_t)ParamP) << FMAC_PARAM_P_Pos) |
  928. (((uint32_t)ParamQ) << FMAC_PARAM_Q_Pos) | (((uint32_t)ParamR) << FMAC_PARAM_R_Pos));
  929. }
  930. /**
  931. * @}
  932. */
  933. #if defined(USE_FULL_LL_DRIVER)
  934. /** @defgroup FMAC_LL_EF_Init Initialization and de-initialization functions
  935. * @{
  936. */
  937. ErrorStatus LL_FMAC_Init(FMAC_TypeDef *FMACx);
  938. ErrorStatus LL_FMAC_DeInit(const FMAC_TypeDef *FMACx);
  939. /**
  940. * @}
  941. */
  942. #endif /* USE_FULL_LL_DRIVER */
  943. /**
  944. * @}
  945. */
  946. /**
  947. * @}
  948. */
  949. #endif /* defined(FMAC) */
  950. /**
  951. * @}
  952. */
  953. #ifdef __cplusplus
  954. }
  955. #endif
  956. #endif /* STM32G4xx_LL_FMAC_H */