source: rtems/doc/bsp_howto/analog.t @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

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