Blame view
include/env_callback.h
2.37 KB
170ab1107
|
1 2 3 4 |
/* * (C) Copyright 2012 * Joe Hershberger, National Instruments, joe.hershberger@ni.com * |
1a4596601
|
5 |
* SPDX-License-Identifier: GPL-2.0+ |
170ab1107
|
6 7 8 9 |
*/ #ifndef __ENV_CALLBACK_H__ #define __ENV_CALLBACK_H__ |
2598090b7
|
10 |
#include <env_flags.h> |
170ab1107
|
11 12 13 14 15 16 17 18 19 |
#include <linker_lists.h> #include <search.h> #define ENV_CALLBACK_VAR ".callbacks" /* Board configs can define additional static callback bindings */ #ifndef CONFIG_ENV_CALLBACK_LIST_STATIC #define CONFIG_ENV_CALLBACK_LIST_STATIC #endif |
e080d545f
|
20 21 22 23 24 |
#ifdef CONFIG_SILENT_CONSOLE #define SILENT_CALLBACK "silent:silent," #else #define SILENT_CALLBACK #endif |
c08804853
|
25 26 27 28 29 |
#ifdef CONFIG_SPLASHIMAGE_GUARD #define SPLASHIMAGE_CALLBACK "splashimage:splashimage," #else #define SPLASHIMAGE_CALLBACK #endif |
bdf1fe4e6
|
30 31 |
#ifdef CONFIG_REGEX #define ENV_DOT_ESCAPE "\\" |
f7848d90d
|
32 |
#define ETHADDR_WILDCARD "\\d?" |
bdf1fe4e6
|
33 34 |
#else #define ENV_DOT_ESCAPE |
f7848d90d
|
35 |
#define ETHADDR_WILDCARD |
bdf1fe4e6
|
36 |
#endif |
fd3056337
|
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#ifdef CONFIG_CMD_DNS #define DNS_CALLBACK "dnsip:dnsip," #else #define DNS_CALLBACK #endif #ifdef CONFIG_NET #define NET_CALLBACKS \ "bootfile:bootfile," \ "ipaddr:ipaddr," \ "gatewayip:gatewayip," \ "netmask:netmask," \ "serverip:serverip," \ "nvlan:nvlan," \ "vlan:vlan," \ |
6e0d26c05
|
52 |
DNS_CALLBACK \ |
f7848d90d
|
53 |
"eth" ETHADDR_WILDCARD "addr:ethaddr," |
fd3056337
|
54 55 56 |
#else #define NET_CALLBACKS #endif |
170ab1107
|
57 58 59 60 |
/* * This list of callback bindings is static, but may be overridden by defining * a new association in the ".callbacks" environment variable. */ |
bdf1fe4e6
|
61 62 |
#define ENV_CALLBACK_LIST_STATIC ENV_DOT_ESCAPE ENV_CALLBACK_VAR ":callbacks," \ ENV_DOT_ESCAPE ENV_FLAGS_VAR ":flags," \ |
32057717e
|
63 |
"baudrate:baudrate," \ |
fd3056337
|
64 |
NET_CALLBACKS \ |
1cf0a8b2f
|
65 |
"loadaddr:loadaddr," \ |
e080d545f
|
66 |
SILENT_CALLBACK \ |
c08804853
|
67 |
SPLASHIMAGE_CALLBACK \ |
849d5d9cd
|
68 |
"stdin:console,stdout:console,stderr:console," \ |
170ab1107
|
69 70 71 72 73 74 75 |
CONFIG_ENV_CALLBACK_LIST_STATIC struct env_clbk_tbl { const char *name; /* Callback name */ int (*callback)(const char *name, const char *value, enum env_op op, int flags); }; |
170ab1107
|
76 77 78 79 80 81 82 |
void env_callback_init(ENTRY *var_entry); /* * Define a callback that can be associated with variables. * when associated through the ".callbacks" environment variable, the callback * will be executed any time the variable is inserted, overwritten, or deleted. */ |
f8cfcf1b1
|
83 84 |
#ifdef CONFIG_SPL_BUILD #define U_BOOT_ENV_CALLBACK(name, callback) \ |
3ea664c7c
|
85 |
static inline __maybe_unused void _u_boot_env_noop_##name(void) \ |
f8cfcf1b1
|
86 87 88 89 |
{ \ (void)callback; \ } #else |
170ab1107
|
90 |
#define U_BOOT_ENV_CALLBACK(name, callback) \ |
ef123c525
|
91 |
ll_entry_declare(struct env_clbk_tbl, name, env_clbk) = \ |
170ab1107
|
92 |
{#name, callback} |
f8cfcf1b1
|
93 |
#endif |
170ab1107
|
94 95 |
#endif /* __ENV_CALLBACK_H__ */ |