Desktop/xinu_mips-1.0.2.tar/xinu_mips-1.0.2/include/shell.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  centry

Defines

#define SHELL_BUFLEN   80
#define SHELL_MAXTOK   16
#define SHELL_CMDSTK   8192
#define SHELL_CMDPRIO   20
#define SHELL_BANNER   "\033[1;35m_______________________________________\n _ _ _____ ______ _ _ \n \\ \\ / /(_____)| ___ \\ | | | |\n \\ \\/ / _ | | | || | | |\n ) ( | | | | | || | | |\n / /\\ \\ _| |_ | | | || |___| |\n /_/ \\_\\(_____)|_| |_| \\______|\n---------------------------------------\033[0;39m\n"
#define SHELL_START   "Welcome to the wonderful world of XINU!\n"
#define SHELL_EXIT   "Shell closed.\n"
#define SHELL_PROMPT   "xsh$ "
#define SHELL_SYNTAXERR   "Syntax error.\n"
#define SHELL_CHILDERR   "Cannot create.\n"
#define isEndOfLine(c)   ((c) == '\0' || (c) == '\r' || (c) == '\n')
#define isQuote(c)   ((c) == '"' || (c) == '\'')
#define isOtherSpecial(c)   ((c) == '<' || (c) == '>' || (c) == '&')
#define isWhitespace(c)   ((c) == ' ' || (c) == '\t')

Functions

process shell (ushort)
short lexan (char *, ushort, char *, char *[])
command xsh_exit (ushort, ushort, ushort, ushort, char *[])
command xsh_gpiostat (ushort, ushort, ushort, ushort, char *[])
command xsh_help (ushort, ushort, ushort, ushort, char *[])
command xsh_kill (ushort, ushort, ushort, ushort, char *[])
command xsh_led (ushort, ushort, ushort, ushort, char *[])
command xsh_memstat (ushort, ushort, ushort, ushort, char *[])
command xsh_ps (ushort, ushort, ushort, ushort, char *[])
command xsh_reset (ushort, ushort, ushort, ushort, char *[])
command xsh_sleep (ushort, ushort, ushort, ushort, char *[])
command xsh_test (ushort, ushort, ushort, ushort, char *[])
command xsh_testsuite (ushort, ushort, ushort, ushort, char *[])
command xsh_uartstat (ushort, ushort, ushort, ushort, char *[])

Variables

struct centry commandtab []
ulong ncommand


Detailed Description

Id
shell.h 238 2007-07-13 17:25:53Z brylow

Definition in file shell.h.


Define Documentation

#define isEndOfLine (  )     ((c) == '\0' || (c) == '\r' || (c) == '\n')

Definition at line 37 of file shell.h.

Referenced by lexan().

#define isOtherSpecial (  )     ((c) == '<' || (c) == '>' || (c) == '&')

Definition at line 39 of file shell.h.

Referenced by lexan().

#define isQuote (  )     ((c) == '"' || (c) == '\'')

Definition at line 38 of file shell.h.

Referenced by lexan().

#define isWhitespace (  )     ((c) == ' ' || (c) == '\t')

Definition at line 40 of file shell.h.

Referenced by lexan().

#define SHELL_BANNER   "\033[1;35m_______________________________________\n _ _ _____ ______ _ _ \n \\ \\ / /(_____)| ___ \\ | | | |\n \\ \\/ / _ | | | || | | |\n ) ( | | | | | || | | |\n / /\\ \\ _| |_ | | | || |___| |\n /_/ \\_\\(_____)|_| |_| \\______|\n---------------------------------------\033[0;39m\n"

Definition at line 28 of file shell.h.

Referenced by shell().

#define SHELL_BUFLEN   80

length of general buffer

Definition at line 22 of file shell.h.

Referenced by shell().

#define SHELL_CHILDERR   "Cannot create.\n"

command error

Definition at line 34 of file shell.h.

Referenced by shell().

#define SHELL_CMDPRIO   20

command process priority

Definition at line 25 of file shell.h.

Referenced by shell().

#define SHELL_CMDSTK   8192

size of command proc. stack

Definition at line 24 of file shell.h.

Referenced by shell().

#define SHELL_EXIT   "Shell closed.\n"

exit message

Definition at line 31 of file shell.h.

Referenced by shell(), and xsh_exit().

#define SHELL_MAXTOK   16

maximum tokens per line

Definition at line 23 of file shell.h.

Referenced by lexan(), and shell().

#define SHELL_PROMPT   "xsh$ "

prompt

Definition at line 32 of file shell.h.

Referenced by shell().

#define SHELL_START   "Welcome to the wonderful world of XINU!\n"

start message

Definition at line 30 of file shell.h.

Referenced by shell().

#define SHELL_SYNTAXERR   "Syntax error.\n"

syntax error

Definition at line 33 of file shell.h.

Referenced by shell().


Function Documentation

short lexan ( char *  line,
ushort  linelen,
char *  tokbuf,
char *  tok[] 
)

Ad hoc lexical analyzer to divide command line into tokens

Parameters:
*line pointer to line to parse
linelen length of line to parse
*tokbuf buffer for tokens
*tok[] array of pointers into token buffer
Returns:
number of tokens created

Definition at line 20 of file lexan.c.

References isEndOfLine, isOtherSpecial, isQuote, isWhitespace, SHELL_MAXTOK, and SYSERR.

Referenced by shell().

process shell ( ushort  descrp  ) 

The XINU shell. Provides an interface to execute commands.

Parameters:
descrp descriptor of device on which the shell is open
Returns:
OK for successful exit, SYSERR for unrecoverable error

Definition at line 40 of file shell.c.

References centry::builtin, control(), create(), FALSE, fprintf(), lexan(), centry::name, ncommand, NULL, OK, centry::procedure, read(), ready(), receive(), RESCHED_NO, RESCHED_YES, SHELL_BANNER, SHELL_BUFLEN, SHELL_CHILDERR, SHELL_CMDPRIO, SHELL_CMDSTK, SHELL_EXIT, SHELL_MAXTOK, SHELL_PROMPT, SHELL_START, SHELL_SYNTAXERR, sleep(), strcmp(), syscall, SYSERR, TRUE, TTY_IFLAG_ECHO, TTY_IOC_CBREAK, TTY_IOC_EOF, and TTY_IOC_SETIFLAG.

Referenced by main().

command xsh_exit ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (exit) closes the shell.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
nargs number of arguments in args array
args array of arguments
Returns:
OK for success, SYSERR for syntax error

Definition at line 23 of file xsh_exit.c.

References fprintf(), getpid(), kill(), OK, SHELL_EXIT, sleep(), strncmp(), and SYSERR.

command xsh_gpiostat ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (gpiostat) provides information about the current status of the GPIO pins.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
nargs number of arguments in args array
args array of arguments
Returns:
OK for success, SYSERR for syntax error

Definition at line 24 of file xsh_gpiostat.c.

References gpio_csreg::control, gpio_csreg::enable, fprintf(), GPIO_BASE, GPIO_PIN_COUNT, gpio_csreg::input, OK, gpio_csreg::output, strncmp(), and SYSERR.

command xsh_help ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (help) provides a list of commands recognized by the shell, or displays help information for a particular command.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
nargs number of arguments in args array
args array of arguments
Returns:
OK for success, SYSERR for syntax error

Definition at line 24 of file xsh_help.c.

References commandtab, fprintf(), ncommand, OK, centry::procedure, strncmp(), and SYSERR.

command xsh_kill ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (kill) terminates a process.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
nargs number of arguments in args array
args array of arguments
Returns:
OK for success, SYSERR for syntax error

Definition at line 24 of file xsh_kill.c.

References atol(), fprintf(), getpid(), kill(), NULLPROC, OK, sleep(), strncmp(), and SYSERR.

command xsh_led ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (led DESCRIPTOR STATE) turns a specified led on or off.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
nargs number of arguments in args array
args array of arguments
Returns:
OK for success, SYSERR for syntax error

Definition at line 23 of file xsh_led.c.

References fprintf(), GPIO1, GPIO_CTRL_LED_OFF, GPIO_CTRL_LED_ON, GPIO_LED_CISCOONG, GPIO_LED_CISCOWHT, GPIO_LED_DMZ, GPIO_LED_WLAN, OK, strncmp(), and SYSERR.

command xsh_memstat ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (gpiostat) provides memory use and free list information.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
nargs number of arguments in args array
args array of arguments
Returns:
OK for success, SYSERR for syntax error

Definition at line 30 of file xsh_memstat.c.

References _start(), end, fprintf(), freelist, KSEG0_BASE, memblock::length, memblock::next, NPROC, NULL, OK, PRFREE, proctab, strncmp(), and SYSERR.

command xsh_ps ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (ps) outputs process table information.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
nargs number of arguments in args array
args array of arguments

Definition at line 23 of file xsh_ps.c.

References fprintf(), pentry::name, NPROC, OK, pentry::parent, PRFREE, pentry::prio, proctab, pentry::state, pentry::stkbase, pentry::stklen, pentry::stkptr, strncmp(), and SYSERR.

command xsh_reset ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (reset) performs a soft restart of the router.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
nargs number of arguments in args array
args array of arguments
Returns:
OK for success, SYSERR for syntax error

Definition at line 23 of file xsh_reset.c.

References fprintf(), GPIO_BASE, GPIO_BUT_RESET, gpio_csreg::input, OK, strncmp(), and SYSERR.

command xsh_sleep ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (sleep DELAY) delay for a given number of seconds.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
args array of arguments
Returns:
OK for success, SYSERR for syntax error

Definition at line 22 of file xsh_sleep.c.

References atol(), fprintf(), OK, sleep(), strncmp(), and SYSERR.

command xsh_test ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (test) provides a mechanism for testing XINU features. The action and output varies depending on the feature currently being tested. This is not meant to serve as a permanent shell command for a particular action.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
args array of arguments
Returns:
OK for success, SYSERR for syntax error

Definition at line 22 of file xsh_test.c.

References OK.

command xsh_testsuite ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (testsuite) provides a menu of standard XINU component tests.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
args array of arguments
Returns:
OK for success, SYSERR for syntax error

Definition at line 35 of file xsh_testsuite.c.

References atol(), fprintf(), NTESTS, OK, strncmp(), SYSERR, and testItem().

command xsh_uartstat ( ushort  stdin,
ushort  stdout,
ushort  stderr,
ushort  nargs,
char *  args[] 
)

Shell command (uartstat UARTNUM) provides information about the current status of a UART.

Parameters:
stdin descriptor of input device
stdout descriptor of output device
stderr descriptor of error device
nargs number of arguments in args array
args array of arguments

Definition at line 28 of file xsh_uartstat.c.

References atol(), fprintf(), NUART, OK, strncmp(), SYSERR, and uartStat().


Variable Documentation

struct centry commandtab[]

table of commands

Definition at line 16 of file shell.c.

Referenced by xsh_help().

number of commands in table

Definition at line 33 of file shell.c.

Referenced by shell(), and xsh_help().


Generated on Thu Oct 9 22:34:41 2008 for xinu by  doxygen 1.5.5