OpenCores
URL https://opencores.org/ocsvn/potato/potato/trunk

Subversion Repositories potato

[/] [potato/] [trunk/] [benchmarks/] [sha256/] [uart.c] - Blame information for rev 65

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 skordal
// The Potato Processor Benchmark Applications
2
// (c) Kristian Klomsten Skordal 2015 <kristian.skordal@wafflemail.net>
3
// Report bugs and issues on <http://opencores.org/project,potato,bugtracker>
4
 
5
#include <stdarg.h>
6
#include <stdbool.h>
7
 
8
#include "platform.h"
9
#include "uart.h"
10
 
11
void uart_puts(volatile uint32_t * base, const char * s)
12
{
13
        for(int i = 0; s[i] != 0; ++i)
14
                uart_putc(base, s[i]);
15
}
16
 
17
void uart_putc(volatile uint32_t * base, char c)
18
{
19
        // Wait until there is room in the transmit buffer:
20 65 skordal
        while(base[UART_STATUS >> 2] & (1 << UART_STATUS_TXBUF_FULL));
21
        base[UART_TX >> 2] = c & 0xff;
22 13 skordal
}
23
 
24
void uart_puth(volatile uint32_t * base, uint32_t n)
25
{
26
        static const char * hex_digits = "0123456789abcdef";
27
        uart_putc(base, '0');
28
        uart_putc(base, 'x');
29
        for(int i = 28; i >= 0; i -= 4)
30
                uart_putc(base, hex_digits[(n >> i) & 0xf]);
31
}
32
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.