1 /*
2  * Copyright (c) 2020 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <kernel.h>
8 #include <sys/util.h>
9 #include <init.h>
10 #include <device.h>
11 #include <version.h>
12 
13 /* boot banner items */
14 #if defined(CONFIG_MULTITHREADING) && defined(CONFIG_BOOT_DELAY) &&            \
15 	CONFIG_BOOT_DELAY > 0
16 #define BOOT_DELAY_BANNER " (delayed boot " STRINGIFY(CONFIG_BOOT_DELAY) "ms)"
17 #else
18 #define BOOT_DELAY_BANNER ""
19 #endif
20 
21 #if defined(CONFIG_BOOT_DELAY) || CONFIG_BOOT_DELAY > 0
boot_banner(void)22 void boot_banner(void)
23 {
24 #if defined(CONFIG_BOOT_DELAY) && CONFIG_BOOT_DELAY > 0
25 	static const unsigned int boot_delay = CONFIG_BOOT_DELAY;
26 #else
27 	static const unsigned int boot_delay;
28 #endif
29 
30 	if (boot_delay > 0 && IS_ENABLED(CONFIG_MULTITHREADING)) {
31 		printk("***** delaying boot " STRINGIFY(
32 			CONFIG_BOOT_DELAY) "ms (per build configuration) *****\n");
33 		k_busy_wait(CONFIG_BOOT_DELAY * USEC_PER_MSEC);
34 	}
35 
36 #if defined(CONFIG_BOOT_BANNER)
37 #ifdef BUILD_VERSION
38 	printk("*** Booting Zephyr OS build %s %s ***\n",
39 	       STRINGIFY(BUILD_VERSION), BOOT_DELAY_BANNER);
40 #else
41 	printk("*** Booting Zephyr OS version %s %s ***\n",
42 	       KERNEL_VERSION_STRING, BOOT_DELAY_BANNER);
43 #endif
44 #endif
45 }
46 #else
boot_banner(void)47 void boot_banner(void)
48 {
49 	/* do nothing */
50 }
51 #endif
52