Re: tty.cdl

Sergei Gavrikov <[email protected]>
Newsgroups gmane.os.ecos.devel
Message-ID <alpine.DEB.2.00.1103271511250.8683@sg-laptop>
On Sun, 27 Mar 2011, Ilija Kocho wrote:

> On 26.03.2011 19:32, Sergei Gavrikov wrote:
> > On Sat, 26 Mar 2011, Ilija Kocho wrote:
> >
> >> Hello colleagues
> >>
> >> I need to extend tty.cdl in order to accommodate more than 4 serial
> >> ports, currently I need 6. I can simply add 2 port entries but i would
> >> prefer something like the snippet below. Either case I am ready to post
> >> to Bugzilla.
> >> Note: Similar case is with termios.cdl
> >>
> >> Please advise.
> >  
> > Hi Ilija,
> >
> > It seems your issue cannot be solved by editing the config files *only*.
> > There are a couple of hardwired conditional definitions for device table
> > entries there, take a look at
> >
> >   $ECOS_REPOSITORY/io/serial/<version>/src/common/tty.c
> >   $ECOS_REPOSITORY/io/serial/<version>/src/common/termiostty.c
> >
> >
> > Sergei
> Hi Sergei
> 
> Thanks for the notes. I tried to extend this concept to tty.c, please
> see attached CDL. Here are my questions.
> 
> 1. The proc output is in io-serial.h and is protected to instantiate in
> only file that defines __CYGSEM_FILE_IS_IO_SERIAL_COMMON_TTY_C (tty.c)
> I would ask if it is possible to redirect puts to other file?
 
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

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?

I dislike a complicated Tcl programming in eCos config files (however,
this is mine).

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.