Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 99 lines (90 sloc) 3.611 kb
85629787 »
2010-03-16 first cut
1 /*
2 *
3 * This is free software, written by Richard B. Johnson. It is
4 * presumed to be correct but it is not warranted to do anything
5 * useful. Therefore, one must use this at their own peril since
6 * it is possible for any kernel code to corrupt a machine and
7 * destroy valuable property existing on storage media.
8 *
9 * This software is Copyright(c) 2003, by Richard B. Johnson
10 * Everybody is granted a non-exclusive license to use this
11 * software for any purpose. However, you are required to retain
12 * the author's name within this source-code.
13 */
14
15 #ifndef _ADC_BOARD_H_
16 #define _ADC_BOARD_H_
17 #define DEV_MAJOR 177
18 #define CLOCK 10000000 /* 1 MHz clock on the board */
19 #define FILT_COEF 0x20 /* Default value For IIR filter */
20
21 /*
22 * This template is the order and kind of data returned from the
23 * ioctl() function, ADC_READ_MULTI. You get all the channels,
24 * all at once.
25 */
26
27 struct adc_multi {
28 int chan00;
29 int chan01;
30 int chan02;
31 int chan03;
32 int chan04;
33 int chan05;
34 int chan06;
35 int chan07;
36 int chan08;
37 int chan09;
38 int chan0a;
39 int chan0b;
40 int chan0c;
41 int chan0d;
42 int chan0e;
43 int chan0f;
44 };
45
46 /*
47 * This is a template for the data that is passed to the ioctl()
48 * function, ADC_POINT_LIST.
49 * The filter coefficient must be 1 or greater.
50 * The input parameter is the logical OR of the bits shown in
51 * the documentation to configure the input channel. Bits
52 * MA0 through MA3 are ignored. The channels are configured
53 * in order, zero through fifteen.
54 */
55
56 typedef struct {
57 int input; /* Input setup from offset 2 ADC/Control */
58 int filter; /* Filter coefficient for this channel */
59 } ADC_LIST;
60
61 struct adc_list {
62 ADC_LIST list[0x10]; /* Sixteen of these, one for each channel */
63 };
64 /*
65 * These are the supported functions, used as the second parameter of
66 * an ioctl() call.
67 */
68 #define ADC_SINGLE_CHAN 0x00 /* Acquire data from chan set in 0x05 */
69 #define ADC_MULTI_CHAN 0x01 /* Acquire filtered data from all */
70 #define ADC_READ_MULTI 0x02 /* Read all filtered data */
71 #define ADC_SET_FILTER 0x03 /* Set filter coefficient */
72 #define ADC_SET_TIMER 0x04 /* Set timer rate microseconds */
73 #define ADC_SET_CHAN 0x05 /* Set for single channel operation */
74 #define ADC_DIAGS 0x06 /* Hook to see what's going on */
75 #define ADC_POINT_LIST 0x07 /* Warning! Read the manual! */
76 #define ADC_GET_INTRS 0x08 /* Return interrupt count */
77 /*
78 * These set the input range and configuration.
79 */
80 #define ADC_BIP_10 0x09 /* Biploar -10V to + 10V */
81 #define ADC_BIP_05 0x0a /* Bipolar -5V to +5V */
82 #define ADC_BIP_2d5 0x0b /* Bipolar -2.5V to + 2.5V */
83 #define ADC_BIP_1d25 0x0c /* Bipolar -1.25 to + 1.25V */
84 #define ADC_UNI_10 0x0d /* Unipolar 0 to 10V */
85 #define ADC_UNI_05 0x0e /* Unipolar 0 to 5V */
86 #define ADC_UNI_1d25 0x0f /* Unipolar 1.25 to 3.75 V */
87 #define ADC_UNI_6d25 0x10 /* Unipolar 1.25 to 6.25 V */
88 /*
89 * These bits are defined in the instruction manual for offset 2
90 * write. These are used in the ADC_POINT_LIST ioctl() function.
91 */
92 #define ADC_R0 0x01
93 #define ADC_R1 0x02
94 #define ADC_R2 0x04
95 #define ADC_DIFF 0x08
96
97 #endif
98
Something went wrong with that request. Please try again.