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