1 |
786 |
skrzyp |
# ====================================================================
|
2 |
|
|
#
|
3 |
|
|
# adc_synth.cdl
|
4 |
|
|
#
|
5 |
|
|
# eCos Synthetic ADC configuration data
|
6 |
|
|
#
|
7 |
|
|
# ====================================================================
|
8 |
|
|
## ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
## -------------------------------------------
|
10 |
|
|
## This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
## Copyright (C) 2009 Free Software Foundation, Inc.
|
12 |
|
|
##
|
13 |
|
|
## eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
## the terms of the GNU General Public License as published by the Free
|
15 |
|
|
## Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
## version.
|
17 |
|
|
##
|
18 |
|
|
## eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
## for more details.
|
22 |
|
|
##
|
23 |
|
|
## You should have received a copy of the GNU General Public License
|
24 |
|
|
## along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
##
|
27 |
|
|
## As a special exception, if other files instantiate templates or use
|
28 |
|
|
## macros or inline functions from this file, or you compile this file
|
29 |
|
|
## and link it with other works to produce a work based on this file,
|
30 |
|
|
## this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
## the GNU General Public License. However the source code for this file
|
32 |
|
|
## must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
## General Public License v2.
|
34 |
|
|
##
|
35 |
|
|
## This exception does not invalidate any other reasons why a work based
|
36 |
|
|
## on this file might be covered by the GNU General Public License.
|
37 |
|
|
## -------------------------------------------
|
38 |
|
|
## ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
# ====================================================================
|
40 |
|
|
######DESCRIPTIONBEGIN####
|
41 |
|
|
#
|
42 |
|
|
# Author(s): Simon Kallweit
|
43 |
|
|
# Contributors:
|
44 |
|
|
# Date: 2009-02-27
|
45 |
|
|
#
|
46 |
|
|
#####DESCRIPTIONEND####
|
47 |
|
|
#
|
48 |
|
|
# ====================================================================
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
cdl_package CYGPKG_DEVS_ADC_SYNTH {
|
52 |
|
|
display "Synthetic ADC device driver"
|
53 |
|
|
|
54 |
|
|
parent CYGPKG_IO_ADC_DEVICES
|
55 |
|
|
active_if CYGPKG_IO_ADC_DEVICES
|
56 |
|
|
active_if CYGPKG_HAL_SYNTH
|
57 |
|
|
requires {CYGNUM_IO_ADC_SAMPLE_SIZE >= CYGNUM_DEVS_ADC_SYNTH_SAMPLE_SIZE}
|
58 |
|
|
description "
|
59 |
|
|
This option enables the ADC device drivers for Synthetic target."
|
60 |
|
|
|
61 |
|
|
include_dir cyg/io
|
62 |
|
|
compile -library=libextras.a adc_synth.c
|
63 |
|
|
|
64 |
|
|
cdl_interface CYGINT_DEVS_ADC_SYNTH_CHANNELS {
|
65 |
|
|
display "Number of ADC channels"
|
66 |
|
|
}
|
67 |
|
|
|
68 |
|
|
cdl_option CYGNUM_DEVS_ADC_SYNTH_SAMPLE_SIZE {
|
69 |
|
|
display "Sample size"
|
70 |
|
|
flavor data
|
71 |
|
|
legal_values 1 to 32
|
72 |
|
|
default_value 16
|
73 |
|
|
description "
|
74 |
|
|
Sample size provided by the ADC channels."
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
cdl_option CYGNUM_DEVS_ADC_SYNTH_DEFAULT_RATE {
|
78 |
|
|
display "Default sample rate"
|
79 |
|
|
flavor data
|
80 |
|
|
legal_values 1 to 10000
|
81 |
|
|
default_value 100
|
82 |
|
|
description "
|
83 |
|
|
The driver will be initialized with the default sample rate.
|
84 |
|
|
If you raise the default sample rate you might need to increase
|
85 |
|
|
the buffer size for each channel."
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
# Support 16 channels
|
89 |
|
|
for { set ::channel 0 } { $::channel < 16 } { incr ::channel } {
|
90 |
|
|
|
91 |
|
|
cdl_component CYGHWR_DEVS_ADC_SYNTH_CHANNEL[set ::channel] {
|
92 |
|
|
display "ADC channel [set ::channel]"
|
93 |
|
|
flavor none
|
94 |
|
|
implements CYGINT_DEVS_ADC_SYNTH_CHANNELS
|
95 |
|
|
description "
|
96 |
|
|
If the application needs to access the ADC
|
97 |
|
|
channel [set ::channel] via an eCos ADC driver then
|
98 |
|
|
this option should be enabled."
|
99 |
|
|
|
100 |
|
|
cdl_option CYGDAT_DEVS_ADC_SYNTH_CHANNEL[set ::channel]_NAME {
|
101 |
|
|
display "Device name"
|
102 |
|
|
flavor data
|
103 |
|
|
default_value [format {"\"/dev/adc0%d\""} $::channel]
|
104 |
|
|
description "
|
105 |
|
|
This option controls the name that an eCos application
|
106 |
|
|
should use to access this device via cyg_io_lookup(),
|
107 |
|
|
open(), or similar calls."
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
cdl_option CYGNUM_DEVS_ADC_SYNTH_CHANNEL[set ::channel]_BUFSIZE {
|
111 |
|
|
display "Size of data buffer"
|
112 |
|
|
flavor data
|
113 |
|
|
legal_values 1 to 65536
|
114 |
|
|
default_value 128
|
115 |
|
|
description "
|
116 |
|
|
This option controls the number of samples the
|
117 |
|
|
buffer can store. The required RAM is = size of
|
118 |
|
|
data buffer * size of sample."
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
cdl_option CYGDAT_DEVS_ADC_SYNTH_CHANNEL[set ::channel]_SOURCE {
|
122 |
|
|
display "Channel source"
|
123 |
|
|
flavor data
|
124 |
|
|
legal_values { "CONST" "RANDOM" "FILE" }
|
125 |
|
|
default_value { "CONST" }
|
126 |
|
|
description "
|
127 |
|
|
This option controls the sample source of the virtual ADC
|
128 |
|
|
channel. CONST mode always returns a constant sample value.
|
129 |
|
|
RANDOM mode returns random samples. FILE returns samples as
|
130 |
|
|
read by a file on the host."
|
131 |
|
|
}
|
132 |
|
|
|
133 |
|
|
cdl_option CYGNUM_DEVS_ADC_SYNTH_CHANNEL[set ::channel]_CONST_VALUE {
|
134 |
|
|
display "Constant sample value"
|
135 |
|
|
flavor data
|
136 |
|
|
default_value 0
|
137 |
|
|
description "
|
138 |
|
|
Constant sample value returned when CONST mode is selected."
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
cdl_option CYGDAT_DEVS_ADC_SYNTH_CHANNEL[set ::channel]_FILENAME {
|
142 |
|
|
display "Sample data filename"
|
143 |
|
|
flavor data
|
144 |
|
|
default_value [format {"\"adc0%d\""} $::channel]
|
145 |
|
|
description "
|
146 |
|
|
Filename of sample data file used in FILE mode."
|
147 |
|
|
}
|
148 |
|
|
|
149 |
|
|
cdl_option CYGNUM_DEVS_ADC_SYNTH_CHANNEL[set ::channel]_MODE {
|
150 |
|
|
display "Channel mode"
|
151 |
|
|
flavor data
|
152 |
|
|
calculated CYGDAT_DEVS_ADC_SYNTH_CHANNEL[set ::channel]_SOURCE == { "CONST" } ? 0 : \
|
153 |
|
|
CYGDAT_DEVS_ADC_SYNTH_CHANNEL[set ::channel]_SOURCE == { "RANDOM" } ? 1 : \
|
154 |
|
|
CYGDAT_DEVS_ADC_SYNTH_CHANNEL[set ::channel]_SOURCE == { "FILE" } ? 2 : -1
|
155 |
|
|
}
|
156 |
|
|
}
|
157 |
|
|
}
|
158 |
|
|
}
|