console.c revision 178173
1178173Simp/* $NetBSD: uart.c,v 1.2 2007/03/23 20:05:47 dogcow Exp $ */ 2178173Simp 3178173Simp/*- 4178173Simp * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. 5178173Simp * All rights reserved. 6178173Simp * 7178173Simp * Redistribution and use in source and binary forms, with or 8178173Simp * without modification, are permitted provided that the following 9178173Simp * conditions are met: 10178173Simp * 1. Redistributions of source code must retain the above copyright 11178173Simp * notice, this list of conditions and the following disclaimer. 12178173Simp * 2. Redistributions in binary form must reproduce the above 13178173Simp * copyright notice, this list of conditions and the following 14178173Simp * disclaimer in the documentation and/or other materials provided 15178173Simp * with the distribution. 16178173Simp * 3. The names of the authors may not be used to endorse or promote 17178173Simp * products derived from this software without specific prior 18178173Simp * written permission. 19178173Simp * 20178173Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY 21178173Simp * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22178173Simp * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 23178173Simp * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS 24178173Simp * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 25178173Simp * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26178173Simp * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 27178173Simp * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28178173Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 29178173Simp * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 30178173Simp * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31178173Simp * OF SUCH DAMAGE. 32178173Simp * 33178173Simp */ 34178173Simp 35178173Simp#include <sys/cdefs.h> 36178173Simp__FBSDID("$FreeBSD: head/sys/mips/mips32/adm5120/console.c 178173 2008-04-13 07:44:55Z imp $"); 37178173Simp 38178173Simp#include <sys/types.h> 39178173Simp#include <sys/param.h> 40178173Simp#include <sys/systm.h> 41178173Simp#include <sys/kernel.h> 42178173Simp#include <sys/time.h> 43178173Simp 44178173Simp#include <sys/cons.h> 45178173Simp#include <sys/consio.h> 46178173Simp 47178173Simpstatic cn_probe_t uart_cnprobe; 48178173Simpstatic cn_init_t uart_cninit; 49178173Simpstatic cn_term_t uart_cnterm; 50178173Simpstatic cn_getc_t uart_cngetc; 51178173Simpstatic cn_putc_t uart_cnputc; 52178173Simp 53178173Simpstatic void 54178173Simpuart_cnprobe(struct consdev *cp) 55178173Simp{ 56178173Simp 57178173Simp sprintf(cp->cn_name, "uart"); 58178173Simp cp->cn_pri = CN_NORMAL; 59178173Simp} 60178173Simp 61178173Simpstatic void 62178173Simpuart_cninit(struct consdev *cp) 63178173Simp{ 64178173Simp 65178173Simp} 66178173Simp 67178173Simp 68178173Simpvoid 69178173Simpuart_cnputc(struct consdev *cp, int c) 70178173Simp{ 71178173Simp char chr; 72178173Simp 73178173Simp chr = c; 74178173Simp while ((*((volatile unsigned long *)0xb2600018)) & 0x20) ; 75178173Simp (*((volatile unsigned long *)0xb2600000)) = c; 76178173Simp while ((*((volatile unsigned long *)0xb2600018)) & 0x20) ; 77178173Simp} 78178173Simp 79178173Simpint 80178173Simpuart_cngetc(struct consdev * cp) 81178173Simp{ 82178173Simp 83178173Simp while ((*((volatile unsigned long *)0xb2600018)) & 0x10) ; 84178173Simp return (*((volatile unsigned long *)0xb2600000)) & 0xff; 85178173Simp} 86178173Simp 87178173Simpstatic void 88178173Simpuart_cnterm(struct consdev * cp) 89178173Simp{ 90178173Simp 91178173Simp} 92178173Simp 93178173SimpCONSOLE_DRIVER(uart); 94