1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
# ====================================================================
#
# adc_at91.cdl
#
# eCos AT91 ADC configuration data
#
# ====================================================================
## ####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 2008 Free Software Foundation, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later
## version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License
## along with eCos; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## As a special exception, if other files instantiate templates or use
## macros or inline functions from this file, or you compile this file
## and link it with other works to produce a work based on this file,
## this file does not by itself cause the resulting work to be covered by
## the GNU General Public License. However the source code for this file
## must still be made available in accordance with section (3) of the GNU
## General Public License v2.
##
## This exception does not invalidate any other reasons why a work based
## on this file might be covered by the GNU General Public License.
## -------------------------------------------
## ####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): ccoutand@stmi.com
# Contributors:
# Date: 2010-02-12
#
#####DESCRIPTIONEND####
#
# ====================================================================
cdl_package CYGPKG_DEVS_ADC_ARM_AT91 {
display "ADC hardware device driver for AT91 family of ARM controllers"
parent CYGPKG_IO_ADC_DEVICES
active_if CYGPKG_IO_ADC_DEVICES
active_if CYGPKG_HAL_ARM_AT91
description "
This package provides a generic ADC device driver for the on-chip
ADC peripherals in AT91 processors."
include_dir cyg/io
compile -library=libextras.a adc_at91.c
define_proc {
puts $::cdl_system_header "#define CYGDAT_DEVS_ADC_ARM_AT91_INL <cyg/io/adc_at91.inl>"
}
#
# Primary ADC ( ADC0 )
#
cdl_component CYGPKG_DEVS_ADC_ARM_AT91_ADC0 {
display "Atmel AT91 ADC port 0 driver"
flavor bool
default_value 1
description "
This option includes the device driver for the on-chip ADC 0 of the
AT91 processors"
cdl_interface CYGINT_DEVS_ADC_ARM_AT91_ADC0_CHANNELS {
display "Number of ADC0 channels"
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC0_SELECT_TIMER {
display "Interrupt priority"
flavor data
legal_values {0 1 2}
default_value 1
description "
This option selects the timer channel to be used for
generating the sampling interval. Timer channel 0 can
be assigned as Real Time Kernel clock so timer channel
1 is set to be the default value."
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC0_PRESCAL {
display "ADC clock setting"
flavor data
legal_values 0 to 255
default_value 128
description "
This option sets the AT91 ADC PRESCAL value.
ADCClock = MCK / ((PRESCAL + 1) * 2)"
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC0_STARTUP_TIME {
display "ADC start-up time"
flavor data
legal_values 0 to 255
default_value 128
description "
This option sets the AT91 ADC start-up time value.
ADC start-up time = (STARTUP+1) * 8 / ADCClock"
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC0_SHTIM {
display "ADC start up time"
flavor data
legal_values 0 to 15
default_value 7
description "
This option sets the AT91 ADC Sample and Hold Time.
Sample and Hold Time = SHTIM / ADCClock"
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC0_INTPRIO {
display "Interrupt priority"
flavor data
legal_values 0 to 15
default_value 15
description "
This option selects the interrupt priority for the ADC
interrupts. Timer x is used for generating the sample
clock. So this option configures the interrupt priority
for timer x. There are 16 priority levels corresponding to
the values 0 through 15 decimal, of which 15 is the lowest
priority. The reset value of these registers defaults all
interrupts to the lowest priority, allowing a single write
to elevate the priority of an individual interrupt."
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC0_DEFAULT_RATE {
display "Default sample rate"
flavor data
legal_values 1 to 10000
default_value 100
description "
The driver will be initialized with the default sample rate.
If you raise the default sample rate you might need to increase
the buffer size for each channel."
}
# Support up to 8 ADC channels
for { set ::channel 0 } { $::channel < 8 } { incr ::channel } {
cdl_component CYGPKG_DEVS_ADC_ARM_AT91_ADC0_CHANNEL[set ::channel] {
display "Access ADC channel [set ::channel]"
flavor bool
default_value [set ::channel] == 0
implements CYGINT_DEVS_ADC_ARM_AT91_ADC0_CHANNELS
description "
If the application needs to access the on-chip ADC
channel [set ::channel] via an eCos ADC driver then
this option should be enabled."
cdl_option CYGDAT_DEVS_ADC_ARM_AT91_ADC0_CHANNEL[set ::channel]_NAME {
display "Device name"
flavor data
default_value [format {"\"/dev/adc0%d\""} $::channel]
description "
This option controls the name that an eCos application
should use to access this device via cyg_io_lookup(),
open(), or similar calls."
}
cdl_option CYGDAT_DEVS_ADC_ARM_AT91_ADC0_CHANNEL[set ::channel]_BUFSIZE {
display "Size of data buffer"
flavor data
legal_values 0x01 to 0x2000000
default_value 512
description "
This option controls the number of samples the
buffer can store. The required RAM depends on the
sample size and on the number of samples. If the
sample size is <= 8 bit the the required RAM =
size of data buffer. If the sample size is 9 or 10
bit then required RAM = size of data buffer * 2."
}
}
}
}
#
# ADC1
#
cdl_component CYGPKG_DEVS_ADC_ARM_AT91_ADC1 {
display "Atmel AT91 ADC port 1 driver"
flavor bool
default_value 0
requires { CYGHWR_HAL_ARM_AT91 == "M55800A" }
description "
This option includes the device driver for the on-chip ADC 1 of the
AT91 processors"
cdl_interface CYGINT_DEVS_ADC_ARM_AT91_ADC1_CHANNELS {
display "Number of ADC1 channels"
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC1_SELECT_TIMER {
display "Interrupt priority"
flavor data
legal_values {0 1 2}
default_value 2
description "
This option selects the timer channel to be used for
generating the sampling interval. Timer channel 0 can
be assigned as Real Time Kernel clock so timer channel
1 is set to be the default value."
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC1_PRESCAL {
display "ADC clock setting"
flavor data
legal_values 0 to 255
default_value 128
description "
This option sets the AT91 ADC PRESCAL value.
ADCClock = MCK / ((PRESCAL + 1) * 2)"
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC1_STARTUP_TIME {
display "ADC start-up time"
flavor data
legal_values 0 to 255
default_value 128
description "
This option sets the AT91 ADC start-up time value.
ADC start-up time = (STARTUP+1) * 8 / ADCClock"
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC1_SHTIM {
display "ADC start up time"
flavor data
legal_values 0 to 15
default_value 7
description "
This option sets the AT91 ADC Sample and Hold Time.
Sample and Hold Time = SHTIM / ADCClock"
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC1_INTPRIO {
display "Interrupt priority"
flavor data
legal_values 0 to 15
default_value 15
description "
This option selects the interrupt priority for the ADC
interrupts. Timer x is used for generating the sample
clock. So this option configures the interrupt priority
for timer x. There are 16 priority levels corresponding to
the values 0 through 15 decimal, of which 15 is the lowest
priority. The reset value of these registers defaults all
interrupts to the lowest priority, allowing a single write
to elevate the priority of an individual interrupt."
}
cdl_option CYGNUM_DEVS_ADC_ARM_AT91_ADC1_DEFAULT_RATE {
display "Default sample rate"
flavor data
legal_values 1 to 10000
default_value 100
description "
The driver will be initialized with the default sample rate.
If you raise the default sample rate you might need to increase
the buffer size for each channel."
}
# Support up to 8 ADC channels
for { set ::channel 0 } { $::channel < 8 } { incr ::channel } {
cdl_component CYGPKG_DEVS_ADC_ARM_AT91_ADC1_CHANNEL[set ::channel] {
display "Access ADC channel [set ::channel]"
flavor bool
default_value [set ::channel] == 0
implements CYGINT_DEVS_ADC_ARM_AT91_ADC1_CHANNELS
description "
If the application needs to access the on-chip ADC
channel [set ::channel] via an eCos ADC driver then
this option should be enabled."
cdl_option CYGDAT_DEVS_ADC_ARM_AT91_ADC1_CHANNEL[set ::channel]_NAME {
display "Device name"
flavor data
default_value [format {"\"/dev/adc1%d\""} $::channel]
description "
This option controls the name that an eCos application
should use to access this device via cyg_io_lookup(),
open(), or similar calls."
}
cdl_option CYGDAT_DEVS_ADC_ARM_AT91_ADC1_CHANNEL[set ::channel]_BUFSIZE {
display "Size of data buffer"
flavor data
legal_values 0x01 to 0x2000000
default_value 512
description "
This option controls the number of samples the
buffer can store. The required RAM depends on the
sample size and on the number of samples. If the
sample size is <= 8 bit the the required RAM =
size of data buffer. If the sample size is 9 or 10
bit then required RAM = size of data buffer * 2."
}
}
}
}
cdl_option CYGPKG_DEVS_ADC_ARM_AT91_DEBUG_LEVEL {
display "Driver debug output level"
flavor data
legal_values {0 1}
default_value 0
description "
This option specifies the level of debug data output by
the AT91 ADC device driver. A value of 0 signifies
no debug data output; 1 signifies normal debug data
output. If an overrun occurred then this can only be
detected by debug output messages."
}
cdl_component CYGSEM_DEVS_ADC_ARM_AT91_SAMPLE_SIZE_LIMIT {
display "Sample size limit"
flavor bool
calculated 1
requires { ( CYGNUM_IO_ADC_SAMPLE_SIZE == 8 )
|| ( CYGNUM_IO_ADC_SAMPLE_SIZE == 10 ) }
description "
This component forces a limit (or rounds) the sample
size for AT91 ADC channels which in the most are 10-bit."
}
cdl_option CYGPKG_DEVS_ADC_ARM_AT91_TESTS {
display "Tests for AT91 ADC driver"
flavor data
no_define
calculated { "tests/at91_adc_test" }
description "
This option specifies the set of tests for the AT91
ADC device driver."
}
}
|