1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * comedi/drivers/ni_routing/ni_route_values.h
4 * Route information for NI boards.
6 * COMEDI - Linux Control and Measurement Device Interface
7 * Copyright (C) 2016 Spencer E. Olson <olsonse@umich.edu>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
20 #ifndef _COMEDI_DRIVERS_NI_ROUTINT_NI_ROUTE_VALUES_H
21 #define _COMEDI_DRIVERS_NI_ROUTINT_NI_ROUTE_VALUES_H
23 #include <linux/comedi.h>
24 #include <linux/types.h>
27 * This file includes the tables that are a list of all the values of various
28 * signals routes available on NI hardware. In many cases, one does not
29 * explicitly make these routes, rather one might indicate that something is
30 * used as the source of one particular trigger or another (using
33 * This file is meant to be included by comedi/drivers/ni_routes.c
36 #define B(x) ((x) - NI_NAMES_BASE)
38 /** Marks a register value as valid, implemented, and tested. */
39 #define V(x) (((x) & 0x7f) | 0x80)
41 #ifndef NI_ROUTE_VALUE_EXTERNAL_CONVERSION
42 /** Marks a register value as implemented but needing testing. */
44 /** Marks a register value as not implemented. */
47 typedef u8 register_type;
49 /** Marks a register value as implemented but needing testing. */
50 #define I(x) (((x) & 0x7f) | 0x100)
51 /** Marks a register value as not implemented. */
52 #define U(x) (((x) & 0x7f) | 0x200)
54 /** Tests whether a register is marked as valid/implemented/tested */
55 #define MARKED_V(x) (((x) & 0x80) != 0)
56 /** Tests whether a register is implemented but not tested */
57 #define MARKED_I(x) (((x) & 0x100) != 0)
58 /** Tests whether a register is not implemented */
59 #define MARKED_U(x) (((x) & 0x200) != 0)
61 /* need more space to store extra marks */
62 typedef u16 register_type;
65 /* Mask out the marking bit(s). */
66 #define UNMARK(x) ((x) & 0x7f)
69 * Gi_SRC(x,1) implements Gi_Src_SubSelect = 1
71 * This appears to only really be a valid MUX for m-series devices.
73 #define Gi_SRC(val, subsel) ((val) | ((subsel) << 6))
76 * struct family_route_values - Register values for all routes for a particular
78 * @family: lower-case string representation of a specific series or family of
79 * devices from National Instruments where each member of this family
80 * shares the same register values for the various signal MUXes. It
81 * should be noted that not all devices of any family have access to
83 * @register_values: Table of all register values for various signal MUXes on
84 * National Instruments devices. The first index of this table is the
85 * signal destination (i.e. identification of the signal MUX). The
86 * second index of this table is the signal source (i.e. input of the
89 struct family_route_values {
91 const register_type register_values[NI_NUM_NAMES][NI_NUM_NAMES];
95 extern const struct family_route_values *const ni_all_route_values[];
97 #endif /* _COMEDI_DRIVERS_NI_ROUTINT_NI_ROUTE_VALUES_H */