putchar.c revision 157873
1130803Smarcel/*- 2130803Smarcel * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3130803Smarcel * 4130803Smarcel * Redistribution and use in source and binary forms, with or without 5130803Smarcel * modification, are permitted provided that the following conditions 6130803Smarcel * are met: 7130803Smarcel * 1. Redistributions of source code must retain the above copyright 8130803Smarcel * notice, this list of conditions and the following disclaimer. 9130803Smarcel * 2. Redistributions in binary form must reproduce the above copyright 10130803Smarcel * notice, this list of conditions and the following disclaimer in the 11130803Smarcel * documentation and/or other materials provided with the distribution. 12130803Smarcel * 13130803Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14130803Smarcel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15130803Smarcel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16130803Smarcel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17130803Smarcel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18130803Smarcel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19130803Smarcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20130803Smarcel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21130803Smarcel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22130803Smarcel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23130803Smarcel * 24130803Smarcel * This software is derived from software provided by kwikbyte without 25130803Smarcel * copyright as follows: 26130803Smarcel * 27130803Smarcel * No warranty, expressed or implied, is included with this software. It is 28130803Smarcel * provided "AS IS" and no warranty of any kind including statutory or aspects 29130803Smarcel * relating to merchantability or fitness for any purpose is provided. All 30130803Smarcel * intellectual property rights of others is maintained with the respective 31130803Smarcel * owners. This software is not copyrighted and is intended for reference 32130803Smarcel * only. 33130803Smarcel * 34130803Smarcel * $FreeBSD: head/sys/boot/arm/at91/libat91/putchar.c 157873 2006-04-19 17:16:49Z imp $ 35130803Smarcel */ 36130803Smarcel 37130803Smarcel#include "at91rm9200.h" 38130803Smarcel#include "at91rm9200_lowlevel.h" 39130803Smarcel#include "lib.h" 40130803Smarcel 41130803Smarcel/* 42130803Smarcel * void putchar(int ch) 43130803Smarcel * Writes a character to the DBGU port. It assumes that DBGU has 44130803Smarcel * already been initialized. 45130803Smarcel */ 46130803Smarcelvoid 47130803Smarcelputchar(int ch) 48130803Smarcel{ 49130803Smarcel AT91PS_USART pUSART = (AT91PS_USART)AT91C_BASE_DBGU; 50130803Smarcel 51130803Smarcel while (!(pUSART->US_CSR & AT91C_US_TXRDY)) 52130803Smarcel continue; 53130803Smarcel pUSART->US_THR = (ch & 0xFF); 54130803Smarcel} 55130803Smarcel