drivers/comedi/drivers/ni_routing/tools/ni_names.py
Source file repositories/reference/linux-study-clean/drivers/comedi/drivers/ni_routing/tools/ni_names.py
File Facts
- System
- Linux kernel
- Corpus path
drivers/comedi/drivers/ni_routing/tools/ni_names.py- Extension
.py- Size
- 1415 bytes
- Lines
- 56
- Domain
- Driver Families
- Bucket
- drivers/comedi
- Inferred role
- Driver Families: drivers/comedi
- Status
- atlas-only
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.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
# SPDX-License-Identifier: GPL-2.0+
"""
This file helps to extract string names of NI signals as included in comedi.h
between NI_NAMES_BASE and NI_NAMES_BASE+NI_NUM_NAMES.
"""
# This is simply to aide in creating the entries in the order of the value of
# the device-global NI signal/terminal constants defined in comedi.h
import comedi_h
ni_macros = (
'NI_PFI',
'TRIGGER_LINE',
'NI_RTSI_BRD',
'NI_CtrSource',
'NI_CtrGate',
'NI_CtrAux',
'NI_CtrA',
'NI_CtrB',
'NI_CtrZ',
'NI_CtrArmStartTrigger',
'NI_CtrInternalOutput',
'NI_CtrOut',
'NI_CtrSampleClock',
)
def get_ni_names():
name_dict = dict()
# load all the static names; start with those that do not begin with NI_
name_dict['PXI_Star'] = comedi_h.PXI_Star
name_dict['PXI_Clk10'] = comedi_h.PXI_Clk10
#load all macro values
for fun in ni_macros:
f = getattr(comedi_h, fun)
name_dict.update({
'{}({})'.format(fun,i):f(i) for i in range(1 + f(-1) - f(0))
})
#load everything else in ni_common_signal_names enum
name_dict.update({
k:v for k,v in comedi_h.__dict__.items()
if k.startswith('NI_') and (not callable(v)) and
comedi_h.NI_COUNTER_NAMES_MAX < v < (comedi_h.NI_NAMES_BASE + comedi_h.NI_NUM_NAMES)
})
# now create reverse lookup (value -> name)
val_dict = {v:k for k,v in name_dict.items()}
return name_dict, val_dict
name_to_value, value_to_name = get_ni_names()
Annotation
- Atlas domain: Driver Families / drivers/comedi.
- Implementation status: atlas-only.
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.