Commit 2615bf43 authored by Øyvind Harboe's avatar Øyvind Harboe
Browse files

types: write memory now uses const


Signed-off-by: default avatarØyvind Harboe <oyvind.harboe@zylin.com>
parent d76fd2aa
......@@ -1618,7 +1618,7 @@ static int cortex_m3_read_memory(struct target *target, uint32_t address,
}
static int cortex_m3_write_memory(struct target *target, uint32_t address,
uint32_t size, uint32_t count, uint8_t *buffer)
uint32_t size, uint32_t count, const uint8_t *buffer)
{
struct armv7m_common *armv7m = target_to_armv7m(target);
struct adiv5_dap *swjdp = &armv7m->dap;
......@@ -1642,7 +1642,7 @@ static int cortex_m3_write_memory(struct target *target, uint32_t address,
}
static int cortex_m3_bulk_write_memory(struct target *target, uint32_t address,
uint32_t count, uint8_t *buffer)
uint32_t count, const uint8_t *buffer)
{
return cortex_m3_write_memory(target, address, 4, count, buffer);
}
......
......@@ -1482,13 +1482,13 @@ static int dsp563xx_read_memory_default(struct target *target, uint32_t address,
return dsp563xx_read_memory(target, dsp563xx_get_default_memory(), address, size, count, buffer);
}
static int dsp563xx_write_memory_core(struct target *target, int mem_type, uint32_t address, uint32_t size, uint32_t count, uint8_t * buffer)
static int dsp563xx_write_memory_core(struct target *target, int mem_type, uint32_t address, uint32_t size, uint32_t count, const uint8_t * buffer)
{
int err;
struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target);
uint32_t i, x;
uint32_t data, move_cmd = 0;
uint8_t *b;
const uint8_t *b;
LOG_DEBUG("memtype: %d address: 0x%8.8" PRIx32 ", size: 0x%8.8" PRIx32 ", count: 0x%8.8" PRIx32 "", mem_type,address, size, count);
......@@ -1557,7 +1557,7 @@ static int dsp563xx_write_memory_core(struct target *target, int mem_type, uint3
return ERROR_OK;
}
static int dsp563xx_write_memory(struct target *target, int mem_type, uint32_t address, uint32_t size, uint32_t count, uint8_t * buffer)
static int dsp563xx_write_memory(struct target *target, int mem_type, uint32_t address, uint32_t size, uint32_t count, const uint8_t * buffer)
{
int err;
uint32_t i,i1;
......@@ -1615,12 +1615,12 @@ static int dsp563xx_write_memory(struct target *target, int mem_type, uint32_t a
return ERROR_OK;
}
static int dsp563xx_write_memory_default(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t * buffer)
static int dsp563xx_write_memory_default(struct target *target, uint32_t address, uint32_t size, uint32_t count, const uint8_t * buffer)
{
return dsp563xx_write_memory(target, dsp563xx_get_default_memory(), address, size, count, buffer);
}
static int dsp563xx_bulk_write_memory_default(struct target *target, uint32_t address, uint32_t count, uint8_t *buffer)
static int dsp563xx_bulk_write_memory_default(struct target *target, uint32_t address, uint32_t count, const uint8_t *buffer)
{
return dsp563xx_write_memory(target, dsp563xx_get_default_memory(), address, 4, count, buffer);
}
......
......@@ -637,7 +637,7 @@ int embeddedice_handshake(struct arm_jtag *jtag_info, int hsbit, uint32_t timeou
* This is an inner loop of the open loop DCC write of data to target
*/
void embeddedice_write_dcc(struct jtag_tap *tap,
int reg_addr, uint8_t *buffer, int little, int count)
int reg_addr, const uint8_t *buffer, int little, int count)
{
int i;
......
......@@ -130,6 +130,6 @@ static __inline__ void embeddedice_write_reg_inner(struct jtag_tap *tap, int reg
TAP_IDLE);
}
void embeddedice_write_dcc(struct jtag_tap *tap, int reg_addr, uint8_t *buffer, int little, int count);
void embeddedice_write_dcc(struct jtag_tap *tap, int reg_addr, const uint8_t *buffer, int little, int count);
#endif /* EMBEDDED_ICE_H */
......@@ -460,7 +460,7 @@ static int feroceon_examine_debug_reason(struct target *target)
}
static int feroceon_bulk_write_memory(struct target *target,
uint32_t address, uint32_t count, uint8_t *buffer)
uint32_t address, uint32_t count, const uint8_t *buffer)
{
int retval;
struct arm *armv4_5 = target->arch_info;
......
......@@ -872,7 +872,7 @@ static int mips_m4k_read_memory(struct target *target, uint32_t address,
}
static int mips_m4k_write_memory(struct target *target, uint32_t address,
uint32_t size, uint32_t count, uint8_t *buffer)
uint32_t size, uint32_t count, const uint8_t *buffer)
{
struct mips32_common *mips32 = target_to_mips32(target);
struct mips_ejtag *ejtag_info = &mips32->ejtag_info;
......@@ -966,7 +966,7 @@ static int mips_m4k_examine(struct target *target)
}
static int mips_m4k_bulk_write_memory(struct target *target, uint32_t address,
uint32_t count, uint8_t *buffer)
uint32_t count, const uint8_t *buffer)
{
struct mips32_common *mips32 = target_to_mips32(target);
struct mips_ejtag *ejtag_info = &mips32->ejtag_info;
......
......@@ -49,7 +49,7 @@
static int target_read_buffer_default(struct target *target, uint32_t address,
uint32_t size, uint8_t *buffer);
static int target_write_buffer_default(struct target *target, uint32_t address,
uint32_t size, uint8_t *buffer);
uint32_t size, const uint8_t *buffer);
static int target_array2mem(Jim_Interp *interp, struct target *target,
int argc, Jim_Obj *const *argv);
static int target_mem2array(Jim_Interp *interp, struct target *target,
......@@ -615,7 +615,7 @@ const char *target_type_name(struct target *target)
return target->type->name;
}
static int target_write_memory_imp(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
static int target_write_memory_imp(struct target *target, uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
{
if (!target_was_examined(target))
{
......@@ -705,19 +705,19 @@ static int target_read_phys_memory(struct target *target,
}
int target_write_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
{
return target->type->write_memory(target, address, size, count, buffer);
}
static int target_write_phys_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
{
return target->type->write_phys_memory(target, address, size, count, buffer);
}
int target_bulk_write_memory(struct target *target,
uint32_t address, uint32_t count, uint8_t *buffer)
uint32_t address, uint32_t count, const uint8_t *buffer)
{
return target->type->bulk_write_memory(target, address, count, buffer);
}
......@@ -783,7 +783,7 @@ err_read_phys_memory(struct target *target, uint32_t address,
static int
err_write_phys_memory(struct target *target, uint32_t address,
uint32_t size, uint32_t count, uint8_t *buffer)
uint32_t size, uint32_t count, const uint8_t *buffer)
{
LOG_ERROR("Not implemented: %s", __func__);
return ERROR_FAIL;
......@@ -1340,7 +1340,7 @@ int target_arch_state(struct target *target)
* mode respectively, otherwise data is handled as quickly as
* possible
*/
int target_write_buffer(struct target *target, uint32_t address, uint32_t size, uint8_t *buffer)
int target_write_buffer(struct target *target, uint32_t address, uint32_t size, const uint8_t *buffer)
{
LOG_DEBUG("writing buffer of %i byte at 0x%8.8x",
(int)size, (unsigned)address);
......@@ -1367,7 +1367,7 @@ int target_write_buffer(struct target *target, uint32_t address, uint32_t size,
return target->type->write_buffer(target, address, size, buffer);
}
static int target_write_buffer_default(struct target *target, uint32_t address, uint32_t size, uint8_t *buffer)
static int target_write_buffer_default(struct target *target, uint32_t address, uint32_t size, const uint8_t *buffer)
{
int retval = ERROR_OK;
......@@ -2390,10 +2390,10 @@ COMMAND_HANDLER(handle_md_command)
}
typedef int (*target_write_fn)(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
static int target_write_memory_fast(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
{
return target_write_buffer(target, address, size * count, buffer);
}
......
......@@ -408,7 +408,7 @@ int target_read_memory(struct target *target,
* This routine is wrapper for target->type->write_memory.
*/
int target_write_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
/**
* Write @a count items of 4 bytes to the memory of @a target at
......@@ -418,7 +418,7 @@ int target_write_memory(struct target *target,
* This routine is wrapper for target->type->bulk_write_memory.
*/
int target_bulk_write_memory(struct target *target,
uint32_t address, uint32_t count, uint8_t *buffer);
uint32_t address, uint32_t count, const uint8_t *buffer);
/*
* Write to target memory using the virtual address.
......@@ -445,7 +445,7 @@ int target_bulk_write_memory(struct target *target,
* peripheral registers which do not support byte operations.
*/
int target_write_buffer(struct target *target,
uint32_t address, uint32_t size, uint8_t *buffer);
uint32_t address, uint32_t size, const uint8_t *buffer);
int target_read_buffer(struct target *target,
uint32_t address, uint32_t size, uint8_t *buffer);
int target_checksum_memory(struct target *target,
......
......@@ -112,25 +112,25 @@ struct target_type
* directly, use target_read_memory() instead.
*/
int (*read_memory)(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
int (*write_memory_imp)(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
int (*write_memory_imp)(struct target *target, uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
/**
* Target memory write callback. Do @b not call this function
* directly, use target_write_memory() instead.
*/
int (*write_memory)(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
int (*write_memory)(struct target *target, uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
/* Default implementation will do some fancy alignment to improve performance, target can override */
int (*read_buffer)(struct target *target, uint32_t address, uint32_t size, uint8_t *buffer);
/* Default implementation will do some fancy alignment to improve performance, target can override */
int (*write_buffer)(struct target *target, uint32_t address, uint32_t size, uint8_t *buffer);
int (*write_buffer)(struct target *target, uint32_t address, uint32_t size, const uint8_t *buffer);
/**
* Write target memory in multiples of 4 bytes, optimized for
* writing large quantities of data. Do @b not call this
* function directly, use target_bulk_write_memory() instead.
*/
int (*bulk_write_memory)(struct target *target, uint32_t address, uint32_t count, uint8_t *buffer);
int (*bulk_write_memory)(struct target *target, uint32_t address, uint32_t count, const uint8_t *buffer);
int (*checksum_memory)(struct target *target, uint32_t address, uint32_t count, uint32_t* checksum);
int (*blank_check_memory)(struct target *target, uint32_t address, uint32_t count, uint32_t* blank);
......@@ -225,7 +225,7 @@ struct target_type
/*
* same as read_phys_memory, except that it writes...
*/
int (*write_phys_memory)(struct target *target, uint32_t phys_address, uint32_t size, uint32_t count, uint8_t *buffer);
int (*write_phys_memory)(struct target *target, uint32_t phys_address, uint32_t size, uint32_t count, const uint8_t *buffer);
int (*mmu)(struct target *target, int *enabled);
......
......@@ -528,7 +528,7 @@ static int xscale_write_rx(struct target *target)
}
/* send count elements of size byte to the debug handler */
static int xscale_send(struct target *target, uint8_t *buffer, int count, int size)
static int xscale_send(struct target *target, const uint8_t *buffer, int count, int size)
{
struct xscale_common *xscale = target_to_xscale(target);
uint32_t t[3];
......@@ -1937,7 +1937,7 @@ static int xscale_read_phys_memory(struct target *target, uint32_t address,
}
static int xscale_write_memory(struct target *target, uint32_t address,
uint32_t size, uint32_t count, uint8_t *buffer)
uint32_t size, uint32_t count, const uint8_t *buffer)
{
struct xscale_common *xscale = target_to_xscale(target);
int retval;
......@@ -2016,7 +2016,7 @@ static int xscale_write_memory(struct target *target, uint32_t address,
}
static int xscale_write_phys_memory(struct target *target, uint32_t address,
uint32_t size, uint32_t count, uint8_t *buffer)
uint32_t size, uint32_t count, const uint8_t *buffer)
{
struct xscale_common *xscale = target_to_xscale(target);
......@@ -2031,7 +2031,7 @@ static int xscale_write_phys_memory(struct target *target, uint32_t address,
}
static int xscale_bulk_write_memory(struct target *target, uint32_t address,
uint32_t count, uint8_t *buffer)
uint32_t count, const uint8_t *buffer)
{
return xscale_write_memory(target, address, 4, count, buffer);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment