21 lines
422 B
C
21 lines
422 B
C
#include <stdint.h>
|
|
|
|
#include "uart.h"
|
|
|
|
static volatile uint32_t *const uart_data = (uint32_t*)0x49020000;
|
|
static volatile uint32_t *const uart_status = (uint32_t*)0x49020044;
|
|
|
|
static void _uart_wait_txnotfull() {
|
|
while(*uart_status & 0x1) {}
|
|
}
|
|
|
|
void uart_sendb(char b) {
|
|
_uart_wait_txnotfull();
|
|
*uart_data = b;
|
|
}
|
|
|
|
void uart_write(const char *data, int len) {
|
|
for(int i = 0;i < len;++i)
|
|
uart_sendb(*data++);
|
|
}
|