Multiple rtems_io_register_name
Chris Johns
cjohns at cybertec.com.au
Thu Oct 23 07:10:59 UTC 2003
Cedric Aubert wrote:
>
> I want to known if it's possible and a correct usage
> to do multiple rtems_io_register_name for have more
> device with same major minor couple for serial port.
>
> Example, to have /dev/console and /dev/ttyS0 and
> to the same physical serial port. If it's exist a more
> beuatiful manner to do a link like this, thank to tell
> me.
>
For our boards we create devices with names such as /dev/porta
/dev/portb, etc that relate to the connector documentation and then link
them with a 'symlink' to a logical device name, ie /dev/ttyS0, ie:
/dev/ttyS0 -> /dev/porta
The code is:
status = rtems_io_register_name ("/dev/porta", 4, 0);
if (status != RTEMS_SUCCESSFUL)
rtems_fatal_error_occurred (status);
status = rtems_io_register_name ("/dev/portb", 4, 1);
if (status != RTEMS_SUCCESSFUL)
rtems_fatal_error_occurred (status);
if (symlink ("/dev/porta", "/dev/ttyS0") < 0)
printf (" sfp-core target init: cannot make symlink to porta, %s",
strerror (errno));
if (symlink ("/dev/portb", "/dev/ttyS1") < 0)
printf (" sfp-core target init: cannot make symlink to portb, %s",
strerror (errno));
--
Chris Johns, cjohns at cybertec.com.au
More information about the users
mailing list