summaryrefslogtreecommitdiff
path: root/bootwrapper/uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootwrapper/uart.c')
-rw-r--r--bootwrapper/uart.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/bootwrapper/uart.c b/bootwrapper/uart.c
index 5c858f6..8ea104f 100644
--- a/bootwrapper/uart.c
+++ b/bootwrapper/uart.c
@@ -18,7 +18,7 @@
* contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- */
+ */
/*
* uart.c - boot code to output characters on a PL011 uart
@@ -56,61 +56,61 @@ static unsigned uart_base = NULL;
void config_uart(void)
{
- uart_base = UART0_BASE;
- write32(uart_base + PL011_CR, 0);
- write32(uart_base + PL011_FBRD, 0x01);
- write32(uart_base + PL011_IBRD, 0x27);
- write32(uart_base + PL011_LCRH, 0x70);
- write32(uart_base + PL011_CR, 0xf01); /* TXE|RXE|En|DTR|CTS */
+ uart_base = UART0_BASE;
+ write32(uart_base + PL011_CR, 0);
+ write32(uart_base + PL011_FBRD, 0x01);
+ write32(uart_base + PL011_IBRD, 0x27);
+ write32(uart_base + PL011_LCRH, 0x70);
+ write32(uart_base + PL011_CR, 0xf01); /* TXE|RXE|En|DTR|CTS */
}
void drain_uart_fifo(void)
{
- while (!(read32(uart_base + PL011_FR) & PL011_TXFE)) {
- /* Do nothing */
- }
+ while (!(read32(uart_base + PL011_FR) & PL011_TXFE)) {
+ /* Do nothing */
+ }
}
static __inline void wait_for_space(void)
{
- while ((read32(uart_base + PL011_FR) & PL011_TXFF)) {
- /* Do nothing */
- }
+ while ((read32(uart_base + PL011_FR) & PL011_TXFF)) {
+ /* Do nothing */
+ }
}
void output_char(int c)
{
- if (c == '\n') {
- wait_for_space();
- write32(uart_base + PL011_DR, '\r');
- }
- wait_for_space();
- write32(uart_base + PL011_DR, c);
+ if (c == '\n') {
+ wait_for_space();
+ write32(uart_base + PL011_DR, '\r');
+ }
+ wait_for_space();
+ write32(uart_base + PL011_DR, c);
}
void output_string(const char *string)
{
- int i;
+ int i;
- for (i = 0; string[i]; ++i) {
- output_char(string[i]);
- }
+ for (i = 0; string[i]; ++i) {
+ output_char(string[i]);
+ }
}
void hexword(unsigned value)
{
- printf(" 0x%8.8x", value);
- drain_uart_fifo();
+ printf(" 0x%8.8x", value);
+ drain_uart_fifo();
}
typedef struct __FILE {
- int dummy;
+ int dummy;
} FILE;
FILE __stdout;
int fputc(int c, FILE * f)
{
- output_char(c);
- return c;
+ output_char(c);
+ return c;
}