732fe1e6ae1aca6e572445a43ba4b9e1f89370d4
[openocd.git] / 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, see <http://www.gnu.org/licenses/>. *
20 ***************************************************************************/
21
22 #ifndef OPENOCD_JTAG_HLA_HLA_LAYOUT_H
23 #define OPENOCD_JTAG_HLA_HLA_LAYOUT_H
24
25 #include <target/armv7m_trace.h>
26 #include <target/arm_tpiu_swo.h>
27
28 /** */
29 struct hl_interface_s;
30 struct hl_interface_param_s;
31
32 /** */
33 extern struct hl_layout_api_s stlink_usb_layout_api;
34 extern struct hl_layout_api_s icdi_usb_layout_api;
35 extern struct hl_layout_api_s nulink_usb_layout_api;
36
37 /** */
38 struct hl_layout_api_s {
39 /** */
40 int (*open)(struct hl_interface_param_s *param, void **handle);
41 /** */
42 int (*close)(void *handle);
43 /** */
44 int (*reset)(void *handle);
45 /** */
46 int (*assert_srst)(void *handle, int srst);
47 /** */
48 int (*run)(void *handle);
49 /** */
50 int (*halt)(void *handle);
51 /** */
52 int (*step)(void *handle);
53 /** */
54 int (*read_regs)(void *handle);
55 /**
56 * Read one register from the target
57 *
58 * @param handle A pointer to the device-specific handle
59 * @param regsel Register selection index compatible with all the
60 * values allowed by armv7m DCRSR.REGSEL
61 * @param val A pointer to retrieve the register value
62 * @returns ERROR_OK on success, or an error code on failure.
63 */
64 int (*read_reg)(void *handle, unsigned int regsel, uint32_t *val);
65 /**
66 * Write one register to the target
67 * @param handle A pointer to the device-specific handle
68 * @param regsel Register selection index compatible with all the
69 * values allowed by armv7m DCRSR.REGSEL
70 * @param val The value to be written in the register
71 * @returns ERROR_OK on success, or an error code on failure.
72 */
73 int (*write_reg)(void *handle, unsigned int regsel, uint32_t val);
74 /** */
75 int (*read_mem)(void *handle, uint32_t addr, uint32_t size,
76 uint32_t count, uint8_t *buffer);
77 /** */
78 int (*write_mem)(void *handle, uint32_t addr, uint32_t size,
79 uint32_t count, const uint8_t *buffer);
80 /** */
81 int (*write_debug_reg)(void *handle, uint32_t addr, uint32_t val);
82 /**
83 * Read the idcode of the target connected to the adapter
84 *
85 * If the adapter doesn't support idcode retrieval, this callback should
86 * store 0 to indicate a wildcard match.
87 *
88 * @param handle A pointer to the device-specific handle
89 * @param idcode Storage for the detected idcode
90 * @returns ERROR_OK on success, or an error code on failure.
91 */
92 int (*idcode)(void *handle, uint32_t *idcode);
93 /** */
94 int (*override_target)(const char *targetname);
95 /** */
96 int (*custom_command)(void *handle, const char *command);
97 /** */
98 int (*speed)(void *handle, int khz, bool query);
99 /**
100 * Configure trace parameters for the adapter
101 *
102 * @param handle A handle to adapter
103 * @param enabled Whether to enable trace
104 * @param pin_protocol Configured pin protocol
105 * @param port_size Trace port width for sync mode
106 * @param trace_freq A pointer to the configured trace
107 * frequency; if it points to 0, the adapter driver must write
108 * its maximum supported rate there
109 * @returns ERROR_OK on success, an error code on failure.
110 */
111 int (*config_trace)(void *handle, bool enabled,
112 enum tpiu_pin_protocol pin_protocol, uint32_t port_size,
113 unsigned int *trace_freq, unsigned int traceclkin_freq,
114 uint16_t *prescaler);
115 /**
116 * Poll for new trace data
117 *
118 * @param handle A handle to adapter
119 * @param buf A pointer to buffer to store received data
120 * @param size A pointer to buffer size; must be filled with
121 * the actual amount of bytes written
122 *
123 * @returns ERROR_OK on success, an error code on failure.
124 */
125 int (*poll_trace)(void *handle, uint8_t *buf, size_t *size);
126 /** */
127 enum target_state (*state)(void *fd);
128 };
129
130 /** */
131 struct hl_layout {
132 /** */
133 char *name;
134 /** */
135 int (*open)(struct hl_interface_s *adapter);
136 /** */
137 int (*close)(struct hl_interface_s *adapter);
138 /** */
139 struct hl_layout_api_s *api;
140 };
141
142 /** */
143 const struct hl_layout *hl_layout_get_list(void);
144 /** */
145 int hl_layout_init(struct hl_interface_s *adapter);
146
147 #endif /* OPENOCD_JTAG_HLA_HLA_LAYOUT_H */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)