- prepare OpenOCD for branching, created ./trunk/
[fw/openocd] / src / target / register.h
1 /***************************************************************************
2  *   Copyright (C) 2005 by Dominic Rath                                    *
3  *   Dominic.Rath@gmx.de                                                   *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20 #ifndef REGISTER_H
21 #define REGISTER_H
22
23 #include "types.h"
24 #include "target.h"
25
26 struct target_s;
27
28 typedef struct bitfield_desc_s
29 {
30         char *name;
31         int num_bits;
32 } bitfield_desc_t;
33
34 typedef struct reg_s
35 {
36         char *name;
37         u8 *value;
38         int dirty;
39         int valid;
40         int size;
41         bitfield_desc_t *bitfield_desc;
42         int num_bitfields;
43         void *arch_info;
44         int arch_type;
45 } reg_t;
46
47 typedef struct reg_cache_s
48 {
49         char *name;
50         struct reg_cache_s *next;
51         reg_t *reg_list;
52         int num_regs;
53 } reg_cache_t;
54
55 typedef struct reg_arch_type_s
56 {
57         int id;
58         int (*get)(reg_t *reg);
59         int (*set)(reg_t *reg, u32 value);
60         struct reg_arch_type_s *next;
61 } reg_arch_type_t;
62
63 extern reg_t* register_get_by_name(reg_cache_t *first, char *name, int search_all);
64 extern reg_cache_t** register_get_last_cache_p(reg_cache_t **first);
65 extern int register_reg_arch_type(int (*get)(reg_t *reg), int (*set)(reg_t *reg, u32 value));
66 extern reg_arch_type_t* register_get_arch_type(int id);
67
68 #endif /* REGISTER_H */
69