coreboot/src/console/uart8250_console.c
<<
>>
Prefs
   1/*
   2 * This file is part of the coreboot project.
   3 *
   4 * Copyright (C) 2003 Eric Biederman
   5 *
   6 * This program is free software; you can redistribute it and/or modify
   7 * it under the terms of the GNU General Public License as published by
   8 * the Free Software Foundation; version 2 of the License.
   9 *
  10 * This program is distributed in the hope that it will be useful,
  11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13 * GNU General Public License for more details.
  14 *
  15 * You should have received a copy of the GNU General Public License
  16 * along with this program; if not, write to the Free Software
  17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  18 */
  19
  20#include <console/console.h>
  21#include <uart8250.h>
  22#include <pc80/mc146818rtc.h>
  23
  24static void ttyS0_init(void)
  25{
  26        uart_init();
  27}
  28
  29static void ttyS0_tx_byte(unsigned char data)
  30{
  31        uart8250_tx_byte(CONFIG_TTYS0_BASE, data);
  32}
  33
  34static unsigned char ttyS0_rx_byte(void)
  35{
  36        return uart8250_rx_byte(CONFIG_TTYS0_BASE);
  37}
  38
  39static int ttyS0_tst_byte(void)
  40{
  41        return uart8250_can_rx_byte(CONFIG_TTYS0_BASE);
  42}
  43
  44static const struct console_driver uart8250_console __console = {
  45        .init     = ttyS0_init,
  46        .tx_byte  = ttyS0_tx_byte,
  47        .rx_byte  = ttyS0_rx_byte,
  48        .tst_byte = ttyS0_tst_byte,
  49};
  50
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.