From: Tim Ousley Date: Tue, 1 May 2001 21:53:59 +0000 (+0000) Subject: GPCTR compiles by default, #defined insn to get internal gpctr timebase X-Git-Tag: r0_7_59~84 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7c9fbe21c280a243fd4e01fdaca31bc43b0aa3ac;p=comedi.git GPCTR compiles by default, #defined insn to get internal gpctr timebase --- diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index b0d3a575..c341ab56 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -210,11 +210,18 @@ static int ni_gpct_insn_read(comedi_device *dev,comedi_subdevice *s, static void pfi_setup(comedi_device *dev); -/*GPCTR function def's...incomplete right now.*/ +/*GPCTR function def's*/ int GPCTR_G_Watch(comedi_device *dev, int chan); -int GPCTR_Begin_Event_Counting(comedi_device *dev,int chan, int value); void GPCTR_Reset(comedi_device *dev, int chan); +void GPCTR_Gen_Cont_Pulse(comedi_device *dev, int chan, unsigned int length); +void GPCTR_Gen_Single_Pulse(comedi_device *dev, int chan, unsigned int length); +void GPCTR_Period_Meas(comedi_device *dev, int chan); +void GPCTR_Pulse_Width_Meas(comedi_device *dev, int chan); +void GPCTR_Event_Counting(comedi_device *dev,int chan); +int GPCTR_Set_Direction(comedi_device *dev,int chan,int direction); +int GPCTR_Set_Gate(comedi_device *dev,int chan ,int gate); +int GPCTR_Set_Source(comedi_device *dev,int chan ,int source); static int ni_gpctr_insn_write(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); @@ -1891,7 +1898,7 @@ static int ni_E_init(comedi_device *dev,comedi_devconfig *it) s->maxdata=1; gpct_setup(dev,s); - #ifdef GPCTR + //TIM 5/1/01 #ifdef GPCTR s=dev->subdevices+4; s->type=COMEDI_SUBD_COUNTER; s->subdev_flags=SDF_READABLE|SDF_WRITEABLE; @@ -1902,7 +1909,7 @@ static int ni_E_init(comedi_device *dev,comedi_devconfig *it) s->maxdata=1; GPCTR_Reset(dev,0); GPCTR_Reset(dev,1); - #endif //GPCTR + //TIM 5/1/01 #endif //GPCTR /* calibration subdevice -- ai and ao */ s=dev->subdevices+5; @@ -2434,7 +2441,7 @@ static int gpct_sp(comedi_device *dev,comedi_param *it) #endif //make -DGPCTR is best way to include this. -#ifdef GPCTR +//TIM 5/1/01 #ifdef GPCTR /* * Low level stuff...Each STC counter has two 24 bit load registers (A&B). Just make * it easier to access them. @@ -2524,6 +2531,7 @@ int GPCTR_Arm(comedi_device *dev, int chan){ } return 0; } + int GPCTR_Set_Source(comedi_device *dev,int chan ,int source){ //printk("GPCTR_Set_Source..."); devpriv->gpctr_input_select[chan] &= ~G_Source_Select(0x1f);//reset gate to 0 @@ -2543,6 +2551,7 @@ int GPCTR_Set_Source(comedi_device *dev,int chan ,int source){ //printk("exit GPCTR_Set_Source\n"); return 0; } + int GPCTR_Set_Gate(comedi_device *dev,int chan ,int gate){ //printk("GPCTR_Set_Gate..."); devpriv->gpctr_input_select[chan] &= ~G_Gate_Select(0x1f);//reset gate to 0 @@ -2567,7 +2576,6 @@ int GPCTR_Set_Gate(comedi_device *dev,int chan ,int gate){ return 0; } - int GPCTR_Set_Direction(comedi_device *dev,int chan,int direction) { //printk("GPCTR_Set_Direction..."); @@ -2890,6 +2898,14 @@ static int ni_gpctr_insn_config(comedi_device *dev,comedi_subdevice *s, if(insn->n!=2) return -EINVAL; retval=GPCTR_Set_Direction(dev,insn->chanspec,data[1]); break; + case GPCTR_GET_INT_CLK_FRQ: + if(insn->n!=2) return -EINVAL; + //There are actually 2 internal clocks on the STC, we always + //use the fast 20MHz one at this time. Tim Ousley 5/1/01 + //NOTE: This is not the final interface, ideally the user + //will never need to know the int. clk. freq. + data[1]=50;//50ns = 20MHz = internal timebase of STC + break; case GPCTR_SET_OPERATION: //TIM 5/1/01 if((insn->n<2)||(insn->n>3))return -EINVAL; switch(data[1]){ @@ -2965,6 +2981,7 @@ static int ni_gpctr_insn_write(comedi_device *dev,comedi_subdevice *s, return 1; } +/*TIM 5/1/01 //note: EXPORT_SYMTAB must have been defined for this to work. //this is mostly for testing inside the kernel EXPORT_SYMBOL(GPCTR_Load_Using_A); @@ -2975,9 +2992,9 @@ EXPORT_SYMBOL(GPCTR_Reset); EXPORT_SYMBOL(ni_gpctr_insn_config); EXPORT_SYMBOL(ni_gpctr_insn_read); EXPORT_SYMBOL(ni_gpctr_insn_write); +*/ - -#endif +//TIM 5/1/01 #endif static int ni_8255_callback(int dir,int port,int data,void *arg) diff --git a/comedi/drivers/ni_pcimio.c b/comedi/drivers/ni_pcimio.c index 0648ddea..6de1defa 100644 --- a/comedi/drivers/ni_pcimio.c +++ b/comedi/drivers/ni_pcimio.c @@ -63,14 +63,6 @@ */ -//TIM 4/13/01. I need to export the GPCTR functions to test them -//before I build an API. This should be a temporary fix, since -//I just need a way to test the functions w/o choosing an API -//...Tim Ousley -#ifdef GPCTR -#define EXPORT_SYMTAB -#endif - #include #include #include diff --git a/include/linux/comedi.h b/include/linux/comedi.h index 6bc308b3..775bb220 100644 --- a/include/linux/comedi.h +++ b/include/linux/comedi.h @@ -70,6 +70,7 @@ typedef unsigned short sampl_t; #define GPCTR_SET_OPERATION 0x0010 #define GPCTR_ARM 0x0020 #define GPCTR_DISARM 0x0040 +#define GPCTR_GET_INT_CLK_FRQ 0x0080 #define GPCTR_INT_CLOCK 0x0001 #define GPCTR_EXT_PIN 0x0002