diff options
author | Daniel Anselmi <danselmi@gmx.ch> | 2023-04-15 01:13:12 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2023-07-08 18:04:24 +0000 |
commit | a27907aed1cd26bcbaac834343f08146fc8fa1fe (patch) | |
tree | a21b6ef9b006fec2cb997811170bbf7c54b9214a /src/pld/intel.c | |
parent | 373d7eaa706b4895cb94e5f563526aec865c8814 (diff) | |
download | riscv-openocd-a27907aed1cd26bcbaac834343f08146fc8fa1fe.zip riscv-openocd-a27907aed1cd26bcbaac834343f08146fc8fa1fe.tar.gz riscv-openocd-a27907aed1cd26bcbaac834343f08146fc8fa1fe.tar.bz2 |
ipdbg/pld: ipdbg can get tap and hub/ir from pld driver.
To start a ipdbg server one needs to know the tap and the
instruction code to reach the IPDBG-Hub. This instruction is
vendor/family specific. Knowledge which can be provided by the
pld driver.
Change-Id: I13eeb9fee895d65cd48544da4704fcc9b528b869
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7369
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src/pld/intel.c')
-rw-r--r-- | src/pld/intel.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/pld/intel.c b/src/pld/intel.c index 92a790b..e5c9273 100644 --- a/src/pld/intel.c +++ b/src/pld/intel.c @@ -18,6 +18,8 @@ #include "raw_bit.h" #define BYPASS 0x3FF +#define USER0 0x00C +#define USER1 0x00E enum intel_family_e { INTEL_CYCLONEIII, @@ -337,6 +339,29 @@ static int intel_load(struct pld_device *pld_device, const char *filename) return jtag_execute_queue(); } +static int intel_get_ipdbg_hub(int user_num, struct pld_device *pld_device, struct pld_ipdbg_hub *hub) +{ + if (!pld_device) + return ERROR_FAIL; + + struct intel_pld_device *pld_device_info = pld_device->driver_priv; + + if (!pld_device_info || !pld_device_info->tap) + return ERROR_FAIL; + + hub->tap = pld_device_info->tap; + + if (user_num == 0) { + hub->user_ir_code = USER0; + } else if (user_num == 1) { + hub->user_ir_code = USER1; + } else { + LOG_ERROR("intel devices only have user register 0 & 1"); + return ERROR_FAIL; + } + return ERROR_OK; +} + COMMAND_HANDLER(intel_set_bscan_command_handler) { unsigned int boundary_scan_length; @@ -472,4 +497,5 @@ struct pld_driver intel_pld = { .commands = intel_command_handler, .pld_create_command = &intel_pld_create_command, .load = &intel_load, + .get_ipdbg_hub = intel_get_ipdbg_hub, }; |