shell.h File Reference

Go to the source code of this file.

Data Structures

struct  SHELL_CONTROL
struct  ARGUMENT_CONTROL

Defines

#define ASCII_NUL   0x00
#define ASCII_SOH   0x01
#define ASCII_STX   0x02
#define ASCII_ETX   0x03
#define ASCII_EOT   0x04
#define ASCII_ENQ   0x05
#define ASCII_ACK   0x06
#define ASCII_BEL   0x07
#define ASCII_BS   0x08
#define ASCII_HT   0x09
#define ASCII_LF   0x0a
#define ASCII_VT   0x0b
#define ASCII_FF   0x0c
#define ASCII_CR   0x0d
#define ASCII_SO   0x0e
#define ASCII_SI   0x0f
#define ASCII_DLE   0x10
#define ASCII_DC1   0x11
#define ASCII_DC2   0x12
#define ASCII_DC3   0x13
#define ASCII_DC4   0x14
#define ASCII_NAK   0x15
#define ASCII_SYN   0x26
#define ASCII_ETB   0x17
#define ASCII_CAN   0x18
#define ASCII_EM   0x19
#define ASCII_SUB   0x1a
#define ASCII_ESC   0x1b
#define ASCII_FS   0x1c
#define ASCII_GS   0x1d
#define ASCII_RS   0x1e
#define ASCII_US   0x1f
#define ASCII_SP   0x20
#define ASCII_DEL   0x7f
#define KEY_HOME   0x48
#define KEY_END   0x4b
#define KEY_PAGE_UP   0x4d
#define KEY_PAGE_DOWN   0x32
#define KEY_PAGE_DOWN2   0x4a
#define KEY_LEFT_ARROW   0x44
#define KEY_RIGHT_ARROW   0x43
#define KEY_UP_ARROW   0x41
#define KEY_DOWN_ARROW   0x42
#define ArgumentIdleState   0
#define ArgumentInitialState   1
#define ArgumentRxState   2
#define MeetEscKey   0x01
#define HasEscXkey   0x02
#define HasPageDown   0x04
#define ARGUMENT_ARGV_MAX   10
#define ARGUMENT_INDEX_MAX   250

Functions

void F_ShellInit (void)
void F_ShellSvc (void)
void F_ShellArgumentInitial (void)
void F_ShellArgumentSvc (unsigned char Data)
void F_ShellArgumentParser (void)
void F_ShellArgumentExecute (unsigned char **Argv, unsigned char Argc)
unsigned char F_ShellArgumentCheck (void)
void F_ShellArgumentReset (void)
void F_ShellArgumentReceive (unsigned char **Argv, unsigned char Argc)
void F_ShellArgumentBs (void)
void F_ShellArgumentDel (void)
void F_ShellArgumentKeyPut (unsigned char)
void F_ShellArgumentIns (void)
void F_ShellArgumentHome (void)
void F_ShellArgumentEnd (void)
void F_ShellArgumentPageUp (void)
void F_ShellArgumentPageDown (void)
void F_ShellArgumentArrowUp (void)
void F_ShellArgumentArrowDown (void)
void F_ShellArgumentArrowLeft (void)
void F_ShellArgumentArrowRight (void)

Variables

ARGUMENT_CONTROL ArgumentCtrl
SHELL_CONTROL ShellCtrl


Define Documentation

#define ARGUMENT_ARGV_MAX   10

Definition at line 66 of file shell.h.

#define ARGUMENT_INDEX_MAX   250

Definition at line 67 of file shell.h.

#define ArgumentIdleState   0

Definition at line 58 of file shell.h.

#define ArgumentInitialState   1

Definition at line 59 of file shell.h.

#define ArgumentRxState   2

Definition at line 60 of file shell.h.

#define ASCII_ACK   0x06

Definition at line 10 of file shell.h.

#define ASCII_BEL   0x07

Definition at line 11 of file shell.h.

#define ASCII_BS   0x08

Definition at line 12 of file shell.h.

#define ASCII_CAN   0x18

Definition at line 28 of file shell.h.

#define ASCII_CR   0x0d

Definition at line 17 of file shell.h.

#define ASCII_DC1   0x11

Definition at line 21 of file shell.h.

#define ASCII_DC2   0x12

Definition at line 22 of file shell.h.

#define ASCII_DC3   0x13

Definition at line 23 of file shell.h.

#define ASCII_DC4   0x14

Definition at line 24 of file shell.h.

#define ASCII_DEL   0x7f

Definition at line 37 of file shell.h.

#define ASCII_DLE   0x10

Definition at line 20 of file shell.h.

#define ASCII_EM   0x19

Definition at line 29 of file shell.h.

#define ASCII_ENQ   0x05

Definition at line 9 of file shell.h.

#define ASCII_EOT   0x04

Definition at line 8 of file shell.h.

#define ASCII_ESC   0x1b

Definition at line 31 of file shell.h.

#define ASCII_ETB   0x17

Definition at line 27 of file shell.h.

#define ASCII_ETX   0x03

Definition at line 7 of file shell.h.

#define ASCII_FF   0x0c

Definition at line 16 of file shell.h.

#define ASCII_FS   0x1c

Definition at line 32 of file shell.h.

#define ASCII_GS   0x1d

Definition at line 33 of file shell.h.

#define ASCII_HT   0x09

Definition at line 13 of file shell.h.

#define ASCII_LF   0x0a

Definition at line 14 of file shell.h.

#define ASCII_NAK   0x15

Definition at line 25 of file shell.h.

#define ASCII_NUL   0x00

Definition at line 4 of file shell.h.

#define ASCII_RS   0x1e

Definition at line 34 of file shell.h.

#define ASCII_SI   0x0f

Definition at line 19 of file shell.h.

#define ASCII_SO   0x0e

Definition at line 18 of file shell.h.

#define ASCII_SOH   0x01

Definition at line 5 of file shell.h.

#define ASCII_SP   0x20

Definition at line 36 of file shell.h.

#define ASCII_STX   0x02

Definition at line 6 of file shell.h.

#define ASCII_SUB   0x1a

Definition at line 30 of file shell.h.

#define ASCII_SYN   0x26

Definition at line 26 of file shell.h.

#define ASCII_US   0x1f

Definition at line 35 of file shell.h.

#define ASCII_VT   0x0b

Definition at line 15 of file shell.h.

#define HasEscXkey   0x02

Definition at line 63 of file shell.h.

#define HasPageDown   0x04

Definition at line 64 of file shell.h.

#define KEY_DOWN_ARROW   0x42

Definition at line 48 of file shell.h.

#define KEY_END   0x4b

Definition at line 41 of file shell.h.

#define KEY_HOME   0x48

Definition at line 40 of file shell.h.

#define KEY_LEFT_ARROW   0x44

Definition at line 45 of file shell.h.

#define KEY_PAGE_DOWN   0x32

Definition at line 43 of file shell.h.

#define KEY_PAGE_DOWN2   0x4a

Definition at line 44 of file shell.h.

#define KEY_PAGE_UP   0x4d

Definition at line 42 of file shell.h.

#define KEY_RIGHT_ARROW   0x43

Definition at line 46 of file shell.h.

#define KEY_UP_ARROW   0x41

Definition at line 47 of file shell.h.

#define MeetEscKey   0x01

Definition at line 62 of file shell.h.


Function Documentation

void F_ShellArgumentArrowDown ( void   ) 

Definition at line 619 of file shell.c.

00619                                    {
00620     #if(DEBUG_SHELL_KEY==1)
00621         F_StringPut("\r\n key_arrow_down");
00622     #endif
00623 }

void F_ShellArgumentArrowLeft ( void   ) 

Definition at line 624 of file shell.c.

00624                                    {
00625     #if(DEBUG_SHELL_KEY==1)
00626         F_StringPut("\r\n key_arrow_left");
00627     #endif
00628     if(ArgumentCtrl.Index==0){;}
00629     else{
00630         ArgumentCtrl.Index--;
00631     }
00632 }

void F_ShellArgumentArrowRight ( void   ) 

Definition at line 633 of file shell.c.

00633                                     {
00634     #if(DEBUG_SHELL_KEY==1)
00635         F_StringPut("\r\n key_arrow_right");
00636     #endif
00637     if(ArgumentCtrl.Index==ArgumentCtrl.Put){;}
00638     else{
00639         if(ArgumentCtrl.Index<ArgumentCtrl.Put) ArgumentCtrl.Index++;
00640     }
00641 }

void F_ShellArgumentArrowUp ( void   ) 

Definition at line 614 of file shell.c.

00614                                  {
00615     #if(DEBUG_SHELL_KEY==1)
00616         F_StringPut("\r\n key_arrow_up");
00617     #endif
00618 }

void F_ShellArgumentBs ( void   ) 

Definition at line 516 of file shell.c.

00516                             {
00517     unsigned char i;
00518     #if(DEBUG_SHELL_KEY==1)
00519         F_StringPut("\r\n key_bs");
00520     #endif
00521     if(ArgumentCtrl.Put==ArgumentCtrl.Index){
00522         if(ArgumentCtrl.Put==0){;}
00523         else{
00524             ArgumentCtrl.Put--;
00525             ArgumentCtrl.Index--;
00526         }
00527     }
00528     else{
00529         if(ArgumentCtrl.Index==0){;}
00530         else{
00531             ArgumentCtrl.Index--;
00532             ArgumentCtrl.Put--;
00533             i=ArgumentCtrl.Index;
00534             for(;i<=ArgumentCtrl.Put;i++){
00535                 ArgumentCtrl.Data[i]=ArgumentCtrl.Data[i+1];
00536             }
00537         }
00538     }
00539 }

unsigned char F_ShellArgumentCheck ( void   ) 

Definition at line 502 of file shell.c.

00502                              {
00503     if(ArgumentCtrl.HasInput==TRUE) return TRUE;
00504     else return FALSE;
00505 }

void F_ShellArgumentDel ( void   ) 

Definition at line 540 of file shell.c.

00540                              {
00541     unsigned char i;
00542     #if(DEBUG_SHELL_KEY==1)
00543         F_StringPut("\r\n key_del");
00544     #endif
00545     if(ArgumentCtrl.Put==ArgumentCtrl.Index){;} // nothing to delete
00546     else{                                           // xxxxyyyy -> xxxyyyy
00547        ArgumentCtrl.Put--;
00548        i=ArgumentCtrl.Index;
00549        for(;i<=ArgumentCtrl.Put;i++){
00550            ArgumentCtrl.Data[i]=ArgumentCtrl.Data[i+1];
00551        }
00552     }
00553 }

void F_ShellArgumentEnd ( void   ) 

Definition at line 598 of file shell.c.

00598                              {
00599     #if(DEBUG_SHELL_KEY==1)
00600         F_StringPut("\r\n key_end");
00601     #endif
00602     ArgumentCtrl.Index=ArgumentCtrl.Put;
00603 }

void F_ShellArgumentExecute ( unsigned char **  Argv,
unsigned char  Argc 
)

Definition at line 507 of file shell.c.

00507                                                                     {
00508 
00509 }

void F_ShellArgumentHome ( void   ) 

Definition at line 592 of file shell.c.

00592                               {
00593     #if(DEBUG_SHELL_KEY==1)
00594         F_StringPut("\r\n key_home");
00595     #endif
00596     ArgumentCtrl.Index=0;
00597 }

void F_ShellArgumentInitial ( void   ) 

Definition at line 290 of file shell.c.

void F_ShellArgumentIns ( void   ) 

Definition at line 585 of file shell.c.

00585                              {
00586     #if(DEBUG_SHELL_KEY==1)
00587         F_StringPut("\r\n key_ins");
00588     #endif
00589     //if(ArgumentCtrl.Insert==TRUE) ArgumentCtrl.Insert=FALSE;
00590     //else ArgumentCtrl.Insert=TRUE;
00591 }

void F_ShellArgumentKeyPut ( unsigned  char  ) 

Definition at line 554 of file shell.c.

00554                                               {
00555     unsigned char i;
00556 
00557     if(ArgumentCtrl.Put==ArgumentCtrl.Index){
00558         ArgumentCtrl.Data[ArgumentCtrl.Index]=Data;
00559         if(ArgumentCtrl.Put<ARGUMENT_INDEX_MAX){
00560             ArgumentCtrl.Put++;
00561             ArgumentCtrl.Index++;
00562         }
00563     }
00564     else{
00565         if(Data==0x0d){
00566             ArgumentCtrl.Data[ArgumentCtrl.Put]=Data;
00567         }
00568         else{
00569             if(ArgumentCtrl.Insert==TRUE){
00570                 i=ArgumentCtrl.Put;
00571                 for(;i>=ArgumentCtrl.Index;i--){
00572                     ArgumentCtrl.Data[i+1]=ArgumentCtrl.Data[i];
00573                 }
00574                 ArgumentCtrl.Data[ArgumentCtrl.Index]=Data;
00575                 if(ArgumentCtrl.Put<ARGUMENT_INDEX_MAX) ArgumentCtrl.Put++;
00576                 ArgumentCtrl.Index++;
00577             }
00578             else{
00579                 ArgumentCtrl.Data[ArgumentCtrl.Index]=Data;
00580                 ArgumentCtrl.Index++;
00581             }
00582         }
00583     }
00584 }

void F_ShellArgumentPageDown ( void   ) 

Definition at line 609 of file shell.c.

00609                                   {
00610     #if(DEBUG_SHELL_KEY==1)
00611         F_StringPut("\r\n key_page_down");
00612     #endif
00613 }

void F_ShellArgumentPageUp ( void   ) 

Definition at line 604 of file shell.c.

00604                                 {
00605     #if(DEBUG_SHELL_KEY==1)
00606         F_StringPut("\r\n key_page_up");
00607     #endif
00608 }

void F_ShellArgumentParser ( void   ) 

Definition at line 452 of file shell.c.

00452                                 {
00453     unsigned char Index;
00454     unsigned char State;
00455     unsigned char Status;
00456     //unsigned char i;
00457     //unsigned char **ppArgv;
00458 
00459     Index=0;
00460     Status=0;
00461     ArgumentCtrl.Argc=0;
00462     State=ArgumentSearchState;
00463     while(1){
00464         switch(State){
00465             case ArgumentSearchState:
00466                 if(ArgumentCtrl.Data[Index]==0x20){;}       // " "
00467                 else if(ArgumentCtrl.Data[Index]==0x0d){  // enter key
00468                     ArgumentCtrl.Data[Index]=0;
00469                     ArgumentCtrl.Data[Index+1]=0x0d;
00470                     State=ArgumentDoneState;
00471                 }
00472                 else{
00473                     ArgumentCtrl.pArgv[ArgumentCtrl.Argc]=&ArgumentCtrl.Data[Index];
00474                     ArgumentCtrl.Argc++;
00475                     State=ArgumentGoThroughState;
00476                 }
00477                 break;
00478             case ArgumentGoThroughState:
00479                 if(ArgumentCtrl.Data[Index]==0x0d){
00480                     ArgumentCtrl.Data[Index]=0;
00481                     ArgumentCtrl.Data[Index+1]=0x0d;
00482                     State=ArgumentDoneState;
00483                 }
00484                 else if(ArgumentCtrl.Data[Index]==0x20){
00485                     ArgumentCtrl.Data[Index]=0;
00486                     State=ArgumentSearchState;
00487                 }
00488                 break;
00489             case ArgumentDoneState:
00490                 if(ArgumentCtrl.Put==ARGUMENT_INDEX_MAX){ // too many input
00491                     F_ShellArgumentReset();
00492                     return;
00493                 }
00494                 ArgumentCtrl.HasInput=TRUE;
00495                 return;
00496                 //if(ArgumentCtrl.Argc!=0) F_ShellArgumentExecute(&ArgumentCtrl.pArgv,ArgumentCtrl.Argc);
00497                 //break;
00498         }
00499         Index++;
00500     }
00501 }

void F_ShellArgumentReceive ( unsigned char **  Argv,
unsigned char  Argc 
)

void F_ShellArgumentReset ( void   ) 

Definition at line 510 of file shell.c.

00510                                {
00511     ArgumentCtrl.Index=0;
00512     ArgumentCtrl.Put=0;
00513     ArgumentCtrl.Argc=0;
00514     ArgumentCtrl.HasInput=FALSE;
00515 }

void F_ShellArgumentSvc ( unsigned char  Data  ) 

Definition at line 300 of file shell.c.

00300                                            {
00301     switch(ArgumentCtrl.State){
00302         case ArgumentIdleState:
00303             break;
00304         case ArgumentRxState:            
00305             // process special keys
00306             if(Data==ASCII_ESC){
00307                 ArgumentCtrl.Status=0;
00308                 ArgumentCtrl.Status=MeetEscKey;
00309                 return;
00310             }
00311             else if(ArgumentCtrl.Status==MeetEscKey){
00312                 if(Data==0x5b){
00313                     ArgumentCtrl.Status=HasEscXkey;
00314                     return;
00315                 }
00316                 else{
00317                     ArgumentCtrl.Status=0; // meet single esc key, not a special key
00318                 }
00319             }
00320             else if(ArgumentCtrl.Status==HasEscXkey){
00321                 switch(Data){
00322                     case KEY_HOME:
00323                         F_ShellArgumentHome();
00324                         ArgumentCtrl.Status=0;
00325                         return;
00326                     case KEY_END:
00327                         F_ShellArgumentEnd();
00328                         ArgumentCtrl.Status=0;
00329                         return;
00330                     case KEY_PAGE_UP:
00331                         F_ShellArgumentPageUp();
00332                         ArgumentCtrl.Status=0;
00333                         return;
00334                     case KEY_PAGE_DOWN:
00335                         ArgumentCtrl.Status=HasPageDown;
00336                         return;
00337                     case KEY_LEFT_ARROW:
00338                         F_ShellArgumentArrowLeft();
00339                         ArgumentCtrl.Status=0;
00340                         return;
00341                     case KEY_RIGHT_ARROW:
00342                         F_ShellArgumentArrowRight();
00343                         ArgumentCtrl.Status=0;
00344                         return;
00345                     case KEY_UP_ARROW:
00346                         F_ShellArgumentArrowUp();
00347                         ArgumentCtrl.Status=0;
00348                         return;
00349                     case KEY_DOWN_ARROW:
00350                         F_ShellArgumentArrowDown();
00351                         ArgumentCtrl.Status=0;
00352                         return;
00353                     default:
00354                         ArgumentCtrl.Status=0;
00355                         return; // skip this code no matter what it is
00356                 }
00357                 //ArgumentCtrl.Status=0;
00358             }
00359             else if(ArgumentCtrl.Status==HasPageDown){
00360                 if(Data==0x4a){
00361                     F_ShellArgumentPageDown();
00362                     ArgumentCtrl.Status=0;
00363                     return;
00364                 }
00365                 ArgumentCtrl.Status=0;
00366             }
00367             switch(Data){
00368                 case  ASCII_NUL: // ^@
00369                     break;
00370                 case  ASCII_SOH: // ^A
00371                     break;
00372                 case  ASCII_STX: // ^B
00373                     break;
00374                 case  ASCII_ETX: // ^C
00375                     break;
00376                 case  ASCII_EOT: // ^D
00377                     break;
00378                 case  ASCII_ENQ: // ^E
00379                     break;
00380                 case  ASCII_ACK: // ^F
00381                     break;
00382                 case  ASCII_BEL: // ^G
00383                     break;
00384                 case  ASCII_BS:  // ^H
00385                     F_ShellArgumentBs();
00386                     //F_HidPs2KeyDispatch(Data);
00387                     //F_GuiTextBufferPut(Data);
00388                     break;
00389                 case  ASCII_HT:  // ^I
00390                     break;
00391                 case  ASCII_LF:  // ^J
00392                     break;
00393                 case  ASCII_VT:  // ^K
00394                     break;
00395                 case  ASCII_FF:  // ^L
00396                     break;
00397                 case  ASCII_CR:  // ^M
00398                     F_ShellArgumentKeyPut(Data);
00399                     F_ShellArgumentParser();
00400                     break;
00401                 case  ASCII_SO:  // ^N
00402                     break;
00403                 case  ASCII_SI:  // ^O
00404                     break;
00405                 case  ASCII_DLE: // ^P
00406                     break;
00407                 case  ASCII_DC1: // ^Q
00408                     break;
00409                 case  ASCII_DC2: // ^R
00410                     break;
00411                 case  ASCII_DC3: // ^S
00412                     break;
00413                 case  ASCII_DC4: // ^T
00414                     break;
00415                 case  ASCII_NAK: // ^U
00416                     break;
00417                 case  ASCII_SYN: // ^V
00418                     break;
00419                 case  ASCII_ETB: // ^W
00420                     break;
00421                 case  ASCII_CAN: // ^X
00422                     break;
00423                 case  ASCII_EM:  // ^Y
00424                     break;
00425                 case  ASCII_SUB: // ^Z
00426                     break;
00427                 //case  ASCII_ESC: // ^[
00428                 //    break;
00429                 case  ASCII_FS:   /* ^\  */
00430                     break;
00431                 case  ASCII_GS:  // ^]
00432                     break;
00433                 case  ASCII_RS:  // ^^
00434                     break;
00435                 case  ASCII_US:  // ^_
00436                     break;
00437                 case  ASCII_DEL: //
00438                     F_ShellArgumentDel();
00439                     break;
00440                 default:
00441                     if((Data>=0x20)&&(Data<=0x7e)){
00442                         F_ShellArgumentKeyPut(Data);
00443                     }
00444                     break;
00445             }
00446     }
00447 }

void F_ShellInit ( void   ) 

Definition at line 64 of file shell.c.

void F_ShellSvc ( void   ) 

Definition at line 72 of file shell.c.

00072                      {
00073     U8 Data,i;
00074     //U32 FileEnd,FileStart;
00075     //U32 Address,Length;
00076     U8 Argc;
00077     //unsigned char *pData;
00078     U8 **ppArgv;    // pointer of pArgv
00079     //U32 j;
00080 
00081     switch(ShellCtrl.State){
00082         case ShellIdleState:
00083             break;          
00084         case ShellInitial0State:    
00085             printf("\n*******************************");
00086             printf("\n Hello, welcome to use MYLPT.");
00087             printf("\n type <help> for help");
00088             printf("\n*******************************");
00089             printf("\n$>");
00090             F_ShellArgumentInitial();
00091             ShellCtrl.State=ShellWaitCommandState;
00092             break;
00093         case ShellInitial1State:    
00094             break;
00095         case ShellInitial2State:    
00096             break;
00097         case ShellWaitCommandState:
00098             Data=getch();
00099             putch(Data);
00100             F_ShellArgumentSvc(Data);
00101             if(F_ShellArgumentCheck()==TRUE) ShellCtrl.State=ShellDispatchState;
00102             break;
00103         case ShellDispatchState:
00104             Argc=ArgumentCtrl.Argc;
00105             ppArgv=(unsigned char **)&ArgumentCtrl.pArgv;
00106             if(Argc>0){
00107                 for(i=0;;i++){
00108                     if(ShellCommand[i]==(U8 *)0){
00109                         printf("\r\n command not found");
00110                         break;
00111                     }
00112                     if(strcmp((char *)ArgumentCtrl.pArgv[0],(char *)ShellCommand[i])==0){
00113                         ShellCtrl.ExecuteItem=i;
00114                         ShellCtrl.ExecuteState=ExecuteStartState;
00115                         ShellCtrl.State=ShellExecuteState;
00116                         return;
00117                     }
00118                 }
00119             }
00120             printf("\n$>");
00121             F_ShellArgumentReset();
00122             ShellCtrl.State=ShellWaitCommandState;
00123             break;
00124         case ShellExecuteState:
00125             switch(ShellCtrl.ExecuteItem){
00126                 case ItemInfo:
00127                     switch(ShellCtrl.ExecuteState){
00128                         case ExecuteIdleState:
00129                             ShellCtrl.State=ShellExecuteStopState;
00130                             break;
00131                         case ExecuteStartState:                     
00132                             printf("\n*******************************************");
00133                             printf("\n Hello, welcome to use MYLPT.");
00134                             printf("\n MYLPT is developed by BOOK CHEN.");
00135                             printf("\n BOOK CHEN is a firmware engineer,SUMC Inc.");
00136                             printf("\n*******************************************");
00137                             ShellCtrl.ExecuteState=ExecuteIdleState;
00138                             break;
00139                     }
00140                     break;
00141                 case ItemHelp:
00142                     switch(ShellCtrl.ExecuteState){
00143                         case ExecuteIdleState:
00144                             ShellCtrl.State=ShellExecuteStopState;
00145                             break;
00146                         case ExecuteStartState:
00147                             printf("\n help information:");
00148                             printf("\n info");
00149                             printf("\n help");
00150                             printf("\n exit");
00151                             printf("\n bye");
00152                             printf("\n quit");
00153                             printf("\n q");
00154                             printf("\n icsp");
00155                             ShellCtrl.ExecuteState=ExecuteRunState;
00156                             break;
00157                         case ExecuteRunState:
00158                             ShellCtrl.ExecuteState=ExecuteIdleState;
00159                             break;
00160                     }
00161                     break;
00162                 case ItemExit:
00163                     switch(ShellCtrl.ExecuteState){
00164                         case ExecuteIdleState:
00165                             ShellCtrl.State=ShellExecuteStopState;
00166                             break;
00167                         case ExecuteStartState:         
00168                             ShellCtrl.Exit=TRUE;
00169                             printf("\n bye.");
00170                             ShellCtrl.ExecuteState=ExecuteIdleState;
00171                             break;
00172                         case ExecuteRunState:
00173                             ShellCtrl.ExecuteState=ExecuteIdleState;
00174                             break;
00175                     }
00176                     break;
00177                 case ItemBye:
00178                     switch(ShellCtrl.ExecuteState){
00179                         case ExecuteIdleState:
00180                             ShellCtrl.State=ShellExecuteStopState;
00181                             break;
00182                         case ExecuteStartState:         
00183                             ShellCtrl.Exit=TRUE;
00184                             printf("\n bye.");
00185                             ShellCtrl.ExecuteState=ExecuteIdleState;
00186                             break;
00187                         case ExecuteRunState:
00188                             ShellCtrl.ExecuteState=ExecuteIdleState;
00189                             break;
00190                     }
00191                     break;
00192                 case ItemQuit:
00193                     switch(ShellCtrl.ExecuteState){
00194                         case ExecuteIdleState:
00195                             ShellCtrl.State=ShellExecuteStopState;
00196                             break;
00197                         case ExecuteStartState:         
00198                             ShellCtrl.Exit=TRUE;
00199                             printf("\n bye.");
00200                             ShellCtrl.ExecuteState=ExecuteIdleState;
00201                             break;
00202                         case ExecuteRunState:
00203                             ShellCtrl.ExecuteState=ExecuteIdleState;
00204                             break;
00205                     }
00206                     break;
00207                 case ItemQuit2:
00208                     switch(ShellCtrl.ExecuteState){
00209                         case ExecuteIdleState:
00210                             ShellCtrl.State=ShellExecuteStopState;
00211                             break;
00212                         case ExecuteStartState:         
00213                             ShellCtrl.Exit=TRUE;
00214                             printf("\n bye.");
00215                             ShellCtrl.ExecuteState=ExecuteIdleState;
00216                             break;
00217                         case ExecuteRunState:
00218                             ShellCtrl.ExecuteState=ExecuteIdleState;
00219                             break;
00220                     }
00221                     break;
00222                 case ItemIcsperase:
00223                     switch(ShellCtrl.ExecuteState){
00224                         case ExecuteIdleState:
00225                             ShellCtrl.State=ShellExecuteStopState;
00226                             break;
00227                         case ExecuteStartState: 
00228                             printf("\n icsp erase");
00229                             F_IcspProgramModeEnter(); 
00230                             F_IcspBulkErase();           
00231                             F_IcspProgramModeExit();
00232                             F_IcspReset();
00233                             ShellCtrl.ExecuteState=ExecuteRunState;
00234                             break;
00235                         case ExecuteRunState:
00236                             if(F_WriterStateGet()!=0) return;
00237                             ShellCtrl.ExecuteState=ExecuteIdleState;
00238                             break;
00239                     }
00240                     break;
00241                 case ItemIcspread:
00242                     switch(ShellCtrl.ExecuteState){
00243                         case ExecuteIdleState:
00244                             ShellCtrl.State=ShellExecuteStopState;
00245                             break;
00246                         case ExecuteStartState: 
00247                             printf("\n icsp read");
00248                             F_IcspTest();
00249                             //F_WriterImageWrite();
00250                             ShellCtrl.ExecuteState=ExecuteRunState;
00251                             break;
00252                         case ExecuteRunState:
00253                             if(F_WriterStateGet()!=0) return;
00254                             ShellCtrl.ExecuteState=ExecuteIdleState;
00255                             break;
00256                     }
00257                     break;
00258                 case ItemIcspwrite:
00259                     switch(ShellCtrl.ExecuteState){
00260                         case ExecuteIdleState:
00261                             ShellCtrl.State=ShellExecuteStopState;
00262                             break;
00263                         case ExecuteStartState: 
00264                             printf("\n icsp write");
00265                             //F_IcspTest();
00266                             F_WriterImageWrite();
00267                             ShellCtrl.ExecuteState=ExecuteRunState;
00268                             break;
00269                         case ExecuteRunState:
00270                             if(F_WriterStateGet()!=0) return;
00271                             ShellCtrl.ExecuteState=ExecuteIdleState;
00272                             break;
00273                     }
00274                     break;
00275                 default:
00276                     ShellCtrl.State=ShellExecuteStopState;
00277                     break;
00278             }           
00279             break;
00280         case ShellExecuteStopState:
00281             printf("\n$>");
00282             F_ShellArgumentReset();
00283             ShellCtrl.State=ShellWaitCommandState;
00284             break;
00285         default:
00286             break;
00287     }
00288 }


Variable Documentation

Definition at line 62 of file shell.c.

Definition at line 61 of file shell.c.


Generated on Sun Jul 19 00:50:40 2009 for PROGRAMER FOR PIC18F87J10 USING LPT PORT by  doxygen 1.5.9