Kvaser Linux CANLIB

Object buffers

Functions

canStatus canObjBufFreeAll (const CanHandle hnd)
canStatus canObjBufAllocate (const CanHandle hnd, int type)
canStatus canObjBufFree (const CanHandle hnd, int idx)
canStatus canObjBufWrite (const CanHandle hnd, int idx, int id, void *msg, unsigned int dlc, unsigned int flags)
canStatus canObjBufSetFilter (const CanHandle hnd, int idx, unsigned int code, unsigned int mask)
canStatus canObjBufSetFlags (const CanHandle hnd, int idx, unsigned int flags)
canStatus canObjBufSetPeriod (const CanHandle hnd, int idx, unsigned int period)
canStatus canObjBufSetMsgCount (const CanHandle hnd, int idx, unsigned int count)
canStatus canObjBufEnable (const CanHandle hnd, int idx)
canStatus canObjBufDisable (const CanHandle hnd, int idx)
canStatus canObjBufSendBurst (const CanHandle hnd, int idx, unsigned int burstlen)

Function Documentation

canStatus canObjBufAllocate ( const CanHandle  hnd,
int  type 
)

Allocates an object buffer associated with a handle to a CAN circuit.

Parameters:
[in]hndAn open handle to a CAN circuit.
[in]typeThe type of the buffer. Must be one of canOBJBUF_TYPE_xxx
Returns:
A buffer index (zero or positive) if success.
canERR_xxx (negative) if failure
See also:
Object Buffers
canObjBufFree(), canObjBufFreeAll()
canStatus canObjBufDisable ( const CanHandle  hnd,
int  idx 
)

Disables the object buffer with the specified index.

Parameters:
[in]hndAn open handle to a CAN circuit.
[in]idxThe index of the buffer.
Returns:
canOK (zero) if success
canERR_xxx (negative) if failure
See also:
Object Buffers
canObjBufEnable()
canStatus canObjBufEnable ( const CanHandle  hnd,
int  idx 
)

Enables the object buffer with the specified index.

Parameters:
[in]hndAn open handle to a CAN circuit.
[in]idxThe index of the object buffer to enable.
Returns:
canOK (zero) if success
canERR_xxx (negative) if failure
See also:
Object Buffers
canObjBufDisable()
canStatus canObjBufFree ( const CanHandle  hnd,
int  idx 
)

Deallocates the object buffer with the specified index. The buffer can not be referenced after this operation.

Parameters:
[in]hndAn open handle to a CAN circuit.
[in]idxThe object buffer to deallocate.
Returns:
canOK (zero) if success
canERR_xxx (negative) if failure
See also:
Object Buffers
canObjBufFreeAll(), canObjBufAllocate(),
canStatus canObjBufFreeAll ( const CanHandle  hnd)

Deallocates all object buffers on the specified handle. The buffers cannot be referenced after this operation.

Parameters:
[in]hndAn open handle to a CAN circuit.
Returns:
canOK (zero) if success
canERR_xxx (negative) if failure
See also:
Object Buffers
canObjBufFree(), canObjBufAllocate()
canStatus canObjBufSendBurst ( const CanHandle  hnd,
int  idx,
unsigned int  burstlen 
)

The canObjBufSendBurst function sends a burst of CAN messages. You have to set up an object buffer first with the message to send. The messages will be sent as fast as possible from the hardware.

This function is inteneded for certain diagnostic applications.

Parameters:
[in]hndAn open handle to a CAN channel.
[in]idxThe index of a CAN object buffer.
[in]burstlenThe number of messages to send.
Returns:
canOK (zero) if success
canERR_xxx (negative) if failure
See also:
Object Buffers
canStatus canObjBufSetFilter ( const CanHandle  hnd,
int  idx,
unsigned int  code,
unsigned int  mask 
)

Defines a message reception filter on the specified object buffer. Messages not matching the filter are discarded.

Note:
For an auto response buffer, set the code and mask that together define the identifier(s) that trigger(s) the automatic response.
Parameters:
[in]hndAn open handle to a CAN circuit.
[in]idxThe index of the object buffer on which the filter is to be set.
[in]codeThe acceptance code in the filter.
[in]maskThe acceptance mask in the filter.
Returns:
canOK (zero) if success
canERR_xxx (negative) if failure
See also:
Code and Mask Format, Object Buffers
canStatus canObjBufSetFlags ( const CanHandle  hnd,
int  idx,
unsigned int  flags 
)

Sets object buffer flags on a specified object buffer.

Parameters:
[in]hndAn open handle to a CAN circuit.
[in]idxThe buffer on which the flags are to be set.
[in]flagsSpecifies a combination of zero or more of the canOBJBUF_AUTO_RESPONSE_xxx flag values
Returns:
canOK (zero) if success
canERR_xxx (negative) if failure
See also:
Object Buffers
canStatus canObjBufSetMsgCount ( const CanHandle  hnd,
int  idx,
unsigned int  count 
)

The canObjBufSetMsgCount function sets the message count for an auto transmit object buffer.

Parameters:
[in]hndAn open handle to a CAN channel.
[in]idxThe index of a CAN object buffer.
[in]countThe message count.
Returns:
canOK (zero) if success
canERR_xxx (negative) if failure
See also:
Object Buffers
canStatus canObjBufSetPeriod ( const CanHandle  hnd,
int  idx,
unsigned int  period 
)

The canObjBufSetPeriod function sets the transmission period for an auto transmission object buffer.

Parameters:
[in]hndAn open handle to a CAN channel.
[in]idxThe index of a CAN object buffer.
[in]periodThe transmission interval, in microseconds.
Returns:
canOK (zero) if success
canERR_xxx (negative) if failure
See also:
Object Buffers
canStatus canObjBufWrite ( const CanHandle  hnd,
int  idx,
int  id,
void *  msg,
unsigned int  dlc,
unsigned int  flags 
)

Defines the contents of a specific object buffer.

Parameters:
[in]hndAn open handle to a CAN circuit.
[in]idxThe index of the object buffer whose contents is to be defined.
[in]idThe CAN identifier of the message.
[in]msgPoints to the contents of the message.
[in]dlcThe length of the message. Must be at least 0 and at most 8 bytes.
[in]flagsMessage flags; a combination of the canMSG_xxx flags.
Returns:
canOK (zero) if success
canERR_xxx (negative) if failure
See also:
Object Buffers