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