CANBUS_DATA

CANBUS_DATA

Description

This structure holds the runtime data for the CAN bus management.

Members

typedef struct {
    CANBUS_PARA *Cfg;
    CPU_INT16S   Dev;
    CPU_INT16U   RxTimeout;
    CPU_INT16U   TxTimeout;
    CANFRM       BufTx[CANBUS_TX_QSIZE];
    CPU_INT16U   BufTxRd;
    CPU_INT16U   BufTxWr;
    CANFRM       BufRx[CANBUS_RX_QSIZE];
    CPU_INT16U   BufRxRd;
    CPU_INT16U   BufRxWr;
#if CANBUS_STAT_EN > 0
    CPU_INT16U   RxOkay;
    CPU_INT16U   TxOkay;
    CPU_INT16U   RxLost;
    CPU_INT16U   TxLost;
#endif
} CANBUS_DATA;
  

Member

Meaning

Cfg

The pointer to the read-only CAN bus configuration

Dev

This member holds the device ID, which is returned by the Open() function of the linked low level device driver.

RxTimeout

The timeout, which is used during the CanBusRead()

TxTimeout

The timeout, which is used during the CanBusWrite()

BufTx[]

The internal transmit queue which is used between CanBusWrite() and CanBusTxHandler() when the CAN bus is busy.

BufTxRd

The internal transmit queue read pointer.

BufTxWr

The internal transmit queue write pointer.

BufRx[]

The internal receive queue which is used between CanBusRxHandler() and CanBusRead().

BufRxRd

The internal receive queue read pointer.

BufRxWr

The internal receive queue write pointer.

RxOkay

This member holds the counter, which will be incremented every received CAN frame.

This counter is incremented, when the CanBusRead() function successfully gives the CAN frame to the application layer.

TxOkay

The counter, which will be incremented every transmitted CAN frame.

This counter is incremented, when the CAN transmit complete interrupt indicates, that the CAN frame is sent to the bus.

RxLost

This member holds the counter, which will be incremented for every received CAN frame which can not transferred to the application, due to a full receive queue.

TxLost

This member holds the counter, which will be incremented for every transmission CAN frame, which can not transferred to the transmit interrupt handler due to a full transmission queue