Mercurial > ecos
comparison packages/cygmon/current/misc/monitor.h @ 76:435cced73e2f ecos-v1_3_1-release
eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
| author | jlarmour |
|---|---|
| date | Tue, 28 Mar 2000 14:10:45 +0000 |
| parents | |
| children | 02ea4320376c |
comparison
equal
deleted
inserted
replaced
| 75:41bf073c0c32 | 76:435cced73e2f |
|---|---|
| 1 //========================================================================== | |
| 2 // | |
| 3 // monitor.h | |
| 4 // | |
| 5 // Main definitions for the CygMON ROM monitor | |
| 6 // | |
| 7 //========================================================================== | |
| 8 //####COPYRIGHTBEGIN#### | |
| 9 // | |
| 10 // ------------------------------------------- | |
| 11 // The contents of this file are subject to the Red Hat eCos Public License | |
| 12 // Version 1.1 (the "License"); you may not use this file except in | |
| 13 // compliance with the License. You may obtain a copy of the License at | |
| 14 // http://www.redhat.com/ | |
| 15 // | |
| 16 // Software distributed under the License is distributed on an "AS IS" | |
| 17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 18 // License for the specific language governing rights and limitations under | |
| 19 // the License. | |
| 20 // | |
| 21 // The Original Code is eCos - Embedded Configurable Operating System, | |
| 22 // released September 30, 1998. | |
| 23 // | |
| 24 // The Initial Developer of the Original Code is Red Hat. | |
| 25 // Portions created by Red Hat are | |
| 26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. | |
| 27 // All Rights Reserved. | |
| 28 // ------------------------------------------- | |
| 29 // | |
| 30 //####COPYRIGHTEND#### | |
| 31 //========================================================================== | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 34 // Author(s): | |
| 35 // Contributors: gthomas | |
| 36 // Date: 1999-10-20 | |
| 37 // Purpose: Main definitions for the CygMON ROM monitor | |
| 38 // Description: | |
| 39 // | |
| 40 // | |
| 41 //####DESCRIPTIONEND#### | |
| 42 // | |
| 43 //========================================================================= | |
| 44 | |
| 45 #ifndef MONITOR_H | |
| 46 #define MONITOR_H | |
| 47 | |
| 48 #if !defined(__ASSEMBLER__) | |
| 49 #include <stdarg.h> | |
| 50 #endif | |
| 51 | |
| 52 #include <board.h> | |
| 53 #ifdef HAVE_BSP | |
| 54 #include "cpu_info.h" | |
| 55 #endif | |
| 56 #include <monitor_cmd.h> | |
| 57 | |
| 58 #ifndef ASM | |
| 59 | |
| 60 #ifdef HAVE_BSP | |
| 61 #define xprintf bsp_dprintf | |
| 62 #define xsprintf bsp_sprintf | |
| 63 #define xvprintf bsp_vprintf | |
| 64 #define xputchar bsp_debug_putc | |
| 65 #define xgetchar bsp_debug_getc | |
| 66 #define xungetchar bsp_debug_ungetc | |
| 67 #define __getTty() bsp_set_debug_comm(-1) | |
| 68 #define set_pc(x) bsp_set_pc((x), mon_saved_regs) | |
| 69 #define __single_step() bsp_singlestep_setup(mon_saved_regs) | |
| 70 #define __reset bsp_reset | |
| 71 #define breakpoint() bsp_breakpoint() | |
| 72 #else | |
| 73 extern void xprintf(const char *fmt, ...); | |
| 74 extern void xsprintf(char *str, const char *fmt, ...); | |
| 75 extern void xvprintf(const char *fmt, va_list ap); | |
| 76 | |
| 77 #ifdef HAS_USER_IO | |
| 78 #define xputchar putUserChar | |
| 79 #define xgetchar getUserChar | |
| 80 #else | |
| 81 extern void putDebugChar(int ch); | |
| 82 extern int getDebugChar(void); | |
| 83 #define xputchar putDebugChar | |
| 84 #define xgetchar getDebugChar | |
| 85 #endif | |
| 86 #define xungetchar ungetDebugChar | |
| 87 #endif | |
| 88 | |
| 89 | |
| 90 struct bp { | |
| 91 mem_addr_t address; | |
| 92 bp_inst_t old_inst; | |
| 93 char in_memory; | |
| 94 struct bp *next; | |
| 95 }; | |
| 96 | |
| 97 struct regstruct | |
| 98 { | |
| 99 char *registername; | |
| 100 int registernumber; | |
| 101 #ifdef HAVE_BSP | |
| 102 int registertype; | |
| 103 #endif | |
| 104 }; | |
| 105 | |
| 106 | |
| 107 | |
| 108 #ifdef HAVE_BSP | |
| 109 #define REGTYPE_INT 1 | |
| 110 #define REGTYPE_FLOAT 2 | |
| 111 #define REGTYPE_DOUBLE 3 | |
| 112 | |
| 113 union target_reg | |
| 114 { | |
| 115 unsigned long i; /* integer register (32/64 bit) */ | |
| 116 #if HAVE_FLOAT_REGS | |
| 117 float f; /* float register (32bit) */ | |
| 118 #endif | |
| 119 #if HAVE_DOUBLE_REGS | |
| 120 double d; /* double register (64bit) */ | |
| 121 #endif | |
| 122 }; | |
| 123 | |
| 124 typedef union target_reg target_regval_t; | |
| 125 | |
| 126 | |
| 127 /* This is a template for what should be defined in the board specific | |
| 128 header file composed, board.h */ | |
| 129 #if ! defined(MEM_ADDR_DEFINED) | |
| 130 #define MEM_ADDR_DEFINED 1 | |
| 131 typedef struct mem_addr { | |
| 132 unsigned long addr; | |
| 133 } mem_addr_t; | |
| 134 #endif | |
| 135 | |
| 136 #if !defined(BP_INST_T_DEFINED) | |
| 137 #define BP_INST_T_DEFINED 1 | |
| 138 typedef unsigned char bp_inst_t ; | |
| 139 #endif | |
| 140 | |
| 141 #if ! defined(MAKE_STD_ADDR) | |
| 142 #define MAKE_STD_ADDR(SRC, DST) ((DST)->addr = (SRC)) | |
| 143 #endif | |
| 144 | |
| 145 | |
| 146 #if ! defined(ADD_OFFSET) | |
| 147 #define ADD_OFFSET(SRC,DST,OFFSET) ((DST)->addr = (SRC)->addr + (OFFSET)) | |
| 148 #endif | |
| 149 | |
| 150 #if ! defined(ADD_ALIGN) | |
| 151 #define ADD_ALIGN(SRC,DST,ALIGN) \ | |
| 152 ((DST)->addr = (SRC)->addr - ((SRC)->addr % (ALIGN))) | |
| 153 #endif | |
| 154 | |
| 155 #if ! defined(MEM_ADDR_EQ_P) | |
| 156 #define MEM_ADDR_EQ_P(A, B) ((A).addr == (B).addr) | |
| 157 #endif | |
| 158 | |
| 159 #if ! defined(MEM_ADDR_DIFF) | |
| 160 #define MEM_ADDR_DIFF(A, B) ((A).addr - (B).addr) | |
| 161 #endif | |
| 162 | |
| 163 #if ! defined(MEM_ADDR_ASI) | |
| 164 #define MEM_ADDR_ASI(A) -1 | |
| 165 #endif | |
| 166 | |
| 167 #endif /* HAVE_BSP */ | |
| 168 | |
| 169 #if defined(NO_MALLOC) && ! defined(MAX_NUM_BP) | |
| 170 #define MAX_NUM_BP 64 | |
| 171 #endif | |
| 172 | |
| 173 extern struct regstruct regtab[]; | |
| 174 | |
| 175 extern char **argvect; | |
| 176 | |
| 177 #ifdef HAVE_BSP | |
| 178 #define VERSION "release 2.0" | |
| 179 #else | |
| 180 #define VERSION "release 1.2" | |
| 181 #endif | |
| 182 | |
| 183 #define MAXLINELEN 80 | |
| 184 #define PROMPT "cygmon> " | |
| 185 #if ! defined MAX_HIST_ENTS | |
| 186 #define MAX_HIST_ENTS 10 | |
| 187 #endif | |
| 188 | |
| 189 /* | |
| 190 * From monitor.c | |
| 191 */ | |
| 192 extern mem_addr_t last_pc; | |
| 193 extern int stub_is_active; | |
| 194 #ifdef HAVE_BSP | |
| 195 extern void *mon_saved_regs; | |
| 196 #else | |
| 197 extern int (*user_signal_handler)(int); | |
| 198 #endif | |
| 199 | |
| 200 extern void clear_user_state (void); | |
| 201 extern int transfer_to_stub (void); | |
| 202 extern void version (void); | |
| 203 #ifdef MONITOR_CONTROL_INTERRUPTS | |
| 204 /* Enable interrupts within the monitor. */ | |
| 205 extern void monitor_enable_interrupts (void); | |
| 206 | |
| 207 /* Disable interrupts within the monitor. */ | |
| 208 extern void monitor_disable_interrupts (void); | |
| 209 | |
| 210 /* Returns 1 if interrupts have been enabled within the monitor, 0 | |
| 211 otherwise. */ | |
| 212 extern int monitor_interrupt_state (void); | |
| 213 #endif /* MONITOR_CONTROL_INTERRUPTS */ | |
| 214 | |
| 215 | |
| 216 /* | |
| 217 * From utils.c | |
| 218 */ | |
| 219 extern int switch_to_stub_flag; | |
| 220 extern int input_char (void); | |
| 221 extern target_register_t str2int (char *str, int base); | |
| 222 #if HAVE_DOUBLE_REGS | |
| 223 extern double str2double (char *str, int base); | |
| 224 #endif | |
| 225 extern target_register_t str2intlen (char *str, int base, int len); | |
| 226 extern int hex2bytes(char *string, char *dest, int maxsize); | |
| 227 extern char *int2str (target_register_t number, int base, int numdigs); | |
| 228 #ifndef NO_MALLOC | |
| 229 extern char *strdup(const char *str); | |
| 230 #endif | |
| 231 extern target_register_t get_pc(void); | |
| 232 extern char *get_register_str (regnames_t which, int detail); | |
| 233 extern void store_register (regnames_t which, char *string); | |
| 234 | |
| 235 /* | |
| 236 * From breakpoints.c | |
| 237 */ | |
| 238 extern int add_mon_breakpoint (mem_addr_t location); | |
| 239 extern void install_breakpoints (void); | |
| 240 extern void clear_breakpoints (void); | |
| 241 extern int show_breakpoints (void); | |
| 242 extern int clear_mon_breakpoint (mem_addr_t location); | |
| 243 | |
| 244 | |
| 245 /* | |
| 246 * From do-dis.c | |
| 247 */ | |
| 248 extern mem_addr_t do_dis (mem_addr_t *addr); | |
| 249 extern void flush_dis (void); | |
| 250 | |
| 251 | |
| 252 /* | |
| 253 * From architecture-mon.c | |
| 254 */ | |
| 255 #ifdef HAVE_BSP | |
| 256 extern void initialize_mon(void); | |
| 257 extern target_regval_t get_register(int regnum); | |
| 258 extern void put_register(int regnum, target_regval_t val); | |
| 259 #endif | |
| 260 | |
| 261 | |
| 262 /* Lame. */ | |
| 263 #ifndef ITIMER_REAL | |
| 264 #define ITIMER_REAL 0 | |
| 265 #endif | |
| 266 | |
| 267 #endif /* ASM */ | |
| 268 #endif |
