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
16 #define SWIM_FREQ_LOW 363
17 #define SWIM_FREQ_HIGH 800
21 * Send SRST (system reset) command to target.
23 * @return ERROR_OK on success, else a fault code.
28 * Read target memory through ROTF (read on-the-fly) command.
30 * @param addr Start address to read data from target memory.
31 * @param size Size in bytes of data units, 1, 2 or 4.
32 * @param count Number of units (size units, not bytes) to read.
33 * @param buffer Data buffer to receive data.
34 * @return ERROR_OK on success, else a fault code.
36 int (*read_mem
)(uint32_t addr
, uint32_t size
, uint32_t count
,
40 * Write target memory through WOTF (write on-the-fly) command.
42 * @param addr Start address to write data to target memory.
43 * @param size Size in bytes of data units, 1, 2 or 4.
44 * @param count Number of units (size units, not bytes) to write.
45 * @param buffer Data buffer to write.
46 * @return ERROR_OK on success, else a fault code.
48 int (*write_mem
)(uint32_t addr
, uint32_t size
, uint32_t count
,
49 const uint8_t *buffer
);
52 * Reconnect to the target.
53 * Should be reworked to be more generic and not linked to current
54 * implementation in stlink driver.
56 * @return ERROR_OK on success, else a fault code.
58 int (*reconnect
)(void);
61 int swim_system_reset(void);
62 int swim_read_mem(uint32_t addr
, uint32_t size
, uint32_t count
,
64 int swim_write_mem(uint32_t addr
, uint32_t size
, uint32_t count
,
65 const uint8_t *buffer
);
66 int swim_reconnect(void);
68 #endif /* OPENOCD_JTAG_SWIM_H */