#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;
|
}
|