1 Function: comedi_cancel -- stop streaming input/output in progress
3 Param: comedi_t * device
4 Param: unsigned int subdevice
6 The function comedi_cancel() can be used to stop a Comedi command
7 previously started by comedi_command() that is still in progress
8 on the subdevice indicated by the parameters device and subdevice.
9 This may not return the subdevice to a ready state, since there may
10 be samples in the buffer that need to be read.
12 If successful, 0 is returned, otherwise -1.
14 Function: comedi_command -- start streaming input/output
16 Param: comedi_t * device
17 Param: comedi_cmd * command
19 The function comedi_command() starts streaming input or output. The
20 command structure pointed to by the parameter command specifies the
21 acquisition. The command must be able to pass comedi_command_test()
22 with a return value of 0, or comedi_command() will fail.
23 For input subdevices, sample values are read using the
24 function read(). For output subdevices, sample values are written
25 using the function write().
27 If successful, 0 is returned, otherwise -1.
29 Function: comedi_command_test -- test streaming input/output configuration
31 Param: comedi_t * device
32 Param: comedi_cmd * command
34 The function comedi_command_test() tests the command structure pointed
35 to by the parameter command and returns an integer describing the
36 testing stages that were successfully passed. In addition, if elements
37 of the command structure are invalid, they may be modified. Source
38 elements are modified to remove invalid source triggers. Argument
39 elements are adjusted or rounded to the nearest valid value.
41 The meanings of the return value are as follows.
43 0 indicates a valid command.
45 1 indicates that one of the *_src
46 members of the command contained an
47 unsupported trigger. The bits corresponding to the unsupported
50 2 indicates that the particular combination
51 of *_src settings is not supported by the driver, or that
52 one of the *_src members has the bit corresponding to
53 multiple trigger sources set at the same time.
55 3 indicates that one of the *_arg members
56 of the command is set outside the range of allowable values.
57 For instance, an argument for a TRIG_TIMER source which
58 exceeds the board's maximum speed. The invalid *_arg
59 members will be adjusted to valid values.
61 4 indicates that one of the *_arg members
62 required adjustment. For instance, the argument of a
63 TRIG_TIMER source may have been rounded to the nearest
64 timing period supported by the board.
66 5 indicates that some aspect of the
67 command's chanlist is unsupported by the board. For example,
68 some board's require that all channels in the chanlist
71 Function: comedi_get_buffer_contents -- streaming buffer status
73 Param: comedi_t * device
74 Param: unsigned int subdevice
76 The function comedi_get_buffer_contents() is used on a subdevice
77 that has a Comedi command in progress. The number of bytes that
78 are available in the streaming buffer is returned. If there is
79 an error, -1 is returned.
81 Function: comedi_get_buffer_offset -- streaming buffer status
83 Param: comedi_t * device
84 Param: unsigned int subdevice
86 The function comedi_get_buffer_offset() is used on a subdevice
87 that has a Comedi command in progress. This function returns
88 the offset in bytes of the read pointer in the streaming buffer.
89 This offset is only useful for memory mapped buffers.
90 If there is an error, -1 is returned.
92 Function: comedi_get_buffer_size -- streaming buffer size of subdevice
94 Param: comedi_t * device
95 Param: unsigned int subdevice
97 The function comedi_get_buffer_size() returns the size (in bytes)
98 of the streaming buffer for the subdevice specified by device and
99 subdevice. On error, -1 is returned.
101 Function: comedi_get_cmd_generic_timed -- streaming input/output capabilities
103 Param: comedi_t * device
104 Param: unsigned int subdevice
105 Param: comedi_cmd * command
106 Param: unsigned int chanlist_len
107 Param: unsigned int scan_period_ns
109 The command capabilities of the subdevice indicated by the parameters
110 device and subdevice are probed, and the results placed in the
111 command structure pointed to by the parameter command. The command
112 structure pointed to by the parameter command is modified to be a
113 valid command that can be used as a parameter to comedi_command()
114 (after the command has been assigned a valid chanlist array).
115 The command measures scans consisting of chanlist_len channels
116 at a scan rate that corresponds to the
117 period scan_period_ns. The rate is adjusted to a rate that the device
118 can handle. If successful, 0 is returned, otherwise -1.
120 Function: comedi_get_cmd_src_mask -- streaming input/output capabilities
122 Param: comedi_t * device
123 Param: unsigned int subdevice
124 Param: comedi_cmd * command
126 The command capabilities of the subdevice indicated by the parameters
127 device and subdevice are probed, and the results placed in the
128 command structure pointed to by the parameter command. The trigger
129 source elements of the command structure are set to the logical OR
130 value of possible trigger sources. Other elements in the structure
131 are undefined. If successful, 0 is returned, otherwise -1.
133 Function: comedi_get_max_buffer_size -- maximum streaming buffer size
135 Param: comedi_t * device
136 Param: unsigned int subdevice
138 The function comedi_get_max_buffer_size() returns the maximum
139 allowable size (in bytes) of the streaming buffer for the subdevice
140 specified by device and subdevice. Changing the maximum buffer
141 size requires appropriate privileges. On error, -1 is returned.
143 Function: comedi_get_read_subdevice -- find streaming input subdevice
145 Param: comedi_t * device
147 The function comedi_get_read_subdevice() returns the subdevice
148 that allows streaming input for device dev. If no subdevice
149 supports streaming input, -1 is returned and the Comedilib error
150 number is set to XXX "subdevice not found".
152 Function: comedi_get_write_subdevice -- find streaming output subdevice
154 Param: comedi_t * device
156 The function comedi_get_write_subdevice() returns the subdevice
157 that allows streaming output for device dev. If no subdevice
158 supports streaming output, -1 is returned and the Comedilib error
159 number is set to XXX "subdevice not found".
161 Function: comedi_mark_buffer_read -- streaming buffer control
163 Param: comedi_t * device
164 Param: unsigned int subdevice
165 Param: unsigned int num_bytes
167 The function comedi_mark_buffer_read() is used on a subdevice
168 that has a Comedi input command in progress. It should only be used
169 if you are using a mmap() (as opposed
170 to calling read() on the device file) to read data from Comedi's buffer,
171 since Comedi will automatically keep track of how many bytes have been
172 transferred via read() calls. This function is
173 used to indicate that the next num_bytes bytes in the buffer
174 are no longer needed and may be discarded.
176 A return value ret greater than 0 indicates that the read offset in
177 the streaming buffer, as returned by comedi_get_buffer_offset, has been
178 incremented by ret bytes. If there is an error, -1 is returned.
180 Function: comedi_mark_buffer_written -- streaming buffer control
182 Param: comedi_t * device
183 Param: unsigned int subdevice
184 Param: unsigned int num_bytes
186 The function comedi_mark_buffer_written() is used on a subdevice
187 that has a Comedi output command in progress. It should only be used
188 if you are using a mmap() (as opposed to calling write() on the device
189 file) to write data to Comedi's buffer, since Comedi
190 will automatically keep track of how many bytes have been
191 transferred via write() calls. This function is
192 used to indicate that the next num_bytes bytes in the buffer
193 are valid and may be sent to the device.
194 If there is an error, -1 is returned.
196 Function: comedi_poll -- force updating of streaming buffer
198 Param: comedi_t * device
199 Param: unsigned int subdevice
201 The function comedi_poll() is used on a subdevice that has a
202 Comedi command in progress in order to update the streaming buffer.
203 If supported by the driver, all available samples are copied to
204 the streaming buffer. These samples may be pending in DMA buffers
205 or device FIFOs. If successful, the number of additional bytes
206 available is returned. If there is an error, -1 is returned.
208 Function: comedi_set_buffer_size -- streaming buffer size of subdevice
210 Param: comedi_t * device
211 Param: unsigned int subdevice
212 Param: unsigned int size
214 The function comedi_set_buffer_size() changes the size of the
215 streaming buffer for the subdevice specified by device and subdevice.
216 The parameter size must be a multiple of the virtual memory page
219 The virtual memory page size can be determined using
220 sysconf(_SC_PAGE_SIZE).
222 Function: comedi_set_max_buffer_size -- streaming buffer size of subdevice
224 Param: comedi_t * device
225 Param: unsigned int subdevice
226 Param: unsigned int max_size
228 The function comedi_set_max_buffer_size() changes the maximum
229 allowable size (in bytes) of the streaming buffer for the subdevice
230 specified by device and subdevice. Changing the maximum buffer
231 size requires appropriate privileges. If successful, the old buffer
232 size is returned. On error, -1 is returned.