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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [config/] [or1k/] [tm-or1k.h] - Blame information for rev 593

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* Definitions to target GDB to or1k targets.
2
   Copyright 2001 Free Software Foundation, Inc.
3
 
4
   This file is part of GDB.
5
 
6
   This program is free software; you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License as published by
8
   the Free Software Foundation; either version 2 of the License, or
9
   (at your option) any later version.
10
 
11
   This program is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
   GNU General Public License for more details.
15
 
16
   You should have received a copy of the GNU General Public License
17
   along with this program; if not, write to the Free Software
18
   Foundation, Inc., 59 Temple Place - Suite 330,
19
   Boston, MA 02111-1307, USA.  */
20
 
21
#ifndef TM_OR1K_H
22
#define TM_OR1K_H
23
 
24
#ifndef TARGET_OR1K
25
#define TARGET_OR1K
26
#endif
27
 
28 122 markom
#include "defs.h"
29 126 chris
#include <inttypes.h>  /* CZ */
30 122 markom
 
31 106 markom
struct value;
32
 
33
struct struct_or1k_implementation
34
  {
35
    /* Implementation version.  */
36
    unsigned int VR;
37
    /* Units present.  */
38
    unsigned int UPR;
39
    /* Number of total available matchpoints in this implementation.  */
40
    unsigned int num_matchpoints;
41 113 markom
    /* Number of currently used matchpoints.  */
42
    unsigned int num_used_matchpoints;
43 115 markom
    /* Has watchpoint driven counters.  */
44
    int has_counters;
45 106 markom
    /* Number of registers.  */
46
    unsigned int num_gpr_regs;
47 115 markom
    unsigned int num_vfpr_regs;
48
    /* Is there any vf support?  */
49 106 markom
    int vf_present;
50
 };
51
 
52
struct or1k_target_ops
53
  {
54
    /* Name this target type.  */
55
    char *to_shortname;
56
 
57
    /* Init target.  */
58
    void (*to_init) PARAMS ((char *args));
59
    /* Destruct target.  */
60
    void (*to_done) PARAMS ((void));
61
 
62 113 markom
    /* Read register.
63
       Does not fail, places error no. in err instead or call error(), if fatal.  */
64 122 markom
    ULONGEST (*to_read_reg) PARAMS ((unsigned int regno));
65 113 markom
    /* Write register.
66
       Does not fail, places error no. in err instead or call error(), if fatal.  */
67 122 markom
    void (*to_write_reg) PARAMS ((unsigned int regno, ULONGEST value));
68 106 markom
 
69 146 chris
    /* Read a block...possibly more efficient than several isolated
70
       call to read_reg...worst case the same efficiency. Returns 0
71
       on success or errno if a failure occurred. */
72
    int (*to_read_block) PARAMS ((unsigned int regno, void* block, int nRegisters));
73
 
74
    /* Write a block...possibly more efficient than several isolated
75
       call to write_reg...worst case the same efficiency. Returns 0
76
       on success or errno if a failure occurred. */
77
    int (*to_write_block) PARAMS ((unsigned int regno, void* block, int nRegisters));
78
 
79 113 markom
    /* Selects scan chain.  All register accesses are related to current scan chain.
80
       Does not fail, places error no. in err instead or call error(), if fatal.
81
       See jtag_chains enum.  */
82
    void (*to_set_chain) PARAMS ((int chain));
83 106 markom
 
84
    /* Executes extended command on the target.  */
85
    void (*to_exec_command) PARAMS ((char *args, int from_tty));
86
 
87
    /* Associated target_ops.  */
88
    struct target_ops *gdb_ops;
89
    /* Should be OPS_MAGIC. */
90
    int to_magic;
91
  };
92
 
93
 
94 403 simons
#define DEFAULT_PROMPT "(gdb) "
95 106 markom
 
96 113 markom
/* Context stuff. */
97
#define CURRENT_CID (0)
98
#define MAX_CID     (15)
99
 
100
 
101
/* Instruction definitions. */
102 364 markom
#define BRK_INSTR_STRUCT {0x21, 0x00, 0x00, 0x01}
103 113 markom
#define NOP_INSTR (0x15000000)
104
 
105 106 markom
/* Special purpose regisers.  */
106 113 markom
#define SPR_GROUP_SIZE_BITS (11)
107 106 markom
#define SPR_GROUP_SIZE (1 << SPR_GROUP_SIZE_BITS)
108
#define SPR_SYSTEM_GROUP (0)
109
#define SPR_DEBUG_GROUP (6)
110 115 markom
#define SPR_GPR_START  (1024)
111
#define SPR_VFPR_START ((MAX_CID + 1) * MAX_GPR_REGS + SPR_GPR_START)
112
#define OR1K_NUM_SPR_GROUPS (12)
113 106 markom
 
114
/* Define register values.  */
115
#define SPR_REG(group, index) (((group) << SPR_GROUP_SIZE_BITS) + (index))
116
 
117 115 markom
#define VR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 0)
118
#define UPR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 1)
119
#define CPUCFGR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 2)
120
#define DCFGR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 7)
121
#define PC_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 16)
122
#define SR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 17)
123 372 markom
#define PPC_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 18)
124 113 markom
#define CCR_SPRNUM(cid) SPR_REG(SPR_SYSTEM_GROUP, 4 + (cid))
125 362 markom
#define EPCR_SPRNUM(cid) SPR_REG(SPR_SYSTEM_GROUP, 32 + (cid))
126
#define EPCR0_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 32)
127
 
128
#define DVR0_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
129
#define DCR0_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
130
#define DMR1_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 16)
131
#define DMR2_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 17)
132
#define DCWR0_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
133
#define DCWR1_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
134
#define DSR_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 20)
135
#define DRR_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 21)
136
 
137 106 markom
#define ZERO_REGNUM (0)
138
#define SP_REGNUM (1)
139
#define FP_REGNUM (2)
140
#define A0_REGNUM (3)
141
#define A5_REGNUM (8)
142
#define LR_REGNUM (9)
143
#define RV_REGNUM (11)
144 113 markom
#define VFA0_REGNUM (MAX_GPR_REGS + 0)
145
#define VFA5_REGNUM (MAX_GPR_REGS + 5)
146
#define VFRV_REGNUM (MAX_GPR_REGS + 6)
147
#define PC_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 0)
148
#define PS_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 1)
149 362 markom
#define EPCR_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 2)
150 113 markom
#define CCR_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 2)
151 106 markom
 
152 207 chris
/******** END OF ADDITIONS BY CZ ************/
153
 
154 106 markom
extern int or1k_regnum_to_sprnum PARAMS ((int regno));
155
#define REGNUM_TO_SPRNUM(regno) (or1k_regnum_to_sprnum(regno))
156
 
157
/* Defines for SPR bits.  */
158
#define DMR1_ST    (0x00400000)
159
 
160 136 chris
/* Changed by CZ 21/06/01 */
161 363 markom
#define DRR_TE     (0x00002000)
162 372 markom
#define DRR_SSE    (0x00001000)
163 136 chris
#define DRR_SCE    (0x00000800)
164
#define DRR_RE     (0x00000400)
165
#define DRR_IME    (0x00000200)
166
#define DRR_DME    (0x00000100)
167
#define DRR_HPINTE (0x00000080)
168 106 markom
#define DRR_IIE    (0x00000040)
169 136 chris
#define DRR_AE     (0x00000020)
170
#define DRR_LPINTE (0x00000010)
171
#define DRR_IPFE   (0x00000008)
172
#define DRR_DPFE   (0x00000004)
173
#define DRR_BUSEE  (0x00000002)
174
#define DRR_RSTE   (0x00000001)
175 106 markom
 
176
/* Number of matchpoints */
177
#define NUM_MATCHPOINTS (or1k_implementation.num_matchpoints)
178 118 markom
#define MAX_MATCHPOINTS (8)
179 106 markom
 
180
/* Number of machine GPR registers */
181
#define NUM_GPR_REGS (or1k_implementation.num_gpr_regs)
182
#define MAX_GPR_REGS (32)
183
 
184
/* Number of machine VF registers */
185 116 markom
#define NUM_VF_REGS (or1k_implementation.num_vfpr_regs)
186 106 markom
#define MAX_VF_REGS (32)
187
 
188
/* gdb mapping of registers */
189
#ifndef NUM_REGS
190 363 markom
#define NUM_REGS (MAX_GPR_REGS+MAX_VF_REGS+3)
191 106 markom
#endif
192
 
193
/* Can act like a little or big endian.  */
194
#if !defined (TARGET_BYTE_ORDER_DEFAULT)
195
#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
196
#define TARGET_BYTE_ORDER_SELECTABLE_P (1)
197
#endif
198
 
199
/* Size (in bytes) of registers.  */
200
#define OR1K_SPR_REGSIZE (4)
201
#define OR1K_VF_REGSIZE (8)
202
#define OR1K_GPR_REGSIZE ((OR1K_64BIT_IMPLEMENTATION)?(8):(4))
203 113 markom
#define OR1K_VF_DOUBLE (0)
204 106 markom
 
205 113 markom
#define OR1K_IS_GPR(N) ((N) >= 0 && (N) < MAX_GPR_REGS)
206
#define OR1K_IS_VF(N) ((N) >= MAX_GPR_REGS && (N) < MAX_GPR_REGS + MAX_VF_REGS)
207 106 markom
 
208
/* Register representation is the same as in memory.  */
209
#define REGISTER_CONVERTIBLE(N) (0)
210
 
211
/* Given the register index, return the name of the corresponding
212
   register. */
213
extern char *or1k_register_name PARAMS ((int regno));
214
#define REGISTER_NAME(regno) or1k_register_name (regno)
215
 
216
/* Is this implementation 64 or 32 bit.
217
   WARNING: gdb or1k port is not yet prepared for 64b implementations!  */
218
#define OR1K_64BIT_IMPLEMENTATION 0
219
 
220
/* Number of bytes of storage in the actual machine representation for
221
   register N.  NOTE: This indirectly defines the register size
222
   transfered by the GDB protocol.  If we have 64bit processor
223
   implementation, GPR register raw size is 8B, otherwise 4B.  */
224
#define REGISTER_RAW_SIZE(N) ((OR1K_IS_GPR(N)?((OR1K_64BIT_IMPLEMENTATION)?\
225
(8):(4)):(OR1K_SPR_REGSIZE)))
226
 
227
/* Number of bytes of storage in the program's representation
228
   for register N. Same as RAW_SIZE.  */
229
#define REGISTER_VIRTUAL_SIZE(N) TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (N))
230
 
231
/* Return the GDB type object for the "standard" data type of data in
232
   register N.  */
233
#define REGISTER_VIRTUAL_TYPE(N) ((OR1K_IS_GPR(N))?(\
234 113 markom
(OR1K_64BIT_IMPLEMENTATION)?builtin_type_int64:builtin_type_int\
235
):(OR1K_IS_VF(N) ? builtin_type_float : builtin_type_uint32))
236 106 markom
 
237
/* Largest value REGISTER_RAW_SIZE can have.  */
238
#define MAX_REGISTER_RAW_SIZE ((OR1K_64BIT_IMPLEMENTATION)?(8):(4))
239
 
240
/* Largest value REGISTER_VIRTUAL_SIZE can have.  */
241
#define MAX_REGISTER_VIRTUAL_SIZE ((OR1K_64BIT_IMPLEMENTATION)?(8):(4))
242
 
243
#define REGISTER_SIZE (MAX_REGISTER_VIRTUAL_SIZE)
244
 
245
/* ABI uses R3 through R8 for args.  */
246
#define OR1K_LAST_ARG_REGNUM (A5_REGNUM)
247
#define OR1K_NUM_ARG_REGS (6)
248 118 markom
 
249 106 markom
/* ABI uses VFR0 through VFR5 for float args.  */
250
#define OR1K_LAST_FP_ARG_REGNUM (VFA5_REGNUM)
251
#define OR1K_NUM_FP_ARG_REGS (6)
252
 
253
/* Should not store into R0.  */
254
#define CANNOT_STORE_REGISTER(N) ((N) == 0)
255
 
256
/* Index within `registers' of the first byte of the space for
257
   register N.  */
258
#define REGISTER_BYTE(N) ((N) * OR1K_SPR_REGSIZE)
259
 
260
/* Total amount of space needed to store our copies of the machine's
261
   register state, the array `registers'.  */
262 362 markom
#define REGISTER_BYTES (NUM_REGS * OR1K_GPR_REGSIZE)
263 106 markom
 
264 113 markom
extern void or1k_do_registers_info PARAMS ((int, int));
265
#define DO_REGISTERS_INFO(regnum, fp) or1k_do_registers_info(regnum, fp)
266
 
267
 
268
 
269 106 markom
/* BREAKPOINT_FROM_PC uses the program counter value to determine whether a
270
   16- or 32-bit breakpoint should be used.  It returns a pointer
271
   to a string of bytes that encode a breakpoint instruction, stores
272
   the length of the string to *lenptr, and adjusts the pc (if necessary) to
273
   point to the actual memory location where the breakpoint should be
274
   inserted.  */
275
extern unsigned char *or1k_breakpoint_from_pc PARAMS ((CORE_ADDR *bp_addr, int *bp_size));
276
#define BREAKPOINT_FROM_PC(pcptr, lenptr) or1k_breakpoint_from_pc (pcptr, lenptr)
277
 
278
/* Amount PC must be decremented by after a breakpoint.
279
   This is often the number of bytes in BREAKPOINT
280
   but not always.  */
281
 
282
#define DECR_PC_AFTER_BREAK 0
283
 
284 372 markom
/* Don't step over l.trap */
285
#define CANNOT_STEP_BREAKPOINT
286
 
287 113 markom
extern int or1k_insert_breakpoint (CORE_ADDR addr, char *contents_cache);
288
#define target_insert_hw_breakpoint(addr, cache) or1k_insert_breakpoint (addr, cache)
289
 
290
extern int or1k_remove_breakpoint (CORE_ADDR addr, char *contents_cache);
291
#define target_remove_hw_breakpoint(addr, cache) or1k_remove_breakpoint (addr, cache)
292
 
293
/* Watchpoint support.  */
294
#define TARGET_HAS_HARDWARE_WATCHPOINTS
295
 
296
/* Use these macros for watchpoint insertion/deletion.  */
297
/* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */
298
extern int or1k_insert_watchpoint PARAMS ((CORE_ADDR addr, int len, int type));
299
#define target_insert_watchpoint(addr, len, type) \
300
        or1k_insert_watchpoint (addr, len, type)
301
 
302
extern int or1k_insert_watchpoint PARAMS ((CORE_ADDR addr, int len, int type));
303
#define target_remove_watchpoint(addr, len, type) \
304
        or1k_remove_watchpoint (addr, len, type)
305
 
306
/* We need to remove watchpoints when stepping, else we hit them again! */
307
#define HAVE_NONSTEPPABLE_WATCHPOINT
308
 
309
extern int or1k_stopped_by_watchpoint PARAMS ((void));
310
#define STOPPED_BY_WATCHPOINT(w) or1k_stopped_by_watchpoint ()
311
 
312
typedef enum bptype;
313
extern int or1k_can_use_hardware_watchpoint PARAMS ((enum bptype, int));
314
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(bp_type, cnt, ot) \
315
  or1k_can_use_hardware_watchpoint(bp_type, cnt)
316
 
317
 
318
/* Catchpoint support.  */
319
/* HACK: how do we hook to signal namings otherwise? */
320
#include "target.h"
321
extern char *target_signal_to_string PARAMS ((enum target_signal));
322 118 markom
 
323 113 markom
/* Return the name (SIGHUP, etc.) for a signal.  */
324
extern char *or1k_signal_to_name PARAMS ((enum target_signal));
325 118 markom
 
326 113 markom
/* Given a name (SIGHUP, etc.), return its signal.  */
327
extern enum target_signal or1k_signal_from_name PARAMS ((char *));
328
 
329 207 chris
#define NUM_OR1K_SIGNALS (14)
330 113 markom
 
331 106 markom
/* Extract from an array REGBUF containing the (raw) register state
332
   a function return value of type TYPE, and copy that, in virtual format,
333
   into VALBUF.  */
334
extern void or1k_extract_return_value PARAMS ((struct type *, char[], char *));
335
#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
336
  or1k_extract_return_value (TYPE, REGBUF, VALBUF)
337
 
338
/* Write into appropriate registers a function return value
339
   of type TYPE, given in virtual format.  */
340
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
341
  {\
342
    if (TYPE_CODE (TYPE) == TYPE_CODE_FLT)\
343
      write_register_bytes (REGISTER_BYTE (VFRV_REGNUM), VALBUF, TYPE_LENGTH (TYPE));\
344
    else\
345
      write_register_bytes (REGISTER_BYTE (RV_REGNUM), VALBUF, TYPE_LENGTH (TYPE));\
346
  }
347
 
348
/* Extract from an array REGBUF containing the (raw) register state
349
   the address in which a function should return its structure value,
350
   as a CORE_ADDR (or an expression that can be used as one).  */
351
/* The address is passed in a0 upon entry to the function, but when
352
   the function exits, the compiler has copied the value to v0.  This
353
   convention is specified by the System V ABI, so I think we can rely
354
   on it.  */
355
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
356
  (extract_address (REGBUF + REGISTER_BYTE (RV_REGNUM), \
357
                    REGISTER_RAW_SIZE (RV_REGNUM)))
358
 
359 593 markom
#ifdef GDBTK
360
#define EXTRACT_STRUCT_VALUE_ADDRESS_P() 1
361
#else
362 106 markom
#define EXTRACT_STRUCT_VALUE_ADDRESS_P 1
363 593 markom
#endif
364 106 markom
 
365
/* Advance PC across any function entry prologue instructions
366
   to reach some "real" code.  */
367
extern CORE_ADDR or1k_skip_prologue PARAMS ((CORE_ADDR addr));
368
#define SKIP_PROLOGUE(pc) (or1k_skip_prologue (pc))
369
 
370
/* FRAMES */
371 207 chris
 
372 106 markom
#define FRAME_ARGS_ADDRESS(fi)  (fi)->frame
373
 
374
#define FRAME_LOCALS_ADDRESS(fi) (fi)->frame
375
 
376
/* FRAME_CHAIN takes a frame's nominal address
377
   and produces the frame's chain-pointer. */
378
#define FRAME_CHAIN(thisframe) (CORE_ADDR) or1k_frame_chain (thisframe)
379
extern CORE_ADDR or1k_frame_chain PARAMS ((struct frame_info *));
380
 
381
/* Discard from the stack the innermost frame, restoring all registers.  */
382
extern void or1k_pop_frame PARAMS ((void));
383
#define POP_FRAME or1k_pop_frame()
384
 
385
 
386
/* Return number of args passed to a frame.
387
   Can return -1, meaning no way to tell.  */
388
#define FRAME_NUM_ARGS(fi)      (-1)
389
 
390
/* Return number of bytes at start of arglist that are not really args.  */
391
#define FRAME_ARGS_SKIP 0
392
 
393
/* Put here the code to store, into a struct frame_saved_regs,
394
   the addresses of the saved registers of frame described by FRAME_INFO.
395
   This includes special registers such as pc and fp saved in special
396
   ways in the stack frame.  sp is even more special:
397
   the address we return for it IS the sp for the next frame.  */
398
extern void or1k_init_saved_regs PARAMS ((struct frame_info *));
399
#define FRAME_INIT_SAVED_REGS(frame_info) or1k_init_saved_regs (frame_info);
400
 
401
/* Saved Pc.  */
402
extern CORE_ADDR or1k_frame_saved_pc PARAMS ((struct frame_info *));
403
#define FRAME_SAVED_PC(FRAME) (or1k_frame_saved_pc(FRAME))
404
 
405
/* Set the return address register to point to the entry
406
   point of the program, where a breakpoint lies in wait.  */
407
extern CORE_ADDR or1k_push_return_address PARAMS ((CORE_ADDR pc, CORE_ADDR sp));
408
#define PUSH_RETURN_ADDRESS(PC, SP) (or1k_push_return_address ((PC), (SP)))
409
 
410
/* Immediately after a function call, return the saved pc.
411
   Can't always go through the frames for this because on some machines
412
   the new frame is not set up until the new function executes
413
   some instructions.  */
414
#define SAVED_PC_AFTER_CALL(frame)      read_register(LR_REGNUM)
415
 
416
/* Offset from address of function to start of its code.
417
   Zero on most machines.  */
418
#define FUNCTION_START_OFFSET (0)
419
 
420
/* Floating point is IEEE compliant */
421 593 markom
#define IEEE_FLOAT 1
422 106 markom
 
423
/* Is floating/vector unit present.  */
424
#define OR1K_VF_PRESENT (or1k_implementation.vf_present)
425
 
426 207 chris
/* #define INIT_FRAME_PC        */      /* Not necessary */
427 106 markom
 
428
/* Stack grows downward.  */
429
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
430
 
431
/* Size of stack entry - in bytes.  */
432
#define OR1K_STACK_ALIGN (8)
433 118 markom
 
434 106 markom
/* Maximum struct size, that is still stored onto stack.  */
435
#define OR1K_STRUCT_CONV_SIZE (8)
436
#define STACK_ALIGN(addr) OR1K_STACK_ALIGN
437
 
438
#define USE_STRUCT_CONVENTION(gcc_p, type) (TYPE_LENGTH (type) > OR1K_STRUCT_CONV_SIZE)
439
 
440
/* Stack must be aligned on 32-bit boundaries when synthesizing
441
   function calls. PUSH_ARGUMENTS will handle it. */
442
extern CORE_ADDR or1k_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR));
443
#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
444
(or1k_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
445
 
446 403 simons
/* Return nonzero if instruction has delay slot */
447
extern int is_delayed PARAMS ((unsigned long));
448
 
449 106 markom
/* Return non-zero if PC points to an instruction which will cause a step
450
   to execute both the instruction at PC and an instruction at PC+4.  */
451
extern int or1k_step_skips_delay PARAMS ((CORE_ADDR));
452
#define STEP_SKIPS_DELAY_P (1)
453
#define STEP_SKIPS_DELAY(pc) (or1k_step_skips_delay (pc))
454
 
455
/* DUMMY CALLS */
456
#define USE_GENERIC_DUMMY_FRAMES 1
457
#define CALL_DUMMY                   {0}
458
#define CALL_DUMMY_START_OFFSET      (0)
459
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
460
#define SIZEOF_CALL_DUMMY_WORDS      (0)
461
#define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
462
#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP) 
463
 
464
/* Return a location where we can set a breakpoint that will be hit
465
   when an inferior function call returns.  This is normally the
466
   program's entry point.  */
467
#define CALL_DUMMY_ADDRESS()         entry_point_address ()
468
#define SAVE_DUMMY_FRAME_TOS(SP)     generic_save_dummy_frame_tos (SP)
469
#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
470
#define PUSH_DUMMY_FRAME             generic_push_dummy_frame ()
471
 
472
/* Definitions and declarations used by or1k dependent files.  */
473
#define OR1K_INSTLEN 4          /* Length of an instruction */
474
typedef unsigned long t_inst;   /* Integer big enough to hold an instruction */
475
 
476
 
477
 
478
/* Defined in remote-or1k.c */
479
 
480
/* Target state names.  */
481
extern const char *status_name[];
482 118 markom
 
483 106 markom
/* Target state.  */
484
enum target_status
485
  {
486
    TARGET_UNDEFINED,
487
    TARGET_CONNECTING,
488
    TARGET_DISCONNECTING,
489
    TARGET_RUNNING,
490
    TARGET_STOPPED
491
  };
492
 
493
/* Compare conditions for DCRx registers.  */
494
enum enum_compare_condition
495
  {
496 118 markom
    CC_MASKED, CC_EQUAL, CC_LESS, CC_LESSE, CC_GREAT, CC_GREATE, CC_NEQUAL
497 106 markom
  };
498
 
499
/* Compare operand to compare DVRx to.  */
500
enum enum_compare_to
501
  {
502 119 markom
    CT_DISABLED, CT_FETCH, CT_LEA, CT_SEA, CT_LDATA, CT_SDATA, CT_AEA, CT_ADATA
503 106 markom
  };
504
 
505 118 markom
/* Matchpoint chaining types.  */
506
enum enum_chaining
507
  {
508
    CHAINING_NONE, CHAINING_AND, CHAINING_OR
509
  };
510 106 markom
 
511 118 markom
/* Names for cts.  */
512
#define NUM_CT_NAMES 8
513
extern const char *compare_to_names[NUM_CT_NAMES];
514
 
515 106 markom
/* DRCx struct */
516
struct dcr_struct
517
  {
518 113 markom
    enum enum_compare_to ct:3;
519
    unsigned int sc:1;
520 106 markom
    enum enum_compare_condition cc:3;
521 113 markom
    unsigned int dp:1;
522 106 markom
  };
523
 
524 118 markom
/* All data needed for a matchpoint.  */
525
struct matchpoint
526
  {
527
    struct dcr_struct dcr;
528
    unsigned int dvr;
529
    unsigned int chain_type;
530
    unsigned int cause_breakpoint;
531
  };
532
 
533
/* Trace related structures and data.  */
534
#define TRACE_FILENAME_SIZE (128)
535
extern char trace_filename[TRACE_FILENAME_SIZE];
536
#define TRACE_FILENAME (&trace_filename[0])
537
#define TRACE_DATA_SIZE (sizeof(struct htrace_data_struct))
538
 
539
struct htrace_data_struct
540
  {
541
    unsigned int unused:24;
542
    unsigned int data:32;
543
    unsigned int type:4;
544
    unsigned int reserved:3;
545
    unsigned int valid:1;
546
  };
547
 
548
enum enum_operation
549
  {
550
    TRIGOP_ANY, TRIGOP_OR, TRIGOP_AND
551
  };
552
 
553
struct htrace_event_struct
554
  {
555
    enum enum_operation operation:2;
556
    unsigned int reserved1:6;
557
    unsigned int is_valid:1;
558
    unsigned int is_trig:2;
559
    unsigned int ls_valid:1;
560
    unsigned int ls_trig:4;
561
    unsigned int reserved2:2;
562
    unsigned int bp_valid:1;
563
    unsigned int bp_trig:1;
564
    unsigned int wp_valid:1;
565
    unsigned int wp_trig:11;
566
  };
567
 
568
struct htrace_record_struct
569
  {
570
    unsigned int reserved:25;
571
    unsigned int rec:7;
572
  };
573
 
574
struct htrace_moder_struct
575
  {
576
    unsigned int reserved:29;
577
    unsigned int rec_sel_dep:1;
578
    unsigned int trace_enable:1;
579
    unsigned int contin:1;
580
  };
581
 
582
/* Number of records as defined in TAP.  */
583
#define NUM_RECORDS (8)
584
 
585
struct htrace_struct
586
  {
587
    /* Local copy of HW regs for trace.  */
588
    struct htrace_event_struct trig, qual, stop;
589
    struct htrace_record_struct recwp[MAX_MATCHPOINTS], recbp;
590
    struct htrace_moder_struct moder;
591
    /* Which matchpoints does record use?  Bitmask.  */
592
    unsigned int wp_record_uses[MAX_MATCHPOINTS];
593
  };
594
 
595
extern struct htrace_struct or1k_htrace;
596
extern int trace_size;
597
 
598
#define MAX_RECORD_NAMES 7
599
extern const char *or1k_record_names[MAX_RECORD_NAMES];
600
#define MAX_IS_NAMES 4
601
extern const char *or1k_is_names[MAX_IS_NAMES];
602
#define MAX_LS_NAMES 16
603
extern const char *or1k_ls_names[MAX_LS_NAMES];
604
 
605
/* Stuff for HW watches.  */
606
#define MAX_HW_WATCHES MAX_MATCHPOINTS
607
 
608
struct hwatch_struct
609
  {
610
    int matchpoint_start;
611
  };
612
 
613
extern int num_hw_watches;
614
extern struct hwatch_struct or1k_hwatch[MAX_HW_WATCHES];
615
 
616 106 markom
/* Possible errors are listed here.  */
617 126 chris
enum enum_errors  /* modified <chris@asics.ws> CZ 24/05/01 */
618
{
619
  /* Codes > 0 are for system errors */
620 106 markom
 
621 126 chris
  ERR_NONE = 0,
622
  ERR_CRC = -1,
623 146 chris
  ERR_MEM = -2,
624
  JTAG_PROXY_INVALID_COMMAND = -3,
625
  JTAG_PROXY_SERVER_TERMINATED = -4,
626
  JTAG_PROXY_NO_CONNECTION = -5,
627
  JTAG_PROXY_PROTOCOL_ERROR = -6,
628
  JTAG_PROXY_COMMAND_NOT_IMPLEMENTED = -7,
629
  JTAG_PROXY_INVALID_CHAIN = -8,
630
  JTAG_PROXY_INVALID_ADDRESS = -9,
631
  JTAG_PROXY_ACCESS_EXCEPTION = -10, /* Write to ROM */
632
  JTAG_PROXY_INVALID_LENGTH = -11,
633
  JTAG_PROXY_OUT_OF_MEMORY = -12,
634 126 chris
};
635
 
636 118 markom
/* All JTAG chains.  */
637 113 markom
enum jtag_chains
638
  {
639
    SC_GLOBAL,      /* 0 Global BS Chain */
640
    SC_RISC_DEBUG,  /* 1 RISC Debug Interface chain */
641
    SC_RISC_TEST,   /* 2 RISC Test Chain */
642
    SC_TRACE,       /* 3 Trace Chain */
643 362 markom
    SC_REGISTER,    /* 4 Register Chain */
644
    SC_WISHBONE,    /* 5 Wisbone Chain */
645
    SC_BLOCK        /* Block Chains */
646 113 markom
  };
647
 
648 118 markom
/* See JTAG documentation about these.  */
649
#define JI_SIZE (4)
650
enum jtag_instr
651
  {
652
    JI_EXTEST,
653
    JI_SAMPLE_PRELOAD,
654
    JI_IDCODE,
655
    JI_CHAIN_SELECT,
656
    JI_INTEST,
657
    JI_CLAMP,
658
    JI_CLAMPZ,
659
    JI_HIGHZ,
660 362 markom
    JI_DEBUG,
661 118 markom
    JI_BYPASS = 0xF
662
  };
663
 
664 113 markom
/* JTAG registers.  */
665 118 markom
#define JTAG_MODER  (0x0)
666
#define JTAG_TSEL   (0x1)
667
#define JTAG_QSEL   (0x2)
668
#define JTAG_SSEL   (0x3)
669 362 markom
#define JTAG_RISCOP (0x4)
670 118 markom
#define JTAG_RECWP0 (0x10)
671
#define JTAG_RECBP0 (0x1b)
672 113 markom
 
673 118 markom
 
674
/* Current register values.  */
675
extern unsigned int dmr1;
676
extern unsigned int dmr2;
677
extern unsigned int dsr;
678
extern unsigned int drr;
679
 
680
extern int matchpoint_user_count[MAX_MATCHPOINTS];
681
 
682
/* Current watchpoints.  */
683
extern unsigned int dvr[MAX_MATCHPOINTS];
684
extern struct dcr_struct dcr[MAX_MATCHPOINTS];
685
extern int debug_regs_changed;
686
 
687
/* Returns error name.  */
688 106 markom
extern const char *or1k_err_name PARAMS ((int e));
689
 
690 118 markom
/* Last error number.  */
691
extern int err;
692
 
693 106 markom
extern struct struct_or1k_implementation or1k_implementation;
694
extern unsigned int or1k_fetch_instruction PARAMS ((CORE_ADDR addr));
695
extern void or1k_fetch_registers PARAMS ((int regno));
696
 
697
/* Sets register/memory regno to data.  */
698 113 markom
extern void or1k_write_spr_reg PARAMS ((unsigned int regno, unsigned int data));
699 106 markom
 
700
/* Sets register/memory regno to data.  */
701 113 markom
extern unsigned int or1k_read_spr_reg PARAMS ((unsigned int regno));
702 106 markom
 
703 118 markom
/* Flushes or1k's pipeline.  */
704 113 markom
extern void or1k_flush_pipeline PARAMS ((void));
705
 
706 118 markom
/* Sifts unused matchpoints to higher indexses.  */
707
extern void sift_matchpoints ();
708
 
709 126 chris
 
710
/* Added by Chris Ziomkowski <chris@asics.ws> 24/05/01 */
711
typedef enum {
712
  JTAG_COMMAND_READ = 1,
713
  JTAG_COMMAND_WRITE = 2,
714 146 chris
  JTAG_COMMAND_BLOCK_READ = 3,
715
  JTAG_COMMAND_BLOCK_WRITE = 4,
716
  JTAG_COMMAND_CHAIN = 5,
717 126 chris
} JTAG_proxy_protocol_commands;
718
 
719
/* Each transmit structure must begin with an integer
720
   which specifies the type of command. Information
721
   after this is variable. Make sure to have all information
722
   aligned properly. If we stick with 32 bit integers, it
723
   should be portable onto every platform. These structures
724
   will be transmitted across the network in network byte
725
   order.
726
*/
727
 
728
typedef struct {
729
  uint32_t command;
730
  uint32_t length;
731
  uint32_t address;
732
  uint32_t data_H;
733
  uint32_t data_L;
734
} JTAGProxyWriteMessage;
735
 
736
typedef struct {
737
  uint32_t command;
738
  uint32_t length;
739
  uint32_t address;
740
} JTAGProxyReadMessage;
741
 
742
typedef struct {
743
  uint32_t command;
744
  uint32_t length;
745 146 chris
  uint32_t address;
746
  int32_t  nRegisters;
747
  uint32_t data[1];
748
} JTAGProxyBlockWriteMessage;
749
 
750
typedef struct {
751
  uint32_t command;
752
  uint32_t length;
753
  uint32_t address;
754
  int32_t  nRegisters;
755
} JTAGProxyBlockReadMessage;
756
 
757
typedef struct {
758
  uint32_t command;
759
  uint32_t length;
760 126 chris
  uint32_t chain;
761
} JTAGProxyChainMessage;
762
 
763
/* The responses are messages specific, however convention
764
   states the first word should be an error code. Again,
765
   sticking with 32 bit integers should provide maximum
766
   portability. */
767
 
768
typedef struct {
769
  int32_t status;
770
} JTAGProxyWriteResponse;
771
 
772
typedef struct {
773
  int32_t status;
774
  uint32_t data_H;
775
  uint32_t data_L;
776
} JTAGProxyReadResponse;
777
 
778
typedef struct {
779
  int32_t status;
780 146 chris
} JTAGProxyBlockWriteResponse;
781
 
782
typedef struct {
783
  int32_t status;
784
  int32_t nRegisters;
785
  uint32_t data[1];
786
  /* uint32_t data[nRegisters-1] still unread */
787
} JTAGProxyBlockReadResponse;
788
 
789
typedef struct {
790
  int32_t status;
791 126 chris
} JTAGProxyChainResponse;
792
 
793 146 chris
 
794 106 markom
#endif /* TM_OR1K_H */

powered by: WebSVN 2.1.0

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