📄 shell.lst
字号:
C51 COMPILER V8.06 SHELL 12/24/2007 11:34:17 PAGE 1
C51 COMPILER V8.06, COMPILATION OF MODULE SHELL
OBJECT MODULE PLACED IN .\obj\shell.obj
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE src\shell.c BROWSE MODP2 DEBUG OBJECTEXTEND PRINT(.\shell.lst) OBJECT(.\obj
-\shell.obj)
line level source
1 /****************************************Copyright (c)**************************************************
2 ** Unversity of electronic technology and science of China
3 ** school of electronic engineer
4 **
5 **--------------File Info-------------------------------------------------------------------------------
6 ** File name: shell.c
7 ** Last modified Date: 2006.11.02
8 ** Last Version:
9 ** Descriptions: command shell base on 51
10 **
11 **------------------------------------------------------------------------------------------------------
12 ** Created by: wang zheng
13 ** Created date: 2006.10.29
14 ** Version:
15 ** Descriptions:
16 **
17 **------------------------------------------------------------------------------------------------------
18 ** Modified by: wang zheng
19 ** Modified date:
20 ** Version:
21 ** Descriptions:
22 **
23 **------------------------------------------------------------------------------------------------------
24 ** Modified by:
25 ** Modified date:
26 ** Version:
27 ** Descriptions:
28 **
29 ********************************************************************************************************/
30 #define __MASTER_FILE__
31
32 #include "command_shell.h"
33 /************************************************************************************************
34 * add your function handler at here
35 ************************************************************************************************/
36
37 cmd_tabel code TABLE [ CMD_NUM] =
38 {
39 { 4, "help", help },
40 { 8 , "ipconfig", ipconfig},
41 { 5 , "login", login},
42 { 4 , "exit" , exit },
43 { 4 , "time" , gettime},
44 { 6 , "sucess" , sucess }
45
46 };
47
48 /************************************************************************************************
49 *
50 ************************************************************************************************/
51 char code menue[]=
52 " mp3 mp3 mp3mp3 mp3mp3\r\n"
53 " mp3 mp3 mp3 mp3 mp3 mp3\r\n"
54 "mp3 mp3 mp3 mp3 mp3 mp3\r\n"
C51 COMPILER V8.06 SHELL 12/24/2007 11:34:17 PAGE 2
55 "mp3 mp3 mp3 mp3mp3 mp3\r\n"
56 "mp3 mp3 mp3 mp3 mp3\r\n"
57 "mp3 mp3 mp3 mp3 mp3\r\n"
58 "mp3 mp3 mp3 mp3 mp3mp3\r\n"
59 "\r\n"
60 ">";
61
62
63 char code bad_command[]=" *******bad command***********\r\n";
64
65 /************************************************************************************************
66 * internal function of command shell
67 ************************************************************************************************/
68
69 void Normal_Normal(void);
70 void Normal_Control(void);
71 void Normal_Cr(void);
72 void Control_Control_bs(void);
73 void Control_Cr(void );
74 void Func_Execute(void); /* these are state process functions */
75
76 /*********************************************************************************************************
77 ** 函数名称: Cmd_Shell_Init()
78 ** 功能描述:
79 ** 输 入:
80 ** 输 出:
81 ** 全局变量: curr_stat ,sig_renew
82 ** 调用模块: Uart0_Write()
83 **
84 ** 作 者: wangzheng
85 ** 日 期: 2006.11.02
86 **-------------------------------------------------------------------------------------------------------
87 ** 修改人: wangzheng
88 ** 日 期:
89 **-------------------------------------------------------------------------------------------------------
90 ** 修改人: wangzheng
91 ** 日 期:
92 **------------------------------------------------------------------------------------------------------
93 ********************************************************************************************************/
94 void Cmd_Shell_Init( )
95 {
96 1 curr_stat = normal_char;
97 1 sig_renew = 0;
98 1 Uart_Write(menue); /* print the wellcome information*/
99 1 }
100
101 /*********************************************************************************************************
102 ** 函数名称: State_Tran( )
103 ** 功能描述: tranfer to next state of FSM
104 ** 输 入: uint8 next_state
105 ** 输 出:
106 ** 全局变量: curr_stat,sig_renew
107 ** 调用模块:
108 **
109 ** 作 者: wangzheng
110 ** 日 期: 2006.11.02
111 **-------------------------------------------------------------------------------------------------------
112 ** 修改人: wangzheng
113 ** 日 期:
114 **-------------------------------------------------------------------------------------------------------
115 ** 修改人: wangzheng
116 ** 日 期:
C51 COMPILER V8.06 SHELL 12/24/2007 11:34:17 PAGE 3
117 **------------------------------------------------------------------------------------------------------
118 ********************************************************************************************************/
119 void State_Tran(uint8 next_stat )
120 {
121 1 curr_stat = next_stat;
122 1 sig_renew = 1;
123 1 }
124 /*********************************************************************************************************
125 ** 函数名称: Init_cmd_buf()
126 ** 功能描述:
127 ** 输 入:
128 ** 输 出:
129 ** 全局变量: cmd_buf
130 ** 调用模块:
131 **
132 ** 作 者: wangzheng
133 ** 日 期: 2006.11.02
134 **-------------------------------------------------------------------------------------------------------
135 ** 修改人: wangzheng
136 ** 日 期:
137 **-------------------------------------------------------------------------------------------------------
138 ** 修改人: wangzheng
139 ** 日 期:
140 **------------------------------------------------------------------------------------------------------
141 ********************************************************************************************************/
142 void Init_Cmd_Buf(void )
143 {
144 1 uint8 cnt;
145 1 cmd_buf.length = 0;
146 1 for(cnt=0;cnt<MAX_CMD_LENGTH;cnt++)
147 1 cmd_buf.cmd_line[cnt]=0;
148 1 }
149 /*********************************************************************************************************
150 ** 函数名称: Search_cmd();
151 ** 功能描述: search for the matched command in TABLE
152 ** 输 入:
153 ** 输 出: the index of matched command in TABLE
154 ** 全局变量:
155 ** 调用模块:
156 **
157 ** 作 者: wangzheng
158 ** 日 期: 2006.11.02
159 **-------------------------------------------------------------------------------------------------------
160 ** 修改人: wangzheng
161 ** 日 期:
162 **-------------------------------------------------------------------------------------------------------
163 ** 修改人: wangzheng
164 ** 日 期:
165 **------------------------------------------------------------------------------------------------------
166 ********************************************************************************************************/
167 int8 Search_Cmd( )
168 {
169 1 uint8 temp_length=0; /* cmd length ,exclude the parametes*/
170 1 uint8 cnt=0; /* search count*/
171 1 uint8 search_buf[10]; /* buf for save the length matched cmd's index*/
172 1 uint8 search_index=0;
173 1 uint8 temp=0;
174 1 uint8 i=0;
175 1
176 1 while( (cmd_buf.cmd_line[temp_length] != '-') && (cmd_buf.cmd_line[temp_length] !=0 )
177 1 && (temp_length<=MAX_CMD_LENGTH) )
178 1 temp_length++; /*temp_length then is the length of cmd ,
C51 COMPILER V8.06 SHELL 12/24/2007 11:34:17 PAGE 4
179 1 dont contanin parametes */
180 1 for(cnt=0; cnt<= CMD_NUM;cnt++ )
181 1 {
182 2 if( TABLE[cnt].length == temp_length )
183 2 {
184 3 search_buf[search_index] = cnt; /* save the index of length matched cmd,
185 3 prepare for next search*/
186 3 search_index++;
187 3 }
188 2 } /* search for the cmd_length matched commmand in TABLE ,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -