exo2: implement remainder of warmboot tz code

This commit is contained in:
Michael Scire 2020-05-13 10:56:07 -07:00 committed by SciresM
parent 97ab282351
commit ad664daea5
21 changed files with 691 additions and 17 deletions

View file

@ -40,9 +40,30 @@ namespace ams::log {
}
}();
ALWAYS_INLINE void SetupUart() {
if constexpr (UartLogPort == uart::Port_ReservedDebug) {
/* Logging to the debug port. */
pinmux::SetupUartA();
clkrst::EnableUartAClock();
} else if constexpr (UartLogPort == uart::Port_LeftJoyCon) {
/* Logging to left joy-con (e.g. with Joyless). */
pinmux::SetupUartB();
clkrst::EnableUartBClock();
} else if constexpr (UartLogPort == uart::Port_RightJoyCon) {
/* Logging to right joy-con (e.g. with Joyless). */
pinmux::SetupUartC();
clkrst::EnableUartCClock();
} else {
__builtin_unreachable();
}
}
}
void Initialize() {
/* Initialize pinmux and clock for the target uart port. */
SetupUart();
/* Initialize the target uart port. */
uart::Initialize(UartLogPort, 115200, UartPortFlags);
@ -50,4 +71,20 @@ namespace ams::log {
g_initialized_uart = true;
}
void Finalize() {
g_initialized_uart = false;
}
void SendText(const void *text, size_t size) {
if (g_initialized_uart) {
uart::SendText(UartLogPort, text, size);
}
}
void Flush() {
if (g_initialized_uart) {
uart::WaitFlush(UartLogPort);
}
}
}