Merge pull request #11270 from haslinghuis/rename_attr
[betaflight.git] / lib / main / STM32H7 / Drivers / STM32H7xx_HAL_Driver / Inc / stm32h7xx_ll_fmac.h
blob4bc018c33b9439f6c3e9a983806c9482885ce28b
1 /**
2 ******************************************************************************
3 * @file stm32h7xx_ll_fmac.h
4 * @author MCD Application Team
5 * @brief Header file of FMAC LL module.
6 ******************************************************************************
7 * @attention
9 * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
10 * All rights reserved.</center></h2>
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
17 ******************************************************************************
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32H7xx_LL_FMAC_H
22 #define STM32H7xx_LL_FMAC_H
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32h7xx.h"
31 /** @addtogroup STM32H7xx_LL_Driver
32 * @{
35 #if defined(FMAC)
37 /** @defgroup FMAC_LL FMAC
38 * @{
41 /* Private variables ---------------------------------------------------------*/
43 /* Private constants ---------------------------------------------------------*/
45 /* Private macros ------------------------------------------------------------*/
46 #if defined(USE_FULL_LL_DRIVER)
47 /** @defgroup FMAC_LL_Private_Macros FMAC Private Macros
48 * @{
50 /**
51 * @}
53 #endif /*USE_FULL_LL_DRIVER*/
55 /* Exported types ------------------------------------------------------------*/
57 /* Exported constants --------------------------------------------------------*/
58 /** @defgroup FMAC_LL_Exported_Constants FMAC Exported Constants
59 * @{
62 /** @defgroup FMAC_LL_EC_GET_FLAG Get Flag Defines
63 * @brief Flag defines which can be used with LL_FMAC_ReadReg function
64 * @{
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 * @}
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 * @{
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 * @}
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 * @{
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 * @}
100 /** @defgroup FMAC_LL_EC_FUNC FMAC functions
101 * @{
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) */
109 * @}
113 * @}
116 /* Exported macro ------------------------------------------------------------*/
117 /** @defgroup FMAC_LL_Exported_Macros FMAC Exported Macros
118 * @{
121 /** @defgroup FMAC_LL_EM_WRITE_READ Common Write and read registers Macros
122 * @{
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
132 #define LL_FMAC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
135 * @brief Read a value in FMAC register
136 * @param __INSTANCE__ FMAC Instance
137 * @param __REG__ Register to be read
138 * @retval Register value
140 #define LL_FMAC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
142 * @}
146 * @}
150 /* Exported functions --------------------------------------------------------*/
152 /** @defgroup FMAC_LL_Exported_Functions FMAC Exported Functions
153 * @{
156 /** @defgroup FMAC_LL_EF_Configuration FMAC Configuration functions
157 * @{
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
171 __STATIC_INLINE void LL_FMAC_SetX1FullWatermark(FMAC_TypeDef *FMACx, uint32_t Watermark)
173 MODIFY_REG(FMACx->X1BUFCFG, FMAC_X1BUFCFG_FULL_WM, Watermark);
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
186 __STATIC_INLINE uint32_t LL_FMAC_GetX1FullWatermark(FMAC_TypeDef *FMACx)
188 return (uint32_t)(READ_BIT(FMACx->X1BUFCFG, FMAC_X1BUFCFG_FULL_WM));
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
198 __STATIC_INLINE void LL_FMAC_SetX1BufferSize(FMAC_TypeDef *FMACx, uint8_t BufferSize)
200 MODIFY_REG(FMACx->X1BUFCFG, FMAC_X1BUFCFG_X1_BUF_SIZE, ((uint32_t)BufferSize) << FMAC_X1BUFCFG_X1_BUF_SIZE_Pos);
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").
209 __STATIC_INLINE uint8_t LL_FMAC_GetX1BufferSize(FMAC_TypeDef *FMACx)
211 return (uint8_t)(READ_BIT(FMACx->X1BUFCFG, FMAC_X1BUFCFG_X1_BUF_SIZE) >> FMAC_X1BUFCFG_X1_BUF_SIZE_Pos);
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
221 __STATIC_INLINE void LL_FMAC_SetX1Base(FMAC_TypeDef *FMACx, uint8_t Base)
223 MODIFY_REG(FMACx->X1BUFCFG, FMAC_X1BUFCFG_X1_BASE, ((uint32_t)Base) << FMAC_X1BUFCFG_X1_BASE_Pos);
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.
232 __STATIC_INLINE uint8_t LL_FMAC_GetX1Base(FMAC_TypeDef *FMACx)
234 return (uint8_t)(READ_BIT(FMACx->X1BUFCFG, FMAC_X1BUFCFG_X1_BASE) >> FMAC_X1BUFCFG_X1_BASE_Pos);
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
244 __STATIC_INLINE void LL_FMAC_SetX2BufferSize(FMAC_TypeDef *FMACx, uint8_t BufferSize)
246 MODIFY_REG(FMACx->X2BUFCFG, FMAC_X2BUFCFG_X2_BUF_SIZE, ((uint32_t)BufferSize) << FMAC_X2BUFCFG_X2_BUF_SIZE_Pos);
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.
255 __STATIC_INLINE uint8_t LL_FMAC_GetX2BufferSize(FMAC_TypeDef *FMACx)
257 return (uint8_t)(READ_BIT(FMACx->X2BUFCFG, FMAC_X2BUFCFG_X2_BUF_SIZE) >> FMAC_X2BUFCFG_X2_BUF_SIZE_Pos);
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
267 __STATIC_INLINE void LL_FMAC_SetX2Base(FMAC_TypeDef *FMACx, uint8_t Base)
269 MODIFY_REG(FMACx->X2BUFCFG, FMAC_X2BUFCFG_X2_BASE, ((uint32_t)Base) << FMAC_X2BUFCFG_X2_BASE_Pos);
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.
278 __STATIC_INLINE uint8_t LL_FMAC_GetX2Base(FMAC_TypeDef *FMACx)
280 return (uint8_t)(READ_BIT(FMACx->X2BUFCFG, FMAC_X2BUFCFG_X2_BASE) >> FMAC_X2BUFCFG_X2_BASE_Pos);
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
294 __STATIC_INLINE void LL_FMAC_SetYEmptyWatermark(FMAC_TypeDef *FMACx, uint32_t Watermark)
296 MODIFY_REG(FMACx->YBUFCFG, FMAC_YBUFCFG_EMPTY_WM, Watermark);
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
309 __STATIC_INLINE uint32_t LL_FMAC_GetYEmptyWatermark(FMAC_TypeDef *FMACx)
311 return (uint32_t)(READ_BIT(FMACx->YBUFCFG, FMAC_YBUFCFG_EMPTY_WM));
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
321 __STATIC_INLINE void LL_FMAC_SetYBufferSize(FMAC_TypeDef *FMACx, uint8_t BufferSize)
323 MODIFY_REG(FMACx->YBUFCFG, FMAC_YBUFCFG_Y_BUF_SIZE, ((uint32_t)BufferSize) << FMAC_YBUFCFG_Y_BUF_SIZE_Pos);
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").
332 __STATIC_INLINE uint8_t LL_FMAC_GetYBufferSize(FMAC_TypeDef *FMACx)
334 return (uint8_t)(READ_BIT(FMACx->YBUFCFG, FMAC_YBUFCFG_Y_BUF_SIZE) >> FMAC_YBUFCFG_Y_BUF_SIZE_Pos);
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
344 __STATIC_INLINE void LL_FMAC_SetYBase(FMAC_TypeDef *FMACx, uint8_t Base)
346 MODIFY_REG(FMACx->YBUFCFG, FMAC_YBUFCFG_Y_BASE, ((uint32_t)Base) << FMAC_YBUFCFG_Y_BASE_Pos);
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.
355 __STATIC_INLINE uint8_t LL_FMAC_GetYBase(FMAC_TypeDef *FMACx)
357 return (uint8_t)(READ_BIT(FMACx->YBUFCFG, FMAC_YBUFCFG_Y_BASE) >> FMAC_YBUFCFG_Y_BASE_Pos);
361 * @brief Start FMAC processing.
362 * @rmtoll PARAM START LL_FMAC_EnableStart
363 * @param FMACx FMAC instance
364 * @retval None
366 __STATIC_INLINE void LL_FMAC_EnableStart(FMAC_TypeDef *FMACx)
368 SET_BIT(FMACx->PARAM, FMAC_PARAM_START);
372 * @brief Stop FMAC processing.
373 * @rmtoll PARAM START LL_FMAC_DisableStart
374 * @param FMACx FMAC instance
375 * @retval None
377 __STATIC_INLINE void LL_FMAC_DisableStart(FMAC_TypeDef *FMACx)
379 CLEAR_BIT(FMACx->PARAM, FMAC_PARAM_START);
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).
388 __STATIC_INLINE uint32_t LL_FMAC_IsEnabledStart(FMAC_TypeDef *FMACx)
390 return ((READ_BIT(FMACx->PARAM, FMAC_PARAM_START) == (FMAC_PARAM_START)) ? 1UL : 0UL);
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
405 __STATIC_INLINE void LL_FMAC_SetFunction(FMAC_TypeDef *FMACx, uint32_t Function)
407 MODIFY_REG(FMACx->PARAM, FMAC_PARAM_FUNC, Function);
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
421 __STATIC_INLINE uint32_t LL_FMAC_GetFunction(FMAC_TypeDef *FMACx)
423 return (uint32_t)(READ_BIT(FMACx->PARAM, FMAC_PARAM_FUNC));
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
433 __STATIC_INLINE void LL_FMAC_SetParamR(FMAC_TypeDef *FMACx, uint8_t Param)
435 MODIFY_REG(FMACx->PARAM, FMAC_PARAM_R, ((uint32_t)Param) << FMAC_PARAM_R_Pos);
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.).
444 __STATIC_INLINE uint8_t LL_FMAC_GetParamR(FMAC_TypeDef *FMACx)
446 return (uint8_t)(READ_BIT(FMACx->PARAM, FMAC_PARAM_R) >> FMAC_PARAM_R_Pos);
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
456 __STATIC_INLINE void LL_FMAC_SetParamQ(FMAC_TypeDef *FMACx, uint8_t Param)
458 MODIFY_REG(FMACx->PARAM, FMAC_PARAM_Q, ((uint32_t)Param) << FMAC_PARAM_Q_Pos);
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.).
467 __STATIC_INLINE uint8_t LL_FMAC_GetParamQ(FMAC_TypeDef *FMACx)
469 return (uint8_t)(READ_BIT(FMACx->PARAM, FMAC_PARAM_Q) >> FMAC_PARAM_Q_Pos);
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
479 __STATIC_INLINE void LL_FMAC_SetParamP(FMAC_TypeDef *FMACx, uint8_t Param)
481 MODIFY_REG(FMACx->PARAM, FMAC_PARAM_P, ((uint32_t)Param) << FMAC_PARAM_P_Pos);
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.).
490 __STATIC_INLINE uint8_t LL_FMAC_GetParamP(FMAC_TypeDef *FMACx)
492 return (uint8_t)(READ_BIT(FMACx->PARAM, FMAC_PARAM_P) >> FMAC_PARAM_P_Pos);
496 * @}
499 /** @defgroup FMAC_LL_EF_Reset_Management Reset_Management
500 * @{
504 * @brief Start the FMAC reset.
505 * @rmtoll CR RESET LL_FMAC_EnableReset
506 * @param FMACx FMAC instance
507 * @retval None
509 __STATIC_INLINE void LL_FMAC_EnableReset(FMAC_TypeDef *FMACx)
511 SET_BIT(FMACx->CR, FMAC_CR_RESET);
515 * @brief Interrupt the FMAC reset.
516 * @rmtoll CR RESET LL_FMAC_DisableReset
517 * @param FMACx FMAC instance
518 * @retval None
520 __STATIC_INLINE void LL_FMAC_DisableReset(FMAC_TypeDef *FMACx)
522 CLEAR_BIT(FMACx->CR, FMAC_CR_RESET);
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).
531 __STATIC_INLINE uint32_t LL_FMAC_IsEnabledReset(FMAC_TypeDef *FMACx)
533 return ((READ_BIT(FMACx->CR, FMAC_CR_RESET) == (FMAC_CR_RESET)) ? 1UL : 0UL);
537 * @}
540 /** @defgroup FMAC_LL_EF_Configuration FMAC Configuration functions
541 * @{
545 * @brief Enable Clipping.
546 * @rmtoll CR CLIPEN LL_FMAC_EnableClipping
547 * @param FMACx FMAC instance
548 * @retval None
550 __STATIC_INLINE void LL_FMAC_EnableClipping(FMAC_TypeDef *FMACx)
552 SET_BIT(FMACx->CR, FMAC_CR_CLIPEN);
556 * @brief Disable Clipping.
557 * @rmtoll CR CLIPEN LL_FMAC_DisableClipping
558 * @param FMACx FMAC instance
559 * @retval None
561 __STATIC_INLINE void LL_FMAC_DisableClipping(FMAC_TypeDef *FMACx)
563 CLEAR_BIT(FMACx->CR, FMAC_CR_CLIPEN);
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).
572 __STATIC_INLINE uint32_t LL_FMAC_IsEnabledClipping(FMAC_TypeDef *FMACx)
574 return ((READ_BIT(FMACx->CR, FMAC_CR_CLIPEN) == (FMAC_CR_CLIPEN)) ? 1UL : 0UL);
578 * @}
581 /** @defgroup FMAC_LL_EF_DMA_Management DMA_Management
582 * @{
586 * @brief Enable FMAC DMA write channel request.
587 * @rmtoll CR DMAWEN LL_FMAC_EnableDMAReq_WRITE
588 * @param FMACx FMAC instance
589 * @retval None
591 __STATIC_INLINE void LL_FMAC_EnableDMAReq_WRITE(FMAC_TypeDef *FMACx)
593 SET_BIT(FMACx->CR, FMAC_CR_DMAWEN);
597 * @brief Disable FMAC DMA write channel request.
598 * @rmtoll CR DMAWEN LL_FMAC_DisableDMAReq_WRITE
599 * @param FMACx FMAC instance
600 * @retval None
602 __STATIC_INLINE void LL_FMAC_DisableDMAReq_WRITE(FMAC_TypeDef *FMACx)
604 CLEAR_BIT(FMACx->CR, FMAC_CR_DMAWEN);
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).
613 __STATIC_INLINE uint32_t LL_FMAC_IsEnabledDMAReq_WRITE(FMAC_TypeDef *FMACx)
615 return ((READ_BIT(FMACx->CR, FMAC_CR_DMAWEN) == (FMAC_CR_DMAWEN)) ? 1UL : 0UL);
619 * @brief Enable FMAC DMA read channel request.
620 * @rmtoll CR DMAREN LL_FMAC_EnableDMAReq_READ
621 * @param FMACx FMAC instance
622 * @retval None
624 __STATIC_INLINE void LL_FMAC_EnableDMAReq_READ(FMAC_TypeDef *FMACx)
626 SET_BIT(FMACx->CR, FMAC_CR_DMAREN);
630 * @brief Disable FMAC DMA read channel request.
631 * @rmtoll CR DMAREN LL_FMAC_DisableDMAReq_READ
632 * @param FMACx FMAC instance
633 * @retval None
635 __STATIC_INLINE void LL_FMAC_DisableDMAReq_READ(FMAC_TypeDef *FMACx)
637 CLEAR_BIT(FMACx->CR, FMAC_CR_DMAREN);
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).
646 __STATIC_INLINE uint32_t LL_FMAC_IsEnabledDMAReq_READ(FMAC_TypeDef *FMACx)
648 return ((READ_BIT(FMACx->CR, FMAC_CR_DMAREN) == (FMAC_CR_DMAREN)) ? 1UL : 0UL);
652 * @}
655 /** @defgroup FMAC_LL_EF_IT_Management IT_Management
656 * @{
660 * @brief Enable FMAC saturation error interrupt.
661 * @rmtoll CR SATIEN LL_FMAC_EnableIT_SAT
662 * @param FMACx FMAC instance
663 * @retval None
665 __STATIC_INLINE void LL_FMAC_EnableIT_SAT(FMAC_TypeDef *FMACx)
667 SET_BIT(FMACx->CR, FMAC_CR_SATIEN);
671 * @brief Disable FMAC saturation error interrupt.
672 * @rmtoll CR SATIEN LL_FMAC_DisableIT_SAT
673 * @param FMACx FMAC instance
674 * @retval None
676 __STATIC_INLINE void LL_FMAC_DisableIT_SAT(FMAC_TypeDef *FMACx)
678 CLEAR_BIT(FMACx->CR, FMAC_CR_SATIEN);
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).
687 __STATIC_INLINE uint32_t LL_FMAC_IsEnabledIT_SAT(FMAC_TypeDef *FMACx)
689 return ((READ_BIT(FMACx->CR, FMAC_CR_SATIEN) == (FMAC_CR_SATIEN)) ? 1UL : 0UL);
693 * @brief Enable FMAC underflow error interrupt.
694 * @rmtoll CR UNFLIEN LL_FMAC_EnableIT_UNFL
695 * @param FMACx FMAC instance
696 * @retval None
698 __STATIC_INLINE void LL_FMAC_EnableIT_UNFL(FMAC_TypeDef *FMACx)
700 SET_BIT(FMACx->CR, FMAC_CR_UNFLIEN);
704 * @brief Disable FMAC underflow error interrupt.
705 * @rmtoll CR UNFLIEN LL_FMAC_DisableIT_UNFL
706 * @param FMACx FMAC instance
707 * @retval None
709 __STATIC_INLINE void LL_FMAC_DisableIT_UNFL(FMAC_TypeDef *FMACx)
711 CLEAR_BIT(FMACx->CR, FMAC_CR_UNFLIEN);
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).
720 __STATIC_INLINE uint32_t LL_FMAC_IsEnabledIT_UNFL(FMAC_TypeDef *FMACx)
722 return ((READ_BIT(FMACx->CR, FMAC_CR_UNFLIEN) == (FMAC_CR_UNFLIEN)) ? 1UL : 0UL);
726 * @brief Enable FMAC overflow error interrupt.
727 * @rmtoll CR OVFLIEN LL_FMAC_EnableIT_OVFL
728 * @param FMACx FMAC instance
729 * @retval None
731 __STATIC_INLINE void LL_FMAC_EnableIT_OVFL(FMAC_TypeDef *FMACx)
733 SET_BIT(FMACx->CR, FMAC_CR_OVFLIEN);
737 * @brief Disable FMAC overflow error interrupt.
738 * @rmtoll CR OVFLIEN LL_FMAC_DisableIT_OVFL
739 * @param FMACx FMAC instance
740 * @retval None
742 __STATIC_INLINE void LL_FMAC_DisableIT_OVFL(FMAC_TypeDef *FMACx)
744 CLEAR_BIT(FMACx->CR, FMAC_CR_OVFLIEN);
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).
753 __STATIC_INLINE uint32_t LL_FMAC_IsEnabledIT_OVFL(FMAC_TypeDef *FMACx)
755 return ((READ_BIT(FMACx->CR, FMAC_CR_OVFLIEN) == (FMAC_CR_OVFLIEN)) ? 1UL : 0UL);
759 * @brief Enable FMAC write interrupt.
760 * @rmtoll CR WIEN LL_FMAC_EnableIT_WR
761 * @param FMACx FMAC instance
762 * @retval None
764 __STATIC_INLINE void LL_FMAC_EnableIT_WR(FMAC_TypeDef *FMACx)
766 SET_BIT(FMACx->CR, FMAC_CR_WIEN);
770 * @brief Disable FMAC write interrupt.
771 * @rmtoll CR WIEN LL_FMAC_DisableIT_WR
772 * @param FMACx FMAC instance
773 * @retval None
775 __STATIC_INLINE void LL_FMAC_DisableIT_WR(FMAC_TypeDef *FMACx)
777 CLEAR_BIT(FMACx->CR, FMAC_CR_WIEN);
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).
786 __STATIC_INLINE uint32_t LL_FMAC_IsEnabledIT_WR(FMAC_TypeDef *FMACx)
788 return ((READ_BIT(FMACx->CR, FMAC_CR_WIEN) == (FMAC_CR_WIEN)) ? 1UL : 0UL);
792 * @brief Enable FMAC read interrupt.
793 * @rmtoll CR RIEN LL_FMAC_EnableIT_RD
794 * @param FMACx FMAC instance
795 * @retval None
797 __STATIC_INLINE void LL_FMAC_EnableIT_RD(FMAC_TypeDef *FMACx)
799 SET_BIT(FMACx->CR, FMAC_CR_RIEN);
803 * @brief Disable FMAC read interrupt.
804 * @rmtoll CR RIEN LL_FMAC_DisableIT_RD
805 * @param FMACx FMAC instance
806 * @retval None
808 __STATIC_INLINE void LL_FMAC_DisableIT_RD(FMAC_TypeDef *FMACx)
810 CLEAR_BIT(FMACx->CR, FMAC_CR_RIEN);
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).
819 __STATIC_INLINE uint32_t LL_FMAC_IsEnabledIT_RD(FMAC_TypeDef *FMACx)
821 return ((READ_BIT(FMACx->CR, FMAC_CR_RIEN) == (FMAC_CR_RIEN)) ? 1UL : 0UL);
825 * @}
828 /** @defgroup FMAC_LL_EF_FLAG_Management FLAG_Management
829 * @{
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).
838 __STATIC_INLINE uint32_t LL_FMAC_IsActiveFlag_SAT(FMAC_TypeDef *FMACx)
840 return ((READ_BIT(FMACx->SR, FMAC_SR_SAT) == (FMAC_SR_SAT)) ? 1UL : 0UL);
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).
849 __STATIC_INLINE uint32_t LL_FMAC_IsActiveFlag_UNFL(FMAC_TypeDef *FMACx)
851 return ((READ_BIT(FMACx->SR, FMAC_SR_UNFL) == (FMAC_SR_UNFL)) ? 1UL : 0UL);
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).
860 __STATIC_INLINE uint32_t LL_FMAC_IsActiveFlag_OVFL(FMAC_TypeDef *FMACx)
862 return ((READ_BIT(FMACx->SR, FMAC_SR_OVFL) == (FMAC_SR_OVFL)) ? 1UL : 0UL);
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).
871 __STATIC_INLINE uint32_t LL_FMAC_IsActiveFlag_X1FULL(FMAC_TypeDef *FMACx)
873 return ((READ_BIT(FMACx->SR, FMAC_SR_X1FULL) == (FMAC_SR_X1FULL)) ? 1UL : 0UL);
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).
882 __STATIC_INLINE uint32_t LL_FMAC_IsActiveFlag_YEMPTY(FMAC_TypeDef *FMACx)
884 return ((READ_BIT(FMACx->SR, FMAC_SR_YEMPTY) == (FMAC_SR_YEMPTY)) ? 1UL : 0UL);
888 * @}
891 /** @defgroup FMAC_LL_EF_Data_Management Data_Management
892 * @{
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
902 __STATIC_INLINE void LL_FMAC_WriteData(FMAC_TypeDef *FMACx, uint16_t InData)
904 WRITE_REG(FMACx->WDATA, InData);
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.
913 __STATIC_INLINE uint16_t LL_FMAC_ReadData(FMAC_TypeDef *FMACx)
915 return (uint16_t)(READ_REG(FMACx->RDATA));
919 * @}
922 /** @defgroup FMAC_LL_EF_Configuration FMAC Configuration functions
923 * @{
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
941 __STATIC_INLINE void LL_FMAC_ConfigX1(FMAC_TypeDef *FMACx, uint32_t Watermark, uint8_t Base, uint8_t BufferSize)
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));
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
956 __STATIC_INLINE void LL_FMAC_ConfigX2(FMAC_TypeDef *FMACx, uint8_t Base, uint8_t BufferSize)
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));
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
977 __STATIC_INLINE void LL_FMAC_ConfigY(FMAC_TypeDef *FMACx, uint32_t Watermark, uint8_t Base, uint8_t BufferSize)
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));
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
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)
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));
1011 * @}
1016 #if defined(USE_FULL_LL_DRIVER)
1017 /** @defgroup FMAC_LL_EF_Init Initialization and de-initialization functions
1018 * @{
1020 ErrorStatus LL_FMAC_Init(FMAC_TypeDef *FMACx);
1021 ErrorStatus LL_FMAC_DeInit(FMAC_TypeDef *FMACx);
1025 * @}
1027 #endif /* USE_FULL_LL_DRIVER */
1030 * @}
1034 * @}
1037 #endif /* defined(FMAC) */
1040 * @}
1043 #ifdef __cplusplus
1045 #endif
1047 #endif /* STM32H7xx_LL_FMAC_H */
1049 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/