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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [sim/] [common/] [hw-properties.h] - Diff between revs 835 and 841

Only display areas with differences | Details | Blame | View Log

Rev 835 Rev 841
/* The common simulator framework for GDB, the GNU Debugger.
/* The common simulator framework for GDB, the GNU Debugger.
 
 
   Copyright 2002, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
   Copyright 2002, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 
   Contributed by Andrew Cagney and Red Hat.
   Contributed by Andrew Cagney and Red Hat.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   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
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 
 
#ifndef HW_PROPERTIES_H
#ifndef HW_PROPERTIES_H
#define HW_PROPERTIES_H
#define HW_PROPERTIES_H
 
 
/* The following are valid property types.  The property `array' is
/* The following are valid property types.  The property `array' is
   for generic untyped data. */
   for generic untyped data. */
 
 
typedef enum {
typedef enum {
  array_property,
  array_property,
  boolean_property,
  boolean_property,
#if 0
#if 0
  ihandle_property, /*runtime*/
  ihandle_property, /*runtime*/
#endif
#endif
  integer_property,
  integer_property,
  range_array_property,
  range_array_property,
  reg_array_property,
  reg_array_property,
  string_property,
  string_property,
  string_array_property,
  string_array_property,
} hw_property_type;
} hw_property_type;
 
 
struct hw_property {
struct hw_property {
  struct hw *owner;
  struct hw *owner;
  const char *name;
  const char *name;
  hw_property_type type;
  hw_property_type type;
  unsigned sizeof_array;
  unsigned sizeof_array;
  const void *array;
  const void *array;
  const struct hw_property *original;
  const struct hw_property *original;
  object_disposition disposition;
  object_disposition disposition;
};
};
 
 
#define hw_property_owner(p) ((p)->owner + 0)
#define hw_property_owner(p) ((p)->owner + 0)
#define hw_property_name(p) ((p)->name + 0)
#define hw_property_name(p) ((p)->name + 0)
#define hw_property_type(p) ((p)->type + 0)
#define hw_property_type(p) ((p)->type + 0)
#define hw_property_array(p) ((p)->array + 0)
#define hw_property_array(p) ((p)->array + 0)
#define hw_property_sizeof_array(p) ((p)->sizeof_array + 0)
#define hw_property_sizeof_array(p) ((p)->sizeof_array + 0)
#define hw_property_original(p) ((p)->original + 0)
#define hw_property_original(p) ((p)->original + 0)
#define hw_property_disposition(p) ((p)->disposition + 0)
#define hw_property_disposition(p) ((p)->disposition + 0)
 
 
 
 
/* Find/iterate over properites attached to a device.
/* Find/iterate over properites attached to a device.
 
 
   To iterate over all properties attached to a device, call
   To iterate over all properties attached to a device, call
   hw_find_property (.., NULL) and then hw_property_next. */
   hw_find_property (.., NULL) and then hw_property_next. */
 
 
const struct hw_property *hw_find_property
const struct hw_property *hw_find_property
(struct hw *me,
(struct hw *me,
 const char *property);
 const char *property);
 
 
const struct hw_property *hw_next_property
const struct hw_property *hw_next_property
(const struct hw_property *previous);
(const struct hw_property *previous);
 
 
 
 
/* Manipulate the properties belonging to a given device.
/* Manipulate the properties belonging to a given device.
 
 
   HW_ADD_* will, if the property is not already present, add a
   HW_ADD_* will, if the property is not already present, add a
   property to the device.  Adding a property to a device after it has
   property to the device.  Adding a property to a device after it has
   been created is a checked run-time error (use HW_SET_*).
   been created is a checked run-time error (use HW_SET_*).
 
 
   HW_SET_* will always update (or create) the property so that it has
   HW_SET_* will always update (or create) the property so that it has
   the specified value.  Changing the type of a property is a checked
   the specified value.  Changing the type of a property is a checked
   run-time error.
   run-time error.
 
 
   FIND returns the specified properties value.  It is a checked
   FIND returns the specified properties value.  It is a checked
   runtime error to either request a nonexistant property or to
   runtime error to either request a nonexistant property or to
   request a property using the wrong type. Code locating a property
   request a property using the wrong type. Code locating a property
   should first check its type (using hw_find_property above) and then
   should first check its type (using hw_find_property above) and then
   obtain its value using the below.
   obtain its value using the below.
 
 
   Naming convention:
   Naming convention:
 
 
   void hw_add_<type>_property(struct hw *, const char *, <type>)
   void hw_add_<type>_property(struct hw *, const char *, <type>)
   void hw_add_*_array_property(struct hw *, const char *, const <type>*, int)
   void hw_add_*_array_property(struct hw *, const char *, const <type>*, int)
   void hw_set_*_property(struct hw *, const char *, <type>)
   void hw_set_*_property(struct hw *, const char *, <type>)
   void hw_set_*_array_property(struct hw *, const char *, const <type>*, int)
   void hw_set_*_array_property(struct hw *, const char *, const <type>*, int)
   <type> hw_find_*_property(struct hw *, const char *)
   <type> hw_find_*_property(struct hw *, const char *)
   int hw_find_*_array_property(struct hw *, const char *, int, <type>*)
   int hw_find_*_array_property(struct hw *, const char *, int, <type>*)
 
 
   */
   */
 
 
 
 
void hw_add_array_property
void hw_add_array_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 const void *array,
 const void *array,
 int sizeof_array);
 int sizeof_array);
 
 
void hw_set_array_property
void hw_set_array_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 const void *array,
 const void *array,
 int sizeof_array);
 int sizeof_array);
 
 
const struct hw_property *hw_find_array_property
const struct hw_property *hw_find_array_property
(struct hw *me,
(struct hw *me,
 const char *property);
 const char *property);
 
 
 
 
 
 
void hw_add_boolean_property
void hw_add_boolean_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 int boolean);
 int boolean);
 
 
int hw_find_boolean_property
int hw_find_boolean_property
(struct hw *me,
(struct hw *me,
 const char *property);
 const char *property);
 
 
 
 
 
 
#if 0
#if 0
typedef struct _ihandle_runtime_property_spec {
typedef struct _ihandle_runtime_property_spec {
  const char *full_path;
  const char *full_path;
} ihandle_runtime_property_spec;
} ihandle_runtime_property_spec;
 
 
void hw_add_ihandle_runtime_property
void hw_add_ihandle_runtime_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 const ihandle_runtime_property_spec *ihandle);
 const ihandle_runtime_property_spec *ihandle);
 
 
void hw_find_ihandle_runtime_property
void hw_find_ihandle_runtime_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 ihandle_runtime_property_spec *ihandle);
 ihandle_runtime_property_spec *ihandle);
 
 
void hw_set_ihandle_property
void hw_set_ihandle_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 hw_instance *ihandle);
 hw_instance *ihandle);
 
 
hw_instance * hw_find_ihandle_property
hw_instance * hw_find_ihandle_property
(struct hw *me,
(struct hw *me,
 const char *property);
 const char *property);
#endif
#endif
 
 
 
 
void hw_add_integer_property
void hw_add_integer_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 signed_cell integer);
 signed_cell integer);
 
 
signed_cell hw_find_integer_property
signed_cell hw_find_integer_property
(struct hw *me,
(struct hw *me,
 const char *property);
 const char *property);
 
 
int hw_find_integer_array_property
int hw_find_integer_array_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 unsigned index,
 unsigned index,
 signed_cell *integer);
 signed_cell *integer);
 
 
 
 
 
 
typedef struct _range_property_spec {
typedef struct _range_property_spec {
  hw_unit child_address;
  hw_unit child_address;
  hw_unit parent_address;
  hw_unit parent_address;
  hw_unit size;
  hw_unit size;
} range_property_spec;
} range_property_spec;
 
 
void hw_add_range_array_property
void hw_add_range_array_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 const range_property_spec *ranges,
 const range_property_spec *ranges,
 unsigned nr_ranges);
 unsigned nr_ranges);
 
 
int hw_find_range_array_property
int hw_find_range_array_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 unsigned index,
 unsigned index,
 range_property_spec *range);
 range_property_spec *range);
 
 
 
 
 
 
typedef struct _reg_property_spec {
typedef struct _reg_property_spec {
  hw_unit address;
  hw_unit address;
  hw_unit size;
  hw_unit size;
} reg_property_spec;
} reg_property_spec;
 
 
void hw_add_reg_array_property
void hw_add_reg_array_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 const reg_property_spec *reg,
 const reg_property_spec *reg,
 unsigned nr_regs);
 unsigned nr_regs);
 
 
int hw_find_reg_array_property
int hw_find_reg_array_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 unsigned index,
 unsigned index,
 reg_property_spec *reg);
 reg_property_spec *reg);
 
 
 
 
 
 
void hw_add_string_property
void hw_add_string_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 const char *string);
 const char *string);
 
 
const char *hw_find_string_property
const char *hw_find_string_property
(struct hw *me,
(struct hw *me,
 const char *property);
 const char *property);
 
 
 
 
 
 
typedef const char *string_property_spec;
typedef const char *string_property_spec;
 
 
void hw_add_string_array_property
void hw_add_string_array_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 const string_property_spec *strings,
 const string_property_spec *strings,
 unsigned nr_strings);
 unsigned nr_strings);
 
 
int hw_find_string_array_property
int hw_find_string_array_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 unsigned index,
 unsigned index,
 string_property_spec *string);
 string_property_spec *string);
 
 
 
 
 
 
void hw_add_duplicate_property
void hw_add_duplicate_property
(struct hw *me,
(struct hw *me,
 const char *property,
 const char *property,
 const struct hw_property *original);
 const struct hw_property *original);
 
 
#endif
#endif
 
 

powered by: WebSVN 2.1.0

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