Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

CanFunctions
[Can_returnValues]


Enumerations

enum  { B_CAN_GATEWAY, B_CAN_GROUP, B_CAN_MESSAGE, B_CAN_STATUS }

Functions

int can_probebus (can_list list, char *errbuf)
 The function is used to probe the bus for CAN cards.
int can_openchannel (char *device, char *errbuf)
 This functions is used to open a CAN channel for reading and writing.
int can_readchannel (int handle, can_frame *frame)
 This functions is used to read a can_frame from a channel.
int can_writechannel (int handle, can_frame *frame)
 This functions is used to write a can_frame to a channel.
int can_closechannel (int handle)
 This functions is used to close a channel opened with can_openchannel.
int can_setchanneloptions (int handle, int option, int status)
 This functions is used to manually set an option on an underlying adapter.
int can_getchanneloptions (int handle, int option, int *status)
 This functions is used to manually get an option from an underlying adapter.
int can_can2raw (can_frame *frame, uchar *raw)
 This functions is used to convert a formatted can_frame to a raw bitpacked CAN 2.0 B frame.
int can_raw2can (uchar *raw, can_frame *frame)
 This functions is used to convert a raw bitpacked CAN 2.0 B frame to a formatted can_frame.
int can_getlasterror (int handle, char *errbuf)
 This functions is used to get the character string of the last error associated with a handle.
int can_getlastassoc (int handle, as_ts *timestamp)
 This functions is used to get the last IRIG time sync association.
int can_getfield (can_frame *frame, int type, int *ret)
 This functions is used to extract fields for use in the Analyzer.

Enumeration Type Documentation

anonymous enum
 

Enumerator:
B_CAN_GATEWAY  If the packet has been read without problems.
B_CAN_GROUP  Group ID bits from the Arbitration Field.
B_CAN_MESSAGE  Message ID bits from the Arbitration Field.
B_CAN_STATUS  Status bits from the Arbitration Field.

Definition at line 622 of file canapi.h.


Function Documentation

int can_can2raw can_frame frame,
uchar raw
 

This functions is used to convert a formatted can_frame to a raw bitpacked CAN 2.0 B frame.

Parameters:
frame The can_frame to convert to a bitpacked Frame
raw The output bitpacked frame
Returns:
Possible return values are

Definition at line 85 of file canapi.c.

References _bit_width, _get_offsets(), _GETBYTE, _offsets, can20bframe::ack, can20bframe::arbitration, B_ACK, B_CRC, B_DAT, B_DLC, B_EOF, B_EXT, B_ID, B_IDE, B_RES, B_RTR, B_SOF, B_SRR, can20bframe::control, can20bframe::crc, can20bframe::data, can20bframe::eof, S_ERR_INVARG1, S_ERR_INVARG2, S_SUCCESS, setatbit(), and can20bframe::sof.

int can_closechannel int  handle  ) 
 

This functions is used to close a channel opened with can_openchannel.

Parameters:
handle Handle to the device for which the user wants to close
Returns:
Possible return values are

Definition at line 227 of file canapi.c.

References boardshutdown(), isinvalid(), and S_ERR_INV_HANDLE.

int can_getchanneloptions int  handle,
int  option,
int *  status
 

This functions is used to manually get an option from an underlying adapter.

Parameters:
handle Handle to the device for which the user wants to
option One of Options that can be passed
status The return value from the call
Returns:
Possible return values are

Definition at line 129 of file canapi.c.

References _if_channel::baudrate, _if_channel::blocktimeout, _if_channel::board, boardupdatestatus(), C_BAUDRATE, C_BLOCKTIMEOUT, C_BOARDSTATE, C_CODE, C_HIDECHIP, C_HIDEERRORS, C_MASK, C_RXERROR, C_RXQUEUE, C_TXERROR, C_TXQUEUE, _if_channel::filter, isinvalid(), _if_channel::rxerror, _if_channel::rxqueue, S_ERR_INV_HANDLE, S_ERR_INVARG2, S_SUCCESS, SETERROR, _if_board::status, _if_channel::txerror, and _if_channel::txqueue.

int can_getfield can_frame frame,
int  type,
int *  ret
 

This functions is used to extract fields for use in the Analyzer.

Parameters:
frame The frame from which to get a field
type The field to get in the frame
ret The returned value of the field
Returns:
Possible return values are

Definition at line 292 of file canapi.c.

References can20bframe::arbitration, b_can_bitsizes, getatbit(), S_ERR_INVARG3, and S_SUCCESS.

int can_getlastassoc int  handle,
as_ts timestamp
 

This functions is used to get the last IRIG time sync association.

Parameters:
handle Handle to the device for which the user wants to
timestamp A as_ts
Returns:
Possible return values are

Definition at line 253 of file canapi.c.

References _as_ts::can_ts_nsec, _as_ts::can_ts_sec, _as_ts::irig_ts_nsec, _as_ts::irig_ts_sec, isinvalid(), _if_channel::lastsync, S_ERR_INV_HANDLE, and S_SUCCESS.

int can_getlasterror int  handle,
char *  errbuf
 

This functions is used to get the character string of the last error associated with a handle.

Parameters:
handle Handle to the device for which the user wants to
errbuf A char of size CAN_MAXBUFFER for errors
Returns:
Possible return values are

Definition at line 233 of file canapi.c.

References _errframe, _errors, _if_channel::error, isinvalid(), _if_channel::mask, S_ERR_INV_HANDLE, and S_SUCCESS.

int can_openchannel char *  device,
char *  errbuf
 

This functions is used to open a CAN channel for reading and writing.

Parameters:
device An index of the array returned by can_probebus
errbuf A char of size CAN_MAXBUFFER for errors
Returns:
Possible return values are
  • Non-negative number: Numeric value which to refer to the channel
  • Negative number: An error occured, check errbuf

Definition at line 195 of file canapi.c.

References boardopenchannel(), if_channel_count, _if_channel::name, S_ERR_HW_NOT_PRESENT, and seterror().

int can_probebus can_list  list,
char *  errbuf
 

The function is used to probe the bus for CAN cards.

Parameters:
list A char* list of CAN channels that can be opened
errbuf A char of size CAN_MAXBUFFER for errors
Returns:
Possible return values are
  • Non-negative: Return value corresponds to number of channels available
  • Negative: An error occured, check errbuf

Definition at line 176 of file canapi.c.

References boardprobe(), CAN_MAXBUFFER, if_board_count, if_channel_count, _if_channel::name, S_ERR_INVARG1, S_ERR_UNKNOWN, and seterror().

int can_raw2can uchar raw,
can_frame frame
 

This functions is used to convert a raw bitpacked CAN 2.0 B frame to a formatted can_frame.

Parameters:
raw The bitpacked CAN frame to convert to a can_frame
frame The output can_frame
Returns:
Possible return values are

Definition at line 115 of file canapi.c.

int can_readchannel int  handle,
can_frame frame
 

This functions is used to read a can_frame from a channel.

Parameters:
handle Handle to the device for which the user wants to
frame A can_frame that is read in
Returns:
Possible return values are

Definition at line 207 of file canapi.c.

References boardread(), isinvalid(), S_ERR_INV_HANDLE, S_ERR_INVARG2, and SETERROR.

int can_setchanneloptions int  handle,
int  option,
int  status
 

This functions is used to manually set an option on an underlying adapter.

Parameters:
handle Handle to the device for which the user wants to close
option One of Options that can be passed
status The value to attribute to the option
Returns:
Possible return values are

Definition at line 119 of file canapi.c.

References boardchangestatus(), isinvalid(), S_ERR_INV_HANDLE, S_ERR_INVARG2, and SETERROR.

int can_writechannel int  handle,
can_frame frame
 

This functions is used to write a can_frame to a channel.

Parameters:
handle Handle to the device for which the user wants to
frame A can_frame to write out to the bus
Returns:
Possible return values are

Definition at line 217 of file canapi.c.

References boardwrite(), isinvalid(), S_ERR_INV_HANDLE, S_ERR_INVARG2, and SETERROR.


Generated on Wed Feb 22 13:31:30 2006 for CANapi by  doxygen 1.4.4