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 118

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