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