finsh_var.h 986 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2010-03-22 Bernard first version
  9. */
  10. #ifndef __FINSH_VAR_H__
  11. #define __FINSH_VAR_H__
  12. #include <finsh.h>
  13. /*
  14. * The variable in finsh is put in data segment as a global variable.
  15. * The 'finsh_var' structure presents the structure of variable in data segment.
  16. */
  17. struct finsh_var
  18. {
  19. char name[FINSH_NAME_MAX + 1]; /* the name of variable */
  20. uint8_t type; /* the type of variable */
  21. /* variable value */
  22. union {
  23. char char_value;
  24. short short_value;
  25. int int_value;
  26. long long_value;
  27. void* ptr;
  28. }value;
  29. };
  30. extern struct finsh_var global_variable[];
  31. int finsh_var_init(void);
  32. int finsh_var_insert(const char* name, int type);
  33. int finsh_var_delete(const char* name);
  34. struct finsh_var* finsh_var_lookup(const char* name);
  35. #endif