---
 urjtag/src/tap/detect.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/urjtag/src/tap/detect.c b/urjtag/src/tap/detect.c
index 5c139507..ddb84508 100644
--- a/urjtag/src/tap/detect.c
+++ b/urjtag/src/tap/detect.c
@@ -45,6 +45,7 @@
 #include <urjtag/data_register.h>
 #include <urjtag/parse.h>
 #include <urjtag/jtag.h>
+#include <urjtag/jep106.h>
 
 static int
 find_record (char *filename, urj_tap_register_t *key,
@@ -315,7 +316,31 @@ urj_tap_detect_parts (urj_chain_t *chain, const char 
*db_path, int maxirlen)
 
 #ifdef ENABLE_BSDL
         if (urj_bsdl_scan_files (chain, urj_tap_register_get_string (did),
-                                 URJ_BSDL_MODE_DETECT) <= 0)
+                                 URJ_BSDL_MODE_DETECT) > 0)
+       {
+           uint64_t idcode = urj_tap_register_get_value (did);
+           unsigned int Mfg  = (unsigned int) EXTRACT_MFG(idcode);
+           unsigned int Bank = (unsigned int) EXTRACT_JEP106_BANK(idcode);
+           unsigned int Id   = (unsigned int) EXTRACT_JEP106_ID(idcode);
+           unsigned int Part = (unsigned int) EXTRACT_PART(idcode);
+           unsigned int Ver  = (unsigned int) EXTRACT_VER(idcode);
+
+           if (part->manufacturer[0] == '\0') {
+               const char *str = jep106_manufacturer(Bank, Id);
+               if (str == NULL) {
+                   snprintf(part->manufacturer, URJ_PART_MANUFACTURER_MAXLEN + 
1, "0x%02x", Mfg);
+               } else {
+                   snprintf(part->manufacturer, URJ_PART_MANUFACTURER_MAXLEN + 
1, "%s", str);
+               }
+           }
+           if (part->part[0] == '\0') {
+               snprintf(part->part, URJ_PART_PART_MAXLEN + 1, "0x%02x", Part);
+           }
+           if (part->stepping[0] == '\0') {
+               snprintf(part->stepping, URJ_PART_STEPPING_MAXLEN + 1, 
"0x%02x", Ver);
+           }
+       }
+       else
 #endif
         {
             char *id_name = NULL, *id_fullname = NULL;
-- 
2.21.0



_______________________________________________
UrJTAG-development mailing list
UrJTAG-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/urjtag-development

Reply via email to