From ca0e41e8a092e8ff639c1b5b8e3412674dd5cd3b Mon Sep 17 00:00:00 2001 From: hexkyz Date: Fri, 28 Sep 2018 21:12:59 +0100 Subject: [PATCH] fusee: Improve integration with the new logging system fusee: Implement log level configuration from BCT.ini --- fusee/fusee-primary/src/lib/log.c | 10 +++-- fusee/fusee-primary/src/lib/log.h | 6 +-- fusee/fusee-primary/src/main.c | 47 +++++++++++++++----- fusee/fusee-primary/src/sdmmc/sdmmc_core.c | 43 ++++-------------- fusee/fusee-primary/src/sdmmc/sdmmc_core.h | 10 ----- fusee/fusee-primary/src/stage2.c | 11 +---- fusee/fusee-primary/src/stage2.h | 10 ++++- fusee/fusee-secondary/src/console.c | 10 ----- fusee/fusee-secondary/src/console.h | 7 +++ fusee/fusee-secondary/src/lib/log.c | 10 +++-- fusee/fusee-secondary/src/lib/log.h | 6 +-- fusee/fusee-secondary/src/main.c | 6 +-- fusee/fusee-secondary/src/sdmmc/sdmmc_core.c | 41 +++-------------- fusee/fusee-secondary/src/sdmmc/sdmmc_core.h | 10 ----- fusee/fusee-secondary/src/splash_screen.c | 6 +-- fusee/fusee-secondary/src/stage2.h | 4 +- 16 files changed, 98 insertions(+), 139 deletions(-) diff --git a/fusee/fusee-primary/src/lib/log.c b/fusee/fusee-primary/src/lib/log.c index 4aa396d72..37006b166 100644 --- a/fusee/fusee-primary/src/lib/log.c +++ b/fusee/fusee-primary/src/lib/log.c @@ -20,17 +20,21 @@ #include "vsprintf.h" /* default log level for screen output */ -ScreenLogLevel g_screen_log_level = SCREEN_LOG_LEVEL_MANDATORY; +ScreenLogLevel g_screen_log_level = SCREEN_LOG_LEVEL_NONE; void log_set_log_level(ScreenLogLevel log_level) { g_screen_log_level = log_level; } +ScreenLogLevel log_get_log_level() { + return g_screen_log_level; +} + void log_to_uart(const char *message) { /* TODO: add UART logging */ } -void print_to_screen(ScreenLogLevel screen_log_level, char *message) { +static void print_to_screen(ScreenLogLevel screen_log_level, char *message) { /* don't print to screen if below log level */ if(screen_log_level > g_screen_log_level) return; @@ -58,7 +62,7 @@ void vprint(ScreenLogLevel screen_log_level, const char *fmt, va_list args) print_to_screen(screen_log_level, buf); } -void add_prefix(ScreenLogLevel screen_log_level, const char *fmt, char *buf) { +static void add_prefix(ScreenLogLevel screen_log_level, const char *fmt, char *buf) { char typebuf[] = "[%s] %s"; /* apply prefix and append message format */ diff --git a/fusee/fusee-primary/src/lib/log.h b/fusee/fusee-primary/src/lib/log.h index 00ddfdb6e..32703a318 100644 --- a/fusee/fusee-primary/src/lib/log.h +++ b/fusee/fusee-primary/src/lib/log.h @@ -14,8 +14,8 @@ * along with this program. If not, see . */ -#ifndef FUSEE_PRIMARY_PRINT_H -#define FUSEE_PRIMARY_PRINT_H +#ifndef FUSEE_LOG_H +#define FUSEE_LOG_H #define PRINT_MESSAGE_MAX_LENGTH 512 @@ -32,10 +32,10 @@ typedef enum { SCREEN_LOG_LEVEL_NO_PREFIX = 0x100 /* OR this to your LOG_LEVEL to prevent prefix creation */ } ScreenLogLevel; -/* TODO: make this configurable by BCT.ini */ 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, ...); diff --git a/fusee/fusee-primary/src/main.c b/fusee/fusee-primary/src/main.c index b41149ce4..130362e0a 100644 --- a/fusee/fusee-primary/src/main.c +++ b/fusee/fusee-primary/src/main.c @@ -26,6 +26,8 @@ #include "sdmmc/sdmmc.h" #include "lib/fatfs/ff.h" #include "lib/log.h" +#include "lib/vsprintf.h" +#include "lib/ini.h" #include "display/video_fb.h" extern void (*__program_exit_callback)(int rc); @@ -33,6 +35,8 @@ extern void (*__program_exit_callback)(int rc); static void *g_framebuffer; static char g_bct0_buffer[BCTO_MAX_SIZE]; +#define CONFIG_LOG_LEVEL_KEY "log_level" + #define DEFAULT_BCT0_FOR_DEBUG \ "BCT0\n"\ "[stage1]\n"\ @@ -45,25 +49,41 @@ static const char *load_config(void) { print(SCREEN_LOG_LEVEL_DEBUG, "Failed to read BCT0 from SD!\n"); print(SCREEN_LOG_LEVEL_DEBUG, "Using default BCT0!\n"); memcpy(g_bct0_buffer, DEFAULT_BCT0_FOR_DEBUG, sizeof(DEFAULT_BCT0_FOR_DEBUG)); - /* TODO: Stop using default. */ - /* printk("Error: Failed to load BCT.ini!\n"); - * generic_panic(); */ } if (memcmp(g_bct0_buffer, "BCT0", 4) != 0) { fatal_error("Unexpected magic in BCT.ini!\n"); } + /* Return pointer to first line of the ini. */ const char *bct0 = g_bct0_buffer; while (*bct0 && *bct0 != '\n') { bct0++; } + if (!bct0) { fatal_error("BCT.ini has no newline!\n"); } + return bct0; } +static int config_ini_handler(void *user, const char *section, const char *name, const char *value) { + if (strcmp(section, "config") == 0) { + if (strcmp(name, CONFIG_LOG_LEVEL_KEY) == 0) { + ScreenLogLevel *config_log_level = (ScreenLogLevel *)user; + int log_level = 0; + sscanf(value, "%d", &log_level); + *config_log_level = (ScreenLogLevel)log_level; + } else { + return 0; + } + } else { + return 0; + } + return 1; +} + static void setup_env(void) { g_framebuffer = (void *)0xC0000000; @@ -111,20 +131,26 @@ int main(void) { const char *stage2_path; stage2_args_t *stage2_args; uint32_t stage2_version = 0; - - /* Set the SDMMC's driver logging level. */ - sdmmc_set_log_level(SDMMC_LOG_INFO); + ScreenLogLevel log_level = SCREEN_LOG_LEVEL_MANDATORY; /* Initialize the display, console, etc. */ setup_env(); - /* Say hello. */ - print(SCREEN_LOG_LEVEL_MANDATORY, "Welcome to Atmosph\xe8re Fus\xe9" "e!\n"); - print(SCREEN_LOG_LEVEL_DEBUG, "Using color linear framebuffer at 0x%p!\n", g_framebuffer); - /* Load the BCT0 configuration ini off of the SD. */ bct0 = load_config(); + /* Extract the logging level from the BCT.ini file. */ + if (ini_parse_string(bct0, config_ini_handler, &log_level) < 0) { + fatal_error("Failed to parse BCT.ini!\n"); + } + + /* Override the global logging level. */ + log_set_log_level(log_level); + + /* Say hello. */ + print(SCREEN_LOG_LEVEL_MANDATORY, "Welcome to Atmosph\xe8re Fus\xe9" "e!\n"); + print(SCREEN_LOG_LEVEL_DEBUG, "Using color linear framebuffer at 0x%p!\n", g_framebuffer); + /* Load the loader payload into DRAM. */ load_stage2(bct0); @@ -133,6 +159,7 @@ int main(void) { strcpy(g_chainloader_arg_data, stage2_path); stage2_args = (stage2_args_t *)(g_chainloader_arg_data + strlen(stage2_path) + 1); /* May be unaligned. */ memcpy(&stage2_args->version, &stage2_version, 4); + stage2_args->log_level = log_level; stage2_args->display_initialized = false; strcpy(stage2_args->bct0, bct0); g_chainloader_argc = 2; diff --git a/fusee/fusee-primary/src/sdmmc/sdmmc_core.c b/fusee/fusee-primary/src/sdmmc/sdmmc_core.c index 9d353d3b9..ded10a7ab 100644 --- a/fusee/fusee-primary/src/sdmmc/sdmmc_core.c +++ b/fusee/fusee-primary/src/sdmmc/sdmmc_core.c @@ -32,39 +32,12 @@ #include "../max7762x.h" #include "../lib/log.h" -static SdmmcLogLevel g_sdmmc_log_level = SDMMC_LOG_NONE; - -void sdmmc_set_log_level(SdmmcLogLevel log_level) +static void sdmmc_print(sdmmc_t *sdmmc, ScreenLogLevel screen_log_level, char *fmt, va_list list) { - g_sdmmc_log_level = log_level; -} - -static void sdmmc_print(sdmmc_t *sdmmc, SdmmcLogLevel log_level, char *fmt, va_list list) -{ - if (log_level > g_sdmmc_log_level) + if (screen_log_level > log_get_log_level()) return; - - char sdmmc_fmt[] = "%s: "; - ScreenLogLevel screen_log_level = SCREEN_LOG_LEVEL_ERROR; - - switch (log_level) { - case SDMMC_LOG_ERROR: - screen_log_level = SCREEN_LOG_LEVEL_ERROR; - break; - case SDMMC_LOG_WARN: - screen_log_level = SCREEN_LOG_LEVEL_WARNING; - break; - case SDMMC_LOG_INFO: - screen_log_level = SCREEN_LOG_LEVEL_DEBUG; - break; - case SDMMC_LOG_DEBUG: - screen_log_level = SCREEN_LOG_LEVEL_DEBUG; - break; - default: - break; - } - - print(screen_log_level, sdmmc_fmt, sdmmc->name); + + print(screen_log_level, "%s: ", sdmmc->name); vprint(screen_log_level, fmt, list); print(screen_log_level | SCREEN_LOG_LEVEL_NO_PREFIX, "\n"); } @@ -74,7 +47,7 @@ void sdmmc_error(sdmmc_t *sdmmc, char *fmt, ...) va_list list; va_start(list, fmt); - sdmmc_print(sdmmc, SDMMC_LOG_ERROR, fmt, list); + sdmmc_print(sdmmc, SCREEN_LOG_LEVEL_ERROR, fmt, list); va_end(list); } @@ -83,7 +56,7 @@ void sdmmc_warn(sdmmc_t *sdmmc, char *fmt, ...) va_list list; va_start(list, fmt); - sdmmc_print(sdmmc, SDMMC_LOG_WARN, fmt, list); + sdmmc_print(sdmmc, SCREEN_LOG_LEVEL_WARNING, fmt, list); va_end(list); } @@ -92,7 +65,7 @@ void sdmmc_info(sdmmc_t *sdmmc, char *fmt, ...) va_list list; va_start(list, fmt); - sdmmc_print(sdmmc, SDMMC_LOG_INFO, fmt, list); + sdmmc_print(sdmmc, SCREEN_LOG_LEVEL_INFO, fmt, list); va_end(list); } @@ -101,7 +74,7 @@ void sdmmc_debug(sdmmc_t *sdmmc, char *fmt, ...) va_list list; va_start(list, fmt); - sdmmc_print(sdmmc, SDMMC_LOG_DEBUG, fmt, list); + sdmmc_print(sdmmc, SCREEN_LOG_LEVEL_DEBUG, fmt, list); va_end(list); } diff --git a/fusee/fusee-primary/src/sdmmc/sdmmc_core.h b/fusee/fusee-primary/src/sdmmc/sdmmc_core.h index edcd3c60f..ccfab130b 100644 --- a/fusee/fusee-primary/src/sdmmc/sdmmc_core.h +++ b/fusee/fusee-primary/src/sdmmc/sdmmc_core.h @@ -181,15 +181,6 @@ #define SDMMC_RSP_SPI_R5 (SDMMC_RSP_SPI_S1|SDMMC_RSP_SPI_S2) #define SDMMC_RSP_SPI_R7 (SDMMC_RSP_SPI_S1|SDMMC_RSP_SPI_B4) -/* Internal logging */ -typedef enum { - SDMMC_LOG_NONE = 0, - SDMMC_LOG_ERROR = 1, - SDMMC_LOG_WARN = 2, - SDMMC_LOG_INFO = 3, - SDMMC_LOG_DEBUG = 4 -} SdmmcLogLevel; - /* SDMMC controllers */ typedef enum { SDMMC_1 = 0, @@ -306,7 +297,6 @@ int sdmmc_execute_tuning(sdmmc_t *sdmmc, SdmmcBusSpeed bus_speed, uint32_t opcod int sdmmc_send_cmd(sdmmc_t *sdmmc, sdmmc_command_t *cmd, sdmmc_request_t *req, uint32_t *num_blocks_out); int sdmmc_load_response(sdmmc_t *sdmmc, uint32_t flags, uint32_t *resp); int sdmmc_abort(sdmmc_t *sdmmc, uint32_t opcode); -void sdmmc_set_log_level(SdmmcLogLevel log_level); void sdmmc_error(sdmmc_t *sdmmc, char *fmt, ...); void sdmmc_warn(sdmmc_t *sdmmc, char *fmt, ...); void sdmmc_info(sdmmc_t *sdmmc, char *fmt, ...); diff --git a/fusee/fusee-primary/src/stage2.c b/fusee/fusee-primary/src/stage2.c index 66b8dcd4b..4d1e1d9da 100644 --- a/fusee/fusee-primary/src/stage2.c +++ b/fusee/fusee-primary/src/stage2.c @@ -13,18 +13,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include -#include "utils.h" -#include "display/video_fb.h" -#include "fs_utils.h" #include "stage2.h" #include "chainloader.h" -#include "lib/log.h" -#include "lib/vsprintf.h" -#include "lib/ini.h" -#include "lib/fatfs/ff.h" +#include "fs_utils.h" +#include "utils.h" char g_stage2_path[0x100] = {0}; diff --git a/fusee/fusee-primary/src/stage2.h b/fusee/fusee-primary/src/stage2.h index 72b22f6a9..e453d159f 100644 --- a/fusee/fusee-primary/src/stage2.h +++ b/fusee/fusee-primary/src/stage2.h @@ -17,7 +17,14 @@ #ifndef FUSEE_STAGE2_H #define FUSEE_STAGE2_H -#include "sdmmc/sdmmc_core.h" +#include +#include + +#include "display/video_fb.h" +#include "lib/log.h" +#include "lib/vsprintf.h" +#include "lib/ini.h" +#include "lib/fatfs/ff.h" /* TODO: Is there a more concise way to do this? */ #define STAGE2_ARGV_PROGRAM_PATH 0 @@ -37,6 +44,7 @@ typedef struct { typedef struct { uint32_t version; + ScreenLogLevel log_level; bool display_initialized; char bct0[BCTO_MAX_SIZE]; } stage2_args_t; diff --git a/fusee/fusee-secondary/src/console.c b/fusee/fusee-secondary/src/console.c index 0eb49fb06..3131620f3 100644 --- a/fusee/fusee-secondary/src/console.c +++ b/fusee/fusee-secondary/src/console.c @@ -14,12 +14,6 @@ * along with this program. If not, see . */ -#include -#include -#include -#include -#include -#include #include "console.h" #include "di.h" #include "display/video_fb.h" @@ -181,7 +175,6 @@ void *console_get_framebuffer(bool enable_display) { if (g_framebuffer != NULL && enable_display) { console_init_display(); } - return g_framebuffer; } @@ -189,8 +182,6 @@ int console_display(const void *framebuffer) { if (!g_display_initialized) { console_init_display(); } - - /* TODO: does this work? */ display_init_framebuffer((void *)framebuffer); return 0; } @@ -199,7 +190,6 @@ int console_resume(void) { if (!g_display_initialized) { console_init_display(); } else { - /* TODO: does this work? */ display_init_framebuffer(g_framebuffer); } return 0; diff --git a/fusee/fusee-secondary/src/console.h b/fusee/fusee-secondary/src/console.h index 492a11299..29c67be5e 100644 --- a/fusee/fusee-secondary/src/console.h +++ b/fusee/fusee-secondary/src/console.h @@ -17,6 +17,13 @@ #ifndef FUSEE_CONSOLE_H #define FUSEE_CONSOLE_H +#include +#include +#include +#include +#include +#include + int console_init(bool display_initialized); void *console_get_framebuffer(bool enable_display); int console_display(const void *framebuffer); /* Must be page-aligned */ diff --git a/fusee/fusee-secondary/src/lib/log.c b/fusee/fusee-secondary/src/lib/log.c index d4cae38b3..402121d4d 100644 --- a/fusee/fusee-secondary/src/lib/log.c +++ b/fusee/fusee-secondary/src/lib/log.c @@ -19,17 +19,21 @@ #include /* default log level for screen output */ -ScreenLogLevel g_screen_log_level = SCREEN_LOG_LEVEL_MANDATORY; +ScreenLogLevel g_screen_log_level = SCREEN_LOG_LEVEL_NONE; void log_set_log_level(ScreenLogLevel log_level) { g_screen_log_level = log_level; } +ScreenLogLevel log_get_log_level() { + return g_screen_log_level; +} + void log_to_uart(const char *message) { /* TODO: add UART logging */ } -void print_to_screen(ScreenLogLevel screen_log_level, char *message) { +static void print_to_screen(ScreenLogLevel screen_log_level, char *message) { /* don't print to screen if below log level */ if(screen_log_level > g_screen_log_level) return; @@ -57,7 +61,7 @@ void vprint(ScreenLogLevel screen_log_level, const char *fmt, va_list args) print_to_screen(screen_log_level, buf); } -void add_prefix(ScreenLogLevel screen_log_level, const char *fmt, char *buf) { +static void add_prefix(ScreenLogLevel screen_log_level, const char *fmt, char *buf) { char typebuf[] = "[%s] %s"; /* apply prefix and append message format */ diff --git a/fusee/fusee-secondary/src/lib/log.h b/fusee/fusee-secondary/src/lib/log.h index 080f34bef..32703a318 100644 --- a/fusee/fusee-secondary/src/lib/log.h +++ b/fusee/fusee-secondary/src/lib/log.h @@ -14,8 +14,8 @@ * along with this program. If not, see . */ -#ifndef FUSEE_SECONDARY_PRINT_H -#define FUSEE_SECONDARY_PRINT_H +#ifndef FUSEE_LOG_H +#define FUSEE_LOG_H #define PRINT_MESSAGE_MAX_LENGTH 512 @@ -32,10 +32,10 @@ typedef enum { SCREEN_LOG_LEVEL_NO_PREFIX = 0x100 /* OR this to your LOG_LEVEL to prevent prefix creation */ } ScreenLogLevel; -/* TODO: make this configurable by BCT.ini */ 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, ...); diff --git a/fusee/fusee-secondary/src/main.c b/fusee/fusee-secondary/src/main.c index ec2ea8bc4..d10e6e7cb 100644 --- a/fusee/fusee-secondary/src/main.c +++ b/fusee/fusee-secondary/src/main.c @@ -52,8 +52,6 @@ static void setup_env(void) { if (nxfs_mount_all() < 0) { fatal_error("Failed to mount at least one parition: %s\n", strerror(errno)); } - - /* TODO: What other hardware init should we do here? */ } static void cleanup_env(void) { @@ -87,8 +85,8 @@ int main(int argc, void **argv) { generic_panic(); } - /* Set the SDMMC's driver logging level. */ - sdmmc_set_log_level(SDMMC_LOG_INFO); + /* Override the global logging level. */ + log_set_log_level(g_stage2_args->log_level); /* Initialize the display, console, FS, etc. */ setup_env(); diff --git a/fusee/fusee-secondary/src/sdmmc/sdmmc_core.c b/fusee/fusee-secondary/src/sdmmc/sdmmc_core.c index 56602bc49..ded10a7ab 100644 --- a/fusee/fusee-secondary/src/sdmmc/sdmmc_core.c +++ b/fusee/fusee-secondary/src/sdmmc/sdmmc_core.c @@ -32,39 +32,12 @@ #include "../max7762x.h" #include "../lib/log.h" -static SdmmcLogLevel g_sdmmc_log_level = SDMMC_LOG_NONE; - -void sdmmc_set_log_level(SdmmcLogLevel log_level) +static void sdmmc_print(sdmmc_t *sdmmc, ScreenLogLevel screen_log_level, char *fmt, va_list list) { - g_sdmmc_log_level = log_level; -} - -static void sdmmc_print(sdmmc_t *sdmmc, SdmmcLogLevel log_level, char *fmt, va_list list) -{ - if (log_level > g_sdmmc_log_level) + if (screen_log_level > log_get_log_level()) return; - - char sdmmc_fmt[] = "%s: "; - ScreenLogLevel screen_log_level = SCREEN_LOG_LEVEL_ERROR; - switch (log_level) { - case SDMMC_LOG_ERROR: - screen_log_level = SCREEN_LOG_LEVEL_ERROR; - break; - case SDMMC_LOG_WARN: - screen_log_level = SCREEN_LOG_LEVEL_WARNING; - break; - case SDMMC_LOG_INFO: - screen_log_level = SCREEN_LOG_LEVEL_DEBUG; - break; - case SDMMC_LOG_DEBUG: - screen_log_level = SCREEN_LOG_LEVEL_DEBUG; - break; - default: - break; - } - - print(screen_log_level, sdmmc_fmt, sdmmc->name); + print(screen_log_level, "%s: ", sdmmc->name); vprint(screen_log_level, fmt, list); print(screen_log_level | SCREEN_LOG_LEVEL_NO_PREFIX, "\n"); } @@ -74,7 +47,7 @@ void sdmmc_error(sdmmc_t *sdmmc, char *fmt, ...) va_list list; va_start(list, fmt); - sdmmc_print(sdmmc, SDMMC_LOG_ERROR, fmt, list); + sdmmc_print(sdmmc, SCREEN_LOG_LEVEL_ERROR, fmt, list); va_end(list); } @@ -83,7 +56,7 @@ void sdmmc_warn(sdmmc_t *sdmmc, char *fmt, ...) va_list list; va_start(list, fmt); - sdmmc_print(sdmmc, SDMMC_LOG_WARN, fmt, list); + sdmmc_print(sdmmc, SCREEN_LOG_LEVEL_WARNING, fmt, list); va_end(list); } @@ -92,7 +65,7 @@ void sdmmc_info(sdmmc_t *sdmmc, char *fmt, ...) va_list list; va_start(list, fmt); - sdmmc_print(sdmmc, SDMMC_LOG_INFO, fmt, list); + sdmmc_print(sdmmc, SCREEN_LOG_LEVEL_INFO, fmt, list); va_end(list); } @@ -101,7 +74,7 @@ void sdmmc_debug(sdmmc_t *sdmmc, char *fmt, ...) va_list list; va_start(list, fmt); - sdmmc_print(sdmmc, SDMMC_LOG_DEBUG, fmt, list); + sdmmc_print(sdmmc, SCREEN_LOG_LEVEL_DEBUG, fmt, list); va_end(list); } diff --git a/fusee/fusee-secondary/src/sdmmc/sdmmc_core.h b/fusee/fusee-secondary/src/sdmmc/sdmmc_core.h index edcd3c60f..ccfab130b 100644 --- a/fusee/fusee-secondary/src/sdmmc/sdmmc_core.h +++ b/fusee/fusee-secondary/src/sdmmc/sdmmc_core.h @@ -181,15 +181,6 @@ #define SDMMC_RSP_SPI_R5 (SDMMC_RSP_SPI_S1|SDMMC_RSP_SPI_S2) #define SDMMC_RSP_SPI_R7 (SDMMC_RSP_SPI_S1|SDMMC_RSP_SPI_B4) -/* Internal logging */ -typedef enum { - SDMMC_LOG_NONE = 0, - SDMMC_LOG_ERROR = 1, - SDMMC_LOG_WARN = 2, - SDMMC_LOG_INFO = 3, - SDMMC_LOG_DEBUG = 4 -} SdmmcLogLevel; - /* SDMMC controllers */ typedef enum { SDMMC_1 = 0, @@ -306,7 +297,6 @@ int sdmmc_execute_tuning(sdmmc_t *sdmmc, SdmmcBusSpeed bus_speed, uint32_t opcod int sdmmc_send_cmd(sdmmc_t *sdmmc, sdmmc_command_t *cmd, sdmmc_request_t *req, uint32_t *num_blocks_out); int sdmmc_load_response(sdmmc_t *sdmmc, uint32_t flags, uint32_t *resp); int sdmmc_abort(sdmmc_t *sdmmc, uint32_t opcode); -void sdmmc_set_log_level(SdmmcLogLevel log_level); void sdmmc_error(sdmmc_t *sdmmc, char *fmt, ...); void sdmmc_warn(sdmmc_t *sdmmc, char *fmt, ...); void sdmmc_info(sdmmc_t *sdmmc, char *fmt, ...); diff --git a/fusee/fusee-secondary/src/splash_screen.c b/fusee/fusee-secondary/src/splash_screen.c index 97b258ccd..17cc302af 100644 --- a/fusee/fusee-secondary/src/splash_screen.c +++ b/fusee/fusee-secondary/src/splash_screen.c @@ -13,8 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include + +#include "console.h" #include "di.h" #include "timers.h" #include "splash_screen.h" @@ -36,7 +36,7 @@ static void render_bmp(const uint32_t *bmp_data, uint32_t *framebuffer, uint32_t } /* Re-initialize the frame buffer. */ - display_init_framebuffer(framebuffer); + console_display(framebuffer); } void display_splash_screen_bmp(const char *custom_splash_path, void *fb_address) { diff --git a/fusee/fusee-secondary/src/stage2.h b/fusee/fusee-secondary/src/stage2.h index c3d18ef49..1274efeee 100644 --- a/fusee/fusee-secondary/src/stage2.h +++ b/fusee/fusee-secondary/src/stage2.h @@ -17,8 +17,9 @@ #ifndef FUSEE_STAGE2_H #define FUSEE_STAGE2_H -#include "utils.h" +#include "lib/log.h" #include "sdmmc/sdmmc.h" +#include "utils.h" /* TODO: Is there a more concise way to do this? */ #define STAGE2_ARGV_PROGRAM_PATH 0 @@ -29,6 +30,7 @@ typedef struct { uint32_t version; + ScreenLogLevel log_level; bool display_initialized; char bct0[BCTO_MAX_SIZE]; } stage2_args_t;