/*-1* Copyright (c) 2007 Semihalf, Rafal Jaworowski <[email protected]>2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12*13* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND14* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE16* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE17* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL18* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS19* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)20* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT21* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY22* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF23* SUCH DAMAGE.24*/2526#include <stand.h>27#include "bootstrap.h"28#include "glue.h"2930int console;3132static void uboot_cons_probe(struct console *cp);33static int uboot_cons_init(int);34static void uboot_cons_putchar(int);35static int uboot_cons_getchar(void);36static int uboot_cons_poll(void);3738struct console uboot_console = {39.c_name = "uboot",40.c_desc = "U-Boot console",41.c_probe = uboot_cons_probe,42.c_init = uboot_cons_init,43.c_out = uboot_cons_putchar,44.c_in = uboot_cons_getchar,45.c_ready = uboot_cons_poll,46};4748static void49uboot_cons_probe(struct console *cp)50{5152cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);53}5455static int56uboot_cons_init(int arg)57{5859return (0);60}6162static void63uboot_cons_putchar(int c)64{6566if (c == '\n')67ub_putc('\r');6869ub_putc(c);70}7172static int73uboot_cons_getchar(void)74{7576return (ub_getc());77}7879static int80uboot_cons_poll(void)81{8283return (ub_tstc());84}858687