summaryrefslogtreecommitdiff
path: root/src/target/armv4_5_mmu.c
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2009-10-21 15:36:31 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2009-10-21 15:36:31 +0200
commit1e5daf5886999a8ff01a4957e17c1466d76e022d (patch)
tree858c90393312d7eb60a3162e7f9c017e5ce6ea16 /src/target/armv4_5_mmu.c
parent2d45a10dfd70f9f13a8d07553d728e5025feabb5 (diff)
downloadopenocd+libswd-1e5daf5886999a8ff01a4957e17c1466d76e022d.tar.gz
openocd+libswd-1e5daf5886999a8ff01a4957e17c1466d76e022d.tar.bz2
openocd+libswd-1e5daf5886999a8ff01a4957e17c1466d76e022d.tar.xz
openocd+libswd-1e5daf5886999a8ff01a4957e17c1466d76e022d.zip
retire obsolete mXY_phys commands. Handled by generic memory read/modify commands and target read/write physical memory callbacks.
Diffstat (limited to 'src/target/armv4_5_mmu.c')
-rw-r--r--src/target/armv4_5_mmu.c151
1 files changed, 0 insertions, 151 deletions
diff --git a/src/target/armv4_5_mmu.c b/src/target/armv4_5_mmu.c
index 33800122..4088fd22 100644
--- a/src/target/armv4_5_mmu.c
+++ b/src/target/armv4_5_mmu.c
@@ -169,154 +169,3 @@ int armv4_5_mmu_write_physical(target_t *target, armv4_5_mmu_common_t *armv4_5_m
return retval;
}
-
-int armv4_5_mmu_handle_md_phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc, target_t *target, armv4_5_mmu_common_t *armv4_5_mmu)
-{
- int count = 1;
- int size = 4;
- uint32_t address = 0;
- int i;
-
- char output[128];
- int output_len;
-
- int retval;
-
- uint8_t *buffer;
-
- if (target->state != TARGET_HALTED)
- {
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
- return ERROR_OK;
- }
-
- if (argc < 1)
- return ERROR_OK;
-
- if (argc == 2)
- count = strtoul(args[1], NULL, 0);
-
- address = strtoul(args[0], NULL, 0);
-
- switch (cmd[2])
- {
- case 'w':
- size = 4;
- break;
- case 'h':
- size = 2;
- break;
- case 'b':
- size = 1;
- break;
- default:
- return ERROR_OK;
- }
-
- buffer = calloc(count, size);
- if ((retval = armv4_5_mmu_read_physical(target, armv4_5_mmu, address, size, count, buffer)) != ERROR_OK)
- {
- switch (retval)
- {
- case ERROR_TARGET_UNALIGNED_ACCESS:
- command_print(cmd_ctx, "error: address not aligned");
- break;
- case ERROR_TARGET_NOT_HALTED:
- command_print(cmd_ctx, "error: target must be halted for memory accesses");
- break;
- case ERROR_TARGET_DATA_ABORT:
- command_print(cmd_ctx, "error: access caused data abort, system possibly corrupted");
- break;
- default:
- command_print(cmd_ctx, "error: unknown error");
- }
- }
-
- output_len = 0;
-
- for (i = 0; i < count; i++)
- {
- if (i%8 == 0)
- output_len += snprintf(output + output_len, 128 - output_len, "0x%8.8" PRIx32 ": ", address + (i*size));
-
- switch (size)
- {
- case 4:
- output_len += snprintf(output + output_len, 128 - output_len, "%8.8" PRIx32 " ", target_buffer_get_u32(target, &buffer[i*4]));
- break;
- case 2:
- output_len += snprintf(output + output_len, 128 - output_len, "%4.4x ", target_buffer_get_u16(target, &buffer[i*2]));
- break;
- case 1:
- output_len += snprintf(output + output_len, 128 - output_len, "%2.2x ", buffer[i*1]);
- break;
- }
-
- if ((i % 8 == 7) || (i == count - 1))
- {
- command_print(cmd_ctx, "%s", output);
- output_len = 0;
- }
- }
-
- free(buffer);
-
- return ERROR_OK;
-}
-
-int armv4_5_mmu_handle_mw_phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc, target_t *target, armv4_5_mmu_common_t *armv4_5_mmu)
-{
- uint32_t address = 0;
- uint32_t value = 0;
- int retval;
- uint8_t value_buf[4];
-
- if (target->state != TARGET_HALTED)
- {
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
- return ERROR_OK;
- }
-
- if (argc < 2)
- return ERROR_OK;
-
- address = strtoul(args[0], NULL, 0);
- value = strtoul(args[1], NULL, 0);
-
- switch (cmd[2])
- {
- case 'w':
- target_buffer_set_u32(target, value_buf, value);
- retval = armv4_5_mmu_write_physical(target, armv4_5_mmu, address, 4, 1, value_buf);
- break;
- case 'h':
- target_buffer_set_u16(target, value_buf, value);
- retval = armv4_5_mmu_write_physical(target, armv4_5_mmu, address, 2, 1, value_buf);
- break;
- case 'b':
- value_buf[0] = value;
- retval = armv4_5_mmu_write_physical(target, armv4_5_mmu, address, 1, 1, value_buf);
- break;
- default:
- return ERROR_OK;
- }
-
- switch (retval)
- {
- case ERROR_TARGET_UNALIGNED_ACCESS:
- command_print(cmd_ctx, "error: address not aligned");
- break;
- case ERROR_TARGET_DATA_ABORT:
- command_print(cmd_ctx, "error: access caused data abort, system possibly corrupted");
- break;
- case ERROR_TARGET_NOT_HALTED:
- command_print(cmd_ctx, "error: target must be halted for memory accesses");
- break;
- case ERROR_OK:
- break;
- default:
- command_print(cmd_ctx, "error: unknown error");
- }
-
- return ERROR_OK;
-}