j-marjanovic / jtag-quartus-ft232h

GNU General Public License v3.0
44 stars 16 forks source link

Steps to enable multi-device capability in jtag_hw_xx libraries #6

Open FvMP opened 7 months ago

FvMP commented 7 months ago

Found that jtagserver feature of connecting multiple devices in parallel isn't supported by this project yet. Problem is that parameter unused_void is actually intended as a device handle that supplies a device specfic context, containig e.g. tdi, tms and tdo data storage, counters and server_ops_data. It's expected to be set in init_dev and returned through **arg1.

Below definitions show how things work.

`struct device_context { uint8_t tdo_data; uint8_t tms_data; uint8_t tdi_data; uint32_t tdo_data_count; uint32_t tdi_data_count; uint32_t tdo_bit_offset; void server_ops_data; }; typedef device_context t_device_context, *p_device_context;

typedef int64_t (fn_init_dev)(p_device_context p_ctx, const char desc, struct server_ops_t s_server_ops, void parent); typedef void (fn_close)(p_device_context p_ctx); // etc.

t_device_context ctx[N_DEVICES]; In init_dev, perform *p_ctx = &ctx[act_dev]; `