/** * Module Name: gen_fir * Description: * Files: gen_fir.c * * Author: ismael * Created: Tue Feb 15 15:45:52 2011 * Revision: 0.1 * * Comments: Filter type is selected with the type variable in .params configuration file. * It can be changed only during the initialization (stats modification is ignored). Possible types are: * - 0: rectangular filter * - 1: raised cosine * - 2: root-raised cosine * - 3: MATLAB coefficients readed from fdacoefs.h file * * For raised and root raised filters, 'rate' and 'alpha' variables need to be selected. * */ #include #include #include #include "typetools.h" #include "stats.h" #include "moduleConfig.h" /** This file must be included AFTER moduleConfig.h */ #include #include "rcos.h" #include "fdacoefs.h" float taps[MAX_COEFFS]; int mem[MAX_COEFFS]; int norm; /** Generates filter coefficients */ int myinit() { int i; if (Ntaps>MAX_COEFFS) { xprintf("Error number of coefficients too large (%d>%d)\n",Ntaps,MAX_COEFFS); return 1; } memset(taps,0,sizeof(float)*Ntaps); /* compute filter coeficients */ switch(FilterType) { /* rect */ case 0: memset(taps,1,sizeof(float)*Ntaps); for (i=0;i