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 1152

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