1 | /* |
---|
2 | * $Id$ |
---|
3 | */ |
---|
4 | |
---|
5 | #ifndef __SHELL_H__ |
---|
6 | #define __SHELL_H__ |
---|
7 | |
---|
8 | #ifdef __cplusplus |
---|
9 | extern "C" { |
---|
10 | #endif |
---|
11 | |
---|
12 | #include <rtems.h> |
---|
13 | #include <stdio.h> |
---|
14 | #include <termios.h> |
---|
15 | |
---|
16 | typedef int (*shell_command_t)(int argc,char * argv[]); |
---|
17 | |
---|
18 | struct shell_cmd_tt ; |
---|
19 | typedef struct shell_cmd_tt shell_cmd_t; |
---|
20 | |
---|
21 | struct shell_cmd_tt { |
---|
22 | char * name; |
---|
23 | char * usage; |
---|
24 | char * topic; |
---|
25 | shell_command_t command; |
---|
26 | shell_cmd_t * alias; |
---|
27 | shell_cmd_t * next; |
---|
28 | }; |
---|
29 | |
---|
30 | rtems_unsigned32 new_rtems_name(char * rtems_name); |
---|
31 | shell_cmd_t * shell_lookup_cmd(char * cmd); |
---|
32 | shell_cmd_t * shell_add_cmd(char * cmd, |
---|
33 | char * topic, |
---|
34 | char * usage, |
---|
35 | shell_command_t command); |
---|
36 | shell_cmd_t * shell_alias_cmd(char * cmd, char * alias); |
---|
37 | |
---|
38 | int shell_make_args(char * cmd, |
---|
39 | int * pargc, |
---|
40 | char * argv[]); |
---|
41 | |
---|
42 | typedef struct { |
---|
43 | rtems_name magic; /* 'S','E','N','V': Shell Environment */ |
---|
44 | char * devname; |
---|
45 | char * taskname; |
---|
46 | tcflag_t tcflag; |
---|
47 | /* user extensions */ |
---|
48 | int exit_shell; /* logout */ |
---|
49 | int forever ; /* repeat login */ |
---|
50 | int errorlevel; |
---|
51 | int mdump_adr; |
---|
52 | } shell_env_t; |
---|
53 | |
---|
54 | int shell_scanline(char * line,int size,FILE * in,FILE * out) ; |
---|
55 | void cat_file(FILE * out,char *name); |
---|
56 | |
---|
57 | rtems_status_code shell_init(char * task_name , |
---|
58 | rtems_unsigned32 task_stacksize,/*0 default*/ |
---|
59 | rtems_task_priority task_priority , |
---|
60 | char * devname , |
---|
61 | tcflag_t tcflag , |
---|
62 | int forever ); |
---|
63 | |
---|
64 | extern shell_env_t global_shell_env, |
---|
65 | * current_shell_env; |
---|
66 | /*--------*/ |
---|
67 | /* pty.c */ |
---|
68 | /*--------*/ |
---|
69 | |
---|
70 | char * get_pty(int socket); |
---|
71 | |
---|
72 | |
---|
73 | rtems_device_driver pty_initialize( |
---|
74 | rtems_device_major_number major, |
---|
75 | rtems_device_minor_number minor, |
---|
76 | void *arg); |
---|
77 | rtems_device_driver pty_open( |
---|
78 | rtems_device_major_number major, |
---|
79 | rtems_device_minor_number minor, |
---|
80 | void * arg); |
---|
81 | rtems_device_driver pty_close( |
---|
82 | rtems_device_major_number major, |
---|
83 | rtems_device_minor_number minor, |
---|
84 | void * arg); |
---|
85 | rtems_device_driver pty_read( |
---|
86 | rtems_device_major_number major, |
---|
87 | rtems_device_minor_number minor, |
---|
88 | void * arg); |
---|
89 | rtems_device_driver pty_write( |
---|
90 | rtems_device_major_number major, |
---|
91 | rtems_device_minor_number minor, |
---|
92 | void * arg); |
---|
93 | rtems_device_driver pty_control( |
---|
94 | rtems_device_major_number major, |
---|
95 | rtems_device_minor_number minor, |
---|
96 | void * arg); |
---|
97 | |
---|
98 | |
---|
99 | #define PTY_DRIVER_TABLE_ENTRY \ |
---|
100 | { pty_initialize , pty_open , pty_close , \ |
---|
101 | pty_read , pty_write , pty_control } |
---|
102 | /*--------*/ |
---|
103 | /* cmds.c */ |
---|
104 | /*--------*/ |
---|
105 | int str2int(char * s); |
---|
106 | void register_cmds(void); |
---|
107 | |
---|
108 | #ifdef __cplusplus |
---|
109 | } |
---|
110 | #endif |
---|
111 | |
---|
112 | #endif |
---|