Make target_buffer_get_uXX interfaces work with constant buffers.

git-svn-id: svn://svn.berlios.de/openocd/trunk@1956 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
zwelch 2009-05-31 02:18:26 +00:00
parent 79cec48ba2
commit 12df0f0090
2 changed files with 6 additions and 6 deletions

View File

@ -273,7 +273,7 @@ static int new_target_number(void)
static int target_continous_poll = 1; static int target_continous_poll = 1;
/* read a u32 from a buffer in target memory endianness */ /* read a u32 from a buffer in target memory endianness */
u32 target_buffer_get_u32(target_t *target, u8 *buffer) u32 target_buffer_get_u32(target_t *target, const u8 *buffer)
{ {
if (target->endianness == TARGET_LITTLE_ENDIAN) if (target->endianness == TARGET_LITTLE_ENDIAN)
return le_to_h_u32(buffer); return le_to_h_u32(buffer);
@ -282,7 +282,7 @@ u32 target_buffer_get_u32(target_t *target, u8 *buffer)
} }
/* read a u16 from a buffer in target memory endianness */ /* read a u16 from a buffer in target memory endianness */
u16 target_buffer_get_u16(target_t *target, u8 *buffer) u16 target_buffer_get_u16(target_t *target, const u8 *buffer)
{ {
if (target->endianness == TARGET_LITTLE_ENDIAN) if (target->endianness == TARGET_LITTLE_ENDIAN)
return le_to_h_u16(buffer); return le_to_h_u16(buffer);
@ -291,7 +291,7 @@ u16 target_buffer_get_u16(target_t *target, u8 *buffer)
} }
/* read a u8 from a buffer in target memory endianness */ /* read a u8 from a buffer in target memory endianness */
u8 target_buffer_get_u8(target_t *target, u8 *buffer) u8 target_buffer_get_u8(target_t *target, const u8 *buffer)
{ {
return *buffer & 0x0ff; return *buffer & 0x0ff;
} }

View File

@ -401,9 +401,9 @@ extern target_t *all_targets;
extern target_event_callback_t *target_event_callbacks; extern target_event_callback_t *target_event_callbacks;
extern target_timer_callback_t *target_timer_callbacks; extern target_timer_callback_t *target_timer_callbacks;
extern u32 target_buffer_get_u32(target_t *target, u8 *buffer); extern u32 target_buffer_get_u32(target_t *target, const u8 *buffer);
extern u16 target_buffer_get_u16(target_t *target, u8 *buffer); extern u16 target_buffer_get_u16(target_t *target, const u8 *buffer);
extern u8 target_buffer_get_u8 (target_t *target, u8 *buffer); extern u8 target_buffer_get_u8 (target_t *target, const u8 *buffer);
extern void target_buffer_set_u32(target_t *target, u8 *buffer, u32 value); extern void target_buffer_set_u32(target_t *target, u8 *buffer, u32 value);
extern void target_buffer_set_u16(target_t *target, u8 *buffer, u16 value); extern void target_buffer_set_u16(target_t *target, u8 *buffer, u16 value);
extern void target_buffer_set_u8 (target_t *target, u8 *buffer, u8 value); extern void target_buffer_set_u8 (target_t *target, u8 *buffer, u8 value);