drivers/comedi/drivers/ni_tio.h
Source file repositories/reference/linux-study-clean/drivers/comedi/drivers/ni_tio.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/comedi/drivers/ni_tio.h- Extension
.h- Size
- 5313 bytes
- Lines
- 182
- Domain
- Driver Families
- Bucket
- drivers/comedi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/comedi/comedidev.h
Detected Declarations
struct ni_gpctstruct ni_gpct_deviceenum ni_gpct_registerenum ni_gpct_variant
Annotated Snippet
struct ni_gpct {
struct ni_gpct_device *counter_dev;
unsigned int counter_index;
unsigned int chip_index;
u64 clock_period_ps; /* clock period in picoseconds */
struct mite_channel *mite_chan;
spinlock_t lock; /* protects 'mite_chan' */
};
struct ni_gpct_device {
struct comedi_device *dev;
void (*write)(struct ni_gpct *counter, unsigned int value,
enum ni_gpct_register);
unsigned int (*read)(struct ni_gpct *counter, enum ni_gpct_register);
enum ni_gpct_variant variant;
struct ni_gpct *counters;
unsigned int num_counters;
unsigned int num_chips;
unsigned int (*regs)[NITIO_NUM_REGS]; /* [num_chips][NITIO_NUM_REGS] */
spinlock_t regs_lock; /* protects 'regs' */
const struct ni_route_tables *routing_tables; /* link to routes */
};
struct ni_gpct_device *
ni_gpct_device_construct(struct comedi_device *dev,
void (*write)(struct ni_gpct *counter,
unsigned int value,
enum ni_gpct_register),
unsigned int (*read)(struct ni_gpct *counter,
enum ni_gpct_register),
enum ni_gpct_variant,
unsigned int num_counters,
unsigned int counters_per_chip,
const struct ni_route_tables *routing_tables);
void ni_gpct_device_destroy(struct ni_gpct_device *counter_dev);
void ni_tio_init_counter(struct ni_gpct *counter);
int ni_tio_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
int ni_tio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
int ni_tio_insn_write(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
int ni_tio_cmd(struct comedi_device *dev, struct comedi_subdevice *s);
int ni_tio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_cmd *cmd);
int ni_tio_cancel(struct ni_gpct *counter);
void ni_tio_handle_interrupt(struct ni_gpct *counter,
struct comedi_subdevice *s);
void ni_tio_set_mite_channel(struct ni_gpct *counter,
struct mite_channel *mite_chan);
void ni_tio_acknowledge(struct ni_gpct *counter);
/*
* Retrieves the register value of the current source of the output selector for
* the given destination.
*
* If the terminal for the destination is not already configured as an output,
* this function returns -EINVAL as error.
*
* Return: the register value of the destination output selector;
* -EINVAL if terminal is not configured for output.
*/
int ni_tio_get_routing(struct ni_gpct_device *counter_dev,
unsigned int destination);
/*
* Sets the register value of the selector MUX for the given destination.
* @counter_dev:Pointer to general counter device.
* @destination:Device-global identifier of route destination.
* @register_value:
* The first several bits of this value should store the desired
* value to write to the register. All other bits are for
* transmitting information that modify the mode of the particular
* destination/gate. These mode bits might include a bitwise or of
* CR_INVERT and CR_EDGE. Note that the calling function should
* have already validated the correctness of this value.
*/
int ni_tio_set_routing(struct ni_gpct_device *counter_dev,
unsigned int destination, unsigned int register_value);
/*
* Sets the given destination MUX to its default value or disable it.
*
* Return: 0 if successful; -EINVAL if terminal is unknown.
*/
int ni_tio_unset_routing(struct ni_gpct_device *counter_dev,
unsigned int destination);
#endif /* _COMEDI_NI_TIO_H */
Annotation
- Immediate include surface: `linux/comedi/comedidev.h`.
- Detected declarations: `struct ni_gpct`, `struct ni_gpct_device`, `enum ni_gpct_register`, `enum ni_gpct_variant`.
- Atlas domain: Driver Families / drivers/comedi.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.