This is the mail archive of the ecos-devel@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: tty.cdl


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 <target>
> % 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]