parent
356e47b543
commit
ba91618324
|
@ -23,6 +23,7 @@ ASM_SRCS += $(COMMON_DIR)/trap_entry.S
|
||||||
C_SRCS += $(COMMON_DIR)/init.c
|
C_SRCS += $(COMMON_DIR)/init.c
|
||||||
C_SRCS += $(COMMON_DIR)/lib/utils.c
|
C_SRCS += $(COMMON_DIR)/lib/utils.c
|
||||||
C_SRCS += $(COMMON_DIR)/lib/xprintf.c
|
C_SRCS += $(COMMON_DIR)/lib/xprintf.c
|
||||||
|
C_SRCS += $(COMMON_DIR)/lib/uart.c
|
||||||
|
|
||||||
|
|
||||||
LINKER_SCRIPT := $(COMMON_DIR)/link.lds
|
LINKER_SCRIPT := $(COMMON_DIR)/link.lds
|
||||||
|
|
|
@ -9,4 +9,6 @@
|
||||||
|
|
||||||
#define UART0_REG(addr) (*((volatile uint32_t *)addr))
|
#define UART0_REG(addr) (*((volatile uint32_t *)addr))
|
||||||
|
|
||||||
|
void uart_init();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "../include/uart.h"
|
||||||
|
#include "../include/xprintf.h"
|
||||||
|
|
||||||
|
|
||||||
|
static void uart_putc(uint8_t c)
|
||||||
|
{
|
||||||
|
while (UART0_REG(UART0_STATUS) & 0x1);
|
||||||
|
UART0_REG(UART0_TXDATA) = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 115200bps, 8 N 1
|
||||||
|
void uart_init()
|
||||||
|
{
|
||||||
|
UART0_REG(UART0_CTRL) = 0x1;
|
||||||
|
|
||||||
|
xdev_out(uart_putc);
|
||||||
|
}
|
Loading…
Reference in New Issue