This is an automated email from Gerrit.

Spencer Oliver (s...@spen-soft.co.uk) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/1602

-- gerrit

commit 32c24fbad4c4721ecc6a4b5cea5b9f0fa6dd05e3
Author: Spencer Oliver <s...@spen-soft.co.uk>
Date:   Thu Aug 29 22:16:17 2013 +0100

    adiv5: check packed transfers are supported
    
    Currently we try and use MEM-AP packed transfers as much as possible for
    8/16bit transfers. However not all targets support packed transfers, so
    check before using.
    
    Change-Id: I66256007f25ccd0c583f23db5acf6d1aa8b5e57d
    Signed-off-by: Spencer Oliver <s...@spen-soft.co.uk>

diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index ce92f4c..9d8e868 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -416,7 +416,7 @@ int mem_ap_write_buf_u16(struct adiv5_dap *dap, const 
uint8_t *buffer, int count
 {
        int retval = ERROR_OK;
 
-       if (count >= 4)
+       if (dap->packed_transfers && count >= 4)
                return mem_ap_write_buf_packed_u16(dap, buffer, count, address);
 
        while (count > 0) {
@@ -516,7 +516,7 @@ int mem_ap_write_buf_u8(struct adiv5_dap *dap, const 
uint8_t *buffer, int count,
 {
        int retval = ERROR_OK;
 
-       if (count >= 4)
+       if (dap->packed_transfers && count >= 4)
                return mem_ap_write_buf_packed_u8(dap, buffer, count, address);
 
        while (count > 0) {
@@ -685,7 +685,7 @@ int mem_ap_read_buf_u16(struct adiv5_dap *dap, uint8_t 
*buffer,
        uint32_t invalue, i;
        int retval = ERROR_OK;
 
-       if (count >= 4)
+       if (dap->packed_transfers && count >= 4)
                return mem_ap_read_buf_packed_u16(dap, buffer, count, address);
 
        while (count > 0) {
@@ -787,7 +787,7 @@ int mem_ap_read_buf_u8(struct adiv5_dap *dap, uint8_t 
*buffer,
        uint32_t invalue;
        int retval = ERROR_OK;
 
-       if (count >= 4)
+       if (dap->packed_transfers && count >= 4)
                return mem_ap_read_buf_packed_u8(dap, buffer, count, address);
 
        while (count > 0) {
@@ -1164,6 +1164,25 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
 
        dap_syssec(dap);
 
+       /* check that we support packed transfers */
+       uint32_t csw;
+
+       retval = dap_setup_accessport(dap, CSW_8BIT | CSW_ADDRINC_PACKED, 0);
+       if (retval != ERROR_OK)
+               return retval;
+
+       retval = dap_queue_ap_read(dap, AP_REG_CSW, &csw);
+       if (retval != ERROR_OK)
+               return retval;
+
+       if (csw & CSW_ADDRINC_PACKED)
+               dap->packed_transfers = true;
+       else
+               dap->packed_transfers = false;
+
+       LOG_DEBUG("MEM_AP Packed Transfers: %s",
+                       dap->packed_transfers ? "enabled" : "disabled");
+
        return ERROR_OK;
 }
 
diff --git a/src/target/arm_adi_v5.h b/src/target/arm_adi_v5.h
index e2e83e1..7cc90b2 100644
--- a/src/target/arm_adi_v5.h
+++ b/src/target/arm_adi_v5.h
@@ -186,6 +186,9 @@ struct adiv5_dap {
 
        /* Size of TAR autoincrement block, ARM ADI Specification requires at 
least 10 bits */
        uint32_t tar_autoincr_block;
+
+       /* true if packed transfers are supported by the MEM-AP */
+       bool packed_transfers;
 };
 
 /**

-- 

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to