adi_v5: Rename AP_REG_* to MEM_AP_REG_* and add LA support
[openocd.git] / src / target / arm_adi_v5.c
index 3df39f9edb2908ef27dd6e7415ffdd989b503822..fd91281b3776253daf36b64ae564ef173c029f02 100644 (file)
@@ -125,7 +125,7 @@ static int dap_setup_accessport_csw(struct adiv5_dap *dap, uint32_t csw)
 
        if (csw != dap->ap_csw_value) {
                /* LOG_DEBUG("DAP: Set CSW %x",csw); */
-               int retval = dap_queue_ap_write(dap, AP_REG_CSW, csw);
+               int retval = dap_queue_ap_write(dap, MEM_AP_REG_CSW, csw);
                if (retval != ERROR_OK)
                        return retval;
                dap->ap_csw_value = csw;
@@ -137,7 +137,7 @@ static int dap_setup_accessport_tar(struct adiv5_dap *dap, uint32_t tar)
 {
        if (tar != dap->ap_tar_value || dap->ap_csw_value & CSW_ADDRINC_MASK) {
                /* LOG_DEBUG("DAP: Set TAR %x",tar); */
-               int retval = dap_queue_ap_write(dap, AP_REG_TAR, tar);
+               int retval = dap_queue_ap_write(dap, MEM_AP_REG_TAR, tar);
                if (retval != ERROR_OK)
                        return retval;
                dap->ap_tar_value = tar;
@@ -149,7 +149,7 @@ static int dap_setup_accessport_tar(struct adiv5_dap *dap, uint32_t tar)
  * Queue transactions setting up transfer parameters for the
  * currently selected MEM-AP.
  *
- * Subsequent transfers using registers like AP_REG_DRW or AP_REG_BD2
+ * Subsequent transfers using registers like MEM_AP_REG_DRW or MEM_AP_REG_BD2
  * initiate data reads or writes using memory or peripheral addresses.
  * If the CSW is configured for it, the TAR may be automatically
  * incremented after each transfer.
@@ -200,7 +200,7 @@ int mem_ap_read_u32(struct adiv5_dap *dap, uint32_t address,
        if (retval != ERROR_OK)
                return retval;
 
-       return dap_queue_ap_read(dap, AP_REG_BD0 | (address & 0xC), value);
+       return dap_queue_ap_read(dap, MEM_AP_REG_BD0 | (address & 0xC), value);
 }
 
 /**
@@ -251,7 +251,7 @@ int mem_ap_write_u32(struct adiv5_dap *dap, uint32_t address,
        if (retval != ERROR_OK)
                return retval;
 
-       return dap_queue_ap_write(dap, AP_REG_BD0 | (address & 0xC),
+       return dap_queue_ap_write(dap, MEM_AP_REG_BD0 | (address & 0xC),
                        value);
 }
 
@@ -379,7 +379,7 @@ int mem_ap_write(struct adiv5_dap *dap, const uint8_t *buffer, uint32_t size, ui
 
                nbytes -= this_size;
 
-               retval = dap_queue_ap_write(dap, AP_REG_DRW, outvalue);
+               retval = dap_queue_ap_write(dap, MEM_AP_REG_DRW, outvalue);
                if (retval != ERROR_OK)
                        break;
 
@@ -397,7 +397,7 @@ int mem_ap_write(struct adiv5_dap *dap, const uint8_t *buffer, uint32_t size, ui
 
        if (retval != ERROR_OK) {
                uint32_t tar;
-               if (dap_queue_ap_read(dap, AP_REG_TAR, &tar) == ERROR_OK
+               if (dap_queue_ap_read(dap, MEM_AP_REG_TAR, &tar) == ERROR_OK
                                && dap_run(dap) == ERROR_OK)
                        LOG_ERROR("Failed to write memory at 0x%08"PRIx32, tar);
                else
@@ -480,7 +480,7 @@ int mem_ap_read(struct adiv5_dap *dap, uint8_t *buffer, uint32_t size, uint32_t
                if (retval != ERROR_OK)
                        break;
 
-               retval = dap_queue_ap_read(dap, AP_REG_DRW, read_ptr++);
+               retval = dap_queue_ap_read(dap, MEM_AP_REG_DRW, read_ptr++);
                if (retval != ERROR_OK)
                        break;
 
@@ -507,7 +507,7 @@ int mem_ap_read(struct adiv5_dap *dap, uint8_t *buffer, uint32_t size, uint32_t
         * at least give the caller what we have. */
        if (retval != ERROR_OK) {
                uint32_t tar;
-               if (dap_queue_ap_read(dap, AP_REG_TAR, &tar) == ERROR_OK
+               if (dap_queue_ap_read(dap, MEM_AP_REG_TAR, &tar) == ERROR_OK
                                && dap_run(dap) == ERROR_OK) {
                        LOG_ERROR("Failed to read memory at 0x%08"PRIx32, tar);
                        if (nbytes > tar - address)
@@ -718,11 +718,11 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
                if (retval != ERROR_OK)
                        continue;
 
-               retval = dap_queue_ap_read(dap, AP_REG_CSW, &csw);
+               retval = dap_queue_ap_read(dap, MEM_AP_REG_CSW, &csw);
                if (retval != ERROR_OK)
                        continue;
 
-               retval = dap_queue_ap_read(dap, AP_REG_CFG, &cfg);
+               retval = dap_queue_ap_read(dap, MEM_AP_REG_CFG, &cfg);
                if (retval != ERROR_OK)
                        continue;
 
@@ -844,10 +844,10 @@ int dap_get_debugbase(struct adiv5_dap *dap, int ap,
        if (ap >= 256)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
-       ap_old = dap->ap_current;
+       ap_old = dap_ap_get_select(dap);
        dap_ap_select(dap, ap);
 
-       retval = dap_queue_ap_read(dap, AP_REG_BASE, dbgbase);
+       retval = dap_queue_ap_read(dap, MEM_AP_REG_BASE, dbgbase);
        if (retval != ERROR_OK)
                return retval;
        retval = dap_queue_ap_read(dap, AP_REG_IDR, apid);
@@ -873,7 +873,7 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int ap,
                return ERROR_COMMAND_SYNTAX_ERROR;
 
        *addr = 0;
-       ap_old = dap->ap_current;
+       ap_old = dap_ap_get_select(dap);
        dap_ap_select(dap, ap);
 
        do {
@@ -992,7 +992,7 @@ static int dap_rom_display(struct command_context *cmd_ctx,
                        uint32_t c_cid0, c_cid1, c_cid2, c_cid3;
                        uint32_t c_pid0, c_pid1, c_pid2, c_pid3, c_pid4;
                        uint32_t component_base;
-                       unsigned part_num;
+                       uint32_t part_num;
                        const char *type, *full;
 
                        component_base = (dbgbase & 0xFFFFF000) + (romentry & 0xFFFFF000);
@@ -1408,7 +1408,7 @@ static int dap_info_command(struct command_context *cmd_ctx,
        if (retval != ERROR_OK)
                return retval;
 
-       ap_old = dap->ap_current;
+       ap_old = dap_ap_get_select(dap);
        dap_ap_select(dap, ap);
 
        /* Now we read ROM table ID registers, ref. ARM IHI 0029B sec  */
@@ -1499,7 +1499,7 @@ COMMAND_HANDLER(dap_baseaddr_command)
         * though they're not common for now.  This should
         * use the ID register to verify it's a MEM-AP.
         */
-       retval = dap_queue_ap_read(dap, AP_REG_BASE, &baseaddr);
+       retval = dap_queue_ap_read(dap, MEM_AP_REG_BASE, &baseaddr);
        if (retval != ERROR_OK)
                return retval;
        retval = dap_run(dap);

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)