diff --git a/src/fe/controllerAppUser.c b/src/fe/controllerAppUser.c index 07b1f7e06c5f22ccbad4c3de9989c6611d820b4a..1d59b6283d6bb058865b3dc364990e000932fb1f 100644 --- a/src/fe/controllerAppUser.c +++ b/src/fe/controllerAppUser.c @@ -54,7 +54,6 @@ #include "drv/mapuser.h" #include "timing.c" // timing module / IRIG-B functions -// int dacOF[ MAX_DAC_MODULES ]; #include "drv/inputFilterModule.h" #include "drv/inputFilterModule1.h" #include <drv/app_dac_functions.c> diff --git a/src/fe/controllerIopUser.c b/src/fe/controllerIopUser.c index 48f5fe8832a57ecbc58b43bb69d33247c0ffa37a..fe5c6c18d8e3dff836871e0379c809c3c72b550a 100644 --- a/src/fe/controllerIopUser.c +++ b/src/fe/controllerIopUser.c @@ -55,6 +55,7 @@ #include "drv/inputFilterModule.h" #include "drv/inputFilterModule1.h" +#include <drv/dac_info.c> #ifdef DOLPHIN_TEST #include "dolphin.c" @@ -168,14 +169,13 @@ fe_start_iop_user( ) cpuClock[ CPU_TIMER_CNT ]; /// @param cpuClock[] Code timing diag /// variables static int chanHop = 0; /// @param chanHop Adc channel hopping status - int dacOF[ MAX_DAC_MODULES ]; int adcData[ MAX_ADC_MODULES ] [ MAX_ADC_CHN_PER_MOD ]; /// @param adcData[][] ADC raw data int adcChanErr[ MAX_ADC_MODULES ]; // int adcWait = 0; adcInfo_t adcInfo; - dacInfo_t dacInfo; + dacInfo_t dacinfo; int adcOF[ MAX_ADC_MODULES ]; /// @param adcOF[] ADC overrange counters static int dacWriteEnable = @@ -291,7 +291,7 @@ fe_start_iop_user( ) { dacOut[ ii ][ jj ] = 0.0; dacOutUsed[ ii ][ jj ] = 0; - dacInfo.dacOutBufSize[ ii ] = 0; + dacinfo.dacOutBufSize[ ii ] = 0; // Zero out DAC channel map in the shared memory // to be used to check on control models' channel allocation ioMemData->dacOutUsed[ ii ][ jj ] = 0; @@ -665,10 +665,10 @@ fe_start_iop_user( ) /// errors if ( dac_out > limit || dac_out < -limit ) { - dacInfo.overflowDac[ jj ][ ii ]++; + dacinfo.overflowDac[ jj ][ ii ]++; pLocalEpics->epicsOutput.overflowDacAcc[ jj ][ ii ]++; overflowAcc++; - dacOF[ jj ] = 1; + dacinfo.dacOF[ jj ] = 1; odcStateWord |= ODC_DAC_OVF; ; if ( dac_out > limit ) @@ -681,7 +681,7 @@ fe_start_iop_user( ) dac_out = 0; /// - ---- Load last values to EPICS channels for monitoring on /// GDS_TP screen. - dacInfo.dacOutEpics[ jj ][ ii ] = dac_out; + dacinfo.dacOutEpics[ jj ][ ii ] = dac_out; /// - ---- Load DAC testpoints floatDacOut[ 16 * jj + ii ] = dac_out; @@ -696,15 +696,6 @@ fe_start_iop_user( ) /// again by Master ioMemData->iodata[ mm ][ ioMemCntrDac ].cycle = -1; /// - -- DMA Write data to DAC module -#if 0 - if(dacWriteEnable > 4) { - if(cdsPciModules.dacType[jj] == GSC_16AO16) { - gsc16ao16DmaStart(jj); - } else { - gsc18ao8DmaStart(jj); - } - } -#endif } /// \> Increment DAC memory block pointers for next cycle ioClockDac = ( ioClockDac + 1 ) % IOP_IO_RATE; @@ -883,7 +874,7 @@ fe_start_iop_user( ) for ( ii = 0; ii < MAX_DAC_CHN_PER_MOD; ii++ ) { pLocalEpics->epicsOutput.dacValue[ jj ][ ii ] = - dacInfo.dacOutEpics[ jj ][ ii ]; + dacinfo.dacOutEpics[ jj ][ ii ]; } } } @@ -944,39 +935,7 @@ fe_start_iop_user( ) printf( "Code is exiting ..............\n" ); continue; } - for ( jj = 0; jj < cdsPciModules.dacCount; jj++ ) - { - if ( dacOF[ jj ] ) - { - pLocalEpics->epicsOutput.statDac[ jj ] &= - ~( DAC_OVERFLOW_BIT ); - feStatus |= FE_ERROR_OVERFLOW; - ; - } - else - pLocalEpics->epicsOutput.statDac[ jj ] |= DAC_OVERFLOW_BIT; - dacOF[ jj ] = 0; - if ( dacChanErr[ jj ] ) - { - pLocalEpics->epicsOutput.statDac[ jj ] &= - ~( DAC_TIMING_BIT ); - } - else - pLocalEpics->epicsOutput.statDac[ jj ] |= DAC_TIMING_BIT; - dacChanErr[ jj ] = 0; - for ( ii = 0; ii < MAX_DAC_CHN_PER_MOD; ii++ ) - { - - if ( pLocalEpics->epicsOutput.overflowDacAcc[ jj ][ ii ] > - OVERFLOW_CNTR_LIMIT ) - { - pLocalEpics->epicsOutput.overflowDacAcc[ jj ][ ii ] = 0; - } - pLocalEpics->epicsOutput.overflowDac[ jj ][ ii ] = - dacInfo.overflowDac[ jj ][ ii ]; - dacInfo.overflowDac[ jj ][ ii ] = 0; - } - } + feStatus |= dac_status_update( &dacinfo ); } // ********************************************************************* // Capture end of cycle time. diff --git a/src/include/cds_types.h b/src/include/cds_types.h index ccc11785164a608d6d46896b28ef86f24ccca776..5286c6081bb5c06991dc2a6819e7413f43e8d4a2 100644 --- a/src/include/cds_types.h +++ b/src/include/cds_types.h @@ -25,6 +25,7 @@ typedef struct dacInfo_t [ MAX_DAC_CHN_PER_MOD ]; // DAC overflow diagnostics int dacOutBufSize[ MAX_DAC_MODULES ]; int dacOutEpics[ MAX_DAC_MODULES ][ MAX_DAC_CHN_PER_MOD ]; + int dacOF[ MAX_DAC_MODULES ]; } dacInfo_t; typedef struct duotone_diag_t diff --git a/src/include/drv/app_dac_functions.c b/src/include/drv/app_dac_functions.c index 11a7dbd83bb5cd78d58357324095c7d0aef8aa48..4dc415074608be068a7790d05a053290c0ec78ff 100644 --- a/src/include/drv/app_dac_functions.c +++ b/src/include/drv/app_dac_functions.c @@ -163,7 +163,7 @@ app_dac_write( int ioMemCtrDac, int ioClkDac, dacInfo_t* dacinfo ) dacinfo->overflowDac[ jj ][ ii ]++; pLocalEpics->epicsOutput.overflowDacAcc[ jj ][ ii ]++; overflowAcc++; - dacOF[ jj ] = 1; + dacinfo->dacOF[ jj ] = 1; odcStateWord |= ODC_DAC_OVF; ; if ( dac_out > limit ) diff --git a/src/include/drv/dac_info.c b/src/include/drv/dac_info.c index 5a8c5ca2633be9f7653b4e3a101d8e8a5d7a339c..d8ab39aeaa2e221a714fa7d831a3bbbcce2e8e46 100644 --- a/src/include/drv/dac_info.c +++ b/src/include/drv/dac_info.c @@ -8,7 +8,7 @@ dac_status_update( dacInfo_t* dacinfo ) for ( jj = 0; jj < cdsPciModules.dacCount; jj++ ) { - if ( dacOF[ jj ] ) + if ( dacinfo->dacOF[ jj ] ) { pLocalEpics->epicsOutput.statDac[ jj ] &= ~( DAC_OVERFLOW_BIT ); status |= FE_ERROR_OVERFLOW; @@ -16,7 +16,7 @@ dac_status_update( dacInfo_t* dacinfo ) } else pLocalEpics->epicsOutput.statDac[ jj ] |= DAC_OVERFLOW_BIT; - dacOF[ jj ] = 0; + dacinfo->dacOF[ jj ] = 0; if ( dacChanErr[ jj ] ) { pLocalEpics->epicsOutput.statDac[ jj ] &= ~( DAC_TIMING_BIT ); diff --git a/src/include/drv/iop_dac_functions.c b/src/include/drv/iop_dac_functions.c index 399118fe104429a9cacb64b8c536187434b5347e..2b046675c46da22ed3bb0f6a566048d782716ba8 100644 --- a/src/include/drv/iop_dac_functions.c +++ b/src/include/drv/iop_dac_functions.c @@ -217,7 +217,7 @@ iop_dac_write( int in_delay ) dacinfo.overflowDac[ card ][ chan ]++; pLocalEpics->epicsOutput.overflowDacAcc[ card ][ chan ]++; overflowAcc++; - dacOF[ card ] = 1; + dacinfo.dacOF[ card ] = 1; odcStateWord |= ODC_DAC_OVF; ; if ( dac_out > limit )