target: add deprecated target name support
[fw/openocd] / src / jtag / hla / hla_layout.h
1 /***************************************************************************
2  *   Copyright (C) 2011 by Mathias Kuester                                 *
3  *   Mathias Kuester <kesmtp@freenet.de>                                   *
4  *                                                                         *
5  *   Copyright (C) 2012 by Spencer Oliver                                  *
6  *   spen@spen-soft.co.uk                                                  *
7  *                                                                         *
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.                                   *
12  *                                                                         *
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.                          *
17  *                                                                         *
18  *   You should have received a copy of the GNU General Public License     *
19  *   along with this program; if not, write to the                         *
20  *   Free Software Foundation, Inc.,                                       *
21  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
22  ***************************************************************************/
23
24 #ifndef _HL_LAYOUT_H
25 #define _HL_LAYOUT_H
26
27 /** */
28 struct hl_interface_s;
29 struct hl_interface_param_s;
30
31 /** */
32 extern struct hl_layout_api_s stlink_usb_layout_api;
33
34 /** */
35 struct hl_layout_api_s {
36         /** */
37         int (*open) (struct hl_interface_param_s *param, void **fd);
38         /** */
39         int (*close) (void *fd);
40         /** */
41         int (*reset) (void *fd);
42         /** */
43         int (*assert_srst) (void *fd, int srst);
44         /** */
45         int (*run) (void *fd);
46         /** */
47         int (*halt) (void *fd);
48         /** */
49         int (*step) (void *fd);
50         /** */
51         int (*read_regs) (void *fd);
52         /** */
53         int (*read_reg) (void *fd, int num, uint32_t *val);
54         /** */
55         int (*write_reg) (void *fd, int num, uint32_t val);
56         /** */
57         int (*read_mem8) (void *handle, uint32_t addr, uint16_t len,
58                            uint8_t *buffer);
59         /** */
60         int (*write_mem8) (void *handle, uint32_t addr, uint16_t len,
61                             const uint8_t *buffer);
62         /** */
63         int (*read_mem32) (void *handle, uint32_t addr, uint16_t len,
64                            uint8_t *buffer);
65         /** */
66         int (*write_mem32) (void *handle, uint32_t addr, uint16_t len,
67                             const uint8_t *buffer);
68         /** */
69         int (*write_debug_reg) (void *handle, uint32_t addr, uint32_t val);
70         /** */
71         int (*idcode) (void *fd, uint32_t *idcode);
72         /** */
73         enum target_state (*state) (void *fd);
74 };
75
76 /** */
77 struct hl_layout {
78         /** */
79         char *name;
80         /** */
81         int (*open) (struct hl_interface_s *adapter);
82         /** */
83         int (*close) (struct hl_interface_s *adapter);
84         /** */
85         struct hl_layout_api_s *api;
86 };
87
88 /** */
89 const struct hl_layout *hl_layout_get_list(void);
90 /** */
91 int hl_layout_init(struct hl_interface_s *adapter);
92
93 #endif /* _HL_LAYOUT_H */