~ubuntu-branches/ubuntu/feisty/comedilib/feisty

« back to all changes in this revision

Viewing changes to doc/funcref

  • Committer: Bazaar Package Importer
  • Author(s): David Schleef
  • Date: 2003-09-23 18:11:12 UTC
  • Revision ID: james.westby@ubuntu.com-20030923181112-sat05jyh702rb1at
Tags: upstream-0.7.21
ImportĀ upstreamĀ versionĀ 0.7.21

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Function: comedi_close -- close a Comedi device
 
2
Retval: int
 
3
Param: comedi * device
 
4
Description:
 
5
 Close a device previously opened by comedi_open().
 
6
Returns:
 
7
 If sucessful, comedi_close returns 0.  On failure, -1 is returned.
 
8
 
 
9
Function: comedi_open -- open a Comedi device
 
10
Retval: comedi_t *
 
11
Param: const char * filename
 
12
Description:
 
13
 Open a Comedi device specified by the file filename.
 
14
Returns:
 
15
 If sucessful, comedi_open returns a pointer to a valid comedi_t
 
16
 structure.  This structure is transparent; the pointer should not
 
17
 be dereferenced by the application.  NULL is returned on failure.
 
18
 
 
19
Function: comedi_loglevel -- change Comedilib logging properties
 
20
Retval: int
 
21
Param: int loglevel
 
22
Description:
 
23
 This function affects the output of debugging and error messages
 
24
 from Comedilib.  By increasing the loglevel, additional debugging
 
25
 information will be printed.  Error and debugging messages are
 
26
 printed to the stream stderr.
 
27
 
 
28
 The default loglevel can be set by using the environment variable
 
29
 COMEDI_LOGLEVEL.  The default loglevel is 1.
 
30
 
 
31
 In order to conserve resources, some debugging information is
 
32
 disabled by default when Comedilib is compiled.
 
33
 
 
34
 The meaning of the loglevels is as follows:
 
35
 
 
36
 COMEDI_LOGLEVEL=0  Comedilib prints nothing.
 
37
 
 
38
 COMEDI_LOGLEVEL=1  (default) Comedilib prints error messages when
 
39
 there is a self-consistency error (i.e., an internal bug.)
 
40
 
 
41
 COMEDI_LOGLEVEL=2  Comedilib prints an error message when an invalid
 
42
 parameter is passed.
 
43
 
 
44
 COMEDI_LOGLEVEL=3  Comedilib prints an error message whenever an
 
45
 error is generated in the Comedilib library or in the C library,
 
46
 when called by Comedilib.
 
47
 
 
48
 COMEDI_LOGLEVEL=4  Comedilib prints a lot of junk.
 
49
Returns:
 
50
 This function returns the previous loglevel.
 
51
 
 
52
Function: comedi_perror -- print a Comedilib error message
 
53
Retval: void
 
54
Param: const char * s
 
55
Description:
 
56
 When a Comedilib function fails, it usually returns -1 or
 
57
 NULL, depending on the return type.  An internal library
 
58
 variable stores an error number, which can be retrieved with
 
59
 comedi_errno().  This error number can be converted to a
 
60
 human-readable form by the functions comedi_perror()
 
61
 and comedi_strerror().
 
62
 
 
63
 These functions are intended to mimic the behavior of the
 
64
 standard C library functions perror(), strerror(), and errno.
 
65
 In particular, Comedilib functions sometimes return an error
 
66
 that is generated inside the C library; the comedi error
 
67
 message in this case is the same as the C library.
 
68
 
 
69
 The function comedi_perror() prints an error message to stderr.
 
70
 The error message consists of the argument string, a colon, a
 
71
 space, a description of the error condition, and a new line.
 
72
 
 
73
Function: comedi_strerror -- return string describing Comedilib error code
 
74
Retval: char *
 
75
Param: int errnum
 
76
Description:
 
77
 When a Comedilib function fails, it usually returns -1 or
 
78
 NULL, depending on the return type.  An internal library
 
79
 variable stores an error number, which can be retrieved with
 
80
 comedi_errno().  This error number can be converted to a
 
81
 human-readable form by the functions comedi_perror()
 
82
 and comedi_strerror().
 
83
 
 
84
 These functions are intended to mimic the behavior of the
 
85
 standard C library functions perror(), strerror(), and errno.
 
86
 In particular, Comedilib functions sometimes return an error
 
87
 that is generated inside the C library; the comedi error
 
88
 message in this case is the same as the C library.
 
89
 
 
90
 The function comedi_strerror() returns a pointer to a
 
91
 character string
 
92
 describing the Comedilib error errnum.  The persistence
 
93
 of the returned pointer is undefined, and should not be trusted
 
94
 after the next Comedilib call.  An unrecognized error number will
 
95
 return a pointer to the string "undefined error", or similar.
 
96
 
 
97
Function: comedi_errno -- number of last Comedilib error
 
98
Retval: int
 
99
Param: void
 
100
Description:
 
101
 When a Comedilib function fails, it usually returns -1 or
 
102
 NULL, depending on the return type.  An internal library
 
103
 variable stores an error number, which can be retrieved with
 
104
 comedi_errno().  This error number can be converted to a
 
105
 human-readable form by the functions comedi_perror()
 
106
 and comedi_strerror().
 
107
 
 
108
 These functions are intended to mimic the behavior of the
 
109
 standard C library functions perror(), strerror(), and errno.
 
110
 In particular, Comedilib functions sometimes return an error
 
111
 that is generated inside the C library; the comedi error
 
112
 message in this case is the same as the C library.
 
113
 
 
114
 The function comedi_errno() returns an integer describing
 
115
 the most recent comedilib error.  This integer may be used
 
116
 as the errnum parameter for comedi_strerror().
 
117
 
 
118
 Note that comedi_errno() is deliberately different than the
 
119
 variable errno.  This is to overcome difficulties in making
 
120
 errno thread-safe.
 
121
 
 
122
Function: comedi_fileno -- integer descriptor of Comedilib device
 
123
Retval: int
 
124
Param: comedi_t * device
 
125
Description:
 
126
 The function comedi_fileno returns the integer descriptor for
 
127
 the device dev.  This descriptor can then be used as the
 
128
 file descriptor parameter of read(), write(), etc.
 
129
 This function is intended to mimic the standard C library
 
130
 function fileno().  If dev is an invalid comedi_t
 
131
 pointer, the function returns -1 and sets the appropriate
 
132
 Comedilib error value.
 
133
 
 
134
Function: comedi_get_n_subdevices -- number of subdevices 
 
135
Retval: int
 
136
Param: comedi_t * device
 
137
Description:
 
138
 Returns the number of subdevices belonging to the Comedi
 
139
 device referenced by the parameter device.
 
140
 
 
141
Function: comedi_get_version_code -- Comedi version code
 
142
Retval: int
 
143
Param: comedi_t * device
 
144
Description:
 
145
 Returns the Comedi kernel module version code.  A valid Comedi
 
146
 device referenced by the parameter device is necessary to
 
147
 communicate with the kernel module.  On error, -1 is returned.
 
148
 
 
149
 The version code is encoded as a bitfield of three 8-bit
 
150
 numbers.  For example, 0x00073d is the version code for
 
151
 version 0.7.61.
 
152
 
 
153
 This function is of limited usefulness.  A typical
 
154
 mis-application of this function is to use it to determine
 
155
 if a certain feature is supported.  If the application needs
 
156
 to know of the existence of a particular feature, an existence
 
157
 test function should be written and put in the Comedilib source.
 
158
 
 
159
Function: comedi_get_driver_name -- Comedi driver name
 
160
Retval: char *
 
161
Param: comedi_t * device
 
162
Description:
 
163
 The function comedi_get_driver_name returns a pointer
 
164
 to a string containing the name of the driver being used by comedi
 
165
 for the comedi device represented by device.  This pointer is
 
166
 valid until the device is closed.  This function returns NULL
 
167
 if there is an error.
 
168
 
 
169
Function: comedi_get_board_name -- Comedi device name
 
170
Retval: char *
 
171
Param: comedi_t * device
 
172
Description:
 
173
 The function comedi_get_board_name returns a pointer
 
174
 to a string containing the name of the device.  This pointer is
 
175
 valid until the comedi descriptor it is closed.  This
 
176
 function returns NULL if there is an error.
 
177
 
 
178
Function: comedi_get_subdevice_type -- type of subdevice
 
179
Retval: int
 
180
Param: comedi_t * device
 
181
Param: unsigned int subdevice
 
182
Description:
 
183
 The function comedi_get_subdevice_type() returns an
 
184
 integer describing the type of subdevice that belongs to the comedi
 
185
 device device and has the index subdevice.  The
 
186
 function returns -1 if there is an error.
 
187
 
 
188
 XXX Subdevice type table
 
189
 
 
190
Function: comedi_find_subdevice_by_type -- search for subdevice type
 
191
Retval: int
 
192
Param: comedi_t * device
 
193
Param: int type
 
194
Param: unsigned int start_subdevice
 
195
Description:
 
196
 The function comedi_find_subdevice_by_type() tries to
 
197
 locate a subdevice belonging to comedi device device,
 
198
 having type type, starting with the subdevice
 
199
 start_subdevice.  If it finds a subdevice with the requested
 
200
 type, it returns its index.  If it does not locate the requested
 
201
 subdevice, it returns -1 and sets the Comedilib error number to
 
202
 XXX "subdevice not found".  If there is an error, the function
 
203
 returns -1 and sets the appropriate error.
 
204
 
 
205
Function: comedi_get_read_subdevice -- find streaming input subdevice
 
206
Retval: int
 
207
Param: comedi_t * device
 
208
Description:
 
209
 The function comedi_get_read_subdevice() returns the subdevice
 
210
 that allows streaming input for device dev.  If no subdevice
 
211
 supports streaming input, -1 is returned and the Comedilib error
 
212
 number is set to XXX "subdevice not found".
 
213
 
 
214
Function: comedi_get_write_subdevice -- find streaming output subdevice
 
215
Retval: int
 
216
Param: comedi_t * device
 
217
Description:
 
218
 The function comedi_get_write_subdevice() returns the subdevice
 
219
 that allows streaming output for device dev.  If no subdevice
 
220
 supports streaming output, -1 is returned and the Comedilib error
 
221
 number is set to XXX "subdevice not found".
 
222
 
 
223
Function: comedi_get_subdevice_flags -- properties of subdevice
 
224
Retval: int
 
225
Param: comedi_t * device
 
226
Param: unsigned int subdevice
 
227
Description:
 
228
 This function returns a bitfield describing the capabilities of
 
229
 the specified subdevice.  If there is an error, -1 is returned,
 
230
 and the Comedilib error value is set.
 
231
 
 
232
 XXX table.
 
233
 
 
234
Function: comedi_get_n_channels -- number of subdevice channels
 
235
Retval: int
 
236
Param: comedi_t * device
 
237
Param: unsigned int subdevice
 
238
Description:
 
239
 The function comedi_get_n_channels() returns the number
 
240
 of channels of the subdevice belonging to the comedi device device
 
241
 and having index subdevice.  This function returns -1 on error and
 
242
 the Comedilib error value is set.
 
243
 
 
244
Function: comedi_range_is_chan_specific -- range information depends on channel
 
245
Retval: int
 
246
Param: comedi_t * device
 
247
Param: unsigned int subdevice
 
248
Description:
 
249
 If each channel of the specified subdevice has different range
 
250
 information, this function returns 1.  Otherwise, this function
 
251
 returns 0.  On error, this function returns -1.
 
252
 
 
253
Function: comedi_maxdata_is_chan_specific -- maximum sample depends on channel
 
254
Retval: int
 
255
Param: comedi_t * device
 
256
Param: unsigned int subdevice
 
257
Description:
 
258
 If each channel of the specified subdevice has different maximum
 
259
 sample values, this function returns 1.  Otherwise, this function
 
260
 returns 0.  On error, this function returns -1.
 
261
 
 
262
Function: comedi_get_maxdata -- maximum sample of channel
 
263
Retval: lsampl_t
 
264
Param: comedi_t * device
 
265
Param: unsigned int subdevice
 
266
Param: unsigned int channel
 
267
Description:
 
268
 The function comedi_get_maxdata() returns the maximum
 
269
 valid data value for channel chan of subdevice
 
270
 subdevice belonging to the comedi device device
 
271
 This function returns 0 on error.
 
272
 
 
273
Function: comedi_get_n_ranges -- number of ranges of channel
 
274
Retval: int
 
275
Param: comedi_t * device
 
276
Param: unsigned int subdevice
 
277
Param: unsigned int channel
 
278
Description:
 
279
 The function comedi_get_n_ranges() returns the number
 
280
 of ranges of the channel chan belonging to the subdevice
 
281
 of the comedi device device.  This function returns -1 on error.
 
282
 
 
283
Function: comedi_get_range -- range information of channel
 
284
Retval: comedi_range *
 
285
Param: comedi_t * device
 
286
Param: unsigned int subdevice
 
287
Param: unsigned int channel
 
288
Param: unsigned int range
 
289
Description:
 
290
 The function comedi_get_range() returns a pointer to a
 
291
 comedi_range structure that contains information that can be used to
 
292
 convert sample values to or from physical units.  The pointer is valid
 
293
 until the Comedi device device is closed.  If there is an
 
294
 error, NULL is returned.
 
295
 
 
296
Function: comedi_find_range -- search for range
 
297
Retval: int
 
298
Param: comedi_t * device
 
299
Param: unsigned int subdevice
 
300
Param: unsigned int channel
 
301
Param: unsigned int unit
 
302
Param: double min
 
303
Param: double max
 
304
Description:
 
305
 The function comedi_find_range() tries to
 
306
 locate the optimal (smallest) range for the channel chan
 
307
 belonging to a subdevice of the comedi device device,
 
308
 that includes both min and max in units.
 
309
 If a matching range is found, the index of the matching range is
 
310
 returned.  If no matching range is available, the function returns
 
311
 -1.
 
312
 
 
313
Function: comedi_get_buffer_size -- streaming buffer size of subdevice
 
314
Retval: int
 
315
Param: comedi_t * device
 
316
Param: unsigned int subdevice
 
317
Description:
 
318
 The function comedi_get_buffer_size() returns the size (in bytes)
 
319
 of the streaming buffer for the subdevice specified by device and
 
320
 subdevice.  On error, -1 is returned.
 
321
 
 
322
Function: comedi_get_max_buffer_size -- maximum streaming buffer size
 
323
Retval: int
 
324
Param: comedi_t * device
 
325
Param: unsigned int subdevice
 
326
Description:
 
327
 The function comedi_get_max_buffer_size() returns the maximum
 
328
 allowable size (in bytes) of the streaming buffer for the subdevice
 
329
 specified by device and subdevice.  Changing the maximum buffer
 
330
 size requires appropriate privileges.  On error, -1 is returned.
 
331
 
 
332
Function: comedi_set_buffer_size -- streaming buffer size of subdevice
 
333
Retval: int
 
334
Param: comedi_t * device
 
335
Param: unsigned int subdevice
 
336
Param: unsigned int size
 
337
Description:
 
338
 The function comedi_set_buffer_size() changes the size of the
 
339
 streaming buffer for the subdevice specified by device and subdevice.
 
340
 The parameter size must be a multiple of the virtual memory page
 
341
 size.
 
342
 
 
343
 The virtual memory page size can be determined using
 
344
 sysconf(_SC_PAGE_SIZE).
 
345
 
 
346
Function: comedi_trigger -- perform streaming input/output (deprecated)
 
347
Retval: int
 
348
Param: comedi_t * device
 
349
Param: comedi_trig * trig
 
350
Status: deprecated
 
351
Description:
 
352
 The function comedi_trigger() instructs Comedi to
 
353
 perform the command specified by the trigger structure trig.
 
354
 The return value depends on
 
355
 the particular trig being issued.  If there is an
 
356
 error, -1 is returned.
 
357
 
 
358
Function: comedi_do_insnlist -- perform multiple instructions
 
359
Retval: int
 
360
Param: comedi_t * device
 
361
Param: comedi_insnlist * list
 
362
Description:
 
363
 The function comedi_do_insnlist() performs multiple Comedi
 
364
 instructions as part of one system call.  In addition, Comedi
 
365
 attempts to perform the instructions atomically, that is, on
 
366
 standard Linux kernels, no process preemption should occur
 
367
 during the instructions.  However, the process may be preempted
 
368
 before or after the group of instructions.
 
369
 
 
370
 This function can be used to avoid the overhead of multiple
 
371
 system calls, or to ensure that multiple instructions occur
 
372
 without significant delay between them.
 
373
 
 
374
 Preemption may occur if any of the instructions or the data
 
375
 arrays of any of the instructions exist in non-resident or
 
376
 copy-on-write pages.
 
377
Returns:
 
378
 The function comedi_do_insnlist() returns the number of
 
379
 sucessfully completed instructions.  Error information for
 
380
 the unsucessful instruction is not available.  If there is
 
381
 an error before the first instruction can be executed, -1
 
382
 is returned.
 
383
 
 
384
Function: comedi_do_insn -- perform instruction
 
385
Retval: int
 
386
Param: comedi_t * device
 
387
Param: comedi_insn * instruction
 
388
Description:
 
389
 The function comedi_do_insn() performs a single instruction.
 
390
 If sucessful, comedi_do_insn() returns the number of samples
 
391
 measured, which may be less than the number of requested
 
392
 samples.  Comedi limits the number of requested samples in
 
393
 order to enforce fairness among processes.  If there is an
 
394
 error, -1 is returned.
 
395
 
 
396
Function: comedi_lock -- subdevice reservation
 
397
Retval: int
 
398
Param: comedi_t * device
 
399
Param: unsigned int subdevice
 
400
Description:
 
401
 The function comedi_lock() reserves a subdevice for use by the
 
402
 current process.  While the lock is held, no other process is
 
403
 allowed to read, write, or configure that subdevice, although
 
404
 other processes can read information about the subdevice.  The
 
405
 lock is released when comedi_unlock() is called, or the device
 
406
 is closed.  If sucessful, 0 is returned.  If there is an error,
 
407
 -1 is returned.
 
408
 
 
409
Function: comedi_unlock -- subdevice reservation
 
410
Retval: int
 
411
Param: comedi_t * device
 
412
Param: unsigned int subdevice
 
413
Description:
 
414
 The function comedi_unlock() released a subdevice lock acquired
 
415
 by comedi_lock().  If sucessful, 0 is returned, otherwise -1.
 
416
 
 
417
Function: comedi_to_phys -- convert sample to physical units
 
418
Retval: double
 
419
Param: lsampl_t data
 
420
Param: comedi_range * range
 
421
Param: lsampl_t maxdata
 
422
Description:
 
423
 Converts data given in sample values (lsampl_t, between 0 and
 
424
 maxdata) into physical units (double).  The parameter range
 
425
 represents the conversion information to use, and the parameter
 
426
 maxdata represents the maximum possible data value for the
 
427
 channel that the data was read.
 
428
 
 
429
 Conversion of endpoint sample values, that is, sample values
 
430
 equal to 0 or maxdata, is affected by the Comedilib out-of-range
 
431
 behavior.  If the out-of-range behavior is set to COMEDI_OOR_NAN, 
 
432
 endpoint values are converted to NAN.  If the out-of-range
 
433
 behavior is set to COMEDI_OOR_NUMBER, the endpoint values are
 
434
 converted similarly to other values.
 
435
 
 
436
 If there is an error, NAN is returned.
 
437
 
 
438
Function: comedi_from_phys -- convert physical units to sample
 
439
Retval: lsampl_t
 
440
Param: double data
 
441
Param: comedi_range * range
 
442
Param: lsampl_t maxdata
 
443
Description:
 
444
 Converts data given in physical units (data) into sample values
 
445
 (lsampl_t, between 0 and maxdata).  The parameter rng
 
446
 represents the conversion information to use, and the parameter
 
447
 maxdata represents the maximum possible data value for the
 
448
 channel that the data will be written to.
 
449
 
 
450
 Conversion is not affected by out-of-range behavior.  Out-of-range
 
451
 data parameters are silently truncated to the range 0 to maxdata.
 
452
 
 
453
Function: comedi_data_read -- read single sample from channel
 
454
Retval: int
 
455
Param: comedi_t * device
 
456
Param: unsigned int subdevice
 
457
Param: unsigned int channel
 
458
Param: unsigned int range
 
459
Param: unsigned int aref
 
460
Param: lsampl_t * data
 
461
Description:
 
462
 Reads a single sample on the channel specified by the Comedi
 
463
 device device, the subdevice subdevice, and the channel channel.
 
464
 For the A/D conversion (if appropriate),
 
465
 the device is configured to use range specification
 
466
 range and (if appropriate) analog reference type
 
467
 aref. Analog reference types that are not supported
 
468
 by the device are silently ignored.
 
469
 
 
470
 The function comedi_data_read() reads one data value from
 
471
 the specified channel and places the data value in the
 
472
 location pointed to by data.
 
473
 
 
474
 WARNING: comedi_data_read() does not do any pausing to
 
475
 allow multiplexed analog inputs to settle before
 
476
 performing an analog to digital conversion.  If you are
 
477
 switching between different channels and need to allow
 
478
 your analog input to settle for an accurate reading,
 
479
 use comedi_data_read_delayed(), or set the
 
480
 input channel at an earlier time with
 
481
 comedi_data_read_hint().
 
482
 
 
483
 On sucess, comedi_data_read() returns 1 (the number of samples
 
484
 read).  If there is an error, -1 is returned.
 
485
 
 
486
 Data values returned by this function are unsigned integers
 
487
 less than or equal to the maximum sample value of the channel,
 
488
 which can be determined using the function comedi_get_maxdata().
 
489
 Conversion of data values to physical units can be performed
 
490
 by the function comedi_to_phys().
 
491
 
 
492
Function: comedi_data_read_delayed -- read single sample from channel after delaying for specified settling time
 
493
Retval: int
 
494
Param: comedi_t * device
 
495
Param: unsigned int subdevice
 
496
Param: unsigned int channel
 
497
Param: unsigned int range
 
498
Param: unsigned int aref
 
499
Param: lsampl_t * data
 
500
Param: unsigned int nanosec
 
501
Description:
 
502
 Similar to comedi_data_read() except it will wait for the
 
503
 specified number of nanoseconds between setting the input
 
504
 channel and taking a sample.  For analog inputs, most
 
505
 boards have a single
 
506
 analog to digital converter which is multiplexed to be
 
507
 able to read multiple channels.  If the input is not allowed
 
508
 to settle after the multiplexer switches channels, the
 
509
 reading will be inaccurate.  This function is useful
 
510
 for allowing a multiplexed analog input to settle
 
511
 when switching channels.
 
512
 
 
513
 Although the settling time is specified in nanoseconds, the
 
514
 actual settling time will be rounded up to the nearest
 
515
 microsecond.
 
516
 
 
517
Function: comedi_data_read_hint -- tell driver which channel/range/aref you are going to read from next
 
518
Retval: int
 
519
Param: comedi_t * device
 
520
Param: unsigned int subdevice
 
521
Param: unsigned int channel
 
522
Param: unsigned int range
 
523
Param: unsigned int aref
 
524
Description:
 
525
 Used to prepare an analog input for a subsequent call to
 
526
 comedi_data_read().  It is not necessary to use this
 
527
 function, but it can be useful for eliminating inaccuaracies
 
528
 caused by insufficient settling times when switching the
 
529
 channel
 
530
 or gain on an analog input.  This function sets an analog input
 
531
 to the channel, range, and aref specified but does not
 
532
 perform an actual analog to digital conversion.
 
533
 
 
534
 Alternatively, one can simply use comedi_data_read_delayed(),
 
535
 which sets up the
 
536
 input, pauses to allow settling, then performs a conversion.
 
537
 
 
538
Function: comedi_data_write -- write single sample to channel
 
539
Retval: int
 
540
Param: comedi_t * device
 
541
Param: unsigned int subdevice
 
542
Param: unsigned int channel
 
543
Param: unsigned int range
 
544
Param: unsigned int aref
 
545
Param: lsampl_t data
 
546
Description:
 
547
 Writes a single sample on the channel that is specified by the
 
548
 Comedi device device, the subdevice subdevice, and the channel
 
549
 channel.  If appropriate, the device is configured to use range
 
550
 specification range and analog reference type aref.  Analog
 
551
 reference types that are not supported by the device are
 
552
 silently ignored.
 
553
 
 
554
 The function comedi_data_write() writes the data value specified
 
555
 by the parameter data to the specified channel.
 
556
 
 
557
 On sucess, comedi_data_write() returns 1 (the number of samples
 
558
 written).  If there is an error, -1 is returned.
 
559
 
 
560
Function: comedi_dio_config -- change input/output properties of channel
 
561
Retval: int
 
562
Param: comedi_t * device
 
563
Param: unsigned int subdevice
 
564
Param: unsigned int channel
 
565
Param: unsigned int direction
 
566
Description:
 
567
 The function comedi_dio_config() configures individual channels
 
568
 in a digital I/O subdevice to be either input or output, depending
 
569
 on the value of parameter direction.  Valid directions are
 
570
 COMEDI_INPUT or COMEDI_OUTPUT.
 
571
 
 
572
 Depending on the capabilities of the hardware device, multiple
 
573
 channels may be grouped together to determine direction.  In this
 
574
 case, a single call to comedi_dio_config() for any channel in the
 
575
 group will affect the entire group.
 
576
 
 
577
 If sucessful, 1 is returned, otherwise -1.
 
578
 
 
579
Function: comedi_dio_read -- read single bit from digital channel
 
580
Retval: int
 
581
Param: comedi_t * device
 
582
Param: unsigned int subdevice
 
583
Param: unsigned int channel
 
584
Param: unsigned int * bit
 
585
Description:
 
586
 The function reads the channel channel belonging to the
 
587
 subdevice subdevice of device device.  The data value that is
 
588
 read is stored in the location pointed to by bit.  This function
 
589
 is equivalent to comedi_data_read(device,subdevice,channel,0,0,bit).
 
590
 This function does not require a digital subdevice or a subdevice
 
591
 with a maximum data value of 1 to work properly.
 
592
 
 
593
 Return values and errors are the same as comedi_data_read().
 
594
 
 
595
Function: comedi_dio_write -- write single bit to digital channel
 
596
Retval: int
 
597
Param: comedi_t * device
 
598
Param: unsigned int subdevice
 
599
Param: unsigned int channel
 
600
Param: unsigned int bit
 
601
Description:
 
602
 The function writes the value bit to the channel channel belonging
 
603
 to the subdevice subdevice of device device.  This function
 
604
 is equivalent to comedi_data_write(device,subdevice,channel,0,0,bit).
 
605
 This function does not require a digital subdevice or a subdevice
 
606
 with a maximum data value of 1 to work properly.
 
607
 
 
608
 Return values and errors are the same as comedi_data_write().
 
609
 
 
610
Function: comedi_dio_bitfield -- read/write multiple digital channels
 
611
Retval: int
 
612
Param: comedi_t * device
 
613
Param: unsigned int subdevice
 
614
Param: unsigned int write_mask
 
615
Param: unsigned int * bits
 
616
Description:
 
617
 The function comedi_dio_bitfield() allows multiple channels to
 
618
 be read simultaneously from a digital input or digital I/O device.
 
619
 The parameter write_mask and the value pointed to by bits
 
620
 are interpreted as bit fields, with the least significant bit
 
621
 representing channel 0.  For each bit in write_mask that is
 
622
 set to 1, the cooresponding bit in *bits is written to the digital
 
623
 output channel.  After writing all the output channels, each
 
624
 channel is read, and the result placed in the approprate bits in
 
625
 *bits.  The result of reading an output channel is undefined.
 
626
 It is not possible to access channels greater than 31 using this
 
627
 function.
 
628
 
 
629
Function: comedi_sv_init -- slowly-varying inputs
 
630
Retval: int
 
631
Param: comedi_sv_t * sv
 
632
Param: comedi_t * device
 
633
Param: unsigned int subdevice
 
634
Param: unsigned int channel
 
635
Status: deprecated
 
636
Description:
 
637
 The function comedi_sv_init() initializes the slow varying Comedi
 
638
 structure sv to use the device device, the analog input subdevice
 
639
 subdevice, and the channel channel.  The slow varying Comedi
 
640
 structure is used by comedi_sv_measure() to accurately measure
 
641
 an analog input by averaging over many samples.  The default
 
642
 number of samples is 100.  This function returns 0 on success,
 
643
 -1 on error.
 
644
 
 
645
Function: comedi_sv_update -- slowly-varying inputs
 
646
Retval: int
 
647
Param: comedi_sv_t * sv
 
648
Status: deprecated
 
649
Description:
 
650
 The function comedi_sv_update() updates internal parameters of
 
651
 the slowly varying Comedi structure sv.
 
652
 
 
653
Function: comedi_sv_measure -- slowly-varying inputs
 
654
Retval: int
 
655
Param: comedi_sv_t * sv
 
656
Param: double * data
 
657
Status: deprecated
 
658
Description:
 
659
 The function comedi_sv_measure() uses the slowly varying Comedi
 
660
 structure sv to measure a slowly varying signal.  If sucessful,
 
661
 the result (in physical units) is stored in the location pointed
 
662
 to by data, and the number of samples is returned.  On error, -1
 
663
 is returned.
 
664
 
 
665
Function: comedi_get_cmd_src_mask -- streaming input/output capabilities
 
666
Retval: int
 
667
Param: comedi_t * device
 
668
Param: unsigned int subdevice
 
669
Param: comedi_cmd * command
 
670
Description:
 
671
 The command capabilities of the subdevice indicated by the parameters
 
672
 device and subdevice are probed, and the results placed in the
 
673
 command structure pointed to by the parameter command.  The trigger
 
674
 source elements of the command structure are set to the logical OR
 
675
 value of possible trigger sources.  Other elements in the structure
 
676
 are undefined.  If sucessful, 0 is returned, otherwise -1.
 
677
 
 
678
Function: comedi_get_cmd_generic_timed -- streaming input/output capabilities
 
679
Retval: int
 
680
Param: comedi_t * device
 
681
Param: unsigned int subdevice
 
682
Param: comedi_cmd * command
 
683
Param: unsigned int period_ns
 
684
Description:
 
685
 The command capabilities of the subdevice indicated by the parameters
 
686
 device and subdevice are probed, and the results placed in the
 
687
 command structure pointed to by the parameter command.  The command
 
688
 structure pointed to by the parameter command is modified to be a
 
689
 valid command that can be used as a parameter to comedi_command().
 
690
 The command measures samples at a rate that corresponds to the
 
691
 period period_ns.  The rate is adjusted to a rate that the device
 
692
 can handle.  If sucessful, 0 is returned, otherwise -1.
 
693
 
 
694
Function: comedi_cancel -- stop streaming input/outpu in progress
 
695
Retval: int
 
696
Param: comedi_t * device
 
697
Param: unsigned int subdevice
 
698
Description:
 
699
 The function comedi_cancel() can be used to stop a Comedi command
 
700
 previously started by comedi_command() that is still in progress
 
701
 on the subdevice indicated by the parameters device and subdevice.
 
702
 This may not return the subdevice to a ready state, since there may
 
703
 be samples in the buffer that need to be read.
 
704
 
 
705
 If sucessful, 0 is returned, otherwise -1.
 
706
 
 
707
Function: comedi_command -- start streaming input/output
 
708
Retval: int
 
709
Param: comedi_t * device
 
710
Param: comedi_cmd * command
 
711
Description:
 
712
 The function comedi_command() starts streaming input or output.  The
 
713
 command structure pointed to by the parameter command specifies the
 
714
 acquisition.  For input subdevices, sample values are read using the
 
715
 function read().  For output subdevices, sample vlaues are written
 
716
 using the function write().
 
717
 
 
718
 If sucessful, 0 is returned, otherwise -1.
 
719
 
 
720
Function: comedi_command_test -- test streaming input/output configuration
 
721
Retval: int
 
722
Param: comedi_t * device
 
723
Param: comedi_cmd * command
 
724
Description:
 
725
 The function comedi_command_test() tests the command structure pointed
 
726
 to by the parameter command and returns an integer describing the
 
727
 testing stages that were sucessfully passed.  In addition, if elements
 
728
 of the command structure are invalid, they may be modified.  Source
 
729
 elements are modified to remove invalid source triggers.  Argument
 
730
 elements are adjusted or rounded to the nearest valid value.
 
731
 
 
732
 XXX return values.
 
733
 
 
734
Function: comedi_poll -- force updating of streaming buffer
 
735
Retval: int
 
736
Param: comedi_t * device
 
737
Param: unsigned int subdevice
 
738
Description:
 
739
 The function comedi_poll() is used on a subdevice that has a
 
740
 Comedi command in progress in order to update the streaming buffer.
 
741
 If supported by the driver, all available samples are copied to
 
742
 the streaming buffer.  These samples may be pending in DMA buffers
 
743
 or device FIFOs.  If sucessful, the number of additional bytes
 
744
 available is returned.  If there is an error, -1 is returned.
 
745
 
 
746
Function: comedi_set_max_buffer_size -- streaming buffer size of subdevice
 
747
Retval: int
 
748
Param: comedi_t * device
 
749
Param: unsigned int subdevice
 
750
Param: unsigned int max_size
 
751
Description:
 
752
 The function comedi_set_max_buffer_size() changes the maximum
 
753
 allowable size (in bytes) of the streaming buffer for the subdevice
 
754
 specified by device and subdevice.  Changing the maximum buffer
 
755
 size requires appropriate privileges.  If sucessful, the old buffer
 
756
 size is returned.  On error, -1 is returned.
 
757
 
 
758
Function: comedi_get_buffer_contents -- streaming buffer status
 
759
Retval: int
 
760
Param: comedi_t * device
 
761
Param: unsigned int subdevice
 
762
Description:
 
763
 The function comedi_get_buffer_contents() is used on a subdevice
 
764
 that has a Comedi command in progress.  The number of bytes that
 
765
 are available in the streaming buffer is returned.  If there is
 
766
 an error, -1 is returned.
 
767
 
 
768
Function: comedi_mark_buffer_read -- streaming buffer status
 
769
Retval: int
 
770
Param: comedi_t * device
 
771
Param: unsigned int subdevice
 
772
Param: unsigned int num_bytes
 
773
Description:
 
774
 The function comedi_mark_buffer_read() is used on a subdevice
 
775
 that has a Comedi command in progress.  This function can be
 
776
 used to indicate that the next num_bytes bytes in the buffer
 
777
 are no longer needed and may be discarded.
 
778
 If there is an error, -1 is returned.
 
779
 
 
780
Function: comedi_get_buffer_offset -- streaming buffer status
 
781
Retval: int
 
782
Param: comedi_t * device
 
783
Param: unsigned int subdevice
 
784
Description:
 
785
 The function comedi_get_buffer_offset() is used on a subdevice
 
786
 that has a Comedi command in progress.  This function returns
 
787
 the offset in bytes of the read pointer in the streaming buffer.
 
788
 This offset is only useful for memory mapped buffers.
 
789
 If there is an error, -1 is returned.
 
790
 
 
791
Function: comedi_get_timer -- timer information (deprecated)
 
792
Retval: int
 
793
Param: comedi_t * device
 
794
Param: unsigned int subdevice
 
795
Param: double frequency
 
796
Param: unsigned int * trigvar
 
797
Param: double * actual_frequency
 
798
Status: deprecated
 
799
Description:
 
800
 The function comedi_get_timer converts the frequency frequency
 
801
 to a number suitable to send to the driver in a comedi_trig
 
802
 structure.  This function remains for compatibility with very
 
803
 old versions of Comedi, that converted sampling rates to timer
 
804
 values in the libary.  This conversion is now done in the kernel,
 
805
 and every device has the timer type nanosec_timer, indicating
 
806
 that timer values are simply a time specified in nanoseconds.
 
807
 
 
808
Function: comedi_timed_1chan -- streaming input (deprecated)
 
809
Retval: int
 
810
Param: comedi_t * device
 
811
Param: unsigned int subdevice
 
812
Param: unsigned int channel
 
813
Param: unsigned int range
 
814
Param: unsigned int aref
 
815
Param: double frequency
 
816
Param: unsigned int num_samples
 
817
Param: double * data
 
818
Status: deprecated
 
819
Description:
 
820
 Not documented.
 
821
 
 
822
Function: comedi_set_global_oor_behavior -- out-of-range behavior
 
823
Retval: int
 
824
Param: enum comedi_oor_behavior behavior
 
825
Status: alpha
 
826
Description:
 
827
 This function changes the Comedilib out-of-range behavior.
 
828
 This currently affects the behavior of comedi_to_phys() when
 
829
 converting endpoint sample values, that is, sample values
 
830
 equal to 0 or maxdata.  If the out-of-range behavior is set to
 
831
 COMEDI_OOR_NAN, endpoint values are converted to NAN.  If the
 
832
 out-of-range behavior is set to COMEDI_OOR_NUMBER, the endpoint
 
833
 values are converted similarly to other values.
 
834
 
 
835
 The previous out-of-range behavior is returned.
 
836
 
 
837
Function: comedi_apply_calibration -- set calibration from file
 
838
Retval: int
 
839
Param: comedi_t *device
 
840
Param: unsigned int subdevice
 
841
Param: unsigned int channel
 
842
Param: unsigned int range
 
843
Param: unsigned int aref
 
844
Param: const char *file_path
 
845
Status: alpha
 
846
Description:
 
847
 This function sets the calibration of the specified subdevice
 
848
 so that it is in proper calibration when using the specified
 
849
 channel, range and aref.  Depending on the hardware, the
 
850
 calibration settings used may or may not depend on the channel,
 
851
 range, or aref.  The file_path parameter can be used
 
852
 to specify the file which contains the calibration information.
 
853
 If <parameter>file_path</parameter> is NULL, then comedilib
 
854
 will use a default
 
855
 file location.  The calibration information used by this function
 
856
 is generated by the comedi_calibrate program (see its man page).
 
857
 
 
858
 The functions comedi_parse_calibration_file(),
 
859
 comedi_apply_parsed_calibration(), and comedi_cleanup_calibration()
 
860
 provide the same functionality at a slightly lower level.
 
861
Returns:
 
862
 Zero on success, a negative number on failure.
 
863
 
 
864
Function: comedi_apply_parsed_calibration -- set calibration from memory
 
865
Retval: int
 
866
Param: comedi_t * device
 
867
Param: unsigned int subdevice
 
868
Param: unsigned int channel
 
869
Param: unsigned int range
 
870
Param: unsigned int aref
 
871
Param: const comedi_calibration_t *calibration
 
872
Status: alpha
 
873
Description:
 
874
 This function is similar to comedi_apply_calibration()
 
875
 except the calibration information is read from memory
 
876
 instead of a file.  This function can be more
 
877
 efficient than comedi_apply_calibration() since the
 
878
 calibration file does not need to be reparsed with
 
879
 every call.  The <parameter>calibration</parameter> is
 
880
 obtained by a call to comedi_parse_calibration_file().
 
881
 
 
882
Returns:
 
883
 Zero on success, a negative number on failure.
 
884
 
 
885
Function: comedi_cleanup_calibration_file -- free calibration resources
 
886
Retval: void
 
887
Param: comedi_calibration_t *calibration
 
888
Status: alpha
 
889
Description:
 
890
 This function frees the resources associated with a
 
891
 <parameter>calibration</parameter> obtained from
 
892
 comedi_parse_calibration_file().  <parameter>calibration</parameter>
 
893
 can not be used again after calling this function.
 
894
 
 
895
Function: comedi_get_default_calibration_path -- get default calibration file path
 
896
Retval: char*
 
897
Param: comedi_t *dev
 
898
Status: alpha
 
899
Description:
 
900
 This function returns a string containing a default calibration file
 
901
 path appropriate for <parameter>dev</parameter>.  Memory for the
 
902
 string is allocated by the function, and should be freed when
 
903
 the string is no longer needed.
 
904
Returns:
 
905
 A string which contains a file path useable by
 
906
 comedi_parse_calibration_file().  On error, NULL is returned.
 
907
 
 
908
Function: comedi_parse_calibration_file -- set calibration
 
909
Retval: comedi_calibration_t*
 
910
Param: const char *file_path
 
911
Status: alpha
 
912
Description:
 
913
 This function parses a calibration file (produced by the
 
914
 comedi_calibrate program) and returns a pointer to a
 
915
 comedi_calibration_t which can be passed to the
 
916
 comedi_apply_parsed_calibration() function.  When you are
 
917
 finished using the comedi_calibration_t, you should
 
918
 call comedi_cleanup_calibration() to free the resources
 
919
 associated with the comedi_calibration_t.
 
920
 
 
921
 The comedi_get_default_calibration_path() function may
 
922
 be useful in conjunction with this function.
 
923
Returns:
 
924
 A pointer to parsed calibration information on success,  or NULL on failure.