#include #include #include #include #include #include "fft.h" #define pi 3.1415926 /* Declaring the external buffers needed for FFT Accelerator*/ //extern float FFT_IP_buff[]; //ÊäÈ뻺³å //extern float FFT_OP_buff[]; //Êä³ö»º³å static float FFT_VCF_buff[2*V]; static float FFT_HCF_buff[2*H]; static float FFT_IM_OP_buff[N*2]; static float FFT_SP_CF_buff[N*4]; /*CPIFFT,IBFFT,ILFFT,ICFFT,IMFFT,IIFFt*/ /* CPIFFT: ͨµÀÖ¸Õë¼Ä´æÆ÷,±£´æÏÂÒ»¸ö´«Êä¿ØÖÆ¿éµÄ¿ªÊ¼Î»ÖᣠIBFFT: »ùÖ·¼Ä´æÆ÷£¬Ñ­»·»º³å¿ªÊ¼µØÖ· ILFFT: ³¤¶È¼Ä´æÆ÷£¬Ñ­»·»º³å³¤¶È ICFFT: ¼ÆÊý¼Ä´æÆ÷£¬±êʾ»¹Ê£Óà¶àÉÙ×ÖÐèÒª´«Êä IMFFT: ¿ÉÐ޸ļĴæÆ÷£¬DMA¶ÁдºóIIFFT±ä»¯µÄÓзûºÅÔöÁ¿ IIFFT: Ë÷Òý¼Ä´æÆ÷£¬Ö¸ÏòÏÂÒ»¸öÄÚ²¿ÄÚ´æ¶ÁдλÖᣠ*/ /*Coefficient TCB for loading V cofficients */ static int FFT_VCF_TCB[6]={0,(int)FFT_VCF_buff,2*V,2*V,1,(int)FFT_VCF_buff};// Vertical coeff TCB static int FFT_VIP_TCB[6]={0,(int)0,2*N-1,2*N-1,2*H,(int)0};// input TCB modify is 2H static int FFT_VLASTIP_TCB[6]={0,(int)0,2*N,1,1,(int)0+2*N-1};// input TCB chain static int FFT_IMOP_TCB1[6]={0,(int)FFT_IM_OP_buff,2*N,2*N,1,(int)FFT_IM_OP_buff};// Vertical FFT receive buffer. static int FFT_PWCF_TCB[N/128][6]={{0,(int)FFT_SP_CF_buff,4*N,512,1,(int)FFT_SP_CF_buff+0}}; static int FFT_IMIP_TCB[N/128][6]={{0,(int)FFT_IM_OP_buff,2*N,256,1,(int)FFT_IM_OP_buff+0}}; static int FFT_IMOP_TCB[N/128][6]={{0,(int)FFT_IM_OP_buff,2*N,256,1,(int)FFT_IM_OP_buff+0}}; static int FFT_HCF_TCB[6]={0,(int)FFT_HCF_buff,2*H,2*H,1,(int)FFT_HCF_buff}; // Horizontal coeff TCB static int FFT_HIP_TCB[6]={0,(int)FFT_IM_OP_buff,2*N-1,2*N-1,2*V,(int)FFT_IM_OP_buff};// Special product transmit buffer. modify is 2V static int FFT_HLASTIP_TCB[6]={0,(int)FFT_IM_OP_buff,2*N,1,1,(int)FFT_IM_OP_buff+2*N-1};// Special product transmit buffer. static int FFT_OP_TCB[6]={0,(int)0,2*N-1,2*N-1,2*V,(int)0};//modify is 2V static int FFT_LASTOP_TCB[6]={0,(int)0,2*N,1,1,(int)0+2*N-1}; //sp_cf³¤¶ÈΪV*H*4 void fft_coeff_calculation(void) { int i,j,k; float temp[128]; float w; //e^-2pikm for(i=0,k=0;i=0){ //Mapping the FFT DMA interrupt temp=* (pPICR0+index); temp&=~(0x1f<