arm: cut bootloader dependency on uart stuff

This commit is contained in:
Paul Mathieu 2022-05-17 09:23:11 -07:00
parent d4e9e133b6
commit e9f623e754

View File

@ -1,9 +1,24 @@
#include <cstdint>
#include "gpio.h"
#include "uart.h"
#include "xuartlite.h"
namespace {
constexpr uintptr_t kUart0BaseAddress = 0x40001000;
XUartLite uart0_inst;
XUartLite_Config uart0_config = {
.DeviceId = 0,
.RegBaseAddr = kUart0BaseAddress,
.BaudRate = 115200,
.UseParity = false,
.DataBits = 8,
};
XUartLite* uart0 = &uart0_inst;
void InitUarts() {
XUartLite_CfgInitialize(uart0, &uart0_config, uart0_config.RegBaseAddr);
}
uint8_t UartRead() {
uint8_t c;
@ -25,7 +40,6 @@ uint32_t UartRead32() {
return val;
}
} // namespace
int main() {