fusee: remove unnecessary delay.

This commit is contained in:
Michael Scire 2019-01-26 00:59:27 -08:00
parent 901723621c
commit dc2b8ebab9
4 changed files with 21 additions and 3 deletions

View file

@ -111,6 +111,9 @@ int main(int argc, void **argv) {
print(SCREEN_LOG_LEVEL_MANDATORY, "Now performing nxboot.\n"); print(SCREEN_LOG_LEVEL_MANDATORY, "Now performing nxboot.\n");
uint32_t boot_memaddr = nxboot_main(); uint32_t boot_memaddr = nxboot_main();
/* Wait for the splash screen to have been displayed as long as it should be. */
splash_screen_wait_delay();
/* Finish boot. */
nxboot_finish(boot_memaddr); nxboot_finish(boot_memaddr);
} else { } else {
/* TODO: What else do we want to do in terms of argc/argv? */ /* TODO: What else do we want to do in terms of argc/argv? */

View file

@ -27,6 +27,8 @@
#undef u8 #undef u8
#undef u32 #undef u32
static uint32_t g_splash_start_time = 0;
static void render_bmp(const uint32_t *bmp_data, uint32_t *framebuffer, uint32_t bmp_width, uint32_t bmp_height, uint32_t bmp_pos_x, uint32_t bmp_pos_y) { static void render_bmp(const uint32_t *bmp_data, uint32_t *framebuffer, uint32_t bmp_width, uint32_t bmp_height, uint32_t bmp_pos_x, uint32_t bmp_pos_y) {
/* Render the BMP. */ /* Render the BMP. */
for (uint32_t y = bmp_pos_y; y < (bmp_pos_y + bmp_height); y++) { for (uint32_t y = bmp_pos_y; y < (bmp_pos_y + bmp_height); y++) {
@ -39,6 +41,11 @@ static void render_bmp(const uint32_t *bmp_data, uint32_t *framebuffer, uint32_t
console_display(framebuffer); console_display(framebuffer);
} }
void splash_screen_wait_delay(void) {
/* Ensure the splash screen is displayed for at least three seconds. */
udelay_absolute(g_splash_start_time, 3000000);
}
void display_splash_screen_bmp(const char *custom_splash_path, void *fb_address) { void display_splash_screen_bmp(const char *custom_splash_path, void *fb_address) {
uint8_t *splash_screen = (uint8_t *)splash_screen_bmp; uint8_t *splash_screen = (uint8_t *)splash_screen_bmp;
@ -84,7 +91,7 @@ void display_splash_screen_bmp(const char *custom_splash_path, void *fb_address)
} else { } else {
fatal_error("Invalid splash screen format!\n"); fatal_error("Invalid splash screen format!\n");
} }
/* Display the splash screen for two and a half seconds. */ /* Note the time we started displaying the splash. */
udelay(2500000); g_splash_start_time = get_time_us();
} }

View file

@ -26,5 +26,6 @@
#define SPLASH_SCREEN_SIZE_MAX (SPLASH_SCREEN_HEIGHT_MAX * SPLASH_SCREEN_STRIDE * 4) #define SPLASH_SCREEN_SIZE_MAX (SPLASH_SCREEN_HEIGHT_MAX * SPLASH_SCREEN_STRIDE * 4)
void display_splash_screen_bmp(const char *custom_splash_path, void *fb_address); void display_splash_screen_bmp(const char *custom_splash_path, void *fb_address);
void splash_screen_wait_delay(void);
#endif #endif

View file

@ -81,6 +81,13 @@ static inline void udelay(uint32_t usecs) {
while (get_time_us() - start < usecs); while (get_time_us() - start < usecs);
} }
/**
* Delays until a number of usecs have passed since an absolute start time.
*/
static inline void udelay_absolute(uint32_t start, uint32_t usecs) {
while (get_time_us() - start < usecs);
}
/** /**
* Delays for a given number of milliseconds. * Delays for a given number of milliseconds.
*/ */