f1f97442f57535b789aecc6fbbce7411aad964d8
[openwrt/openwrt.git] / target / linux / ar71xx / image / lzma-loader / src / board.c
1 /*
2 * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards
3 *
4 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11 #include <stddef.h>
12 #include "config.h"
13
14 #define READREG(r) *(volatile unsigned int *)(r)
15 #define WRITEREG(r,v) *(volatile unsigned int *)(r) = v
16
17 #define UART_BASE 0xb8020000
18
19 #define UART_TX 0
20 #define UART_LSR 5
21
22 #define UART_LSR_THRE 0x20
23
24 #define UART_READ(r) READREG(UART_BASE + 4 * (r))
25 #define UART_WRITE(r,v) WRITEREG(UART_BASE + 4 * (r), (v))
26
27 void board_putc(int ch)
28 {
29 while (((UART_READ(UART_LSR)) & UART_LSR_THRE) == 0);
30 UART_WRITE(UART_TX, ch);
31 while (((UART_READ(UART_LSR)) & UART_LSR_THRE) == 0);
32 }
33
34 void board_init(void)
35 {
36 }