qipp
2025-11-07 744722688187eb4991c72464e2bb5e06b244fee7
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
#include <def21489.h>
#include <cdef21489.h>
#include <stdio.h>
#include <signal.h>
#include <alg.h>
#include "drv/fft_drv.h"
#include "fft.h"
 
//static volatile int fft_channel;
volatile fft_state  fft_status = fft_idle ;  //fftÓ²¼þ×ÊÔ´Õ¼ÓñêÖ¾,Á½ÖÖfft_idle, fft_busy
 
//real, imag,real,imag...real,imag
static  float fft_input[2*N];    
static  float fft_output[2*N];
 
//static fn_fft_completely pfft_notify =0 ;
//static void* pfft_context=0;
 
static int fft_count=0;
 
void fft_isr(int sig)
{    
    if(*pFFTDMASTAT & ODMACHIRPT) {    
        fft_count++;    
        fft_status = fft_completed; 
    }
}
 
 float* fft_channel_inptr()
{
    return fft_input;
}
 
void fft_reset()
{
    int timeout =0 ;
 
    while(fft_status == fft_progress){
        timeout++;
        if(timeout>0xffff)    {
            break;
        }
    }
    
    fft_status = fft_idle;
}
 
 float* fft_channel_outptr()
{
    //µ÷ÓôνӿÚ×Ô¶¯Çå³ý״̬
    fft_status = fft_idle;
    return fft_output;
}
 
void fft_start()
{
    fft_startup((int)fft_input,(int)fft_output);    
    fft_status = fft_progress;
}
 
 
void fft_init()
{
    int i;
    fft_coeff_calculation();
    fft_config(true,15); //15±íʾӳÉäÖжϵ½SIG_P15
    
    interrupts(SIG_P15,fft_isr);
    fft_status = fft_idle;
}