diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2016-09-12 08:45:11 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2016-09-12 08:46:04 +0200 |
commit | 5641c52872eb1ac6dd2a4101ac4274f41c29d7b1 (patch) | |
tree | d8fe022114a9a2af37e6f0717b5fa80ae9a485ca /src | |
parent | b302c4e0c4458d51cb70ac3be03a14c561a976be (diff) | |
parent | dc92132ae88f447cc006ecd9e1eb3c92570fd646 (diff) |
Merge remote-tracking branch 'gerrit/5.8' into dev
Change-Id: I99abea2d39afbc095e9d7cb661507937b450fdf4
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/canbus/peakcan/peakcan_symbols_p.h | 15 | ||||
-rw-r--r-- | src/plugins/canbus/peakcan/peakcanbackend.cpp | 32 | ||||
-rw-r--r-- | src/plugins/canbus/socketcan/socketcanbackend.cpp | 5 | ||||
-rw-r--r-- | src/plugins/canbus/tinycan/tinycan_symbols_p.h | 15 | ||||
-rw-r--r-- | src/plugins/canbus/tinycan/tinycanbackend.cpp | 4 | ||||
-rw-r--r-- | src/plugins/canbus/vectorcan/vectorcan_symbols_p.h | 17 | ||||
-rw-r--r-- | src/plugins/canbus/vectorcan/vectorcanbackend.cpp | 7 | ||||
-rw-r--r-- | src/serialbus/doc/src/peakcan.qdoc | 8 | ||||
-rw-r--r-- | src/serialbus/doc/src/tinycan.qdoc | 5 | ||||
-rw-r--r-- | src/serialbus/doc/src/vectorcan.qdoc | 13 |
10 files changed, 44 insertions, 77 deletions
diff --git a/src/plugins/canbus/peakcan/peakcan_symbols_p.h b/src/plugins/canbus/peakcan/peakcan_symbols_p.h index cb90599..456be17 100644 --- a/src/plugins/canbus/peakcan/peakcan_symbols_p.h +++ b/src/plugins/canbus/peakcan/peakcan_symbols_p.h @@ -258,7 +258,7 @@ typedef struct tagTPCANTimestamp static fp_##symbolName symbolName; #define RESOLVE_SYMBOL(symbolName) \ - symbolName = (fp_##symbolName)resolveSymbol(pcanLibrary, #symbolName); \ + symbolName = (fp_##symbolName)pcanLibrary->resolve(#symbolName); \ if (!symbolName) \ return false; @@ -273,23 +273,12 @@ GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_GetValue, TPCANHandle, TPCANParameter, GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_SetValue, TPCANHandle, TPCANParameter, void *, quint32) GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_GetErrorText, TPCANStatus, quint16, char *) -inline QFunctionPointer resolveSymbol(QLibrary *pcanLibrary, const char *symbolName) -{ - QFunctionPointer symbolFunctionPointer = pcanLibrary->resolve(symbolName); - if (!symbolFunctionPointer) - qWarning("Failed to resolve the pcanbasic symbol: %s", symbolName); - - return symbolFunctionPointer; -} - inline bool resolveSymbols(QLibrary *pcanLibrary) { if (!pcanLibrary->isLoaded()) { pcanLibrary->setFileName(QStringLiteral("pcanbasic")); - if (!pcanLibrary->load()) { - qWarning("Failed to load the library: %s", qPrintable(pcanLibrary->fileName())); + if (!pcanLibrary->load()) return false; - } } RESOLVE_SYMBOL(CAN_Initialize) diff --git a/src/plugins/canbus/peakcan/peakcanbackend.cpp b/src/plugins/canbus/peakcan/peakcanbackend.cpp index 06a2d4b..eb2d4b9 100644 --- a/src/plugins/canbus/peakcan/peakcanbackend.cpp +++ b/src/plugins/canbus/peakcan/peakcanbackend.cpp @@ -288,37 +288,37 @@ bool PeakCanBackendPrivate::setConfigurationParameter(int key, const QVariant &v static int channelIndexFromName(const QString &interfaceName) { - if (interfaceName == QStringLiteral("usbbus1")) + if (interfaceName == QStringLiteral("usb0")) return PCAN_USBBUS1; - else if (interfaceName == QStringLiteral("usbbus2")) + else if (interfaceName == QStringLiteral("usb1")) return PCAN_USBBUS2; - else if (interfaceName == QStringLiteral("usbbus3")) + else if (interfaceName == QStringLiteral("usb2")) return PCAN_USBBUS3; - else if (interfaceName == QStringLiteral("usbbus4")) + else if (interfaceName == QStringLiteral("usb3")) return PCAN_USBBUS4; - else if (interfaceName == QStringLiteral("usbbus5")) + else if (interfaceName == QStringLiteral("usb4")) return PCAN_USBBUS5; - else if (interfaceName == QStringLiteral("usbbus6")) + else if (interfaceName == QStringLiteral("usb5")) return PCAN_USBBUS6; - else if (interfaceName == QStringLiteral("usbbus7")) + else if (interfaceName == QStringLiteral("usb6")) return PCAN_USBBUS7; - else if (interfaceName == QStringLiteral("usbbus8")) + else if (interfaceName == QStringLiteral("usb7")) return PCAN_USBBUS8; - else if (interfaceName == QStringLiteral("pcibus1")) + else if (interfaceName == QStringLiteral("pci0")) return PCAN_PCIBUS1; - else if (interfaceName == QStringLiteral("pcibus2")) + else if (interfaceName == QStringLiteral("pci1")) return PCAN_PCIBUS2; - else if (interfaceName == QStringLiteral("pcibus3")) + else if (interfaceName == QStringLiteral("pci2")) return PCAN_PCIBUS3; - else if (interfaceName == QStringLiteral("pcibus4")) + else if (interfaceName == QStringLiteral("pci3")) return PCAN_PCIBUS4; - else if (interfaceName == QStringLiteral("pcibus5")) + else if (interfaceName == QStringLiteral("pci4")) return PCAN_PCIBUS5; - else if (interfaceName == QStringLiteral("pcibus6")) + else if (interfaceName == QStringLiteral("pci5")) return PCAN_PCIBUS6; - else if (interfaceName == QStringLiteral("pcibus7")) + else if (interfaceName == QStringLiteral("pci6")) return PCAN_PCIBUS7; - else if (interfaceName == QStringLiteral("pcibus8")) + else if (interfaceName == QStringLiteral("pci7")) return PCAN_PCIBUS8; else // TODO: Add other indexes here return PCAN_NONEBUS; diff --git a/src/plugins/canbus/socketcan/socketcanbackend.cpp b/src/plugins/canbus/socketcan/socketcanbackend.cpp index 87c466e..7580c60 100644 --- a/src/plugins/canbus/socketcan/socketcanbackend.cpp +++ b/src/plugins/canbus/socketcan/socketcanbackend.cpp @@ -599,10 +599,7 @@ void SocketCanBackend::readSocket() timeStamp.tv_usec = 0; } - QCanBusFrame::TimeStamp stamp; - stamp.setSeconds(timeStamp.tv_sec); - stamp.setMicroSeconds(timeStamp.tv_usec); - + const QCanBusFrame::TimeStamp stamp(timeStamp.tv_sec, timeStamp.tv_usec); QCanBusFrame bufferedFrame; bufferedFrame.setTimeStamp(stamp); diff --git a/src/plugins/canbus/tinycan/tinycan_symbols_p.h b/src/plugins/canbus/tinycan/tinycan_symbols_p.h index 5ad149c..6e05b92 100644 --- a/src/plugins/canbus/tinycan/tinycan_symbols_p.h +++ b/src/plugins/canbus/tinycan/tinycan_symbols_p.h @@ -285,7 +285,7 @@ typedef void (DRV_CALLBACK_TYPE *CanRxEventCallback)( static fp_##symbolName symbolName; #define RESOLVE_SYMBOL(symbolName) \ - symbolName = (fp_##symbolName)resolveSymbol(mhstcanLibrary, #symbolName); \ + symbolName = (fp_##symbolName)mhstcanLibrary->resolve(#symbolName); \ if (!symbolName) \ return false; @@ -317,23 +317,12 @@ GENERATE_SYMBOL_VARIABLE(void, CanSetRxEventCallback, CanRxEventCallback) GENERATE_SYMBOL_VARIABLE(void, CanSetEvents, quint16) GENERATE_SYMBOL_VARIABLE(quint32, CanEventStatus, void) -inline QFunctionPointer resolveSymbol(QLibrary *mhstcanLibrary, const char *symbolName) -{ - QFunctionPointer symbolFunctionPointer = mhstcanLibrary->resolve(symbolName); - if (!symbolFunctionPointer) - qWarning("Failed to resolve the mhstcan symbol: %s", symbolName); - - return symbolFunctionPointer; -} - inline bool resolveSymbols(QLibrary *mhstcanLibrary) { if (!mhstcanLibrary->isLoaded()) { mhstcanLibrary->setFileName(QStringLiteral("mhstcan")); - if (!mhstcanLibrary->load()) { - qWarning("Failed to load the library: %s", qPrintable(mhstcanLibrary->fileName())); + if (!mhstcanLibrary->load()) return false; - } } RESOLVE_SYMBOL(CanInitDriver) diff --git a/src/plugins/canbus/tinycan/tinycanbackend.cpp b/src/plugins/canbus/tinycan/tinycanbackend.cpp index 2f9c191..ee2b347 100644 --- a/src/plugins/canbus/tinycan/tinycanbackend.cpp +++ b/src/plugins/canbus/tinycan/tinycanbackend.cpp @@ -305,9 +305,9 @@ QString TinyCanBackendPrivate::systemErrorString(int errorCode) static int channelIndexFromName(const QString &interfaceName) { - if (interfaceName == QStringLiteral("channela")) + if (interfaceName == QStringLiteral("can0.0")) return INDEX_CAN_KANAL_A; - else if (interfaceName == QStringLiteral("channelb")) + else if (interfaceName == QStringLiteral("can0.1")) return INDEX_CAN_KANAL_B; else return INDEX_INVALID; diff --git a/src/plugins/canbus/vectorcan/vectorcan_symbols_p.h b/src/plugins/canbus/vectorcan/vectorcan_symbols_p.h index 6f548b0..429f50e 100644 --- a/src/plugins/canbus/vectorcan/vectorcan_symbols_p.h +++ b/src/plugins/canbus/vectorcan/vectorcan_symbols_p.h @@ -438,9 +438,9 @@ typedef struct _XLacceptance { static fp_##symbolName symbolName; #define RESOLVE_SYMBOL(symbolName) \ - symbolName = (fp_##symbolName)resolveSymbol(vectorcanLibrary, #symbolName); \ + symbolName = (fp_##symbolName)vectorcanLibrary->resolve(#symbolName); \ if (!symbolName) \ - return false; + return false; GENERATE_SYMBOL_VARIABLE(XLstatus, xlOpenDriver, void) GENERATE_SYMBOL_VARIABLE(XLstatus, xlCloseDriver, void) @@ -455,23 +455,12 @@ GENERATE_SYMBOL_VARIABLE(XLstatus, xlReceive, XLportHandle, quint32 *, XLevent * GENERATE_SYMBOL_VARIABLE(XLstatus, xlSetNotification, XLportHandle, XLhandle *, int) GENERATE_SYMBOL_VARIABLE(char *, xlGetErrorString, XLstatus) -inline QFunctionPointer resolveSymbol(QLibrary *vectorcanLibrary, const char *symbolName) -{ - QFunctionPointer symbolFunctionPointer = vectorcanLibrary->resolve(symbolName); - if (!symbolFunctionPointer) - qWarning("Failed to resolve the vxlapi symbol: %s", symbolName); - - return symbolFunctionPointer; -} - inline bool resolveSymbols(QLibrary *vectorcanLibrary) { if (!vectorcanLibrary->isLoaded()) { vectorcanLibrary->setFileName(QStringLiteral("vxlapi")); - if (!vectorcanLibrary->load()) { - qWarning("Failed to load the library: %s", qPrintable(vectorcanLibrary->fileName())); + if (!vectorcanLibrary->load()) return false; - } } RESOLVE_SYMBOL(xlOpenDriver) diff --git a/src/plugins/canbus/vectorcan/vectorcanbackend.cpp b/src/plugins/canbus/vectorcan/vectorcanbackend.cpp index 78cf22f..c178b50 100644 --- a/src/plugins/canbus/vectorcan/vectorcanbackend.cpp +++ b/src/plugins/canbus/vectorcan/vectorcanbackend.cpp @@ -224,8 +224,8 @@ bool VectorCanBackendPrivate::setConfigurationParameter(int key, const QVariant void VectorCanBackendPrivate::setupChannel(const QString &interfaceName) { - if (interfaceName.startsWith(QStringLiteral("channel"))) { - const QStringRef ref = interfaceName.midRef(7); + if (interfaceName.startsWith(QStringLiteral("can"))) { + const QStringRef ref = interfaceName.midRef(3); bool ok = false; const int channelIndex = ref.toInt(&ok); if (ok && (channelIndex >= 0 && channelIndex < XL_CONFIG_MAX_CHANNELS)) { @@ -324,7 +324,8 @@ void VectorCanBackendPrivate::startRead() QCanBusFrame frame(msg.id, QByteArray(reinterpret_cast<const char *>(msg.data), int(msg.dlc))); - frame.setTimeStamp(QCanBusFrame::TimeStamp(0, event.timeStamp)); + const quint64 usecs = event.timeStamp / 1000; + frame.setTimeStamp(QCanBusFrame::TimeStamp(usecs / 1000000, usecs % 1000000)); frame.setExtendedFrameFormat(msg.id & XL_CAN_EXT_MSG_ID); frame.setFrameType((msg.flags & XL_CAN_MSG_FLAG_REMOTE_FRAME) ? QCanBusFrame::RemoteRequestFrame diff --git a/src/serialbus/doc/src/peakcan.qdoc b/src/serialbus/doc/src/peakcan.qdoc index 8a973cb..ce612fb 100644 --- a/src/serialbus/doc/src/peakcan.qdoc +++ b/src/serialbus/doc/src/peakcan.qdoc @@ -49,13 +49,13 @@ \code QCanBusDevice *device = QCanBus::instance()->createDevice( - QStringLiteral("peakcan"), QStringLiteral("usbbus1")); + QStringLiteral("peakcan"), QStringLiteral("usb0")); device->connectDevice(); \endcode - Where \e usbbus1 is the active CAN interface name. The PeakCAN backend supports - eight USB interfaces from \e usbbus1 to \e usbbus8 and eight PCI interfaces from - \e pcibus1 to \e pcibus8. + Where \e usb0 is the active CAN interface name. The PeakCAN backend supports + eight USB interfaces from \e usb0 to \e usb7 and eight PCI interfaces from + \e pci0 to \e pci7. \note Only the USB and PCI adapters are currently supported by this backend. diff --git a/src/serialbus/doc/src/tinycan.qdoc b/src/serialbus/doc/src/tinycan.qdoc index 4ca4e53..6637c0d 100644 --- a/src/serialbus/doc/src/tinycan.qdoc +++ b/src/serialbus/doc/src/tinycan.qdoc @@ -53,8 +53,9 @@ device->connectDevice(); \endcode - Where \e channela is the active CAN interface name. The TinyCAN backend - provides two interfaces, \e channela and \e channelb. + Where \e can0.0 is the active CAN interface name. TinyCAN provides the + interfaces \e can0.0 and \e can0.1, which maps to INDEX_CAN_KANAL_A resp. + INDEX_CAN_KANAL_B in the TinyCAN backend. \note Only the USB adapters are currently supported by this backend. diff --git a/src/serialbus/doc/src/vectorcan.qdoc b/src/serialbus/doc/src/vectorcan.qdoc index 8125c5a..f34d0f2 100644 --- a/src/serialbus/doc/src/vectorcan.qdoc +++ b/src/serialbus/doc/src/vectorcan.qdoc @@ -49,15 +49,16 @@ \code QCanBusDevice *device = QCanBus::instance()->createDevice( - QStringLiteral("vectorcan"), QStringLiteral("channel0")); + QStringLiteral("vectorcan"), QStringLiteral("can0")); device->connectDevice(); \endcode - Where \e channel0 is the active CAN channel name. The VectorCAN backend provides - 64 channels from \e channel0 to \e channel63. Some of these channels can be virtual, - and therefore can be used without actual CAN hardware. To find out the virtual - channels, the program "Vector Hardware Config" (vcanconf.exe) can be used, - which is included in Vector's driver package. + Where \e can0 is the active CAN channel name. The VectorCAN backend provides + 64 channels (defined by XL_CONFIG_MAX_CHANNELS in the Vector API) from \e can0 + to \e can63. Some of these channels can be virtual, and therefore can be used + without actual CAN hardware. To find out the virtual channels, the program + "Vector Hardware Config" (vcanconf.exe) can be used, which is included in + Vector's driver package. The device is now open for writing and reading CAN frames: |