Lines Matching +full:level +full:- +full:low
1 /* SPDX-License-Identifier: GPL-2.0+ */
4 * header file for kernel-only structures, variables, and constants
6 * COMEDI - Linux Control and Measurement Device Interface
7 * Copyright (C) 1997-2000 David A. Schleef <ds@schleef.org>
13 #include <linux/dma-mapping.h>
29 * struct comedi_subdevice - Working data for a COMEDI subdevice
35 * the low-level driver.)
37 * low-level driver.)
39 * the COMEDI core and user application. (Initialized by the low-level
43 * low-level driver, or changed from 0 to 1 during post-configuration.)
44 * @private: Private data pointer which is either set by the low-level driver
47 * low-level driver's "detach" handler is called for the device.
48 * (Initialized by the low-level driver.)
51 * post-configuration if needed.)
58 * @spin_lock: Generic spin-lock for use by the COMEDI core and the low-level
60 * @io_bits: Bit-mask indicating the channel directions for a DIO subdevice
63 * low-level driver for a DIO subdevice. Forced to all-outputs during
64 * post-configuration for a digital output subdevice.)
65 * @maxdata: If non-zero, this is the maximum raw data value of each channel.
66 * If zero, the maximum data value is channel-specific. (Initialized by
67 * the low-level driver.)
68 * @maxdata_list: If the maximum data value is channel-specific, this points
70 * (Initialized by the low-level driver.)
71 * @range_table: If non-NULL, this points to a COMEDI range table for the
72 * subdevice. If NULL, the range table is channel-specific. (Initialized
73 * by the low-level driver, will be set to an "invalid" range table during
74 * post-configuration if @range_table and @range_table_list are both
76 * @range_table_list: If the COMEDI range table is channel-specific, this
78 * channel number. (Initialized by the low-level driver.)
81 * (Initialized by the low-level driver, or set to a default handler
82 * during post-configuration.)
84 * (Initialized by the low-level driver, or set to a default handler
85 * during post-configuration.)
88 * (Initialized by the low-level driver, or set to a default handler
89 * during post-configuration.)
91 * instruction. (Initialized by the low-level driver, or set to a default
92 * handler during post-configuration.)
95 * low-level driver.)
99 * the low-level driver.)
102 * instructs the low-level driver to synchronize buffers. (Initialized by
103 * the low-level driver if needed.)
106 * by the low-level driver.)
110 * (Initialized by the low-level driver if needed.)
115 * low-level driver if needed.)
119 * %DMA_NONE by comedi_alloc_subdevices() and changed by the low-level
121 * @state: Handy bit-mask indicating the output states for a DIO or digital
123 * low-level driver.)
130 * post-configuration if needed.)
132 * device number. (Set during post-configuration if necessary.)
136 * automatically freed after the low-level driver's "detach" handler is
137 * called for the device. (Initialized by the low-level driver.)
143 * Most of the subdevice is initialized by the low-level driver's "attach" or
146 * post-configuration on return from that handler.
148 * A low-level driver that sets @insn_bits for a digital input, digital output,
150 * which case they will be set to a default handler during post-configuration
168 spinlock_t spin_lock; /* generic spin-lock for COMEDI and drivers */
178 unsigned int *chanlist; /* driver-owned chanlist (not used) */
216 * struct comedi_buf_page - Describe a page of a COMEDI buffer
226 * struct comedi_buf_map - Describe pages in a COMEDI buffer
227 * @dma_hw_dev: Low-level hardware &struct device pointer copied from the
238 * low-level hardware device. (The buffer pages also get mapped into the
243 * low-level driver (which may happen due to device removal), but if it happens
258 * struct comedi_async - Control data for asynchronous COMEDI commands
278 * @events: Bit-vector of events that have occurred.
281 * @cb_mask: Bit-vector of events that should wake waiting tasks.
373 * enum comedi_cb - &struct comedi_async callback "events"
374 * @COMEDI_CB_EOS: end-of-scan
375 * @COMEDI_CB_EOA: end-of-acquisition/output
396 * struct comedi_driver - COMEDI driver registration
406 * to a board name is embedded in an element of a driver-defined array
407 * of static, read-only board type information.
408 * @offset: Optional size of each element of the driver-defined array of
409 * static, read-only board type information, i.e. the offset between each
413 * register and unregister a low-level COMEDI driver with the COMEDI core.
415 * If @num_names is non-zero, @board_name should be non-NULL, and @offset
420 * @attach handler is set. If @num_names is non-zero, the driver's @attach
423 * array of static, read-only board type information.
430 * @attach or @auto_attach handlers can defer clean-up on error until the
452 * struct comedi_device - Working data for a COMEDI device
454 * @driver: Low-level COMEDI driver attached to this COMEDI device.
457 * detached from the low-level driver.
458 * @private: Optional pointer to private data allocated by the low-level
460 * detached from the low-level driver.
462 * @minor: Minor device number of COMEDI char device (0-47).
465 * @hw_dev: Optional pointer to the low-level hardware &struct device. It is
468 * the bus-specific COMEDI functions only work if it is set correctly.
473 * the low-level driver's "attach" handler is called by the handler for
476 * non-zero, otherwise it points to the low-level driver name string.
477 * When the low-lever driver's "auto_attach" handler is called for an
478 * automatically configured COMEDI device, it points to the low-level
479 * driver name string. The low-level driver is free to change it in its
481 * @board_ptr: Optional pointer to private, read-only board type information in
482 * the low-level driver. If the 'num_names' member of the &struct
483 * comedi_driver is non-zero, the handler for the %COMEDI_DEVCONFIG ioctl
485 * driver's private array of static, read-only board type information when
486 * calling the driver's "attach" handler. The low-level driver is free to
488 * @attached: Flag indicating that the COMEDI device is attached to a low-level
492 * @spinlock: Generic spin-lock for use by the low-level driver.
497 * changing @attached and @detach_count and calling the low-level driver's
501 * @n_subdevices: Number of COMEDI subdevices allocated by the low-level
504 * @mmio: Optional pointer to a remapped MMIO region set by the low-level
506 * @iobase: Optional base of an I/O port region requested by the low-level
509 * @irq: Optional IRQ number requested by the low-level driver.
511 * the read() file operation. Set by the low-level driver.
513 * the write() file operation. Set by the low-level driver.
515 * @open: Optional pointer to a function set by the low-level driver to be
517 * @close: Optional pointer to a function set by the low-level driver to be
519 * @insn_device_config: Optional pointer to a handler for all sub-instructions
521 * instruction. If this is not initialized by the low-level driver, a
522 * default handler will be set during post-configuration.
524 * %INSN_DEVICE_CONFIG_GET_ROUTES sub-instruction of the
526 * low-level driver, a default handler that copies zero routes back to the
530 * COMEDI core is concerned). There are two groups of COMEDI devices -
534 * a low-level COMEDI driver. The "legacy" COMEDI devices are allocated
536 * parameter is non-zero and use minor device numbers from 0 to
556 spinlock_t spinlock; /* generic spin-lock for low-level driver */
608 #define BIP_RANGE(a) {-(a) * 1e6, (a) * 1e6, 0}
625 * struct comedi_lrange - Describes a COMEDI range table
641 * comedi_range_is_bipolar() - Test if subdevice range is bipolar
649 * channel-specific range table list.
658 return s->range_table->range[range].min < 0; in comedi_range_is_bipolar()
662 * comedi_range_is_unipolar() - Test if subdevice range is unipolar
670 * channel-specific range table list.
679 return s->range_table->range[range].min >= 0; in comedi_range_is_unipolar()
683 * comedi_range_is_external() - Test if subdevice range is external
691 * channel-specific range table list.
700 return !!(s->range_table->range[range].flags & RF_EXTERNAL); in comedi_range_is_external()
704 * comedi_chan_range_is_bipolar() - Test if channel-specific range is bipolar
713 * channel-specific range table list.
723 return s->range_table_list[chan]->range[range].min < 0; in comedi_chan_range_is_bipolar()
727 * comedi_chan_range_is_unipolar() - Test if channel-specific range is unipolar
736 * channel-specific range table list.
746 return s->range_table_list[chan]->range[range].min >= 0; in comedi_chan_range_is_unipolar()
750 * comedi_chan_range_is_external() - Test if channel-specific range is external
759 * channel-specific range table list.
769 return !!(s->range_table_list[chan]->range[range].flags & RF_EXTERNAL); in comedi_chan_range_is_external()
773 * comedi_offset_munge() - Convert between offset binary and 2's complement
778 * and 2's complement. Assumes that @s->maxdata is a power of 2 minus 1.
785 return val ^ s->maxdata ^ (s->maxdata >> 1); in comedi_offset_munge()
789 * comedi_bytes_per_sample() - Determine subdevice sample size
799 return s->subdev_flags & SDF_LSAMPL ? sizeof(int) : sizeof(short); in comedi_bytes_per_sample()
803 * comedi_sample_shift() - Determine log2 of subdevice sample size
809 * bit-shift operator to multiply or divide something by the sample size.
815 return s->subdev_flags & SDF_LSAMPL ? 2 : 1; in comedi_sample_shift()
819 * comedi_bytes_to_samples() - Convert a number of bytes to a number of samples
832 * comedi_samples_to_bytes() - Convert a number of samples to a number of bytes
846 * comedi_check_trigger_src() - Trivially validate a comedi_cmd trigger source
857 * -EINVAL if any trigger source in *@src is unsupported.
866 return -EINVAL; in comedi_check_trigger_src()
871 * comedi_check_trigger_is_unique() - Make sure a trigger source is unique
876 * -EINVAL if more than one trigger source is set.
881 if ((src & (src - 1)) != 0) in comedi_check_trigger_is_unique()
882 return -EINVAL; in comedi_check_trigger_is_unique()
887 * comedi_check_trigger_arg_is() - Trivially validate a trigger argument
895 * -EINVAL if *@arg differed from @val.
902 return -EINVAL; in comedi_check_trigger_arg_is()
908 * comedi_check_trigger_arg_min() - Trivially validate a trigger argument min
916 * -EINVAL if *@arg was less than @val.
923 return -EINVAL; in comedi_check_trigger_arg_min()
929 * comedi_check_trigger_arg_max() - Trivially validate a trigger argument max
937 * -EINVAL if *@arg was greater than @val.
944 return -EINVAL; in comedi_check_trigger_arg_max()
950 * Must set dev->hw_dev if you wish to dma directly into comedi's buffer.
952 * known bus type. Set automatically for auto-configured devices.
958 * comedi_buf_n_bytes_ready - Determine amount of unread data in buffer
969 return s->async->buf_write_count - s->async->buf_read_count; in comedi_buf_n_bytes_ready()
984 /* drivers.c - general comedi driver functions */
1043 * module_comedi_driver() - Helper macro for registering a comedi driver