Blame view
common/bootretry.c
1.33 KB
83d290c56 SPDX: Convert all... |
1 |
// SPDX-License-Identifier: GPL-2.0+ |
0098e179e Move bootretry co... |
2 3 4 |
/* * (C) Copyright 2000 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
0098e179e Move bootretry co... |
5 6 7 8 9 |
*/ #include <common.h> #include <bootretry.h> #include <cli.h> |
7b51b576d env: Move env_get... |
10 |
#include <env.h> |
0098e179e Move bootretry co... |
11 |
#include <errno.h> |
1045315df common: Move get_... |
12 |
#include <time.h> |
0098e179e Move bootretry co... |
13 14 15 16 17 18 19 20 21 22 23 24 |
#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 */ |
b26440f1f Rename bootretry ... |
25 |
void bootretry_init_cmd_timeout(void) |
0098e179e Move bootretry co... |
26 |
{ |
00caae6d4 env: Rename geten... |
27 |
char *s = env_get("bootretry"); |
0098e179e Move bootretry co... |
28 29 30 31 32 33 34 35 36 37 38 39 40 |
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 */ |
b26440f1f Rename bootretry ... |
41 |
void bootretry_reset_cmd_timeout(void) |
0098e179e Move bootretry co... |
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
{ 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; } |