mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-06-09 23:36:03 +09:00
main: Add debug_bootkeys to avoid #ifdefs
Define a simple debug condition at the top of the file, to avoid using lots of #ifdefs later on. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
3e4088737b
commit
d34d186ef9
|
@ -53,6 +53,11 @@ void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progre
|
||||||
#define debug_parser(fmt, args...) \
|
#define debug_parser(fmt, args...) \
|
||||||
debug_cond(DEBUG_PARSER, fmt, ##args)
|
debug_cond(DEBUG_PARSER, fmt, ##args)
|
||||||
|
|
||||||
|
#ifndef DEBUG_BOOTKEYS
|
||||||
|
#define DEBUG_BOOTKEYS 0
|
||||||
|
#endif
|
||||||
|
#define debug_bootkeys(fmt, args...) \
|
||||||
|
debug_cond(DEBUG_BOOTKEYS, fmt, ##args)
|
||||||
|
|
||||||
char console_buffer[CONFIG_SYS_CBSIZE + 1]; /* console I/O buffer */
|
char console_buffer[CONFIG_SYS_CBSIZE + 1]; /* console I/O buffer */
|
||||||
|
|
||||||
|
@ -138,11 +143,9 @@ static int abortboot_keyed(int bootdelay)
|
||||||
presskey_max = presskey_max > delaykey[i].len ?
|
presskey_max = presskey_max > delaykey[i].len ?
|
||||||
presskey_max : delaykey[i].len;
|
presskey_max : delaykey[i].len;
|
||||||
|
|
||||||
# if DEBUG_BOOTKEYS
|
debug_bootkeys("%s key:<%s>\n",
|
||||||
printf("%s key:<%s>\n",
|
delaykey[i].retry ? "delay" : "stop",
|
||||||
delaykey[i].retry ? "delay" : "stop",
|
delaykey[i].str ? delaykey[i].str : "NULL");
|
||||||
delaykey[i].str ? delaykey[i].str : "NULL");
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In order to keep up with incoming data, check timeout only
|
/* In order to keep up with incoming data, check timeout only
|
||||||
|
@ -167,10 +170,9 @@ static int abortboot_keyed(int bootdelay)
|
||||||
memcmp (presskey + presskey_len - delaykey[i].len,
|
memcmp (presskey + presskey_len - delaykey[i].len,
|
||||||
delaykey[i].str,
|
delaykey[i].str,
|
||||||
delaykey[i].len) == 0) {
|
delaykey[i].len) == 0) {
|
||||||
# if DEBUG_BOOTKEYS
|
debug_bootkeys("got %skey\n",
|
||||||
printf("got %skey\n",
|
delaykey[i].retry ? "delay" :
|
||||||
delaykey[i].retry ? "delay" : "stop");
|
"stop");
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef CONFIG_BOOT_RETRY_TIME
|
# ifdef CONFIG_BOOT_RETRY_TIME
|
||||||
/* don't retry auto boot */
|
/* don't retry auto boot */
|
||||||
|
@ -182,10 +184,8 @@ static int abortboot_keyed(int bootdelay)
|
||||||
}
|
}
|
||||||
} while (!abort && get_ticks() <= etime);
|
} while (!abort && get_ticks() <= etime);
|
||||||
|
|
||||||
# if DEBUG_BOOTKEYS
|
|
||||||
if (!abort)
|
if (!abort)
|
||||||
puts("key timeout\n");
|
debug_bootkeys("key timeout\n");
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_SILENT_CONSOLE
|
#ifdef CONFIG_SILENT_CONSOLE
|
||||||
if (abort)
|
if (abort)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user