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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [config/] [or1k/] [tm-or1k.h] - Blame information for rev 126

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