Data Structures | Macros | Typedefs | Functions
linlib.h File Reference

Definitions for the LINlib API. More...

Go to the source code of this file.

## Data Structures
struct | LinMessageInfo

## Macros
#define | linINVALID_HANDLE ((LinHandle)(-1))
#define | LINERROR(f) ((f) & (LIN_NODATA | LIN_CSUM_ERROR | LIN_SYNCH_ERROR | LIN_BIT_ERROR))
#define | LINLIBAPI
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
typedef unsigned char | BYTE
typedef unsigned int | DWORD
typedef unsigned int | BOOL

## 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)

## Detailed Description

Definitions for the LINlib API.

## Macro Definition Documentation

## ◆ LIN_BIT_ERROR

#define LIN_BIT_ERROR 128

Bit error when transmitting.

## ◆ LIN_CSUM_ERROR

#define LIN_CSUM_ERROR 16

Checksum error.

## ◆ LIN_ENHANCED_CHECKSUM

#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.

## ◆ LIN_MASTER

#define LIN_MASTER 1

The LIN interface will be a LIN master.

## ◆ LIN_MSG_DISTURB_CSUM

#define LIN_MSG_DISTURB_CSUM 1

The checksum of transmitted messages will be inverted (and consequently illegal.)

## ◆ LIN_MSG_DISTURB_PARITY

#define LIN_MSG_DISTURB_PARITY 2

The two parity bits will be inverted (and consequently illegal.) Used only in master mode.

## ◆ LIN_MSG_USE_ENHANCED_PARITY

#define LIN_MSG_USE_ENHANCED_PARITY 0x08

Use standard (1.x) parity for the specified msg

## ◆ LIN_MSG_USE_STANDARD_PARITY

#define LIN_MSG_USE_STANDARD_PARITY 0x04

Use enhanced (2.x) parity for the specified msg

## ◆ LIN_NODATA

#define LIN_NODATA 8

No data, only a header.

## ◆ LIN_PARITY_ERROR

#define LIN_PARITY_ERROR 32

ID parity error.

## ◆ LIN_RX

#define LIN_RX 2

The message was something we received from the bus.

## ◆ LIN_SLAVE

#define LIN_SLAVE 2

The LIN interface will be a LIN slave.

## ◆ LIN_SYNCH_ERROR

#define LIN_SYNCH_ERROR 64

A synch error.

## ◆ LIN_TX

#define LIN_TX 1

The message was something we transmitted on the bus.

## ◆ LIN_VARIABLE_DLC

#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.

## ◆ LIN_WAKEUP_FRAME

#define LIN_WAKEUP_FRAME 4

A wake up frame was received. Id/msg/dlc are undefined.

## ◆ linCHANNELDATA_CARD_FIRMWARE_REV

#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.

## ◆ LINERROR

#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.

## ◆ linINVALID_HANDLE

#define linINVALID_HANDLE ((LinHandle)(-1))

Invalid LIN handle

## ◆ LINLIBAPI

#define LINLIBAPI

## Typedef Documentation

## ◆ BOOL

typedef unsigned int BOOL

## ◆ BYTE

typedef unsigned char BYTE

## ◆ DWORD

typedef unsigned int DWORD

## ◆ LinHandle

typedef int LinHandle

LIN handle