Refs #788. Added support for Vector CAN devices (XL driver) to the host tools.

git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@673 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
Frank Voorburg 2019-04-09 19:02:40 +00:00
parent 0304e87968
commit 6248473234
12 changed files with 7520 additions and 33 deletions

Binary file not shown.

Binary file not shown.

View File

@ -531,6 +531,7 @@ static void DisplayProgramUsage(void)
printf(" peak_pcanusb -> Peak System PCAN-USB.\n");
printf(" kvaser_leaflight -> Kvaser Leaf Light V2.\n");
printf(" lawicel_canusb -> Lawicel CANUSB.\n");
printf(" vector_xldriver -> Vector XL Driver.\n");
printf(" -c=[value] Zero based index of the CAN channel if multiple CAN\n");
printf(" channels are supported for the CAN adapter, as a 32-\n");
printf(" bit value (Default = 0).\n");

View File

@ -39,6 +39,7 @@
#include "pcanusb.h" /* Peak PCAN-USB interface */
#include "leaflight.h" /* Kvaser Leaf Light v2 interface */
#include "canusb.h" /* Lawicel CANUSB interface */
#include "xldriver.h" /* Vector XL driver interface */
#endif
#if defined(PLATFORM_LINUX)
#include "socketcan.h" /* SocketCAN interface */
@ -94,6 +95,10 @@ void CanInit(tCanSettings const * settings)
{
canIfPtr = CanUsbGetInterface();
}
else if (strcmp(settings->devicename, "vector_xldriver") == 0)
{
canIfPtr = VectorXlGetInterface();
}
#endif
#if defined(PLATFORM_LINUX)
/* On Linux, the device name is the name of the SocketCAN link, so always link

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,554 @@
/*---------------------------------------------------------------------------------------
| File:
| xlLoadlib.c
| Project:
| xlCANcontrol, xlMOSTView, xlFlexDemo
|
| Description:
| For the dynamically linking of the XL Driver Library.
|
|
|-----------------------------------------------------------------------------
| $Author: vishsh $ $Date: 2016-05-19 08:45:09 +0200 (Thu, 19 May 2016) $ $Revision: 57918 $
| $Id: xlLoadlib.c 57918 2016-05-19 06:45:09Z vishsh $
|-----------------------------------------------------------------------------
| Copyright (c) 2014 by Vector Informatik GmbH. All rights reserved.
----------------------------------------------------------------------------*/
#include <windows.h>
#ifndef _MFC_VER
# include <stdio.h>
#endif
#include <vxlapi.h>
///////////////////////////////////////////////////////////////////////////
//Global variables
////////////////////////////////////////////////////////////////////////////
// function pointers
XLGETAPPLCONFIG xlGetApplConfig = NULL;
XLSETAPPLCONFIG xlSetApplConfig = NULL;
XLGETDRIVERCONFIG xlGetDriverConfig = NULL;
XLGETCHANNELINDEX xlGetChannelIndex = NULL;
XLGETCHANNELMASK xlGetChannelMask = NULL;
XLOPENPORT xlOpenPort = NULL;
XLSETTIMERRATE xlSetTimerRate = NULL;
XLRESETCLOCK xlResetClock = NULL;
XLSETNOTIFICATION xlSetNotification = NULL;
XLFLUSHRECEIVEQUEUE xlFlushReceiveQueue = NULL;
XLGETRECEIVEQUEUELEVEL xlGetReceiveQueueLevel = NULL;
XLACTIVATECHANNEL xlActivateChannel = NULL;
XLRECEIVE xlReceive = NULL;
XLGETEVENTSTRING xlGetEventString = NULL;
XLGETERRORSTRING xlGetErrorString = NULL;
XLGETSYNCTIME xlGetSyncTime = NULL;
XLGENERATESYNCPULSE xlGenerateSyncPulse = NULL;
XLPOPUPHWCONFIG xlPopupHwConfig = NULL;
XLDEACTIVATECHANNEL xlDeactivateChannel = NULL;
XLCLOSEPORT xlClosePort = NULL;
XLSETTIMERBASEDNOTIFY xlSetTimerBasedNotify = NULL;
XLSETTIMERRATEANDCHANNEL xlSetTimerRateAndChannel = NULL;
XLGETLICENSEINFO xlGetLicenseInfo = NULL;
XLGETCHANNELTIME xlGetChannelTime = NULL;
XLGETREMOTEDRIVERCONFIG xlGetRemoteDriverConfig = NULL;
// CAN specific functions
XLCANSETCHANNELOUTPUT xlCanSetChannelOutput = NULL;
XLCANSETCHANNELMODE xlCanSetChannelMode = NULL;
XLCANSETRECEIVEMODE xlCanSetReceiveMode = NULL;
XLCANSETCHANNELTRANSCEIVER xlCanSetChannelTransceiver = NULL;
XLCANSETCHANNELPARAMS xlCanSetChannelParams = NULL;
XLCANSETCHANNELPARAMSC200 xlCanSetChannelParamsC200 = NULL;
XLCANSETCHANNELBITRATE xlCanSetChannelBitrate = NULL;
XLCANSETCHANNELACCEPTANCE xlCanSetChannelAcceptance = NULL;
XLCANADDACCEPTANCERANGE xlCanAddAcceptanceRange = NULL;
XLCANREMOVEACCEPTANCERANGE xlCanRemoveAcceptanceRange = NULL;
XLCANRESETACCEPTANCE xlCanResetAcceptance = NULL;
XLCANREQUESTCHIPSTATE xlCanRequestChipState = NULL;
XLCANFLUSHTRANSMITQUEUE xlCanFlushTransmitQueue = NULL;
XLCANTRANSMIT xlCanTransmit = NULL;
// CAN-FD specific functions
XLCANFDSETCONFIGURATION xlCanFdSetConfiguration = NULL;
XLCANTRANSMITEX xlCanTransmitEx = NULL;
XLCANRECEIVE xlCanReceive = NULL;
XLCANGETEVENTSTRING xlCanGetEventString = NULL;
// LIN specific functions
XLLINSETCHANNELPARAMS xlLinSetChannelParams = NULL;
XLLINSETDLC xlLinSetDLC = NULL;
XLLINSETSLAVE xlLinSetSlave = NULL;
XLLINSENDREQUEST xlLinSendRequest = NULL;
XLLINSETSLEEPMODE xlLinSetSleepMode = NULL;
XLLINWAKEUP xlLinWakeUp = NULL;
XLLINSETCHECKSUM xlLinSetChecksum = NULL;
XLLINSWITCHSLAVE xlLinSwitchSlave = NULL;
// IOcab specific functions
XLDAIOSETPWMOUTPUT xlDAIOSetPWMOutput = NULL;
XLDAIOSETDIGITALOUTPUT xlDAIOSetDigitalOutput = NULL;
XLDAIOSETANALOGOUTPUT xlDAIOSetAnalogOutput = NULL;
XLDAIOREQUESTMEASUREMENT xlDAIORequestMeasurement = NULL;
XLDAIOSETDIGITALPARAMETERS xlDAIOSetDigitalParameters = NULL;
XLDAIOSETANALOGPARAMETERS xlDAIOSetAnalogParameters = NULL;
XLDAIOSETANALOGTRIGGER xlDAIOSetAnalogTrigger = NULL;
XLDAIOSETMEASUREMENTFREQUENCY xlDAIOSetMeasurementFrequency = NULL;
// MOST specific functions
XLFP_MOSTRECEIVE xlMostReceive = NULL;
XLFP_MOSTCTRLTRANSMIT xlMostCtrlTransmit = NULL;
XLFP_MOSTSWITCHEVENTSOURCES xlMostSwitchEventSources = NULL;
XLFP_MOSTSETALLBYPASS xlMostSetAllBypass = NULL;
XLFP_MOSTGETALLBYPASS xlMostGetAllBypass = NULL;
XLFP_MOSTSETTIMINGMODE xlMostSetTimingMode = NULL;
XLFP_MOSTGETTIMINGMODE xlMostGetTimingMode = NULL;
XLFP_MOSTSETFREQUENCY xlMostSetFrequency = NULL;
XLFP_MOSTGETFREQUENCY xlMostGetFrequency = NULL;
XLFP_MOSTWRITEREGISTER xlMostWriteRegister = NULL;
XLFP_MOSTREADREGISTER xlMostReadRegister = NULL;
XLFP_MOSTWRITEREGISTERBIT xlMostWriteRegisterBit = NULL;
XLFP_MOSTSYNCGETALLOCTABLE xlMostSyncGetAllocTable = NULL;
XLFP_MOSTCTRLSYNCAUDIO xlMostCtrlSyncAudio = NULL;
XLFP_MOSTCTRLSYNCAUDIOEX xlMostCtrlSyncAudioEx = NULL;
XLFP_MOSTSYNCVOLUME xlMostSyncVolume = NULL;
XLFP_MOSTSYNCMUTE xlMostSyncMute = NULL;
XLFP_MOSTSYNCGETVOLUMESTATUS xlMostSyncGetVolumeStatus = NULL;
XLFP_MOSTSYNCGETMUTESTATUS xlMostSyncGetMuteStatus = NULL;
XLFP_MOSTGETRXLIGHT xlMostGetRxLight = NULL;
XLFP_MOSTSETTXLIGHT xlMostSetTxLight = NULL;
XLFP_MOSTGETTXLIGHT xlMostGetTxLight = NULL;
XLFP_MOSTSETLIGHTPOWER xlMostSetLightPower = NULL;
XLFP_MOSTGETLOCKSTATUS xlMostGetLockStatus = NULL;
XLFP_MOSTGENERATELIGHTERROR xlMostGenerateLightError = NULL;
XLFP_MOSTGENERATELOCKERROR xlMostGenerateLockError = NULL;
XLFP_MOSTCTRLRXBUFFER xlMostCtrlRxBuffer = NULL;
XLFP_MOSTTWINKLEPOWERLED xlMostTwinklePowerLed = NULL;
XLFP_MOSTASYNCTRANSMIT xlMostAsyncTransmit = NULL;
XLFP_MOSTCTRLCONFIGUREBUSLOAD xlMostCtrlConfigureBusload = NULL;
XLFP_MOSTCTRLGENERATEBUSLOAD xlMostCtrlGenerateBusload = NULL;
XLFP_MOSTASYNCCONFIGUREBUSLOAD xlMostAsyncConfigureBusload = NULL;
XLFP_MOSTASYNCGENERATEBUSLOAD xlMostAsyncGenerateBusload = NULL;
XLFP_MOSTSTREAMOPEN xlMostStreamOpen = NULL;
XLFP_MOSTSTREAMCLOSE xlMostStreamClose = NULL;
XLFP_MOSTSTREAMSTART xlMostStreamStart = NULL;
XLFP_MOSTSTREAMSTOP xlMostStreamStop = NULL;
XLFP_MOSTSTREAMBUFFERALLOCATE xlMostStreamBufferAllocate = NULL;
XLFP_MOSTSTREAMBUFFERDEALLOCATEALL xlMostStreamBufferDeallocateAll = NULL;
XLFP_MOSTSTREAMBUFFERSETNEXT xlMostStreamBufferSetNext = NULL;
XLFP_MOSTSTREAMGETINFO xlMostStreamGetInfo = NULL;
XLFP_MOSTSTREAMBUFFERCLEARALL xlMostStreamBufferClearAll = NULL;
// FlexRay specific functions
XLFP_FRSETCONFIGURATION xlFrSetConfiguration = NULL;
XLFP_FRGETCHANNELCONFIGURATION xlFrGetChannelConfiguration = NULL;
XLFP_FRSETMODE xlFrSetMode = NULL;
XLFP_FRINITSTARTUPANDSYNC xlFrInitStartupAndSync = NULL;
XLFP_FRSETUPSYMBOLWINDOW xlFrSetupSymbolWindow = NULL;
XLFP_FRRECEIVE xlFrReceive = NULL;
XLFP_FRTRANSMIT xlFrTransmit = NULL;
XLFP_FRSETTRANSCEIVERMODE xlFrSetTransceiverMode = NULL;
XLFP_FRSENDSYMBOLWINDOW xlFrSendSymbolWindow = NULL;
XLFP_FRACTIVATESPY xlFrActivateSpy = NULL;
XLFP_FRSETACCEPTANCEFILTER xlFrSetAcceptanceFilter = NULL;
// MOST150 specific functions
XLFP_MOST150SWITCHEVENTSOURCES xlMost150SwitchEventSources = NULL;
XLFP_MOST150SETDEVICEMODE xlMost150SetDeviceMode = NULL;
XLFP_MOST150GETDEVICEMODE xlMost150GetDeviceMode = NULL;
XLFP_MOST150SETSPDIFMODE xlMost150SetSPDIFMode = NULL;
XLFP_MOST150GETSPDIFMODE xlMost150GetSPDIFMode = NULL;
XLFP_MOST150RECEIVE xlMost150Receive = NULL;
XLFP_MOST150SETSPECIALNODEINFO xlMost150SetSpecialNodeInfo = NULL;
XLFP_MOST150GETSPECIALNODEINFO xlMost150GetSpecialNodeInfo = NULL;
XLFP_MOST150SETFREQUENCY xlMost150SetFrequency = NULL;
XLFP_MOST150GETFREQUENCY xlMost150GetFrequency = NULL;
XLFP_MOST150CTRLTRANSMIT xlMost150CtrlTransmit = NULL;
XLFP_MOST150ASYNCTRANSMIT xlMost150AsyncTransmit = NULL;
XLFP_MOST150ETHTRANSMIT xlMost150EthernetTransmit = NULL;
XLFP_MOST150GETSYSTEMLOCK xlMost150GetSystemLockFlag = NULL;
XLFP_MOST150GETSHUTDOWN xlMost150GetShutdownFlag = NULL;
XLFP_MOST150SHUTDOWN xlMost150Shutdown = NULL;
XLFP_MOST150STARTUP xlMost150Startup = NULL;
XLFP_MOST150GETALLOCTABLE xlMost150SyncGetAllocTable = NULL;
XLFP_MOST150CTRLSYNCAUDIO xlMost150CtrlSyncAudio = NULL;
XLFP_MOST150SYNCSETVOLUME xlMost150SyncSetVolume = NULL;
XLFP_MOST150SYNCGETVOLUME xlMost150SyncGetVolume = NULL;
XLFP_MOST150SYNCSETMUTE xlMost150SyncSetMute = NULL;
XLFP_MOST150SYNCGETMUTE xlMost150SyncGetMute = NULL;
XLFP_MOST150GETLIGHTLOCKSTATUS xlMost150GetRxLightLockStatus = NULL;
XLFP_MOST150SETTXLIGHT xlMost150SetTxLight = NULL;
XLFP_MOST150GETTXLIGHT xlMost150GetTxLight = NULL;
XLFP_MOST150SETTXLIGHTPOWER xlMost150SetTxLightPower = NULL;
XLFP_MOST150GENLIGHTERROR xlMost150GenerateLightError = NULL;
XLFP_MOST150GENLOCKERROR xlMost150GenerateLockError = NULL;
XLFP_MOST150CONFIGURERXBUFFER xlMost150ConfigureRxBuffer = NULL;
XLFP_MOST150CTRLCONFIGLOAD xlMost150CtrlConfigureBusload = NULL;
XLFP_MOST150CTRLGENLOAD xlMost150CtrlGenerateBusload = NULL;
XLFP_MOST150ASYNCCONFIGLOAD xlMost150AsyncConfigureBusload = NULL;
XLFP_MOST150ASYNCGENLOAD xlMost150AsyncGenerateBusload = NULL;
XLFP_MOST150SETECLLINE xlMost150SetECLLine = NULL;
XLFP_MOST150SETECLTERMINATION xlMost150SetECLTermination = NULL;
XLFP_MOST150TWINKLEPOWERLED xlMost150TwinklePowerLed = NULL;
XLFP_MOST150GETECLINFO xlMost150GetECLInfo = NULL;
XLFP_MOST150STREAMOPEN xlMost150StreamOpen = NULL;
XLFP_MOST150STREAMCLOSE xlMost150StreamClose = NULL;
XLFP_MOST150STREAMSTART xlMost150StreamStart = NULL;
XLFP_MOST150STREAMSTOP xlMost150StreamStop = NULL;
XLFP_MOST150STREAMTRANSMITDATA xlMost150StreamTransmitData = NULL;
XLFP_MOST150STREAMCLEARTXFIFO xlMost150StreamClearTxFifo = NULL;
XLFP_MOST150STREAMGETINFO xlMost150StreamGetInfo = NULL;
XLFP_MOST150STREAMINITRXFIFO xlMost150StreamInitRxFifo = NULL;
XLFP_MOST150STREAMRECEIVEDATA xlMost150StreamReceiveData = NULL;
XLFP_MOST150GENERATEBYPASSSTRESS xlMost150GenerateBypassStress = NULL;
XLFP_MOST150ECLCONFIGURESEQ xlMost150EclConfigureSeq = NULL;
XLFP_MOST150ECLGENERATESEQ xlMost150EclGenerateSeq = NULL;
XLFP_MOST150SETECLGLITCHFILTER xlMost150SetECLGlitchFilter = NULL;
XLFP_MOST150SETSSORESULT xlMost150SetSSOResult = NULL;
XLFP_MOST150GETSSORESULT xlMost150GetSSOResult = NULL;
// Ethernet specific funtions
XLFP_ETHSETCONFIG xlEthSetConfig = NULL;
XLFP_ETHGETCONFIG xlEthGetConfig = NULL;
XLFP_ETHRECEIVE xlEthReceive = NULL;
XLFP_ETHSETBYPASS xlEthSetBypass = NULL;
XLFP_ETHTWINKLESTATUSLED xlEthTwinkleStatusLed = NULL;
XLFP_ETHTRANSMIT xlEthTransmit = NULL;
// IOpiggy specific functions
XLIOSETTRIGGERMODE xlIoSetTriggerMode = NULL;
XLIOSETDIGITALOUTPUT xlIoSetDigitalOutput = NULL;
XLIOCONFIGUREPORTS xlIoConfigurePorts = NULL;
XLIOSETDIGINTHRESHOLD xlIoSetDigInThreshold = NULL;
XLIOSETDIGOUTLEVEL xlIoSetDigOutLevel = NULL;
XLIOSETANALOGOUTPUT xlIoSetAnalogOutput = NULL;
XLIOSTARTSAMPLING xlIoStartSampling = NULL;
// Remote specific functions
XLGETREMOTEDEVICEINFO xlGetRemoteDeviceInfo = NULL;
XLRELEASEREMOTEDEVICEINFO xlReleaseRemoteDeviceInfo = NULL;
XLADDREMOTEDEVICE xlAddRemoteDevice = NULL;
XLREMOVEREMOTEDEVICE xlRemoveRemoteDevice = NULL;
XLUPDATEREMOTEDEVICEINFO xlUpdateRemoteDeviceInfo = NULL;
XLGETREMOTEHWINFO xlGetRemoteHwInfo = NULL;
// A429 specific functions
XLFP_A429RECEIVE xlA429Receive = NULL;
XLFP_A429SETCHANNELPARAMS xlA429SetChannelParams = NULL;
XLFP_A429TRANSMIT xlA429Transmit = NULL;
// Keyman license dongle specific functions
XLFP_GETKEYMANBOXES xlGetKeymanBoxes = NULL;
XLFP_GETKEYMANINFO xlGetKeymanInfo = NULL;
//Local variables
static XLCLOSEDRIVER xlDllCloseDriver = NULL;
static XLOPENDRIVER xlDllOpenDriver = NULL;
static HINSTANCE hxlDll;
////////////////////////////////////////////////////////////////////////////
//! xlLoadLibrary()
//! Loads API functions from DLL
//!
////////////////////////////////////////////////////////////////////////////
XLstatus xlLoadLibrary(char const * library){
if (!hxlDll)
hxlDll = LoadLibrary(library);
if (!hxlDll){
#ifdef _MFC_VER
#ifdef WIN64
MessageBox(NULL,"Dynamic XL Driver Library - not found (vxlapi64.dll)","XL API",MB_OK|MB_ICONEXCLAMATION);
#else
MessageBox(NULL,"Dynamic XL Driver Library - not found (vxlapi.dll)","XL API",MB_OK|MB_ICONEXCLAMATION);
#endif
#else
#ifdef WIN64
printf("Dynamic XL Driver Library - not found (vxlapi64.dll)\n");
#else
printf("Dynamic XL Driver Library - not found (vxlapi.dll)\n");
#endif
#endif
return XL_ERROR;
} else {
unsigned int NotFoundAll = 0;
if ( (xlDllOpenDriver = (XLOPENDRIVER)GetProcAddress(hxlDll,"xlOpenDriver") )==NULL) NotFoundAll= 1;
if ( (xlDllCloseDriver = (XLCLOSEDRIVER)GetProcAddress(hxlDll,"xlCloseDriver") )==NULL) NotFoundAll= 2;
// bus independed functions
if ( (xlGetApplConfig = (XLGETAPPLCONFIG)GetProcAddress(hxlDll,"xlGetApplConfig") )==NULL) NotFoundAll= 3;
if ( (xlSetApplConfig = (XLSETAPPLCONFIG)GetProcAddress(hxlDll,"xlSetApplConfig") )==NULL) NotFoundAll= 4;
if ( (xlGetDriverConfig = (XLGETDRIVERCONFIG)GetProcAddress(hxlDll,"xlGetDriverConfig") )==NULL) NotFoundAll= 5;
if ( (xlGetChannelIndex = (XLGETCHANNELINDEX)GetProcAddress(hxlDll,"xlGetChannelIndex") )==NULL) NotFoundAll= 6;
if ( (xlGetChannelMask = (XLGETCHANNELMASK)GetProcAddress(hxlDll,"xlGetChannelMask") )==NULL) NotFoundAll= 7;
if ( (xlOpenPort = (XLOPENPORT)GetProcAddress(hxlDll,"xlOpenPort") )==NULL) NotFoundAll= 8;
if ( (xlSetTimerRate = (XLSETTIMERRATE)GetProcAddress(hxlDll,"xlSetTimerRate") )==NULL) NotFoundAll= 9;
if ( (xlResetClock = (XLRESETCLOCK)GetProcAddress(hxlDll,"xlResetClock") )==NULL) NotFoundAll=10;
if ( (xlSetNotification = (XLSETNOTIFICATION)GetProcAddress(hxlDll,"xlSetNotification") )==NULL) NotFoundAll=11;
if ( (xlFlushReceiveQueue = (XLFLUSHRECEIVEQUEUE)GetProcAddress(hxlDll,"xlFlushReceiveQueue") )==NULL) NotFoundAll=12;
if ( (xlGetReceiveQueueLevel = (XLGETRECEIVEQUEUELEVEL)GetProcAddress(hxlDll,"xlGetReceiveQueueLevel") )==NULL) NotFoundAll=13;
if ( (xlActivateChannel = (XLACTIVATECHANNEL)GetProcAddress(hxlDll,"xlActivateChannel") )==NULL) NotFoundAll=14;
if ( (xlReceive = (XLRECEIVE)GetProcAddress(hxlDll,"xlReceive") )==NULL) NotFoundAll=15;
if ( (xlGetEventString = (XLGETEVENTSTRING)GetProcAddress(hxlDll,"xlGetEventString") )==NULL) NotFoundAll=16;
if ( (xlGetErrorString = (XLGETERRORSTRING)GetProcAddress(hxlDll,"xlGetErrorString") )==NULL) NotFoundAll=17;
if ( (xlGenerateSyncPulse = (XLGENERATESYNCPULSE)GetProcAddress(hxlDll,"xlGenerateSyncPulse") )==NULL) NotFoundAll=18;
if ( (xlGetSyncTime = (XLGETSYNCTIME) GetProcAddress(hxlDll,"xlGetSyncTime") )==NULL) NotFoundAll=19;
if ( (xlPopupHwConfig = (XLPOPUPHWCONFIG)GetProcAddress(hxlDll,"xlPopupHwConfig") )==NULL) NotFoundAll=20;
if ( (xlDeactivateChannel = (XLDEACTIVATECHANNEL)GetProcAddress(hxlDll,"xlDeactivateChannel") )==NULL) NotFoundAll=21;
if ( (xlClosePort = (XLCLOSEPORT )GetProcAddress(hxlDll,"xlClosePort") )==NULL) NotFoundAll=22;
if ( (xlSetTimerBasedNotify = (XLSETTIMERBASEDNOTIFY)GetProcAddress(hxlDll,"xlSetTimerBasedNotify") )==NULL) NotFoundAll=110;
if ( (xlSetTimerRateAndChannel = (XLSETTIMERRATEANDCHANNEL) GetProcAddress(hxlDll, "xlSetTimerRateAndChannel") )==NULL) NotFoundAll=111;
if ( (xlGetLicenseInfo = (XLGETLICENSEINFO) GetProcAddress(hxlDll, "xlGetLicenseInfo") )==NULL) NotFoundAll=112;
if ( (xlGetChannelTime = (XLGETCHANNELTIME)GetProcAddress(hxlDll,"xlGetChannelTime") )==NULL) NotFoundAll=113;
if( (xlGetRemoteDriverConfig = (XLGETREMOTEDRIVERCONFIG) GetProcAddress(hxlDll, "xlGetRemoteDriverConfig") ) == NULL) NotFoundAll=114;
// CAN specific functions
if ( (xlCanSetChannelOutput = (XLCANSETCHANNELOUTPUT)GetProcAddress(hxlDll,"xlCanSetChannelOutput") )==NULL) NotFoundAll=23;
if ( (xlCanSetChannelMode = (XLCANSETCHANNELMODE)GetProcAddress(hxlDll,"xlCanSetChannelMode") )==NULL) NotFoundAll=24;
if ( (xlCanSetReceiveMode = (XLCANSETRECEIVEMODE)GetProcAddress(hxlDll,"xlCanSetReceiveMode") ) == NULL) NotFoundAll=25;
if ( (xlCanSetChannelTransceiver = (XLCANSETCHANNELTRANSCEIVER)GetProcAddress(hxlDll,"xlCanSetChannelTransceiver") ) == NULL) NotFoundAll=26;
if ( (xlCanSetChannelParams = (XLCANSETCHANNELPARAMS)GetProcAddress(hxlDll,"xlCanSetChannelParams") ) == NULL) NotFoundAll=27;
if ( (xlCanSetChannelParamsC200 = (XLCANSETCHANNELPARAMSC200)GetProcAddress(hxlDll,"xlCanSetChannelParamsC200") )==NULL) NotFoundAll=28;
if ( (xlCanSetChannelBitrate = (XLCANSETCHANNELBITRATE)GetProcAddress(hxlDll,"xlCanSetChannelBitrate") )==NULL) NotFoundAll=29;
if ( (xlCanSetChannelAcceptance = (XLCANSETCHANNELACCEPTANCE)GetProcAddress(hxlDll,"xlCanSetChannelAcceptance") )==NULL) NotFoundAll=30;
if ( (xlCanAddAcceptanceRange = (XLCANADDACCEPTANCERANGE)GetProcAddress(hxlDll,"xlCanAddAcceptanceRange") )==NULL) NotFoundAll=31;
if ( (xlCanRemoveAcceptanceRange = (XLCANREMOVEACCEPTANCERANGE)GetProcAddress(hxlDll,"xlCanRemoveAcceptanceRange") )==NULL) NotFoundAll=32;
if ( (xlCanResetAcceptance = (XLCANRESETACCEPTANCE)GetProcAddress(hxlDll,"xlCanResetAcceptance") )==NULL) NotFoundAll=33;
if ( (xlCanRequestChipState = (XLCANREQUESTCHIPSTATE)GetProcAddress(hxlDll,"xlCanRequestChipState") )==NULL) NotFoundAll=34;
if ( (xlCanFlushTransmitQueue = (XLCANFLUSHTRANSMITQUEUE)GetProcAddress(hxlDll,"xlCanFlushTransmitQueue") )==NULL) NotFoundAll=35;
if ( (xlCanTransmit = (XLCANTRANSMIT)GetProcAddress(hxlDll,"xlCanTransmit") )==NULL) NotFoundAll=36;
// LIN specific functions
if ( (xlLinSetChannelParams = (XLLINSETCHANNELPARAMS)GetProcAddress(hxlDll,"xlLinSetChannelParams") )==NULL) NotFoundAll=37;
if ( (xlLinSetDLC = (XLLINSETDLC)GetProcAddress(hxlDll,"xlLinSetDLC") )==NULL) NotFoundAll=38;
if ( (xlLinSetSlave = (XLLINSETSLAVE)GetProcAddress(hxlDll,"xlLinSetSlave") )==NULL) NotFoundAll=39;
if ( (xlLinSendRequest = (XLLINSENDREQUEST)GetProcAddress(hxlDll,"xlLinSendRequest") )==NULL) NotFoundAll=40;
if ( (xlLinWakeUp = (XLLINWAKEUP) GetProcAddress(hxlDll,"xlLinWakeUp") )==NULL) NotFoundAll=41;
if ( (xlLinSetChecksum = (XLLINSETCHECKSUM) GetProcAddress(hxlDll,"xlLinSetChecksum") )==NULL) NotFoundAll=42;
if ( (xlLinSwitchSlave = (XLLINSWITCHSLAVE) GetProcAddress(hxlDll,"xlLinSwitchSlave") )==NULL) NotFoundAll=43;
if ( (xlLinSetSleepMode = (XLLINSETSLEEPMODE) GetProcAddress(hxlDll,"xlLinSetSleepMode") )==NULL) NotFoundAll=190;
// IOcab specific functions
if ( (xlDAIOSetPWMOutput = (XLDAIOSETPWMOUTPUT)GetProcAddress(hxlDll,"xlDAIOSetPWMOutput") )==NULL) NotFoundAll=44;
if ( (xlDAIOSetDigitalOutput = (XLDAIOSETDIGITALOUTPUT)GetProcAddress(hxlDll,"xlDAIOSetDigitalOutput") )==NULL) NotFoundAll=45;
if ( (xlDAIOSetAnalogOutput = (XLDAIOSETANALOGOUTPUT)GetProcAddress(hxlDll,"xlDAIOSetAnalogOutput") )==NULL) NotFoundAll=46;
if ( (xlDAIORequestMeasurement = (XLDAIOREQUESTMEASUREMENT)GetProcAddress(hxlDll,"xlDAIORequestMeasurement") )==NULL) NotFoundAll=47;
if ( (xlDAIOSetDigitalParameters = (XLDAIOSETDIGITALPARAMETERS) GetProcAddress(hxlDll,"xlDAIOSetDigitalParameters") )==NULL) NotFoundAll=48;
if ( (xlDAIOSetAnalogParameters = (XLDAIOSETANALOGPARAMETERS)GetProcAddress(hxlDll,"xlDAIOSetAnalogParameters") )==NULL) NotFoundAll=49;
if ( (xlDAIOSetAnalogTrigger = (XLDAIOSETANALOGTRIGGER) GetProcAddress(hxlDll,"xlDAIOSetAnalogTrigger") )==NULL) NotFoundAll=50;
if ( (xlDAIOSetMeasurementFrequency = (XLDAIOSETMEASUREMENTFREQUENCY)GetProcAddress(hxlDll,"xlDAIOSetMeasurementFrequency") )==NULL) NotFoundAll=51;
// MOST specific functions
if ((xlMostReceive = (XLFP_MOSTRECEIVE) GetProcAddress(hxlDll,"xlMostReceive")) == NULL) NotFoundAll=52;
if ((xlMostCtrlTransmit = (XLFP_MOSTCTRLTRANSMIT) GetProcAddress(hxlDll,"xlMostCtrlTransmit")) == NULL) NotFoundAll=53;
if ((xlMostSwitchEventSources = (XLFP_MOSTSWITCHEVENTSOURCES) GetProcAddress(hxlDll,"xlMostSwitchEventSources")) == NULL) NotFoundAll=54;
if ((xlMostSetAllBypass = (XLFP_MOSTSETALLBYPASS) GetProcAddress(hxlDll,"xlMostSetAllBypass")) == NULL) NotFoundAll=55;
if ((xlMostGetAllBypass = (XLFP_MOSTGETALLBYPASS) GetProcAddress(hxlDll,"xlMostGetAllBypass")) == NULL) NotFoundAll=56;
if ((xlMostSetTimingMode = (XLFP_MOSTSETTIMINGMODE) GetProcAddress(hxlDll,"xlMostSetTimingMode")) == NULL) NotFoundAll=57;
if ((xlMostGetTimingMode = (XLFP_MOSTGETTIMINGMODE) GetProcAddress(hxlDll,"xlMostGetTimingMode")) == NULL) NotFoundAll=58;
if ((xlMostSetFrequency = (XLFP_MOSTSETFREQUENCY) GetProcAddress(hxlDll,"xlMostSetFrequency")) == NULL) NotFoundAll=59;
if ((xlMostGetFrequency = (XLFP_MOSTGETFREQUENCY) GetProcAddress(hxlDll,"xlMostGetFrequency")) == NULL) NotFoundAll=60;
if ((xlMostWriteRegister = (XLFP_MOSTWRITEREGISTER) GetProcAddress(hxlDll,"xlMostWriteRegister")) == NULL) NotFoundAll=61;
if ((xlMostReadRegister = (XLFP_MOSTREADREGISTER) GetProcAddress(hxlDll,"xlMostReadRegister")) == NULL) NotFoundAll=62;
if ((xlMostWriteRegisterBit = (XLFP_MOSTWRITEREGISTERBIT) GetProcAddress(hxlDll,"xlMostWriteRegisterBit")) == NULL) NotFoundAll=63;
if ((xlMostSyncGetAllocTable = (XLFP_MOSTSYNCGETALLOCTABLE) GetProcAddress(hxlDll,"xlMostSyncGetAllocTable")) == NULL) NotFoundAll=64;
if ((xlMostCtrlSyncAudio = (XLFP_MOSTCTRLSYNCAUDIO) GetProcAddress(hxlDll,"xlMostCtrlSyncAudio")) == NULL) NotFoundAll=65;
if ((xlMostCtrlSyncAudioEx = (XLFP_MOSTCTRLSYNCAUDIOEX) GetProcAddress(hxlDll,"xlMostCtrlSyncAudioEx")) == NULL) NotFoundAll=66;
if ((xlMostSyncVolume = (XLFP_MOSTSYNCVOLUME) GetProcAddress(hxlDll,"xlMostSyncVolume")) == NULL) NotFoundAll=67;
if ((xlMostSyncMute = (XLFP_MOSTSYNCMUTE) GetProcAddress(hxlDll,"xlMostSyncMute")) == NULL) NotFoundAll=68;
if ((xlMostSyncGetVolumeStatus = (XLFP_MOSTSYNCGETVOLUMESTATUS) GetProcAddress(hxlDll,"xlMostSyncGetVolumeStatus")) == NULL) NotFoundAll=69;
if ((xlMostSyncGetMuteStatus = (XLFP_MOSTSYNCGETMUTESTATUS) GetProcAddress(hxlDll,"xlMostSyncGetMuteStatus")) == NULL) NotFoundAll=70;
if ((xlMostGetRxLight = (XLFP_MOSTGETRXLIGHT) GetProcAddress(hxlDll,"xlMostGetRxLight")) == NULL) NotFoundAll=71;
if ((xlMostSetTxLight = (XLFP_MOSTSETTXLIGHT) GetProcAddress(hxlDll,"xlMostSetTxLight")) == NULL) NotFoundAll=72;
if ((xlMostGetTxLight = (XLFP_MOSTGETTXLIGHT) GetProcAddress(hxlDll,"xlMostGetTxLight")) == NULL) NotFoundAll=73;
if ((xlMostSetLightPower = (XLFP_MOSTSETLIGHTPOWER) GetProcAddress(hxlDll,"xlMostSetLightPower")) == NULL) NotFoundAll=74;
if ((xlMostGetLockStatus = (XLFP_MOSTGETLOCKSTATUS) GetProcAddress(hxlDll,"xlMostGetLockStatus")) == NULL) NotFoundAll=75;
if ((xlMostGenerateLightError = (XLFP_MOSTGENERATELIGHTERROR) GetProcAddress(hxlDll,"xlMostGenerateLightError")) == NULL) NotFoundAll=76;
if ((xlMostGenerateLockError = (XLFP_MOSTGENERATELOCKERROR) GetProcAddress(hxlDll,"xlMostGenerateLockError")) == NULL) NotFoundAll=77;
if ((xlMostCtrlRxBuffer = (XLFP_MOSTCTRLRXBUFFER) GetProcAddress(hxlDll,"xlMostCtrlRxBuffer")) == NULL) NotFoundAll=78;
if ((xlMostTwinklePowerLed = (XLFP_MOSTTWINKLEPOWERLED) GetProcAddress(hxlDll,"xlMostTwinklePowerLed")) == NULL) NotFoundAll=79;
if ((xlMostAsyncTransmit = (XLFP_MOSTASYNCTRANSMIT) GetProcAddress(hxlDll,"xlMostAsyncTransmit")) == NULL) NotFoundAll=80;
if ((xlMostCtrlConfigureBusload = (XLFP_MOSTCTRLCONFIGUREBUSLOAD) GetProcAddress(hxlDll,"xlMostCtrlConfigureBusload")) == NULL) NotFoundAll=81;
if ((xlMostCtrlGenerateBusload = (XLFP_MOSTCTRLGENERATEBUSLOAD) GetProcAddress(hxlDll,"xlMostCtrlGenerateBusload")) == NULL) NotFoundAll=82;
if ((xlMostAsyncConfigureBusload = (XLFP_MOSTASYNCCONFIGUREBUSLOAD) GetProcAddress(hxlDll,"xlMostAsyncConfigureBusload")) == NULL) NotFoundAll=83;
if ((xlMostAsyncGenerateBusload = (XLFP_MOSTASYNCGENERATEBUSLOAD) GetProcAddress(hxlDll,"xlMostAsyncGenerateBusload")) == NULL) NotFoundAll=84;
if ((xlMostStreamOpen = (XLFP_MOSTSTREAMOPEN) GetProcAddress(hxlDll,"xlMostStreamOpen")) == NULL) NotFoundAll=85;
if ((xlMostStreamClose = (XLFP_MOSTSTREAMCLOSE) GetProcAddress(hxlDll,"xlMostStreamClose")) == NULL) NotFoundAll=86;
if ((xlMostStreamStart = (XLFP_MOSTSTREAMSTART) GetProcAddress(hxlDll,"xlMostStreamStart")) == NULL) NotFoundAll=87;
if ((xlMostStreamStop = (XLFP_MOSTSTREAMSTOP) GetProcAddress(hxlDll,"xlMostStreamStop")) == NULL) NotFoundAll=88;
if ((xlMostStreamBufferAllocate = (XLFP_MOSTSTREAMBUFFERALLOCATE) GetProcAddress(hxlDll,"xlMostStreamBufferAllocate")) == NULL) NotFoundAll=89;
if ((xlMostStreamBufferDeallocateAll = (XLFP_MOSTSTREAMBUFFERDEALLOCATEALL) GetProcAddress(hxlDll,"xlMostStreamBufferDeallocateAll")) == NULL) NotFoundAll=90;
if ((xlMostStreamBufferSetNext = (XLFP_MOSTSTREAMBUFFERSETNEXT) GetProcAddress(hxlDll,"xlMostStreamBufferSetNext")) == NULL) NotFoundAll=91;
if ((xlMostStreamGetInfo = (XLFP_MOSTSTREAMGETINFO) GetProcAddress(hxlDll,"xlMostStreamGetInfo")) == NULL) NotFoundAll=92;
if ((xlMostStreamBufferClearAll = (XLFP_MOSTSTREAMBUFFERCLEARALL) GetProcAddress(hxlDll,"xlMostStreamBufferClearAll")) == NULL) NotFoundAll=93;
// FlexRay specific functions
if ((xlFrSetConfiguration = (XLFP_FRSETCONFIGURATION) GetProcAddress(hxlDll,"xlFrSetConfiguration")) == NULL) NotFoundAll=100;
if ((xlFrGetChannelConfiguration = (XLFP_FRGETCHANNELCONFIGURATION) GetProcAddress(hxlDll,"xlFrGetChannelConfiguration")) == NULL) NotFoundAll=101;
if ((xlFrSetMode = (XLFP_FRSETMODE) GetProcAddress(hxlDll,"xlFrSetMode")) == NULL) NotFoundAll=102;
if ((xlFrInitStartupAndSync = (XLFP_FRINITSTARTUPANDSYNC) GetProcAddress(hxlDll,"xlFrInitStartupAndSync")) == NULL) NotFoundAll=103;
if ((xlFrSetupSymbolWindow = (XLFP_FRSETUPSYMBOLWINDOW) GetProcAddress(hxlDll,"xlFrSetupSymbolWindow")) == NULL) NotFoundAll=104;
if ((xlFrReceive = (XLFP_FRRECEIVE) GetProcAddress(hxlDll,"xlFrReceive")) == NULL) NotFoundAll=105;
if ((xlFrTransmit = (XLFP_FRTRANSMIT) GetProcAddress(hxlDll,"xlFrTransmit")) == NULL) NotFoundAll=106;
if ((xlFrSetTransceiverMode = (XLFP_FRSETTRANSCEIVERMODE) GetProcAddress(hxlDll,"xlFrSetTransceiverMode")) == NULL) NotFoundAll=107;
if ((xlFrSendSymbolWindow = (XLFP_FRSENDSYMBOLWINDOW) GetProcAddress(hxlDll,"xlFrSendSymbolWindow")) == NULL) NotFoundAll=108;
if ((xlFrActivateSpy = (XLFP_FRACTIVATESPY) GetProcAddress(hxlDll,"xlFrActivateSpy")) == NULL) NotFoundAll=109;
if ((xlFrSetAcceptanceFilter = (XLFP_FRSETACCEPTANCEFILTER) GetProcAddress(hxlDll,"xlFrSetAcceptanceFilter")) == NULL) NotFoundAll=120;
// MOST150 specific functions
if ((xlMost150SwitchEventSources = (XLFP_MOST150SWITCHEVENTSOURCES) GetProcAddress(hxlDll,"xlMost150SwitchEventSources")) == NULL) NotFoundAll=110;
if ((xlMost150SetDeviceMode = (XLFP_MOST150SETDEVICEMODE) GetProcAddress(hxlDll,"xlMost150SetDeviceMode")) == NULL) NotFoundAll=112;
if ((xlMost150GetDeviceMode = (XLFP_MOST150GETDEVICEMODE) GetProcAddress(hxlDll,"xlMost150GetDeviceMode")) == NULL) NotFoundAll=113;
if ((xlMost150SetSPDIFMode = (XLFP_MOST150SETSPDIFMODE) GetProcAddress(hxlDll,"xlMost150SetSPDIFMode")) == NULL) NotFoundAll=114;
if ((xlMost150GetSPDIFMode = (XLFP_MOST150GETSPDIFMODE) GetProcAddress(hxlDll,"xlMost150GetSPDIFMode")) == NULL) NotFoundAll=115;
if ((xlMost150Receive = (XLFP_MOST150RECEIVE) GetProcAddress(hxlDll,"xlMost150Receive")) == NULL) NotFoundAll=130;
if ((xlMost150SetSpecialNodeInfo = (XLFP_MOST150SETSPECIALNODEINFO) GetProcAddress(hxlDll,"xlMost150SetSpecialNodeInfo")) == NULL) NotFoundAll=131;
if ((xlMost150GetSpecialNodeInfo = (XLFP_MOST150GETSPECIALNODEINFO) GetProcAddress(hxlDll,"xlMost150GetSpecialNodeInfo")) == NULL) NotFoundAll=132;
if ((xlMost150SetFrequency = (XLFP_MOST150SETFREQUENCY) GetProcAddress(hxlDll,"xlMost150SetFrequency")) == NULL) NotFoundAll=133;
if ((xlMost150GetFrequency = (XLFP_MOST150GETFREQUENCY) GetProcAddress(hxlDll,"xlMost150GetFrequency")) == NULL) NotFoundAll=134;
if ((xlMost150CtrlTransmit = (XLFP_MOST150CTRLTRANSMIT) GetProcAddress(hxlDll,"xlMost150CtrlTransmit")) == NULL) NotFoundAll=135;
if ((xlMost150AsyncTransmit = (XLFP_MOST150ASYNCTRANSMIT) GetProcAddress(hxlDll,"xlMost150AsyncTransmit")) == NULL) NotFoundAll=136;
if ((xlMost150EthernetTransmit = (XLFP_MOST150ETHTRANSMIT) GetProcAddress(hxlDll,"xlMost150EthernetTransmit")) == NULL) NotFoundAll=137;
if ((xlMost150GetSystemLockFlag = (XLFP_MOST150GETSYSTEMLOCK) GetProcAddress(hxlDll,"xlMost150GetSystemLockFlag")) == NULL) NotFoundAll=138;
if ((xlMost150GetShutdownFlag = (XLFP_MOST150GETSHUTDOWN) GetProcAddress(hxlDll,"xlMost150GetShutdownFlag")) == NULL) NotFoundAll=139;
if ((xlMost150Shutdown = (XLFP_MOST150SHUTDOWN) GetProcAddress(hxlDll,"xlMost150Shutdown")) == NULL) NotFoundAll=140;
if ((xlMost150Startup = (XLFP_MOST150STARTUP) GetProcAddress(hxlDll,"xlMost150Startup")) == NULL) NotFoundAll=141;
if ((xlMost150SyncGetAllocTable = (XLFP_MOST150GETALLOCTABLE) GetProcAddress(hxlDll,"xlMost150SyncGetAllocTable")) == NULL) NotFoundAll=142;
if ((xlMost150CtrlSyncAudio = (XLFP_MOST150CTRLSYNCAUDIO) GetProcAddress(hxlDll,"xlMost150CtrlSyncAudio")) == NULL) NotFoundAll=143;
if ((xlMost150SyncSetVolume = (XLFP_MOST150SYNCSETVOLUME) GetProcAddress(hxlDll,"xlMost150SyncSetVolume")) == NULL) NotFoundAll=144;
if ((xlMost150SyncGetVolume = (XLFP_MOST150SYNCGETVOLUME) GetProcAddress(hxlDll,"xlMost150SyncGetVolume")) == NULL) NotFoundAll=145;
if ((xlMost150SyncSetMute = (XLFP_MOST150SYNCSETMUTE) GetProcAddress(hxlDll,"xlMost150SyncSetMute")) == NULL) NotFoundAll=146;
if ((xlMost150SyncGetMute = (XLFP_MOST150SYNCGETMUTE) GetProcAddress(hxlDll,"xlMost150SyncGetMute")) == NULL) NotFoundAll=147;
if ((xlMost150GetRxLightLockStatus = (XLFP_MOST150GETLIGHTLOCKSTATUS) GetProcAddress(hxlDll,"xlMost150GetRxLightLockStatus")) == NULL) NotFoundAll=148;
if ((xlMost150SetTxLight = (XLFP_MOST150SETTXLIGHT) GetProcAddress(hxlDll,"xlMost150SetTxLight")) == NULL) NotFoundAll=149;
if ((xlMost150GetTxLight = (XLFP_MOST150GETTXLIGHT) GetProcAddress(hxlDll,"xlMost150GetTxLight")) == NULL) NotFoundAll=150;
if ((xlMost150SetTxLightPower = (XLFP_MOST150SETTXLIGHTPOWER) GetProcAddress(hxlDll,"xlMost150SetTxLightPower")) == NULL) NotFoundAll=151;
if ((xlMost150GenerateLightError = (XLFP_MOST150GENLIGHTERROR) GetProcAddress(hxlDll,"xlMost150GenerateLightError")) == NULL) NotFoundAll=152;
if ((xlMost150GenerateLockError = (XLFP_MOST150GENLOCKERROR) GetProcAddress(hxlDll,"xlMost150GenerateLockError")) == NULL) NotFoundAll=153;
if ((xlMost150ConfigureRxBuffer = (XLFP_MOST150CONFIGURERXBUFFER) GetProcAddress(hxlDll,"xlMost150ConfigureRxBuffer")) == NULL) NotFoundAll=154;
if ((xlMost150CtrlConfigureBusload = (XLFP_MOST150CTRLCONFIGLOAD) GetProcAddress(hxlDll,"xlMost150CtrlConfigureBusload")) == NULL) NotFoundAll=155;
if ((xlMost150CtrlGenerateBusload = (XLFP_MOST150CTRLGENLOAD) GetProcAddress(hxlDll,"xlMost150CtrlGenerateBusload")) == NULL) NotFoundAll=156;
if ((xlMost150AsyncConfigureBusload = (XLFP_MOST150ASYNCCONFIGLOAD) GetProcAddress(hxlDll,"xlMost150AsyncConfigureBusload")) == NULL) NotFoundAll=157;
if ((xlMost150AsyncGenerateBusload = (XLFP_MOST150ASYNCGENLOAD) GetProcAddress(hxlDll,"xlMost150AsyncGenerateBusload")) == NULL) NotFoundAll=158;
if ((xlMost150SetECLLine = (XLFP_MOST150SETECLLINE) GetProcAddress(hxlDll,"xlMost150SetECLLine")) == NULL) NotFoundAll=163;
if ((xlMost150SetECLTermination = (XLFP_MOST150SETECLTERMINATION) GetProcAddress(hxlDll,"xlMost150SetECLTermination")) == NULL) NotFoundAll=164;
if ((xlMost150TwinklePowerLed = (XLFP_MOST150TWINKLEPOWERLED) GetProcAddress(hxlDll,"xlMost150TwinklePowerLed")) == NULL) NotFoundAll=165;
if ((xlMost150GetECLInfo = (XLFP_MOST150GETECLINFO) GetProcAddress(hxlDll,"xlMost150GetECLInfo")) == NULL) NotFoundAll=166;
if ((xlMost150StreamOpen = (XLFP_MOST150STREAMOPEN) GetProcAddress(hxlDll,"xlMost150StreamOpen")) == NULL) NotFoundAll=167;
if ((xlMost150StreamClose = (XLFP_MOST150STREAMCLOSE) GetProcAddress(hxlDll,"xlMost150StreamClose")) == NULL) NotFoundAll=168;
if ((xlMost150StreamStart = (XLFP_MOST150STREAMSTART) GetProcAddress(hxlDll,"xlMost150StreamStart")) == NULL) NotFoundAll=169;
if ((xlMost150StreamStop = (XLFP_MOST150STREAMSTOP) GetProcAddress(hxlDll,"xlMost150StreamStop")) == NULL) NotFoundAll=170;
if ((xlMost150StreamTransmitData = (XLFP_MOST150STREAMTRANSMITDATA) GetProcAddress(hxlDll,"xlMost150StreamTransmitData")) == NULL) NotFoundAll=171;
if ((xlMost150StreamClearTxFifo = (XLFP_MOST150STREAMCLEARTXFIFO) GetProcAddress(hxlDll,"xlMost150StreamClearTxFifo")) == NULL) NotFoundAll=172;
if ((xlMost150StreamGetInfo = (XLFP_MOST150STREAMGETINFO) GetProcAddress(hxlDll,"xlMost150StreamGetInfo")) == NULL) NotFoundAll=173;
if ((xlMost150StreamInitRxFifo = (XLFP_MOST150STREAMINITRXFIFO) GetProcAddress(hxlDll,"xlMost150StreamInitRxFifo")) == NULL) NotFoundAll=174;
if ((xlMost150StreamReceiveData = (XLFP_MOST150STREAMRECEIVEDATA) GetProcAddress(hxlDll,"xlMost150StreamReceiveData")) == NULL) NotFoundAll=175;
if ((xlMost150GenerateBypassStress = (XLFP_MOST150GENERATEBYPASSSTRESS) GetProcAddress(hxlDll,"xlMost150GenerateBypassStress")) == NULL) NotFoundAll=176;
if ((xlMost150EclConfigureSeq = (XLFP_MOST150ECLCONFIGURESEQ) GetProcAddress(hxlDll,"xlMost150EclConfigureSeq")) == NULL) NotFoundAll=177;
if ((xlMost150EclGenerateSeq = (XLFP_MOST150ECLGENERATESEQ) GetProcAddress(hxlDll,"xlMost150EclGenerateSeq")) == NULL) NotFoundAll=178;
if ((xlMost150SetECLGlitchFilter = (XLFP_MOST150SETECLGLITCHFILTER) GetProcAddress(hxlDll,"xlMost150SetECLGlitchFilter")) == NULL) NotFoundAll=179;
if ((xlMost150SetSSOResult = (XLFP_MOST150SETSSORESULT) GetProcAddress(hxlDll,"xlMost150SetSSOResult")) == NULL) NotFoundAll=180;
if ((xlMost150GetSSOResult = (XLFP_MOST150GETSSORESULT) GetProcAddress(hxlDll,"xlMost150GetSSOResult")) == NULL) NotFoundAll=181;
// CAN-FD specific functions
if ((xlCanFdSetConfiguration = (XLCANFDSETCONFIGURATION) GetProcAddress(hxlDll,"xlCanFdSetConfiguration")) == NULL) NotFoundAll=200;
if ((xlCanTransmitEx = (XLCANTRANSMITEX) GetProcAddress(hxlDll,"xlCanTransmitEx")) == NULL) NotFoundAll=201;
if ((xlCanReceive = (XLCANRECEIVE) GetProcAddress(hxlDll,"xlCanReceive")) == NULL) NotFoundAll=202;
if ((xlCanGetEventString = (XLCANGETEVENTSTRING) GetProcAddress(hxlDll,"xlCanGetEventString")) == NULL) NotFoundAll=203;
// IO piggy specific functions
if ((xlIoSetTriggerMode = (XLIOSETTRIGGERMODE) GetProcAddress(hxlDll,"xlIoSetTriggerMode")) == NULL) NotFoundAll=250;
if ((xlIoSetDigitalOutput = (XLIOSETDIGITALOUTPUT) GetProcAddress(hxlDll,"xlIoSetDigitalOutput")) == NULL) NotFoundAll=251;
if ((xlIoConfigurePorts = (XLIOCONFIGUREPORTS) GetProcAddress(hxlDll,"xlIoConfigurePorts")) == NULL) NotFoundAll=252;
if ((xlIoSetDigInThreshold = (XLIOSETDIGINTHRESHOLD) GetProcAddress(hxlDll,"xlIoSetDigInThreshold")) == NULL) NotFoundAll=253;
if ((xlIoSetDigOutLevel = (XLIOSETDIGOUTLEVEL) GetProcAddress(hxlDll,"xlIoSetDigOutLevel")) == NULL) NotFoundAll=254;
if ((xlIoSetAnalogOutput = (XLIOSETANALOGOUTPUT) GetProcAddress(hxlDll,"xlIoSetAnalogOutput")) == NULL) NotFoundAll=255;
if ((xlIoStartSampling = (XLIOSTARTSAMPLING) GetProcAddress(hxlDll,"xlIoStartSampling")) == NULL) NotFoundAll=256;
// Ethernet specific functions
if ((xlEthSetConfig = (XLFP_ETHSETCONFIG) GetProcAddress(hxlDll,"xlEthSetConfig")) == NULL) NotFoundAll=300;
if ((xlEthGetConfig = (XLFP_ETHGETCONFIG) GetProcAddress(hxlDll,"xlEthGetConfig")) == NULL) NotFoundAll=301;
if ((xlEthReceive = (XLFP_ETHRECEIVE) GetProcAddress(hxlDll,"xlEthReceive")) == NULL) NotFoundAll=302;
if ((xlEthSetBypass = (XLFP_ETHSETBYPASS) GetProcAddress(hxlDll,"xlEthSetBypass")) == NULL) NotFoundAll=303;
if ((xlEthTwinkleStatusLed = (XLFP_ETHTWINKLESTATUSLED) GetProcAddress(hxlDll,"xlEthTwinkleStatusLed")) == NULL) NotFoundAll=304;
if ((xlEthTransmit = (XLFP_ETHTRANSMIT) GetProcAddress(hxlDll,"xlEthTransmit")) == NULL) NotFoundAll=305;
// Remove specifig functions
if ((xlGetRemoteDeviceInfo = (XLGETREMOTEDEVICEINFO) GetProcAddress(hxlDll,"xlGetRemoteDeviceInfo")) == NULL) NotFoundAll=400;
if ((xlReleaseRemoteDeviceInfo = (XLRELEASEREMOTEDEVICEINFO) GetProcAddress(hxlDll,"xlReleaseRemoteDeviceInfo")) == NULL) NotFoundAll=401;
if ((xlAddRemoteDevice = (XLADDREMOTEDEVICE) GetProcAddress(hxlDll,"xlAddRemoteDevice")) == NULL) NotFoundAll=402;
if ((xlRemoveRemoteDevice = (XLREMOVEREMOTEDEVICE) GetProcAddress(hxlDll,"xlRemoveRemoteDevice")) == NULL) NotFoundAll=403;
if ((xlUpdateRemoteDeviceInfo = (XLUPDATEREMOTEDEVICEINFO) GetProcAddress(hxlDll,"xlUpdateRemoteDeviceInfo")) == NULL) NotFoundAll=405;
if ((xlGetRemoteHwInfo = (XLGETREMOTEHWINFO) GetProcAddress(hxlDll,"xlGetRemoteHwInfo")) == NULL) NotFoundAll=406;
// A429 specific functions
if ((xlA429Receive = (XLFP_A429RECEIVE)GetProcAddress(hxlDll,"xlA429Receive") )==NULL) NotFoundAll=500;
if ((xlA429SetChannelParams = (XLFP_A429SETCHANNELPARAMS)GetProcAddress(hxlDll,"xlA429SetChannelParams") )==NULL) NotFoundAll=501;
if ((xlA429Transmit = (XLFP_A429TRANSMIT)GetProcAddress(hxlDll,"xlA429Transmit") )==NULL) NotFoundAll=502;
// Keyman license dongle specific functions
if ((xlGetKeymanBoxes = (XLFP_GETKEYMANBOXES)GetProcAddress(hxlDll,"xlGetKeymanBoxes") )==NULL) NotFoundAll=600;
if ((xlGetKeymanInfo = (XLFP_GETKEYMANINFO)GetProcAddress(hxlDll,"xlGetKeymanInfo") )==NULL) NotFoundAll=601;
if (NotFoundAll) {
return XL_ERROR;
}
}
return XL_SUCCESS;
}
////////////////////////////////////////////////////////////////////////////
//! canUnloadLibrary()
//! Unload XL API DLL
//!
////////////////////////////////////////////////////////////////////////////
XLstatus xlUnloadLibrary(void){
if (hxlDll) {
(void)FreeLibrary( hxlDll );
hxlDll = 0;
}
return XL_SUCCESS;
}
////////////////////////////////////////////////////////////////////////////
//! xlOpenDriver()
//! Automatically loads DLL and then opens driver
//!
////////////////////////////////////////////////////////////////////////////
XLstatus xlOpenDriver(void){
#ifdef WIN64
if (xlLoadLibrary("vxlapi64")!=XL_SUCCESS) return XL_ERR_CANNOT_OPEN_DRIVER;
#else
if (xlLoadLibrary("vxlapi")!=XL_SUCCESS) return XL_ERR_CANNOT_OPEN_DRIVER;
#endif
return xlDllOpenDriver();
}
////////////////////////////////////////////////////////////////////////////
//! xlCloseDriver()
//! Automatically close DLL
//!
////////////////////////////////////////////////////////////////////////////
XLstatus xlCloseDriver(void){
(void)xlDllCloseDriver();
return xlUnloadLibrary();
}

View File

@ -0,0 +1,862 @@
/************************************************************************************//**
* \file xldriver.c
* \brief Vector XL driver interface source file.
* \ingroup XLDRIVER
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2019 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
/****************************************************************************************
* Include files
****************************************************************************************/
#include <assert.h> /* for assertions */
#include <stdint.h> /* for standard integer types */
#include <stddef.h> /* for NULL declaration */
#include <stdbool.h> /* for boolean type */
#include <stdlib.h> /* for standard library */
#include <string.h> /* for string library */
#include "candriver.h" /* Generic CAN driver module */
#include "util.h" /* Utility module */
#include "xldriver.h" /* Vector XL driver interface */
#include <windows.h> /* for Windows API */
#include <vxlapi.h> /* for XL CAN driver library */
/****************************************************************************************
* Macro definitions
****************************************************************************************/
/** \brief Internal driver queue size in CAN events. */
#define VECTOR_XL_RX_QUEUE_SIZE (4096u)
/***************************************************************************************
* Function prototypes
****************************************************************************************/
/* CAN interface functions. */
static void VectorXlInit(tCanSettings const * settings);
static void VectorXlTerminate(void);
static bool VectorXlConnect(void);
static void VectorXlDisconnect(void);
static bool VectorXlTransmit(tCanMsg const * msg);
static bool VectorXlIsBusError(void);
static void VectorXlRegisterEvents(tCanEvents const * events);
/* Baudrate conversion utility function. */
static uint32_t VectorXlConvertToRawBitrate(tCanBaudrate baudrate);
/* CAN event reception thread. */
static DWORD WINAPI VectorXlReceptionThread(LPVOID pv);
/****************************************************************************************
* Local constant declarations
****************************************************************************************/
/** \brief CAN interface structure filled with Vector XL driver specifics. */
static const tCanInterface pVectorXlInterface =
{
VectorXlInit,
VectorXlTerminate,
VectorXlConnect,
VectorXlDisconnect,
VectorXlTransmit,
VectorXlIsBusError,
VectorXlRegisterEvents
};
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief The settings to use in this CAN interface. */
static tCanSettings vectorXlSettings;
/** \brief List with callback functions that this driver should use. */
static tCanEvents * vectorXlEventsList;
/** \brief Total number of event entries into the \ref vectorXlEventsList list. */
static uint32_t vectorXlEventsEntries;
/** \brief The handle to the CAN port needed for API functions. */
static XLportHandle vectorXlPortHandle;
/** \brief The mask for the configured CAN channel. */
static XLaccess vectorXLChannelMask;
/** \brief Boolean flag to track if the driver was opened or not. ***/
static bool vectorXlDriverOpened;
/** \brief Boolean flag to track if the port was opened or not. ***/
static bool vectorXlPortOpened;
/** \brief Boolean flag to track if the channel was activated or not. ***/
static bool vectorXlChannelActivated;
/** \brief Boolean flag to detect if a CAN bus error state was detected. ***/
static bool vectorXlBusErrorDetected;
/** \brief Handle for the event to terminate the reception thread. */
static HANDLE vectorXlTerminateEvent;
/** \brief Handle for a CAN related event. */
static HANDLE vectorXlCanEvent;
/** \brief Handle for the CAN reception thread. */
static HANDLE vectorXlRxThreadHandle;
/***********************************************************************************//**
** \brief Obtains a pointer to the CAN interface structure, so that it can be linked
** to the generic CAN driver module.
** \return Pointer to CAN interface structure.
**
****************************************************************************************/
tCanInterface const * VectorXlGetInterface(void)
{
return &pVectorXlInterface;
} /*** end of VectorXlGetInterface ***/
/************************************************************************************//**
** \brief Initializes the CAN interface.
** \param settings Pointer to the CAN interface settings.
**
****************************************************************************************/
static void VectorXlInit(tCanSettings const * settings)
{
char * canDeviceName;
XLstatus xlStatus = XL_ERROR;
/* Initialize locals. */
vectorXlEventsList = NULL;
vectorXlEventsEntries = 0;
vectorXlPortHandle = XL_INVALID_PORTHANDLE;
vectorXLChannelMask = 0;
vectorXlDriverOpened = false;
vectorXlPortOpened = false;
vectorXlChannelActivated = false;
vectorXlBusErrorDetected = false;
vectorXlTerminateEvent = NULL;
vectorXlCanEvent = NULL;
vectorXlRxThreadHandle = NULL;
/* This module uses critical sections so initialize them. */
UtilCriticalSectionInit();
/* Reset CAN interface settings. */
vectorXlSettings.devicename = "";
vectorXlSettings.channel = 0;
vectorXlSettings.baudrate = CAN_BR500K;
vectorXlSettings.code = 0x00000000u;
vectorXlSettings.mask = 0x00000000u;
/* Check parameters. */
assert(settings != NULL);
/* Only continue with valid parameters. */
if (settings != NULL) /*lint !e774 */
{
/* Shallow copy the CAN interface settings for later usage. */
vectorXlSettings = *settings;
/* The devicename is a pointer and it is not gauranteed that it stays valid so we need
* to deep copy this one. note the +1 for '\0' in malloc.
*/
assert(settings->devicename != NULL);
if (settings->devicename != NULL) /*lint !e774 */
{
canDeviceName = malloc(strlen(settings->devicename) + 1);
assert(canDeviceName != NULL);
if (canDeviceName != NULL) /*lint !e774 */
{
strcpy(canDeviceName, settings->devicename);
vectorXlSettings.devicename = canDeviceName;
}
}
/* Open the XL driver and dynamically load its functions. */
xlStatus = xlOpenDriver();
/* Assert that the driver was opened. If it could not be opened, that means that
* either the XL driver was not installed on the system (vxlapi.dll/vxlapi64.dll)
* or in incompatible vection is installed. Either way the user needs to be
* informed that something is not properly configured on the PC system.
*/
assert(xlStatus == XL_SUCCESS);
/* Update flag to determine if the driver should be closed at a later point. */
if (xlStatus == XL_SUCCESS)
{
vectorXlDriverOpened = true;
}
}
} /*** end of VectorXlInit ***/
/************************************************************************************//**
** \brief Terminates the CAN interface.
**
****************************************************************************************/
static void VectorXlTerminate(void)
{
/* Close the XL driver if necessary. */
if (vectorXlDriverOpened)
{
(void)xlCloseDriver();
vectorXlDriverOpened = false;
}
/* Release memory that was allocated for storing the device name. */
if (vectorXlSettings.devicename != NULL)
{
free((char *)vectorXlSettings.devicename);
}
/* Reset CAN interface settings. */
vectorXlSettings.devicename = "";
vectorXlSettings.channel = 0;
vectorXlSettings.baudrate = CAN_BR500K;
vectorXlSettings.code = 0x00000000u;
vectorXlSettings.mask = 0x00000000u;
/* Release memory that was allocated for CAN events and reset the entry count. */
if ( (vectorXlEventsList != NULL) && (vectorXlEventsEntries != 0) )
{
free(vectorXlEventsList);
vectorXlEventsEntries = 0;
}
/* This module used critical sections so terminate them. */
UtilCriticalSectionTerminate();
} /*** end of VectorXlTerminate ***/
/************************************************************************************//**
** \brief Connects the CAN interface.
** \return True if connected, false otherwise.
**
****************************************************************************************/
static bool VectorXlConnect(void)
{
bool result = true;
XLstatus xlStatus;
XLdriverConfig xlDrvConfig;
char xlAppName[XL_MAX_LENGTH + 1] = "";
XLaccess xlPermissionMask = 0;
uint32_t xlBitrate;
/* Invalidate handles. */
vectorXlTerminateEvent = NULL;
vectorXlCanEvent = NULL;
vectorXlRxThreadHandle = NULL;
/* Reset the bus error detected flag. */
vectorXlBusErrorDetected = false;
/* Obtain the hardware configuration. */
xlStatus = xlGetDriverConfig(&xlDrvConfig);
/* Evaluate the result. */
if (xlStatus != XL_SUCCESS)
{
result = false;
}
/* Check if the requested channel is actually available. */
if (result)
{
if (vectorXlSettings.channel >= xlDrvConfig.channelCount)
{
result = false;
}
else
{
/* Does the requested channel actually support CAN? */
if ((xlDrvConfig.channel[vectorXlSettings.channel].channelBusCapabilities &
XL_BUS_ACTIVE_CAP_CAN) == 0)
{
result = false;
}
}
}
/* Open the port. */
if (result)
{
/* Invalidate the port handle and reset the port opened flag. */
vectorXlPortHandle = XL_INVALID_PORTHANDLE;
vectorXlPortOpened = false;
/* Initialize the access and permission masks. */
vectorXLChannelMask = xlDrvConfig.channel[vectorXlSettings.channel].channelMask;
xlPermissionMask = vectorXLChannelMask;
/* Attempt to open the port. */
xlStatus = xlOpenPort(&vectorXlPortHandle, xlAppName, vectorXLChannelMask,
&xlPermissionMask, VECTOR_XL_RX_QUEUE_SIZE,
XL_INTERFACE_VERSION, XL_BUS_TYPE_CAN);
/* Evaluate the result. */
if ((xlStatus != XL_SUCCESS) || (vectorXlPortHandle == XL_INVALID_PORTHANDLE))
{
result = false;
}
else
{
/* Update flag to determine if the port should be closed at a later point. */
vectorXlPortOpened = true;
}
}
/* Configure the baudrate if initialization access is available. Otherwise skip this
* part, assuming that whomever does have this access already configured the correct
* baudrate.
*/
if (result)
{
if (vectorXLChannelMask == xlPermissionMask)
{
/* Determine the requested bitrate in bits/second. */
xlBitrate = VectorXlConvertToRawBitrate(vectorXlSettings.baudrate);
/* Attempt to configure the communication speed. */
xlStatus = xlCanSetChannelBitrate(vectorXlPortHandle, vectorXLChannelMask,
xlBitrate);
/* Evaluate the result. */
if (xlStatus != XL_SUCCESS)
{
result = false;
}
}
}
/* Configure normal output mode. */
if (result)
{
xlStatus = xlCanSetChannelOutput(vectorXlPortHandle, vectorXLChannelMask,
XL_OUTPUT_MODE_NORMAL);
/* Evaluate the result. */
if (xlStatus != XL_SUCCESS)
{
result = false;
}
}
/* Suppress error frame reception and allow chipstate info events. */
if (result)
{
xlStatus = xlCanSetReceiveMode(vectorXlPortHandle, 1, 0);
/* Evaluate the result. */
if (xlStatus != XL_SUCCESS)
{
result = false;
}
}
/* Create the terminate event handle used in the reception thread. */
if (result)
{
vectorXlTerminateEvent = CreateEvent(NULL, TRUE, FALSE, "");
if (vectorXlTerminateEvent == NULL)
{
result = false;
}
}
/* Obtain handle for notification events. */
if (result)
{
xlStatus = xlSetNotification(vectorXlPortHandle, &vectorXlCanEvent, 1);
/* Evaluate the result. */
if (xlStatus != XL_SUCCESS)
{
result = false;
}
}
/* Configure the acceptance mask. */
if (result)
{
/* Use bit logic to determine if the filter should accept standard 11-bit and/or
* extended 29-bit identifiers:
* acceptStdId = ((mask & code & CAN_MSG_EXT_ID_MASK) == 0)
* acceptExtId = ((mask & code & CAN_MSG_EXT_ID_MASK) != 0) ||
* ((mask & CAN_MSG_EXT_ID_MASK) == 0)
*/
bool acceptStdID = ((vectorXlSettings.mask & vectorXlSettings.code & CAN_MSG_EXT_ID_MASK) == 0);
bool acceptExtID = ((vectorXlSettings.mask & vectorXlSettings.code & CAN_MSG_EXT_ID_MASK) != 0) ||
((vectorXlSettings.mask & CAN_MSG_EXT_ID_MASK) == 0);
/* Start by closing the acceptance filters for all 11-bit and 29-bit identifiers. */
(void)xlCanSetChannelAcceptance(vectorXlPortHandle, vectorXLChannelMask,
0x00000fffu, 0x00000fffu, XL_CAN_STD);
(void)xlCanSetChannelAcceptance(vectorXlPortHandle, vectorXLChannelMask,
0xffffffffu, 0xffffffffu, XL_CAN_EXT);
/* Configure acceptance filter for standard 11-bit identifiers. */
if (acceptStdID)
{
xlStatus = xlCanSetChannelAcceptance(vectorXlPortHandle, vectorXLChannelMask,
vectorXlSettings.code & 0x1fffffffu,
vectorXlSettings.mask & 0x1fffffffu,
XL_CAN_STD);
/* Evaluate the result. */
if (xlStatus != XL_SUCCESS)
{
result = false;
}
}
/* Configure acceptance filter for extended 29-bit identifiers. */
if ((acceptExtID) && (result))
{
xlStatus = xlCanSetChannelAcceptance(vectorXlPortHandle, vectorXLChannelMask,
vectorXlSettings.code & 0x1fffffffu,
vectorXlSettings.mask & 0x1fffffffu,
XL_CAN_EXT);
/* Evaluate the result. */
if (xlStatus != XL_SUCCESS)
{
result = false;
}
}
}
/* Activate the channel. */
if (result)
{
/* Reset the channel activated flag. */
vectorXlChannelActivated = false;
/* Attempt to activate the channel. */
xlStatus = xlActivateChannel(vectorXlPortHandle, vectorXLChannelMask,
XL_BUS_TYPE_CAN, XL_ACTIVATE_RESET_CLOCK);
/* Evaluate the result. */
if (xlStatus != XL_SUCCESS)
{
result = false;
}
else
{
/* Update the channel activated flag. */
vectorXlChannelActivated = true;
}
}
/* Start the reception thread. */
if (result)
{
vectorXlRxThreadHandle = CreateThread(NULL, 0, VectorXlReceptionThread,
NULL, 0, NULL);
if (vectorXlRxThreadHandle == NULL)
{
result = false;
}
}
/* Cleanup in case this function was not successful. */
if (!result)
{
/* Deactivate the channel if it was activated. */
if (vectorXlChannelActivated)
{
(void)xlDeactivateChannel(vectorXlPortHandle, vectorXLChannelMask);
vectorXlChannelActivated = false;
}
/* Invalidate the notification event if it was set. */
if (vectorXlCanEvent != NULL)
{
vectorXlCanEvent = NULL;
}
/* Close the termination event handle if it was created. */
if (vectorXlTerminateEvent != NULL)
{
/* Close the event handle. */
(void)CloseHandle(vectorXlTerminateEvent);
vectorXlTerminateEvent = NULL;
}
/* Close the port if it was opened. */
if (vectorXlPortOpened)
{
(void)xlClosePort(vectorXlPortHandle);
vectorXlPortOpened = false;
}
}
/* Give the result back to the caller. */
return result;
} /*** end of VectorXlConnect ***/
/************************************************************************************//**
** \brief Disconnects the CAN interface.
**
****************************************************************************************/
static void VectorXlDisconnect(void)
{
/* Stop the reception thread. */
if (vectorXlRxThreadHandle != NULL)
{
/* Trigger event to request the reception thread to stop. */
(void)SetEvent(vectorXlTerminateEvent);
/* Wait for the thread to signal termination. */
(void)WaitForSingleObject(vectorXlRxThreadHandle, INFINITE);
/* Close the thread handle. */
(void)CloseHandle(vectorXlRxThreadHandle);
vectorXlRxThreadHandle = NULL;
}
/* Close the termination event handle if it was created. */
if (vectorXlTerminateEvent != NULL)
{
/* Close the event handle. */
(void)CloseHandle(vectorXlTerminateEvent);
vectorXlTerminateEvent = NULL;
}
/* Invalidate the notification event if it was set. */
if (vectorXlCanEvent != NULL)
{
vectorXlCanEvent = NULL;
}
/* Deactivate the channel if necessary. */
if (vectorXlChannelActivated)
{
(void)xlDeactivateChannel(vectorXlPortHandle, vectorXLChannelMask);
vectorXlChannelActivated = false;
}
/* Close the XL port if necessary. */
if (vectorXlPortOpened)
{
(void)xlClosePort(vectorXlPortHandle);
vectorXlPortOpened = false;
}
} /*** end of VectorXlDisconnect ***/
/************************************************************************************//**
** \brief Submits a message for transmission on the CAN bus.
** \param msg Pointer to CAN message structure.
** \return True if successful, false otherwise.
**
****************************************************************************************/
static bool VectorXlTransmit(tCanMsg const * msg)
{
bool result = false;
tCanEvents const * pEvents;
XLstatus xlStatus = XL_ERROR;
XLevent xlEvent[1];
unsigned int txMsgCount = 1;
uint8_t byteIdx;
/* Check parameters. */
assert(msg != NULL);
/* Only continue with valid parameters. */
if (msg != NULL) /*lint !e774 */
{
/* Convert the CAN message to the XLevent format. */
memset(xlEvent, 0, sizeof(xlEvent));
xlEvent[0].tag = XL_TRANSMIT_MSG;
xlEvent[0].tagData.msg.flags = 0;
if ((msg->id & CAN_MSG_EXT_ID_MASK) == 0)
{
xlEvent[0].tagData.msg.id = msg->id & 0x7ffu;
}
else
{
xlEvent[0].tagData.msg.id = msg->id & 0x1fffffffu;
xlEvent[0].tagData.msg.id |= XL_CAN_EXT_MSG_ID;
}
xlEvent[0].tagData.msg.dlc = msg->dlc;
if (xlEvent[0].tagData.msg.dlc > CAN_MSG_MAX_LEN)
{
xlEvent[0].tagData.msg.dlc = CAN_MSG_MAX_LEN;
}
for (byteIdx = 0; byteIdx < msg->dlc; byteIdx++)
{
xlEvent[0].tagData.msg.data[byteIdx] = msg->data[byteIdx];
}
/* Attempt to submit the message for transmission. */
xlStatus = xlCanTransmit(vectorXlPortHandle, vectorXLChannelMask, &txMsgCount,
xlEvent);
/* Check the result. */
if (xlStatus == XL_SUCCESS)
{
/* Update result value to success. */
result = true;
/* Trigger transmit complete event(s). */
pEvents = vectorXlEventsList;
for (uint32_t idx = 0; idx < vectorXlEventsEntries; idx++)
{
if (pEvents != NULL)
{
if (pEvents->MsgTxed != NULL)
{
pEvents->MsgTxed(msg);
}
/* Move on to the next entry in the list. */
pEvents++;
}
}
}
}
/* Give the result back to the caller. */
return result;
} /*** end of VectorXlTransmit ***/
/************************************************************************************//**
** \brief Checks if a bus off or bus heavy situation occurred.
** \return True if a bus error situation was detected, false otherwise.
**
****************************************************************************************/
static bool VectorXlIsBusError(void)
{
bool result = false;
/* To obtain the bus off and error passive state info, a chip state message must
* be requested, which is then received and processed by the reception thread.
*/
(void)xlCanRequestChipState(vectorXlPortHandle, vectorXLChannelMask);
/* Enter critical section. */
UtilCriticalSectionEnter();
/* Was a bus error chip state detected by the reception thread? */
if (vectorXlBusErrorDetected)
{
/* Reset the flag to be able to detect the next bus error event. */
vectorXlBusErrorDetected = false;
/* Update the result. */
result = true;
}
/* Exit critical section. */
UtilCriticalSectionExit();
/* Give the result back to the caller. */
return result;
} /*** end of VectorXlIsBusError ***/
/************************************************************************************//**
** \brief Registers the event callback functions that should be called by the CAN
** interface.
** \param events Pointer to structure with event callback function pointers.
**
****************************************************************************************/
static void VectorXlRegisterEvents(tCanEvents const * events)
{
/* Check parameters. */
assert(events != NULL);
/* Only continue with valid parameters. */
if (events != NULL) /*lint !e774 */
{
/* Increase length of the list to make space for one more event entry. Note that
* it is okay to call realloc with a NULL pointer. In this case it simply behaves
* as malloc.
*/
vectorXlEventsList = realloc(vectorXlEventsList,
(sizeof(tCanEvents) * (vectorXlEventsEntries + 1)));
/* Assert reallocation. */
assert(vectorXlEventsList != NULL);
/* Only continue if reallocation was successful. */
if (vectorXlEventsList != NULL)
{
/* Increment events entry count. */
vectorXlEventsEntries++;
/* Store the events in the new entry. */
vectorXlEventsList[vectorXlEventsEntries - 1] = *events;
}
/* Reallocation failed. */
else
{
/* Reset events entry count. */
vectorXlEventsEntries = 0;
}
}
} /*** end of VectorXlRegisterEvents ***/
/************************************************************************************//**
** \brief Converts the baudrate enumerated type value to a bitrate in bits/second.
** \param baudrate Baudrate enumarated type.
** \return Bitrate in bits/second.
**
****************************************************************************************/
static uint32_t VectorXlConvertToRawBitrate(tCanBaudrate baudrate)
{
uint32_t result = 500000;
switch (baudrate)
{
case CAN_BR10K:
result = 10000;
break;
case CAN_BR20K:
result = 20000;
break;
case CAN_BR50K:
result = 50000;
break;
case CAN_BR100K:
result = 100000;
break;
case CAN_BR125K:
result = 125000;
break;
case CAN_BR250K:
result = 250000;
break;
case CAN_BR500K:
result = 500000;
break;
case CAN_BR800K:
result = 800000;
break;
case CAN_BR1M:
result = 1000000;
break;
default:
/* Default to a common used baudrate as a fallback. */
result = 500000;
break;
}
/* Give the result back to the caller. */
return result;
} /*** end of VectorXlConvertToRawBitrate ***/
/************************************************************************************//**
** \brief CAN event reception thread.
** \param pv Pointer to thread parameters.
** \return Thread exit code.
**
****************************************************************************************/
static DWORD WINAPI VectorXlReceptionThread(LPVOID pv)
{
DWORD waitResult;
HANDLE handles[] =
{
vectorXlCanEvent,
vectorXlTerminateEvent
};
bool running = true;
XLstatus xlStatus;
unsigned int xlEventCount;
XLevent xlEvent;
tCanMsg rxMsg;
uint8_t byteIdx;
tCanEvents const * pEvents;
/* Parameter not used. */
(void)pv;
/* Enter thread's infinite loop. */
while (running)
{
waitResult = WaitForMultipleObjects(sizeof(handles)/sizeof(handles[0]), handles,
FALSE, INFINITE);
switch (waitResult)
{
/* CAN reception event. */
case WAIT_OBJECT_0 + 0: /*lint !e835 */
/* Empty out the event queue. */
xlStatus = XL_SUCCESS;
while (xlStatus == XL_SUCCESS)
{
/* Set the number of events to request to read. */
xlEventCount = 1;
xlStatus = xlReceive(vectorXlPortHandle, &xlEventCount, &xlEvent);
if (xlStatus != XL_ERR_QUEUE_IS_EMPTY )
{
/* Was is a message reception event? */
if (xlEvent.tag == XL_RECEIVE_MSG)
{
/* Only process actual newly received messages and ignore things such as
* a confirmation of a message transmission.
*/
if (xlEvent.tagData.msg.flags == 0)
{
/* Read out the message identifier. */
if ((xlEvent.tagData.msg.id & XL_CAN_EXT_MSG_ID) == 0)
{
rxMsg.id = xlEvent.tagData.msg.id & 0x7ffu;
}
else
{
rxMsg.id = xlEvent.tagData.msg.id & 0x1fffffffu;
rxMsg.id |= CAN_MSG_EXT_ID_MASK;
}
/* Read out the message length. */
if (xlEvent.tagData.msg.dlc > CAN_MSG_MAX_LEN)
{
rxMsg.dlc = CAN_MSG_MAX_LEN;
}
else
{
rxMsg.dlc = (uint8_t)xlEvent.tagData.msg.dlc;
}
/* Read out the message data. */
for (byteIdx = 0; byteIdx < rxMsg.dlc; byteIdx++)
{
rxMsg.data[byteIdx] = xlEvent.tagData.msg.data[byteIdx];
}
/* Trigger message reception event(s). */
pEvents = vectorXlEventsList;
for (uint32_t idx = 0; idx < vectorXlEventsEntries; idx++)
{
if (pEvents != NULL)
{
if (pEvents->MsgRxed != NULL)
{
pEvents->MsgRxed(&rxMsg);
}
/* Move on to the next entry in the list. */
pEvents++;
}
}
}
}
/* Was is a chip state event? */
else if (xlEvent.tag == XL_CHIP_STATE)
{
/* Is a bus off or bus have state reported? */
if ( ((xlEvent.tagData.chipState.busStatus & XL_CHIPSTAT_BUSOFF) != 0) ||
((xlEvent.tagData.chipState.busStatus & XL_CHIPSTAT_ERROR_PASSIVE) != 0))
{
/* Enter critical section. */
UtilCriticalSectionEnter();
/* Set bus error flag. Note that this flag is automatically reset by
* VectorXlIsBusError.
*/
vectorXlBusErrorDetected = true;
/* Exit critical section. */
UtilCriticalSectionExit();
}
}
}
}
break;
/* Termination event. */
default:
case WAIT_OBJECT_0 + 1: /*lint !e835 */
/* Stop thread. */
running = false;
break;
}
}
/* Exit thread. */
return 0;
} /*** end of VectorXlReceptionThread ***/
/*********************************** end of xldriver.c *********************************/

View File

@ -0,0 +1,50 @@
/************************************************************************************//**
* \file xldriver.h
* \brief Vector XL driver interface header file.
* \ingroup XLDRIVER
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2019 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
/************************************************************************************//**
* \defgroup XLDRIVER Vector XL Driver USB to CAN interface
* \brief This module implements the CAN interface for the Vector XL Driver.
* \ingroup CanDriver
****************************************************************************************/
#ifndef XLDRIVER_H
#define XLDRIVER_H
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************************
* Function prototypes
****************************************************************************************/
tCanInterface const * VectorXlGetInterface(void);
#ifdef __cplusplus
}
#endif
#endif /* XLDRIVER_H */
/*********************************** end of xldriver.h *********************************/

View File

@ -19,8 +19,7 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="MainUnit"/>
<IsVisibleTab Value="True"/>
<TopLine Value="31"/>
<TopLine Value="45"/>
<CursorPos X="31" Y="51"/>
<UsageCount Value="87"/>
<Loaded Value="True"/>
@ -48,7 +47,7 @@
<Filename Value="configgroups.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ConfigGroups"/>
<EditorIndex Value="1"/>
<EditorIndex Value="2"/>
<TopLine Value="470"/>
<CursorPos X="37" Y="495"/>
<UsageCount Value="84"/>
@ -73,7 +72,7 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SessionXcpDialog"/>
<EditorIndex Value="2"/>
<EditorIndex Value="3"/>
<TopLine Value="226"/>
<CursorPos X="52" Y="230"/>
<UsageCount Value="76"/>
@ -108,10 +107,13 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TransportXcpCanDialog"/>
<EditorIndex Value="-1"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="212"/>
<CursorPos X="75" Y="239"/>
<UsageCount Value="62"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit9>
<Unit10>
<Filename Value="transportxcpusbdialog.pas"/>
@ -153,7 +155,7 @@
<Filename Value="firmwareupdate.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="FirmwareUpdate"/>
<EditorIndex Value="3"/>
<EditorIndex Value="4"/>
<TopLine Value="896"/>
<CursorPos Y="930"/>
<UsageCount Value="49"/>

View File

@ -8,12 +8,12 @@ object TransportXcpCanForm: TTransportXcpCanForm
ClientWidth = 407
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '1.6.2.0'
LCLVersion = '1.6.4.0'
object LblCommunication: TLabel
Left = 8
Height = 17
Height = 15
Top = 8
Width = 96
Width = 87
Caption = 'Communication'
Font.Style = [fsBold]
ParentColor = False
@ -21,15 +21,16 @@ object TransportXcpCanForm: TTransportXcpCanForm
end
object CmbDevice: TComboBox
Left = 120
Height = 31
Height = 23
Hint = 'Name of the CAN adapter'
Top = 35
Width = 224
ItemHeight = 0
ItemHeight = 15
Items.Strings = (
'Peak System PCAN-USB'
'Kvaser Leaf Light v2'
'Lawicel CANUSB'
'Vector XL Driver'
)
ParentShowHint = False
ShowHint = True
@ -38,19 +39,19 @@ object TransportXcpCanForm: TTransportXcpCanForm
end
object LblDevice: TLabel
Left = 24
Height = 17
Height = 15
Top = 38
Width = 41
Width = 38
Caption = 'Device:'
ParentColor = False
end
object CmbChannel: TComboBox
Left = 120
Height = 31
Height = 23
Hint = 'Zero based index of the CAN channel, if multiple CAN channels are supported for the CAN adapter'
Top = 75
Width = 224
ItemHeight = 0
ItemHeight = 15
Items.Strings = (
'0'
'1'
@ -76,19 +77,19 @@ object TransportXcpCanForm: TTransportXcpCanForm
end
object LblChannel: TLabel
Left = 24
Height = 17
Height = 15
Top = 78
Width = 49
Width = 47
Caption = 'Channel:'
ParentColor = False
end
object CmbBaudrate: TComboBox
Left = 120
Height = 31
Height = 23
Hint = 'The communication speed in bits per second'
Top = 115
Width = 224
ItemHeight = 0
ItemHeight = 15
Items.Strings = (
'1 MBit/sec'
'800 kBit/sec'
@ -107,17 +108,17 @@ object TransportXcpCanForm: TTransportXcpCanForm
end
object LblBaudrate: TLabel
Left = 24
Height = 17
Height = 15
Top = 118
Width = 55
Width = 50
Caption = 'Baudrate:'
ParentColor = False
end
object LblIdentifiers: TLabel
Left = 8
Height = 17
Height = 15
Top = 160
Width = 63
Width = 58
Caption = 'Identifiers'
Font.Style = [fsBold]
ParentColor = False
@ -125,7 +126,7 @@ object TransportXcpCanForm: TTransportXcpCanForm
end
object EdtTransmitId: TEdit
Left = 120
Height = 29
Height = 23
Hint = 'CAN identifier for transmitting XCP command messages from the host to the target, as a 32-bit hexadecimal value (Default = 667h)'
Top = 187
Width = 224
@ -138,15 +139,15 @@ object TransportXcpCanForm: TTransportXcpCanForm
end
object LblTransmitId: TLabel
Left = 24
Height = 17
Height = 15
Top = 190
Width = 84
Width = 78
Caption = 'Transmit (hex):'
ParentColor = False
end
object EdtReceiveId: TEdit
Left = 120
Height = 29
Height = 23
Hint = 'CAN identifier for receiving XCP response messages from the target to the host, as a 32-bit hexadecimal value (Default = 7E1h)'
Top = 227
Width = 224
@ -159,18 +160,18 @@ object TransportXcpCanForm: TTransportXcpCanForm
end
object LblReceiveId: TLabel
Left = 24
Height = 17
Height = 15
Top = 230
Width = 77
Width = 72
Caption = 'Receive (hex):'
ParentColor = False
end
object CbxExtended: TCheckBox
Left = 120
Height = 23
Height = 19
Hint = 'Check if the CAN identifiers are 29-bit extended (Default = 11-bit standard)'
Top = 267
Width = 200
Width = 185
Caption = '29-bit extended CAN identifiers'
OnChange = CbxExtendedChange
ParentShowHint = False

View File

@ -218,7 +218,9 @@ begin
if FTransportXcpCanConfig.Device = 'kvaser_leaflight' then
CmbDevice.ItemIndex := 1
else if FTransportXcpCanConfig.Device = 'lawicel_canusb' then
CmbDevice.ItemIndex := 2;
CmbDevice.ItemIndex := 2
else if FTransportXcpCanConfig.Device = 'vector_xldriver' then
CmbDevice.ItemIndex := 3;
{$ENDIF}
CmbChannel.ItemIndex := 0;
if FTransportXcpCanConfig.Channel <= LongWord(CmbChannel.Items.Count) then
@ -266,7 +268,9 @@ begin
if CmbDevice.ItemIndex = 1 then
FTransportXcpCanConfig.Device := 'kvaser_leaflight'
else if CmbDevice.ItemIndex = 2 then
FTransportXcpCanConfig.Device := 'lawicel_canusb';
FTransportXcpCanConfig.Device := 'lawicel_canusb'
else if CmbDevice.ItemIndex = 3 then
FTransportXcpCanConfig.Device := 'vector_xldriver';
{$ENDIF}
FTransportXcpCanConfig.Channel := CmbChannel.ItemIndex;
case CmbBaudrate.ItemIndex of

Binary file not shown.