1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
5 * Copyright (C) 2007,2008 Øyvind Harboe *
6 * oyvind.harboe@zylin.com *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
20 ***************************************************************************/
22 #ifndef OPENOCD_TARGET_REGISTER_H
23 #define OPENOCD_TARGET_REGISTER_H
44 REG_TYPE_ARCH_DEFINED,
51 struct reg_data_type_vector {
52 struct reg_data_type *type;
56 struct reg_data_type_union_field {
58 struct reg_data_type *type;
59 struct reg_data_type_union_field *next;
62 struct reg_data_type_union {
63 struct reg_data_type_union_field *fields;
66 struct reg_data_type_bitfield {
71 struct reg_data_type_struct_field {
75 struct reg_data_type_bitfield *bitfield;
76 struct reg_data_type *type;
78 struct reg_data_type_struct_field *next;
81 struct reg_data_type_struct {
83 struct reg_data_type_struct_field *fields;
86 struct reg_data_type_flags_field {
88 struct reg_data_type_bitfield *bitfield;
89 struct reg_data_type_flags_field *next;
92 struct reg_data_type_flags {
94 struct reg_data_type_flags_field *fields;
97 enum reg_data_type_class {
98 REG_TYPE_CLASS_VECTOR,
100 REG_TYPE_CLASS_STRUCT,
101 REG_TYPE_CLASS_FLAGS,
104 struct reg_data_type {
107 enum reg_data_type_class type_class;
109 struct reg_data_type_vector *reg_type_vector;
110 struct reg_data_type_union *reg_type_union;
111 struct reg_data_type_struct *reg_type_struct;
112 struct reg_data_type_flags *reg_type_flags;
119 struct reg_feature *feature;
126 struct reg_data_type *reg_data_type;
129 const struct reg_arch_type *type;
134 struct reg_cache *next;
135 struct reg *reg_list;
139 struct reg_arch_type {
140 int (*get)(struct reg *reg);
141 int (*set)(struct reg *reg, uint8_t *buf);
144 struct reg *register_get_by_name(struct reg_cache *first,
145 const char *name, bool search_all);
146 struct reg_cache **register_get_last_cache_p(struct reg_cache **first);
147 void register_unlink_cache(struct reg_cache **cache_p, const struct reg_cache *cache);
148 void register_cache_invalidate(struct reg_cache *cache);
150 void register_init_dummy(struct reg *reg);
152 #endif /* OPENOCD_TARGET_REGISTER_H */