#ifndef HW_PROPERTIES_H
#define HW_PROPERTIES_H
typedef enum {
array_property,
boolean_property,
#if 0
ihandle_property,
#endif
integer_property,
range_array_property,
reg_array_property,
string_property,
string_array_property,
} hw_property_type;
struct hw_property {
struct hw *owner;
const char *name;
hw_property_type type;
unsigned sizeof_array;
const void *array;
const struct hw_property *original;
object_disposition disposition;
};
#define hw_property_owner(p) ((p)->owner + 0)
#define hw_property_name(p) ((p)->name + 0)
#define hw_property_type(p) ((p)->type + 0)
#define hw_property_array(p) ((p)->array + 0)
#define hw_property_sizeof_array(p) ((p)->sizeof_array + 0)
#define hw_property_original(p) ((p)->original + 0)
#define hw_property_disposition(p) ((p)->disposition + 0)
const struct hw_property *hw_find_property
(struct hw *me,
const char *property);
const struct hw_property *hw_next_property
(const struct hw_property *previous);
void hw_add_array_property
(struct hw *me,
const char *property,
const void *array,
int sizeof_array);
void hw_set_array_property
(struct hw *me,
const char *property,
const void *array,
int sizeof_array);
const struct hw_property *hw_find_array_property
(struct hw *me,
const char *property);
void hw_add_boolean_property
(struct hw *me,
const char *property,
int bool);
int hw_find_boolean_property
(struct hw *me,
const char *property);
#if 0
typedef struct _ihandle_runtime_property_spec {
const char *full_path;
} ihandle_runtime_property_spec;
void hw_add_ihandle_runtime_property
(struct hw *me,
const char *property,
const ihandle_runtime_property_spec *ihandle);
void hw_find_ihandle_runtime_property
(struct hw *me,
const char *property,
ihandle_runtime_property_spec *ihandle);
void hw_set_ihandle_property
(struct hw *me,
const char *property,
hw_instance *ihandle);
hw_instance * hw_find_ihandle_property
(struct hw *me,
const char *property);
#endif
void hw_add_integer_property
(struct hw *me,
const char *property,
signed_cell integer);
signed_cell hw_find_integer_property
(struct hw *me,
const char *property);
int hw_find_integer_array_property
(struct hw *me,
const char *property,
unsigned index,
signed_cell *integer);
typedef struct _range_property_spec {
hw_unit child_address;
hw_unit parent_address;
hw_unit size;
} range_property_spec;
void hw_add_range_array_property
(struct hw *me,
const char *property,
const range_property_spec *ranges,
unsigned nr_ranges);
int hw_find_range_array_property
(struct hw *me,
const char *property,
unsigned index,
range_property_spec *range);
typedef struct _reg_property_spec {
hw_unit address;
hw_unit size;
} reg_property_spec;
void hw_add_reg_array_property
(struct hw *me,
const char *property,
const reg_property_spec *reg,
unsigned nr_regs);
int hw_find_reg_array_property
(struct hw *me,
const char *property,
unsigned index,
reg_property_spec *reg);
void hw_add_string_property
(struct hw *me,
const char *property,
const char *string);
const char *hw_find_string_property
(struct hw *me,
const char *property);
typedef const char *string_property_spec;
void hw_add_string_array_property
(struct hw *me,
const char *property,
const string_property_spec *strings,
unsigned nr_strings);
int hw_find_string_array_property
(struct hw *me,
const char *property,
unsigned index,
string_property_spec *string);
void hw_add_duplicate_property
(struct hw *me,
const char *property,
const struct hw_property *original);
#endif