示例#1
0
// print out device and channel diagnostics
void print_diag(const char *prgName)
{
  int err;
  TPDIAG diag;
  
  err = LINUX_CAN_Statistics(h, &diag);
  if (err)
    printf("%s: can't read diagnostics, error %d!\n", prgName, err);
  else      
  {
    printf("%s: type            = %s\n",              prgName, getNameOfInterface(diag.wType));
    if ((diag.wType == HW_USB) || (diag.wType == HW_USB_PRO))
    {
      printf("             Serial Number   = 0x%08x\n", diag.dwBase);
      printf("             Device Number   = %d\n",     diag.wIrqLevel);
    }
    else
    {
      printf("             io              = 0x%08x\n", diag.dwBase);
      printf("             irq             = %d\n",     diag.wIrqLevel);
    }
    printf("             count of reads  = %d\n",     diag.dwReadCounter);
    printf("             count of writes = %d\n",     diag.dwWriteCounter);
    printf("             count of errors = %d\n",     diag.dwErrorCounter);
    printf("             count of irqs   = %d\n",     diag.dwIRQcounter);
    printf("             last CAN status = 0x%04x\n", diag.wErrorFlag);
    printf("             last error      = %d\n",     diag.nLastError);
    printf("             open paths      = %d\n",     diag.nOpenPaths);
    printf("             driver version  = %s\n",     diag.szVersionString);    
  }  
}
示例#2
0
void CANPeakSysUSB::outputDetailedStatus() {
	TPDIAG diag;
	
	LINUX_CAN_Statistics(m_handle, &diag);
	
	std::cout << "*************************\n"
			<< "*** Detailed status output of CANPeakSys\n"
			<< "*************************"
			<< "\nIRQ-Level:     " << diag.wIrqLevel
			<< "\nNo reads:      " << diag.dwReadCounter
			<< "\nNo writes:     " << diag.dwWriteCounter
			<< "\nNo interrupts: " << diag.dwIRQcounter
			<< "\nNo errors:     " << diag.dwErrorCounter
			<< "\nError flag:    " << diag.wErrorFlag
			<< "\nLast error:    " << diag.nLastError
			<< std::endl;
}
示例#3
0
// print out device and channel diagnostics
void print_diag(const char *prgName, HANDLE h)
{
	/*!
					 *\brief The function is copied from the common.cpp file used by both the transmi- and receivetest
					 *
					 *
					 *
					 * */
	int err;
	TPDIAG diag;
	err = LINUX_CAN_Statistics(h, &diag);
	if (err)
		printf("%s: can't read diagnostics, error %d!\n", prgName, err);
	else
	{
		printf("%s: type            = %s\n",              prgName, getNameOfInterface(diag.wType));
		if ((diag.wType == HW_USB) || (diag.wType == HW_USB_PRO))
		{
			printf("             Serial Number   = 0x%08x\n", diag.dwBase);
			printf("             Device Number   = %d\n",     diag.wIrqLevel);
		}
		else
		{
			printf("             io              = 0x%08x\n", diag.dwBase);
			printf("             irq             = %d\n",     diag.wIrqLevel);
		}
		printf("             count of reads  = %d\n",     diag.dwReadCounter);
		printf("             count of writes = %d\n",     diag.dwWriteCounter);
		printf("             count of errors = %d\n",     diag.dwErrorCounter);
		printf("             count of irqs   = %d\n",     diag.dwIRQcounter);
		printf("             last CAN status = 0x%04x\n", diag.wErrorFlag);
		printf("             last error      = %d\n",     diag.nLastError);
		printf("             open paths      = %d\n",     diag.nOpenPaths);
		printf("             driver version  = %s\n",     diag.szVersionString);
	}
}