
* Library Functions


Also look at doc/tutorial

Some of these aren't implemented


** Level 1 - library stores information about kernel

comedi_t *comedi_open(char *filename)
void comedi_close(comedi_t *it)

	opens/closes a /dev/comediN file.  Builds a database of information
	about the open comedi device, which is used by other level 1 calls.

int comedi_get_maxdata(comedi_t *it,unsigned int subdevice,unsigned int chan)

	returns the maximum data value for a subdevice/channel combination

int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int chan)

	returns the range type value for a subdevice/channel combination


int comedi_islocked(comedi_t *it,unsigned int subdevice)

	not implemented

int comedi_isbusy(comedi_t *it,unsigned int subdevice)

	not implemented

int comedi_find_subdevice(comedi_t *it,unsigned int type)

	not implemented



** Level 0 - ioctl wrapper functions

	These functions are mainly internal library functions, but are
	useful enough to have available to user programs.

int comedi_get_devinfo(int,comedi_devinfo *)
int comedi_get_subdinfo(int,comedi_subdinfo *)
int comedi_get_chaninfo(int,unsigned int subdevice,sampl_t *maxdata_list,unsigned int *flaglist,unsigned int *rangelist)
int comedi_trig(int,comedi_trig *)
int comedi_lock(int,int subdevice)
int comedi_unlock(int,int subdevice)
int comedi_cancel(int,int subdevice)



** simple measurements and control


** slowly varying measurements


int comedi_sv_init(comedi_sv_t *it,comedi_t *dev,unsigned int subd,unsigned int chan)

	initializes a comedi_sv_t structure.

int comedi_sv_update(comedi_sv_t *it)

	If you change any values in the comedi_sv_t structure, call
	this to update any internal information.

int comedi_sv_measure(comedi_sv_t *it,double data)

	Call this to measure the channel.


** range information

The comedi_range structure looks like:

typedef struct{
        double min;
        double max;
        unsigned int unit;
}comedi_range;

which tells you the physical meaning of the min and max data
values (0 and maxdata).  unit is currently unused.  A range_type
is an integer that is used to communicate what types of ranges
are available on a particular board -- these really only have
meaning to the library.  For a given range_type, you can choose
a range from 0 to RANGE_LENGTH(range_type)-1, this will typically
coorespond to different input gains on your hardware.


comedi_range *comedi_get_range(unsigned int range_type, unsigned int range)

	returns a pointer to a comedi_range structure cooresponding to
	range_type and range.

double comedi_to_phys(sampl_t data,comedi_range *rng,sampl_t maxdata)

	converts (integer) data to physical units using information provided
	by rng and maxdata.

sampl_t comedi_from_phys(double data,comedi_range *rng,sampl_t maxdata)

	performs the reverse operation.



** timer functions


int comedi_get_timer(comedi_t *it,unsigned int subdevice, double freq, unsigned int
	*trigvar, double *actual_freq)

	call this function with it, subdevice, and your desired frequency, and the
	trigger value and actual frequency will be returned.

