summaryrefslogtreecommitdiff
path: root/bsp/xuantie/libraries/xuantie_libraries/csi/csi2/include/drv/fft.h
blob: a3cd312b6e35a94a9e53d8554851cd3d4263b880 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
 /*
 * Copyright (C) 2017-2024 Alibaba Group Holding Limited
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/******************************************************************************
 * @file     drv/fft.h
 * @brief    Header File for FFT Driver
 * @version  V1.0
 * @date     11. Nov 2020
 * @model    fft
 ******************************************************************************/

#ifndef _DRV_FFT_H_
#define _DRV_FFT_H_

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
    ///< 512-point FFT
    CSKY_MCA_FFT_LEN_512 = 0x1,
    ///< 256-point FFT
    CSKY_MCA_FFT_LEN_256 = 0x2,
    ///< 128-point FFT
    CSKY_MCA_FFT_LEN_128 = 0x4,
    ///< 64-point FFT
    CSKY_MCA_FFT_LEN_64 = 0x8,
    ///< 32-point FFT
    CSKY_MCA_FFT_LEN_32 = 0x10,
    ///< 16-point FFT
    CSKY_MCA_FFT_LEN_16 = 0x20,
} csky_mca_fft_len_t;

/* 8-bit fixed-point numeric type in user-defined format */
typedef int8_t fxp8_t;

/* 16-bit fixed-point numeric type in user-defined format */
typedef int16_t fxp16_t;

/* 24-bit fixed-point numeric type in user-defined format */
typedef int32_t fxp24_t;

/* 32-bit fixed-point numeric type in user-defined format */
typedef int32_t fxp32_t;

/* 64-bit fixed-point numeric type in user-defined format */
typedef int64_t fxp64_t;

/* 8-bit fixed-point numeric type in 1.0.7 format */
typedef fxp8_t q7_t;

/* 16-bit fixed-point numeric type in 1.0.15 format */
typedef fxp16_t q15_t;

/* 32-bit fixed-point numeric type in 1.15.16 format */
typedef fxp32_t q16_t;

void csky_mca_rfft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, size_t input_size, fxp32_t *output);
void csky_mca_cfft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, fxp32_t *output);
void csky_mca_rifft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, fxp32_t *output);
void csky_mca_cifft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, fxp32_t *output);
void csky_mca_power_spectrum_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, size_t input_size, fxp64_t *output);

#ifdef __cplusplus
}
#endif

#endif /* _DRV_FFT_H_ */