Defines |
#define | FINSH_ERROR_OK 0 |
#define | FINSH_ERROR_INVALID_TOKEN 1 |
#define | FINSH_ERROR_EXPECT_TYPE 2 |
#define | FINSH_ERROR_UNKNOWN_TYPE 3 |
#define | FINSH_ERROR_VARIABLE_EXIST 4 |
#define | FINSH_ERROR_EXPECT_OPERATOR 5 |
#define | FINSH_ERROR_MEMORY_FULL 6 |
#define | FINSH_ERROR_UNKNOWN_OP 7 |
#define | FINSH_ERROR_UNKNOWN_NODE 8 |
#define | FINSH_ERROR_EXPECT_CHAR 9 |
#define | FINSH_ERROR_UNEXPECT_END 10 |
#define | FINSH_ERROR_UNKNOWN_TOKEN 11 |
#define | FINSH_ERROR_NO_FLOAT 12 |
#define | FINSH_ERROR_UNKNOWN_SYMBOL 13 |
#define | FINSH_ERROR_NULL_NODE 14 |
#define | FINSH_FUNCTION_EXPORT(name, desc) |
#define | FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) |
#define | FINSH_VAR_EXPORT(name, type, desc) |
Enumerations |
enum | finsh_type {
finsh_type_unknown = 0,
finsh_type_void,
finsh_type_voidp,
finsh_type_char,
finsh_type_uchar,
finsh_type_charp,
finsh_type_short,
finsh_type_ushort,
finsh_type_shortp,
finsh_type_int,
finsh_type_uint,
finsh_type_intp,
finsh_type_long,
finsh_type_ulong,
finsh_type_longp
} |
Functions |
void | finsh_syscall_append (const char *name, syscall_func func) |
void | finsh_sysvar_append (const char *name, u_char type, void *addr) |
void | finsh_set_device (const char *device_name) |
const char * | finsh_get_device () |
void | finsh_set_echo (rt_uint32_t echo) |
rt_uint32_t | finsh_get_echo () |
Detailed Description
finsh shell is a user command shell in RT-Thread RTOS, which is a shell can accept C-expression like syntax in command. From finsh shell, user can access system area, such as memory, variables and function by input C-expression in command.
Figure 3: finsh shell architecture
There is a shell thread, which named as "tshell", in the finsh shell, it read user command from console device, and then invokes system function or access system variable to output result (by rt_kprintf).
Define Documentation
Value:const char __fsym_##name##_name[] = #name; \
const char __fsym_##name##_desc[] = #desc; \
const struct finsh_syscall __fsym_##name SECTION("FSymTab")= \
{ \
__fsym_##name##_name, \
__fsym_##name##_desc, \
(syscall_func)&name \
};
This macro exports a system function to finsh shell.
- Parameters:
-
name | the name of function. |
desc | the description of function, which will show in help. |
Value:const char __fsym_##name##_name[] = #alias; \
const char __fsym_##name##_desc[] = #desc; \
const struct finsh_syscall __fsym_##name SECTION("FSymTab")= \
{ \
__fsym_##name##_name, \
__fsym_##name##_desc, \
(syscall_func)&name \
};
This macro exports a system function with an alias name to finsh shell.
- Parameters:
-
name | the name of function. |
alias | the alias name of function. |
desc | the description of function, which will show in help. |
Value:const char __vsym_##name##_name[] = #name; \
const char __vsym_##name##_desc[] = #desc; \
const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
{ \
__vsym_##name##_name, \
__vsym_##name##_desc, \
type, \
(void*)&name \
};
This macro exports a variable to finsh shell.
- Parameters:
-
name | the name of function. |
type | the type of variable. |
desc | the description of function, which will show in help. |
Enumeration Type Documentation
The basic data type in finsh shell
- Enumerator:
finsh_type_unknown |
unknown data type
|
finsh_type_void |
void
|
finsh_type_voidp |
void pointer
|
finsh_type_char |
char
|
finsh_type_uchar |
unsigned char
|
finsh_type_charp |
char pointer
|
finsh_type_short |
short
|
finsh_type_ushort |
unsigned short
|
finsh_type_shortp |
short pointer
|
finsh_type_int |
int
|
finsh_type_uint |
unsigned int
|
finsh_type_intp |
int pointer
|
finsh_type_long |
long
|
finsh_type_ulong |
unsigned long
|
finsh_type_longp |
long pointer
|
Function Documentation
This function appends a system call to finsh runtime environment
- Parameters:
-
name | the name of system call |
func | the function pointer of system call |
This function appends a system variable to finsh runtime environment
- Parameters:
-
name | the name of system variable |
type | the data type of system variable |
addr | the address of system variable |
This function sets the input device of finsh shell.
- Parameters:
-
device_name | the name of new input device. |
This function returns current finsh shell input device.
- Returns:
- the finsh shell input device name is returned.
This function set the echo mode of finsh shell.
FINSH_OPTION_ECHO=0x01 is echo mode, other values are none-echo mode.
- Parameters:
-
This function gets the echo mode of finsh shell.
- Returns:
- the echo mode