Comm ports on Pc386

Joel Sherrill joel.sherrill at OARcorp.com
Thu Jul 5 20:50:24 UTC 2001


Angelo Fraietta wrote:
> 
> Thank you very much. I can see what is going on from this.  My original problem stemmed from
> the fact that
> #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
> had to be defined (the version of the manual that I have says it should default at 20)

Must be an old manual. :)  The online 4.5.0 documentation that has not
been
replaced in ages says :

CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS is set to the maximum number of
files that can be concurrently open.
     Libio requires a Classic RTEMS semaphore for each file descriptor
as well as one global one. The default value is 3 file
     descriptors which is enough to support standard input, output, and
error output. 
 
> The program below ran fine from my pentium machine but did nothing on my 386dx, so removed the
> calls to the shell and removed
> #define CONFIGURE_MEMORY_OVERHEAD   16384
> #define CONFIGURE_EXTRA_TASK_STACKS
> (CONFIGURE_MAXIMUM_TASKS*4*RTEMS_MINIMUM_STACK_SIZE)
>  as these caused my machine to hang(I don't actually need a shell).

Must have resulted in more memory than you had available somehow.

> I also modified the code to put a fflush after a certain number of chars (thnaks for informing
> me that the output was buffered)
> 
> I can now move on with my project, so I would like to thank you again.
> 
> Warmest regards
> 
> Angelo Fraietta
> 
> "Correo Fernando-ruiz (E-mail)" wrote:
> 
> > Hi Angelo.
> >
> > Trying touch a minimum the config.c well compiled and executed is this.
> >
> > /*
> >  *  Simple test program -- simplified version of sample test hello.
> >  *
> >  *  COPYRIGHT (c) 1989-1999.
> >  *  On-Line Applications Research Corporation (OAR).
> >  *
> >  *  The license and distribution terms for this file may be
> >  *  found in the file LICENSE in this distribution or at
> >  *  http://www.OARcorp.com/rtems/license.html.
> >  *
> >  *  $Id: main.c,v 1.3 2000/06/12 15:00:12 joel Exp $
> >  */
> >
> > #define TEST_INIT
> >
> > #include <bsp.h>
> >
> > void test_main( void );
> >
> > rtems_task Init(
> >   rtems_task_argument ignored
> > )
> > {
> >   test_main();
> >
> >   rtems_task_delete(RTEMS_SELF);
> >
> > }
> >
> > /* configuration information */
> >
> > #include <rtems.h>
> > #include <tty_drv.h>
> > #include <console.h>
> > #include <clockdrv.h>
> > #include <timerdrv.h>
> >
> > rtems_driver_address_table Device_drivers[] = {
> >         CONSOLE_DRIVER_TABLE_ENTRY,
> >         TTY1_DRIVER_TABLE_ENTRY,
> >         TTY2_DRIVER_TABLE_ENTRY,
> >         CLOCK_DRIVER_TABLE_ENTRY,
> >         {NULL,NULL,NULL,NULL,NULL,NULL},
> > };
> >
> > #define CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
> > #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> > #define CONFIGURE_MAXIMUM_TASKS             6
> >
> > #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
> >
> > #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> > #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
> >
> > /* You needs this in order to start anything wrong when the task_create
> > (JOEL?)*/
> >
> > #define CONFIGURE_MEMORY_OVERHEAD   16384
> > #define CONFIGURE_EXTRA_TASK_STACKS
> > (CONFIGURE_MAXIMUM_TASKS*4*RTEMS_MINIMUM_STACK_SIZE)
> >
> > #define CONFIGURE_INIT
> >
> > #include <confdefs.h>
> > #include <stdio.h>
> >
> > rtems_id   Task_id;
> > rtems_name Task_name;
> >
> > rtems_task Test_task( rtems_task_argument unused);
> > void test_main()
> > /* Whether you have a high priority task without
> > rtems_wait(delay/event/sem/queue/etc)
> >    you can hangup the system
> > (Try to change to realtime any task in the Windows2000/NT task list*/
> > {
> >   rtems_status_code status;
> >   Task_name = rtems_build_name( 'T', 'A', '1', ' ' );
> >   status = rtems_task_create(
> >     Task_name, 100, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
> >     RTEMS_DEFAULT_ATTRIBUTES, &Task_id
> >   );
> >   status = rtems_task_start( Task_id, Test_task, 1 );
> >
> > /*
> >  Problems in the device driver when the port is reopened/shared
> >  Test_task uses also /dev/ttyS1 (Perhaps no problem only a little mistake)
> >  shell_init("sh1",16384,100,"/dev/ttyS1"  ,B9600|CS8,TRUE);
> > */
> > shell_init("sh2",16384,100,"/dev/ttyS2"  ,B9600|CS8,TRUE);
> > shell_init("shc",16384,100,"/dev/console",B9600|CS8,TRUE);
> >
> > }
> >
> > const char* tty_ports [] =
> > {
> >         "/dev/ttyS1",
> >         "/dev/ttyS2"
> > };
> >
> > rtems_task Test_task(
> >   rtems_task_argument unused
> > )
> > {
> >
> >         FILE* fp = fopen (tty_ports [0], "r+"); /* B9600|CS0 termios default*/
> >
> >         if (!fp)
> >                 {
> >                         printf ("Unable to open %s", tty_ports [0]);
> >                 }
> >         else
> >                 {
> >                         while (1)
> >                                 {
> >                                         if (!fputc('t', fp))  /* Not the best use */
> >                                                 {
> >                                                         printf ("unable to write to port");
> >                                                 }
> >                                         rtems_task_wake_after(10); /* A while */
> >                                 }
> >                 }
> > }
> >
> > /* end of file */
> >
> > The 'tttt..' stream is showed every bufer size number of t's.
> >
> > The fputc uses I/O buffered. You need raw I/O better(like the shell).
> >
> > browse the sources and see rtems/c/src/libmisc/shell/shell.c
> >
> > There you can see how a termios port is changed to raw mode and the buffer
> > is eliminated.
> > Also you can see how the bauds are changed. (My source was
> > rtems/c/src/tests/libtests/termios)
> >
> > in shell_scanline I do a readkey() and putch() using two fildes of same
> > device.
> >
> > PS:
> >  When login... (On a minicom/hyperterminal client or on /dev/console)
> >  The user 'root' is the superuser and 'rtems' is the normal user.
> >  The password is not validated (crypt.c missing) by the moment.
> >
> >  Write a /etc/motd and /etc/issue and you can have a more friendly logiun
> > process.
> >
> > browse the sources and see rtems/c/src/libmisc/shell/cmds.c in order add
> > your commands.
> >
> > Enjoy it.
> >
> > Do you want another kind of serial device mode?
> >
> > Fernando RUIZ CASAS
> > home: correo at fernando-ruiz.com
> > work: fernando.ruiz at ctv.es
> >
> > -----Mensaje original-----
> > De: Angelo Fraietta [mailto:angelo at hunterlink.net.au]
> > Enviado el: martes, 03 de julio de 2001 22:50
> > Para: fernando.ruiz at ctv.es
> > CC: Correo Fernando-ruiz (E-mail) (E-mail)
> > Asunto: Re: Comm ports on Pc386
> >
> > Find attached the source and makefile. Thank you very much for taking the
> > time to look at these
> > Warmest regards
> > Angelo Fraietta
> > "Fernando RUIZ CASAS (E-mail)" wrote:
> >  Can you send me all the source test application in order to rebuild in my
> > environment?Regards
> > Fernando RUIZ CASAS
> >
> > home:correo at fernando-ruiz.com
> > work:fernando.ruiz at ctv.es
> >
> > ...
> 
> --
> Angelo Fraietta
> 
> PO Box 859
> Hamilton NSW 2303
> 
> Home Page
> 
> http://users.hunterlink.net.au/~maaaf/
> 
> There are those who seek knowledge for the sake of knowledge - that is CURIOSITY
> There are those who seek knowledge to be known by others - that is VANITY
> There are those who seek knowledge in order to serve - that is LOVE
>     Bernard of Clairvaux (1090 - 1153)

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985



More information about the users mailing list