OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [cygmon/] [current/] [misc/] [monitor.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      monitor.h
4
//
5
//      Main definitions for the CygMON ROM monitor
6
//
7
//==========================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
9
// -------------------------------------------                              
10
// This file is part of eCos, the Embedded Configurable Operating System.   
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under    
14
// the terms of the GNU General Public License as published by the Free     
15
// Software Foundation; either version 2 or (at your option) any later      
16
// version.                                                                 
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT      
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
21
// for more details.                                                        
22
//
23
// You should have received a copy of the GNU General Public License        
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
26
//
27
// As a special exception, if other files instantiate templates or use      
28
// macros or inline functions from this file, or you compile this file      
29
// and link it with other works to produce a work based on this file,       
30
// this file does not by itself cause the resulting work to be covered by   
31
// the GNU General Public License. However the source code for this file    
32
// must still be made available in accordance with section (3) of the GNU   
33
// General Public License v2.                                               
34
//
35
// This exception does not invalidate any other reasons why a work based    
36
// on this file might be covered by the GNU General Public License.         
37
// -------------------------------------------                              
38
// ####ECOSGPLCOPYRIGHTEND####                                              
39
//==========================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// Author(s):    
43
// Contributors: gthomas, dmoseley
44
// Date:         1999-10-20
45
// Purpose:      Main definitions for the CygMON ROM monitor
46
// Description:  
47
//               
48
//
49
//####DESCRIPTIONEND####
50
//
51
//=========================================================================
52
 
53
#ifndef MONITOR_H
54
#define MONITOR_H
55
 
56
#if !defined(__ASSEMBLER__)
57
#include <stdarg.h>
58
#endif
59
 
60
#include <board.h>
61
#ifdef HAVE_BSP
62
#include "cpu_info.h"
63
#endif
64
#include <monitor_cmd.h>
65
 
66
#ifdef __ECOS__
67
#include <cyg/hal/plf_stub.h>
68
#endif
69
 
70
#ifndef ASM
71
 
72
#ifdef HAVE_BSP
73
#define xprintf    bsp_dprintf
74
#define xsprintf   bsp_sprintf
75
#define xvprintf   bsp_dvprintf
76
#define xputchar   bsp_debug_putc
77
#define xgetchar   bsp_debug_getc
78
#define xungetchar bsp_debug_ungetc
79
#define __getTty() bsp_set_debug_comm(-1)
80
#define set_pc(x)  bsp_set_pc((x), mon_saved_regs)
81
 
82
#ifndef USE_ECOS_HAL_SINGLESTEP
83
#define __single_step()            bsp_singlestep_setup(mon_saved_regs)
84
#define __clear_single_step()      bsp_singlestep_cleanup(mon_saved_regs)
85
#endif /* USE_ECOS_HAL_SINGLESTEP */
86
 
87
#ifndef USE_ECOS_HAL_BREAKPOINTS
88
#define breakpoint() bsp_breakpoint()
89
#endif /* USE_ECOS_HAL_BREAKPOINTS */
90
 
91
#if defined(__ECOS__) && defined(CYGHWR_HAL_RESET_DEFINED)
92
   extern void __reset(void);
93
#else // defined(__ECOS__) && defined(CYGHWR_HAL_RESET_DEFINED)
94
#  define __reset    bsp_reset
95
#endif // defined(__ECOS__) && defined(CYGHWR_HAL_RESET_DEFINED)
96
 
97
#else
98
extern void xprintf(const char *fmt, ...);
99
extern void xsprintf(char *str, const char *fmt, ...);
100
extern void xvprintf(const char *fmt, va_list ap);
101
 
102
#ifdef HAS_USER_IO
103
#define xputchar   putUserChar
104
#define xgetchar   getUserChar
105
#else
106
extern void putDebugChar(int ch);
107
extern int  getDebugChar(void);
108
#define xputchar   putDebugChar
109
#define xgetchar   getDebugChar
110
#endif
111
#define xungetchar ungetDebugChar
112
#endif
113
 
114
 
115
#ifndef USE_ECOS_HAL_BREAKPOINTS
116
struct bp {
117
  mem_addr_t address;
118
  bp_inst_t  old_inst;
119
  char       in_memory;
120
  struct bp  *next;
121
};
122
#endif // USE_ECOS_HAL_BREAKPOINTS
123
 
124
struct regstruct
125
{
126
  char *registername;
127
  int  registernumber;
128
#ifdef HAVE_BSP
129
#if defined(CYGPKG_HAL_ARM) || !defined(__ECOS__)
130
  int  registertype;
131
#endif // defined(CYGPKG_HAL_ARM) || !defined(__ECOS__)
132
#endif
133
#ifdef REG_VALID_FIELD_IN_REGSTRUCT
134
  int registervalid;
135
#endif
136
};
137
 
138
 
139
 
140
#ifdef HAVE_BSP
141
#define REGTYPE_INT    1
142
#define REGTYPE_FLOAT  2
143
#define REGTYPE_DOUBLE 3
144
 
145
union target_reg
146
{
147
    unsigned long  i;   /* integer register (32/64 bit) */
148
#if HAVE_FLOAT_REGS
149
    float          f;   /* float register (32bit)       */
150
#endif
151
#if HAVE_DOUBLE_REGS
152
    double         d;   /* double register (64bit)      */
153
#endif
154
};
155
 
156
typedef union target_reg target_regval_t;
157
 
158
 
159
/* This is a template for what should be defined in  the board specific
160
   header file composed, board.h */
161
#if ! defined(MEM_ADDR_DEFINED)
162
#define MEM_ADDR_DEFINED 1
163
typedef struct mem_addr {
164
  unsigned long addr;
165
} mem_addr_t;
166
#endif
167
 
168
#if !defined(BP_INST_T_DEFINED)
169
#define BP_INST_T_DEFINED 1
170
typedef unsigned char bp_inst_t ;
171
#endif
172
 
173
#if ! defined(MAKE_STD_ADDR)
174
#define MAKE_STD_ADDR(SRC, DST) ((DST)->addr = (SRC))
175
#endif
176
 
177
 
178
#if ! defined(ADD_OFFSET)
179
#define ADD_OFFSET(SRC,DST,OFFSET) ((DST)->addr = (SRC)->addr + (OFFSET))
180
#endif
181
 
182
#if ! defined(ADD_ALIGN)
183
#define ADD_ALIGN(SRC,DST,ALIGN) \
184
              ((DST)->addr = (SRC)->addr - ((SRC)->addr % (ALIGN)))
185
#endif
186
 
187
#if ! defined(MEM_ADDR_EQ_P)
188
#define MEM_ADDR_EQ_P(A, B) ((A).addr == (B).addr)     
189
#endif
190
 
191
#if ! defined(MEM_ADDR_DIFF)
192
#define MEM_ADDR_DIFF(A, B) ((A).addr - (B).addr)
193
#endif
194
 
195
#if ! defined(MEM_ADDR_ASI)
196
#define MEM_ADDR_ASI(A) -1
197
#endif
198
 
199
#endif  /* HAVE_BSP */
200
 
201
#if defined(NO_MALLOC) && ! defined(MAX_NUM_BP)
202
#define MAX_NUM_BP 64
203
#endif
204
 
205
extern struct regstruct regtab[];
206
 
207
extern char **argvect;
208
 
209
#ifdef HAVE_BSP
210
#define VERSION "release 2.0"
211
#else
212
#define VERSION "release 1.2"
213
#endif
214
 
215
#define MAXLINELEN 80
216
#define PROMPT "cygmon> "
217
#if ! defined MAX_HIST_ENTS
218
#define MAX_HIST_ENTS 10
219
#endif
220
 
221
/*
222
 * From monitor.c
223
 */
224
extern mem_addr_t last_pc;
225
extern int        stub_is_active;
226
#ifdef HAVE_BSP
227
extern void *mon_saved_regs;
228
#else
229
extern int (*user_signal_handler)(int);
230
#endif
231
 
232
extern void clear_user_state (void);
233
extern int  transfer_to_stub (void);
234
extern void version (void);
235
#ifdef MONITOR_CONTROL_INTERRUPTS
236
/* Enable interrupts within the monitor. */
237
extern void monitor_enable_interrupts (void);
238
 
239
/* Disable interrupts within the monitor. */
240
extern void monitor_disable_interrupts (void);
241
 
242
/* Returns 1 if interrupts have been enabled within the monitor, 0
243
   otherwise. */
244
extern int monitor_interrupt_state (void);
245
#endif /* MONITOR_CONTROL_INTERRUPTS */
246
 
247
 
248
/*
249
 * From utils.c
250
 */
251
extern int switch_to_stub_flag;
252
extern int input_char (void);
253
extern target_register_t str2int (char *str, int base);
254
#if HAVE_DOUBLE_REGS
255
extern double str2double (char *str, int base);
256
#endif
257
extern target_register_t str2intlen (char *str, int base, int len);
258
extern int hex2bytes(char *string, char *dest, int maxsize);
259
extern char *int2str (target_register_t number, int base, int numdigs);
260
#ifndef NO_MALLOC
261
extern char *strdup(const char *str);
262
#endif
263
extern target_register_t get_pc(void);
264
extern char *get_register_str (regnames_t which, int detail, int valid);
265
extern void store_register (regnames_t which, char *string);
266
 
267
#ifndef USE_ECOS_HAL_BREAKPOINTS
268
/*
269
 * From breakpoints.c
270
 */
271
extern int add_mon_breakpoint (mem_addr_t location);
272
extern void install_breakpoints (void);
273
extern void clear_breakpoints (void);
274
extern int  show_breakpoints (void);
275
extern int clear_mon_breakpoint (mem_addr_t location);
276
#endif /* USE_ECOS_HAL_BREAKPOINTS */
277
 
278
 
279
/*
280
 * From do-dis.c
281
 */
282
extern mem_addr_t do_dis (mem_addr_t *addr);
283
extern void flush_dis (void);
284
 
285
 
286
/*
287
 * From architecture-mon.c
288
 */
289
#ifdef HAVE_BSP
290
extern void initialize_mon(void);
291
extern target_register_t get_register(regnames_t reg);
292
extern void put_register (regnames_t which, target_register_t value);
293
#endif
294
 
295
 
296
/* Lame. */
297
#ifndef ITIMER_REAL
298
#define ITIMER_REAL 0
299
#endif
300
 
301
#endif /* ASM */
302
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.