bf0_hal_fft.h

Header file of FFT HAL module.

Author

Sifli software development team

Attention

Defines

FFT1_LEN_MAX

FFT1 max length

Typedefs

typedef struct __FFT_HandleTypeDef FFT_HandleTypeDef

FFT handle structure definition

Enums

enum HAL_FFT_StateTypeDef

HAL FFT State structures definition.

Values:

enumerator HAL_FFT_STATE_RESET

FFT not yet initialized or disabled

enumerator HAL_FFT_STATE_READY

Peripheral Initialized and ready for use

enumerator HAL_FFT_STATE_BUSY

An internal process is ongoing

enumerator HAL_FFT_STATE_ERROR

FFT state error

enumerator HAL_FFT_STATE_CDCT_REAL

CDCT real part calculation ongoing state

enum FFT_BitwidthTypeDef

FFT Bitwidth Type Definition

Values:

enumerator FFT_BW_8BIT
enumerator FFT_BW_16BIT
enumerator FFT_BW_32BIT
enumerator FFT_BW_MAX
enum FFT_FFTLengthTypeDef

FFT Length Type Definition

Values:

enumerator FFT_LEN_16
enumerator FFT_LEN_32
enumerator FFT_LEN_64
enumerator FFT_LEN_128
enumerator FFT_LEN_256
enumerator FFT_LEN_512
enumerator FFT_LEN_1024
enumerator FFT_LEN_2048
enumerator FFT_LEN_4096
enumerator FFT_LEN_TYPE_NUM

Functions

HAL_StatusTypeDef HAL_FFT_Init(FFT_HandleTypeDef *fft)

Init FFT Accelerator.

返回值:

status

HAL_StatusTypeDef HAL_FFT_DeInit(FFT_HandleTypeDef *fft)

DeInit FFT Accelerator.

返回值:

status

HAL_StatusTypeDef HAL_FFT_StartFFT(FFT_HandleTypeDef *fft, FFT_ConfigTypeDef *config)

Start FFT in synchronous mode.

8bit FFT: input format is Q1.7, output format as follows, for FFT length greater than 128, output value needs to be upscaled accordingly further to match the FFT definition

FFT Length

Output Format

Upscale value

16

5.3

0

32

6.3

0

64

7.1

0

128

8.0

0

256

8.0

upscale by 2

512

8.0

upscale by 4

1024

8.0

upscale by 8

2048

8.0

upscale by 16

4096

8.0

upscale by 32

8bit IFFT: input format is Q1.7, output format is Q1.7

16bit FFT: input format is Q1.15, output format as follows

FFT Length

Output Format

16

5.11

32

6.10

64

7.9

128

8.8

256

9.7

512

10.6

1024

11.5

2048

12.4

4096

13.3

16bit IFFT: input format is Q1.15, output format is Q1.15

32bit FFT: input format is Q1.31, output format as follows

FFT Length

Output Format

16

5.27

32

6.26

64

7.25

128

8.24

256

9.23

512

10.22

1024

11.21

2048

12.20

4096

13.19

32bit IFFT: input format is Q1.31, output format is Q1.31

参数:
  • fft[in] FFT handle

  • config[in] FFT config

返回值:

status

HAL_StatusTypeDef HAL_FFT_StartFFT_IT(FFT_HandleTypeDef *fft, FFT_ConfigTypeDef *config)

Start FFT in asynchronous mode.

CpltCallback is called after complete

Input and output data format is same as HAL_FFT_StartFFT

参数:
  • fft[in] FFT handle

  • config[in] FFT config

返回值:

status

HAL_StatusTypeDef HAL_FFT_StartDCT(FFT_HandleTypeDef *fft, DCT_ConfigTypeDef *config)

Start DCT in synchronous mode.

8bit DCT: input format is Q1.7, output format as follows

DCT Length

Output Format

8

4.4

16

5.3

32

5.3

64

6.2

128

6.2

256

7.1

16bit DCT: input format is Q1.15, output format as follows

DCT Length

Output Format

8

4.12

16

5.11

32

5.11

64

6.10

128

6.10

256

7.9

32bit DCT: input format is Q1.31, output format as follows

DCT Length

Output Format

8

4.28

16

5.27

32

5.27

64

6.26

128

6.26

256

7.25

参数:
  • fft[in] FFT handle

  • config[in] DCT config

返回值:

status

HAL_StatusTypeDef HAL_FFT_StartDCT_IT(FFT_HandleTypeDef *fft, DCT_ConfigTypeDef *config)

Start DCT in asynchronous mode.

CpltCallback is called after complete

Input and output data format is same as HAL_FFT_StartDCT

参数:
  • fft[in] FFT handle

  • config[in] DCT config

返回值:

status

HAL_StatusTypeDef HAL_FFT_IRQHandler(FFT_HandleTypeDef *fft)
struct __FFT_HandleTypeDef
#include <bf0_hal_fft.h>

FFT handle structure definition

Public Members

FFT_TypeDef *Instance

FFT register base address.

void (*CpltCallback)(struct __FFT_HandleTypeDef *fft)

FFT processing complete callback.

HAL_FFT_StateTypeDef State

FFT state.

struct FFT_ConfigTypeDef
#include <bf0_hal_fft.h>

FFT Config

Public Members

FFT_BitwidthTypeDef bitwidth
FFT_FFTLengthTypeDef fft_length

FFT Length,

Pro: FFT1 support 16~4096, FFT2 supports 16~1024 Lite: FFT1 support 16~512

uint8_t rfft_flag

real fft flag. 1: real fft, 0: complex fft

uint8_t ifft_flag

IFFT flag. 1: ifft, 0: fft

void *input_data

input data, address must be 4 bytes aligned

void *output_data

output data, address must be 4 bytes aligned