![]() |
Kvaser Linux CANLIB: Welcome to Kvaser CANLIB!
|
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 |
#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 |
linCHANNELDATA_xxx | |
These defines are used in linGetChannelData(). | |
#define | linCHANNELDATA_CARD_FIRMWARE_REV 9 |
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 |
typedef unsigned char | BYTE |
typedef unsigned int | DWORD |
typedef unsigned int | HANDLE |
typedef unsigned int | BOOL |
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, linERR_NO_REF_POWER = -25 } |
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 | 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) |
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.
---------------------------------------------------------------------------
Definitions for the LINlib API.
#define linINVALID_HANDLE ((LinHandle)(-1)) |
Invalid LIN handle
#define LIN_TX 1 |
The message was something we transmitted on the bus.
#define LIN_RX 2 |
The message was something we received from the bus.
#define LIN_WAKEUP_FRAME 4 |
A wake up frame was received. Id/msg/dlc are undefined.
#define LIN_NODATA 8 |
No data, only a header.
#define LIN_CSUM_ERROR 16 |
Checksum error.
#define LIN_PARITY_ERROR 32 |
ID parity error.
#define LIN_SYNCH_ERROR 64 |
A synch error.
#define LIN_BIT_ERROR 128 |
Bit error when transmitting.
#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 LINLIBAPI |
#define LIN_MASTER 1 |
The LIN interface will be a LIN master.
#define LIN_SLAVE 2 |
The LIN interface will be a LIN slave.
#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_STANDARD_PARITY 0x04 |
Use enhanced (2.x) parity for the specified msg
#define LIN_MSG_USE_ENHANCED_PARITY 0x08 |
Use standard (1.x) parity for the specified msg
#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_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.
typedef int LinHandle |
LIN handle
typedef unsigned char BYTE |
typedef unsigned int DWORD |
typedef unsigned int HANDLE |
typedef unsigned int BOOL |
enum LinStatus |