From c7694dd4837ba12db3bcda872a1047a44566e0e8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 1 Aug 2019 09:46:46 -0600 Subject: env: Move env_set_hex() to env.h Move env_set_hex() over to the new header file along with env_set_addr() which uses it. Signed-off-by: Simon Glass Acked-by: Joe Hershberger --- include/env.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include/env.h') diff --git a/include/env.h b/include/env.h index bf34ac3f86..5c780f30d6 100644 --- a/include/env.h +++ b/include/env.h @@ -10,6 +10,7 @@ #define __ENV_H #include +#include /** * env_get_id() - Gets a sequence number for the environment @@ -62,6 +63,27 @@ int env_match(unsigned char *name, int index); */ int env_get_f(const char *name, char *buf, unsigned int len); +/** + * env_set_hex() - set an environment variable to a hex value + * + * @varname: Variable to adjust + * @value: Value to set for the variable (will be converted to a hex string) + * @return 0 if OK, 1 on error + */ +int env_set_hex(const char *varname, ulong value); + +/** + * env_set_addr - Set an environment variable to an address in hex + * + * @varname: Environment variable to set + * @addr: Value to set it to + * @return 0 if ok, 1 on error + */ +static inline int env_set_addr(const char *varname, const void *addr) +{ + return env_set_hex(varname, (ulong)addr); +} + /** * env_complete() - return an auto-complete for environment variables * -- cgit v1.2.3