Kvaser Linux CANLIB

linlib.h File Reference

Data Structures

struct  LinMessageInfo

Defines

#define linINVALID_HANDLE   ((LinHandle)(-1))
#define CompilerAssert(exp)   extern char _CompilerAssert[(exp) ? 1 : -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
#define LIN_RX   2
#define LIN_WAKEUP_FRAME   4
#define LIN_NODATA   8
#define LIN_CSUM_ERROR   16
#define LIN_PARITY_ERROR   32
#define LIN_SYNCH_ERROR   64
#define LIN_BIT_ERROR   128
Flags for linOpenChannel()
#define LIN_MASTER   1
#define LIN_SLAVE   2
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

Return codes from the LINlib functions

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
}

Functions

void linInitializeLibrary (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 linGetFirmwareVersion (LinHandle h, unsigned char *bootVerMajor, unsigned char *bootVerMinor, unsigned char *bootVerBuild, unsigned char *appVerMajor, unsigned char *appVerMinor, unsigned char *appVerBuild)
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

LICENSE

 This software is dual licensed under the following two licenses:
 BSD-new and GPLv2. You may use either one. See the included
 COPYING file for details.
 License: BSD-new
 ===============================================================================
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
     * Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.
     * Neither the name of the <organization> nor the
       names of its contributors may be used to endorse or promote products
       derived from this software without specific prior written permission.
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT holder>=""> BE LIABLE FOR ANY
 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 License: GPLv2
 ===============================================================================
 This program 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 2
 of the License, or (at your option) any later version.
 This program 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 should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ---------------------------------------------------------------------------
 

DESCRIPTION

Definitions for the LINlib API.

Author:
Kvaser AB