source: multiio/rtd6425/rtd6425.h @ d35032f

Last change on this file since d35032f was d35032f, checked in by Joel Sherrill <joel.sherrill@…>, on 10/05/11 at 18:09:53

2011-10-05 Joel Sherrill <joel.sherrill@…>

  • .cvsignore, ChangeLog?, Makefile, multiio_rtd6425.c, rtd6425.c, rtd6425.h: New files.
  • Property mode set to 100644
File size: 4.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#ifndef __RTD6425_h
13#define __RTD6425_h
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19
20/* These are the error codes for mio_error_code */
21
22#define MIO_SUCCESS 0
23#define MIO_OPEN_ERROR 1
24#define MIO_TIMEOUT_ERROR 2
25#define MIO_BAD_CHANNEL_NUMBER 3
26#define MIO_BAD_MODE_NUMBER 4
27#define MIO_BAD_RANGE 5
28#define MIO_COMMAND_WRITE_FAILURE 6
29#define MIO_READ_DATA_FAILURE 7
30#define MIO_MISSING_IRQ 8
31#define MIO_ILLEGAL_VOLTAGE 9
32
33/*
34 *  Configuration information for multiio interface
35 */
36#define RTD6425_DISCRETE_IO_BITS 31
37#define RTD6425_ADCs             32  /* 0 based for single ended */
38#define RTD6425_DACs             3   /* 0 based for 4 DACs */
39
40#define RTD6425_VOLTAGE_MAXIMUM  10.0
41#define RTD6425_VOLTAGE_MINIMUM  -10.0
42
43/*
44 *  Register offsets
45 */
46#define RTD6425_CLEAR                0  // Clear Register (Read/Write)
47#define RTD6425_STATUS               2  // Status Register (Read)
48#define RTD6425_CONTROL              2  // Control Register (Write)
49#define RTD6425_AD                   4  // AD Data (Read)
50#define RTD6425_CHANNEL_GAIN         4  // Channel/Gain Register (Write)
51#define RTD6425_AD_TABLE             4  // AD Table (Write)
52#define RTD6425_DIGITAL_TABLE        4  // Digital Table (Write)
53#define RTD6425_START_CONVERSION     6  // Start Conversion (Read)
54#define RTD6425_TRIGGER              6  // Trigger Register (Write)
55#define RTD6425_IRQ                  8  // IRQ Register (Write)
56#define RTD6425_DIN_FIFO             10 // Digital Input FIFO Data (Read)
57#define RTD6425_DIN_CONFIG           10 // Config Digital Input FIFO (Write)
58#define RTD6425_LOAD_AD_SAMPLE_COUNT 14 // Load A/D Sample Counter (Read)
59#define RTD6425_TIMER_CLCK0          16 // Timer/Counter 0 (Read/Write)
60#define RTD6425_TIMER_CLCK1          18 // Timer/Counter 1 (Read/Write)
61#define RTD6425_TIMER_CLCK2          20 // Timer/Counter 2 (Read/Write)
62#define RTD6425_TIMER_CTRL           22 // Timer/Counter Control Word (Write)
63
64#define RTD6425_PORT_0_5812          24 // Digital I/O Port 0 Register
65#define RTD6425_PORT_1_5812          26 // Digital I/O Port 1 Register
66#define RTD6425_PORT_DIR_5812        28 // Digital I/O Port 0 Direction Register
67#define RTD6425_PORT_MASK_5812       28 // Digital I/O Port 0 Mask Register
68#define RTD6425_PORT_COMP_5812       28 // Digital I/O Port 0 Compare Register
69#define RTD6425_CLEAR_5812           28 // Digital I/O Clear Register
70#define RTD6425_STATUS_5812          30 // Digital I/O Status Register
71#define RTD6425_MODE_5812            30 // Digital I/O Mode Register
72
73
74#define RTD6425_DA_SETUP             0x400
75#define RTD6425_DA_SIMULT            0x402
76#define RTD6425_DAC_BASE             0x404
77#define RTD6425_ANTRIG_SETUP         0x410
78
79#define RTD6425_RTD_ID_BA            0x800   // base address of RTD ID hardware
80#define RTD6425_SRAM                 0xC00
81
82/*
83 *  DAC Range Select Constants
84 */
85#define RTD6425_DAC_MINUS_5V_TO_5V    0
86#define RTD6425_DAC_0V_to_5V          1
87#define RTD6425_DAC_MINUS_10_TO_10V   2
88#define RTD6425_DAC_0V_TO_10V         3
89
90
91#ifdef LIB_DEFINED
92
93/* These are used by the library functions */
94
95int mio_error_code;
96char mio_error_string[128];
97#endif
98
99void rtd6425_initialize(
100  unsigned short _base_port,
101  unsigned short _irq1,
102  unsigned short  irq2
103);
104
105int rtd6425_enable_dio_interrupt(void);
106
107int rtd6425_dio_enab_bit_int(int bit_number, int polarity);
108
109void rtd6425_flush_buffered_ints(void);
110
111int  rtd6425_wait_dac_int_with_timeout(int dac_num, int milliseconds);
112
113int  rtd6425_wait_dio_int_with_timeout(int milliseconds);
114
115int  rtd6425_wait_dio_int_with_timestamp(
116  int              milliseconds,
117  struct timespec *timestamp
118);
119
120int rtd6425_dio_get_missed_interrupts(void);
121
122float rtd6425_adc_get_channel_voltage(int channel);
123
124int rtd6425_set_dac_voltage(int channel, float voltage);
125
126int rtd6425_dio_read_bit(int bit_number);
127
128int rtd6425_dio_write_bit(int bit_number, int val);
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif
135/* end of include file */
Note: See TracBrowser for help on using the repository browser.