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: releng/10.2/sys/mips/adm5120/console.c 228631 2011-12-17 15:08:43Z avg $"); 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; 52228631Savgstatic cn_grab_t uart_cngrab; 53228631Savgstatic cn_ungrab_t uart_cnungrab; 54178173Simp 55178173Simpstatic void 56178173Simpuart_cnprobe(struct consdev *cp) 57178173Simp{ 58178173Simp 59178173Simp sprintf(cp->cn_name, "uart"); 60178173Simp cp->cn_pri = CN_NORMAL; 61178173Simp} 62178173Simp 63178173Simpstatic void 64178173Simpuart_cninit(struct consdev *cp) 65178173Simp{ 66178173Simp 67178173Simp} 68178173Simp 69178173Simp 70178173Simpvoid 71178173Simpuart_cnputc(struct consdev *cp, int c) 72178173Simp{ 73178173Simp char chr; 74178173Simp 75178173Simp chr = c; 76178173Simp while ((*((volatile unsigned long *)0xb2600018)) & 0x20) ; 77178173Simp (*((volatile unsigned long *)0xb2600000)) = c; 78178173Simp while ((*((volatile unsigned long *)0xb2600018)) & 0x20) ; 79178173Simp} 80178173Simp 81178173Simpint 82178173Simpuart_cngetc(struct consdev * cp) 83178173Simp{ 84178173Simp 85178173Simp while ((*((volatile unsigned long *)0xb2600018)) & 0x10) ; 86178173Simp return (*((volatile unsigned long *)0xb2600000)) & 0xff; 87178173Simp} 88178173Simp 89178173Simpstatic void 90178173Simpuart_cnterm(struct consdev * cp) 91178173Simp{ 92178173Simp 93178173Simp} 94178173Simp 95228631Savgstatic void 96228631Savguart_cngrab(struct consdev *cp) 97228631Savg{ 98228631Savg 99228631Savg} 100228631Savg 101228631Savgstatic void 102228631Savguart_cnungrab(struct consdev *cp) 103228631Savg{ 104228631Savg 105228631Savg} 106228631Savg 107178173SimpCONSOLE_DRIVER(uart); 108