mirror of https://github.com/rusefi/openblt.git
Refs #316. Integrated XCP on CAN transport layer into the LibOpenBLT API.
git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@314 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
parent
44f30fc5a0
commit
d1a746f454
|
@ -39,6 +39,7 @@
|
|||
#include "session.h" /* Communication session module */
|
||||
#include "xcploader.h" /* XCP loader module */
|
||||
#include "xcptpuart.h" /* XCP UART transport layer */
|
||||
#include "xcptpcan.h" /* XCP CAN transport layer */
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
|
@ -165,6 +166,28 @@ LIBOPENBLT_EXPORT void BltSessionInit(uint32_t sessionType,
|
|||
xcpLoaderSettings.transport = XcpTpUartGetTransport();
|
||||
}
|
||||
}
|
||||
else if (transportType == BLT_TRANSPORT_XCP_V10_CAN)
|
||||
{
|
||||
/* Cast transport settings to the correct type. */
|
||||
tBltTransportSettingsXcpV10Can * bltTransportSettingsXcpV10CanPtr;
|
||||
bltTransportSettingsXcpV10CanPtr =
|
||||
(tBltTransportSettingsXcpV10Can * )transportSettings;
|
||||
/* Convert transport settings to the format supported by the XCP CAN transport
|
||||
* layer. It was made static to make sure it doesn't get out of scope when
|
||||
* used in xcpLoaderSettings.
|
||||
*/
|
||||
static tXcpTpCanSettings xcpTpCanSettings;
|
||||
xcpTpCanSettings.device = bltTransportSettingsXcpV10CanPtr->deviceName;
|
||||
xcpTpCanSettings.channel = bltTransportSettingsXcpV10CanPtr->deviceChannel;
|
||||
xcpTpCanSettings.baudrate = bltTransportSettingsXcpV10CanPtr->baudrate;
|
||||
xcpTpCanSettings.transmitId = bltTransportSettingsXcpV10CanPtr->transmitId;
|
||||
xcpTpCanSettings.receiveId = bltTransportSettingsXcpV10CanPtr->receiveId;
|
||||
xcpTpCanSettings.useExtended = (bltTransportSettingsXcpV10CanPtr->useExtended != 0);
|
||||
/* Store transport layer settings in the XCP loader settings. */
|
||||
xcpLoaderSettings.transportSettings = &xcpTpCanSettings;
|
||||
/* Link the transport layer to the XCP loader settings. */
|
||||
xcpLoaderSettings.transport = XcpTpCanGetTransport();
|
||||
}
|
||||
/* Perform actual session initialization. */
|
||||
SessionInit(XcpLoaderGetProtocol(), &xcpLoaderSettings);
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ typedef struct t_blt_transport_settings_xcp_v10_rs232
|
|||
*/
|
||||
typedef struct t_blt_transport_settings_xcp_v10_can
|
||||
{
|
||||
char const * deviceName; /**< Device name such as can0. */
|
||||
char const * deviceName; /**< Device name such as can0, peak_pcanusb etc. */
|
||||
uint32_t deviceChannel; /**< Channel on the device to use. */
|
||||
uint32_t baudrate; /**< Communication speed in bits/sec. */
|
||||
uint32_t transmitId; /**< Transmit CAN identifier. */
|
||||
|
|
|
@ -93,7 +93,7 @@ type
|
|||
|
||||
// Structure layout of the XCP version 1.0 CAN transport layer settings.
|
||||
tBltTransportSettingsXcpV10Can = record
|
||||
deviceName: PAnsiChar; // Device name such as can0, pcanusb, etc.
|
||||
deviceName: PAnsiChar; // Device name such as can0, peak_pcanusb, etc.
|
||||
deviceChannel: LongWord; // Channel on the device to use.
|
||||
baudrate: LongWord; // Communication speed in bits/sec.
|
||||
transmitId: LongWord; // Transmit CAN identifier.
|
||||
|
|
|
@ -45,7 +45,7 @@ extern "C" {
|
|||
*/
|
||||
typedef struct t_xcp_tp_can_settings
|
||||
{
|
||||
char const * device; /**< Device name such as can0, pcanusb, etc. */
|
||||
char const * device; /**< Device name such as can0, peak_pcanusb, etc. */
|
||||
uint32_t channel; /**< Channel on the device to use. */
|
||||
uint32_t baudrate; /**< Communication speed in bits/sec. */
|
||||
uint32_t transmitId; /**< Transmit CAN identifier. */
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue