This is an automated email from Gerrit. Alamy Liu ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/3315
-- gerrit commit 044816f0abff0eae547c6ed6bb1763a0235a53c7 Author: Alamy Liu <[email protected]> Date: Wed Oct 14 09:34:21 2015 -0700 arm_adi_v5: Add bit-operation functions Add set/clear bits helper functions mem_ap_set_bits_u32() mem_ap_clear_bits_u32() Change-Id: I13278ddf1c47d97fc4c4e9fac9513428cf9c6c76 Signed-off-by: Alamy Liu <[email protected]> diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index e093c66..2d42f84 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -265,6 +265,34 @@ int mem_ap_write_atomic_u32(struct adiv5_ap *ap, uint32_t address, return dap_run(ap->dap); } +int mem_ap_set_bits_u32( + struct adiv5_dap *dap, uint32_t addr, uint32_t bit_mask) +{ + int rc; + uint32_t value; /* ***** WARNING: clear to zero ? */ + + rc = mem_ap_read_u32(dap, addr, &value); + if (rc != ERROR_OK) return rc; + + value |= bit_mask; + + return mem_ap_write_atomic_u32(dap, addr, value); +} + +int mem_ap_clear_bits_u32( + struct adiv5_dap *dap, uint32_t addr, uint32_t bit_mask) +{ + int rc; + uint32_t value; /* ***** WARNING: clear to zero ? */ + + rc = mem_ap_read_u32(dap, addr, &value); + if (rc != ERROR_OK) return rc; + + value &= ~bit_mask; + + return mem_ap_write_atomic_u32(dap, addr, value); +} + /** * Synchronous write of a block of memory, using a specific access size. * diff --git a/src/target/arm_adi_v5.h b/src/target/arm_adi_v5.h index d84fe07..7dc3114 100644 --- a/src/target/arm_adi_v5.h +++ b/src/target/arm_adi_v5.h @@ -709,6 +709,12 @@ int mem_ap_read_atomic_u32(struct adiv5_ap *ap, int mem_ap_write_atomic_u32(struct adiv5_ap *ap, uint32_t address, uint32_t value); +/* Synchronous MEM-AP memory mapped single word bits operation */ +int mem_ap_set_bits_u32(struct adiv5_dap *swjdp, + uint32_t address, uint32_t bit_mask); +int mem_ap_clear_bits_u32(struct adiv5_dap *swjdp, + uint32_t address, uint32_t bit_mask); + /* Synchronous MEM-AP memory mapped bus block transfers. */ int mem_ap_read_buf(struct adiv5_ap *ap, uint8_t *buffer, uint32_t size, uint32_t count, uint32_t address); -- ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
