doc/dio_funcref.txt: Some DocBook mark-up changes.
[comedilib.git] / doc / dio_funcref.txt
1 Digital I/O
2 Function: comedi_dio_bitfield2 -- read/write multiple digital channels
3 Retval: int
4 Param: comedi_t * device
5 Param: unsigned int subdevice
6 Param: unsigned int write_mask
7 Param: unsigned int * bits
8 Param: unsigned int base_channel
9 Description:
10  The function <function>comedi_dio_bitfield2</function>
11  allows multiple channels to
12  be read or written together on a digital input, output,
13  or configurable digital I/O device.
14  The parameter <parameter class="function">write_mask</parameter>
15  and the value pointed to by <parameter class="function">bits</parameter>
16  are interpreted as bit fields, with the least significant bit
17  representing channel <parameter class="function">base_channel</parameter>.
18  For each bit in <parameter class="function">write_mask</parameter> that is
19  set to 1, the corresponding bit in
20  <code language="C">*<parameter class="function">bits</parameter></code>
21  is written to the digital
22  output channel.  After writing all the output channels, each
23  channel is read, and the result placed in the approprate bits in
24  <code language="C">*<parameter class="function">bits</parameter></code>.
25  The result of reading an output channel is the last value written to the
26  output channel.
27
28  All the channels might not be read or written at the exact same time.
29  For example, the driver may need to sequentially write to
30  several registers in order to set all the digital channels specified
31  by the <parameter class="function">write_mask</parameter>
32  and <parameter class="function">base_channel</parameter> parameters.
33 Returns:
34  If successful, <literal>0</literal> is returned, otherwise
35  <literal>-1</literal>.
36
37 Function: comedi_dio_config -- change input/output properties of channel
38 Retval: int
39 Param: comedi_t * device
40 Param: unsigned int subdevice
41 Param: unsigned int channel
42 Param: unsigned int direction
43 Description:
44  The function <function>comedi_dio_config</function> configures individual channels
45  in a digital I/O subdevice to be either input or output, depending
46  on the value of <parameter class="function">direction</parameter>.  Valid directions are
47  <constant>COMEDI_INPUT</constant> or <constant>COMEDI_OUTPUT</constant>.
48
49  Depending on the characteristics of the hardware device, multiple
50  channels might be grouped together in hardware when
51  configuring the input/output direction.  In this
52  case, a single call to <function>comedi_dio_config</function>
53  for any channel in the group will affect the entire group.
54 Returns:
55  If successful, <literal>0</literal> is returned, otherwise
56  <literal>-1</literal>.
57
58 Function: comedi_dio_get_config -- query input/output properties of channel
59 Retval: int
60 Param: comedi_t * device
61 Param: unsigned int subdevice
62 Param: unsigned int channel
63 Param: unsigned int * direction
64 Description:
65  The function <function>comedi_dio_get_config</function> queries the input/output configuration of
66  an individual channel
67  in a digital I/O subdevice (see
68  <function><link linkend="func-ref-comedi-dio-config">comedi_dio_config</link></function>).
69  On success, <code language="C">*<parameter
70  class="function">direction</parameter></code> will
71  be set to either <constant>COMEDI_INPUT</constant> or
72  <constant>COMEDI_OUTPUT</constant>.
73 Returns:
74  If successful, <literal>0</literal> is returned, otherwise
75  <literal>-1</literal>.
76
77 Function: comedi_dio_read -- read single bit from digital channel
78 Retval: int
79 Param: comedi_t * device
80 Param: unsigned int subdevice
81 Param: unsigned int channel
82 Param: unsigned int * bit
83 Description:
84  The function <function>comedi_dio_read</function> reads the channel
85  <parameter class="function">channel</parameter>
86  belonging to the
87  subdevice <parameter class="functioN">subdevice</parameter> of device
88  <parameter class="function">device</parameter>.
89  The data value that is
90  read is stored in the
91  <code language="C">*<parameter class="function">bit</parameter></code>.
92  This function is equivalent to:
93  <programlisting>
94  <link linkend="func-ref-comedi-data-read">comedi_data_read</link>(device, subdevice, channel, 0, 0, bit);
95  </programlisting>
96  This function does not require a digital subdevice or a subdevice
97  with a maximum data value of 1 to work properly.
98
99  If you wish to read multiple digital channels at once, it is more efficient to
100  use
101  <function><link
102  linkend="func-ref-comedi-dio-bitfield2">comedi_dio_bitfield2</link></function>
103  than to call this function multiple times.
104 Returns:
105  Return values and errors are the same as
106  <function><link linkend="func-ref-comedi-data-read">comedi_data_read</link></function>.
107
108 Function: comedi_dio_write -- write single bit to digital channel
109 Retval: int
110 Param: comedi_t * device
111 Param: unsigned int subdevice
112 Param: unsigned int channel
113 Param: unsigned int bit
114 Description:
115  The function writes the value <parameter class="function">bit</parameter> to the channel
116  <parameter class="function">channel</parameter> belonging
117  to the subdevice <parameter class="function">subdevice</parameter> of device
118  <parameter class="function">device</parameter>.  This function
119  is equivalent to:
120  <programlisting>
121  <link linkend="func-ref-comedi-data-write">comedi_data_write</link>(device, subdevice, channel, 0, 0, bit);
122  </programlisting>
123  This function does not require a digital subdevice or a subdevice
124  with a maximum data value of 1 to work properly.
125
126  If you wish to write multiple digital channels at once, it is more efficient to
127  use
128  <function><link
129  linkend="func-ref-comedi-dio-bitfield2">comedi_dio_bitfield2</link></function>
130  than to call this function multiple times.
131 Returns:
132  Return values and errors are the same as
133  <function><link linkend="func-ref-comedi-data-write">comedi_data_write</link></function>.