From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16957 invoked by alias); 27 Mar 2011 15:46:00 -0000 Received: (qmail 16948 invoked by uid 22791); 27 Mar 2011 15:45:59 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from tirion.supremecenter202.com (HELO tirion.supremecenter202.com) (209.25.195.243) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 Mar 2011 15:45:53 +0000 Received: from [77.28.169.68] (port=63162 helo=[192.168.1.68]) by tirion.supremecenter202.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Q3sA4-0000jc-OA for ecos-devel@ecos.sourceware.org; Sun, 27 Mar 2011 15:45:53 +0000 Message-ID: <4D8F5BAD.6020708@siva.com.mk> Date: Sun, 27 Mar 2011 15:46:00 -0000 From: Ilija Kocho User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 ThunderBrowse/3.3.5 MIME-Version: 1.0 To: ecos-devel@ecos.sourceware.org Subject: Re: tty.cdl References: <4D8DBE3F.2000708@siva.com.mk> <4D8F2207.7070701@siva.com.mk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2011-03/txt/msg00028.txt.bz2 On 27.03.2011 14:45, Sergei Gavrikov wrote: > > Hi Ilija, > > I get it (about your attempting to build the in-lines using CDL), but, I > would keep things simpler, i.e. just would add two absent entries for > TTY4, TTY5, TTYx in tty.c. Those are conditional definitions depend on > Adding two additional TTYs is an alternative indeed, it is simple and straightforward to implement. My idea was to make system auto extensible and configurable. I have fixed number of TTYs to 6, but as you suggest in your research below it could be defined as a variable. HAL could provide an override too. Also maintenance may be simpler since we avoid duplicated code?! However there is the question of cost/benefit, this change may be too radical - hence my dilemma what version to post as patch. Would it be proper if I provide both alternatives? > cdl_component CYGPKG_IO_SERIAL_TTY_TTYx { > user_value 1 > }; > > such things define itself if user enables TTYx > > pkgconf/io_serial.h: > #define CYGPKG_IO_SERIAL_TTY_TTYx 1 > #define CYGDAT_IO_SERIAL_TTY_TTYx_DEV "/dev/serX" > > otherwise auto-generated io_serial.h header has no such definitions. > Right? They are present, but at wrong place - after code generated by puts. I found-out it in meantime and I have changed CDL so define_proc/puts is after cdl_option CYGDAT_IO_SERIAL_TTY_TTY[set ::channel]_DEV The actual problem was only with CYGDAT_IO_SERIAL_TTY_TTYx_DEV. CYGDAT_IO_SERIAL_TTY_TTYx_1 are not necessary since CDL will generate only selected devices in io_serial.h > I dislike a complicated Tcl programming in eCos config files (however, > this is mine). > I have to admit that I like to avoid code replication whenever possible, but this for {} pattern is present in some serial device diver CDLs so it is not a precedent. Should I take your research below as an encouragement? > I tried such thing in config file > > if {! [info exist ::env(ECOS_MAX_TTY_DEVS)]} {;# check env variable > set ::max_tty_devs 4 > } { > set ::max_tty_devs $::env(ECOS_MAX_TTY_DEVS) > } > > for { set ::device 0 } { $::device < $::max_tty_devs } { incr ::device } { > cdl_component CYGPKG_IO_SERIAL_TTY_TTY[set ::device] { > display "TTY mode channel #[set ::device]" > flavor bool > default_value 0 > ... > > and if I've configured eCos as > > % env ECOS_MAX_TTY_DEVS=6 ecosconfig new > % env ECOS_MAX_TTY_DEVS=6 ecosconfig tree > > I got 6 definitions for TTYs in eCos config. So, it was needed to add 2 > new entries in tty.c *only* (just c&p) to get things spin. > > Well, I tried > > % export ECOS_MAX_TTY_DEVS=6 > configtool > > and, I've seen in CT > > -[*] TTY mode serial device drivers > ... > + [ ] TTY mode for channel #0 > ... > + [ ] TTY mode for channel #5 > + [ ] TTY mode for channel #6 > > However, I have nothing against hardwired iterators in {,termios}tty.cdl > For six? eight ports? > > for { set ::device 0 } { $::device < 6 } { incr ::device } { > ... > > In any cases user should enable the Nth serial port for TTY/TERMIOS to > get the record in pkgconf/io_serial.h and this header is included in > tty.c and termiostty.c sources. > > > Sergei