Paparazzi UAS  v6.0_unstable-91-g69c55a0-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
SHELL

Data Structures

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

Macros

#define printScreen(...)   {chprintf (chpg, __VA_ARGS__); chprintf (chpg, "\r\n");}
 
#define SHELL_DYNAMIC_ENTRIES_NUMBER   0U
 
#define shellCreate(C, S, P)   shellCreateFromHeap(C, S, P)
 

Typedefs

typedef void( shellcmd_f )(BaseSequentialStream *chp, int argc, const char *const argv[])
 Command handler function type. More...
 

Functions

static void cmd_info (BaseSequentialStream *lchp, int argc, const char *const argv[])
 
static MUTEX_DECL (mut)
 
void microrlPrint (const char *str)
 
void microrlExecute (int argc, const char *const *argv)
 
const char ** microrlComplet (int argc, const char *const *argv)
 
void microrlSigint (void)
 
static void usage (BaseSequentialStream *lchp, char *p)
 
static THD_FUNCTION (shell_thread, p)
 Shell thread function. More...
 
void shellInit (void)
 Shell manager initialization. More...
 
thread_t * shellCreateStatic (const ShellConfig *scp, void *wsp, size_t size, tprio_t prio)
 Spawns a new shell. More...
 
void modeAlternate (void(*funcp)(uint8_t c, uint32_t mode), uint32_t mode)
 
void modeShell (void)
 
bool shellGetLine (BaseSequentialStream *chp, char *line, unsigned size)
 

Variables

void(* AltCbParam::altFunc )(uint8_t c, uint32_t mode)
 
uint32_t AltCbParam::param
 
event_source_t shell_terminated
 Shell termination event source. More...
 
static microrl_t rl
 
static BaseSequentialStream * chpg
 
static const ShellCommandstaticCommands = NULL
 
static const char * complWorlds [64]
 
static const ShellCommand localCommands []
 Array of the default and dynamic commands. More...
 
static AltCbParam altCbParam = {.altFunc = NULL, .param = 0}
 
event_source_t shell_terminated
 Shell termination event source. More...
 

Detailed Description


Data Structure Documentation

struct AltCbParam

Definition at line 18 of file microrlShell.c.

Data Fields

void(* altFunc )(uint8_t c, uint32_t mode)
 
uint32_t param
 
struct ShellCommand

Custom command entry type.

Definition at line 30 of file microrlShell.h.

Data Fields
shellcmd_f * sc_function Command function.
const char * sc_name Command name.
struct ShellConfig

Shell descriptor type.

Definition at line 38 of file microrlShell.h.

+ Collaboration diagram for ShellConfig:
Data Fields
BaseSequentialStream * sc_channel I/O channel associated to the shell.
const ShellCommand * sc_commands Shell extra commands table.

Macro Definition Documentation

#define printScreen (   ...)    {chprintf (chpg, __VA_ARGS__); chprintf (chpg, "\r\n");}

Definition at line 16 of file microrlShell.c.

Referenced by modeShell(), and THD_FUNCTION().

#define SHELL_DYNAMIC_ENTRIES_NUMBER   0U

Definition at line 15 of file microrlShell.h.

#define shellCreate (   C,
  S,
  P 
)    shellCreateFromHeap(C, S, P)

Definition at line 19 of file microrlShell.h.

Typedef Documentation

typedef void( shellcmd_f)(BaseSequentialStream *chp, int argc, const char *const argv[])

Command handler function type.

Definition at line 24 of file microrlShell.h.

Function Documentation

static void cmd_info ( BaseSequentialStream *  lchp,
int  argc,
const char *const  argv[] 
)
static

Definition at line 144 of file microrlShell.c.

References BOARD_NAME, chprintf(), and usage().

+ Here is the call graph for this function:

const char** microrlComplet ( int  argc,
const char *const *  argv 
)

Definition at line 88 of file microrlShell.c.

References complWorlds, mut, and ShellCommand::sc_name.

Referenced by shellInit().

+ Here is the caller graph for this function:

void microrlExecute ( int  argc,
const char *const *  argv 
)

Definition at line 60 of file microrlShell.c.

References chpg, localCommands, mut, ShellCommand::sc_function, ShellCommand::sc_name, and staticCommands.

Referenced by shellInit().

+ Here is the caller graph for this function:

void microrlPrint ( const char *  str)

Definition at line 51 of file microrlShell.c.

References chpg.

Referenced by shellInit().

+ Here is the caller graph for this function:

void microrlSigint ( void  )

Definition at line 131 of file microrlShell.c.

References chpg, and chprintf().

Referenced by shellInit().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void modeAlternate ( void(*)(uint8_t c, uint32_t mode funcp,
uint32_t  mode 
)

Definition at line 455 of file microrlShell.c.

References AltCbParam::altFunc, mode, mut, and AltCbParam::param.

void modeShell ( void  )

Definition at line 463 of file microrlShell.c.

References AltCbParam::altFunc, mut, and printScreen.

static MUTEX_DECL ( mut  )
static
thread_t * shellCreateStatic ( const ShellConfig scp,
void *  wsp,
size_t  size,
tprio_t  prio 
)

Spawns a new shell.

Precondition
CH_USE_MALLOC_HEAP and CH_USE_DYNAMIC must be enabled.
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. 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
[in]priopriority level for the new shell
Returns
A pointer to the shell thread.

Definition at line 416 of file microrlShell.c.

bool shellGetLine ( BaseSequentialStream *  chp,
char *  line,
unsigned  size 
)
void shellInit ( void  )

Shell manager initialization.

Definition at line 382 of file microrlShell.c.

References microrl_init(), microrl_set_complete_callback(), microrl_set_execute_callback(), microrl_set_sigint_callback(), microrlComplet(), microrlExecute(), microrlPrint(), microrlSigint(), and shell_terminated.

Referenced by shell_init_arch().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static THD_FUNCTION ( shell_thread  ,
p   
)
static

Shell thread function.

Parameters
[in]ppointer to a BaseSequentialStream object
Returns
Termination reason.
Return values
MSG_OKterminated by command.
RDY_RESETterminated by reset condition on the I/O channel.

Definition at line 350 of file microrlShell.c.

References AltCbParam::altFunc, chpg, FALSE, microrl_insert_char(), msg, p, AltCbParam::param, printScreen, shell_terminated, and TRUE.

+ Here is the call graph for this function:

static void usage ( BaseSequentialStream *  lchp,
char *  p 
)
static

Definition at line 137 of file microrlShell.c.

References chprintf().

Referenced by cmd_info(), and nps_main_parse_options().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

AltCbParam altCbParam = {.altFunc = NULL, .param = 0}
static

Definition at line 49 of file microrlShell.c.

void(* AltCbParam::altFunc)(uint8_t c, uint32_t mode)

Definition at line 19 of file microrlShell.c.

Referenced by modeAlternate(), modeShell(), and THD_FUNCTION().

BaseSequentialStream* chpg
static

Definition at line 34 of file microrlShell.c.

Referenced by microrlExecute(), microrlPrint(), microrlSigint(), and THD_FUNCTION().

const char* complWorlds[64]
static

Definition at line 36 of file microrlShell.c.

Referenced by microrlComplet().

const ShellCommand localCommands[]
static
Initial value:
= {
{"info", cmd_info},
{NULL, NULL}
}
static void cmd_info(BaseSequentialStream *lchp, int argc, const char *const argv[])
Definition: microrlShell.c:144

Array of the default and dynamic commands.

Definition at line 43 of file microrlShell.c.

Referenced by microrlExecute().

uint32_t AltCbParam::param

Definition at line 20 of file microrlShell.c.

Referenced by modeAlternate(), and THD_FUNCTION().

microrl_t rl
static

Definition at line 33 of file microrlShell.c.

event_source_t shell_terminated

Shell termination event source.

Definition at line 30 of file microrlShell.c.

Referenced by shellInit(), and THD_FUNCTION().

event_source_t shell_terminated

Shell termination event source.

Definition at line 30 of file microrlShell.c.

Referenced by shellInit(), and THD_FUNCTION().

const ShellCommand* staticCommands = NULL
static

Definition at line 35 of file microrlShell.c.

Referenced by microrlExecute().