added comedi_dio_get_config()
This commit is contained in:
parent
1e601cbd3f
commit
2a720182e4
4 changed files with 51 additions and 0 deletions
16
doc/funcref
16
doc/funcref
|
@ -576,6 +576,22 @@ Description:
|
|||
|
||||
If sucessful, 1 is returned, otherwise -1.
|
||||
|
||||
Function: comedi_dio_get_config -- query input/output properties of channel
|
||||
Retval: int
|
||||
Param: comedi_t * device
|
||||
Param: unsigned int subdevice
|
||||
Param: unsigned int channel
|
||||
Param: unsigned int * direction
|
||||
Description:
|
||||
The function comedi_dio_get_config() querys the configuration of
|
||||
an individual channel
|
||||
in a digital I/O subdevice (see comedi_dio_config()).
|
||||
On success, the variable specified by the "direction" pointer will
|
||||
be set to either COMEDI_INPUT or COMEDI_OUTPUT.
|
||||
|
||||
If sucessful, 0 is returned, otherwise -1.
|
||||
|
||||
|
||||
Function: comedi_dio_read -- read single bit from digital channel
|
||||
Retval: int
|
||||
Param: comedi_t * device
|
||||
|
|
|
@ -141,6 +141,8 @@ int comedi_data_write(comedi_t *it,unsigned int subd,unsigned int chan,
|
|||
unsigned int range,unsigned int aref,lsampl_t data);
|
||||
int comedi_dio_config(comedi_t *it,unsigned int subd,unsigned int chan,
|
||||
unsigned int dir);
|
||||
int comedi_dio_get_config(comedi_t *it,unsigned int subd,unsigned int chan,
|
||||
unsigned int *dir);
|
||||
int comedi_dio_read(comedi_t *it,unsigned int subd,unsigned int chan,
|
||||
unsigned int *bit);
|
||||
int comedi_dio_write(comedi_t *it,unsigned int subd,unsigned int chan,
|
||||
|
|
32
lib/dio.c
32
lib/dio.c
|
@ -79,6 +79,38 @@ int _comedi_dio_config(comedi_t *it,unsigned int subdev,unsigned int chan,unsign
|
|||
}
|
||||
}
|
||||
|
||||
EXPORT_ALIAS_DEFAULT(_comedi_dio_get_config, comedi_dio_get_config, 0.7.23);
|
||||
int _comedi_dio_get_config(comedi_t *it,unsigned int subdev, unsigned int chan, unsigned int *io)
|
||||
{
|
||||
subdevice *s;
|
||||
comedi_insn insn;
|
||||
lsampl_t data[2];
|
||||
int retval;
|
||||
|
||||
if(!valid_chan(it,subdev,chan))
|
||||
return -1;
|
||||
|
||||
s=it->subdevices+subdev;
|
||||
if(s->type!=COMEDI_SUBD_DIO)
|
||||
return -1;
|
||||
|
||||
if(it->has_insnlist_ioctl == 0)
|
||||
return -1;
|
||||
|
||||
memset(&insn,0,sizeof(insn));
|
||||
insn.insn = INSN_CONFIG;
|
||||
insn.n = sizeof(data) / sizeof(data[0]);
|
||||
insn.data = data;
|
||||
insn.subdev = subdev;
|
||||
insn.chanspec = CR_PACK(chan,0,0);
|
||||
data[0] = INSN_CONFIG_DIO_QUERY;
|
||||
|
||||
retval = comedi_do_insn(it,&insn);
|
||||
if(retval < 0) return retval;
|
||||
*io = data[1];
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_ALIAS_DEFAULT(_comedi_dio_read,comedi_dio_read,0.7.18);
|
||||
int _comedi_dio_read(comedi_t *it,unsigned int subdev,unsigned int chan,
|
||||
unsigned int *val)
|
||||
|
|
|
@ -83,5 +83,6 @@ v0.7.20 {
|
|||
|
||||
v0.7.23 {
|
||||
global:
|
||||
comedi_dio_get_config;
|
||||
comedi_mark_buffer_written;
|
||||
} v0.7.20;
|
||||
|
|
Loading…
Add table
Reference in a new issue