* [ECOS] CDL/TCL issue building macro names in loops
@ 2013-03-28 16:32 Richard Rauch
2013-03-28 17:10 ` [ECOS] " John Dallaway
0 siblings, 1 reply; 2+ messages in thread
From: Richard Rauch @ 2013-03-28 16:32 UTC (permalink / raw)
To: ecos-discuss
Hi all,
is there an expert for CDL/TCL language?
I have problems with creating macro name dynamically with TCL language.
I have to implement an ADC driver. I want to create the list of channels.
Because the large number of channels (10 internal channel with ACT value,
MIN value and MAX value and 15 external channels) I want to create the
channel list more convenient.
The following code (some excerpt of my CDL script) works already good, but
it is not matching my requirements completely:
#---------------------------------------------------------------------------
----------------------------------------
set SensorList { temp vccint vccaux vpvn vrefp vrefn vccbram vccpint vccpaux
vcc0ddr } foreach Sensor $SensorList {
cdl_component CYGNUM_DEVS_ADC_ARM_XC7Z_ONCHIP_$Sensor {
parent CYGNUM_DEVS_ADC_ARM_XC7Z_ONCHIP_SENSORS
display "on-chip $Sensor"
flavor none
description "XADC on-chip $Sensor sensor
measurement"
cdl_option
CYGDAT_DEVS_ADC_ARM_XC7Z_CHANNEL_NAME_ONCHIP_ACT_$Sensor {
display "Device name"
flavor data
default_value [format
{"\"/dev/xadc_act_%s\""} $Sensor ]
description "
This option controls the
name that an eCos application
should use to access this
device via cyg_io_lookup(),
open(), or similar calls."
}
.
.
.
#---------------------------------------------------------------------------
-----------------------------------------
The $Sensor symbol is replaced in the code for each loop correctly.
But it works only, when $Sensor is separated by blanks or if it is at end of
string.
It is NOT working, when I place it inside the MACRO Name: e.g.
CYGDAT_DEVS_ADC_ARM_XC7Z_CHANNEL_ONCHIP_$Sensor _ACT_NAME I have tried
different syntax approaches...e..g "$$", $ at beginning and end of symbol,
put into "[...]", but no success! Is this possible anyhow? And what is the
correct syntax?
Further I want to use string functions "string toupper" and "string
tolower". In Macro Names I want to convert to upper, in device name I want
to convert to lower (which would match the naming conventions).
But this is not working too. I tried e.g [string tolower ($Sensor)] or [expr
string tolower($Sensor)] and a lot of other variants. But I always get
syntax errors.
Any ideas, what is wrong?
Thanks
Richard
ITR GmbH
web: http://www.itrgmbh.com
email: info@itrgmbh.com
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 2+ messages in thread
* [ECOS] Re: CDL/TCL issue building macro names in loops
2013-03-28 16:32 [ECOS] CDL/TCL issue building macro names in loops Richard Rauch
@ 2013-03-28 17:10 ` John Dallaway
0 siblings, 0 replies; 2+ messages in thread
From: John Dallaway @ 2013-03-28 17:10 UTC (permalink / raw)
To: Richard Rauch; +Cc: eCos Discussion
Hi Richard
On 28/03/13 16:32, Richard Rauch wrote:
> I have problems with creating macro name dynamically with TCL language.
>
> I have to implement an ADC driver. I want to create the list of channels.
> Because the large number of channels (10 internal channel with ACT value,
> MIN value and MAX value and 15 external channels) I want to create the
> channel list more convenient.
>
> The following code (some excerpt of my CDL script) works already good, but
> it is not matching my requirements completely:
>
> #---------------------------------------------------------------------------
> ----------------------------------------
> set SensorList { temp vccint vccaux vpvn vrefp vrefn vccbram vccpint vccpaux
> vcc0ddr } foreach Sensor $SensorList {
>
> cdl_component CYGNUM_DEVS_ADC_ARM_XC7Z_ONCHIP_$Sensor {
You may be able to adapt the approach used in the MCF52xx CAN driver CDL
script to work with your list of sensors:
> for { set ::flexcan 0 } { $::flexcan < 2 } { incr ::flexcan } {
> cdl_interface CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan] {
I hope this helps...
John Dallaway
eCos maintainer
http://www.dallaway.org.uk/john
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-28 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-28 16:32 [ECOS] CDL/TCL issue building macro names in loops Richard Rauch
2013-03-28 17:10 ` [ECOS] " John Dallaway
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).