![]() |
|
|||
File indexing completed on 2025-05-11 08:23:35
0001 /** 0002 ****************************************************************************** 0003 * @file stm32h7xx_hal_fmac.h 0004 * @author MCD Application Team 0005 * @brief Header for stm32h7xx_hal_fmac.c module 0006 ****************************************************************************** 0007 * @attention 0008 * 0009 * Copyright (c) 2017 STMicroelectronics. 0010 * All rights reserved. 0011 * 0012 * This software is licensed under terms that can be found in the LICENSE file 0013 * in the root directory of this software component. 0014 * If no LICENSE file comes with this software, it is provided AS-IS. 0015 * 0016 ****************************************************************************** 0017 */ 0018 0019 /* Define to prevent recursive inclusion -------------------------------------*/ 0020 #ifndef STM32H7xx_HAL_FMAC_H 0021 #define STM32H7xx_HAL_FMAC_H 0022 0023 #ifdef __cplusplus 0024 extern "C" { 0025 #endif 0026 0027 /* Includes ------------------------------------------------------------------*/ 0028 #include "stm32h7xx_hal_def.h" 0029 0030 #if defined(FMAC) 0031 /** @addtogroup STM32H7xx_HAL_Driver 0032 * @{ 0033 */ 0034 0035 /** @addtogroup FMAC 0036 * @{ 0037 */ 0038 0039 /* Exported types ------------------------------------------------------------*/ 0040 /** @defgroup FMAC_Exported_Types FMAC Exported Types 0041 * @ingroup RTEMSBSPsARMSTM32H7 0042 * @{ 0043 */ 0044 0045 /** 0046 * @brief FMAC HAL State Structure definition 0047 */ 0048 typedef enum 0049 { 0050 HAL_FMAC_STATE_RESET = 0x00U, /*!< FMAC not yet initialized or disabled */ 0051 HAL_FMAC_STATE_READY = 0x20U, /*!< FMAC initialized and ready for use */ 0052 HAL_FMAC_STATE_BUSY = 0x24U, /*!< FMAC internal process is ongoing */ 0053 HAL_FMAC_STATE_BUSY_RD = 0x25U, /*!< FMAC reading configuration is ongoing */ 0054 HAL_FMAC_STATE_BUSY_WR = 0x26U, /*!< FMAC writing configuration is ongoing */ 0055 HAL_FMAC_STATE_TIMEOUT = 0xA0U, /*!< FMAC in Timeout state */ 0056 HAL_FMAC_STATE_ERROR = 0xE0U /*!< FMAC in Error state */ 0057 } HAL_FMAC_StateTypeDef; 0058 0059 /** 0060 * @brief FMAC Handle Structure definition 0061 */ 0062 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1) 0063 typedef struct __FMAC_HandleTypeDef 0064 #else 0065 typedef struct 0066 #endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */ 0067 { 0068 FMAC_TypeDef *Instance; /*!< Register base address */ 0069 0070 uint32_t FilterParam; /*!< Filter configuration (operation and parameters). 0071 Set to 0 if no valid configuration was applied. */ 0072 0073 uint8_t InputAccess; /*!< Access to the input buffer (internal memory area): 0074 DMA, IT, Polling, None. 0075 This parameter can be a value of @ref FMAC_Buffer_Access. */ 0076 0077 uint8_t OutputAccess; /*!< Access to the output buffer (internal memory area): 0078 DMA, IT, Polling, None. 0079 This parameter can be a value of @ref FMAC_Buffer_Access. */ 0080 0081 int16_t *pInput; /*!< Pointer to FMAC input data buffer */ 0082 0083 uint16_t InputCurrentSize; /*!< Number of the input elements already written into FMAC */ 0084 0085 uint16_t *pInputSize; /*!< Number of input elements to write (memory allocated to pInput). 0086 In case of early interruption of the filter operation, 0087 its value will be updated. */ 0088 0089 int16_t *pOutput; /*!< Pointer to FMAC output data buffer */ 0090 0091 uint16_t OutputCurrentSize; /*!< Number of the output elements already read from FMAC */ 0092 0093 uint16_t *pOutputSize; /*!< Number of output elements to read (memory allocated to pOutput). 0094 In case of early interruption of the filter operation, 0095 its value will be updated. */ 0096 0097 DMA_HandleTypeDef *hdmaIn; /*!< FMAC peripheral input data DMA handle parameters */ 0098 0099 DMA_HandleTypeDef *hdmaOut; /*!< FMAC peripheral output data DMA handle parameters */ 0100 0101 DMA_HandleTypeDef *hdmaPreload; /*!< FMAC peripheral preloaded data (X1, X2 and Y) DMA handle 0102 parameters */ 0103 0104 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1) 0105 void (* ErrorCallback)(struct __FMAC_HandleTypeDef *hfmac); /*!< FMAC error callback */ 0106 0107 void (* HalfGetDataCallback)(struct __FMAC_HandleTypeDef *hfmac); /*!< FMAC get half data callback */ 0108 0109 void (* GetDataCallback)(struct __FMAC_HandleTypeDef *hfmac); /*!< FMAC get data callback */ 0110 0111 void (* HalfOutputDataReadyCallback)(struct __FMAC_HandleTypeDef *hfmac); /*!< FMAC half output data ready callback */ 0112 0113 void (* OutputDataReadyCallback)(struct __FMAC_HandleTypeDef *hfmac); /*!< FMAC output data ready callback */ 0114 0115 void (* FilterConfigCallback)(struct __FMAC_HandleTypeDef *hfmac); /*!< FMAC filter configuration callback */ 0116 0117 void (* FilterPreloadCallback)(struct __FMAC_HandleTypeDef *hfmac); /*!< FMAC filter preload callback */ 0118 0119 void (* MspInitCallback)(struct __FMAC_HandleTypeDef *hfmac); /*!< FMAC Msp Init callback */ 0120 0121 void (* MspDeInitCallback)(struct __FMAC_HandleTypeDef *hfmac); /*!< FMAC Msp DeInit callback */ 0122 0123 #endif /* (USE_HAL_FMAC_REGISTER_CALLBACKS) */ 0124 0125 HAL_LockTypeDef Lock; /*!< FMAC locking object */ 0126 0127 __IO HAL_FMAC_StateTypeDef State; /*!< FMAC state related to global handle management 0128 This parameter can be a value of @ref HAL_FMAC_StateTypeDef */ 0129 0130 __IO HAL_FMAC_StateTypeDef RdState; /*!< FMAC state related to read operations (access to Y buffer) 0131 This parameter can be a value of @ref HAL_FMAC_StateTypeDef */ 0132 0133 __IO HAL_FMAC_StateTypeDef WrState; /*!< FMAC state related to write operations (access to X1 buffer) 0134 This parameter can be a value of @ref HAL_FMAC_StateTypeDef */ 0135 0136 __IO uint32_t ErrorCode; /*!< FMAC peripheral error code 0137 This parameter can be a value of @ref FMAC_Error_Code */ 0138 0139 } FMAC_HandleTypeDef; 0140 0141 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1) 0142 /** 0143 * @brief FMAC Callback ID enumeration definition 0144 */ 0145 typedef enum 0146 { 0147 HAL_FMAC_ERROR_CB_ID = 0x00U, /*!< FMAC error callback ID */ 0148 HAL_FMAC_HALF_GET_DATA_CB_ID = 0x01U, /*!< FMAC get half data callback ID */ 0149 HAL_FMAC_GET_DATA_CB_ID = 0x02U, /*!< FMAC get data callback ID */ 0150 HAL_FMAC_HALF_OUTPUT_DATA_READY_CB_ID = 0x03U, /*!< FMAC half output data ready callback ID */ 0151 HAL_FMAC_OUTPUT_DATA_READY_CB_ID = 0x04U, /*!< FMAC output data ready callback ID */ 0152 HAL_FMAC_FILTER_CONFIG_CB_ID = 0x05U, /*!< FMAC filter configuration callback ID */ 0153 HAL_FMAC_FILTER_PRELOAD_CB_ID = 0x06U, /*!< FMAC filter preload callback ID */ 0154 0155 HAL_FMAC_MSPINIT_CB_ID = 0x07U, /*!< FMAC MspInit callback ID */ 0156 HAL_FMAC_MSPDEINIT_CB_ID = 0x08U, /*!< FMAC MspDeInit callback ID */ 0157 } HAL_FMAC_CallbackIDTypeDef; 0158 0159 /** 0160 * @brief HAL FMAC Callback pointer definition 0161 */ 0162 typedef void (*pFMAC_CallbackTypeDef)(FMAC_HandleTypeDef *hfmac); /*!< pointer to an FMAC callback function */ 0163 0164 #endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */ 0165 0166 /** 0167 * @brief FMAC Filter Configuration Structure definition 0168 */ 0169 typedef struct 0170 { 0171 uint8_t InputBaseAddress; /*!< Base address of the input buffer (X1) within the internal memory 0172 (0x00 to 0xFF). Ignored if InputBufferSize is set to 0 0173 (previous configuration kept). 0174 Note: the buffers can overlap or even coincide exactly. */ 0175 0176 uint8_t InputBufferSize; /*!< Number of 16-bit words allocated to the input buffer 0177 (including the optional "headroom"). 0178 0 if a previous configuration should be kept. */ 0179 0180 uint32_t InputThreshold; /*!< Input threshold: the buffer full flag will be set if the number 0181 of free spaces in the buffer is lower than this threshold. 0182 This parameter can be a value 0183 of @ref FMAC_Data_Buffer_Threshold. */ 0184 0185 uint8_t CoeffBaseAddress; /*!< Base address of the coefficient buffer (X2) within the internal 0186 memory (0x00 to 0xFF). Ignored if CoeffBufferSize is set to 0 0187 (previous configuration kept). 0188 Note: the buffers can overlap or even coincide exactly. */ 0189 0190 uint8_t CoeffBufferSize; /*!< Number of 16-bit words allocated to the coefficient buffer. 0191 0 if a previous configuration should be kept. */ 0192 0193 uint8_t OutputBaseAddress; /*!< Base address of the output buffer (Y) within the internal 0194 memory (0x00 to 0xFF). Ignored if OuputBufferSize is set to 0 0195 (previous configuration kept). 0196 Note: the buffers can overlap or even coincide exactly. */ 0197 0198 uint8_t OutputBufferSize; /*!< Number of 16-bit words allocated to the output buffer 0199 (including the optional "headroom"). 0200 0 if a previous configuration should be kept. */ 0201 0202 uint32_t OutputThreshold; /*!< Output threshold: the buffer empty flag will be set if the number 0203 of unread values in the buffer is lower than this threshold. 0204 This parameter can be a value 0205 of @ref FMAC_Data_Buffer_Threshold. */ 0206 0207 int16_t *pCoeffA; /*!< [IIR only] Initialization of the coefficient vector A. 0208 If not needed, it should be set to NULL. */ 0209 0210 uint8_t CoeffASize; /*!< Size of the coefficient vector A. */ 0211 0212 int16_t *pCoeffB; /*!< Initialization of the coefficient vector B. 0213 If not needed (re-use of a previously loaded buffer), 0214 it should be set to NULL. */ 0215 0216 uint8_t CoeffBSize; /*!< Size of the coefficient vector B. */ 0217 0218 uint8_t InputAccess; /*!< Access to the input buffer (internal memory area): 0219 DMA, IT, Polling, None. 0220 This parameter can be a value of @ref FMAC_Buffer_Access. */ 0221 0222 uint8_t OutputAccess; /*!< Access to the output buffer (internal memory area): 0223 DMA, IT, Polling, None. 0224 This parameter can be a value of @ref FMAC_Buffer_Access. */ 0225 0226 uint32_t Clip; /*!< Enable or disable the clipping feature. If the q1.15 range 0227 is exceeded, wrapping is done when the clipping feature is disabled 0228 and saturation is done when the clipping feature is enabled. 0229 This parameter can be a value of @ref FMAC_Clip_State. */ 0230 0231 uint32_t Filter; /*!< Filter type. 0232 This parameter can be a value 0233 of @ref FMAC_Functions (filter related values). */ 0234 0235 uint8_t P; /*!< Parameter P (vector length, number of filter taps, etc.). */ 0236 0237 uint8_t Q; /*!< Parameter Q (vector length, etc.). Ignored if not needed. */ 0238 0239 uint8_t R; /*!< Parameter R (gain, etc.). Ignored if not needed. */ 0240 0241 } FMAC_FilterConfigTypeDef; 0242 0243 /** 0244 * @} 0245 */ 0246 0247 0248 /* Exported constants --------------------------------------------------------*/ 0249 0250 0251 /** @defgroup FMAC_Exported_Constants FMAC Exported Constants 0252 * @ingroup RTEMSBSPsARMSTM32H7 0253 * @{ 0254 */ 0255 0256 /** @defgroup FMAC_Error_Code FMAC Error code 0257 * @ingroup RTEMSBSPsARMSTM32H7 0258 * @{ 0259 */ 0260 #define HAL_FMAC_ERROR_NONE 0x00000000U /*!< No error */ 0261 #define HAL_FMAC_ERROR_SAT 0x00000001U /*!< Saturation error */ 0262 #define HAL_FMAC_ERROR_UNFL 0x00000002U /*!< Underflow error */ 0263 #define HAL_FMAC_ERROR_OVFL 0x00000004U /*!< Overflow error */ 0264 #define HAL_FMAC_ERROR_DMA 0x00000008U /*!< DMA error */ 0265 #define HAL_FMAC_ERROR_RESET 0x00000010U /*!< Reset error */ 0266 #define HAL_FMAC_ERROR_PARAM 0x00000020U /*!< Parameter error */ 0267 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1) 0268 #define HAL_FMAC_ERROR_INVALID_CALLBACK 0x00000040U /*!< Invalid Callback error */ 0269 #endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */ 0270 #define HAL_FMAC_ERROR_TIMEOUT 0x00000080U /*!< Timeout error */ 0271 0272 /** 0273 * @} 0274 */ 0275 0276 /** @defgroup FMAC_Functions FMAC Functions 0277 * @ingroup RTEMSBSPsARMSTM32H7 0278 * @{ 0279 */ 0280 #define FMAC_FUNC_LOAD_X1 (FMAC_PARAM_FUNC_0) /*!< Load X1 buffer */ 0281 #define FMAC_FUNC_LOAD_X2 (FMAC_PARAM_FUNC_1) /*!< Load X2 buffer */ 0282 #define FMAC_FUNC_LOAD_Y (FMAC_PARAM_FUNC_1 | FMAC_PARAM_FUNC_0) /*!< Load Y buffer */ 0283 #define FMAC_FUNC_CONVO_FIR (FMAC_PARAM_FUNC_3) /*!< Convolution (FIR filter) */ 0284 #define FMAC_FUNC_IIR_DIRECT_FORM_1 (FMAC_PARAM_FUNC_3 | FMAC_PARAM_FUNC_0) /*!< IIR filter (direct form 1) */ 0285 /** 0286 * @} 0287 */ 0288 0289 /** @defgroup FMAC_Data_Buffer_Threshold FMAC Data Buffer Threshold 0290 * @ingroup RTEMSBSPsARMSTM32H7 0291 * @{ 0292 * @note This parameter sets a watermark for buffer full (input) or buffer empty (output). 0293 */ 0294 #define FMAC_THRESHOLD_1 0x00000000U /*!< Input: Buffer full flag set if the number of free spaces 0295 in the buffer is less than 1. 0296 Output: Buffer empty flag set if the number 0297 of unread values in the buffer is less than 1. */ 0298 #define FMAC_THRESHOLD_2 0x01000000U /*!< Input: Buffer full flag set if the number of free spaces 0299 in the buffer is less than 2. 0300 Output: Buffer empty flag set if the number 0301 of unread values in the buffer is less than 2. */ 0302 #define FMAC_THRESHOLD_4 0x02000000U /*!< Input: Buffer full flag set if the number of free spaces 0303 in the buffer is less than 4. 0304 Output: Buffer empty flag set if the number 0305 of unread values in the buffer is less than 4. */ 0306 #define FMAC_THRESHOLD_8 0x03000000U /*!< Input: Buffer full flag set if the number of free spaces 0307 in the buffer is less than 8. 0308 Output: Buffer empty flag set if the number 0309 of unread values in the buffer is less than 8. */ 0310 #define FMAC_THRESHOLD_NO_VALUE 0xFFFFFFFFU /*!< The configured threshold value shouldn't be changed */ 0311 /** 0312 * @} 0313 */ 0314 0315 /** @defgroup FMAC_Buffer_Access FMAC Buffer Access 0316 * @ingroup RTEMSBSPsARMSTM32H7 0317 * @{ 0318 */ 0319 #define FMAC_BUFFER_ACCESS_NONE 0x00U /*!< Buffer handled by an external IP (ADC for instance) */ 0320 #define FMAC_BUFFER_ACCESS_DMA 0x01U /*!< Buffer accessed through DMA */ 0321 #define FMAC_BUFFER_ACCESS_POLLING 0x02U /*!< Buffer accessed through polling */ 0322 #define FMAC_BUFFER_ACCESS_IT 0x03U /*!< Buffer accessed through interruptions */ 0323 /** 0324 * @} 0325 */ 0326 0327 /** @defgroup FMAC_Clip_State FMAC Clip State 0328 * @ingroup RTEMSBSPsARMSTM32H7 0329 * @{ 0330 */ 0331 #define FMAC_CLIP_DISABLED 0x00000000U /*!< Clipping disabled */ 0332 #define FMAC_CLIP_ENABLED FMAC_CR_CLIPEN /*!< Clipping enabled */ 0333 /** 0334 * @} 0335 */ 0336 0337 /** @defgroup FMAC_Flags FMAC status flags 0338 * @ingroup RTEMSBSPsARMSTM32H7 0339 * @{ 0340 */ 0341 #define FMAC_FLAG_YEMPTY FMAC_SR_YEMPTY /*!< Y Buffer Empty Flag */ 0342 #define FMAC_FLAG_X1FULL FMAC_SR_X1FULL /*!< X1 Buffer Full Flag */ 0343 #define FMAC_FLAG_OVFL FMAC_SR_OVFL /*!< Overflow Error Flag */ 0344 #define FMAC_FLAG_UNFL FMAC_SR_UNFL /*!< Underflow Error Flag */ 0345 #define FMAC_FLAG_SAT FMAC_SR_SAT /*!< Saturation Error Flag 0346 (this helps in debugging a filter) */ 0347 /** 0348 * @} 0349 */ 0350 0351 /** @defgroup FMAC_Interrupts_Enable FMAC Interrupts Enable bit 0352 * @ingroup RTEMSBSPsARMSTM32H7 0353 * @{ 0354 */ 0355 #define FMAC_IT_RIEN FMAC_CR_RIEN /*!< Read Interrupt Enable */ 0356 #define FMAC_IT_WIEN FMAC_CR_WIEN /*!< Write Interrupt Enable */ 0357 #define FMAC_IT_OVFLIEN FMAC_CR_OVFLIEN /*!< Overflow Error Interrupt Enable */ 0358 #define FMAC_IT_UNFLIEN FMAC_CR_UNFLIEN /*!< Underflow Error Interrupt Enable */ 0359 #define FMAC_IT_SATIEN FMAC_CR_SATIEN /*!< Saturation Error Interrupt Enable 0360 (this helps in debugging a filter) */ 0361 /** 0362 * @} 0363 */ 0364 0365 /** 0366 * @} 0367 */ 0368 0369 0370 /* Exported variables --------------------------------------------------------*/ 0371 /** @defgroup FMAC_Exported_variables FMAC Exported variables 0372 * @ingroup RTEMSBSPsARMSTM32H7 0373 * @{ 0374 */ 0375 /** 0376 * @} 0377 */ 0378 0379 /* Exported macros -----------------------------------------------------------*/ 0380 /** @defgroup FMAC_Exported_Macros FMAC Exported Macros 0381 * @ingroup RTEMSBSPsARMSTM32H7 0382 * @{ 0383 */ 0384 0385 /** 0386 * @brief Reset FMAC handle state. 0387 * @param __HANDLE__ FMAC handle. 0388 * @retval None 0389 */ 0390 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1) 0391 #define __HAL_FMAC_RESET_HANDLE_STATE(__HANDLE__) do{ \ 0392 (__HANDLE__)->State = HAL_FMAC_STATE_RESET; \ 0393 (__HANDLE__)->MspInitCallback = NULL; \ 0394 (__HANDLE__)->MspDeInitCallback = NULL; \ 0395 } while(0U) 0396 #else 0397 #define __HAL_FMAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_FMAC_STATE_RESET) 0398 #endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */ 0399 0400 /** 0401 * @brief Enable the specified FMAC interrupt 0402 * @param __HANDLE__ FMAC handle. 0403 * @param __INTERRUPT__ FMAC Interrupt. 0404 * This parameter can be any combination of the following values: 0405 * @arg @ref FMAC_IT_RIEN Read interrupt enable 0406 * @arg @ref FMAC_IT_WIEN Write interrupt enable 0407 * @arg @ref FMAC_IT_OVFLIEN Overflow error interrupt enable 0408 * @arg @ref FMAC_IT_UNFLIEN Underflow error interrupt enable 0409 * @arg @ref FMAC_IT_SATIEN Saturation error interrupt enable (this helps in debugging a filter) 0410 * @retval None 0411 */ 0412 #define __HAL_FMAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) \ 0413 (((__HANDLE__)->Instance->CR) |= (__INTERRUPT__)) 0414 0415 /** 0416 * @brief Disable the FMAC interrupt 0417 * @param __HANDLE__ FMAC handle. 0418 * @param __INTERRUPT__ FMAC Interrupt. 0419 * This parameter can be any combination of the following values: 0420 * @arg @ref FMAC_IT_RIEN Read interrupt enable 0421 * @arg @ref FMAC_IT_WIEN Write interrupt enable 0422 * @arg @ref FMAC_IT_OVFLIEN Overflow error interrupt enable 0423 * @arg @ref FMAC_IT_UNFLIEN Underflow error interrupt enable 0424 * @arg @ref FMAC_IT_SATIEN Saturation error interrupt enable (this helps in debugging a filter) 0425 * @retval None 0426 */ 0427 #define __HAL_FMAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) \ 0428 (((__HANDLE__)->Instance->CR) &= ~(__INTERRUPT__)) 0429 0430 /** 0431 * @brief Check whether the specified FMAC interrupt occurred or not. 0432 * @param __HANDLE__ FMAC handle. 0433 * @param __INTERRUPT__ FMAC interrupt to check. 0434 * This parameter can be any combination of the following values: 0435 * @arg @ref FMAC_FLAG_YEMPTY Y Buffer Empty Flag 0436 * @arg @ref FMAC_FLAG_X1FULL X1 Buffer Full Flag 0437 * @arg @ref FMAC_FLAG_OVFL Overflow Error Flag 0438 * @arg @ref FMAC_FLAG_UNFL Underflow Error Flag 0439 * @arg @ref FMAC_FLAG_SAT Saturation Error Flag 0440 * @retval SET (interrupt occurred) or RESET (interrupt did not occurred) 0441 */ 0442 #define __HAL_FMAC_GET_IT(__HANDLE__, __INTERRUPT__) \ 0443 (((__HANDLE__)->Instance->SR) &= ~(__INTERRUPT__)) 0444 0445 /** 0446 * @brief Clear specified FMAC interrupt status. Dummy macro as the 0447 interrupt status flags are read-only. 0448 * @param __HANDLE__ FMAC handle. 0449 * @param __INTERRUPT__ FMAC interrupt to clear. 0450 * @retval None 0451 */ 0452 #define __HAL_FMAC_CLEAR_IT(__HANDLE__, __INTERRUPT__) /* Dummy macro */ 0453 0454 /** 0455 * @brief Check whether the specified FMAC status flag is set or not. 0456 * @param __HANDLE__ FMAC handle. 0457 * @param __FLAG__ FMAC flag to check. 0458 * This parameter can be any combination of the following values: 0459 * @arg @ref FMAC_FLAG_YEMPTY Y Buffer Empty Flag 0460 * @arg @ref FMAC_FLAG_X1FULL X1 Buffer Full Flag 0461 * @arg @ref FMAC_FLAG_OVFL Overflow Error Flag 0462 * @arg @ref FMAC_FLAG_UNFL Underflow Error Flag 0463 * @arg @ref FMAC_FLAG_SAT Saturation error Flag 0464 * @retval SET (flag is set) or RESET (flag is reset) 0465 */ 0466 #define __HAL_FMAC_GET_FLAG(__HANDLE__, __FLAG__) \ 0467 ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) 0468 0469 /** 0470 * @brief Clear specified FMAC status flag. Dummy macro as no 0471 flag can be cleared. 0472 * @param __HANDLE__ FMAC handle. 0473 * @param __FLAG__ FMAC flag to clear. 0474 * @retval None 0475 */ 0476 #define __HAL_FMAC_CLEAR_FLAG(__HANDLE__, __FLAG__) /* Dummy macro */ 0477 0478 /** 0479 * @brief Check whether the specified FMAC interrupt is enabled or not. 0480 * @param __HANDLE__ FMAC handle. 0481 * @param __INTERRUPT__ FMAC interrupt to check. 0482 * This parameter can be one of the following values: 0483 * @arg @ref FMAC_IT_RIEN Read interrupt enable 0484 * @arg @ref FMAC_IT_WIEN Write interrupt enable 0485 * @arg @ref FMAC_IT_OVFLIEN Overflow error interrupt enable 0486 * @arg @ref FMAC_IT_UNFLIEN Underflow error interrupt enable 0487 * @arg @ref FMAC_IT_SATIEN Saturation error interrupt enable (this helps in debugging a filter) 0488 * @retval FlagStatus 0489 */ 0490 #define __HAL_FMAC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \ 0491 (((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) 0492 0493 /** 0494 * @} 0495 */ 0496 0497 /* Private defines -----------------------------------------------------------*/ 0498 /** @addtogroup FMAC_Private_Constants 0499 * @{ 0500 */ 0501 0502 #define FMAC_PARAM_P_MAX_IIR 64U /*!< Maximum value of P parameter with IIR */ 0503 #define FMAC_PARAM_P_MAX_FIR 127U /*!< Maximum value of P parameter with FIR */ 0504 #define FMAC_PARAM_P_MIN 2U /*!< Minimum value of P parameter */ 0505 #define FMAC_PARAM_Q_MAX 63U /*!< Maximum value of Q parameter */ 0506 #define FMAC_PARAM_Q_MIN 1U /*!< Minimum value of Q parameter */ 0507 #define FMAC_PARAM_R_MAX 7U /*!< Maximum value of R parameter */ 0508 0509 /** 0510 * @} 0511 */ 0512 0513 /* Private Macros-----------------------------------------------------------*/ 0514 /** @addtogroup FMAC_Private_Macros FMAC Private Macros 0515 * @{ 0516 */ 0517 0518 /** 0519 * @brief Verify the FMAC function. 0520 * @param __FUNCTION__ ID of the function. 0521 * @retval SET (__FUNCTION__ is a valid value) or RESET (__FUNCTION__ is invalid) 0522 */ 0523 #define IS_FMAC_FUNCTION(__FUNCTION__) (((__FUNCTION__) == FMAC_FUNC_LOAD_X1) || \ 0524 ((__FUNCTION__) == FMAC_FUNC_LOAD_X2) || \ 0525 ((__FUNCTION__) == FMAC_FUNC_LOAD_Y) || \ 0526 ((__FUNCTION__) == FMAC_FUNC_CONVO_FIR) || \ 0527 ((__FUNCTION__) == FMAC_FUNC_IIR_DIRECT_FORM_1)) 0528 0529 /** 0530 * @brief Verify the FMAC load function used for input data, output data or coefficients. 0531 * @param __FUNCTION__ ID of the load function. 0532 * @retval SET (__FUNCTION__ is a valid value) or RESET (__FUNCTION__ is invalid) 0533 */ 0534 #define IS_FMAC_LOAD_FUNCTION(__FUNCTION__) (((__FUNCTION__) == FMAC_FUNC_LOAD_X1) || \ 0535 ((__FUNCTION__) == FMAC_FUNC_LOAD_X2) || \ 0536 ((__FUNCTION__) == FMAC_FUNC_LOAD_Y)) 0537 0538 /** 0539 * @brief Verify the FMAC load function used with N values as input or output data. 0540 * @param __FUNCTION__ ID of the load function. 0541 * @retval SET (__FUNCTION__ is a valid value) or RESET (__FUNCTION__ is invalid) 0542 */ 0543 #define IS_FMAC_N_LOAD_FUNCTION(__FUNCTION__) (((__FUNCTION__) == FMAC_FUNC_LOAD_X1) || \ 0544 ((__FUNCTION__) == FMAC_FUNC_LOAD_Y)) 0545 0546 /** 0547 * @brief Verify the FMAC load function used with N + M values as coefficients. 0548 * @param __FUNCTION__ ID of the load function. 0549 * @retval SET (__FUNCTION__ is a valid value) or RESET (__FUNCTION__ is invalid) 0550 */ 0551 #define IS_FMAC_N_M_LOAD_FUNCTION(__FUNCTION__) ((__FUNCTION__) == FMAC_FUNC_LOAD_X2) 0552 0553 /** 0554 * @brief Verify the FMAC filter function. 0555 * @param __FUNCTION__ ID of the filter function. 0556 * @retval SET (__FUNCTION__ is a valid value) or RESET (__FUNCTION__ is invalid) 0557 */ 0558 #define IS_FMAC_FILTER_FUNCTION(__FUNCTION__) (((__FUNCTION__) == FMAC_FUNC_CONVO_FIR) || \ 0559 ((__FUNCTION__) == FMAC_FUNC_IIR_DIRECT_FORM_1)) 0560 0561 0562 /** 0563 * @brief Verify the FMAC threshold. 0564 * @param __THRESHOLD__ Value of the threshold. 0565 * @retval SET (__THRESHOLD__ is a valid value) or RESET (__THRESHOLD__ is invalid) 0566 */ 0567 #define IS_FMAC_THRESHOLD(__THRESHOLD__) (((__THRESHOLD__) == FMAC_THRESHOLD_1) || \ 0568 ((__THRESHOLD__) == FMAC_THRESHOLD_2) || \ 0569 ((__THRESHOLD__) == FMAC_THRESHOLD_4) || \ 0570 ((__THRESHOLD__) == FMAC_THRESHOLD_NO_VALUE) || \ 0571 ((__THRESHOLD__) == FMAC_THRESHOLD_8)) 0572 0573 /** 0574 * @brief Verify the FMAC filter parameter P. 0575 * @param __P__ Value of the filter parameter P. 0576 * @param __FUNCTION__ ID of the filter function. 0577 * @retval SET (__P__ is a valid value) or RESET (__P__ is invalid) 0578 */ 0579 #define IS_FMAC_PARAM_P(__FUNCTION__, __P__) ((((__FUNCTION__) == FMAC_FUNC_CONVO_FIR) && \ 0580 (((__P__) >= FMAC_PARAM_P_MIN) && \ 0581 ((__P__) <= FMAC_PARAM_P_MAX_FIR))) || \ 0582 (((__FUNCTION__) == FMAC_FUNC_IIR_DIRECT_FORM_1) && \ 0583 (((__P__) >= FMAC_PARAM_P_MIN) && \ 0584 ((__P__) <= FMAC_PARAM_P_MAX_IIR)))) 0585 0586 /** 0587 * @brief Verify the FMAC filter parameter Q. 0588 * @param __Q__ Value of the filter parameter Q. 0589 * @param __FUNCTION__ ID of the filter function. 0590 * @retval SET (__Q__ is a valid value) or RESET (__Q__ is invalid) 0591 */ 0592 #define IS_FMAC_PARAM_Q(__FUNCTION__, __Q__) ( ((__FUNCTION__) == FMAC_FUNC_CONVO_FIR) || \ 0593 (((__FUNCTION__) == FMAC_FUNC_IIR_DIRECT_FORM_1) && \ 0594 (((__Q__) >= FMAC_PARAM_Q_MIN) && ((__Q__) <= FMAC_PARAM_Q_MAX))) ) 0595 0596 /** 0597 * @brief Verify the FMAC filter parameter R. 0598 * @param __R__ Value of the filter parameter. 0599 * @param __FUNCTION__ ID of the filter function. 0600 * @retval SET (__R__ is a valid value) or RESET (__R__ is invalid) 0601 */ 0602 #define IS_FMAC_PARAM_R(__FUNCTION__, __R__) ( (((__FUNCTION__) == FMAC_FUNC_CONVO_FIR) || \ 0603 ((__FUNCTION__) == FMAC_FUNC_IIR_DIRECT_FORM_1)) && \ 0604 ((__R__) <= FMAC_PARAM_R_MAX)) 0605 0606 /** 0607 * @brief Verify the FMAC buffer access. 0608 * @param __BUFFER_ACCESS__ Type of access. 0609 * @retval SET (__BUFFER_ACCESS__ is a valid value) or RESET (__BUFFER_ACCESS__ is invalid) 0610 */ 0611 #define IS_FMAC_BUFFER_ACCESS(__BUFFER_ACCESS__) (((__BUFFER_ACCESS__) == FMAC_BUFFER_ACCESS_NONE) || \ 0612 ((__BUFFER_ACCESS__) == FMAC_BUFFER_ACCESS_DMA) || \ 0613 ((__BUFFER_ACCESS__) == FMAC_BUFFER_ACCESS_POLLING) || \ 0614 ((__BUFFER_ACCESS__) == FMAC_BUFFER_ACCESS_IT)) 0615 0616 /** 0617 * @brief Verify the FMAC clip feature. 0618 * @param __CLIP_STATE__ Clip state. 0619 * @retval SET (__CLIP_STATE__ is a valid value) or RESET (__CLIP_STATE__ is invalid) 0620 */ 0621 #define IS_FMAC_CLIP_STATE(__CLIP_STATE__) (((__CLIP_STATE__) == FMAC_CLIP_DISABLED) || \ 0622 ((__CLIP_STATE__) == FMAC_CLIP_ENABLED)) 0623 0624 /** 0625 * @brief Check whether the threshold is applicable. 0626 * @param __SIZE__ Size of the matching buffer. 0627 * @param __WM__ Watermark value. 0628 * @param __ACCESS__ Access to the buffer (polling, it, dma, none). 0629 * @retval THRESHOLD 0630 */ 0631 #define IS_FMAC_THRESHOLD_APPLICABLE(__SIZE__, __WM__, __ACCESS__) \ 0632 (( (__SIZE__) >= (((__WM__) == FMAC_THRESHOLD_1)? 1U: \ 0633 ((__WM__) == FMAC_THRESHOLD_2)? 2U: \ 0634 ((__WM__) == FMAC_THRESHOLD_4)? 4U:8U))&& \ 0635 ((((__ACCESS__) == FMAC_BUFFER_ACCESS_DMA)&& \ 0636 ((__WM__) == FMAC_THRESHOLD_1))|| \ 0637 ((__ACCESS__ )!= FMAC_BUFFER_ACCESS_DMA))) 0638 0639 /** 0640 * @} 0641 */ 0642 0643 /* Exported functions ------------------------------------------------------- */ 0644 /** @addtogroup FMAC_Exported_Functions 0645 * @{ 0646 */ 0647 0648 /** @addtogroup FMAC_Exported_Functions_Group1 0649 * @{ 0650 */ 0651 /* Initialization and de-initialization functions ****************************/ 0652 HAL_StatusTypeDef HAL_FMAC_Init(FMAC_HandleTypeDef *hfmac); 0653 HAL_StatusTypeDef HAL_FMAC_DeInit(FMAC_HandleTypeDef *hfmac); 0654 void HAL_FMAC_MspInit(FMAC_HandleTypeDef *hfmac); 0655 void HAL_FMAC_MspDeInit(FMAC_HandleTypeDef *hfmac); 0656 0657 #if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1) 0658 /* Callbacks Register/UnRegister functions ***********************************/ 0659 HAL_StatusTypeDef HAL_FMAC_RegisterCallback(FMAC_HandleTypeDef *hfmac, HAL_FMAC_CallbackIDTypeDef CallbackID, 0660 pFMAC_CallbackTypeDef pCallback); 0661 HAL_StatusTypeDef HAL_FMAC_UnRegisterCallback(FMAC_HandleTypeDef *hfmac, HAL_FMAC_CallbackIDTypeDef CallbackID); 0662 #endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */ 0663 /** 0664 * @} 0665 */ 0666 0667 /** @addtogroup FMAC_Exported_Functions_Group2 0668 * @{ 0669 */ 0670 /* Peripheral Control functions ***********************************************/ 0671 HAL_StatusTypeDef HAL_FMAC_FilterConfig(FMAC_HandleTypeDef *hfmac, FMAC_FilterConfigTypeDef *pConfig); 0672 HAL_StatusTypeDef HAL_FMAC_FilterConfig_DMA(FMAC_HandleTypeDef *hfmac, FMAC_FilterConfigTypeDef *pConfig); 0673 HAL_StatusTypeDef HAL_FMAC_FilterPreload(FMAC_HandleTypeDef *hfmac, int16_t *pInput, uint8_t InputSize, 0674 int16_t *pOutput, uint8_t OutputSize); 0675 HAL_StatusTypeDef HAL_FMAC_FilterPreload_DMA(FMAC_HandleTypeDef *hfmac, int16_t *pInput, uint8_t InputSize, 0676 int16_t *pOutput, uint8_t OutputSize); 0677 HAL_StatusTypeDef HAL_FMAC_FilterStart(FMAC_HandleTypeDef *hfmac, int16_t *pOutput, uint16_t *pOutputSize); 0678 HAL_StatusTypeDef HAL_FMAC_AppendFilterData(FMAC_HandleTypeDef *hfmac, int16_t *pInput, uint16_t *pInputSize); 0679 HAL_StatusTypeDef HAL_FMAC_ConfigFilterOutputBuffer(FMAC_HandleTypeDef *hfmac, int16_t *pOutput, uint16_t *pOutputSize); 0680 HAL_StatusTypeDef HAL_FMAC_PollFilterData(FMAC_HandleTypeDef *hfmac, uint32_t Timeout); 0681 HAL_StatusTypeDef HAL_FMAC_FilterStop(FMAC_HandleTypeDef *hfmac); 0682 /** 0683 * @} 0684 */ 0685 0686 /** @addtogroup FMAC_Exported_Functions_Group3 0687 * @{ 0688 */ 0689 /* Callback functions *********************************************************/ 0690 void HAL_FMAC_ErrorCallback(FMAC_HandleTypeDef *hfmac); 0691 void HAL_FMAC_HalfGetDataCallback(FMAC_HandleTypeDef *hfmac); 0692 void HAL_FMAC_GetDataCallback(FMAC_HandleTypeDef *hfmac); 0693 void HAL_FMAC_HalfOutputDataReadyCallback(FMAC_HandleTypeDef *hfmac); 0694 void HAL_FMAC_OutputDataReadyCallback(FMAC_HandleTypeDef *hfmac); 0695 void HAL_FMAC_FilterConfigCallback(FMAC_HandleTypeDef *hfmac); 0696 void HAL_FMAC_FilterPreloadCallback(FMAC_HandleTypeDef *hfmac); 0697 /** 0698 * @} 0699 */ 0700 0701 /** @addtogroup FMAC_Exported_Functions_Group4 0702 * @{ 0703 */ 0704 /* IRQ handler management *****************************************************/ 0705 void HAL_FMAC_IRQHandler(FMAC_HandleTypeDef *hfmac); 0706 /** 0707 * @} 0708 */ 0709 0710 /** @addtogroup FMAC_Exported_Functions_Group5 0711 * @{ 0712 */ 0713 /* Peripheral State functions *************************************************/ 0714 HAL_FMAC_StateTypeDef HAL_FMAC_GetState(const FMAC_HandleTypeDef *hfmac); 0715 uint32_t HAL_FMAC_GetError(const FMAC_HandleTypeDef *hfmac); 0716 /** 0717 * @} 0718 */ 0719 0720 /** 0721 * @} 0722 */ 0723 0724 /** 0725 * @} 0726 */ 0727 0728 /** 0729 * @} 0730 */ 0731 0732 #endif /* FMAC */ 0733 0734 #ifdef __cplusplus 0735 } 0736 #endif 0737 0738 #endif /* STM32H7xx_HAL_FMAC_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |