mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-18 18:59:44 +00:00
83d290c56f
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
58 lines
1.3 KiB
C
58 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (C) Copyright 2000
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <bootretry.h>
|
|
#include <cli.h>
|
|
#include <errno.h>
|
|
#include <watchdog.h>
|
|
|
|
#ifndef CONFIG_BOOT_RETRY_MIN
|
|
#define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME
|
|
#endif
|
|
|
|
static uint64_t endtime; /* must be set, default is instant timeout */
|
|
static int retry_time = -1; /* -1 so can call readline before main_loop */
|
|
|
|
/***************************************************************************
|
|
* initialize command line timeout
|
|
*/
|
|
void bootretry_init_cmd_timeout(void)
|
|
{
|
|
char *s = env_get("bootretry");
|
|
|
|
if (s != NULL)
|
|
retry_time = (int)simple_strtol(s, NULL, 10);
|
|
else
|
|
retry_time = CONFIG_BOOT_RETRY_TIME;
|
|
|
|
if (retry_time >= 0 && retry_time < CONFIG_BOOT_RETRY_MIN)
|
|
retry_time = CONFIG_BOOT_RETRY_MIN;
|
|
}
|
|
|
|
/***************************************************************************
|
|
* reset command line timeout to retry_time seconds
|
|
*/
|
|
void bootretry_reset_cmd_timeout(void)
|
|
{
|
|
endtime = endtick(retry_time);
|
|
}
|
|
|
|
int bootretry_tstc_timeout(void)
|
|
{
|
|
while (!tstc()) { /* while no incoming data */
|
|
if (retry_time >= 0 && get_ticks() > endtime)
|
|
return -ETIMEDOUT;
|
|
WATCHDOG_RESET();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void bootretry_dont_retry(void)
|
|
{
|
|
retry_time = -1;
|
|
}
|