daily update
[external/binutils.git] / sim / common / hw-device.h
index 44c0709..73e00ef 100644 (file)
@@ -1,22 +1,23 @@
-/*  This file is part of the program psim.
+/* The common simulator framework for GDB, the GNU Debugger.
 
-    Copyright (C) 1994-1998, Andrew Cagney <cagney@highland.com.au>
+   Copyright 2002, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
+   Contributed by Andrew Cagney and Red Hat.
 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-    */
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 #ifndef HW_DEVICE_H
@@ -157,7 +158,7 @@ struct _sim_cpu *hw_system_cpu (struct hw *hw);
 \f
 /* Perform a soft reset of the device */
 
-typedef unsigned (hw_reset_callback)
+typedef unsigned (hw_reset_method)
      (struct hw *me);
 
 #define hw_reset(hw) ((hw)->to_reset (hw))
@@ -172,7 +173,7 @@ typedef unsigned (hw_reset_callback)
    node is described as the bus owner and is responisble for
    co-ordinating bus operations. On the bus, a SPACE:ADDR pair is used
    to specify an address.  A device that is both a bus owner (parent)
-   and bus client (child) are refered to as a bridging device.
+   and bus client (child) are referred to as a bridging device.
 
    A child performing a data (DMA) transfer will pass its request to
    the bus owner (the devices parent).  The bus owner will then either
@@ -190,7 +191,7 @@ typedef unsigned (hw_reset_callback)
    The SPACE:ADDR pair specify an address on the common bus that
    connects the parent and child devices. */
 
-typedef void (hw_attach_address_callback)
+typedef void (hw_attach_address_method)
      (struct hw *me,
       int level,
       int space,
@@ -204,7 +205,7 @@ typedef void (hw_attach_address_callback)
 #define set_hw_attach_address(hw, method) \
 ((hw)->to_attach_address = (method))
 
-typedef void (hw_detach_address_callback)
+typedef void (hw_detach_address_method)
      (struct hw *me,
       int level,
       int space,
@@ -224,7 +225,7 @@ typedef void (hw_detach_address_callback)
    The SPACE:ADDR pair specify an address on the bus shared between
    the parent and child devices. */
 
-typedef unsigned (hw_io_read_buffer_callback)
+typedef unsigned (hw_io_read_buffer_method)
      (struct hw *me,
       void *dest,
       int space,
@@ -237,7 +238,7 @@ typedef unsigned (hw_io_read_buffer_callback)
 #define set_hw_io_read_buffer(hw, method) \
 ((hw)->to_io_read_buffer = (method))
 
-typedef unsigned (hw_io_write_buffer_callback)
+typedef unsigned (hw_io_write_buffer_method)
      (struct hw *me,
       const void *source,
       int space,
@@ -260,7 +261,7 @@ typedef unsigned (hw_io_write_buffer_callback)
    The SPACE:ADDR pair specify an address on the common bus connecting
    the parent and child devices. */
 
-typedef unsigned (hw_dma_read_buffer_callback)
+typedef unsigned (hw_dma_read_buffer_method)
      (struct hw *bus,
       void *dest,
       int space,
@@ -273,7 +274,7 @@ typedef unsigned (hw_dma_read_buffer_callback)
 #define set_hw_dma_read_buffer(me, method) \
 ((me)->to_dma_read_buffer = (method))
 
-typedef unsigned (hw_dma_write_buffer_callback)
+typedef unsigned (hw_dma_write_buffer_method)
      (struct hw *bus,
       const void *source,
       int space,
@@ -324,7 +325,7 @@ const hw_unit *hw_unit_address
    textual representation.  This is because the textual address of a
    device is specified using the parent busses notation. */
 
-typedef int (hw_unit_decode_callback)
+typedef int (hw_unit_decode_method)
      (struct hw *bus,
       const char *encoded,
       hw_unit *unit);
@@ -335,7 +336,7 @@ typedef int (hw_unit_decode_callback)
 #define set_hw_unit_decode(hw, method) \
 ((hw)->to_unit_decode = (method))
 
-typedef int (hw_unit_encode_callback)
+typedef int (hw_unit_encode_method)
      (struct hw *bus,
       const hw_unit *unit,
       char *encoded,
@@ -355,7 +356,7 @@ typedef int (hw_unit_encode_callback)
    Return a zero result if the address should be ignored when looking
    for attach addresses. */
 
-typedef int (hw_unit_address_to_attach_address_callback)
+typedef int (hw_unit_address_to_attach_address_method)
      (struct hw *bus,
       const hw_unit *unit_addr,
       int *attach_space,
@@ -368,7 +369,7 @@ typedef int (hw_unit_address_to_attach_address_callback)
 #define set_hw_unit_address_to_attach_address(hw, method) \
 ((hw)->to_unit_address_to_attach_address = (method))
 
-typedef int (hw_unit_size_to_attach_size_callback)
+typedef int (hw_unit_size_to_attach_size_method)
      (struct hw *bus,
       const hw_unit *unit_size,
       unsigned *attach_size,
@@ -406,7 +407,7 @@ typedef enum {
   nr_hw_ioctl_requests,
 } hw_ioctl_request;
 
-typedef int (hw_ioctl_callback)
+typedef int (hw_ioctl_method)
      (struct hw *me,
       hw_ioctl_request request,
       va_list ap);
@@ -468,6 +469,8 @@ struct hw_port_data;
 struct hw_base_data;
 struct hw_alloc_data;
 struct hw_event_data;
+struct hw_handle_data;
+struct hw_instance_data;
 
 /* Finally the hardware device - keep your grubby little mits off of
    these internals! :-) */
@@ -498,25 +501,25 @@ struct hw {
   int nr_size_cells_of_hw_unit;
 
   /* Soft reset */
-  hw_reset_callback *to_reset;
+  hw_reset_method *to_reset;
 
   /* Basic callbacks */
-  hw_io_read_buffer_callback *to_io_read_buffer;
-  hw_io_write_buffer_callback *to_io_write_buffer;
-  hw_dma_read_buffer_callback *to_dma_read_buffer;
-  hw_dma_write_buffer_callback *to_dma_write_buffer;
-  hw_attach_address_callback *to_attach_address;
-  hw_detach_address_callback *to_detach_address;
+  hw_io_read_buffer_method *to_io_read_buffer;
+  hw_io_write_buffer_method *to_io_write_buffer;
+  hw_dma_read_buffer_method *to_dma_read_buffer;
+  hw_dma_write_buffer_method *to_dma_write_buffer;
+  hw_attach_address_method *to_attach_address;
+  hw_detach_address_method *to_detach_address;
 
   /* More complicated callbacks */
-  hw_ioctl_callback *to_ioctl;
+  hw_ioctl_method *to_ioctl;
   int trace_of_hw_p;
 
   /* address callbacks */
-  hw_unit_decode_callback *to_unit_decode;
-  hw_unit_encode_callback *to_unit_encode;
-  hw_unit_address_to_attach_address_callback *to_unit_address_to_attach_address;
-  hw_unit_size_to_attach_size_callback *to_unit_size_to_attach_size;
+  hw_unit_decode_method *to_unit_decode;
+  hw_unit_encode_method *to_unit_encode;
+  hw_unit_address_to_attach_address_method *to_unit_address_to_attach_address;
+  hw_unit_size_to_attach_size_method *to_unit_size_to_attach_size;
 
   /* related data */
   struct hw_property_data *properties_of_hw;
@@ -524,6 +527,8 @@ struct hw {
   struct hw_base_data *base_of_hw;
   struct hw_alloc_data *alloc_of_hw;
   struct hw_event_data *events_of_hw;
+  struct hw_handle_data *handles_of_hw;
+  struct hw_instance_data *instances_of_hw;
 
 };