示例#1
0
文件: console.c 项目: rtemss/rtems
/**
 *  @brief Console device driver WRITE entry point.
 *
 *  Write characters to the I/O console.
 *
 *  @param  major diver major number
 *  @param  minor driver minor mumber
 *  @param  *arg pointer to parameters
 *  @return status code
*/
rtems_device_driver
console_write(rtems_device_major_number major,
              rtems_device_minor_number minor,
              void                      *arg)
{
    return rtems_termios_write (arg);
}
/* console_write --
 *     Write to the console device
 *
 * PARAMETERS:
 *     major - major device number for console devices
 *     minor - minor device number for console
 *     arg - device write argument
 *
 * RETURNS:
 *     RTEMS error code
 */
rtems_device_driver
console_write(rtems_device_major_number major,
              rtems_device_minor_number minor,
              void *arg
             )
{
    if (console_mode != CONSOLE_MODE_RAW)
    {
        return rtems_termios_write (arg);
    }
    else
    {
        rtems_libio_rw_args_t *argp = arg;
        char cr = '\r';
        char *buf = argp->buffer;
        int count = argp->count;
        int i;
        for (i = 0; i < count; i++)
        {
            if (*buf == '\n')
                mcfuart_poll_write(&uart[minor], &cr, 1);
            mcfuart_poll_write(&uart[minor], buf, 1);
            buf++;
        }
        argp->bytes_moved = count;
        return RTEMS_SUCCESSFUL;
    }
}
示例#3
0
/*
 * TTY device driver WRITE entry point.
 * Write characters to the tty device.
 */
rtems_device_driver
serial_mouse_write(rtems_device_major_number major,
              rtems_device_minor_number minor,
              void                    * arg)
{
    return rtems_termios_write (arg);

} /* tty_write */
static
rtems_device_driver my_pty_write(
  rtems_device_major_number major,
  rtems_device_minor_number minor,
  void                    * arg
)
{
  return rtems_termios_write(arg);
}
示例#5
0
文件: console.c 项目: AoLaD/rtems
/*
 * Write to the device
 */
rtems_device_driver console_write(
  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_write( arg );
  #else
    return do_poll_write( major, minor, arg );
  #endif
}
示例#6
0
文件: console.c 项目: AoLaD/rtems
/* console_write --
 *     Write to the console device
 *
 * PARAMETERS:
 *     major - major device number for console devices
 *     minor - minor device number for console
 *     arg - device write argument
 *
 * RETURNS:
 *     RTEMS error code
 */
rtems_device_driver
console_write(rtems_device_major_number major,
        rtems_device_minor_number minor,
        void *arg)
{
    switch (console_mode)
    {
        case CONSOLE_MODE_POLL:
        case CONSOLE_MODE_INT:
                return rtems_termios_write (arg);
        case CONSOLE_MODE_RAW:
        {
            rtems_libio_rw_args_t *argp = arg;
            char cr = '\r';
            char *buf = argp->buffer;
            int count = argp->count;
            int i;

            for (i = 0; i < count; i++)
            {
                if (*buf == '\n')
                    sh4uart_poll_write(&sh4_uarts[minor], &cr, 1);
                sh4uart_poll_write(&sh4_uarts[minor], buf, 1);
                buf++;
            }
            argp->bytes_moved = count;
            return RTEMS_SUCCESSFUL;
        }
#ifdef SH4_WITH_IPL
        case CONSOLE_MODE_IPL:
        {
            rtems_libio_rw_args_t *argp = arg;
            char *buf = argp->buffer;
            int count = argp->count;
            ipl_console_poll_write(minor, buf, count);
            argp->bytes_moved = count;
            return RTEMS_SUCCESSFUL;
        }
#endif
        default: /* Unreachable */
            return RTEMS_NOT_DEFINED;
    }
}