Skip to content
Snippets Groups Projects
Commit e35234af authored by Erik von Reis's avatar Erik von Reis
Browse files

Works with 16 bit ADC in 1PPS mode

parent bbdd03c1
No related branches found
No related tags found
1 merge request!653Adding sync code, to re-sync ADCs on startup.
......@@ -662,6 +662,8 @@ void fe_start_controller( void )
int duotone_full_cycle_offset = duotone_offset;
#endif //UNDERSAMPLE > 4
/// prime the ADC read module to setup time_shift
iop_adc_setup_timeshift();
// Run forever
......
......@@ -41,7 +41,7 @@ static int first_adc_read = 0;
/// After the ADCs are initialized, but before the first sample is read
/// Start the time_shift process
void
iop_adc_setup_timeshift() {
iop_adc_setup_timeshift(void) {
first_adc_read = 2;
}
......@@ -49,18 +49,20 @@ iop_adc_setup_timeshift() {
int
iop_adc_timeshift_dma_size(int adc)
{
switch ( cdsPciModules.adcType[ jj ] )
int dma_bytes = 0;
int samples=0;
switch ( cdsPciModules.adcType[ adc ] )
{
case GSC_18AI32SSC1M:
case GSC_18AI64SSC:
if(cdsPciModules.adcTimeShift[ jj ] < UNDERSAMPLE)
if(cdsPciModules.adcTimeShift[ adc ] < UNDERSAMPLE)
{
samples = cdsPciModules.adcChannels[ jj ]
* (UNDERSAMPLE-cdsPciModules.adcTimeShift[jj]);
samples = cdsPciModules.adcChannels[ adc ]
* (UNDERSAMPLE-cdsPciModules.adcTimeShift[adc]);
}
else
{
samples = cdsPciModules.adcChannels[ jj ] * UNDERSAMPLE;
samples = cdsPciModules.adcChannels[ adc ] * UNDERSAMPLE;
}
dma_bytes = samples * 4;
break;
......@@ -549,6 +551,7 @@ iop_adc_read( adcInfo_t* adcinfo, uint64_t cpuClock[] )
}
if (first_adc_read > 0) {
first_adc_read -= 1;
RTSLOG_INFO("first adc read = %d", first_adc_read);
}
return 0;
}
......
......@@ -10,6 +10,9 @@ extern "C" {
int iop_adc_init( adcInfo_t* );
int iop_adc_read( adcInfo_t*, unsigned long long[] );
int iop_adc_sync_cards( adcInfo_t* adcinfo );
void iop_adc_setup_timeshift(void);
int iop_adc_timeshift_dma_size(int adc);
#ifdef __cplusplus
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment