hla: cleanup read/write api
[openocd.git] / src / target / hla_target.c
index 41fe45e6c8781cd8d93b8d26831b1891d3a6b4f6..dc81ee89a6d39955808867fd3318188fe853e93d 100644 (file)
@@ -157,18 +157,6 @@ static int adapter_store_core_reg_u32(struct target *target,
 
        LOG_DEBUG("%s", __func__);
 
-#ifdef ARMV7_GDB_HACKS
-       /* If the LR register is being modified, make sure it will put us
-        * in "thumb" mode, or an INVSTATE exception will occur. This is a
-        * hack to deal with the fact that gdb will sometimes "forge"
-        * return addresses, and doesn't set the LSB correctly (i.e., when
-        * printing expressions containing function calls, it sets LR = 0.)
-        * Valid exception return codes have bit 0 set too.
-        */
-       if (num == ARMV7M_R14)
-               value |= 0x01;
-#endif
-
        /* NOTE:  we "know" here that the register identifiers used
         * in the v7m header match the Cortex-M3 Debug Core Register
         * Selector values for R0..R15, xPSR, MSP, and PSP.
@@ -271,8 +259,8 @@ static int adapter_examine_debug_reason(struct target *target)
 static int hl_dcc_read(struct hl_interface_s *hl_if, uint8_t *value, uint8_t *ctrl)
 {
        uint16_t dcrdr;
-       int retval = hl_if->layout->api->read_mem8(hl_if->fd,
-                                                               DCB_DCRDR, sizeof(dcrdr), (uint8_t *)&dcrdr);
+       int retval = hl_if->layout->api->read_mem(hl_if->fd,
+                       DCB_DCRDR, 1, sizeof(dcrdr), (uint8_t *)&dcrdr);
        if (retval == ERROR_OK) {
            *ctrl = (uint8_t)dcrdr;
            *value = (uint8_t)(dcrdr >> 8);
@@ -284,8 +272,7 @@ static int hl_dcc_read(struct hl_interface_s *hl_if, uint8_t *value, uint8_t *ct
                         * to signify we have read data */
                        /* atomically clear just the byte containing the busy bit */
                        static const uint8_t zero;
-                       retval = hl_if->layout->api->write_mem8(
-                                               hl_if->fd, DCB_DCRDR, 1, &zero);
+                       retval = hl_if->layout->api->write_mem(hl_if->fd, DCB_DCRDR, 1, 1, &zero);
                }
        }
        return retval;
@@ -427,7 +414,7 @@ static int adapter_debug_entry(struct target *target)
        /* make sure we clear the vector catch bit */
        adapter->layout->api->write_debug_reg(adapter->fd, DCB_DEMCR, TRCENA);
 
-       r = arm->core_cache->reg_list + ARMV7M_xPSR;
+       r = arm->cpsr;
        xPSR = buf_get_u32(r->value, 0, 32);
 
        /* Are we in an exception handler */
@@ -796,13 +783,7 @@ static int adapter_read_memory(struct target *target, uint32_t address,
                else
                        c = count;
 
-               if (size != 4)
-                       res = adapter->layout->api->read_mem8(adapter->fd,
-                                       address, c, buffer);
-               else
-                       res = adapter->layout->api->read_mem32(adapter->fd,
-                                       address, c, buffer);
-
+               res = adapter->layout->api->read_mem(adapter->fd, address, size, c, buffer);
                if (res != ERROR_OK)
                        return res;
 
@@ -844,13 +825,7 @@ static int adapter_write_memory(struct target *target, uint32_t address,
                else
                        c = count;
 
-               if (size != 4)
-                       res = adapter->layout->api->write_mem8(adapter->fd,
-                                       address, c, buffer);
-               else
-                       res = adapter->layout->api->write_mem32(adapter->fd,
-                                       address, c, buffer);
-
+               res = adapter->layout->api->write_mem(adapter->fd, address, size, c, buffer);
                if (res != ERROR_OK)
                        return res;
 

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)