This is an automated email from Gerrit.

Tomas Vanek ([email protected]) just uploaded a new patch set to Gerrit, which you 
can find at http://openocd.zylin.com/2777

-- gerrit

commit de96297105d0f978b62fe8bffffd73191182fd8f
Author: Tomas Vanek <[email protected]>
Date:   Fri Apr 24 07:33:50 2015 +0200

    arm_adi_v5: add dap apreg command for AP register read/write
    
    Direct access to AP registers can be useful for handling vendor specific
    AP like Freescale Kinetis MDM or Atmel SMAP.
    
    Change-Id: Ie2c7160fc6b2e398513eb23e1e52cbb52b88d9bd
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index f7e58d0..c985b89 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -1646,6 +1646,49 @@ COMMAND_HANDLER(dap_apid_command)
        return retval;
 }
 
+COMMAND_HANDLER(dap_apreg_command)
+{
+       struct target *target = get_current_target(CMD_CTX);
+       struct arm *arm = target_to_arm(target);
+       struct adiv5_dap *dap = arm->dap;
+
+       uint32_t apsel, reg, value;
+       int retval;
+       uint32_t apold = dap->ap_current;
+
+       if (CMD_ARGC < 2 || CMD_ARGC > 3)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
+       /* AP address is in bits 31:24 of DP_SELECT */
+       if (apsel >= 256)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], reg);
+       if (reg >= 256 || (reg & 3))
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       dap_ap_select(dap, apsel);
+
+       if (CMD_ARGC == 3) {
+               COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], value);
+               retval = dap_queue_ap_write(dap, reg, value);
+       } else {
+               retval = dap_queue_ap_read(dap, reg, &value);
+       }
+       if (retval == ERROR_OK)
+               retval = dap_run(dap);
+
+       dap_ap_select(dap, apold);
+       if (retval != ERROR_OK)
+               return retval;
+
+       if (CMD_ARGC == 2)
+               command_print(CMD_CTX, "0x%08" PRIx32, value);
+
+       return retval;
+}
+
 COMMAND_HANDLER(dap_ti_be_32_quirks_command)
 {
        struct target *target = get_current_target(CMD_CTX);
@@ -1706,6 +1749,13 @@ static const struct command_registration dap_commands[] 
= {
                .usage = "[ap_num]",
        },
        {
+               .name = "apreg",
+               .handler = dap_apreg_command,
+               .mode = COMMAND_EXEC,
+               .help = "read/write a register from AP",
+               .usage = "ap_num reg [value]",
+       },
+       {
                .name = "baseaddr",
                .handler = dap_baseaddr_command,
                .mode = COMMAND_EXEC,

-- 

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to