1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Copyright (C) 2020 by Antonio Borneo <borneo.antonio@gmail.com
9 * This file implements support for STMicroelectronics debug protocol SWIM
10 * (Single Wire Interface Module).
13 #ifndef OPENOCD_JTAG_SWIM_H
14 #define OPENOCD_JTAG_SWIM_H
18 * Send SRST (system reset) command to target.
20 * @return ERROR_OK on success, else a fault code.
25 * Read target memory through ROTF (read on-the-fly) command.
27 * @param addr Start address to read data from target memory.
28 * @param size Size in bytes of data units, 1, 2 or 4.
29 * @param count Number of units (size units, not bytes) to read.
30 * @param buffer Data buffer to receive data.
31 * @return ERROR_OK on success, else a fault code.
33 int (*read_mem)(uint32_t addr, uint32_t size, uint32_t count,
37 * Write target memory through WOTF (write on-the-fly) command.
39 * @param addr Start address to write data to target memory.
40 * @param size Size in bytes of data units, 1, 2 or 4.
41 * @param count Number of units (size units, not bytes) to write.
42 * @param buffer Data buffer to write.
43 * @return ERROR_OK on success, else a fault code.
45 int (*write_mem)(uint32_t addr, uint32_t size, uint32_t count,
46 const uint8_t *buffer);
49 * Reconnect to the target.
50 * Should be reworked to be more generic and not linked to current
51 * implementation in stlink driver.
53 * @return ERROR_OK on success, else a fault code.
55 int (*reconnect)(void);
58 int swim_system_reset(void);
59 int swim_read_mem(uint32_t addr, uint32_t size, uint32_t count,
61 int swim_write_mem(uint32_t addr, uint32_t size, uint32_t count,
62 const uint8_t *buffer);
63 int swim_reconnect(void);
65 #endif /* OPENOCD_JTAG_SWIM_H */