/* SPDX-License-Identifier: GPL-2.0-or-later */#ifndefTARGET__RISCV__SCANS_H#defineTARGET__RISCV__SCANS_H#include"target/target.h"#include"jtag/jtag.h"#include"riscv.h"enumriscv_scan_type{RISCV_SCAN_TYPE_INVALID,RISCV_SCAN_TYPE_NOP,RISCV_SCAN_TYPE_READ,RISCV_SCAN_TYPE_WRITE,...};/* A batch of multiple JTAG scans, which are grouped together to avoid the * overhead of some JTAG adapters when sending single commands. This is * designed to support block copies, as that's what we actually need to go * fast. *//* ... */structriscv_batch{structtarget*target;size_tallocated_scans;size_tused_scans;size_tidle_count;uint8_t*data_out;uint8_t*data_in;structscan_field*fields;/* If in BSCAN mode, this field will be allocated (one per scan), and utilized to tunnel all the scans in the batch. If not in BSCAN mode, this field is unallocated and stays NULL *//* ... */riscv_bscan_tunneled_scan_context_t*bscan_ctxt;/* In JTAG we scan out the previous value's output when performing a * scan. This is a pain for users, so we just provide them the * illusion of not having to do this by eliding all but the last NOP. * *//* ... */enumriscv_scan_typelast_scan;/* The read keys. */size_t*read_keys;size_tread_keys_used;...};/* Allocates (or frees) a new scan set. "scans" is the maximum number of JTAG * scans that can be issued to this object, and idle is the number of JTAG idle * cycles between every real scan. *//* ... */structriscv_batch*riscv_batch_alloc(structtarget*target,size_tscans,size_tidle);voidriscv_batch_free(structriscv_batch*batch);/* Checks to see if this batch is full. */boolriscv_batch_full(structriscv_batch*batch);/* Executes this scan batch. */intriscv_batch_run(structriscv_batch*batch);/* Adds a DMI write to this batch. */voidriscv_batch_add_dmi_write(structriscv_batch*batch,unsignedaddress,uint64_tdata);/* DMI reads must be handled in two parts: the first one schedules a read and * provides a key, the second one actually obtains the result of the read - * status (op) and the actual data. *//* ... */size_triscv_batch_add_dmi_read(structriscv_batch*batch,unsignedaddress);unsignedriscv_batch_get_dmi_read_op(structriscv_batch*batch,size_tkey);uint32_triscv_batch_get_dmi_read_data(structriscv_batch*batch,size_tkey);/* Scans in a NOP. */voidriscv_batch_add_nop(structriscv_batch*batch);/* Returns the number of available scans. */size_triscv_batch_available_scans(structriscv_batch*batch);/* ... */#endif
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
Click anywhere in the source to view detailed information here...