STM32H735xx HAL User Manual
Functions
stm32h7xx_hal_cordic.c File Reference

CORDIC HAL module driver. This file provides firmware functions to manage the following functionalities of the CORDIC peripheral: + Initialization and de-initialization functions + Peripheral Control functions + Callback functions + IRQ handler management + Peripheral State functions. More...

#include "stm32h7xx_hal.h"

Go to the source code of this file.

Functions

static void CORDIC_WriteInDataIncrementPtr (CORDIC_HandleTypeDef *hcordic, int32_t **ppInBuff)
 Write input data for CORDIC processing, and increment input buffer pointer.
static void CORDIC_ReadOutDataIncrementPtr (CORDIC_HandleTypeDef *hcordic, int32_t **ppOutBuff)
 Read output data of CORDIC processing, and increment output buffer pointer.
static void CORDIC_DMAInCplt (DMA_HandleTypeDef *hdma)
 DMA CORDIC Input Data process complete callback.
static void CORDIC_DMAOutCplt (DMA_HandleTypeDef *hdma)
 DMA CORDIC Output Data process complete callback.
static void CORDIC_DMAError (DMA_HandleTypeDef *hdma)
 DMA CORDIC communication error callback.
HAL_StatusTypeDef HAL_CORDIC_Init (CORDIC_HandleTypeDef *hcordic)
 Initialize the CORDIC peripheral and the associated handle.
HAL_StatusTypeDef HAL_CORDIC_DeInit (CORDIC_HandleTypeDef *hcordic)
 DeInitialize the CORDIC peripheral.
__weak void HAL_CORDIC_MspInit (CORDIC_HandleTypeDef *hcordic)
 Initialize the CORDIC MSP.
__weak void HAL_CORDIC_MspDeInit (CORDIC_HandleTypeDef *hcordic)
 DeInitialize the CORDIC MSP.
HAL_StatusTypeDef HAL_CORDIC_RegisterCallback (CORDIC_HandleTypeDef *hcordic, HAL_CORDIC_CallbackIDTypeDef CallbackID, void(*pCallback)(CORDIC_HandleTypeDef *_hcordic))
 Register a CORDIC CallBack.
HAL_StatusTypeDef HAL_CORDIC_UnRegisterCallback (CORDIC_HandleTypeDef *hcordic, HAL_CORDIC_CallbackIDTypeDef CallbackID)
 Unregister a CORDIC CallBack.
HAL_StatusTypeDef HAL_CORDIC_Configure (CORDIC_HandleTypeDef *hcordic, CORDIC_ConfigTypeDef *sConfig)
 Configure the CORDIC processing according to the specified parameters in the CORDIC_ConfigTypeDef structure.
HAL_StatusTypeDef HAL_CORDIC_Calculate (CORDIC_HandleTypeDef *hcordic, int32_t *pInBuff, int32_t *pOutBuff, uint32_t NbCalc, uint32_t Timeout)
 Carry out data of CORDIC processing in polling mode, according to the existing CORDIC configuration.
HAL_StatusTypeDef HAL_CORDIC_CalculateZO (CORDIC_HandleTypeDef *hcordic, int32_t *pInBuff, int32_t *pOutBuff, uint32_t NbCalc, uint32_t Timeout)
 Carry out data of CORDIC processing in Zero-Overhead mode (output data being read soon as input data are written), according to the existing CORDIC configuration.
HAL_StatusTypeDef HAL_CORDIC_Calculate_IT (CORDIC_HandleTypeDef *hcordic, int32_t *pInBuff, int32_t *pOutBuff, uint32_t NbCalc)
 Carry out data of CORDIC processing in interrupt mode, according to the existing CORDIC configuration.
HAL_StatusTypeDef HAL_CORDIC_Calculate_DMA (CORDIC_HandleTypeDef *hcordic, int32_t *pInBuff, int32_t *pOutBuff, uint32_t NbCalc, uint32_t DMADirection)
 Carry out input and/or output data of CORDIC processing in DMA mode, according to the existing CORDIC configuration.
__weak void HAL_CORDIC_ErrorCallback (CORDIC_HandleTypeDef *hcordic)
 CORDIC error callback.
__weak void HAL_CORDIC_CalculateCpltCallback (CORDIC_HandleTypeDef *hcordic)
 CORDIC calculate complete callback.
void HAL_CORDIC_IRQHandler (CORDIC_HandleTypeDef *hcordic)
 Handle CORDIC interrupt request.
HAL_CORDIC_StateTypeDef HAL_CORDIC_GetState (CORDIC_HandleTypeDef *hcordic)
 Return the CORDIC handle state.
uint32_t HAL_CORDIC_GetError (CORDIC_HandleTypeDef *hcordic)
 Return the CORDIC peripheral error.

Detailed Description

CORDIC HAL module driver. This file provides firmware functions to manage the following functionalities of the CORDIC peripheral: + Initialization and de-initialization functions + Peripheral Control functions + Callback functions + IRQ handler management + Peripheral State functions.

Author:
MCD Application Team
Attention:

Copyright (c) 2017 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

  ================================================================================
            ##### How to use this driver #####
  ================================================================================
    [..]
      The CORDIC HAL driver can be used as follows:

      (#) Initialize the CORDIC low level resources by implementing the HAL_CORDIC_MspInit():
         (++) Enable the CORDIC interface clock using __HAL_RCC_CORDIC_CLK_ENABLE()
         (++) In case of using interrupts (e.g. HAL_CORDIC_Calculate_IT())
             (+++) Configure the CORDIC interrupt priority using HAL_NVIC_SetPriority()
             (+++) Enable the CORDIC IRQ handler using HAL_NVIC_EnableIRQ()
             (+++) In CORDIC IRQ handler, call HAL_CORDIC_IRQHandler()
         (++) In case of using DMA to control data transfer (e.g. HAL_CORDIC_Calculate_DMA())
             (+++) Enable the DMA2 interface clock using
                 __HAL_RCC_DMA2_CLK_ENABLE()
             (+++) Configure and enable two DMA channels one for managing data transfer from
                 memory to peripheral (input channel) and another channel for managing data
                 transfer from peripheral to memory (output channel)
             (+++) Associate the initialized DMA handle to the CORDIC DMA handle
                 using __HAL_LINKDMA()
             (+++) Configure the priority and enable the NVIC for the transfer complete
                 interrupt on the two DMA channels.
                 Resort to HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ()

      (#) Initialize the CORDIC HAL using HAL_CORDIC_Init(). This function
         (++) resorts to HAL_CORDIC_MspInit() for low-level initialization,

      (#) Configure CORDIC processing (calculation) using HAL_CORDIC_Configure().
          This function configures:
         (++) Processing functions: Cosine, Sine, Phase, Modulus, Arctangent,
              Hyperbolic cosine, Hyperbolic sine, Hyperbolic arctangent,
              Natural log, Square root
         (++) Scaling factor: 1 to 2exp(-7)
         (++) Width of input data: 32 bits input data size (Q1.31 format) or 16 bits
              input data size (Q1.15 format)
         (++) Width of output data: 32 bits output data size (Q1.31 format) or 16 bits
              output data size (Q1.15 format)
         (++) Number of 32-bit write expected for one calculation: One 32-bits write
              or Two 32-bit write
         (++) Number of 32-bit read expected after one calculation: One 32-bits read
              or Two 32-bit read
         (++) Precision: 1 to 15 cycles for calculation (the more cycles, the better precision)

      (#) Four processing (calculation) functions are available:
         (++) Polling mode: processing API is blocking function
              i.e. it processes the data and wait till the processing is finished
              API is HAL_CORDIC_Calculate
         (++) Polling Zero-overhead mode: processing API is blocking function
              i.e. it processes the data and wait till the processing is finished
              A bit faster than standard polling mode, but blocking also AHB bus
              API is HAL_CORDIC_CalculateZO
         (++) Interrupt mode: processing API is not blocking functions
              i.e. it processes the data under interrupt
              API is HAL_CORDIC_Calculate_IT
         (++) DMA mode: processing API is not blocking functions and the CPU is
              not used for data transfer,
              i.e. the data transfer is ensured by DMA
              API is HAL_CORDIC_Calculate_DMA

      (#) Call HAL_CORDIC_DeInit() to de-initialize the CORDIC peripheral. This function
         (++) resorts to HAL_CORDIC_MspDeInit() for low-level de-initialization,

  *** Callback registration ***
  =============================================

  The compilation define  USE_HAL_CORDIC_REGISTER_CALLBACKS when set to 1
  allows the user to configure dynamically the driver callbacks.
  Use Function HAL_CORDIC_RegisterCallback() to register an interrupt callback.

  Function HAL_CORDIC_RegisterCallback() allows to register following callbacks:
    (+) ErrorCallback             : Error Callback.
    (+) CalculateCpltCallback     : Calculate complete Callback.
    (+) MspInitCallback           : CORDIC MspInit.
    (+) MspDeInitCallback         : CORDIC MspDeInit.
  This function takes as parameters the HAL peripheral handle, the Callback ID
  and a pointer to the user callback function.

  Use function HAL_CORDIC_UnRegisterCallback() to reset a callback to the default
  weak function.
  HAL_CORDIC_UnRegisterCallback takes as parameters the HAL peripheral handle,
  and the Callback ID.
  This function allows to reset following callbacks:
    (+) ErrorCallback             : Error Callback.
    (+) CalculateCpltCallback     : Calculate complete Callback.
    (+) MspInitCallback           : CORDIC MspInit.
    (+) MspDeInitCallback         : CORDIC MspDeInit.

  By default, after the HAL_CORDIC_Init() and when the state is HAL_CORDIC_STATE_RESET,
  all callbacks are set to the corresponding weak functions:
  examples HAL_CORDIC_ErrorCallback(), HAL_CORDIC_CalculateCpltCallback().
  Exception done for MspInit and MspDeInit functions that are
  reset to the legacy weak function in the HAL_CORDIC_Init()/ HAL_CORDIC_DeInit() only when
  these callbacks are null (not registered beforehand).
  if not, MspInit or MspDeInit are not null, the HAL_CORDIC_Init()/ HAL_CORDIC_DeInit()
  keep and use the user MspInit/MspDeInit callbacks (registered beforehand)

  Callbacks can be registered/unregistered in HAL_CORDIC_STATE_READY state only.
  Exception done MspInit/MspDeInit that can be registered/unregistered
  in HAL_CORDIC_STATE_READY or HAL_CORDIC_STATE_RESET state,
  thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
  In that case first register the MspInit/MspDeInit user callbacks
  using HAL_CORDIC_RegisterCallback() before calling HAL_CORDIC_DeInit()
  or HAL_CORDIC_Init() function.

  When The compilation define USE_HAL_CORDIC_REGISTER_CALLBACKS is set to 0 or
  not defined, the callback registration feature is not available and all callbacks
  are set to the corresponding weak functions.

  

Definition in file stm32h7xx_hal_cordic.c.