1 | /*===============================================================*\ |
---|
2 | | Project: RTEMS remote gdb over serial line | |
---|
3 | +-----------------------------------------------------------------+ |
---|
4 | | File: serdbg.h | |
---|
5 | +-----------------------------------------------------------------+ |
---|
6 | | Copyright (c) 2002 IMD | |
---|
7 | | Ingenieurbuero fuer Microcomputertechnik Th. Doerfler | |
---|
8 | | <Thomas.Doerfler@imd-systems.de> | |
---|
9 | | all rights reserved | |
---|
10 | +-----------------------------------------------------------------+ |
---|
11 | | this file declares intialization functions to add | |
---|
12 | | a gdb remote debug stub to an RTEMS system | |
---|
13 | | | |
---|
14 | +-----------------------------------------------------------------+ |
---|
15 | | date history ID | |
---|
16 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
---|
17 | | 04.04.02 creation doe | |
---|
18 | \*===============================================================*/ |
---|
19 | /* |
---|
20 | * $Id$ |
---|
21 | */ |
---|
22 | #ifndef _SERDBG_H |
---|
23 | #define _SERDBG_H |
---|
24 | |
---|
25 | #include <rtems.h> |
---|
26 | #include <termios.h> |
---|
27 | |
---|
28 | #ifdef __cplusplus |
---|
29 | extern "C" { |
---|
30 | #endif |
---|
31 | typedef struct { |
---|
32 | uint32_t baudrate; /* debug baud rate, e.g. 57600 */ |
---|
33 | void (*callout)(void); /* callout pointer during polling */ |
---|
34 | int (*open_io)(const char *dev_name,uint32_t baudrate); /* I/O open fnc */ |
---|
35 | const char *devname; /* debug device, e.g. "/dev/tty01" */ |
---|
36 | uint8_t skip_init_bkpt; /* if TRUE, do not stop when initializing */ |
---|
37 | } serdbg_conf_t; |
---|
38 | |
---|
39 | /* |
---|
40 | * must be defined in init module... |
---|
41 | */ |
---|
42 | extern serdbg_conf_t serdbg_conf; |
---|
43 | |
---|
44 | |
---|
45 | /*=========================================================================*\ |
---|
46 | | Function: | |
---|
47 | \*-------------------------------------------------------------------------*/ |
---|
48 | void putDebugChar |
---|
49 | ( |
---|
50 | /*-------------------------------------------------------------------------*\ |
---|
51 | | Purpose: | |
---|
52 | | send character to remote debugger | |
---|
53 | +---------------------------------------------------------------------------+ |
---|
54 | | Input Parameters: | |
---|
55 | \*-------------------------------------------------------------------------*/ |
---|
56 | char c /* char to send */ |
---|
57 | ); |
---|
58 | /*-------------------------------------------------------------------------*\ |
---|
59 | | Return Value: | |
---|
60 | | <none> | |
---|
61 | \*=========================================================================*/ |
---|
62 | |
---|
63 | /*=========================================================================*\ |
---|
64 | | Function: | |
---|
65 | \*-------------------------------------------------------------------------*/ |
---|
66 | int getDebugChar |
---|
67 | ( |
---|
68 | /*-------------------------------------------------------------------------*\ |
---|
69 | | Purpose: | |
---|
70 | | get character from remote debugger | |
---|
71 | +---------------------------------------------------------------------------+ |
---|
72 | | Input Parameters: | |
---|
73 | \*-------------------------------------------------------------------------*/ |
---|
74 | void /* <none> */ |
---|
75 | ); |
---|
76 | /*-------------------------------------------------------------------------*\ |
---|
77 | | Return Value: | |
---|
78 | | <none> | |
---|
79 | \*=========================================================================*/ |
---|
80 | |
---|
81 | /*=========================================================================*\ |
---|
82 | | Function: | |
---|
83 | \*-------------------------------------------------------------------------*/ |
---|
84 | void serdbg_exceptionHandler |
---|
85 | ( |
---|
86 | /*-------------------------------------------------------------------------*\ |
---|
87 | | Purpose: | |
---|
88 | | hook directly to an exception vector | |
---|
89 | +---------------------------------------------------------------------------+ |
---|
90 | | Input Parameters: | |
---|
91 | \*-------------------------------------------------------------------------*/ |
---|
92 | int vecnum, /* vector index to hook at */ |
---|
93 | void *vector /* address of handler function */ |
---|
94 | ); |
---|
95 | /*-------------------------------------------------------------------------*\ |
---|
96 | | Return Value: | |
---|
97 | | <none> | |
---|
98 | \*=========================================================================*/ |
---|
99 | |
---|
100 | /*=========================================================================*\ |
---|
101 | | Function: | |
---|
102 | \*-------------------------------------------------------------------------*/ |
---|
103 | int serdbg_init |
---|
104 | ( |
---|
105 | /*-------------------------------------------------------------------------*\ |
---|
106 | | Purpose: | |
---|
107 | | initialize remote gdb session over serial line | |
---|
108 | +---------------------------------------------------------------------------+ |
---|
109 | | Input Parameters: | |
---|
110 | \*-------------------------------------------------------------------------*/ |
---|
111 | void |
---|
112 | ); |
---|
113 | /*-------------------------------------------------------------------------*\ |
---|
114 | | Return Value: | |
---|
115 | | rtems_status_code | |
---|
116 | \*=========================================================================*/ |
---|
117 | |
---|
118 | /* |
---|
119 | * stuff from serdbgio.c |
---|
120 | */ |
---|
121 | /*=========================================================================*\ |
---|
122 | | Function: | |
---|
123 | \*-------------------------------------------------------------------------*/ |
---|
124 | int serdbg_open |
---|
125 | |
---|
126 | /*-------------------------------------------------------------------------*\ |
---|
127 | | Purpose: | |
---|
128 | | try to open given serial debug port | |
---|
129 | +---------------------------------------------------------------------------+ |
---|
130 | | Input Parameters: | |
---|
131 | \*-------------------------------------------------------------------------*/ |
---|
132 | ( |
---|
133 | const char *dev_name, /* name of device to open */ |
---|
134 | uint32_t baudrate /* baud rate to use */ |
---|
135 | ); |
---|
136 | /*-------------------------------------------------------------------------*\ |
---|
137 | | Return Value: | |
---|
138 | | 0 on success, -1 and errno otherwise | |
---|
139 | \*=========================================================================*/ |
---|
140 | |
---|
141 | /*=========================================================================*\ |
---|
142 | | Function: | |
---|
143 | \*-------------------------------------------------------------------------*/ |
---|
144 | void putDebugChar |
---|
145 | /*-------------------------------------------------------------------------*\ |
---|
146 | | Purpose: | |
---|
147 | | send one character to serial port | |
---|
148 | +---------------------------------------------------------------------------+ |
---|
149 | | Input Parameters: | |
---|
150 | \*-------------------------------------------------------------------------*/ |
---|
151 | ( |
---|
152 | char c /* character to print */ |
---|
153 | ); |
---|
154 | /*-------------------------------------------------------------------------*\ |
---|
155 | | Return Value: | |
---|
156 | | <none> | |
---|
157 | \*=========================================================================*/ |
---|
158 | |
---|
159 | /*=========================================================================*\ |
---|
160 | | Function: | |
---|
161 | \*-------------------------------------------------------------------------*/ |
---|
162 | int getDebugChar |
---|
163 | /*-------------------------------------------------------------------------*\ |
---|
164 | | Purpose: | |
---|
165 | | wait for one character from serial port | |
---|
166 | +---------------------------------------------------------------------------+ |
---|
167 | | Input Parameters: | |
---|
168 | \*-------------------------------------------------------------------------*/ |
---|
169 | ( |
---|
170 | void /* none */ |
---|
171 | ); |
---|
172 | /*-------------------------------------------------------------------------*\ |
---|
173 | | Return Value: | |
---|
174 | | received character | |
---|
175 | \*=========================================================================*/ |
---|
176 | |
---|
177 | #ifdef __cplusplus |
---|
178 | } |
---|
179 | #endif |
---|
180 | |
---|
181 | #endif /* _SERDBG_H */ |
---|