Cast 64-bit trace hit_counter to long long; fixes format warning.
[openocd.git] / src / target / oocd_trace.c
index 7fef23d8f946a2885ec1449fd172f0ade6ed949f..f7af10d26bf50cb0ea534b93527d9f607d53fed1 100644 (file)
 
 static int oocd_trace_register_commands(struct command_context_s *cmd_ctx);
 
-static int oocd_trace_read_reg(oocd_trace_t *oocd_trace, int reg, u32 *value)
+static int oocd_trace_read_reg(oocd_trace_t *oocd_trace, int reg, uint32_t *value)
 {
        size_t bytes_written, bytes_read, bytes_to_read;
-       u8 cmd;
+       uint8_t cmd;
 
        cmd = 0x10 | (reg & 0x7);
        bytes_written = write(oocd_trace->tty_fd, &cmd, 1);
@@ -43,7 +43,7 @@ static int oocd_trace_read_reg(oocd_trace_t *oocd_trace, int reg, u32 *value)
        bytes_to_read = 4;
        while (bytes_to_read > 0)
        {
-               bytes_read = read(oocd_trace->tty_fd, ((u8*)value) + 4 - bytes_to_read, bytes_to_read);
+               bytes_read = read(oocd_trace->tty_fd, ((uint8_t*)value) + 4 - bytes_to_read, bytes_to_read);
                bytes_to_read -= bytes_read;
        }
 
@@ -52,10 +52,10 @@ static int oocd_trace_read_reg(oocd_trace_t *oocd_trace, int reg, u32 *value)
        return ERROR_OK;
 }
 
-static int oocd_trace_write_reg(oocd_trace_t *oocd_trace, int reg, u32 value)
+static int oocd_trace_write_reg(oocd_trace_t *oocd_trace, int reg, uint32_t value)
 {
        size_t bytes_written;
-       u8 data[5];
+       uint8_t data[5];
 
        data[0] = 0x18 | (reg & 0x7);
        data[1] = value & 0xff;
@@ -69,11 +69,11 @@ static int oocd_trace_write_reg(oocd_trace_t *oocd_trace, int reg, u32 value)
        return ERROR_OK;
 }
 
-static int oocd_trace_read_memory(oocd_trace_t *oocd_trace, u8 *data, u32 address, u32 size)
+static int oocd_trace_read_memory(oocd_trace_t *oocd_trace, uint8_t *data, uint32_t address, uint32_t size)
 {
        size_t bytes_written, bytes_to_read;
        ssize_t bytes_read;
-       u8 cmd;
+       uint8_t cmd;
 
        oocd_trace_write_reg(oocd_trace, OOCD_TRACE_ADDRESS, address);
        oocd_trace_write_reg(oocd_trace, OOCD_TRACE_SDRAM_COUNTER, size);
@@ -85,7 +85,7 @@ static int oocd_trace_read_memory(oocd_trace_t *oocd_trace, u8 *data, u32 addres
        while (bytes_to_read > 0)
        {
                if ((bytes_read = read(oocd_trace->tty_fd,
-                               ((u8*)data) + (size * 16) - bytes_to_read, bytes_to_read)) < 0)
+                               ((uint8_t*)data) + (size * 16) - bytes_to_read, bytes_to_read)) < 0)
                {
                        LOG_DEBUG("read() returned %zi (%s)", bytes_read, strerror(errno));
                }
@@ -98,7 +98,7 @@ static int oocd_trace_read_memory(oocd_trace_t *oocd_trace, u8 *data, u32 addres
 
 static int oocd_trace_init(etm_context_t *etm_ctx)
 {
-       u8 trash[256];
+       uint8_t trash[256];
        oocd_trace_t *oocd_trace = etm_ctx->capture_driver_priv;
        size_t bytes_read;
 
@@ -146,7 +146,7 @@ static int oocd_trace_init(etm_context_t *etm_ctx)
 static trace_status_t oocd_trace_status(etm_context_t *etm_ctx)
 {
        oocd_trace_t *oocd_trace = etm_ctx->capture_driver_priv;
-       u32 status;
+       uint32_t status;
 
        oocd_trace_read_reg(oocd_trace, OOCD_TRACE_STATUS, &status);
 
@@ -178,11 +178,11 @@ static trace_status_t oocd_trace_status(etm_context_t *etm_ctx)
 static int oocd_trace_read_trace(etm_context_t *etm_ctx)
 {
        oocd_trace_t *oocd_trace = etm_ctx->capture_driver_priv;
-       u32 status, address;
-       u32 first_frame = 0x0;
-       u32 num_frames = 1048576;
-       u8 *trace_data;
-       u32 i;
+       uint32_t status, address;
+       uint32_t first_frame = 0x0;
+       uint32_t num_frames = 1048576;
+       uint8_t *trace_data;
+       uint32_t i;
 
        oocd_trace_read_reg(oocd_trace, OOCD_TRACE_STATUS, &status);
        oocd_trace_read_reg(oocd_trace, OOCD_TRACE_ADDRESS, &address);
@@ -199,7 +199,7 @@ static int oocd_trace_read_trace(etm_context_t *etm_ctx)
        /* read data into temporary array for unpacking
         * one frame from OpenOCD+trace corresponds to 16 trace cycles
         */
-       trace_data = malloc(sizeof(u8) * num_frames * 16);
+       trace_data = malloc(sizeof(uint8_t) * num_frames * 16);
        oocd_trace_read_memory(oocd_trace, trace_data, first_frame, num_frames);
 
        if (etm_ctx->trace_depth > 0)
@@ -236,8 +236,8 @@ static int oocd_trace_read_trace(etm_context_t *etm_ctx)
 static int oocd_trace_start_capture(etm_context_t *etm_ctx)
 {
        oocd_trace_t *oocd_trace = etm_ctx->capture_driver_priv;
-       u32 control = 0x1;      /* 0x1: enabled */
-       u32 trigger_count;
+       uint32_t control = 0x1; /* 0x1: enabled */
+       uint32_t trigger_count;
 
        if (((etm_ctx->portmode & ETM_PORT_MODE_MASK) != ETM_PORT_NORMAL)
                || ((etm_ctx->portmode & ETM_PORT_WIDTH_MASK) != ETM_PORT_4BIT))
@@ -333,7 +333,7 @@ static int handle_oocd_trace_status_command(struct command_context_s *cmd_ctx, c
        armv4_5_common_t *armv4_5;
        arm7_9_common_t *arm7_9;
        oocd_trace_t *oocd_trace;
-       u32 status;
+       uint32_t status;
 
        target = get_current_target(cmd_ctx);
 
@@ -374,7 +374,7 @@ static int handle_oocd_trace_resync_command(struct command_context_s *cmd_ctx, c
        arm7_9_common_t *arm7_9;
        oocd_trace_t *oocd_trace;
        size_t bytes_written;
-       u8 cmd_array[1];
+       uint8_t cmd_array[1];
 
        target = get_current_target(cmd_ctx);
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)