40 lines
753 B
C
40 lines
753 B
C
#include "hwtimer.h"
|
|
#include "csr.h"
|
|
#include "platform.h"
|
|
#include "uart.h"
|
|
#include <stdio.h>
|
|
#include <stdarg.h>
|
|
|
|
// needed by picolibc/port.c
|
|
int uart_putc(int ch) {
|
|
int intr_enable = riscv_mintr_get();
|
|
riscv_mintr_off();
|
|
uart_write(uart, ch);
|
|
riscv_mintr_restore(intr_enable);
|
|
return 1;
|
|
}
|
|
|
|
int uart_getc(void) {
|
|
int intr_enable = riscv_mintr_get();
|
|
riscv_mintr_off();
|
|
int ch = uart_read(uart);
|
|
riscv_mintr_restore(intr_enable);
|
|
return ch;
|
|
}
|
|
|
|
int uart_init(void) {
|
|
puts("[UART0] : Uart Init Done, this is Test output!");
|
|
return 0;
|
|
};
|
|
|
|
int board_init(void) {
|
|
int ret;
|
|
ret = uart_init();
|
|
if(ret)
|
|
return ret;
|
|
ret = hwtimer_init();
|
|
if(ret)
|
|
return ret;
|
|
return 0;
|
|
}
|