added some error messages, and update status of pcidas-1000
authorFrank Mori Hess <fmhess@speakeasy.net>
Mon, 2 Aug 2004 00:10:47 +0000 (00:10 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Mon, 2 Aug 2004 00:10:47 +0000 (00:10 +0000)
comedi_calibrate/cb.c
comedi_calibrate/cb64.c

index 2281fc988c6e38898f01c860269ab14ec2cb8aa8..25a3069804f00d3f9a7a0ca3e31c7ce10d3a78b1 100644 (file)
@@ -52,7 +52,7 @@ static int cal_cb_pci_1602_16( calibration_setup_t *setup );
 static int init_observables_1xxx( calibration_setup_t *setup );
 
 static struct board_struct boards[]={
-       { "pci-das1000",        STATUS_GUESS,   setup_cb_pci_1xxx },
+       { "pci-das1000",        STATUS_SOME,    setup_cb_pci_1xxx },
        { "pci-das1001",        STATUS_GUESS,   setup_cb_pci_1xxx },
        { "pci-das1002",        STATUS_GUESS,   setup_cb_pci_1xxx },
        { "pci-das1200",        STATUS_DONE,    setup_cb_pci_1xxx },
@@ -575,8 +575,8 @@ int cb_actual_source_voltage( comedi_t *dev, unsigned int subdevice, unsigned in
                *voltage = eeprom8_to_source( byte );
        }else
        {
-               fprintf( stderr, "%s: maxdata = 0x%x invalid\n",
-                       __FUNCTION__, max_data );
+               fprintf( stderr, "%s: maxdata = 0x%x invalid for subdevice %i, channel %i\n",
+                       __FUNCTION__, max_data, subdevice, eeprom_channel);
                return -1;
        }
 
index d65f05dd2418daec49c7b2d4654d4c844b080ba8..d24e67c07ca4949bd07991a666e7da5c065fc4f0 100644 (file)
@@ -233,8 +233,11 @@ static int source_eeprom_addr_64xx( calibration_setup_t *setup, unsigned int ran
        comedi_range *range;
 
        range = comedi_get_range( setup->dev, setup->ad_subdev, 0, range_index );
-       if( range == NULL ) return -1;
-
+       if( range == NULL ) 
+       {
+               fprintf(stderr, "%s: failed to get range\n", __FUNCTION__);     
+               return -1;
+       }
        if( range->max > 7.0 )
                return EEPROM_7V_CHAN;
        else if( range->max > 3.5 )
@@ -252,8 +255,11 @@ static int ai_low_cal_source_64xx( calibration_setup_t *setup, unsigned int rang
        comedi_range *range;
 
        range = comedi_get_range( setup->dev, setup->ad_subdev, 0, range_index );
-       if( range == NULL ) return -1;
-
+       if( range == NULL )
+       {
+               fprintf(stderr, "%s: failed to get range\n", __FUNCTION__);     
+               return -1;
+       }
        if( range->min > -0.001 )
                return CS_64XX_8600uV;
        else
@@ -265,8 +271,11 @@ static int ai_high_cal_source_64xx( calibration_setup_t *setup, unsigned int ran
        comedi_range *range;
 
        range = comedi_get_range( setup->dev, setup->ad_subdev, 0, range_index );
-       if( range == NULL ) return -1;
-
+       if( range == NULL )
+       {
+               fprintf(stderr, "%s: failed to get range\n", __FUNCTION__);     
+               return -1;
+       }
        if( range->max > 7.0 )
                return CS_64XX_7V;
        else if( range->max > 3.5 )
@@ -302,8 +311,11 @@ static int ao_set_high_target_64xx( calibration_setup_t *setup, unsigned int obs
        comedi_range *range;
 
        range = comedi_get_range( setup->dev, setup->da_subdev, 0, range_index );
-       if( range == NULL ) return -1;
-
+       if( range == NULL ) 
+       {
+               fprintf(stderr, "%s: failed to get range\n", __FUNCTION__);     
+               return -1;
+       }
        target = range->max * 0.9;
        set_target( setup, obs, target );
        return 0;
@@ -323,8 +335,11 @@ static int init_observables_64xx( calibration_setup_t *setup )
        tmpl.subdev = setup->ad_subdev;
 
        num_ai_ranges = comedi_get_n_ranges( setup->dev, setup->ad_subdev, 0 );
-       if( num_ai_ranges < 0 ) return -1;
-
+       if( num_ai_ranges < 0 )
+       {
+               fprintf(stderr, "%s: failed to get number of ai ranges\n", __FUNCTION__);
+               return -1;
+       }
        setup->n_observables = 0;
 
        for( range = 0; range < num_ai_ranges; range++ )
@@ -367,7 +382,11 @@ static int init_observables_64xx( calibration_setup_t *setup )
                po_tmpl.subdev = setup->da_subdev;
 
                num_ao_ranges = comedi_get_n_ranges( setup->dev, setup->da_subdev, 0 );
-               if( num_ao_ranges < 0 ) return -1;
+               if( num_ao_ranges < 0 )
+               {
+                       fprintf(stderr, "%s: failed to get number of ao ranges\n", __FUNCTION__);
+                       return -1;
+               }
 
                for( range = 0; range < num_ao_ranges; range++ )
                {
@@ -492,8 +511,11 @@ static int high_ai_cal_src_60xx( calibration_setup_t *setup, unsigned int ai_ran
        comedi_range *range;
 
        range = comedi_get_range( setup->dev, setup->ad_subdev, 0, ai_range );
-       if( range == NULL ) return -1;
-
+       if( range == NULL ) 
+       {
+               fprintf(stderr, "%s: failed to get range\n", __FUNCTION__);     
+               return -1;
+       }
        if( range->max > 9.999 )
                return CS_60XX_10V;
        else if( range->max > 4.999 )
@@ -541,10 +563,14 @@ static int init_observables_60xx( calibration_setup_t *setup )
        setup->n_observables = 0;
 
        num_ranges = comedi_get_n_ranges( setup->dev, setup->ad_subdev, 0 );
-       if( num_ranges < 0 ) return -1;
-
+       if( num_ranges < 0 ) 
+       {
+               fprintf(stderr, "%s: failed to get number of ai ranges\n", __FUNCTION__);
+               return -1;
+       }
        for( i = 0; i < num_ranges; i++ )
        {
+fprintf(stderr, "setting up ai observables for range %i out of %i\n", i, num_ranges);
                o = setup->observables + ai_ground_observable_index_60xx( setup, 0, i );
                o->reference_source = CAL_SRC_GROUND;
                assert( o->name == NULL );
@@ -580,7 +606,11 @@ static int init_observables_60xx( calibration_setup_t *setup )
                po_tmpl.subdev = setup->da_subdev;
 
                num_ranges = comedi_get_n_ranges( setup->dev, setup->da_subdev, 0 );
-               if( num_ranges < 0 ) return -1;
+               if( num_ranges < 0 ) 
+               {
+                       fprintf(stderr, "%s: failed to get number of ao ranges\n", __FUNCTION__);
+                       return -1;
+               }
 
                for( i = 0; i < num_ranges; i++ )
                {
@@ -635,8 +665,11 @@ static int high_ai_cal_src_4020( calibration_setup_t *setup, unsigned int ai_ran
        comedi_range *range;
 
        range = comedi_get_range( setup->dev, setup->ad_subdev, 0, ai_range );
-       if( range == NULL ) return -1;
-
+       if( range == NULL ) 
+       {
+               fprintf(stderr, "%s: failed to get range\n", __FUNCTION__);     
+               return -1;
+       }
        if( range->max > 4.4  )
                return CS_4020_4375mV;
        else if( range->max > 0.7 )
@@ -655,8 +688,11 @@ static int source_eeprom_addr_4020( calibration_setup_t *setup, unsigned int ran
        comedi_range *range;
 
        range = comedi_get_range( setup->dev, setup->ad_subdev, 0, range_index );
-       if( range == NULL ) return -1;
-
+       if( range == NULL ) 
+       {
+               fprintf(stderr, "%s: failed to get range\n", __FUNCTION__);     
+               return -1;
+       }
        if( range->max > 4.4 )
                return EEPROM_4375mV_CHAN;
        else if( range->max > 0.7 )
@@ -679,10 +715,18 @@ static int init_observables_4020( calibration_setup_t *setup )
        tmpl.subdev = setup->ad_subdev;
 
        num_ranges = comedi_get_n_ranges( setup->dev, setup->ad_subdev, 0 );
-       if( num_ranges < 0 ) return -1;
+       if( num_ranges < 0 )
+       {
+               fprintf(stderr, "%s: failed to get number of ai ranges\n", __FUNCTION__);
+               return -1;
+       }
 
        num_channels = comedi_get_n_channels( setup->dev, setup->ad_subdev );
-       if( num_channels < 0 ) return -1;
+       if( num_channels < 0 ) 
+       {
+               fprintf(stderr, "%s: failed to get number of ai channels\n", __FUNCTION__);
+               return -1;
+       }
 
        setup->n_observables = 0;