iLLD_TC29x
1.0
|
Shell functions. More...
#include "StdIf/IfxStdIf_DPipe.h"
Go to the source code of this file.
Data Structures | |
struct | Ifx_Shell_Command |
Shell command object. More... | |
struct | Ifx_Shell_CmdLine |
Command line editing state. More... | |
struct | Ifx_Shell_Protocol |
Shell protocol configuration. More... | |
struct | Ifx_Shell_Flags |
Shell control flags. More... | |
struct | Ifx_Shell_Runtime |
internal Shell run-time data More... | |
struct | Ifx_Shell |
Shell object definition. More... | |
struct | Ifx_Shell_Config |
Shell configuration. More... | |
struct | Ifx_Shell_Syntax |
Macros | |
#define | IFX_SHELL_NULL_CHAR '\0' |
#define | IFX_SHELL_CMD_HISTORY_SIZE (10) |
Number of commands to store in history. More... | |
#define | IFX_SHELL_CMD_LINE_SIZE (128) |
max command line IFX_SHELL_CMD_LINE_SIZE - 1 More... | |
#define | IFX_SHELL_COMMAND_LISTS (1) |
Number of command lists. More... | |
#define | IFX_SHELL_PROMPT "Shell>" |
Shell prompt. More... | |
#define | IFX_SHELL_COMMAND_LIST_END {0, 0, 0, 0} |
Marker for end of command list. More... | |
#define | IFX_SHELL_SYNTAX_LIST_END {0, 0} |
Marker for end of syntax list. More... | |
#define | IFX_SHELL_CMD_HISTORY_NO_ITEM (-1) |
Signifies no item in use in command history list. More... | |
Typedefs | |
typedef boolean(* | Ifx_Shell_Call )(pchar args, void *data, IfxStdIf_DPipe *io) |
Definition of a callback function which handles a Shell command. More... | |
Enumerations | |
enum | Ifx_Shell_ResultCode { Ifx_Shell_ResultCode_unknown = (128), Ifx_Shell_ResultCode_nok = (129), Ifx_Shell_ResultCode_undefined = (130), Ifx_Shell_ResultCode_ok = (255) } |
Result code definition used after each executed Shell command. More... | |
enum | Ifx_Shell_CmdState { IFX_SHELL_CMD_STATE_NORMAL, IFX_SHELL_CMD_STATE_ESCAPE, IFX_SHELL_CMD_STATE_ESCAPE_BRACKET, IFX_SHELL_CMD_STATE_ESCAPE_BRACKET_NUMBER } |
Shell command processing state. More... | |
Functions | |
Basic functionality | |
void | Ifx_Shell_initConfig (Ifx_Shell_Config *config) |
IFX_EXTERN boolean | Ifx_Shell_init (Ifx_Shell *shell, const Ifx_Shell_Config *config) |
Initialize the shell. More... | |
IFX_EXTERN void | Ifx_Shell_deinit (Ifx_Shell *shell) |
Deinitialise the shell. More... | |
IFX_EXTERN void | Ifx_Shell_enable (Ifx_Shell *shell) |
Clear the receive buffer and enable the shell. More... | |
IFX_EXTERN void | Ifx_Shell_disable (Ifx_Shell *shell) |
Disable the shell. More... | |
IFX_EXTERN void | Ifx_Shell_process (Ifx_Shell *shell) |
Process the shell. More... | |
Parsing functions | |
IFX_EXTERN pchar | Ifx_Shell_skipWhitespace (pchar args) |
Within the context of Shell.call, skip the whitespaces of the args string. More... | |
IFX_EXTERN boolean | Ifx_Shell_matchToken (pchar *argsPtr, pchar token) |
Match string pointed by the *argsPtr with a given token. More... | |
IFX_EXTERN boolean | Ifx_Shell_parseToken (pchar *argsPtr, char *tokenBuffer, int bufferLength) |
Parse a token. More... | |
IFX_EXTERN boolean | Ifx_Shell_parseAddress (pchar *argsPtr, void **address) |
Parse an address. More... | |
IFX_EXTERN boolean | Ifx_Shell_parseSInt32 (pchar *argsPtr, sint32 *value) |
Parse a signed 32-bit integer value. More... | |
IFX_EXTERN boolean | Ifx_Shell_parseUInt32 (pchar *argsPtr, uint32 *value, boolean hex) |
Parse an unsigned 32-bit integer value. More... | |
IFX_EXTERN boolean | Ifx_Shell_parseSInt64 (pchar *argsPtr, sint64 *value) |
Parse a signed 64-bit integer value. More... | |
IFX_EXTERN boolean | Ifx_Shell_parseUInt64 (pchar *argsPtr, uint64 *value, boolean hex) |
Parse an unsigned 64-bit integer value. More... | |
IFX_EXTERN boolean | Ifx_Shell_parseFloat64 (pchar *argsPtr, float64 *value) |
Parse a 64-bit (double precision) floating-point value. More... | |
IFX_EXTERN boolean | Ifx_Shell_parseFloat32 (pchar *argsPtr, float32 *value) |
Parse a 32-bit (single precision) floating-point value. More... | |
Command list functions | |
IFX_EXTERN const Ifx_Shell_Command * | Ifx_Shell_commandFind (const Ifx_Shell_Command *commandList, pchar commandLine, pchar *args) |
Find command in commandList. More... | |
IFX_EXTERN boolean | Ifx_Shell_showHelpSingle (pchar prefix, const void *commandList, IfxStdIf_DPipe *io) |
Implementation of Ifx_Shell_Call. Show the help menu from single command list. More... | |
IFX_EXTERN boolean | Ifx_Shell_showHelp (pchar args, void *shellPtr, IfxStdIf_DPipe *io) |
Implementation of Ifx_Shell_Call. Show the help menu and list of commands. More... | |
IFX_EXTERN void | Ifx_Shell_printSyntax (const Ifx_Shell_Syntax *syntaxList, IfxStdIf_DPipe *io) |
Find command in commandList. More... | |
Sub protocol functions | |
IFX_EXTERN boolean | Ifx_Shell_protocolStart (pchar args, void *data, IfxStdIf_DPipe *io) |
Implementation of Ifx_Shell_Call. Start the ShellBb protocol. More... | |
IFX_EXTERN boolean | Ifx_Shell_bbProtocolStart (pchar args, void *data, IfxStdIf_DPipe *io) |
Implementation of Ifx_Shell_Call. Start the ShellBb protocol. More... | |
Shell functions.
IMPORTANT NOTICE
Infineon Technologies AG (Infineon) is supplying this file for use exclusively with Infineon's microcontroller products. This file can be freely distributed within development tools that are supporting such microcontroller products.
THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
Definition in file Ifx_Shell.h.
struct Ifx_Shell_Command |
Shell command object.
Definition at line 70 of file Ifx_Shell.h.
Data Fields | ||
---|---|---|
Ifx_Shell_Call | call | |
pchar | commandLine | |
void * | data | |
pchar | help |
struct Ifx_Shell_CmdLine |
Command line editing state.
Definition at line 79 of file Ifx_Shell.h.
Data Fields | ||
---|---|---|
char * | cmdStr | Pointer to current string containing command line as so far processed. |
Ifx_SizeT | cursor | Pointer to variable containing position of cursor in so-far-processed command line. |
boolean | historyAdd | If TRUE, when Enter is pressed, the current cmdLine should be added to the command history (in parent) |
Ifx_SizeT | historyItem | Item ID in command history list, or IFX_SHELL_CMD_HISTORY_NO_ITEM if not using list (e.g. new command) |
Ifx_SizeT | length | Pointer to variable containing total length of command line. |
struct Ifx_Shell_Flags |
struct Ifx_Shell_Runtime |
internal Shell run-time data
Definition at line 119 of file Ifx_Shell.h.
Data Fields | ||
---|---|---|
Ifx_Shell_CmdState | cmdState | |
char | cmdStr[IFX_SHELL_CMD_LINE_SIZE] | |
char | echo[2] | |
char | escBracketNum | |
char | inputbuffer[IFX_SHELL_CMD_LINE_SIZE+1] |
struct Ifx_Shell |
Shell object definition.
Definition at line 131 of file Ifx_Shell.h.
Data Fields | ||
---|---|---|
Ifx_Shell_CmdLine | cmd | Current status of command line editing (saves passing many parameters around) |
char * | cmdHistory[IFX_SHELL_CMD_HISTORY_SIZE] | Array of pointers to the history entries. |
const Ifx_Shell_Command * | commandList[IFX_SHELL_COMMAND_LISTS] | Array of pointers to command list. The pointed location shall be constant during Shell lifetime, e.g. stored in non-volatile memory or as global variable. |
Ifx_Shell_Flags | control | control flags |
IfxStdIf_DPipe * | io | Pointer to IfxStdIf_DPipe object used by the Shell. |
Ifx_Shell_Runtime | locals | Runtime data. |
Ifx_Shell_Protocol | protocol | Protocol handler data. |
struct Ifx_Shell_Config |
Shell configuration.
Definition at line 155 of file Ifx_Shell.h.
Data Fields | ||
---|---|---|
const Ifx_Shell_Command * | commandList[IFX_SHELL_COMMAND_LISTS] | Specifies pointer to the command list. |
boolean | echo | Specifies whether each command shall be echoed back to user. |
Ifx_Shell_Protocol | protocol | Configuration for the Ifx_Shell_Protocol. |
boolean | sendResultCode | Specifies whether the Ifx_Shell_ResultCode shall be sent to user. |
boolean | showPrompt | Specifies whether the IFX_SHELL_PROMPT shall be displayed after each command. |
IfxStdIf_DPipe * | standardIo | Pointer to a IfxStdIf_DPipe object used by the Shell. |
struct Ifx_Shell_Syntax |
Definition at line 165 of file Ifx_Shell.h.
Data Fields | ||
---|---|---|
pchar | description | |
pchar | syntax |
#define IFX_SHELL_CMD_HISTORY_NO_ITEM (-1) |
Signifies no item in use in command history list.
Definition at line 55 of file Ifx_Shell.h.
Referenced by Ifx_Shell_cmdEscapeProcess(), Ifx_Shell_init(), and Ifx_Shell_process().
#define IFX_SHELL_CMD_HISTORY_SIZE (10) |
Number of commands to store in history.
Definition at line 37 of file Ifx_Shell.h.
Referenced by Ifx_Shell_cmdEscapeProcess(), Ifx_Shell_init(), and Ifx_Shell_process().
#define IFX_SHELL_CMD_LINE_SIZE (128) |
max command line IFX_SHELL_CMD_LINE_SIZE - 1
Definition at line 38 of file Ifx_Shell.h.
Referenced by Ifx_Shell_cmdEscapeProcess(), Ifx_Shell_init(), and Ifx_Shell_process().
#define IFX_SHELL_COMMAND_LIST_END {0, 0, 0, 0} |
Marker for end of command list.
Definition at line 49 of file Ifx_Shell.h.
#define IFX_SHELL_COMMAND_LISTS (1) |
Number of command lists.
Definition at line 41 of file Ifx_Shell.h.
Referenced by Ifx_Shell_commandListFind(), Ifx_Shell_init(), Ifx_Shell_initConfig(), and Ifx_Shell_showHelp().
#define IFX_SHELL_NULL_CHAR '\0' |
Definition at line 35 of file Ifx_Shell.h.
Referenced by Ifx_Shell_cmdEscapeProcess(), Ifx_Shell_execute(), Ifx_Shell_init(), Ifx_Shell_isEndOfLine(), Ifx_Shell_parseAddress(), Ifx_Shell_parseFloat32(), Ifx_Shell_parseFloat64(), Ifx_Shell_parseSInt64(), Ifx_Shell_parseToken(), Ifx_Shell_parseUInt64(), Ifx_Shell_process(), Ifx_Shell_showHelpSingle(), and Ifx_Shell_skipWhitespace().
#define IFX_SHELL_PROMPT "Shell>" |
Shell prompt.
Definition at line 45 of file Ifx_Shell.h.
Referenced by Ifx_Shell_init(), and Ifx_Shell_process().
#define IFX_SHELL_SYNTAX_LIST_END {0, 0} |
Marker for end of syntax list.
Definition at line 52 of file Ifx_Shell.h.
typedef boolean(* Ifx_Shell_Call)(pchar args, void *data, IfxStdIf_DPipe *io) |
Definition of a callback function which handles a Shell command.
Definition at line 67 of file Ifx_Shell.h.
enum Ifx_Shell_CmdState |
Shell command processing state.
Definition at line 89 of file Ifx_Shell.h.
enum Ifx_Shell_ResultCode |
Result code definition used after each executed Shell command.
Enumerator | |
---|---|
Ifx_Shell_ResultCode_unknown | |
Ifx_Shell_ResultCode_nok | |
Ifx_Shell_ResultCode_undefined | |
Ifx_Shell_ResultCode_ok |
Definition at line 58 of file Ifx_Shell.h.