arm: add host uart driver tests

All host tests currently pass
Some async refactors may not work well on device, will try later
This commit is contained in:
2023-06-02 23:33:01 -07:00
parent 1f2f08e525
commit f274749050
14 changed files with 494 additions and 97 deletions

View File

@@ -30,7 +30,7 @@ void SetupUart() {
}
void SetupTimer() {
timer0->SetupAsWdt(100000 * 4000);
timer0->SetupAsWdt(100000 * 1); //4000);
timer0->EnableT1();
_vector_table[16 + Timer0_IRQn] = reinterpret_cast<uint32_t>(Timer0Isr);
@@ -38,7 +38,7 @@ void SetupTimer() {
}
#if 0 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101133
#if 1 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101133
async::task<> echo() {
async::task<uint8_t> reader = UartReadLoop();
async::gimme<std::span<const std::byte>> feeder;
@@ -52,8 +52,7 @@ async::task<> echo() {
co_await feeder.feed(std::as_bytes(std::span{&c, 1}));
}
}
#endif
#else
async::task<> echo() {
async::task<uint8_t> reader = UartReadLoop();
while (1) {
@@ -64,7 +63,9 @@ async::task<> echo() {
co_await UartWrite(std::as_bytes(std::span{&c, 1}));
}
}
#endif
[[maybe_unused]]
async::task<> dump_trace() {
while (1) {
co_await async::delay(5000);
@@ -86,7 +87,7 @@ int main() {
UartWriteBlocking("timer setup done\r\n");
async::schedule(echo().h);
async::schedule(dump_trace().h);
// async::schedule(dump_trace().h);
tracing::trace(tracing::TraceEvent::kUartIsr);
tracing::trace(tracing::TraceEvent::kUartIsr);