From f98ce0c90924237ff363a02e9680db5a0826b638 Mon Sep 17 00:00:00 2001 From: misson20000 Date: Sun, 18 Oct 2020 14:54:00 -0700 Subject: [PATCH] fusee-primary: log to UART-B --- fusee/fusee-primary/src/hwinit.c | 14 +++++++------- fusee/fusee-primary/src/lib/log.c | 5 +++-- fusee/fusee-primary/src/lib/log.h | 3 +-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/fusee/fusee-primary/src/hwinit.c b/fusee/fusee-primary/src/hwinit.c index 44b7d9456..a0632647a 100644 --- a/fusee/fusee-primary/src/hwinit.c +++ b/fusee/fusee-primary/src/hwinit.c @@ -65,9 +65,9 @@ void config_gpios() pinmux->uart3_tx = 0; pinmux->pe6 = PINMUX_INPUT; pinmux->ph6 = PINMUX_INPUT; - - gpio_configure_mode(TEGRA_GPIO(G, 0), GPIO_MODE_GPIO); - gpio_configure_mode(TEGRA_GPIO(D, 1), GPIO_MODE_GPIO); + + gpio_configure_mode(TEGRA_GPIO(G, 0), GPIO_MODE_SFIO); + gpio_configure_mode(TEGRA_GPIO(D, 1), GPIO_MODE_SFIO); gpio_configure_mode(TEGRA_GPIO(E, 6), GPIO_MODE_GPIO); gpio_configure_mode(TEGRA_GPIO(H, 6), GPIO_MODE_GPIO); gpio_configure_direction(TEGRA_GPIO(G, 0), GPIO_DIRECTION_INPUT); @@ -78,6 +78,7 @@ void config_gpios() i2c_config(I2C_1); i2c_config(I2C_5); uart_config(UART_A); + uart_config(UART_B); /* Configure volume up/down as inputs. */ gpio_configure_mode(GPIO_BUTTON_VOL_UP, GPIO_MODE_GPIO); @@ -213,10 +214,9 @@ void nx_hwinit() config_gpios(); /* Uncomment for UART debugging. */ - /* - clkrst_reboot(CARDEVICE_UARTC); - uart_init(UART_C, 115200); - */ + + clkrst_reboot(CARDEVICE_UARTB); + uart_init(UART_B, 115200); /* Reboot CL-DVFS. */ clkrst_reboot(CARDEVICE_CL_DVFS); diff --git a/fusee/fusee-primary/src/lib/log.c b/fusee/fusee-primary/src/lib/log.c index eb6734da7..26e0cb8a3 100644 --- a/fusee/fusee-primary/src/lib/log.c +++ b/fusee/fusee-primary/src/lib/log.c @@ -17,6 +17,7 @@ #include "log.h" #include "../display/video_fb.h" +#include "../uart.h" #include "vsprintf.h" /* default log level for screen output */ @@ -31,7 +32,7 @@ ScreenLogLevel log_get_log_level() { } void log_to_uart(const char *message) { - /* TODO: add UART logging */ + uart_send(UART_B, message, strlen(message)); } static void print_to_screen(ScreenLogLevel screen_log_level, char *message) { @@ -124,4 +125,4 @@ void print(ScreenLogLevel screen_log_level, const char * fmt, ...) log_to_uart(message); print_to_screen(screen_log_level, message); -} \ No newline at end of file +} diff --git a/fusee/fusee-primary/src/lib/log.h b/fusee/fusee-primary/src/lib/log.h index d1c5777f3..eea293e33 100644 --- a/fusee/fusee-primary/src/lib/log.h +++ b/fusee/fusee-primary/src/lib/log.h @@ -36,8 +36,7 @@ extern ScreenLogLevel g_screen_log_level; void log_set_log_level(ScreenLogLevel screen_log_level); ScreenLogLevel log_get_log_level(); -void log_to_uart(const char *message); void vprint(ScreenLogLevel screen_log_level, const char *fmt, va_list args); void print(ScreenLogLevel screen_log_level, const char* fmt, ...); -#endif \ No newline at end of file +#endif