EE445M RTOS
Taken at the University of Texas Spring 2015
|
#include <shellpp.hpp>
Public Member Functions | |
shell () | |
shell (uart *u) | |
shell (uart *u, semaphore *m_start, semaphore *m_stop) | |
void | clear_buffer () |
void | set_ps1 (char *new_ps1) |
void | print_ps1 () |
bool | type (char ch) |
void | backspace (void) |
void | accept (char ch) |
exit_status_t | execute_command () |
Private Member Functions | |
int32_t | ustrncmp (const char *, const char *, uint32_t) |
void * | memset (void *b, int c, int len) |
uint32_t | strlen (const char *) |
void | init_ps1 (void) |
void | init (void) |
Static Private Member Functions | |
static exit_status_t | help_info (const char *args) |
static exit_status_t | doctor (const char *args) |
static exit_status_t | witch (const char *args) |
static exit_status_t | jester (const char *args) |
static exit_status_t | motor_start (const char *args) |
static exit_status_t | motor_stop (const char *args) |
static void | ustrcpy (char *dest, const char *source) |
Private Attributes | |
uart * | uart0 |
buffer< char, 32 > | buf |
char | ps1 [4+1] |
Static Private Attributes | |
static char | system_command_names [2][10] |
static sys_cmd | system_command_funcs [2] |
static semaphore * | m_start |
static semaphore * | m_stop |
Definition at line 31 of file shellpp.hpp.
shell::shell | ( | ) |
Definition at line 81 of file shellpp.cpp.
References init().
shell::shell | ( | uart * | u | ) |
void shell::accept | ( | char | ch | ) |
Accept a char, shell will call or appropriately.
Definition at line 174 of file shellpp.cpp.
References backspace(), execute_command(), and type().
Referenced by shell_handler().
void shell::backspace | ( | void | ) |
Remove a char from the shell buffer.
Definition at line 192 of file shellpp.cpp.
References uart::atomic_printf(), buf, buffer< T, N >::get(), and uart0.
Referenced by accept().
void shell::clear_buffer | ( | ) |
Clear the shell buffer.
Definition at line 142 of file shellpp.cpp.
References buf, and buffer< T, N >::clear().
|
staticprivate |
Definition at line 21 of file shellpp.cpp.
References blink, EXIT_SUCCESS, PIN_RED, and blinker::toggle().
Referenced by execute_command().
exit_status_t shell::execute_command | ( | ) |
Execute this command.
You know how I know this shell sucks? You can't even do this, because uart0 is a non-static context and this is a static context. eff this implementation of system
Definition at line 228 of file shellpp.cpp.
References uart::atomic_printf(), buf, buffer< T, N >::buf, doctor(), EXIT_SUCCESS, jester(), buffer< T, N >::length(), motor_start(), motor_stop(), print_ps1(), shell_command_is, uart0, and witch().
Referenced by accept().
|
staticprivate |
|
private |
Common code between constructors
Definition at line 75 of file shellpp.cpp.
References buf, and init_ps1().
Referenced by shell().
|
private |
Definition at line 102 of file shellpp.cpp.
References print_ps1(), and ps1.
Referenced by init().
|
staticprivate |
Definition at line 35 of file shellpp.cpp.
References blink, EXIT_SUCCESS, PIN_BLUE, and blinker::toggle().
Referenced by execute_command().
|
private |
Definition at line 113 of file shellpp.cpp.
|
staticprivate |
Definition at line 201 of file shellpp.cpp.
References EXIT_SUCCESS, and semaphore::post().
Referenced by execute_command().
|
staticprivate |
Definition at line 207 of file shellpp.cpp.
References EXIT_SUCCESS, and semaphore::post().
Referenced by execute_command().
void shell::print_ps1 | ( | ) |
Print the PS1.
Definition at line 153 of file shellpp.cpp.
References uart::atomic_printf(), buf, buffer< T, N >::clear(), ps1, and uart0.
Referenced by execute_command(), and init_ps1().
void shell::set_ps1 | ( | char * | new_ps1 | ) |
Set the PS1.
Definition at line 147 of file shellpp.cpp.
References ps1, strlen(), and umemcpy().
|
private |
Return the length of a null-terminated string.
Definition at line 126 of file shellpp.cpp.
Referenced by set_ps1().
bool shell::type | ( | char | ch | ) |
Add a char to the shell buffer.
Definition at line 159 of file shellpp.cpp.
References buffer< T, N >::add(), uart::atomic_printf(), buf, buffer< T, N >::full(), and uart0.
Referenced by accept().
|
staticprivate |
Definition at line 66 of file shellpp.cpp.
|
private |
Execute a system command.
Definition at line 44 of file shellpp.cpp.
|
staticprivate |
Definition at line 28 of file shellpp.cpp.
References blink, EXIT_SUCCESS, PIN_GREEN, and blinker::toggle().
Referenced by execute_command().
|
private |
Definition at line 34 of file shellpp.hpp.
Referenced by backspace(), clear_buffer(), execute_command(), init(), print_ps1(), and type().
|
staticprivate |
Definition at line 60 of file shellpp.hpp.
Referenced by shell().
|
staticprivate |
Definition at line 61 of file shellpp.hpp.
Referenced by shell().
|
private |
Definition at line 36 of file shellpp.hpp.
Referenced by init_ps1(), print_ps1(), and set_ps1().
|
staticprivate |
Definition at line 54 of file shellpp.hpp.
|
staticprivate |
Definition at line 53 of file shellpp.hpp.
|
private |
Definition at line 33 of file shellpp.hpp.
Referenced by backspace(), execute_command(), print_ps1(), shell(), and type().