#endif
#include "armv4_5.h"
+#include "etm.h"
#include "etb.h"
#include "image.h"
#include "arm_disassembler.h"
* ARM IHI 0014O ... Embedded Trace Macrocell, Architecture Specification
*/
-#define ARRAY_SIZE(x) ((int)(sizeof(x)/sizeof((x)[0])))
-
enum {
RO, /* read/only */
WO, /* write/only */
{ 0x6f, 32, RO, 0x20, "ETM_contextid_comparator_mask", }
#endif
-static int etm_reg_arch_type = -1;
-
static int etm_get_reg(struct reg *reg);
static int etm_read_reg_w_check(struct reg *reg,
uint8_t* check_value, uint8_t* check_mask);
static struct command *etm_cmd;
+static const struct reg_arch_type etm_scan6_type = {
+ .get = etm_get_reg,
+ .set = etm_set_reg_w_exec,
+};
/* Look up register by ID ... most ETM instances only
* support a subset of the possible registers.
reg->size = r->size;
reg->value = &ereg->value;
reg->arch_info = ereg;
- reg->arch_type = etm_reg_arch_type;
+ reg->type = &etm_scan6_type;
reg++;
cache->num_regs++;
struct etm_reg *arch_info = NULL;
unsigned bcd_vers, config;
- /* register a register arch-type for etm registers only once */
- if (etm_reg_arch_type == -1)
- etm_reg_arch_type = register_reg_arch_type(etm_get_reg,
- etm_set_reg_w_exec);
-
/* the actual registers are kept in two arrays */
reg_list = calloc(128, sizeof(struct reg));
arch_info = calloc(128, sizeof(struct etm_reg));
{
int i;
int section = -1;
- uint32_t size_read;
+ size_t size_read;
uint32_t opcode;
int retval;
etmv1_tracemode_t tracemode = etm->tracemode;
- switch (argc)
+ switch (CMD_ARGC)
{
case 0:
break;
struct etm_context *etm_ctx;
int i;
- if (argc != 5)
+ if (CMD_ARGC != 5)
return ERROR_COMMAND_SYNTAX_ERROR;
target = get_target(args[0]);
struct arm *arm;
struct etm_context *etm_ctx;
- if (argc < 1)
+ if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "usage: etm image <file> [base address] [type]");
return ERROR_FAIL;
etm_ctx->image->start_address_set = 0;
/* a base address isn't always necessary, default to 0x0 (i.e. don't relocate) */
- if (argc >= 2)
+ if (CMD_ARGC >= 2)
{
etm_ctx->image->base_address_set = 1;
COMMAND_PARSE_NUMBER(int, args[1], etm_ctx->image->base_address);
etm_ctx->image->base_address_set = 0;
}
- if (image_open(etm_ctx->image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK)
+ if (image_open(etm_ctx->image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK)
{
free(etm_ctx->image);
etm_ctx->image = NULL;
struct etm_context *etm_ctx;
uint32_t i;
- if (argc != 1)
+ if (CMD_ARGC != 1)
{
command_print(cmd_ctx, "usage: etm dump <file>");
return ERROR_FAIL;
struct etm_context *etm_ctx;
uint32_t i;
- if (argc != 1)
+ if (CMD_ARGC != 1)
{
command_print(cmd_ctx, "usage: etm load <file>");
return ERROR_FAIL;
return ERROR_FAIL;
}
- if (argc > 0)
+ if (CMD_ARGC > 0)
{
uint32_t new_value;
COMMAND_PARSE_NUMBER(u32, args[0], new_value);