]>
Commit | Line | Data |
---|---|---|
eda0ba38 HS |
1 | /* |
2 | * (C) Copyright 2013 | |
3 | * Heiko Schocher, DENX Software Engineering, hs@denx.de. | |
4 | * | |
5 | * SPDX-License-Identifier: GPL-2.0+ | |
6 | */ | |
7 | ||
8 | #include <common.h> | |
01510091 | 9 | #include <environment.h> |
eda0ba38 HS |
10 | |
11 | void bootcount_store(ulong a) | |
12 | { | |
bfebc8c9 | 13 | int upgrade_available = env_get_ulong("upgrade_available", 10, 0); |
eda0ba38 HS |
14 | |
15 | if (upgrade_available) { | |
018f5303 | 16 | env_set_ulong("bootcount", a); |
01510091 | 17 | env_save(); |
eda0ba38 HS |
18 | } |
19 | } | |
20 | ||
21 | ulong bootcount_load(void) | |
22 | { | |
bfebc8c9 | 23 | int upgrade_available = env_get_ulong("upgrade_available", 10, 0); |
eda0ba38 HS |
24 | ulong val = 0; |
25 | ||
26 | if (upgrade_available) | |
bfebc8c9 | 27 | val = env_get_ulong("bootcount", 10, 0); |
eda0ba38 HS |
28 | |
29 | return val; | |
30 | } |