diff --git a/src/fe/controllerApp.c b/src/fe/controllerApp.c index 226f24c2313cc8c2459c8a45e9b5c21d239ba0e8..87994486226cf30c5828ea4c2fafb3eb04447cab 100644 --- a/src/fe/controllerApp.c +++ b/src/fe/controllerApp.c @@ -173,93 +173,6 @@ int getGpsTime(unsigned int *tsyncSec, unsigned int *tsyncUsec); char daqArea[2*DAQ_DCU_SIZE]; // Space allocation for daqLib buffers int cpuId = 1; -// All systems not running at 64K require up/down sampling to communicate I/O data -// with IOP, which is running at 64K. -// Following defines the filter coeffs for these up/down filters. -#ifdef OVERSAMPLE - -#if defined(CORE_BIQUAD) - -/* Recalculated filters in biquad form */ - -/* Oversamping base rate is 64K */ -/* Coeffs for the 2x downsampling (32K system) filter */ -static double __attribute__ ((unused)) feCoeff2x[9] = - {0.053628649721183, - 0.2568759660371100, -0.3225906481359000, 1.2568801238621801, 1.6774135096891700, - -0.2061764045745400, -1.0941543149527400, 2.0846376586498803, 2.1966597482716801}; - -/* RCG V3.0 Coeffs for the 4x downsampling (16K system) filter */ -static double __attribute__ ((unused)) feCoeff4x[9] = - {0.054285975, - 0.3890221, -0.17645085, -0.0417771600000001, 0.41775916, - 0.52191125, -0.37884382, 1.52190741336686, 1.69347541336686}; - -// Pre RCG 3.0 filters -// {0.014805052402446, -// 0.7166258547451800, -0.0683289874517300, 0.3031629575762000, 0.5171469569032900, -// 0.6838596423885499, -0.2534855521841101, 1.6838609161411500, 1.7447155374502499}; - -// -// New Brian Lantz 4k decimation filter -static double __attribute__ ((unused)) feCoeff16x[9] = - {0.010203728365, - 0.8052941009065100, -0.0241751519071000, 0.3920490703701900, 0.5612099784288400, - 0.8339678987936501, -0.0376022631287799, -0.0131581721533700, 0.1145865116421301}; - -/* Coeffs for the 32x downsampling filter (2K system) */ -#if 0 -/* Original Rana coeffs from 40m lab elog */ -static double __attribute__ ((unused)) feCoeff32x[9] = - {0.0001104130574447, - 0.9701834961388200, -0.0010837026165800, -0.0200761119821899, 0.0085463156103800, - 0.9871502388637901, -0.0039246182095299, 3.9871502388637898, 3.9960753817904697}; -#endif - -/* Coeffs for the 32x downsampling filter (2K system) per Brian Lantz May 5, 2009 */ -static double __attribute__ ((unused)) feCoeff32x[9] = - {0.010581064947739, - 0.90444302586137004, -0.0063413204375699639, -0.056459743474659874, 0.032075154877300172, - 0.92390910024681006, -0.0097523655540199261, 0.077383808424050127, 0.14238741130302013}; - -#else - -/* Oversamping base rate is 64K */ -/* Coeffs for the 2x downsampling (32K system) filter */ -static double __attribute__ ((unused)) feCoeff2x[9] = - {0.053628649721183, - -1.25687596603711, 0.57946661417301, 0.00000415782507, 1.00000000000000, - -0.79382359542546, 0.88797791037820, 1.29081406322442, 1.00000000000000}; -/* Coeffs for the 4x downsampling (16K system) filter */ -static double __attribute__ ((unused)) feCoeff4x[9] = - {0.014805052402446, - -1.71662585474518, 0.78495484219691, -1.41346289716898, 0.99893884152400, - -1.68385964238855, 0.93734519457266, 0.00000127375260, 0.99819981588176}; -// -// New Brian Lantz 4k decimation filter -static double __attribute__ ((unused)) feCoeff16x[9] = - {0.010203728365, - -1.80529410090651, 0.82946925281361, -1.41324503053632, 0.99863016087226, - -1.83396789879365, 0.87157016192243, -1.84712607094702, 0.99931484571793}; -// - -/* Coeffs for the 32x downsampling filter (2K system) per Brian Lantz May 5, 2009 */ -static double __attribute__ ((unused)) feCoeff32x[9] = - {0.010581064947739, - -1.90444302586137, 0.91078434629894, -1.96090276933603, 0.99931924465090, - -1.92390910024681, 0.93366146580083, -1.84652529182276, 0.99866506867980}; -#endif - - - -// History buffers for oversampling filters -double dHistory[(MAX_ADC_MODULES * 32)][MAX_HISTRY]; -double dDacHistory[(MAX_DAC_MODULES * 16)][MAX_HISTRY]; -#else - -#define OVERSAMPLE_TIMES 1 -#endif - #ifdef DUAL_DAQ_DC #define MX_OK 15 #else diff --git a/src/fe/controllerIop.c b/src/fe/controllerIop.c index b61f21292013cc104ce975b1d1b6c1f8ae85f4bb..fb5aabf57dca9fdb1399c34d546d55aa49c98cb5 100644 --- a/src/fe/controllerIop.c +++ b/src/fe/controllerIop.c @@ -174,93 +174,6 @@ int getGpsTime(unsigned int *tsyncSec, unsigned int *tsyncUsec); char daqArea[2*DAQ_DCU_SIZE]; // Space allocation for daqLib buffers int cpuId = 1; -// All systems not running at 64K require up/down sampling to communicate I/O data -// with IOP, which is running at 64K. -// Following defines the filter coeffs for these up/down filters. -#ifdef OVERSAMPLE - -#if defined(CORE_BIQUAD) - -/* Recalculated filters in biquad form */ - -/* Oversamping base rate is 64K */ -/* Coeffs for the 2x downsampling (32K system) filter */ -static double __attribute__ ((unused)) feCoeff2x[9] = - {0.053628649721183, - 0.2568759660371100, -0.3225906481359000, 1.2568801238621801, 1.6774135096891700, - -0.2061764045745400, -1.0941543149527400, 2.0846376586498803, 2.1966597482716801}; - -/* RCG V3.0 Coeffs for the 4x downsampling (16K system) filter */ -static double __attribute__ ((unused)) feCoeff4x[9] = - {0.054285975, - 0.3890221, -0.17645085, -0.0417771600000001, 0.41775916, - 0.52191125, -0.37884382, 1.52190741336686, 1.69347541336686}; - -// Pre RCG 3.0 filters -// {0.014805052402446, -// 0.7166258547451800, -0.0683289874517300, 0.3031629575762000, 0.5171469569032900, -// 0.6838596423885499, -0.2534855521841101, 1.6838609161411500, 1.7447155374502499}; - -// -// New Brian Lantz 4k decimation filter -static double __attribute__ ((unused)) feCoeff16x[9] = - {0.010203728365, - 0.8052941009065100, -0.0241751519071000, 0.3920490703701900, 0.5612099784288400, - 0.8339678987936501, -0.0376022631287799, -0.0131581721533700, 0.1145865116421301}; - -/* Coeffs for the 32x downsampling filter (2K system) */ -#if 0 -/* Original Rana coeffs from 40m lab elog */ -static double __attribute__ ((unused)) feCoeff32x[9] = - {0.0001104130574447, - 0.9701834961388200, -0.0010837026165800, -0.0200761119821899, 0.0085463156103800, - 0.9871502388637901, -0.0039246182095299, 3.9871502388637898, 3.9960753817904697}; -#endif - -/* Coeffs for the 32x downsampling filter (2K system) per Brian Lantz May 5, 2009 */ -static double __attribute__ ((unused)) feCoeff32x[9] = - {0.010581064947739, - 0.90444302586137004, -0.0063413204375699639, -0.056459743474659874, 0.032075154877300172, - 0.92390910024681006, -0.0097523655540199261, 0.077383808424050127, 0.14238741130302013}; - -#else - -/* Oversamping base rate is 64K */ -/* Coeffs for the 2x downsampling (32K system) filter */ -static double __attribute__ ((unused)) feCoeff2x[9] = - {0.053628649721183, - -1.25687596603711, 0.57946661417301, 0.00000415782507, 1.00000000000000, - -0.79382359542546, 0.88797791037820, 1.29081406322442, 1.00000000000000}; -/* Coeffs for the 4x downsampling (16K system) filter */ -static double __attribute__ ((unused)) feCoeff4x[9] = - {0.014805052402446, - -1.71662585474518, 0.78495484219691, -1.41346289716898, 0.99893884152400, - -1.68385964238855, 0.93734519457266, 0.00000127375260, 0.99819981588176}; -// -// New Brian Lantz 4k decimation filter -static double __attribute__ ((unused)) feCoeff16x[9] = - {0.010203728365, - -1.80529410090651, 0.82946925281361, -1.41324503053632, 0.99863016087226, - -1.83396789879365, 0.87157016192243, -1.84712607094702, 0.99931484571793}; -// - -/* Coeffs for the 32x downsampling filter (2K system) per Brian Lantz May 5, 2009 */ -static double __attribute__ ((unused)) feCoeff32x[9] = - {0.010581064947739, - -1.90444302586137, 0.91078434629894, -1.96090276933603, 0.99931924465090, - -1.92390910024681, 0.93366146580083, -1.84652529182276, 0.99866506867980}; -#endif - - - -// History buffers for oversampling filters -double dHistory[(MAX_ADC_MODULES * 32)][MAX_HISTRY]; -double dDacHistory[(MAX_DAC_MODULES * 16)][MAX_HISTRY]; -#else - -#define OVERSAMPLE_TIMES 1 -#endif - #ifdef DUAL_DAQ_DC #define MX_OK 15 #else diff --git a/src/include/controller.h b/src/include/controller.h index ed61a4f7ee37fd34c3251c238701fbb1109e5d43..59aa9ba75fc4d4adba5a8a572cf124c8636be594 100644 --- a/src/include/controller.h +++ b/src/include/controller.h @@ -23,6 +23,7 @@ #define SYNC_SRC_1PPS 2 #define SYNC_SRC_TDS 4 #define SYNC_SRC_MASTER 8 +#define SYNC_SRC_TIMER 16 #define TIME_ERR_IRIGB 0x10 #define TIME_ERR_1PPS 0x20 #define TIME_ERR_TDS 0x40 @@ -293,6 +294,63 @@ unsigned int CDO32Output[MAX_DIO_MODULES]; #endif +// Up/Down Sampling Filter Coeffs +// All systems not running at 64K require up/down sampling to communicate I/O data +// with IOP, which is running at 64K. +// Following defines the filter coeffs for these up/down filters. +#ifdef OVERSAMPLE +/* Recalculated filters in biquad form */ + +/* Oversamping base rate is 64K */ +/* Coeffs for the 2x downsampling (32K system) filter */ +static double __attribute__ ((unused)) feCoeff2x[9] = + {0.053628649721183, + 0.2568759660371100, -0.3225906481359000, 1.2568801238621801, 1.6774135096891700, + -0.2061764045745400, -1.0941543149527400, 2.0846376586498803, 2.1966597482716801}; + +/* RCG V3.0 Coeffs for the 4x downsampling (16K system) filter */ +static double __attribute__ ((unused)) feCoeff4x[9] = + {0.054285975, + 0.3890221, -0.17645085, -0.0417771600000001, 0.41775916, + 0.52191125, -0.37884382, 1.52190741336686, 1.69347541336686}; + +// Pre RCG 3.0 filters +// {0.014805052402446, +// 0.7166258547451800, -0.0683289874517300, 0.3031629575762000, 0.5171469569032900, +// 0.6838596423885499, -0.2534855521841101, 1.6838609161411500, 1.7447155374502499}; + +// +// New Brian Lantz 4k decimation filter +static double __attribute__ ((unused)) feCoeff16x[9] = + {0.010203728365, + 0.8052941009065100, -0.0241751519071000, 0.3920490703701900, 0.5612099784288400, + 0.8339678987936501, -0.0376022631287799, -0.0131581721533700, 0.1145865116421301}; + +/* Coeffs for the 32x downsampling filter (2K system) */ +#if 0 +/* Original Rana coeffs from 40m lab elog */ +static double __attribute__ ((unused)) feCoeff32x[9] = + {0.0001104130574447, + 0.9701834961388200, -0.0010837026165800, -0.0200761119821899, 0.0085463156103800, + 0.9871502388637901, -0.0039246182095299, 3.9871502388637898, 3.9960753817904697}; +#endif + +/* Coeffs for the 32x downsampling filter (2K system) per Brian Lantz May 5, 2009 */ +static double __attribute__ ((unused)) feCoeff32x[9] = + {0.010581064947739, + 0.90444302586137004, -0.0063413204375699639, -0.056459743474659874, 0.032075154877300172, + 0.92390910024681006, -0.0097523655540199261, 0.077383808424050127, 0.14238741130302013}; + +// History buffers for oversampling filters +double dHistory[(MAX_ADC_MODULES * 32)][MAX_HISTRY]; +double dDacHistory[(MAX_DAC_MODULES * 16)][MAX_HISTRY]; + +#else + +#define OVERSAMPLE_TIMES 1 + +#endif + // /proc epics channel interface struct proc_epics { char *name;