@@ -183,9 +183,37 @@ delta_format_version(uint32_t version, bool long_out) -> std::string
183183 return out;
184184}
185185
186+ // PrintChnType in SDK
186187static void
187188print_avail_channels (HANDLE BoardHandle)
188189{
190+ printf (" \t - available channels:" );
191+ #ifdef HAVE_VHD_STRING
192+ printf (" " );
193+ // PrintChnType in SDK
194+ ULONG ChnType, NbOfChn;
195+
196+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_NB_RXCHANNELS, &NbOfChn);
197+ for (ULONG i = 0 ; i < NbOfChn; i++) {
198+ VHD_GetChannelProperty (BoardHandle, VHD_RX_CHANNEL, i,
199+ VHD_CORE_CP_TYPE, &ChnType);
200+ printf (" RX%d=%s / " , i,
201+ VHD_CHANNELTYPE_ToPrettyString (
202+ ((VHD_CHANNELTYPE) ChnType)));
203+ }
204+
205+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_NB_TXCHANNELS, &NbOfChn);
206+ for (ULONG i = 0 ; i < NbOfChn; i++) {
207+ VHD_GetChannelProperty (BoardHandle, VHD_TX_CHANNEL, i,
208+ VHD_CORE_CP_TYPE, &ChnType);
209+ printf (" TX%d=%s / " , i,
210+ VHD_CHANNELTYPE_ToPrettyString (
211+ ((VHD_CHANNELTYPE) ChnType)));
212+ }
213+
214+ printf (" \b\b\b \n " );
215+
216+ #else // compat
189217 ULONG avail_channs = 0 ;
190218 ULONG Result = VHD_GetBoardProperty (
191219 BoardHandle, VHD_CORE_BP_CHN_AVAILABILITY, &avail_channs);
@@ -195,7 +223,6 @@ print_avail_channels(HANDLE BoardHandle)
195223 << delta_get_error_description (Result) << " \n " ;
196224 return ;
197225 }
198- printf (" \t\t available channels:" );
199226 // RXx
200227 // bit0 = RX0, bit1 = RX1, bit2 = RX2, bit3 = RX3
201228 for (int i = 0 ; i < 4 ; ++i) {
@@ -224,12 +251,16 @@ print_avail_channels(HANDLE BoardHandle)
224251 }
225252 }
226253 printf (" \n " );
254+ #endif
227255}
228256
257+ // PrintBoardInfo in SDK
229258static void
230259print_board_info (int BoardIndex, ULONG DllVersion, bool full)
231260{
232- ULONG BoardType = 0U ;
261+ color_printf (" \t Board " TBOLD (" %d" ) " : " TBOLD (" %s" ) " \n " , BoardIndex,
262+ VHD_GetBoardModel (BoardIndex));
263+
233264 ULONG DriverVersion = 0U ;
234265 HANDLE BoardHandle = nullptr ;
235266 ULONG Result =
@@ -239,43 +270,116 @@ print_board_info(int BoardIndex, ULONG DllVersion, bool full)
239270 BoardIndex);
240271 return ;
241272 }
242- Result = VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_BOARD_TYPE,
243- &BoardType);
244- if (Result != VHDERR_NOERROR) {
245- DELTA_PRINT_ERROR (Result, " Unable to get board %d type." ,
246- BoardIndex);
247- VHD_CloseBoardHandle (BoardHandle);
248- return ;
249- }
250273 Result = VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_DRIVER_VERSION,
251274 &DriverVersion);
252275 if (Result != VHDERR_NOERROR) {
253276 DELTA_PRINT_ERROR (Result, " Unable to get board %d version." ,
254277 BoardIndex);
255278 }
256-
257- const char *board_type = delta_get_board_type_name (BoardType);
258- color_printf (" \t Board " TBOLD (" %d" ) " : " TBOLD (" %s" ) " (driver: %s)\n " ,
259- BoardIndex, board_type,
260- delta_format_version (DriverVersion, false ).c_str ());
261- if (full) {
262- print_avail_channels (BoardHandle);
263- const char *bidir_status = " ERROR" ;
264- ULONG IsBiDir = 0 ;
265- if (VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_IS_BIDIR,
266- &IsBiDir) == VHDERR_NOERROR) {
267- bidir_status =
268- IsBiDir == TRUE ? " supported" : " not supported" ;
269- }
270- printf (" \t\t bidirectional (switchable) channels: "
271- " %s\n " ,
272- bidir_status);
273- }
274279 if ((DllVersion >> 16U ) != (DriverVersion >> 16U )) {
275280 MSG (WARNING, " API and driver version mismatch: %s vs %s\n " ,
276281 delta_format_version (DllVersion, true ).c_str (),
277282 delta_format_version (DriverVersion, true ).c_str ());
278283 }
284+ if (!full) {
285+ VHD_CloseBoardHandle (BoardHandle);
286+ return ;
287+ }
288+
289+ ULONG BoardType = 0U ;
290+
291+ ULONG SerialNumber_UL[4 ] = {};
292+ ULONG NbOfLane, BusType, FirmwareVersion, Firmware3Version, LowProfile,
293+ NbRxChannels, NbTxChannels, Firmware4Version, ProductVersion = 0 ;
294+ char pIdString_c[64 ];
295+
296+ Result = VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_BOARD_TYPE,
297+ &BoardType);
298+ if (Result != VHDERR_NOERROR) {
299+ DELTA_PRINT_ERROR (Result, " Unable to get board %d type." ,
300+ BoardIndex);
301+ }
302+
303+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_FIRMWARE_VERSION,
304+ &FirmwareVersion);
305+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_BOARD_TYPE, &BoardType);
306+ #if defined VHD_MIN_6_21 // (not tested exactly)
307+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_SERIALNUMBER_PART1_LSW,
308+ &SerialNumber_UL[0 ]);
309+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_SERIALNUMBER_PART2,
310+ &SerialNumber_UL[1 ]);
311+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_SERIALNUMBER_PART3,
312+ &SerialNumber_UL[2 ]);
313+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_SERIALNUMBER_PART4_MSW,
314+ &SerialNumber_UL[3 ]);
315+ #endif
316+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_NBOF_LANE, &NbOfLane);
317+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_LOWPROFILE, &LowProfile);
318+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_NB_RXCHANNELS,
319+ &NbRxChannels);
320+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_NB_TXCHANNELS,
321+ &NbTxChannels);
322+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_PRODUCT_VERSION,
323+ &ProductVersion);
324+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_BUS_TYPE, &BusType);
325+ VHD_GetPCIeIdentificationString (BoardIndex, pIdString_c);
326+
327+ printf (" \t - PCIe Id string : %s\n " , pIdString_c);
328+ printf (" \t - Driver %s\n " ,
329+ delta_format_version (DriverVersion, false ).c_str ());
330+ printf (" \t - Board fpga firmware v%02X (%02X-%02X-%02X)\n " ,
331+ FirmwareVersion & 0xFF , (FirmwareVersion >> 24 ) & 0xFF ,
332+ (FirmwareVersion >> 16 ) & 0xFF , (FirmwareVersion >> 8 ) & 0xFF );
333+ if (BoardType == VHD_BOARDTYPE_3G || BoardType == VHD_BOARDTYPE_3GKEY ||
334+ (BoardType == VHD_BOARDTYPE_HD && NbTxChannels == 4 )) {
335+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_FIRMWARE3_VERSION,
336+ &Firmware3Version);
337+ printf (" \t - Board micro-controller firmware v%02X "
338+ " (%02X-%02X-%02X)\n " ,
339+ Firmware3Version & 0xFF , (Firmware3Version >> 24 ) & 0xFF ,
340+ (Firmware3Version >> 16 ) & 0xFF ,
341+ (Firmware3Version >> 8 ) & 0xFF );
342+ }
343+ if (BoardType == VHD_BOARDTYPE_IP) {
344+ VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_FIRMWARE4_VERSION,
345+ &Firmware4Version);
346+ printf (
347+ " \t - Board microcode firmware v%02X (%02X-%02X-%02X)\n " ,
348+ Firmware4Version & 0xFF , (Firmware4Version >> 24 ) & 0xFF ,
349+ (Firmware4Version >> 16 ) & 0xFF ,
350+ (Firmware4Version >> 8 ) & 0xFF );
351+ }
352+ printf (" \t - Board serial# : 0x%08X%08X%08X%08X\n " , SerialNumber_UL[3 ],
353+ SerialNumber_UL[2 ], SerialNumber_UL[1 ], SerialNumber_UL[0 ]);
354+
355+ if (ProductVersion != 0 )
356+ printf (" \t - Board product v%04X\n " , ProductVersion);
357+
358+ #ifdef HAVE_VHD_STRING
359+ #define bus_type_to_str (x ) VHD_BUSTYPE_ToPrettyString((VHD_BUSTYPE) x)
360+ #else
361+ #define bus_type_to_str (x ) " unknown bus"
362+ #endif
363+ printf (" \t - %s on %s" , delta_get_board_type_name (BoardType),
364+ bus_type_to_str (BusType));
365+ #undef bus_type_to_str "unknown bus"
366+ if (NbOfLane)
367+ printf (" (%d lane%s)\n " , NbOfLane, (NbOfLane > 1 ) ? " s" : " " );
368+ else
369+ printf (" \n " );
370+ printf (" \t - %s\n " , LowProfile ? " Low profile" : " Full height" );
371+ printf (" \t - %d In / %d Out\n " , NbRxChannels, NbTxChannels);
372+
373+ print_avail_channels (BoardHandle);
374+ const char *bidir_status = " ERROR" ;
375+ ULONG IsBiDir = 0 ;
376+ if (VHD_GetBoardProperty (BoardHandle, VHD_CORE_BP_IS_BIDIR, &IsBiDir) ==
377+ VHDERR_NOERROR) {
378+ bidir_status = IsBiDir == TRUE ? " supported" : " not supported" ;
379+ }
380+ printf (" \t - bidirectional (switchable) channels: "
381+ " %s\n " ,
382+ bidir_status);
279383 VHD_CloseBoardHandle (BoardHandle);
280384}
281385
0 commit comments