2 ******************************************************************************
3 * @file stm32h7xx_hal_fmac.h
4 * @author MCD Application Team
5 * @brief This file contains all the functions prototypes for the FMAC firmware
7 ******************************************************************************
10 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
11 * All rights reserved.</center></h2>
13 * This software component is licensed by ST under BSD 3-Clause license,
14 * the "License"; You may not use this file except in compliance with the
15 * License. You may obtain a copy of the License at:
16 * opensource.org/licenses/BSD-3-Clause
18 ******************************************************************************
21 /* Define to prevent recursive inclusion -------------------------------------*/
22 #ifndef STM32H7xx_HAL_FMAC_H
23 #define STM32H7xx_HAL_FMAC_H
29 /* Includes ------------------------------------------------------------------*/
30 #include "stm32h7xx_hal_def.h"
33 /** @addtogroup STM32H7xx_HAL_Driver
41 /* Exported types ------------------------------------------------------------*/
42 /** @defgroup FMAC_Exported_Types FMAC Exported Types
47 * @brief FMAC HAL State Structure definition
51 HAL_FMAC_STATE_RESET
= 0x00U
, /*!< FMAC not yet initialized or disabled */
52 HAL_FMAC_STATE_READY
= 0x20U
, /*!< FMAC initialized and ready for use */
53 HAL_FMAC_STATE_BUSY
= 0x24U
, /*!< FMAC internal process is ongoing */
54 HAL_FMAC_STATE_BUSY_RD
= 0x25U
, /*!< FMAC reading configuration is ongoing */
55 HAL_FMAC_STATE_BUSY_WR
= 0x26U
, /*!< FMAC writing configuration is ongoing */
56 HAL_FMAC_STATE_TIMEOUT
= 0xA0U
, /*!< FMAC in Timeout state */
57 HAL_FMAC_STATE_ERROR
= 0xE0U
/*!< FMAC in Error state */
58 } HAL_FMAC_StateTypeDef
;
61 * @brief FMAC Handle Structure definition
63 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
64 typedef struct __FMAC_HandleTypeDef
67 #endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
69 FMAC_TypeDef
*Instance
; /*!< Register base address */
71 uint32_t FilterParam
; /*!< Filter configuration (operation and parameters).
72 Set to 0 if no valid configuration was applied. */
74 uint8_t InputAccess
; /*!< Access to the input buffer (internal memory area): DMA, IT, Polling, None.
75 This parameter can be a value of @ref FMAC_Buffer_Access. */
77 uint8_t OutputAccess
; /*!< Access to the output buffer (internal memory area): DMA, IT, Polling, None.
78 This parameter can be a value of @ref FMAC_Buffer_Access. */
80 int16_t *pInput
; /*!< Pointer to FMAC input data buffer */
82 uint16_t InputCurrentSize
; /*!< Number of the input elements already written into FMAC */
84 uint16_t *pInputSize
; /*!< Number of input elements to write (memory allocated to pInput).
85 In case of early interruption of the filter operation, its value will be updated. */
87 int16_t *pOutput
; /*!< Pointer to FMAC output data buffer */
89 uint16_t OutputCurrentSize
; /*!< Number of the output elements already read from FMAC */
91 uint16_t *pOutputSize
; /*!< Number of output elements to read (memory allocated to pOutput).
92 In case of early interruption of the filter operation, its value will be updated. */
94 DMA_HandleTypeDef
*hdmaIn
; /*!< FMAC peripheral input data DMA handle parameters */
96 DMA_HandleTypeDef
*hdmaOut
; /*!< FMAC peripheral output data DMA handle parameters */
98 DMA_HandleTypeDef
*hdmaPreload
; /*!< FMAC peripheral preloaded data (X1, X2 and Y) DMA handle parameters */
100 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
101 void (* ErrorCallback
)(struct __FMAC_HandleTypeDef
*hfmac
); /*!< FMAC error callback */
103 void (* HalfGetDataCallback
)(struct __FMAC_HandleTypeDef
*hfmac
); /*!< FMAC get half data callback */
105 void (* GetDataCallback
)(struct __FMAC_HandleTypeDef
*hfmac
); /*!< FMAC get data callback */
107 void (* HalfOutputDataReadyCallback
)(struct __FMAC_HandleTypeDef
*hfmac
); /*!< FMAC half output data ready callback */
109 void (* OutputDataReadyCallback
)(struct __FMAC_HandleTypeDef
*hfmac
); /*!< FMAC output data ready callback */
111 void (* FilterConfigCallback
)(struct __FMAC_HandleTypeDef
*hfmac
); /*!< FMAC filter configuration callback */
113 void (* FilterPreloadCallback
)(struct __FMAC_HandleTypeDef
*hfmac
); /*!< FMAC filter preload callback */
115 void (* MspInitCallback
)(struct __FMAC_HandleTypeDef
*hfmac
); /*!< FMAC Msp Init callback */
117 void (* MspDeInitCallback
)(struct __FMAC_HandleTypeDef
*hfmac
); /*!< FMAC Msp DeInit callback */
119 #endif /* (USE_HAL_FMAC_REGISTER_CALLBACKS) */
121 HAL_LockTypeDef Lock
; /*!< FMAC locking object */
123 __IO HAL_FMAC_StateTypeDef State
; /*!< FMAC state related to global handle management
124 This parameter can be a value of @ref HAL_FMAC_StateTypeDef */
126 __IO HAL_FMAC_StateTypeDef RdState
; /*!< FMAC state related to read operations (access to Y buffer)
127 This parameter can be a value of @ref HAL_FMAC_StateTypeDef */
129 __IO HAL_FMAC_StateTypeDef WrState
; /*!< FMAC state related to write operations (access to X1 buffer)
130 This parameter can be a value of @ref HAL_FMAC_StateTypeDef */
132 __IO
uint32_t ErrorCode
; /*!< FMAC peripheral error code
133 This parameter can be a value of @ref FMAC_Error_Code */
135 } FMAC_HandleTypeDef
;
137 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
139 * @brief FMAC Callback ID structure definition
143 HAL_FMAC_ERROR_CB_ID
= 0x00U
, /*!< FMAC error callback ID */
144 HAL_FMAC_HALF_GET_DATA_CB_ID
= 0x01U
, /*!< FMAC get half data callback ID */
145 HAL_FMAC_GET_DATA_CB_ID
= 0x02U
, /*!< FMAC get data callback ID */
146 HAL_FMAC_HALF_OUTPUT_DATA_READY_CB_ID
= 0x03U
, /*!< FMAC half output data ready callback ID */
147 HAL_FMAC_OUTPUT_DATA_READY_CB_ID
= 0x04U
, /*!< FMAC output data ready callback ID */
148 HAL_FMAC_FILTER_CONFIG_CB_ID
= 0x05U
, /*!< FMAC filter configuration callback ID */
149 HAL_FMAC_FILTER_PRELOAD_CB_ID
= 0x06U
, /*!< FMAC filter preload callback ID */
151 HAL_FMAC_MSPINIT_CB_ID
= 0x07U
, /*!< FMAC MspInit callback ID */
152 HAL_FMAC_MSPDEINIT_CB_ID
= 0x08U
, /*!< FMAC MspDeInit callback ID */
153 } HAL_FMAC_CallbackIDTypeDef
;
156 * @brief HAL FMAC Callback pointer definition
158 typedef void (*pFMAC_CallbackTypeDef
)(FMAC_HandleTypeDef
*hfmac
); /*!< pointer to an FMAC callback function */
160 #endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
163 * @brief FMAC Filter Configuration Structure definition
167 uint8_t InputBaseAddress
; /*!< Base address of the input buffer (X1) within the internal memory (0x00 to 0xFF).
168 Ignored if InputBufferSize is set to 0 (previous configuration kept).
169 NB: the buffers can overlap or even coincide exactly. */
171 uint8_t InputBufferSize
; /*!< Number of 16-bit addresses allocated to the input buffer (including the optional "headroom").
172 0 if a previous configuration should be kept. */
174 uint32_t InputThreshold
; /*!< Input threshold: the buffer full flag will be set if the number of free spaces
175 in the buffer is inferior to this threshold.
176 This parameter can be a value of @ref FMAC_Data_Buffer_Threshold. */
178 uint8_t CoeffBaseAddress
; /*!< Base address of the coefficient buffer (X2) within the internal memory (0x00 to 0xFF).
179 Ignored if CoeffBufferSize is set to 0 (previous configuration kept).
180 NB: the buffers can overlap or even coincide exactly. */
182 uint8_t CoeffBufferSize
; /*!< Number of 16-bit addresses allocated to the coefficient buffer.
183 0 if a previous configuration should be kept. */
185 uint8_t OutputBaseAddress
; /*!< Base address of the output buffer (Y) within the internal memory (0x00 to 0xFF).
186 Ignored if OuputBufferSize is set to 0 (previous configuration kept).
187 NB: the buffers can overlap or even coincide exactly. */
189 uint8_t OutputBufferSize
; /*!< Number of 16-bit addresses allocated to the output buffer (including the optional "headroom").
190 0 if a previous configuration should be kept. */
192 uint32_t OutputThreshold
; /*!< Output threshold: the buffer empty flag will be set if the number of unread values
193 in the buffer is inferior to this threshold.
194 This parameter can be a value of @ref FMAC_Data_Buffer_Threshold. */
196 int16_t *pCoeffA
; /*!< [IIR only] Initialization of the coefficient vector A.
197 If not needed, it should be set to NULL. */
199 uint8_t CoeffASize
; /*!< Size of the coefficient vector A. */
201 int16_t *pCoeffB
; /*!< Initialization of the coefficient vector B.
202 If not needed (re-use of a previously loaded buffer), it should be set to NULL. */
204 uint8_t CoeffBSize
; /*!< Size of the coefficient vector B. */
206 uint8_t InputAccess
; /*!< Access to the input buffer (internal memory area): DMT, IT, Polling, None.
207 This parameter can be a value of @ref FMAC_Buffer_Access. */
209 uint8_t OutputAccess
; /*!< Access to the output buffer (internal memory area): DMA, IT, Polling, None.
210 This parameter can be a value of @ref FMAC_Buffer_Access. */
212 uint32_t Clip
; /*!< Enable or disable the clipping feature (wrapping when the q1.15 range is exceeded).
213 This parameter can be a value of @ref FMAC_Clip_State. */
215 uint32_t Filter
; /*!< Filter type.
216 This parameter can be a value of @ref FMAC_Functions (filter related values). */
218 uint8_t P
; /*!< Parameter P (vector length, number of filter taps, etc.). */
220 uint8_t Q
; /*!< Parameter Q (vector length, etc.). Ignored if not needed. */
222 uint8_t R
; /*!< Parameter R (gain, etc.). Ignored if not needed. */
224 } FMAC_FilterConfigTypeDef
;
231 /* Exported constants --------------------------------------------------------*/
234 /** @defgroup FMAC_Exported_Constants FMAC Exported Constants
238 /** @defgroup FMAC_Error_Code FMAC Error code
241 #define HAL_FMAC_ERROR_NONE 0x00000000UL /*!< No error */
242 #define HAL_FMAC_ERROR_SAT 0x00000001UL /*!< Saturation error */
243 #define HAL_FMAC_ERROR_UNFL 0x00000002UL /*!< Underflow error */
244 #define HAL_FMAC_ERROR_OVFL 0x00000004UL /*!< Overflow error */
245 #define HAL_FMAC_ERROR_DMA 0x00000008UL /*!< DMA error */
246 #define HAL_FMAC_ERROR_RESET 0x00000010UL /*!< Reset error */
247 #define HAL_FMAC_ERROR_PARAM 0x00000020UL /*!< Parameter error */
248 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
249 #define HAL_FMAC_ERROR_INVALID_CALLBACK 0x00000040UL /*!< Invalid Callback error */
250 #endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
251 #define HAL_FMAC_ERROR_TIMEOUT 0x00000080UL /*!< Timeout error */
257 /** @defgroup FMAC_Functions FMAC Functions
260 #define FMAC_FUNC_LOAD_X1 ((uint32_t)(FMAC_PARAM_FUNC_0)) /*!< Load X1 buffer */
261 #define FMAC_FUNC_LOAD_X2 ((uint32_t)(FMAC_PARAM_FUNC_1)) /*!< Load X2 buffer */
262 #define FMAC_FUNC_LOAD_Y ((uint32_t)(FMAC_PARAM_FUNC_1 | FMAC_PARAM_FUNC_0)) /*!< Load Y buffer */
263 #define FMAC_FUNC_CONVO_FIR ((uint32_t)(FMAC_PARAM_FUNC_3)) /*!< Convolution (FIR filter) */
264 #define FMAC_FUNC_IIR_DIRECT_FORM_1 ((uint32_t)(FMAC_PARAM_FUNC_3 | FMAC_PARAM_FUNC_0)) /*!< IIR filter (direct form 1) */
269 /** @defgroup FMAC_Data_Buffer_Threshold FMAC Data Buffer Threshold
271 * @note This parameter sets a watermark for buffer full (input) or buffer empty (output).
273 #define FMAC_THRESHOLD_1 0x00000000UL /*!< Input: Buffer full flag set if the number of free spaces in the buffer is less than 1.
274 Output: Buffer empty flag set if the number of unread values in the buffer is less than 1. */
275 #define FMAC_THRESHOLD_2 0x01000000UL /*!< Input: Buffer full flag set if the number of free spaces in the buffer is less than 2.
276 Output: Buffer empty flag set if the number of unread values in the buffer is less than 2. */
277 #define FMAC_THRESHOLD_4 0x02000000UL /*!< Input: Buffer full flag set if the number of free spaces in the buffer is less than 4.
278 Output: Buffer empty flag set if the number of unread values in the buffer is less than 4. */
279 #define FMAC_THRESHOLD_8 0x03000000UL /*!< Input: Buffer full flag set if the number of free spaces in the buffer is less than 8.
280 Output: Buffer empty flag set if the number of unread values in the buffer is less than 8. */
281 #define FMAC_THRESHOLD_NO_VALUE 0xFFFFFFFFUL /*!< The configured threshold value shouldn't be changed */
286 /** @defgroup FMAC_Buffer_Access FMAC Buffer Access
289 #define FMAC_BUFFER_ACCESS_NONE 0x00U /*!< Buffer handled by an external IP (ADC for instance) */
290 #define FMAC_BUFFER_ACCESS_DMA 0x01U /*!< Buffer accessed through the FMAC DMA */
291 #define FMAC_BUFFER_ACCESS_POLLING 0x02U /*!< Buffer accessed through polling */
292 #define FMAC_BUFFER_ACCESS_IT 0x03U /*!< Buffer accessed through interruptions */
297 /** @defgroup FMAC_Clip_State FMAC Clip State
300 #define FMAC_CLIP_DISABLED 0x00000000UL /*!< Clipping disabled */
301 #define FMAC_CLIP_ENABLED FMAC_CR_CLIPEN /*!< Clipping enabled */
306 /** @defgroup FMAC_Flags FMAC status flags
309 #define FMAC_FLAG_YEMPTY FMAC_SR_YEMPTY /*!< Y Buffer Empty Flag */
310 #define FMAC_FLAG_X1FULL FMAC_SR_X1FULL /*!< X1 Buffer Full Flag */
311 #define FMAC_FLAG_OVFL FMAC_SR_OVFL /*!< Overflow Error Flag */
312 #define FMAC_FLAG_UNFL FMAC_SR_UNFL /*!< Underflow Error Flag */
313 #define FMAC_FLAG_SAT FMAC_SR_SAT /*!< Saturation Error Flag (this helps in debugging a filter) */
318 /** @defgroup FMAC_Interrupts_Enable FMAC Interrupts Enable bit
321 #define FMAC_IT_RIEN FMAC_CR_RIEN /*!< Read Interrupt Enable */
322 #define FMAC_IT_WIEN FMAC_CR_WIEN /*!< Write Interrupt Enable */
323 #define FMAC_IT_OVFLIEN FMAC_CR_OVFLIEN /*!< Overflow Error Interrupt Enable */
324 #define FMAC_IT_UNFLIEN FMAC_CR_UNFLIEN /*!< Underflow Error Interrupt Enable */
325 #define FMAC_IT_SATIEN FMAC_CR_SATIEN /*!< Saturation Error Interrupt Enable (this helps in debugging a filter) */
330 /** @defgroup FMAC_DMAR DMA Read Request Enable bit
333 #define FMAC_DMA_REN FMAC_CR_DMAREN /*!< DMA Read Requests Enable */
338 /** @defgroup FMAC_DMAW DMA Write Request Enable bit
341 #define FMAC_DMA_WEN FMAC_CR_DMAWEN /*!< DMA Write Channel Enable */
346 /** @defgroup FMAC_DMAS DMA START bit
349 #define FMAC_START FMAC_PARAM_START /*!< DMA Start */
354 /** @defgroup FMAC_TimeOut_Value FMAC polling-based communications time-out value
357 #define HAL_FMAC_TIMEOUT_VALUE 1000UL /*!< FMAC polling-based communications time-out value */
362 /** @defgroup FMAC_Reset_TimeOut_Value FMAC reset time-out value
365 #define HAL_FMAC_RESET_TIMEOUT_VALUE 500UL /*!< FMAC reset time-out value */
375 /* Exported macro ------------------------------------------------------------*/
376 /** @defgroup FMAC_Exported_Macros FMAC Exported Macros
380 /** @brief Reset FMAC handle state.
381 * @param __HANDLE__ FMAC handle.
384 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
385 #define __HAL_FMAC_RESET_HANDLE_STATE(__HANDLE__) do{ \
386 (__HANDLE__)->State = HAL_FMAC_STATE_RESET; \
387 (__HANDLE__)->MspInitCallback = NULL; \
388 (__HANDLE__)->MspDeInitCallback = NULL; \
391 #define __HAL_FMAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_FMAC_STATE_RESET)
392 #endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
395 * @brief Enable the FMAC interrupt when result is ready
396 * @param __HANDLE__ FMAC handle.
397 * @param __INTERRUPT__ FMAC Interrupt.
398 * This parameter can be one of the following values:
399 * @arg @ref FMAC_IT_RIEN Read interrupt enable
400 * @arg @ref FMAC_IT_WIEN Write interrupt enable
401 * @arg @ref FMAC_IT_OVFLIEN Overflow error interrupt enable
402 * @arg @ref FMAC_IT_UNFLIEN Underflow error interrupt enable
403 * @arg @ref FMAC_IT_SATIEN Saturation error interrupt enable (this helps in debugging a filter)
406 #define __HAL_FMAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) \
407 (((__HANDLE__)->Instance->CR) |= (__INTERRUPT__))
410 * @brief Disable the FMAC interrupt
411 * @param __HANDLE__ FMAC handle.
412 * @param __INTERRUPT__ FMAC Interrupt.
413 * This parameter can be one of the following values:
414 * @arg @ref FMAC_IT_RIEN Read interrupt enable
415 * @arg @ref FMAC_IT_WIEN Write interrupt enable
416 * @arg @ref FMAC_IT_OVFLIEN Overflow error interrupt enable
417 * @arg @ref FMAC_IT_UNFLIEN Underflow error interrupt enable
418 * @arg @ref FMAC_IT_SATIEN Saturation error interrupt enable (this helps in debugging a filter)
421 #define __HAL_FMAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) \
422 (((__HANDLE__)->Instance->CR) &= ~(__INTERRUPT__))
424 /** @brief Check whether the specified FMAC interrupt occurred or not.
425 * @param __HANDLE__ FMAC handle.
426 * @param __INTERRUPT__ FMAC interrupt to check.
427 * This parameter can be one of the following values:
428 * @arg @ref FMAC_FLAG_YEMPTY Y Buffer Empty Flag
429 * @arg @ref FMAC_FLAG_X1FULL X1 Buffer Full Flag
430 * @arg @ref FMAC_FLAG_OVFL Overflow Error Flag
431 * @arg @ref FMAC_FLAG_UNFL Underflow Error Flag
432 * @arg @ref FMAC_FLAG_SAT Saturation Error Flag
433 * @retval SET (interrupt occurred) or RESET (interrupt did not occurred)
435 #define __HAL_FMAC_GET_IT(__HANDLE__, __INTERRUPT__) \
436 (((__HANDLE__)->Instance->SR) &= ~(__INTERRUPT__))
438 /** @brief Clear specified FMAC interrupt status. Dummy macro as the
439 interrupt status flags are read-only.
440 * @param __HANDLE__ FMAC handle.
441 * @param __INTERRUPT__ FMAC interrupt to clear.
444 #define __HAL_FMAC_CLEAR_IT(__HANDLE__, __INTERRUPT__) /* Dummy macro */
446 /** @brief Check whether the specified FMAC status flag is set or not.
447 * @param __HANDLE__ FMAC handle.
448 * @param __FLAG__ FMAC flag to check.
449 * This parameter can be one of the following values:
450 * @arg @ref FMAC_FLAG_YEMPTY Y Buffer Empty Flag
451 * @arg @ref FMAC_FLAG_X1FULL X1 Buffer Full Flag
452 * @arg @ref FMAC_FLAG_OVFL Overflow Error Flag
453 * @arg @ref FMAC_FLAG_UNFL Underflow Error Flag
454 * @arg @ref FMAC_FLAG_SAT Saturation error Flag
455 * @retval SET (flag is set) or RESET (flag is reset)
457 #define __HAL_FMAC_GET_FLAG(__HANDLE__, __FLAG__) \
458 ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
460 /** @brief Clear specified FMAC status flag. Dummy macro as no
462 * @param __HANDLE__ FMAC handle.
463 * @param __FLAG__ FMAC flag to clear.
466 #define __HAL_FMAC_CLEAR_FLAG(__HANDLE__, __FLAG__) /* Dummy macro */
468 /** @brief Check whether the specified FMAC interrupt is enabled or not.
469 * @param __HANDLE__ FMAC handle.
470 * @param __INTERRUPT__ FMAC interrupt to check.
471 * This parameter can be one of the following values:
472 * @arg @ref FMAC_IT_RIEN Read interrupt enable
473 * @arg @ref FMAC_IT_WIEN Write interrupt enable
474 * @arg @ref FMAC_IT_OVFLIEN Overflow error interrupt enable
475 * @arg @ref FMAC_IT_UNFLIEN Underflow error interrupt enable
476 * @arg @ref FMAC_IT_SATIEN Saturation error interrupt enable (this helps in debugging a filter)
479 #define __HAL_FMAC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \
480 (((__HANDLE__)->Instance->CR) & (__INTERRUPT__))
486 /* Private macros --------------------------------------------------------*/
487 /** @addtogroup FMAC_Private_Macros
492 * @brief Verify the FMAC function.
493 * @param __FUNCTION__ ID of the function.
494 * @retval SET (__FUNCTION__ is a valid value) or RESET (__FUNCTION__ is invalid)
496 #define IS_FMAC_FUNCTION(__FUNCTION__) (((__FUNCTION__) == FMAC_FUNC_LOAD_X1) || \
497 ((__FUNCTION__) == FMAC_FUNC_LOAD_X2) || \
498 ((__FUNCTION__) == FMAC_FUNC_LOAD_Y) || \
499 ((__FUNCTION__) == FMAC_FUNC_CONVO_FIR) || \
500 ((__FUNCTION__) == FMAC_FUNC_IIR_DIRECT_FORM_1))
503 * @brief Verify the FMAC load function.
504 * @param __FUNCTION__ ID of the load function.
505 * @retval SET (__FUNCTION__ is a valid value) or RESET (__FUNCTION__ is invalid)
507 #define IS_FMAC_LOAD_FUNCTION(__FUNCTION__) (((__FUNCTION__) == FMAC_FUNC_LOAD_X1) || \
508 ((__FUNCTION__) == FMAC_FUNC_LOAD_X2) || \
509 ((__FUNCTION__) == FMAC_FUNC_LOAD_Y))
512 * @brief Verify the FMAC load function.
513 * @param __FUNCTION__ ID of the load function.
514 * @retval SET (__FUNCTION__ is a valid value) or RESET (__FUNCTION__ is invalid)
516 #define IS_FMAC_N_LOAD_FUNCTION(__FUNCTION__) (((__FUNCTION__) == FMAC_FUNC_LOAD_X1) || \
517 ((__FUNCTION__) == FMAC_FUNC_LOAD_Y))
520 * @brief Verify the FMAC load function.
521 * @param __FUNCTION__ ID of the load function.
522 * @retval SET (__FUNCTION__ is a valid value) or RESET (__FUNCTION__ is invalid)
524 #define IS_FMAC_N_M_LOAD_FUNCTION(__FUNCTION__) ((__FUNCTION__) == FMAC_FUNC_LOAD_X2)
527 * @brief Verify the FMAC filter function.
528 * @param __FUNCTION__ ID of the filter function.
529 * @retval SET (__FUNCTION__ is a valid value) or RESET (__FUNCTION__ is invalid)
531 #define IS_FMAC_FILTER_FUNCTION(__FUNCTION__) (((__FUNCTION__) == FMAC_FUNC_CONVO_FIR) || \
532 ((__FUNCTION__) == FMAC_FUNC_IIR_DIRECT_FORM_1))
536 * @brief Verify the FMAC threshold.
537 * @param __THRESHOLD__ Value of the threshold.
538 * @retval SET (__THRESHOLD__ is a valid value) or RESET (__THRESHOLD__ is invalid)
540 #define IS_FMAC_THRESHOLD(__THRESHOLD__) (((__THRESHOLD__) == FMAC_THRESHOLD_1) || \
541 ((__THRESHOLD__) == FMAC_THRESHOLD_2) || \
542 ((__THRESHOLD__) == FMAC_THRESHOLD_4) || \
543 ((__THRESHOLD__) == FMAC_THRESHOLD_NO_VALUE) || \
544 ((__THRESHOLD__) == FMAC_THRESHOLD_8))
547 * @brief Verify the FMAC filter parameter P.
548 * @param __P__ Value of the filter parameter P.
549 * @param __FUNCTION__ ID of the filter function.
550 * @retval SET (__P__ is a valid value) or RESET (__P__ is invalid)
552 #define IS_FMAC_PARAM_P(__FUNCTION__, __P__) ( (((__FUNCTION__) == FMAC_FUNC_CONVO_FIR) && \
553 (((__P__) >= 2U) && ((__P__) <= 127U))) || \
554 (((__FUNCTION__) == FMAC_FUNC_IIR_DIRECT_FORM_1) && \
555 (((__P__) >= 2U) && ((__P__) <= 64U))) )
558 * @brief Verify the FMAC filter parameter Q.
559 * @param __Q__ Value of the filter parameter Q.
560 * @param __FUNCTION__ ID of the filter function.
561 * @retval SET (__Q__ is a valid value) or RESET (__Q__ is invalid)
563 #define IS_FMAC_PARAM_Q(__FUNCTION__, __Q__) ( ((__FUNCTION__) == FMAC_FUNC_CONVO_FIR) || \
564 (((__FUNCTION__) == FMAC_FUNC_IIR_DIRECT_FORM_1) && \
565 (((__Q__) >= 1U) && ((__Q__) <= 63U))) )
568 * @brief Verify the FMAC filter parameter R.
569 * @param __R__ Value of the filter parameter.
570 * @param __FUNCTION__ ID of the filter function.
571 * @retval SET (__R__ is a valid value) or RESET (__R__ is invalid)
573 #define IS_FMAC_PARAM_R(__FUNCTION__, __R__) ( (((__FUNCTION__) == FMAC_FUNC_CONVO_FIR) || \
574 ((__FUNCTION__) == FMAC_FUNC_IIR_DIRECT_FORM_1)) && \
578 * @brief Verify the FMAC buffer access.
579 * @param __BUFFER_ACCESS__ Type of access.
580 * @retval SET (__BUFFER_ACCESS__ is a valid value) or RESET (__BUFFER_ACCESS__ is invalid)
582 #define IS_FMAC_BUFFER_ACCESS(__BUFFER_ACCESS__) (((__BUFFER_ACCESS__) == FMAC_BUFFER_ACCESS_NONE) || \
583 ((__BUFFER_ACCESS__) == FMAC_BUFFER_ACCESS_DMA) || \
584 ((__BUFFER_ACCESS__) == FMAC_BUFFER_ACCESS_POLLING) || \
585 ((__BUFFER_ACCESS__) == FMAC_BUFFER_ACCESS_IT))
588 * @brief Verify the FMAC clip feature.
589 * @param __CLIP_STATE__ Clip state.
590 * @retval SET (__CLIP_STATE__ is a valid value) or RESET (__CLIP_STATE__ is invalid)
592 #define IS_FMAC_CLIP_STATE(__CLIP_STATE__) (((__CLIP_STATE__) == FMAC_CLIP_DISABLED) || \
593 ((__CLIP_STATE__) == FMAC_CLIP_ENABLED))
599 /* Exported functions ------------------------------------------------------- */
600 /** @addtogroup FMAC_Exported_Functions
604 /** @addtogroup FMAC_Exported_Functions_Group1
607 /* Initialization and de-initialization functions ****************************/
608 HAL_StatusTypeDef
HAL_FMAC_Init(FMAC_HandleTypeDef
*hfmac
);
609 HAL_StatusTypeDef
HAL_FMAC_DeInit(FMAC_HandleTypeDef
*hfmac
);
610 void HAL_FMAC_MspInit(FMAC_HandleTypeDef
*hfmac
);
611 void HAL_FMAC_MspDeInit(FMAC_HandleTypeDef
*hfmac
);
613 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
614 /* Callbacks Register/UnRegister functions ***********************************/
615 HAL_StatusTypeDef
HAL_FMAC_RegisterCallback(FMAC_HandleTypeDef
*hfmac
, HAL_FMAC_CallbackIDTypeDef CallbackID
,
616 pFMAC_CallbackTypeDef pCallback
);
617 HAL_StatusTypeDef
HAL_FMAC_UnRegisterCallback(FMAC_HandleTypeDef
*hfmac
, HAL_FMAC_CallbackIDTypeDef CallbackID
);
618 #endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
623 /** @addtogroup FMAC_Exported_Functions_Group2
626 /* Peripheral Control functions ***********************************************/
627 HAL_StatusTypeDef
HAL_FMAC_FilterConfig(FMAC_HandleTypeDef
*hfmac
, FMAC_FilterConfigTypeDef
*sConfig
);
628 HAL_StatusTypeDef
HAL_FMAC_FilterConfig_DMA(FMAC_HandleTypeDef
*hfmac
, FMAC_FilterConfigTypeDef
*sConfig
);
629 HAL_StatusTypeDef
HAL_FMAC_FilterPreload(FMAC_HandleTypeDef
*hfmac
, int16_t *pInput
, uint8_t InputSize
,
630 int16_t *pOutput
, uint8_t OutputSize
);
631 HAL_StatusTypeDef
HAL_FMAC_FilterPreload_DMA(FMAC_HandleTypeDef
*hfmac
, int16_t *pInput
, uint8_t InputSize
,
632 int16_t *pOutput
, uint8_t OutputSize
);
633 HAL_StatusTypeDef
HAL_FMAC_FilterStart(FMAC_HandleTypeDef
*hfmac
, int16_t *pOutput
, uint16_t *pOutputSize
);
634 HAL_StatusTypeDef
HAL_FMAC_AppendFilterData(FMAC_HandleTypeDef
*hfmac
, int16_t *pInput
, uint16_t *pInputSize
);
635 HAL_StatusTypeDef
HAL_FMAC_ConfigFilterOutputBuffer(FMAC_HandleTypeDef
*hfmac
, int16_t *pOutput
, uint16_t *pOutputSize
);
636 HAL_StatusTypeDef
HAL_FMAC_PollFilterData(FMAC_HandleTypeDef
*hfmac
, uint32_t Timeout
);
637 HAL_StatusTypeDef
HAL_FMAC_FilterStop(FMAC_HandleTypeDef
*hfmac
);
642 /** @addtogroup FMAC_Exported_Functions_Group3
645 /* Callback functions *********************************************************/
646 void HAL_FMAC_ErrorCallback(FMAC_HandleTypeDef
*hfmac
);
647 void HAL_FMAC_HalfGetDataCallback(FMAC_HandleTypeDef
*hfmac
);
648 void HAL_FMAC_GetDataCallback(FMAC_HandleTypeDef
*hfmac
);
649 void HAL_FMAC_HalfOutputDataReadyCallback(FMAC_HandleTypeDef
*hfmac
);
650 void HAL_FMAC_OutputDataReadyCallback(FMAC_HandleTypeDef
*hfmac
);
651 void HAL_FMAC_FilterConfigCallback(FMAC_HandleTypeDef
*hfmac
);
652 void HAL_FMAC_FilterPreloadCallback(FMAC_HandleTypeDef
*hfmac
);
657 /** @addtogroup FMAC_Exported_Functions_Group4
660 /* IRQ handler management *****************************************************/
661 void HAL_FMAC_IRQHandler(FMAC_HandleTypeDef
*hfmac
);
666 /** @addtogroup FMAC_Exported_Functions_Group5
669 /* Peripheral State functions *************************************************/
670 HAL_FMAC_StateTypeDef
HAL_FMAC_GetState(FMAC_HandleTypeDef
*hfmac
);
671 uint32_t HAL_FMAC_GetError(FMAC_HandleTypeDef
*hfmac
);
694 #endif /* STM32H7xx_HAL_FMAC_H */
696 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/