source: mainline/boot/arch/sparc32/src/putchar.c@ f6f22cdb

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since f6f22cdb was f6f22cdb, checked in by Martin Decky <martin@…>, 12 years ago

code revision
coding style changes

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 * Copyright (c) 2007 Michal Kebrt
3 * Copyright (c) 2009 Vineeth Pillai
4 * Copyright (c) 2010 Jiri Svoboda
5 * Copyright (c) 2013 Jakub Klama
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * - Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * - Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * - The name of the author may not be used to endorse or promote products
18 * derived from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32/** @addtogroup sparc32boot
33 * @{
34 */
35/** @file
36 * @brief bootloader output logic
37 */
38
39#include <typedefs.h>
40#include <arch/asm.h>
41#include <arch/arch.h>
42#include <arch/main.h>
43#include <arch/mm.h>
44#include <putchar.h>
45#include <str.h>
46
47/** Send a byte to the LEON3 serial console.
48 *
49 * @param byte Byte to send.
50 *
51 */
52static void scons_sendb(uint8_t byte)
53{
54 asi_u32_write(ASI_MMUBYPASS, APBUART_SCONS_THR, byte);
55}
56
57/** Display a character
58 *
59 * @param ch Character to display
60 *
61 */
62void putchar(const wchar_t ch)
63{
64 if (ch == '\n')
65 scons_sendb('\r');
66
67 if (ascii_check(ch))
68 scons_sendb((uint8_t) ch);
69 else
70 scons_sendb(U_SPECIAL);
71}
72
73/** @}
74 */
Note: See TracBrowser for help on using the repository browser.