4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-15 13:49:22 +08:00
bernard.xiong@gmail.com 1e1b85b9c7 clean up finsh shell code.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@734 bbd45198-f89e-11dd-88c7-29a3b14d5316
2010-05-25 23:54:45 +00:00

60 lines
1.1 KiB
C

#ifndef __SHELL_H__
#define __SHELL_H__
#include <rtthread.h>
#define FINSH_USING_HISTORY
#ifndef FINSH_THREAD_PRIORITY
#define FINSH_THREAD_PRIORITY 20
#endif
#ifndef FINSH_THREAD_STACK_SIZE
#define FINSH_THREAD_STACK_SIZE 2048
#endif
#define FINSH_CMD_SIZE 80
#define FINSH_OPTION_ECHO 0x01
#define FINSH_PROMPT "finsh>>"
#ifdef FINSH_USING_HISTORY
enum input_stat
{
WAIT_NORMAL,
WAIT_SPEC_KEY,
WAIT_FUNC_KEY,
};
#ifndef FINSH_HISTORY_LINES
#define FINSH_HISTORY_LINES 5
#endif
#endif
struct finsh_shell
{
struct rt_semaphore rx_sem;
enum input_stat stat;
rt_uint8_t echo_mode:1;
rt_uint8_t use_history:1;
#ifdef FINSH_USING_HISTORY
rt_uint8_t current_history;
rt_uint16_t history_count;
char cmd_history[FINSH_HISTORY_LINES][FINSH_CMD_SIZE];
#endif
struct finsh_parser parser;
char line[FINSH_CMD_SIZE];
rt_uint8_t line_position;
rt_device_t device;
};
void finsh_set_echo(rt_uint32_t enable);
rt_uint32_t finsh_get_echo(void);
void finsh_set_device(const char* device_name);
#endif