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 122

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