示例#1
0
文件: console.c 项目: AoLaD/rtems
/* console_read --
 *     Read from the console device
 *
 * PARAMETERS:
 *     major - major device number for console devices
 *     minor - minor device number for console
 *     arg - device read argument
 *
 * RETURNS:
 *     RTEMS error code
 */
rtems_device_driver
console_read(rtems_device_major_number major,
        rtems_device_minor_number minor,
        void *arg)
{
    if ((console_mode != CONSOLE_MODE_RAW) &&
            (console_mode != CONSOLE_MODE_IPL))
    {
        return rtems_termios_read (arg);
    }
    else
    {
        rtems_libio_rw_args_t *argp = arg;
        char *buf = argp->buffer;
        int count = argp->count;
        int n = 0;
        int c;
        while (n < count)
        {
            do {
                c = (console_mode == CONSOLE_MODE_RAW) ?
                        sh4uart_poll_read(&sh4_uarts[minor]) :
                        ipl_console_poll_read(minor);
            } while (c == -1);
            if (c == '\r')
                c = '\n';
            *(buf++) = c;
            n++;
            if (c == '\n')
                break;
        }
        argp->bytes_moved = n;
        return RTEMS_SUCCESSFUL;
    }
}
示例#2
0
/*
 * paux device driver READ entry point.
 * Read characters from the PS/2 mouse.
 */
rtems_device_driver paux_read(
  rtems_device_major_number major,
  rtems_device_minor_number minor,
  void                      *arg)
{
  return rtems_termios_read (arg);
} /* tty_read */
rtems_device_driver console_read(
	rtems_device_major_number	major,
	rtems_device_minor_number	minor,
	void				*arg)
{
	return rtems_termios_read(arg);
}
static
rtems_device_driver my_pty_read(
  rtems_device_major_number major,
  rtems_device_minor_number minor,
  void                    * arg
)
{
  return rtems_termios_read(arg);
}
示例#5
0
文件: console.c 项目: AoLaD/rtems
/*
 * Read from the device
 */
rtems_device_driver console_read(
  rtems_device_major_number major,
  rtems_device_minor_number minor,
  void *arg
)
{
  if ( minor > NUM_PORTS-1 )
    return RTEMS_INVALID_NUMBER;

  #if UARTS_USE_TERMIOS == 1
    return rtems_termios_read( arg );
  #else
    return do_poll_read( major, minor, arg );
  #endif
}
/*-------------------------------------------------------------------------+
| Console device driver READ entry point.
+--------------------------------------------------------------------------+
| Read characters from the I/O console. We only have stdin.
+--------------------------------------------------------------------------*/
rtems_device_driver
console_read(rtems_device_major_number major,
             rtems_device_minor_number minor,
             void                      *arg)
{
  rtems_status_code sc;

  sc = rtems_termios_read (arg);

  if ( sc != RTEMS_SUCCESSFUL )
    printk("console_read: fails %s\n",rtems_status_text(sc));

  return sc;

} /* console_read */