xref: /nrf52832-nimble/rt-thread/components/finsh/finsh_var.h (revision 104654410c56c573564690304ae786df310c91fc)
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 
13 #include <finsh.h>
14 
15 /*
16  * The variable in finsh is put in data segment as a global variable.
17  * The 'finsh_var' structure presents the structure of variable in data segment.
18  */
19 struct finsh_var
20 {
21     char name[FINSH_NAME_MAX + 1];  /* the name of variable */
22 
23     uint8_t type;                   /* the type of variable */
24 
25     /* variable value */
26     union {
27         char    char_value;
28         short   short_value;
29         int     int_value;
30         long    long_value;
31         void*   ptr;
32     }value;
33 };
34 extern struct finsh_var global_variable[];
35 
36 int finsh_var_init(void);
37 int finsh_var_insert(const char* name, int type);
38 int finsh_var_delete(const char* name);
39 struct finsh_var* finsh_var_lookup(const char* name);
40 
41 #endif
42