vcan_messageΒΆ

Here is the definition:

typedef struct
  {
    long           port     CDEP_NOALIGN_ATTR; /* actually, in the VME-CAN2
                                                  documentation this is
                                                  called a node-number */
    long           id       CDEP_NOALIGN_ATTR; /* Message ID */
    long           datasize CDEP_NOALIGN_ATTR; /* number of data-bytes */
    byte           data[8]  CDEP_NOALIGN_ATTR; /* the data-bytes */
    unsigned short counter  CDEP_NOALIGN_ATTR; /* counter of the object,
                                                  this counter starts at 0
                                                  and is incremented with
                                                  each message, actually
                                                  this is only one byte */
    vcan_msg_status  stat    CDEP_NOALIGN_ATTR;/* status returned by the
                                                  ci-module */
    vcan_errcodes    errcode CDEP_NOALIGN_ATTR;/* 0 in case of no error */
  } vcan_message;

This is the data type of a single CAN message. This structure is used to read or write data to the CAN bus. It also contains a status and an error- field where the result of the action (reading or writing) is returned. Here is an explanation of the fields:

port

The port-number of the object that is being used.

id

The CAN-id of the object that is beeing used.

datasize

The number of data-bytes. This must be set by the user when writing is performed. For reading, the number of bytes that were read is returned in this field.

data

This array of 8 bytes is used for reading and writing. It either receives bytes from the CAN bus or the user writes the data that has to be sent to this field.

counter

This is the internal object counter. Each event increments the counter by 1. This is only one byte, so the range of this counter is 0 to 255.

stat

This is the status that is returned by the function that was called.

errcode

This is the error-code that is returned by the function that was called.