Definitions for the LINlib API. More...
#include <pshpack1.h>
#include <poppack.h>
Go to the source code of this file.
Data Structures |
Macros | |
#define | linINVALID_HANDLE ((LinHandle)(-1)) |
#define | LINERROR(f) ((f) & (LIN_NODATA | LIN_CSUM_ERROR | LIN_SYNCH_ERROR | LIN_BIT_ERROR)) |
LIN message flags | |
The following flags can be returned from linReadMessage() and linReadMessageWait(). | |
#define | LIN_TX 1 |
The message was something we transmitted on the bus. More... | |
#define | LIN_RX 2 |
The message was something we received from the bus. More... | |
#define | LIN_WAKEUP_FRAME 4 |
A wake up frame was received. Id/msg/dlc are undefined. More... | |
#define | LIN_NODATA 8 |
No data, only a header. More... | |
#define | LIN_CSUM_ERROR 16 |
Checksum error. More... | |
#define | LIN_PARITY_ERROR 32 |
ID parity error. More... | |
#define | LIN_SYNCH_ERROR 64 |
A synch error. More... | |
#define | LIN_BIT_ERROR 128 |
Bit error when transmitting. More... | |
Flags for linGetChannelData() | |
These defines are used in linGetChannelData(). | |
#define | linCHANNELDATA_CARD_FIRMWARE_REV 9 |
Flags for linOpenChannel() | |
These defines are used in linOpenChannel(). | |
#define | LIN_MASTER 1 |
The LIN interface will be a LIN master. More... | |
#define | LIN_SLAVE 2 |
The LIN interface will be a LIN slave. More... | |
LIN illegal message flags | |
#define | LIN_MSG_DISTURB_CSUM 1 |
#define | LIN_MSG_DISTURB_PARITY 2 |
LIN message parity | |
#define | LIN_MSG_USE_STANDARD_PARITY 0x04 |
#define | LIN_MSG_USE_ENHANCED_PARITY 0x08 |
LIN setup | |
#define | LIN_ENHANCED_CHECKSUM 1 |
#define | LIN_VARIABLE_DLC 2 |
Typedefs | |
typedef int | LinHandle |
Enumerations | |
enum | LinStatus { linOK = 0, linERR_NOMSG = -1, linERR_NOTRUNNING = -3, linERR_RUNNING = -4, linERR_MASTERONLY = -5, linERR_SLAVEONLY = -6, linERR_PARAM = -7, linERR_NOTFOUND = -8, linERR_NOMEM = -9, linERR_NOCHANNELS = -10, linERR_TIMEOUT = -11, linERR_NOTINITIALIZED = -12, linERR_NOHANDLES = -13, linERR_INVHANDLE = -14, linERR_CANERROR = -15, linERR_ERRRESP = -16, linERR_WRONGRESP = -17, linERR_DRIVER = -18, linERR_DRIVERFAILED = -19, linERR_NOCARD = -20, linERR_LICENSE = -21, linERR_INTERNAL = -22, linERR_NO_ACCESS = -23, linERR_VERSION = -24, linERR_NO_REF_POWER = -25, linERR_NOT_IMPLEMENTED = -26 } |
Functions | |
void | linInitializeLibrary (void) |
void | linUnloadLibrary (void) |
LinStatus | linGetTransceiverData (int channel, unsigned char eanNo[8], unsigned char serNo[8], int *ttype) |
LinHandle | linOpenChannel (int channel, int flags) |
LinStatus | linClose (LinHandle h) |
LinStatus | linGetVersion (int *major, int *minor, int *build) |
LinStatus | linGetFirmwareVersion (LinHandle h, unsigned char *bootVerMajor, unsigned char *bootVerMinor, unsigned char *bootVerBuild, unsigned char *appVerMajor, unsigned char *appVerMinor, unsigned char *appVerBuild) |
LinStatus | linGetChannelData (int channel, int item, void *buffer, size_t bufsize) |
LinStatus | linSetBitrate (LinHandle h, unsigned int bps) |
LinStatus | linBusOn (LinHandle h) |
LinStatus | linBusOff (LinHandle h) |
unsigned long | linReadTimer (LinHandle h) |
LinStatus | linWriteMessage (LinHandle h, unsigned int id, const void *msg, unsigned int dlc) |
LinStatus | linRequestMessage (LinHandle h, unsigned int id) |
LinStatus | linReadMessage (LinHandle h, unsigned int *id, void *msg, unsigned int *dlc, unsigned int *flags, LinMessageInfo *msgInfo) |
LinStatus | linReadMessageWait (LinHandle h, unsigned int *id, void *msg, unsigned int *dlc, unsigned int *flags, LinMessageInfo *msgInfo, unsigned long timeout) |
LinStatus | linUpdateMessage (LinHandle h, unsigned int id, const void *msg, unsigned int dlc) |
LinStatus | linSetupIllegalMessage (LinHandle h, unsigned int id, unsigned int cFlags, unsigned int delay) |
LinStatus | linSetupLIN (LinHandle h, unsigned int lFlags, unsigned int bps) |
LinStatus | linWriteWakeup (LinHandle h, unsigned int count, unsigned int interval) |
LinStatus | linClearMessage (LinHandle h, unsigned int id) |
LinStatus | linWriteSync (LinHandle h, unsigned long timeout) |
LinStatus | linGetCanHandle (LinHandle h, unsigned int *canHandle) |
Definitions for the LINlib API.
struct LinMessageInfo |
In certain LIN bus API calls, the following structure is used to provide more information about the LIN messages.
Data Fields | ||
---|---|---|
unsigned long | bitrate |
The bitrate of the message in bits per seconds. Range [1000 .. 20000] (plus some margin) |
unsigned long | byteTime[8] |
Start time in microseconds of each data byte. In case of 8-byte messages, the crc time isn't included (but can be deduced from frameLength).
|
unsigned char | checkSum |
The checksum as read from the LIN bus. Might not match the data in case of LIN_CSUM_ERROR. |
unsigned long | frameLength |
The total frame length in microseconds; from the synch break to the end of the crc. [2200 .. 173600] |
unsigned char | idPar |
The id with parity of the message as read from the LIN bus. Might be invalid in case of LIN_PARITY_ERROR. |
unsigned long | synchBreakLength |
Length of the synch break in microseconds. [650 .. 13000], [400 .. 8000] for a wakeup signal. |
unsigned long | synchEdgeTime[4] |
Time in microseconds of the falling edges in the synch byte relative the falling edge of the start bit.
|
unsigned long | timestamp |
Kvaser DRV Lin timestamp - Timestamp in milliseconds of the falling edge of the synch break of the message. Uses the canlib CAN timer. Kvaser LIN Leaf timestamp - Timestamp in milliseconds of the falling edge of the synch break of the message. Uses the canlib CAN timer.
|
unsigned short | z | Dummy for alignment. |
#define LIN_BIT_ERROR 128 |
Bit error when transmitting.
#define LIN_CSUM_ERROR 16 |
Checksum error.
#define LIN_ENHANCED_CHECKSUM 1 |
When specified, the LIN interface will use the "enhanced" checksum according to LIN 2.0. Note that (as per the LIN 2.0 spec) the enhanced checksum is not used on the diagnostic frames even if the LIN_ENHANCED_CHECKSUM setting is in effect.
The default value is OFF.
#define LIN_MASTER 1 |
The LIN interface will be a LIN master.
#define LIN_MSG_DISTURB_CSUM 1 |
The checksum of transmitted messages will be inverted (and consequently illegal.)
#define LIN_MSG_DISTURB_PARITY 2 |
The two parity bits will be inverted (and consequently illegal.) Used only in master mode.
#define LIN_MSG_USE_ENHANCED_PARITY 0x08 |
Use enhanced (2.x) parity for the specified msg
#define LIN_MSG_USE_STANDARD_PARITY 0x04 |
Use standard (1.x) parity for the specified msg
#define LIN_NODATA 8 |
No data, only a header.
#define LIN_PARITY_ERROR 32 |
ID parity error.
#define LIN_RX 2 |
The message was something we received from the bus.
#define LIN_SLAVE 2 |
The LIN interface will be a LIN slave.
#define LIN_SYNCH_ERROR 64 |
A synch error.
#define LIN_TX 1 |
The message was something we transmitted on the bus.
#define LIN_VARIABLE_DLC 2 |
When specified, turns variable message length on, so the the message length will depend on the message ID.
The default value is ON.
#define LIN_WAKEUP_FRAME 4 |
A wake up frame was received. Id/msg/dlc are undefined.
#define linCHANNELDATA_CARD_FIRMWARE_REV 9 |
This define is used in linGetChannelData(), buffer mentioned below refers to this functions argument.
buffer points to a 64-bit (8 bytes) area which receives the firmware revision number on the card. This number consists of four 16-bit words: the major revision, the minor revision, the release number and the build number, listed in order from the most significant to the least significant.
#define LINERROR | ( | f | ) | ((f) & (LIN_NODATA | LIN_CSUM_ERROR | LIN_SYNCH_ERROR | LIN_BIT_ERROR)) |
Macro for determining if a flag field contains a LIN error flag bit.
#define linINVALID_HANDLE ((LinHandle)(-1)) |
Invalid LIN handle
typedef int LinHandle |
LIN handle