Home | History | Annotate | Download | only in inc
      1 /*
      2  * console.h
      3  *
      4  * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/
      5  *
      6  * Licensed under the Apache License, Version 2.0 (the "License");
      7  * you may not use this file except in compliance with the License.
      8  * You may obtain a copy of the License at
      9  *
     10  *     http://www.apache.org/licenses/LICENSE-2.0
     11  *
     12  * Unless required by applicable law or agreed to in writing, software
     13  * distributed under the License is distributed on an "AS IS" BASIS,
     14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15  * See the License for the specific language governing permissions and
     16  * limitations under the License.
     17  */
     18 
     19 /** \file  console.h
     20  *  \brief Console (CLI) API
     21  *
     22  *  \see   console.c, ticon.c
     23  */
     24 
     25 #ifndef _CONSOLE_H_
     26 #define _CONSOLE_H_
     27 
     28 /* defines */
     29 /***********/
     30 /* parameter flags */
     31 #define CON_PARM_OPTIONAL       0x01  /* Parameter is optional */
     32 #define CON_PARM_DEFVAL         0x02  /* Default value is set */
     33 #define CON_PARM_RANGE          0x04  /* Range is set */
     34 #define CON_PARM_STRING         0x08  /* String parm */
     35 #define CON_PARM_LINE           0x10  /* String from the current parser position till EOL */
     36 #define CON_PARM_SIGN           0x20  /* Signed param */
     37 #define CON_PARM_NOVAL          0x80  /* Internal flag: parameter is anassigned */
     38 #define CON_LAST_PARM           { NULL, 0, 0, 0, 0 }
     39 
     40 #define CONSOLE_TERMINAL_MODULE_ID  (0)
     41 #define CONSOLE_LOGGER_MODULE_ID    (1)
     42 #define CONSOLE_WIPP_MODULE_ID      (2)
     43 #define CONSOLE_G_TESTER_MODULE_ID  (3)
     44 #define CONSOLE_NUMBER_OF_MODULES   (4)
     45 
     46 
     47 /* types */
     48 /*********/
     49 typedef enum
     50 {
     51     E_OK = 0,
     52     E_BADPARM,
     53     E_TOOMANY,
     54     E_NOMEMORY,
     55     E_NOT_FOUND,
     56     E_EXISTS,
     57     E_DUMMY,
     58     E_ERROR
     59 } consoleErr;
     60 
     61 typedef struct ConParm_t
     62 {
     63    PS8         name;                     /* Parameter name. Shouldn't be allocated on stack! */
     64    U8          flags;                    /* Combination of CON_PARM_??? flags */
     65    U32         low_val;                  /* Low val for range checking */
     66    U32         hi_val;                   /* Hi val for range checking/max length of string */
     67    U32         value;                    /* Value/address of string parameter */
     68 } ConParm_t;
     69 
     70 
     71 typedef void (*FuncToken_t)(THandle hCuCmd, ConParm_t parm[], U16 nParms);
     72 
     73 
     74 /* functions */
     75 /*************/
     76 THandle Console_Create(const PS8 device_name, S32 BypassSupplicant, PS8 pSupplIfFile);
     77 VOID Console_Destroy(THandle hConsole);
     78 VOID Console_GetDeviceStatus(THandle hConsole);
     79 VOID Console_Start(THandle hConsole);
     80 VOID Console_Stop(THandle hConsole);
     81 THandle Console_AddDirExt( THandle  hConsole,
     82                             THandle  hRoot,
     83                             const PS8 name,
     84                             const PS8 desc );
     85 consoleErr Console_AddToken( THandle hConsole,
     86                                 THandle      hDir,
     87                                 const PS8     name,
     88                                 const PS8     help,
     89                                 FuncToken_t   p_func,
     90                                 ConParm_t     p_parms[] );
     91 
     92 #endif  /* _CONSOLE_H_ */
     93 
     94