env_callback.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2012
  4. * Joe Hershberger, National Instruments, joe.hershberger@ni.com
  5. */
  6. #ifndef __ENV_CALLBACK_H__
  7. #define __ENV_CALLBACK_H__
  8. #include <env_flags.h>
  9. #include <linker_lists.h>
  10. #include <search.h>
  11. #define ENV_CALLBACK_VAR ".callbacks"
  12. /* Board configs can define additional static callback bindings */
  13. #ifndef CONFIG_ENV_CALLBACK_LIST_STATIC
  14. #define CONFIG_ENV_CALLBACK_LIST_STATIC
  15. #endif
  16. #ifdef CONFIG_SILENT_CONSOLE
  17. #define SILENT_CALLBACK "silent:silent,"
  18. #else
  19. #define SILENT_CALLBACK
  20. #endif
  21. #ifdef CONFIG_SPLASHIMAGE_GUARD
  22. #define SPLASHIMAGE_CALLBACK "splashimage:splashimage,"
  23. #else
  24. #define SPLASHIMAGE_CALLBACK
  25. #endif
  26. #ifdef CONFIG_REGEX
  27. #define ENV_DOT_ESCAPE "\\"
  28. #else
  29. #define ENV_DOT_ESCAPE
  30. #endif
  31. #ifdef CONFIG_CMD_DNS
  32. #define DNS_CALLBACK "dnsip:dnsip,"
  33. #else
  34. #define DNS_CALLBACK
  35. #endif
  36. #ifdef CONFIG_NET
  37. #define NET_CALLBACKS \
  38. "bootfile:bootfile," \
  39. "ipaddr:ipaddr," \
  40. "gatewayip:gatewayip," \
  41. "netmask:netmask," \
  42. "serverip:serverip," \
  43. "nvlan:nvlan," \
  44. "vlan:vlan," \
  45. DNS_CALLBACK \
  46. "eth" ETHADDR_WILDCARD "addr:ethaddr,"
  47. #else
  48. #define NET_CALLBACKS
  49. #endif
  50. /*
  51. * This list of callback bindings is static, but may be overridden by defining
  52. * a new association in the ".callbacks" environment variable.
  53. */
  54. #define ENV_CALLBACK_LIST_STATIC ENV_DOT_ESCAPE ENV_CALLBACK_VAR ":callbacks," \
  55. ENV_DOT_ESCAPE ENV_FLAGS_VAR ":flags," \
  56. "baudrate:baudrate," \
  57. NET_CALLBACKS \
  58. "loadaddr:loadaddr," \
  59. SILENT_CALLBACK \
  60. SPLASHIMAGE_CALLBACK \
  61. "stdin:console,stdout:console,stderr:console," \
  62. "serial#:serialno," \
  63. CONFIG_ENV_CALLBACK_LIST_STATIC
  64. void env_callback_init(struct env_entry *var_entry);
  65. #endif /* __ENV_CALLBACK_H__ */