2010-03-22 07:49:57 +08:00
|
|
|
/*
|
2021-03-08 18:19:04 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2010-03-22 07:49:57 +08:00
|
|
|
*
|
2018-10-14 19:28:18 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2010-03-22 07:49:57 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2010-03-22 Bernard first version
|
|
|
|
*/
|
2009-07-03 06:48:23 +08:00
|
|
|
#ifndef __FINSH_VAR_H__
|
|
|
|
#define __FINSH_VAR_H__
|
|
|
|
|
|
|
|
#include <finsh.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The variable in finsh is put in data segment as a global variable.
|
|
|
|
* The 'finsh_var' structure presents the structure of variable in data segment.
|
|
|
|
*/
|
|
|
|
struct finsh_var
|
|
|
|
{
|
2018-03-01 21:01:20 +08:00
|
|
|
char name[FINSH_NAME_MAX + 1]; /* the name of variable */
|
2009-07-03 06:48:23 +08:00
|
|
|
|
2018-03-01 21:01:20 +08:00
|
|
|
uint8_t type; /* the type of variable */
|
2009-07-03 06:48:23 +08:00
|
|
|
|
2018-03-01 21:01:20 +08:00
|
|
|
/* variable value */
|
|
|
|
union {
|
|
|
|
char char_value;
|
|
|
|
short short_value;
|
|
|
|
int int_value;
|
|
|
|
long long_value;
|
|
|
|
void* ptr;
|
|
|
|
}value;
|
2009-07-03 06:48:23 +08:00
|
|
|
};
|
|
|
|
extern struct finsh_var global_variable[];
|
|
|
|
|
|
|
|
int finsh_var_init(void);
|
|
|
|
int finsh_var_insert(const char* name, int type);
|
|
|
|
int finsh_var_delete(const char* name);
|
|
|
|
struct finsh_var* finsh_var_lookup(const char* name);
|
|
|
|
|
|
|
|
#endif
|