25 assert(addr_end >=
addr || addr_end == 0);
34 uint32_t
count,
void *buf)
38 LOG_DEBUG(
"Write 4-byte memory block: addr=0x%08" PRIx32
", count=%" PRIu32,
61 uint32_t
count,
void *buf)
66 uint8_t buffer_te[
sizeof(uint32_t)];
67 uint8_t halfword_te[
sizeof(uint16_t)];
69 LOG_DEBUG(
"Write 2-byte memory block: addr=0x%08" PRIx32
", count=%" PRIu32,
81 for (i = 0; i <
count; i++) {
93 (
addr + i *
sizeof(uint16_t)) & ~3u, 4, 1);
95 (
addr + i *
sizeof(uint16_t)) & ~3u, 1, &buffer_he,
102 memcpy(buffer_te + ((
addr + i *
sizeof(uint16_t)) & 3u),
103 halfword_te,
sizeof(uint16_t));
108 (
addr + i *
sizeof(uint16_t)) & ~3u, 1, &buffer_he));
119 uint32_t
count,
void *buf)
124 uint8_t buffer_te[
sizeof(uint32_t)];
127 LOG_DEBUG(
"Write 1-byte memory block: addr=0x%08" PRIx32
", count=%" PRIu32,
136 for (i = 0; i <
count; i++) {
143 memcpy(buffer_te + ((
addr + i) & 3), (uint8_t *)buf + i, 1);
173 if (((
size == 4) && (address & 0x3u)) || ((
size == 2) && (address & 0x1u)))
182 tunnel = calloc(1,
count *
size *
sizeof(uint8_t));
204 }
else if (
size == 2) {
219 uint32_t
size, uint32_t
count,
void *buf)
243 uint32_t words_to_read, bytes_to_read;
247 ", count=%" PRIu32, address,
size,
count);
258 if (((
size == 4) && (address & 0x3u)) || ((
size == 2) && (address & 0x1u)))
265 bytes_to_read = (
count *
size + 3 + (address & 3u)) & ~3u;
266 words_to_read = bytes_to_read >> 2;
267 tunnel_he = calloc(1, bytes_to_read);
268 tunnel_te = calloc(1, bytes_to_read);
270 if (!tunnel_he || !tunnel_te) {
279 words_to_read, tunnel_he);
292 words_to_read, tunnel_he);
294 memcpy(
buffer, tunnel_te + (address & 3u),
295 count *
sizeof(uint16_t));
299 words_to_read, tunnel_he);
int arc_cache_flush(struct target *target)
int arc_cache_invalidate(struct target *target)
static struct arc_common * target_to_arc(struct target *target)
#define CHECK_RETVAL(action)
int arc_jtag_read_memory(struct arc_jtag *jtag_info, uint32_t addr, uint32_t count, uint32_t *buffer, bool slow_memory)
Read a sequence of 4-byte words from target memory.
int arc_jtag_write_memory(struct arc_jtag *jtag_info, uint32_t addr, uint32_t count, const uint32_t *buffer)
Write a sequence of 4-byte words into target memory.
int arc_mem_read(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
static int arc_mem_read_block(struct target *target, target_addr_t addr, uint32_t size, uint32_t count, void *buf)
int arc_mem_write(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
static int arc_mem_write_block32(struct target *target, uint32_t addr, uint32_t count, void *buf)
static int arc_mem_write_block16(struct target *target, uint32_t addr, uint32_t count, void *buf)
static bool arc_mem_is_slow_memory(struct arc_common *arc, uint32_t addr, uint32_t size, uint32_t count)
static int arc_mem_write_block8(struct target *target, uint32_t addr, uint32_t count, void *buf)
#define ERROR_COMMAND_SYNTAX_ERROR
#define LOG_WARNING(expr ...)
#define LOG_TARGET_ERROR(target, fmt_str,...)
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
target_addr_t addr
Start address to search for the control block.
size_t size
Size of the control block search area.
struct arc_jtag jtag_info
void target_buffer_get_u16_array(struct target *target, const uint8_t *buffer, uint32_t count, uint16_t *dstbuf)
void target_buffer_set_u16(struct target *target, uint8_t *buffer, uint16_t value)
void target_buffer_set_u32(struct target *target, uint8_t *buffer, uint32_t value)
void target_buffer_get_u32_array(struct target *target, const uint8_t *buffer, uint32_t count, uint32_t *dstbuf)
void target_buffer_set_u32_array(struct target *target, uint8_t *buffer, uint32_t count, const uint32_t *srcbuf)
uint32_t target_buffer_get_u32(struct target *target, const uint8_t *buffer)
#define ERROR_TARGET_NOT_HALTED
#define ERROR_TARGET_UNALIGNED_ACCESS