-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconsole.h
47 lines (35 loc) · 1.04 KB
/
console.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef CONSOLE_H
#define CONSOLE_H
#define ESC_SPACE 300000
#define ESC_COUNT 3
struct console_cmd {
const char *name;
const char *help;
int required_args;
int maximum_args;
int (*handler)(int argc, char ** argv);
char ** (*get_completion) (int argc, const char * const * argv );
void (*interrupt)(void);
} ;
#define CONSOLE_CMD(_name, _reqargs, _maxargs, _handler, _inthandler, _completion, _help) \
const struct console_cmd cmd_ ##_name \
__attribute__ ((used)) \
__attribute__((section(".console_cmd"))) = { \
.name = #_name, \
.required_args = _reqargs, \
.maximum_args = _maxargs, \
.handler = _handler, \
.interrupt = _inthandler, \
.get_completion = _completion, \
.help = _help, \
}
#include <stdarg.h>
int console_printf (const char *fmt, ...);
#define HELPSTR_NEWLINE "\n "
void console_init(void);
void console_insert(char c);
void console_lock(int l);
void console_write(char *buf, int len);
void console_exec(char *str);
void enable_passthrough(int v);
#endif