Xenomai API  2.6.5
ni_mio.h
Go to the documentation of this file.
1 
21 #ifndef __ANALOGY_NI_MIO_H__
22 #define __ANALOGY_NI_MIO_H__
23 
24 /* Debug stuff */
25 
26 #ifdef CONFIG_DEBUG_MIO
27 #define MDPRINTK(fmt, args...) rtdm_printk(format, ##args)
28 #else /* !CONFIG_DEBUG_MIO */
29 #define MDPRINTK(fmt, args...)
30 #endif /* CONFIG_DEBUG_MIO */
31 
32 /* Subdevice related defines */
33 
34 #define AIMODE_NONE 0
35 #define AIMODE_HALF_FULL 1
36 #define AIMODE_SCAN 2
37 #define AIMODE_SAMPLE 3
38 
39 #define NI_AI_SUBDEV 0
40 #define NI_AO_SUBDEV 1
41 #define NI_DIO_SUBDEV 2
42 #define NI_8255_DIO_SUBDEV 3
43 #define NI_UNUSED_SUBDEV 4
44 #define NI_CALIBRATION_SUBDEV 5
45 #define NI_EEPROM_SUBDEV 6
46 #define NI_PFI_DIO_SUBDEV 7
47 #define NI_CS5529_CALIBRATION_SUBDEV 8
48 #define NI_SERIAL_SUBDEV 9
49 #define NI_RTSI_SUBDEV 10
50 #define NI_GPCT0_SUBDEV 11
51 #define NI_GPCT1_SUBDEV 12
52 #define NI_FREQ_OUT_SUBDEV 13
53 #define NI_NUM_SUBDEVICES 14
54 
55 #define NI_GPCT_SUBDEV(x) ((x == 1) ? NI_GPCT1_SUBDEV : NI_GPCT0_SUBDEV)
56 
57 #define TIMEBASE_1_NS 50
58 #define TIMEBASE_2_NS 10000
59 
60 #define SERIAL_DISABLED 0
61 #define SERIAL_600NS 600
62 #define SERIAL_1_2US 1200
63 #define SERIAL_10US 10000
64 
65 /* PFI digital filtering options for ni m-series for use with
66  INSN_CONFIG_FILTER. */
67 #define NI_PFI_FILTER_OFF 0x0
68 #define NI_PFI_FILTER_125ns 0x1
69 #define NI_PFI_FILTER_6425ns 0x2
70 #define NI_PFI_FILTER_2550us 0x3
71 
72 /* Signals which can be routed to an NI PFI pin on an m-series board
73  with INSN_CONFIG_SET_ROUTING. These numbers are also returned by
74  INSN_CONFIG_GET_ROUTING on pre-m-series boards, even though their
75  routing cannot be changed. The numbers assigned are not arbitrary,
76  they correspond to the bits required to program the board. */
77 #define NI_PFI_OUTPUT_PFI_DEFAULT 0
78 #define NI_PFI_OUTPUT_AI_START1 1
79 #define NI_PFI_OUTPUT_AI_START2 2
80 #define NI_PFI_OUTPUT_AI_CONVERT 3
81 #define NI_PFI_OUTPUT_G_SRC1 4
82 #define NI_PFI_OUTPUT_G_GATE1 5
83 #define NI_PFI_OUTPUT_AO_UPDATE_N 6
84 #define NI_PFI_OUTPUT_AO_START1 7
85 #define NI_PFI_OUTPUT_AI_START_PULSE 8
86 #define NI_PFI_OUTPUT_G_SRC0 9
87 #define NI_PFI_OUTPUT_G_GATE0 10
88 #define NI_PFI_OUTPUT_EXT_STROBE 11
89 #define NI_PFI_OUTPUT_AI_EXT_MUX_CLK 12
90 #define NI_PFI_OUTPUT_GOUT0 13
91 #define NI_PFI_OUTPUT_GOUT1 14
92 #define NI_PFI_OUTPUT_FREQ_OUT 15
93 #define NI_PFI_OUTPUT_PFI_DO 16
94 #define NI_PFI_OUTPUT_I_ATRIG 17
95 #define NI_PFI_OUTPUT_RTSI0 18
96 #define NI_PFI_OUTPUT_PXI_STAR_TRIGGER_IN 26
97 #define NI_PFI_OUTPUT_SCXI_TRIG1 27
98 #define NI_PFI_OUTPUT_DIO_CHANGE_DETECT_RTSI 28
99 #define NI_PFI_OUTPUT_CDI_SAMPLE 29
100 #define NI_PFI_OUTPUT_CDO_UPDATE 30
101 
102 static inline unsigned int NI_PFI_OUTPUT_RTSI(unsigned rtsi_channel) {
103  return NI_PFI_OUTPUT_RTSI0 + rtsi_channel;
104 }
105 
106 /* Ranges declarations */
107 
108 extern a4l_rngdesc_t a4l_range_ni_E_ai;
109 extern a4l_rngdesc_t a4l_range_ni_E_ai_limited;
110 extern a4l_rngdesc_t a4l_range_ni_E_ai_limited14;
111 extern a4l_rngdesc_t a4l_range_ni_E_ai_bipolar4;
112 extern a4l_rngdesc_t a4l_range_ni_E_ai_611x;
113 extern a4l_rngdesc_t range_ni_E_ai_622x;
114 extern a4l_rngdesc_t range_ni_E_ai_628x;
115 extern a4l_rngdesc_t a4l_range_ni_S_ai_6143;
116 extern a4l_rngdesc_t a4l_range_ni_E_ao_ext;
117 
118 /* Misc functions declarations */
119 
120 int a4l_ni_E_interrupt(unsigned int irq, void *d);
121 int a4l_ni_E_init(a4l_dev_t *dev);
122 
123 
124 #endif /* !__ANALOGY_NI_MIO_H__ */