source: rtems/doc/bsp_howto/analog.t @ 0660b4f8

4.104.114.84.95
Last change on this file since 0660b4f8 was 0660b4f8, checked in by Joel Sherrill <joel.sherrill@…>, on 11/16/99 at 19:50:56

Changed copyright date to 1999.

  • Property mode set to 100644
File size: 6.0 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1999.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter Analog Driver
10
11The Analog driver is responsible for providing an
12interface to Digital to Analog Converters (DACs) and
13Analog to Digital Converters (ADCs).  The capabilities provided
14by this class of device driver are:
15
16@itemize @bullet
17@item Initialize an Analog Board
18@item Open a Particular Analog
19@item Close a Particular Analog
20@item Read from a Particular Analog
21@item Write to a Particular Analog
22@item Reset DACs
23@item Reinitialize DACS
24@end itemize
25
26Most analog devices are found on I/O cards that support multiple
27DACs or ADCs on a single card.
28
29There are currently no analog device drivers included in the
30RTEMS source tree.  The information provided in this chapter
31is based on drivers developed by OAR Corporation personnel
32for applications using RTEMS.   It is hoped that this
33driver model information can form the basis for a standard
34analog driver model that can be supported in future RTEMS
35distribution.
36
37@section Major and Minor Numbers
38
39The @b{major} number of a device driver is its index in the
40RTEMS Device Address Table.
41
42A @b{minor} number is associated with each device instance
43managed by a particular device driver.  An RTEMS minor number
44is an @code{unsigned32} entity.  Convention calls
45dividing the bits in the minor number down into categories
46like the following:
47
48@itemize @bullet
49
50@item @b{board} - indicates the board a particular device is located on
51@item @b{port} - indicates the particular device on a board.
52
53@end itemize
54
55From the above, it should be clear that a single device driver
56can support multiple copies of the same board in a single system.
57The minor number is used to distinguish the devices.
58
59@section Analog Driver Configuration
60
61There is not a standard analog driver configuration table but some
62fields are common across different drivers.  The analog driver
63configuration table is typically an array of structures with each
64structure containing the information for a particular board.
65The following is a list of the type of information normally required
66to configure an analog board:
67
68@table @b
69@item board_offset
70is the base address of a board.
71
72@item DAC_initial_values
73is an array of the voltages that should be written to each DAC
74during initialization.  This allows the driver to start the board
75in a known state.
76
77@end table
78
79@section Initialize an Analog Board
80
81At system initialization, the analog driver's initialization entry point
82will be invoked.  As part of initialization, the driver will perform
83whatever board initialization is required and then set all
84outputs to their configured initial state.
85
86The analog driver may register a device name for each DAC and ADC in
87the system.
88
89@section Open a Particular Analog
90
91This is the driver open call.  Usually this call does nothing other than
92validate the minor number. 
93
94With some drivers, it may be necessary to allocate memory when a particular
95device is opened.  If that is the case, then this is often the place
96to do this operation.
97
98@section Close a Particular Analog
99
100This is the driver close call.  Usually this call does nothing.
101
102With some drivers, it may be necessary to allocate memory when a particular
103device is opened.  If that is the case, then this is the place
104where that memory should be deallocated.
105
106@section Read from a Particular Analog
107
108This corresponds to the driver read call.  After validating the minor
109number and arguments, this call reads the indicated device.  Most analog
110devices store the last value written to a DAC.  Since DACs are output
111only devices, saving the last written value gives the appearance that
112DACs can be read from also.  If the device is an ADC, then it is sampled.
113
114@b{NOTE:} Many boards have multiple analog inputs but only one ADC.  On
115these boards, it will be necessary to provide some type of mutual exclusion
116during reads.  On these boards, there is a MUX which must be switched
117before sampling the ADC.  After the MUX is switched, the driver must
118delay some short period of time (usually microseconds) before the
119signal is stable and can be sampled.  To make matters worse, some ADCs
120cannot respond to wide voltage swings in a single sample.  On these
121ADCs, one must do two samples when the voltage swing is too large.
122On a practical basis, this means that the driver usually ends up
123double sampling the ADC on these systems.
124
125The value returned is a single precision floating point number
126representing the voltage read.  This value is stored in the
127@code{argument_block} passed in to the call.  By returning the
128voltage, the caller is freed from having to know the number of
129bits in the analog and board dependent conversion algorithm.
130
131@section Write to a Particular Analog
132
133This corresponds to the driver write call.  After validating the minor
134number and arguments, this call writes the indicated device.  If the
135specified device is an ADC, then an error is usually returned. 
136
137The value written is a single precision floating point number
138representing the voltage to be written to the specified DAC. 
139This value is stored in the @code{argument_block} passed in to the
140call.  By passing the voltage to the device driver, the caller is
141freed from having to know the number of bits in the analog
142and board dependent conversion algorithm.
143
144@section Reset DACs
145
146This is one of the IOCTL functions supported by the I/O control
147device driver entry point.  When this IOCTL function is invoked,
148all of the DACs are written to 0.0 volts.
149
150@section Reinitialize DACS
151
152This is one of the IOCTL functions supported by the I/O control
153device driver entry point.  When this IOCTL function is invoked,
154all of the DACs are written with the initial value configured
155for this device.
156
157@section Get Last Written Values
158
159This is one of the IOCTL functions supported by the I/O control
160device driver entry point.  When this IOCTL function is invoked,
161the following information is returned to the caller:
162
163@itemize @bullet
164@item last value written to the specified DAC
165@item timestamp of when the last write was performed
166@end itemize
167
Note: See TracBrowser for help on using the repository browser.