]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/ppc/hw_trace.c
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / sim / ppc / hw_trace.c
1 /* This file is part of the program psim.
2
3 Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 */
20
21
22 #ifndef _HW_TRACE_C_
23 #define _HW_TRACE_C_
24
25 #include "device_table.h"
26 #include <stdarg.h>
27
28 /* DEVICE
29
30 trace - the properties of this dummy device specify trace options
31
32 DESCRIPTION
33
34 The properties of this device are used, during initialization, to
35 specify the value various simulation trace options. The
36 initialization can occure implicitly (during device tree init) or
37 explicitly using this devices ioctl method.
38
39 The actual options and their default values (for a given target)
40 are defined in the file debug.
41
42 This device is normally a child of the /openprom node.
43
44 EXAMPLE
45
46 The trace option dump-device-tree can be enabled by specifying the
47 option:
48
49 | -o '/openprom/trace/dump-device-tree 0x1'
50
51 Alternativly the shorthand version:
52
53 | -t dump-device-tree
54
55 can be used. */
56
57
58 /* Hook to allow the initialization of the trace options at any time */
59
60 static int
61 hw_trace_ioctl(device *me,
62 cpu *processor,
63 unsigned_word cia,
64 device_ioctl_request request,
65 va_list ap)
66 {
67 switch (request) {
68 case device_ioctl_set_trace:
69 {
70 const device_property *prop = device_find_property(me, NULL);
71 while (prop != NULL) {
72 const char *name = prop->name;
73 unsigned32 value = device_find_integer_property(me, name);
74 trace_option(name, value);
75 prop = device_next_property(prop);
76 }
77 }
78 break;
79 default:
80 device_error(me, "insupported ioctl request");
81 break;
82 }
83 return 0;
84 }
85
86
87 static device_callbacks const hw_trace_callbacks = {
88 { NULL, }, /* init */
89 { NULL, }, /* address */
90 { NULL, }, /* IO */
91 { NULL, }, /* DMA */
92 { NULL, }, /* interrupt */
93 { NULL, }, /* unit */
94 NULL, /* instance-create */
95 hw_trace_ioctl,
96 };
97
98 const device_descriptor hw_trace_device_descriptor[] = {
99 { "trace", NULL, &hw_trace_callbacks },
100 { NULL },
101 };
102
103 #endif _HW_TRACE_C_