sdk-hwV1.3/lichee/xr806/appos/project/common/cmd/fft/fft.h

83 lines
2.8 KiB
C
Raw Normal View History

2024-05-07 10:09:20 +00:00
/*
* Copyright (C) 2017 XRADIO TECHNOLOGY CO., LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* 3. Neither the name of XRADIO TECHNOLOGY CO., LTD. nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _FFT_H_
#define _FFT_H_
#define debug_print_en 0
#define fref 24 // ref xtal freqency is 24MHz
typedef enum {
Max287x_Power_Level0 = 0, /*!< 00 = -4dBm */
Max287x_Power_Level1 = 1, /*!< 00 = -1dBm */
Max287x_Power_Level2 = 2, /*!< 00 = +2dBm */
Max287x_Power_Level3 = 3 /*!< 00 = +5dBm */
} PowerLevel;
#define round(x) (__u32)((x)+0.5)
typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
typedef signed long long s64;
typedef signed int s32;
typedef signed short s16;
typedef signed char s8;
typedef u8 __u8;
typedef u16 __u16;
typedef u32 __u32;
typedef u64 __u64;
typedef s8 __s8;
typedef s16 __s16;
typedef s32 __s32;
typedef s64 __s64;
typedef struct _COMPLEX {
__s32 Re;
__s32 Im;
} COMPLEX;
typedef struct _FFT_RESULT {
double sig_power;
double noise_power;
double Harm2nd_power;
double Harm3th_power;
float sig_freq;
} FFT_RESULT;
COMPLEX complex_add(COMPLEX x1, COMPLEX x2);
COMPLEX complex_sub(COMPLEX x1, COMPLEX x2);
COMPLEX complex_mul(COMPLEX x1, COMPLEX x2);
#endif