- uint8_t *base = batch->data_in + 8 * index;
- return base[0] |
- ((uint64_t) base[1]) << 8 |
- ((uint64_t) base[2]) << 16 |
- ((uint64_t) base[3]) << 24 |
- ((uint64_t) base[4]) << 32 |
- ((uint64_t) base[5]) << 40 |
- ((uint64_t) base[6]) << 48 |
- ((uint64_t) base[7]) << 56;
+ uint8_t *base = batch->data_in + DMI_SCAN_BUF_SIZE * index;
+ /* extract "op" field from the DMI read result */
+ return (unsigned)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)
+{
+ assert(key < batch->read_keys_used);
+ size_t index = batch->read_keys[key];
+ assert(index <= batch->used_scans);
+ uint8_t *base = batch->data_in + DMI_SCAN_BUF_SIZE * index;
+ /* extract "data" field from the DMI read result */
+ return buf_get_u32(base, DTM_DMI_DATA_OFFSET, DTM_DMI_DATA_LENGTH);