| 1 | /* |
|---|
| 2 | This file is part of MutekP. |
|---|
| 3 | |
|---|
| 4 | MutekP is free software; you can redistribute it and/or modify it |
|---|
| 5 | under the terms of the GNU General Public License as published by |
|---|
| 6 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 7 | (at your option) any later version. |
|---|
| 8 | |
|---|
| 9 | MutekP is distributed in the hope that it will be useful, but |
|---|
| 10 | WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 12 | General Public License for more details. |
|---|
| 13 | |
|---|
| 14 | You should have received a copy of the GNU General Public License |
|---|
| 15 | along with MutekP; if not, write to the Free Software Foundation, |
|---|
| 16 | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 17 | |
|---|
| 18 | UPMC / LIP6 / SOC (c) 2008 |
|---|
| 19 | Copyright Ghassan Almaless <ghassan.almaless@gmail.com> |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | #ifndef __MINI_SHELL_H__ |
|---|
| 23 | #define __MINI_SHELL_H__ |
|---|
| 24 | |
|---|
| 25 | #include <vfs.h> |
|---|
| 26 | #include <kdmsg.h> |
|---|
| 27 | |
|---|
| 28 | #define MS_MAX_ARG_LEN 20 |
|---|
| 29 | #define MS_MAX_LINE_LEN 64 |
|---|
| 30 | #define BUFFER_SIZE 4096 |
|---|
| 31 | #define MSG_STR_LEN 512 |
|---|
| 32 | |
|---|
| 33 | extern uint8_t buffer[]; |
|---|
| 34 | extern kdmsg_channel_t ksh_tty; |
|---|
| 35 | |
|---|
| 36 | typedef struct ms_argument_s |
|---|
| 37 | { |
|---|
| 38 | uint_t argc; |
|---|
| 39 | char argv[MS_MAX_ARG_LEN][MS_MAX_LINE_LEN]; |
|---|
| 40 | }ms_args_t; |
|---|
| 41 | |
|---|
| 42 | extern struct vfs_file_s *root ; |
|---|
| 43 | extern struct vfs_file_s *ms_n_cwd ; |
|---|
| 44 | extern char ms_pwd[128] ; |
|---|
| 45 | |
|---|
| 46 | void print_error_msg(error_t err) ; |
|---|
| 47 | void ksh_print(const char *fmt, ...); |
|---|
| 48 | void ksh_write(void *buff, size_t size); |
|---|
| 49 | char getChar() ; |
|---|
| 50 | void putChar(char ch) ; |
|---|
| 51 | void cmdLineAnalyser(ms_args_t *args); |
|---|
| 52 | |
|---|
| 53 | typedef error_t (ksh_cmd_t)(void*); |
|---|
| 54 | |
|---|
| 55 | /* Commands */ |
|---|
| 56 | error_t clear_func(void* param); |
|---|
| 57 | error_t rm_func(void *parm) ; |
|---|
| 58 | error_t cd_func(void *parm) ; |
|---|
| 59 | error_t ls_func(void *param) ; |
|---|
| 60 | error_t mkdir_func(void *param) ; |
|---|
| 61 | error_t cp_func(void *arg) ; |
|---|
| 62 | error_t mkfifo_func(void *param) ; |
|---|
| 63 | error_t cat_func(void *param) ; |
|---|
| 64 | error_t cat2_func(void *param) ; |
|---|
| 65 | error_t eomtkp_func(void *param) ; |
|---|
| 66 | error_t ps_func(void *param); |
|---|
| 67 | error_t show_instrumentation(void* param) ; |
|---|
| 68 | error_t exec_func(void *param); |
|---|
| 69 | error_t pwd_func(void *param); |
|---|
| 70 | error_t ksh_set_tty_func(void *param); |
|---|
| 71 | error_t ppm_func(void *param); |
|---|
| 72 | error_t ksh_cpu_state_func(void *param); |
|---|
| 73 | error_t kill_func(void *param); |
|---|
| 74 | |
|---|
| 75 | #endif |
|---|