Comm ports on Pc386

Angelo Fraietta angelo at hunterlink.net.au
Mon Jul 2 01:38:13 UTC 2001


I am using the previous snapshot as  do not have networking enabled. I am
trying to open the commport and write some chars (for now). If I just try to
open the port without the code you provided, the file does not open. I assume
it is because the port has to be configured with the code you provided.
However, trying to compile this below, I get a heap of parse errors in
ttr_drv.h.
Is this because of the snapshot or am I doing something wrong here?




#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_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MAXIMUM_TASKS             1
#include <confdefs.h>

rtems_id   Task_id;
rtems_name Task_name;

const char* tty_ports [] =
{
 "/dev/ttyS1",
 "/dev/ttyS2"
};

rtems_task Test_task(
  rtems_task_argument unused
)
{
 FILE* fp = fopen (tty_ports [0], "r+");

 if (!fp)
  {
   printf ("Unable to open %s", tty_ports [0]);
  }
 else
  {
   while (1)
    {
     if (!fputc('t', fp))
      {
       printf ("unable to write to port");
      }
    }
  }

}

Init()
{
 Task_name = rtems_build_name( 'T', 'A', '1', ' ' );
  rtems_status_code status;
  status = rtems_task_create(
    Task_name, 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
    RTEMS_DEFAULT_ATTRIBUTES, &Task_id
  );
  status = rtems_task_start( &Task_id, Test_task, 1 );
}




"Correo Fernando-ruiz (E-mail)" wrote:

> > -----Mensaje original-----
> > De: Angelo Fraietta [mailto:angelo at hunterlink.net.au]
> > Enviado el: jueves, 28 de junio de 2001 3:52
> > Para: rtems-users
> > Asunto: Comm ports on Pc386
> >
> >
> > Does anyone have an example of using the comm ports on a PC386 build?
> >
> > --
>
> ***************************************************************
>
> #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},
> };
> #include <confdefs.h>
>
> ****************************************************************
>
> Adding this like rtems device configuration you have
> THREE termios ports in your PC.
>
> /dev/console
> /dev/ttyS1
> /dev/ttyS2
>
> How to manage this ports with TERMIOS?
> See the /rtems/c/src/tests/libtests/termios directory.
> A complete program to drive a termios device.
> (My first source to understand it. Thanks Eric Norum)
> Enjoy it.
>
> Are you using the last snapshot (20010525)?
> With this you can open remote consoles in every port termios.
>
> /* TASK NAME,STACK SIZE, TASK PRIO, DEV_NAME, BAUDS & LINE SETT.,FOREVER*/
> #include <shell.h>
> Init() {
> ...
> shell_init("sh1",16384,100,"/dev/ttyS1"  ,B38400|CS8,TRUE);
> shell_init("sh2",16384,100,"/dev/ttyS2"  ,B38400|CS8,TRUE);
> shell_init("shc",16384,100,"/dev/console",B38400|CS8,TRUE);
> ...
> }
>
> Three users accessing at same time at the PC but with RTEMS rtos.
> A new task for evevy user.
>
> 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)
> >
> >
> >

--
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)





More information about the users mailing list