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