mbv: now with functioning timer interrupts!
And a few other nice things. The bootloader now has an embedded wozmon! If you know its offset, you can jump to it from the app.
This commit is contained in:
@@ -1,19 +1,23 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "pol0.h"
|
||||
#include "xuartlite.h"
|
||||
|
||||
uint8_t UartRead();
|
||||
void UartWrite(uint8_t);
|
||||
|
||||
struct Gpio {
|
||||
volatile uint32_t data;
|
||||
};
|
||||
|
||||
#define gpio0 ((Gpio*)0x40000000)
|
||||
#define gpio0 ((Gpio*)GPIO0_BASE)
|
||||
|
||||
namespace {
|
||||
constexpr uintptr_t kUart0BaseAddress = 0x40600000;
|
||||
|
||||
XUartLite uart0_inst;
|
||||
XUartLite_Config uart0_config = {
|
||||
.DeviceId = 0,
|
||||
.RegBaseAddr = kUart0BaseAddress,
|
||||
.RegBaseAddr = UART0_BASE,
|
||||
.BaudRate = 115200,
|
||||
.UseParity = false,
|
||||
.DataBits = 8,
|
||||
@@ -25,15 +29,6 @@ void InitUarts() {
|
||||
XUartLite_CfgInitialize(uart0, &uart0_config, uart0_config.RegBaseAddr);
|
||||
}
|
||||
|
||||
uint8_t UartRead() {
|
||||
uint8_t c;
|
||||
while (XUartLite_Recv(uart0, &c, 1) < 1) {
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
void UartWrite(uint8_t c) { XUartLite_Send(uart0, &c, 1); }
|
||||
|
||||
uint32_t UartRead32() {
|
||||
uint32_t val = 0;
|
||||
|
||||
@@ -45,8 +40,21 @@ uint32_t UartRead32() {
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
uint8_t UartRead() {
|
||||
uint8_t c;
|
||||
while (XUartLite_Recv(uart0, &c, 1) < 1) {
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
void UartWrite(uint8_t c) {
|
||||
XUartLite_Send(uart0, &c, 1);
|
||||
while (XUartLite_IsSending(uart0)) {}
|
||||
}
|
||||
|
||||
int main() {
|
||||
gpio0->data = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user