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 | |
---|
32 | typedef struct { |
---|
33 | uint32_t baudrate; /* debug baud rate, e.g. 57600 */ |
---|
34 | void (*callout)(void); /* callout pointer during polling */ |
---|
35 | int (*open_io)(const char *dev_name, uint32_t baudrate); /* I/O open fnc */ |
---|
36 | const char *devname; /* debug device, e.g. "/dev/tty01" */ |
---|
37 | bool skip_init_bkpt; /* if TRUE, do not stop when initializing */ |
---|
38 | } serdbg_conf_t; |
---|
39 | |
---|
40 | /* |
---|
41 | * must be defined in init module... |
---|
42 | */ |
---|
43 | extern serdbg_conf_t serdbg_conf; |
---|
44 | |
---|
45 | |
---|
46 | /*=========================================================================*\ |
---|
47 | | Function: | |
---|
48 | \*-------------------------------------------------------------------------*/ |
---|
49 | void putDebugChar |
---|
50 | ( |
---|
51 | /*-------------------------------------------------------------------------*\ |
---|
52 | | Purpose: | |
---|
53 | | send character to remote debugger | |
---|
54 | +---------------------------------------------------------------------------+ |
---|
55 | | Input Parameters: | |
---|
56 | \*-------------------------------------------------------------------------*/ |
---|
57 | char c /* char to send */ |
---|
58 | ); |
---|
59 | /*-------------------------------------------------------------------------*\ |
---|
60 | | Return Value: | |
---|
61 | | <none> | |
---|
62 | \*=========================================================================*/ |
---|
63 | |
---|
64 | /*=========================================================================*\ |
---|
65 | | Function: | |
---|
66 | \*-------------------------------------------------------------------------*/ |
---|
67 | int getDebugChar |
---|
68 | ( |
---|
69 | /*-------------------------------------------------------------------------*\ |
---|
70 | | Purpose: | |
---|
71 | | get character from remote debugger | |
---|
72 | +---------------------------------------------------------------------------+ |
---|
73 | | Input Parameters: | |
---|
74 | \*-------------------------------------------------------------------------*/ |
---|
75 | void /* <none> */ |
---|
76 | ); |
---|
77 | /*-------------------------------------------------------------------------*\ |
---|
78 | | Return Value: | |
---|
79 | | <none> | |
---|
80 | \*=========================================================================*/ |
---|
81 | |
---|
82 | /*=========================================================================*\ |
---|
83 | | Function: | |
---|
84 | \*-------------------------------------------------------------------------*/ |
---|
85 | void serdbg_exceptionHandler |
---|
86 | ( |
---|
87 | /*-------------------------------------------------------------------------*\ |
---|
88 | | Purpose: | |
---|
89 | | hook directly to an exception vector | |
---|
90 | +---------------------------------------------------------------------------+ |
---|
91 | | Input Parameters: | |
---|
92 | \*-------------------------------------------------------------------------*/ |
---|
93 | int vecnum, /* vector index to hook at */ |
---|
94 | void *vector /* address of handler function */ |
---|
95 | ); |
---|
96 | /*-------------------------------------------------------------------------*\ |
---|
97 | | Return Value: | |
---|
98 | | <none> | |
---|
99 | \*=========================================================================*/ |
---|
100 | |
---|
101 | /*=========================================================================*\ |
---|
102 | | Function: | |
---|
103 | \*-------------------------------------------------------------------------*/ |
---|
104 | int serdbg_init |
---|
105 | ( |
---|
106 | /*-------------------------------------------------------------------------*\ |
---|
107 | | Purpose: | |
---|
108 | | initialize remote gdb session over serial line | |
---|
109 | +---------------------------------------------------------------------------+ |
---|
110 | | Input Parameters: | |
---|
111 | \*-------------------------------------------------------------------------*/ |
---|
112 | void |
---|
113 | ); |
---|
114 | /*-------------------------------------------------------------------------*\ |
---|
115 | | Return Value: | |
---|
116 | | rtems_status_code | |
---|
117 | \*=========================================================================*/ |
---|
118 | |
---|
119 | /* |
---|
120 | * stuff from serdbgio.c |
---|
121 | */ |
---|
122 | /*=========================================================================*\ |
---|
123 | | Function: | |
---|
124 | \*-------------------------------------------------------------------------*/ |
---|
125 | int serdbg_open |
---|
126 | |
---|
127 | /*-------------------------------------------------------------------------*\ |
---|
128 | | Purpose: | |
---|
129 | | try to open given serial debug port | |
---|
130 | +---------------------------------------------------------------------------+ |
---|
131 | | Input Parameters: | |
---|
132 | \*-------------------------------------------------------------------------*/ |
---|
133 | ( |
---|
134 | const char *dev_name, /* name of device to open */ |
---|
135 | uint32_t baudrate /* baud rate to use */ |
---|
136 | ); |
---|
137 | /*-------------------------------------------------------------------------*\ |
---|
138 | | Return Value: | |
---|
139 | | 0 on success, -1 and errno otherwise | |
---|
140 | \*=========================================================================*/ |
---|
141 | |
---|
142 | /*=========================================================================*\ |
---|
143 | | Function: | |
---|
144 | \*-------------------------------------------------------------------------*/ |
---|
145 | void putDebugChar |
---|
146 | /*-------------------------------------------------------------------------*\ |
---|
147 | | Purpose: | |
---|
148 | | send one character to serial port | |
---|
149 | +---------------------------------------------------------------------------+ |
---|
150 | | Input Parameters: | |
---|
151 | \*-------------------------------------------------------------------------*/ |
---|
152 | ( |
---|
153 | char c /* character to print */ |
---|
154 | ); |
---|
155 | /*-------------------------------------------------------------------------*\ |
---|
156 | | Return Value: | |
---|
157 | | <none> | |
---|
158 | \*=========================================================================*/ |
---|
159 | |
---|
160 | /*=========================================================================*\ |
---|
161 | | Function: | |
---|
162 | \*-------------------------------------------------------------------------*/ |
---|
163 | int getDebugChar |
---|
164 | /*-------------------------------------------------------------------------*\ |
---|
165 | | Purpose: | |
---|
166 | | wait for one character from serial port | |
---|
167 | +---------------------------------------------------------------------------+ |
---|
168 | | Input Parameters: | |
---|
169 | \*-------------------------------------------------------------------------*/ |
---|
170 | ( |
---|
171 | void /* none */ |
---|
172 | ); |
---|
173 | /*-------------------------------------------------------------------------*\ |
---|
174 | | Return Value: | |
---|
175 | | received character | |
---|
176 | \*=========================================================================*/ |
---|
177 | |
---|
178 | /* |
---|
179 | * Assumed to be provided by the BSP |
---|
180 | */ |
---|
181 | extern void set_debug_traps(void); |
---|
182 | extern void breakpoint(void); |
---|
183 | #ifdef __cplusplus |
---|
184 | } |
---|
185 | #endif |
---|
186 | |
---|
187 | #endif /* _SERDBG_H */ |
---|