Skip to content

Commit df3d9d7

Browse files
committed
Added initial enumeration support for Glasgow
1 parent d862a8e commit df3d9d7

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

jtagd/main.cpp

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ void ListAdapters()
459459
ShowVersion();
460460

461461
//disable compiler warning if no APIs are found
462-
#if( defined(HAVE_DJTG) || defined(HAVE_FTD2XX) )
462+
#if( defined(HAVE_DJTG) || defined(HAVE_FTD2XX) || defined(HAVE_LIBUSB) )
463463
string ver;
464464
int ndev = 0;
465465
#endif
@@ -492,10 +492,10 @@ void ListAdapters()
492492
}
493493
}
494494
#else //#ifdef HAVE_DJTG
495-
printf("Digilent API version: not supported\n");
495+
LogNotice("Digilent API version: not supported\n");
496496
#endif
497497

498-
printf("\n");
498+
LogNotice("\n");
499499
#ifdef HAVE_FTD2XX
500500
ver = FTDIJtagInterface::GetAPIVersion();
501501
LogNotice("FTDI API version: %s\n", ver.c_str());
@@ -530,6 +530,39 @@ void ListAdapters()
530530
#else //#ifdef HAVE_FTD2XX
531531
LogNotice("FTDI API version: not supported\n");
532532
#endif
533+
534+
LogNotice("\n");
535+
#ifdef HAVE_LIBUSB
536+
ver = GlasgowSWDInterface::GetAPIVersion();
537+
LogNotice("Glasgow API version: %s\n", ver.c_str());
538+
ndev = GlasgowSWDInterface::GetInterfaceCount();
539+
LogNotice(" Enumerating interfaces... %d found\n", ndev);
540+
if(ndev == 0)
541+
LogNotice("No interfaces found\n");
542+
else
543+
{
544+
int idev = 0;
545+
LogIndenter li;
546+
for(int i=0; i<ndev; i++)
547+
{
548+
try
549+
{
550+
LogNotice("Interface %d: %s\n", idev, GlasgowSWDInterface::GetDescription(i).c_str());
551+
LogIndenter li;
552+
LogNotice("Serial number: %s\n", GlasgowSWDInterface::GetSerialNumber(i).c_str());
553+
LogNotice("User ID: %s\n", GlasgowSWDInterface::GetSerialNumber(i).c_str());
554+
//LogNotice("Default clock: %.2f MHz\n", GlasgowSWDInterface::GetDefaultFrequency(i)/1000000.0f);
555+
idev++;
556+
}
557+
catch(const JtagException& e)
558+
{
559+
LogNotice("Interface %d: Error getting device information\n", i);
560+
}
561+
}
562+
}
563+
#else //#ifdef HAVE_LIBUSB
564+
LogNotice("Glasgow API version: not supported\n");
565+
#endif
533566
}
534567

535568
catch(const JtagException& ex)

0 commit comments

Comments
 (0)