return 32;
}
+unsigned int target_data_bits(struct target *target)
+{
+ if (target->type->data_bits)
+ return target->type->data_bits(target);
+ return 32;
+}
+
static int target_profiling(struct target *target, uint32_t *samples,
uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
{
uint32_t sample_count = 0;
/* hopefully it is safe to cache! We want to stop/restart as quickly as possible. */
- struct reg *reg = register_get_by_name(target->reg_cache, "pc", 1);
+ struct reg *reg = register_get_by_name(target->reg_cache, "pc", true);
int retval = ERROR_OK;
for (;;) {
target_addr_t address, uint32_t count, const uint8_t *buffer)
{
uint32_t size;
+ unsigned int data_bytes = target_data_bits(target) / 8;
- /* Align up to maximum 4 bytes. The loop condition makes sure the next pass
+ /* Align up to maximum bytes. The loop condition makes sure the next pass
* will have something to do with the size we leave to it. */
- for (size = 1; size < 4 && count >= size * 2 + (address & size); size *= 2) {
+ for (size = 1;
+ size < data_bytes && count >= size * 2 + (address & size);
+ size *= 2) {
if (address & size) {
int retval = target_write_memory(target, address, size, 1, buffer);
if (retval != ERROR_OK)
static int target_read_buffer_default(struct target *target, target_addr_t address, uint32_t count, uint8_t *buffer)
{
uint32_t size;
+ unsigned int data_bytes = target_data_bits(target) / 8;
- /* Align up to maximum 4 bytes. The loop condition makes sure the next pass
+ /* Align up to maximum bytes. The loop condition makes sure the next pass
* will have something to do with the size we leave to it. */
- for (size = 1; size < 4 && count >= size * 2 + (address & size); size *= 2) {
+ for (size = 1;
+ size < data_bytes && count >= size * 2 + (address & size);
+ size *= 2) {
if (address & size) {
int retval = target_read_memory(target, address, size, 1, buffer);
if (retval != ERROR_OK)
}
} else {
/* access a single register by its name */
- reg = register_get_by_name(target->reg_cache, CMD_ARGV[0], 1);
+ reg = register_get_by_name(target->reg_cache, CMD_ARGV[0], true);
if (!reg)
goto not_found;
if (goi->argc != 0)
goto no_params;
}
- Jim_SetResultString(goi->interp, target->gdb_port_override ? : "undefined", -1);
+ Jim_SetResultString(goi->interp, target->gdb_port_override ? target->gdb_port_override : "undefined", -1);
/* loop for more */
break;
target_reset_examined(target);
/* determine if we should halt or not. */
- target->reset_halt = !!a;
+ target->reset_halt = (a != 0);
/* When this happens - all workareas are invalid. */
target_free_all_working_areas_restore(target, 0);