3 * Joe Hershberger, National Instruments, joe.hershberger@ni.com
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 #ifndef __ENV_CALLBACK_H__
25 #define __ENV_CALLBACK_H__
27 #include <env_flags.h>
28 #include <linker_lists.h>
31 #define ENV_CALLBACK_VAR ".callbacks"
33 /* Board configs can define additional static callback bindings */
34 #ifndef CONFIG_ENV_CALLBACK_LIST_STATIC
35 #define CONFIG_ENV_CALLBACK_LIST_STATIC
38 #ifdef CONFIG_SILENT_CONSOLE
39 #define SILENT_CALLBACK "silent:silent,"
41 #define SILENT_CALLBACK
44 #ifdef CONFIG_SPLASHIMAGE_GUARD
45 #define SPLASHIMAGE_CALLBACK "splashimage:splashimage,"
47 #define SPLASHIMAGE_CALLBACK
51 * This list of callback bindings is static, but may be overridden by defining
52 * a new association in the ".callbacks" environment variable.
54 #define ENV_CALLBACK_LIST_STATIC ENV_CALLBACK_VAR ":callbacks," \
55 ENV_FLAGS_VAR ":flags," \
56 "baudrate:baudrate," \
57 "bootfile:bootfile," \
58 "loadaddr:loadaddr," \
60 SPLASHIMAGE_CALLBACK \
61 "stdin:console,stdout:console,stderr:console," \
62 CONFIG_ENV_CALLBACK_LIST_STATIC
65 const char *name; /* Callback name */
66 int (*callback)(const char *name, const char *value, enum env_op op,
70 void env_callback_init(ENTRY *var_entry);
73 * Define a callback that can be associated with variables.
74 * when associated through the ".callbacks" environment variable, the callback
75 * will be executed any time the variable is inserted, overwritten, or deleted.
77 #ifdef CONFIG_SPL_BUILD
78 #define U_BOOT_ENV_CALLBACK(name, callback) \
79 static inline void _u_boot_env_noop_##name(void) \
84 #define U_BOOT_ENV_CALLBACK(name, callback) \
85 ll_entry_declare(struct env_clbk_tbl, name, env_clbk) = \
89 #endif /* __ENV_CALLBACK_H__ */