swim: abstract the transport in stm8 target
[openocd.git] / src / jtag / swim.c
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /*
4 * Copyright (C) 2020 by Antonio Borneo <borneo.antonio@gmail.com
5 *
6 * SWIM (Single Wire Interface Module) is a low-pin-count debug protocol
7 * used by STMicroelectronics MCU family STM8 and documented in UM470
8 * https://www.st.com/resource/en/user_manual/cd00173911.pdf
9 */
10
11 #ifdef HAVE_CONFIG_H
12 #include "config.h"
13 #endif
14
15 #include "interface.h"
16 #include "swim.h"
17 #include "jtag/hla/hla_transport.h"
18 #include "jtag/hla/hla_interface.h"
19 #include "jtag/hla/hla_layout.h"
20
21 extern struct adapter_driver *adapter_driver;
22
23 int swim_system_reset(void)
24 {
25 assert(adapter_driver->hla_if);
26
27 return adapter_driver->hla_if->layout->api->reset(adapter_driver->hla_if->handle);
28 }
29
30 int swim_read_mem(uint32_t addr, uint32_t size, uint32_t count,
31 uint8_t *buffer)
32 {
33 assert(adapter_driver->hla_if);
34
35 return adapter_driver->hla_if->layout->api->read_mem(adapter_driver->hla_if->handle, addr, size, count, buffer);
36 }
37
38 int swim_write_mem(uint32_t addr, uint32_t size, uint32_t count,
39 const uint8_t *buffer)
40 {
41 assert(adapter_driver->hla_if);
42
43 return adapter_driver->hla_if->layout->api->write_mem(adapter_driver->hla_if->handle, addr, size, count, buffer);
44 }
45
46 int swim_reconnect(void)
47 {
48 assert(adapter_driver->hla_if);
49
50 return adapter_driver->hla_if->layout->api->state(adapter_driver->hla_if->handle);
51 }

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)