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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [sim/] [common/] [hw-instances.h] - Blame information for rev 24

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* The common simulator framework for GDB, the GNU Debugger.
2
 
3
   Copyright 2002, 2007, 2008 Free Software Foundation, Inc.
4
 
5
   Contributed by Andrew Cagney and Red Hat.
6
 
7
   This file is part of GDB.
8
 
9
   This program is free software; you can redistribute it and/or modify
10
   it under the terms of the GNU General Public License as published by
11
   the Free Software Foundation; either version 3 of the License, or
12
   (at your option) any later version.
13
 
14
   This program is distributed in the hope that it will be useful,
15
   but WITHOUT ANY WARRANTY; without even the implied warranty of
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
   GNU General Public License for more details.
18
 
19
   You should have received a copy of the GNU General Public License
20
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21
 
22
 
23
#ifndef HW_INSTANCES_H
24
#define HW_INSTANCES_H
25
 
26
/* Instances:
27
 
28
   As with IEEE1275, a device can be opened, creating an instance.
29
   Instances provide more abstract interfaces to the underlying
30
   hardware.  For example, the instance methods for a disk may include
31
   code that is able to interpret file systems found on disks.  Such
32
   methods would there for allow the manipulation of files on the
33
   disks file system.  The operations would be implemented using the
34
   basic block I/O model provided by the disk.
35
 
36
   This model includes methods that faciliate the creation of device
37
   instance and (should a given device support it) standard operations
38
   on those instances.
39
 
40
   */
41
 
42
 
43
struct hw_instance;
44
 
45
 
46
typedef void (hw_finish_instance_method)
47
     (struct hw *hw,
48
      struct hw_instance *);
49
 
50
extern void set_hw_finish_instance
51
(struct hw *hw,
52
 hw_finish_instance_method *method);
53
 
54
 
55
/* construct an instance of the hardware */
56
 
57
struct hw_instance *hw_instance_create
58
(struct hw *hw,
59
 struct hw_instance *parent,
60
 const char *path,
61
 const char *args);
62
 
63
struct hw_instance *hw_instance_interceed
64
(struct hw_instance *parent,
65
 const char *path,
66
 const char *args);
67
 
68
void hw_instance_delete
69
(struct hw_instance *instance);
70
 
71
 
72
/* methods applied to an instance of the hw */
73
 
74
typedef int (hw_instance_read_method)
75
     (struct hw_instance *instance,
76
      void *addr,
77
      unsigned_cell len);
78
 
79
#define hw_instance_read(instance, addr, len) \
80
((instance)->to_instance_read ((instance), (addr), (len)))
81
 
82
#define set_hw_instance_read(instance, method) \
83
((instance)->to_instance_read = (method))
84
 
85
 
86
typedef int (hw_instance_write_method)
87
     (struct hw_instance *instance,
88
      const void *addr,
89
      unsigned_cell len);
90
 
91
#define hw_instance_write(instance, addr, len) \
92
((instance)->to_instance_write ((instance), (addr), (len)))
93
 
94
#define set_hw_instance_write(instance, method) \
95
((instance)->to_instance_write = (method))
96
 
97
 
98
typedef int (hw_instance_seek_method)
99
     (struct hw_instance *instance,
100
      unsigned_cell pos_hi,
101
      unsigned_cell pos_lo);
102
 
103
#define hw_instance_seek(instance, pos_hi, pos_lo) \
104
((instance)->to_instance_seek ((instance), (pos_hi), (pos_lo)));
105
 
106
#define set_hw_instance_seek(instance, method) \
107
((instance)->to_instance_seek = (method))
108
 
109
 
110
int hw_instance_call_method
111
(struct hw_instance *instance,
112
 const char *method,
113
 int n_stack_args,
114
 unsigned_cell stack_args[/*n_stack_args + 1(NULL)*/],
115
 int n_stack_returns,
116
 unsigned_cell stack_returns[/*n_stack_returns + 1(NULL)*/]);
117
 
118
 
119
 
120
/* the definition of the instance */
121
 
122
#define hw_instance_hw(instance) ((instance)->hw_of_instance + 0)
123
 
124
#define hw_instance_path(instance) ((instance)->path_of_instance + 0)
125
 
126
#define hw_instance_args(instance) ((instance)->args_of_instance)
127
 
128
#define hw_instance_data(instance) ((instance)->data_of_instance)
129
 
130
#define hw_instance_system(instance) (hw_system (hw_instance_hw (instance)))
131
 
132
 
133
 
134
/* Finally an instance of a hardware device - keep your grubby little
135
   mits off of these internals! :-) */
136
 
137
struct hw_instance {
138
 
139
  void *data_of_instance;
140
  char *args_of_instance;
141
  char *path_of_instance;
142
 
143
  /* the device that owns the instance */
144
  struct hw *hw_of_instance;
145
  struct hw_instance *sibling_of_instance;
146
 
147
  /* interposed instance */
148
  struct hw_instance *parent_of_instance;
149
  struct hw_instance *child_of_instance;
150
 
151
  /* methods */
152
  hw_instance_read_method *to_instance_read;
153
  hw_instance_write_method *to_instance_write;
154
  hw_instance_seek_method *to_instance_seek;
155
 
156
};
157
 
158
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.