1 | /* |
2 | * JzBoot: an USB bootloader for JZ series of Ingenic(R) microprocessors. |
3 | * Copyright (C) 2010 Sergey Gridassov <grindars@gmail.com> |
4 | * |
5 | * This program is free software: you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation, either version 3 of the License, or |
8 | * (at your option) any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ |
18 | |
19 | #ifndef __SHELL__H__ |
20 | #define __SHELL__H__ |
21 | |
22 | #ifndef SHELL_INTERNALS |
23 | typedef void shell_context_t; |
24 | #endif |
25 | |
26 | typedef struct shell_command { |
27 | const char *cmd; |
28 | const char *description; |
29 | int (*handler)(shell_context_t *ctx, int argc, char *argv[]); |
30 | const char *args; |
31 | } shell_command_t; |
32 | |
33 | shell_context_t *shell_init(void *ingenic); |
34 | void shell_fini(shell_context_t *context); |
35 | |
36 | void shell_interactive(shell_context_t *ctx); |
37 | int shell_source(shell_context_t *ctx, const char *filename); |
38 | int shell_execute(shell_context_t *ctx, const char *input); |
39 | void *shell_device(shell_context_t *ctx); |
40 | int shell_run(shell_context_t *ctx, int argc, char *argv[]); |
41 | |
42 | void shell_exit(shell_context_t *ctx, int val); |
43 | int shell_enumerate_commands(shell_context_t *ctx, int (*callback)(shell_context_t *ctx, const shell_command_t *cmd, void *arg), void *arg); |
44 | |
45 | extern const shell_command_t spl_cmdset[]; |
46 | extern const shell_command_t usbboot_cmdset[]; |
47 | extern const shell_command_t builtin_cmdset[]; |
48 | |
49 | #endif |
50 | |