target: riscv: remove non-trivial 'unsigned' cast

Change the prototype of riscv_batch_get_dmi_read_op().
Now that 'target->smp' is unsigned, drop the cast.

Change-Id: I2a54268ed1e4bf0ea884b62cceb73f5c7451da78
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8484
Tested-by: jenkins
This commit is contained in:
Antonio Borneo 2024-09-08 21:47:31 +02:00
parent 957eb741a0
commit fec3b22421
3 changed files with 4 additions and 4 deletions

View File

@ -156,14 +156,14 @@ size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, unsigned int address)
return batch->read_keys_used++; return batch->read_keys_used++;
} }
unsigned int riscv_batch_get_dmi_read_op(struct riscv_batch *batch, size_t key) uint32_t riscv_batch_get_dmi_read_op(struct riscv_batch *batch, size_t key)
{ {
assert(key < batch->read_keys_used); assert(key < batch->read_keys_used);
size_t index = batch->read_keys[key]; size_t index = batch->read_keys[key];
assert(index <= batch->used_scans); assert(index <= batch->used_scans);
uint8_t *base = batch->data_in + DMI_SCAN_BUF_SIZE * index; uint8_t *base = batch->data_in + DMI_SCAN_BUF_SIZE * index;
/* extract "op" field from the DMI read result */ /* extract "op" field from the DMI read result */
return (unsigned)buf_get_u32(base, DTM_DMI_OP_OFFSET, DTM_DMI_OP_LENGTH); return buf_get_u32(base, DTM_DMI_OP_OFFSET, DTM_DMI_OP_LENGTH);
} }
uint32_t riscv_batch_get_dmi_read_data(struct riscv_batch *batch, size_t key) uint32_t riscv_batch_get_dmi_read_data(struct riscv_batch *batch, size_t key)

View File

@ -65,7 +65,7 @@ void riscv_batch_add_dmi_write(struct riscv_batch *batch, unsigned int address,
* provides a key, the second one actually obtains the result of the read - * provides a key, the second one actually obtains the result of the read -
* status (op) and the actual data. */ * status (op) and the actual data. */
size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, unsigned int address); size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, unsigned int address);
unsigned int riscv_batch_get_dmi_read_op(struct riscv_batch *batch, size_t key); uint32_t riscv_batch_get_dmi_read_op(struct riscv_batch *batch, size_t key);
uint32_t riscv_batch_get_dmi_read_data(struct riscv_batch *batch, size_t key); uint32_t riscv_batch_get_dmi_read_data(struct riscv_batch *batch, size_t key);
/* Scans in a NOP. */ /* Scans in a NOP. */

View File

@ -1537,7 +1537,7 @@ static int set_haltgroup(struct target *target, bool *supported)
uint32_t read; uint32_t read;
if (dmi_read(target, &read, DM_DMCS2) != ERROR_OK) if (dmi_read(target, &read, DM_DMCS2) != ERROR_OK)
return ERROR_FAIL; return ERROR_FAIL;
*supported = get_field(read, DM_DMCS2_GROUP) == (unsigned)target->smp; *supported = get_field(read, DM_DMCS2_GROUP) == target->smp;
return ERROR_OK; return ERROR_OK;
} }