Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/drivers/s3c24xx/uart.c

    r28a5ebd re9bc927  
    4949#include <str.h>
    5050
    51 static void s3c24xx_uart_sendb(outdev_t *dev, uint8_t byte)
     51static void s3c24xx_uart_sendb(s3c24xx_uart_t *uart, uint8_t byte)
    5252{
    53         s3c24xx_uart_t *uart =
    54             (s3c24xx_uart_t *) dev->data;
    55 
    5653        /* Wait for space becoming available in Tx FIFO. */
    5754        while ((pio_read_32(&uart->io->ufstat) & S3C24XX_UFSTAT_TX_FULL) != 0)
     
    6158}
    6259
    63 static void s3c24xx_uart_putuchar(outdev_t *dev, char32_t ch)
     60static void s3c24xx_uart_write(outdev_t *dev, const char *s, size_t n)
    6461{
    65         s3c24xx_uart_t *uart =
    66             (s3c24xx_uart_t *) dev->data;
     62        s3c24xx_uart_t *uart = dev->data;
    6763
    68         if ((!uart->parea.mapped) || (console_override)) {
    69                 if (!ascii_check(ch)) {
    70                         s3c24xx_uart_sendb(dev, U_SPECIAL);
    71                 } else {
    72                         if (ch == '\n')
    73                                 s3c24xx_uart_sendb(dev, (uint8_t) '\r');
    74                         s3c24xx_uart_sendb(dev, (uint8_t) ch);
    75                 }
     64        /* If the userspace owns the console, do not output anything. */
     65        if (uart->parea.mapped && !console_override)
     66                return;
     67
     68        const char *top = s + n;
     69        assert(top >= s);
     70
     71        for (; s < top; s++) {
     72                if (*s == '\n')
     73                        s3c24xx_uart_sendb(uart, '\r');
     74
     75                s3c24xx_uart_sendb(uart, (uint8_t) *s);
    7676        }
    7777}
     
    9494
    9595static outdev_operations_t s3c24xx_uart_ops = {
    96         .write = s3c24xx_uart_putuchar,
     96        .write = s3c24xx_uart_write,
    9797        .redraw = NULL,
    9898        .scroll_up = NULL,
Note: See TracChangeset for help on using the changeset viewer.