drivers/gpib/tnt4882/mite.c
Source file repositories/reference/linux-study-clean/drivers/gpib/tnt4882/mite.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpib/tnt4882/mite.c- Extension
.c- Size
- 3277 bytes
- Lines
- 134
- Domain
- Driver Families
- Bucket
- drivers/gpib
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/errno.hlinux/ioport.hlinux/delay.hlinux/mm.hlinux/interrupt.hlinux/pci.hlinux/io.hlinux/slab.hmite.h
Detected Declarations
function mite_initfunction mite_setupfunction mite_cleanupfunction mite_unsetup
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Hardware driver for NI Mite PCI interface chip,
* adapted from COMEDI
*
* Copyright (C) 1997-8 David A. Schleef
* Copyright (C) 2002 Frank Mori Hess
*
* The PCI-MIO E series driver was originally written by
* Tomasz Motylewski <...>, and ported to comedi by ds.
*
* References for specifications:
*
* 321747b.pdf Register Level Programmer Manual (obsolete)
* 321747c.pdf Register Level Programmer Manual (new)
* DAQ-STC reference manual
*
* Other possibly relevant info:
*
* 320517c.pdf User manual (obsolete)
* 320517f.pdf User manual (new)
* 320889a.pdf delete
* 320906c.pdf maximum signal ratings
* 321066a.pdf about 16x
* 321791a.pdf discontinuation of at-mio-16e-10 rev. c
* 321808a.pdf about at-mio-16e-10 rev P
* 321837a.pdf discontinuation of at-mio-16de-10 rev d
* 321838a.pdf about at-mio-16de-10 rev N
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/io.h>
#include <linux/slab.h>
#include "mite.h"
#define PCI_MITE_SIZE 4096
#define PCI_DAQ_SIZE 4096
struct mite_struct *mite_devices;
#define TOP_OF_PAGE(x) ((x) | (~(PAGE_MASK)))
void mite_init(void)
{
struct pci_dev *pcidev;
struct mite_struct *mite;
for (pcidev = pci_get_device(PCI_VENDOR_ID_NATINST, PCI_ANY_ID, NULL);
pcidev;
pcidev = pci_get_device(PCI_VENDOR_ID_NATINST, PCI_ANY_ID, pcidev)) {
mite = kzalloc_obj(*mite);
if (!mite)
return;
mite->pcidev = pcidev;
pci_dev_get(mite->pcidev);
mite->next = mite_devices;
mite_devices = mite;
}
}
int mite_setup(struct mite_struct *mite)
{
u32 addr;
if (pci_enable_device(mite->pcidev)) {
pr_err("mite: error enabling mite.\n");
return -EIO;
}
pci_set_master(mite->pcidev);
if (pci_request_regions(mite->pcidev, "mite")) {
pr_err("mite: failed to request mite io regions.\n");
return -EIO;
}
addr = pci_resource_start(mite->pcidev, 0);
mite->mite_phys_addr = addr;
mite->mite_io_addr = ioremap(addr, pci_resource_len(mite->pcidev, 0));
if (!mite->mite_io_addr) {
pr_err("mite: failed to remap mite io memory address.\n");
return -ENOMEM;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/errno.h`, `linux/ioport.h`, `linux/delay.h`, `linux/mm.h`, `linux/interrupt.h`, `linux/pci.h`.
- Detected declarations: `function mite_init`, `function mite_setup`, `function mite_cleanup`, `function mite_unsetup`.
- Atlas domain: Driver Families / drivers/gpib.
- 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.