RTEMS CPU Kit with SuperCore  4.11.3
Macros | Functions | Variables
shell.c File Reference
#include <stdio.h>
#include <time.h>
#include <rtems.h>
#include <rtems/error.h>
#include <rtems/libio.h>
#include <rtems/libio_.h>
#include <rtems/system.h>
#include <rtems/shell.h>
#include <rtems/shellconfig.h>
#include <rtems/console.h>
#include "internal.h"
#include <termios.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <pwd.h>
#include <pthread.h>
#include <assert.h>
Include dependency graph for shell.c:

Macros

#define RTEMS_SHELL_MAXIMUM_ARGUMENTS   (128)
 
#define RTEMS_SHELL_CMD_SIZE   (128)
 
#define RTEMS_SHELL_CMD_COUNT   (32)
 
#define RTEMS_SHELL_PROMPT_SIZE   (128)
 

Functions

void rtems_shell_init_environment (void)
 
rtems_shell_env_trtems_shell_get_current_env (void)
 
void rtems_shell_dup_current_env (rtems_shell_env_t *copy)
 
bool rtems_shell_main_loop (rtems_shell_env_t *shell_env_arg)
 
rtems_status_code rtems_shell_init (const char *task_name, size_t task_stacksize, rtems_task_priority task_priority, const char *devname, bool forever, bool wait, rtems_shell_login_check_t login_check)
 Initialise the shell creating tasks to login and run the shell sessions. More...
 
rtems_status_code rtems_shell_script (const char *task_name, size_t task_stacksize, rtems_task_priority task_priority, const char *input, const char *output, bool output_append, bool wait, bool echo)
 Run a shell script creating a shell tasks to execute the command under. More...
 

Variables

const rtems_shell_env_t rtems_global_shell_env
 

Function Documentation

◆ rtems_shell_init()

rtems_status_code rtems_shell_init ( const char *  task_name,
size_t  task_stacksize,
rtems_task_priority  task_priority,
const char *  devname,
bool  forever,
bool  wait,
rtems_shell_login_check_t  login_check 
)

Initialise the shell creating tasks to login and run the shell sessions.

Parameters
task_nameName of the shell task.
task_stacksizeThe size of the stack. If 0 the default size is used.
task_priorityThe priority the shell runs at.
foreverRepeat logins.
waitCaller should block until shell exits.
login_checkUser login check function, NULL disables login checks.

◆ rtems_shell_script()

rtems_status_code rtems_shell_script ( const char *  task_name,
size_t  task_stacksize,
rtems_task_priority  task_priority,
const char *  input,
const char *  output,
bool  output_append,
bool  wait,
bool  echo 
)

Run a shell script creating a shell tasks to execute the command under.

Parameters
task_nameName of the shell task.
task_stacksizeThe size of the stack. If 0 the default size is used.
task_priorityThe priority the shell runs at.
inputThe file of commands. Can be 'stdin' to use stdin.
outputThe output file to write commands to. Can be 'stdout', 'stderr' or '/dev/null'.
output_appendAppend the output to the file or truncate the file. Create if it does not exist.
waitWait for the script to finish.

References RTEMS_INVALID_ID, RTEMS_LOCAL, RTEMS_SELF, RTEMS_SUCCESSFUL, and rtems_task_ident().

Variable Documentation

◆ rtems_global_shell_env

const rtems_shell_env_t rtems_global_shell_env
Initial value:
= {
.magic = rtems_build_name('S', 'E', 'N', 'V'),
.devname = CONSOLE_DEVICE_NAME,
.taskname = "SHGL",
.exit_shell = false,
.forever = true,
.errorlevel = -1,
.echo = false,
.cwd = "/",
.input = NULL,
.output = NULL,
.output_append = false,
.wake_on_end = RTEMS_ID_NONE,
.login_check = NULL
}
#define CONSOLE_DEVICE_NAME
This macro defines the standard name for the console device that is available to applications.
Definition: console.h:32
#define RTEMS_ID_NONE
Invalid object identifier value.
Definition: types.h:87
#define rtems_build_name(_C1, _C2, _C3, _C4)
Build Thirty-Two Bit Object Name.
Definition: object.h:96