public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Richard Rauch" <rrauch@itrgmbh.de>
To: <ecos-discuss@ecos.sourceware.org>
Subject: [ECOS] CDL/TCL issue building macro names in loops
Date: Thu, 28 Mar 2013 16:32:00 -0000	[thread overview]
Message-ID: <000301ce2bd1$d0acd530$72067f90$@itrgmbh.de> (raw)

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

             reply	other threads:[~2013-03-28 16:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28 16:32 Richard Rauch [this message]
2013-03-28 17:10 ` [ECOS] " John Dallaway

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000301ce2bd1$d0acd530$72067f90$@itrgmbh.de' \
    --to=rrauch@itrgmbh.de \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).