All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
vexshell.h File Reference

Simple CLI shell header. More...

Go to the source code of this file.

Data Structures

struct  ShellCommand
 Custom command entry type. More...
 
struct  ShellConfig
 Shell descriptor type. More...
 

Macros

#define SHELL_MAX_LINE_LENGTH   64
 Shell maximum input line length. More...
 
#define SHELL_MAX_ARGUMENTS   4
 Shell maximum arguments per command. More...
 

Typedefs

typedef void(* shellcmd_t )(vexStream *chp, int argc, char *argv[])
 Command handler function type. More...
 

Functions

void shellInit (void)
 Shell manager initialization. More...
 
Thread * shellCreate (const ShellConfig *scp, size_t size, tprio_t prio)
 Spawns a new shell using dynamic memory allocation. More...
 
Thread * shellCreateStatic (const ShellConfig *scp, void *wsp, size_t size, tprio_t prio)
 Create statically allocated shell thread. More...
 
bool_t shellGetLine (vexStream *chp, char *line, unsigned size)
 Gets a single line of input for the shell. More...
 

Detailed Description

Simple CLI shell header.

Macro Definition Documentation

#define SHELL_MAX_LINE_LENGTH   64

Shell maximum input line length.

#define SHELL_MAX_ARGUMENTS   4

Shell maximum arguments per command.

Typedef Documentation

typedef void(* shellcmd_t)(vexStream *chp, int argc, char *argv[])

Command handler function type.

Function Documentation

void shellInit ( void  )

Shell manager initialization.

Thread* shellCreate ( const ShellConfig scp,
size_t  size,
tprio_t  prio 
)

Spawns a new shell using dynamic memory allocation.

Parameters
[in]scppointer to a ShellConfig object
[in]sizesize of the shell working area to be allocated
[in]priopriority level for the new shell
Returns
A pointer to the shell thread.
Return values
NULLthread creation failed because memory allocation.
Note
CH_USE_MALLOC_HEAP and CH_USE_DYNAMIC must be enabled.
Thread* shellCreateStatic ( const ShellConfig scp,
void *  wsp,
size_t  size,
tprio_t  prio 
)

Create statically allocated shell thread.

Parameters
[in]scppointer to a ShellConfig object
[in]wsppointer to a working area dedicated to the shell thread stack
[in]sizesize of the shell working area to be allocated
[in]priopriority level for the new shell
Returns
A pointer to the shell thread.
bool_t shellGetLine ( vexStream chp,
char *  line,
unsigned  size 
)

Gets a single line of input for the shell.

Parameters
[in]chpA pointer to a vexStream object
[in]lineA pointer the inpout buffer
[in]sizesize of the inpout buffer
Returns
True if shell is to be terminated else false