Xenomai 3.3.2
Loading...
Searching...
No Matches
ni_mio.h
1/*
2 * Hardware driver for NI Mite PCI interface chip
3 * Copyright (C) 1999 David A. Schleef <ds@schleef.org>
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; either version 2 of the License,
8 * or (at your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with Xenomai; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19#ifndef __ANALOGY_NI_MIO_H__
20#define __ANALOGY_NI_MIO_H__
21
22/* Debug stuff */
23
24#ifdef CONFIG_DEBUG_MIO
25#define MDPRINTK(fmt, args...) pr_debug(fmt, ##args)
26#else /* !CONFIG_DEBUG_MIO */
27#define MDPRINTK(fmt, args...)
28#endif /* CONFIG_DEBUG_MIO */
29
30/* Subdevice related defines */
31
32#define AIMODE_NONE 0
33#define AIMODE_HALF_FULL 1
34#define AIMODE_SCAN 2
35#define AIMODE_SAMPLE 3
36
37#define NI_AI_SUBDEV 0
38#define NI_AO_SUBDEV 1
39#define NI_DIO_SUBDEV 2
40#define NI_8255_DIO_SUBDEV 3
41#define NI_UNUSED_SUBDEV 4
42#define NI_CALIBRATION_SUBDEV 5
43#define NI_EEPROM_SUBDEV 6
44#define NI_PFI_DIO_SUBDEV 7
45#define NI_CS5529_CALIBRATION_SUBDEV 8
46#define NI_SERIAL_SUBDEV 9
47#define NI_RTSI_SUBDEV 10
48#define NI_GPCT0_SUBDEV 11
49#define NI_GPCT1_SUBDEV 12
50#define NI_FREQ_OUT_SUBDEV 13
51#define NI_NUM_SUBDEVICES 14
52
53#define NI_GPCT_SUBDEV(x) ((x == 1) ? NI_GPCT1_SUBDEV : NI_GPCT0_SUBDEV)
54
55#define TIMEBASE_1_NS 50
56#define TIMEBASE_2_NS 10000
57
58#define SERIAL_DISABLED 0
59#define SERIAL_600NS 600
60#define SERIAL_1_2US 1200
61#define SERIAL_10US 10000
62
63/* PFI digital filtering options for ni m-series for use with
64 INSN_CONFIG_FILTER. */
65#define NI_PFI_FILTER_OFF 0x0
66#define NI_PFI_FILTER_125ns 0x1
67#define NI_PFI_FILTER_6425ns 0x2
68#define NI_PFI_FILTER_2550us 0x3
69
70/* Signals which can be routed to an NI PFI pin on an m-series board
71 with INSN_CONFIG_SET_ROUTING. These numbers are also returned by
72 INSN_CONFIG_GET_ROUTING on pre-m-series boards, even though their
73 routing cannot be changed. The numbers assigned are not arbitrary,
74 they correspond to the bits required to program the board. */
75#define NI_PFI_OUTPUT_PFI_DEFAULT 0
76#define NI_PFI_OUTPUT_AI_START1 1
77#define NI_PFI_OUTPUT_AI_START2 2
78#define NI_PFI_OUTPUT_AI_CONVERT 3
79#define NI_PFI_OUTPUT_G_SRC1 4
80#define NI_PFI_OUTPUT_G_GATE1 5
81#define NI_PFI_OUTPUT_AO_UPDATE_N 6
82#define NI_PFI_OUTPUT_AO_START1 7
83#define NI_PFI_OUTPUT_AI_START_PULSE 8
84#define NI_PFI_OUTPUT_G_SRC0 9
85#define NI_PFI_OUTPUT_G_GATE0 10
86#define NI_PFI_OUTPUT_EXT_STROBE 11
87#define NI_PFI_OUTPUT_AI_EXT_MUX_CLK 12
88#define NI_PFI_OUTPUT_GOUT0 13
89#define NI_PFI_OUTPUT_GOUT1 14
90#define NI_PFI_OUTPUT_FREQ_OUT 15
91#define NI_PFI_OUTPUT_PFI_DO 16
92#define NI_PFI_OUTPUT_I_ATRIG 17
93#define NI_PFI_OUTPUT_RTSI0 18
94#define NI_PFI_OUTPUT_PXI_STAR_TRIGGER_IN 26
95#define NI_PFI_OUTPUT_SCXI_TRIG1 27
96#define NI_PFI_OUTPUT_DIO_CHANGE_DETECT_RTSI 28
97#define NI_PFI_OUTPUT_CDI_SAMPLE 29
98#define NI_PFI_OUTPUT_CDO_UPDATE 30
99
100static inline unsigned int NI_PFI_OUTPUT_RTSI(unsigned rtsi_channel) {
101 return NI_PFI_OUTPUT_RTSI0 + rtsi_channel;
102}
103
104/* Ranges declarations */
105
106extern struct a4l_rngdesc a4l_range_ni_E_ai;
107extern struct a4l_rngdesc a4l_range_ni_E_ai_limited;
108extern struct a4l_rngdesc a4l_range_ni_E_ai_limited14;
109extern struct a4l_rngdesc a4l_range_ni_E_ai_bipolar4;
110extern struct a4l_rngdesc a4l_range_ni_E_ai_611x;
111extern struct a4l_rngdesc range_ni_E_ai_622x;
112extern struct a4l_rngdesc range_ni_E_ai_628x;
113extern struct a4l_rngdesc a4l_range_ni_S_ai_6143;
114extern struct a4l_rngdesc a4l_range_ni_E_ao_ext;
115
116/* Misc functions declarations */
117
118int a4l_ni_E_interrupt(unsigned int irq, void *d);
119int a4l_ni_E_init(struct a4l_device *dev);
120
121
122#endif /* !__ANALOGY_NI_MIO_H__ */