Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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

◆ AltCbParam

struct AltCbParam

Definition at line 18 of file microrlShell.c.

Data Fields

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

◆ ShellCommand

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.


◆ ShellConfig

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

◆ printScreen

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

Definition at line 16 of file microrlShell.c.

◆ SHELL_DYNAMIC_ENTRIES_NUMBER

#define SHELL_DYNAMIC_ENTRIES_NUMBER   0U

Definition at line 15 of file microrlShell.h.

◆ shellCreate

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

Definition at line 19 of file microrlShell.h.

Typedef Documentation

◆ shellcmd_f

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

◆ cmd_info()

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(), STM32_SYSCLK, and usage().

+ Here is the call graph for this function:

◆ microrlComplet()

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

Definition at line 88 of file microrlShell.c.

References complWorlds, localCommands, mut, ShellCommand::sc_name, and staticCommands.

Referenced by shellInit().

+ Here is the caller graph for this function:

◆ microrlExecute()

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:

◆ microrlPrint()

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:

◆ microrlSigint()

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:

◆ modeAlternate()

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

Definition at line 451 of file microrlShell.c.

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

◆ modeShell()

void modeShell ( void  )

Definition at line 459 of file microrlShell.c.

References altCbParam, AltCbParam::altFunc, mut, and printScreen.

◆ MUTEX_DECL()

static MUTEX_DECL ( mut  )
static

◆ shellCreateStatic()

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 412 of file microrlShell.c.

◆ shellGetLine()

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

◆ shellInit()

void shellInit ( void  )

Shell manager initialization.

Definition at line 378 of file microrlShell.c.

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

Referenced by shell_init_arch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ THD_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, AltCbParam::altFunc, chpg, microrl_insert_char(), msg, p, AltCbParam::param, printScreen, rl, shell_terminated, and staticCommands.

+ Here is the call graph for this function:

◆ usage()

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

Definition at line 137 of file microrlShell.c.

References chprintf(), and p.

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 altCbParam = {.altFunc = NULL, .param = 0}
static

Definition at line 49 of file microrlShell.c.

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

◆ altFunc

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

Definition at line 19 of file microrlShell.c.

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

◆ chpg

BaseSequentialStream* chpg
static

Definition at line 34 of file microrlShell.c.

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

◆ complWorlds

const char* complWorlds[64]
static

Definition at line 36 of file microrlShell.c.

Referenced by microrlComplet().

◆ localCommands

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 microrlComplet(), and microrlExecute().

◆ param

uint32_t AltCbParam::param

Definition at line 20 of file microrlShell.c.

Referenced by modeAlternate(), and THD_FUNCTION().

◆ rl

microrl_t rl
static

Definition at line 33 of file microrlShell.c.

Referenced by shellInit(), and THD_FUNCTION().

◆ shell_terminated [1/2]

event_source_t shell_terminated

Shell termination event source.

Definition at line 30 of file microrlShell.c.

Referenced by shellInit(), and THD_FUNCTION().

◆ shell_terminated [2/2]

event_source_t shell_terminated
extern

Shell termination event source.

Definition at line 30 of file microrlShell.c.

Referenced by shellInit(), and THD_FUNCTION().

◆ staticCommands

const ShellCommand* staticCommands = NULL
static

Definition at line 35 of file microrlShell.c.

Referenced by microrlComplet(), microrlExecute(), and THD_FUNCTION().