RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
shell.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2006-2021, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 * 2011-06-02 Bernard Add finsh_get_prompt function declaration
9 */
10
11#ifndef __SHELL_H__
12#define __SHELL_H__
13
14#include <rtthread.h>
15#include "finsh.h"
16
17#ifndef FINSH_THREAD_PRIORITY
18 #define FINSH_THREAD_PRIORITY 20
19#endif
20#ifndef FINSH_THREAD_STACK_SIZE
21 #define FINSH_THREAD_STACK_SIZE 2048
22#endif
23#ifndef FINSH_CMD_SIZE
24 #define FINSH_CMD_SIZE 80
25#endif
26
27#define FINSH_OPTION_ECHO 0x01
28
29#define FINSH_PROMPT finsh_get_prompt()
30const char *finsh_get_prompt(void);
31int finsh_set_prompt(const char *prompt);
32
33#ifdef FINSH_USING_HISTORY
34 #ifndef FINSH_HISTORY_LINES
35 #define FINSH_HISTORY_LINES 5
36 #endif
37#endif
38
39#ifdef FINSH_USING_AUTH
40 #ifndef FINSH_PASSWORD_MAX
41 #define FINSH_PASSWORD_MAX RT_NAME_MAX
42 #endif
43 #ifndef FINSH_PASSWORD_MIN
44 #define FINSH_PASSWORD_MIN 6
45 #endif
46 #ifndef FINSH_DEFAULT_PASSWORD
47 #define FINSH_DEFAULT_PASSWORD "rtthread"
48 #endif
49#endif /* FINSH_USING_AUTH */
50
51#ifndef FINSH_THREAD_NAME
52 #define FINSH_THREAD_NAME "tshell"
53#endif
54
62{
64
66
69
70#ifdef FINSH_USING_HISTORY
71 rt_uint16_t current_history;
72 rt_uint16_t history_count;
73
74 char cmd_history[FINSH_HISTORY_LINES][FINSH_CMD_SIZE];
75#endif
76
80
81#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
83#endif
84
85#ifdef FINSH_USING_AUTH
86 char password[FINSH_PASSWORD_MAX];
87#endif
88};
89
92
93int finsh_system_init(void);
94const char *finsh_get_device(void);
95int finsh_getchar(void);
96
98void finsh_set_prompt_mode(rt_uint32_t prompt_mode);
99
100#ifdef FINSH_USING_AUTH
101 rt_err_t finsh_set_password(const char *password);
102 const char *finsh_get_password(void);
103#endif
104
105#ifdef RT_USING_HOOK
106void finsh_thread_entry_sethook(void (*hook)(void));
107#endif /* RT_USING_HOOK */
108
109#endif
struct rt_device * rt_device_t
void finsh_thread_entry_sethook(void(*hook)(void))
This function set a hook function at the entry of finsh thread
rt_uint32_t finsh_get_echo(void)
rt_uint32_t finsh_get_prompt_mode(void)
void finsh_set_prompt_mode(rt_uint32_t prompt_mode)
void finsh_set_echo(rt_uint32_t echo)
const char * finsh_get_device(void)
rt_base_t rt_err_t
unsigned char rt_uint8_t
unsigned short rt_uint16_t
unsigned int rt_uint32_t
int finsh_system_init(void)
input_stat
定义 shell.h:56
@ WAIT_FUNC_KEY
定义 shell.h:59
@ WAIT_NORMAL
定义 shell.h:57
@ WAIT_SPEC_KEY
定义 shell.h:58
#define FINSH_CMD_SIZE
定义 shell.h:24
const char * finsh_get_prompt(void)
定义 shell.c:95
int finsh_set_prompt(const char *prompt)
定义 shell.c:71
int finsh_getchar(void)
struct rt_semaphore rx_sem
定义 shell.h:63
rt_uint8_t prompt_mode
定义 shell.h:68
rt_uint8_t echo_mode
定义 shell.h:67
rt_device_t device
定义 shell.h:82
rt_uint16_t line_curpos
定义 shell.h:79
enum input_stat stat
定义 shell.h:65
rt_uint16_t line_position
定义 shell.h:78
char line[FINSH_CMD_SIZE+1]
定义 shell.h:77