Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This structure contains the information for a bus. A bus represents one interface to the world.

Members


typedef struct {
    CPU_BOOLEAN  Extended;
    CPU_INT32U   Baudrate;
    CPU_INT32U   BusNodeName;
    CPU_INT32U   DriverDevName;
    CPU_INT16S (*Init)  (CPU_INT32U);
    CPU_INT16S (*Open)  (CPU_INT16S, CPU_INT32U, CPU_INT16U);
    CPU_INT16S (*Close) (CPU_INT16S);
    CPU_INT16S (*IoCtl) (CPU_INT16S, CPU_INT16U, void *);
    CPU_INT16S (*Read)  (CPU_INT16S, CPU_INT08U *, CPU_INT16U);
    CPU_INT16S (*Write) (CPU_INT16S, CPU_INT08U *, CPU_INT16U);
    CPU_INT16U   Io[CAN_IO_FUNC_N];

} CANBUS_PARA;

Member

Meaning

Extended

The default configuration for the receive buffer

Baudrate

The baudrate in bit/s. If this is set to 0 then the CanBusEnable-function will not set the CAN device to active state.

BusNodeName

The bus node name, which must be used to open the interface with the can bus layer. This is a unique number.

DriverDevName

The driver device name, which must be used to open the interface with the low level device driver. This number is unique for a device driver.

Init

The function pointer to the CAN low level device driver XXX_I nit() function (see chapter 4.1 Driver Layer XXX_Init)

Open

The function pointer to the CAN low level device driver XXX_O pen() function (see chapter 4.1 Driver Layer XXX_Open)

Close

The function pointer to the CAN low level device driver XXX_C lose() function (see chapter 4.1 Driver Layer XXX_Close)

IoCtl

The function pointer to the CAN low level device driver XXX_I oCtl() function (see chapter 4.1 Driver Layer XXX_IoCtl)

Read

The function pointer to the CAN low level device driver XXX_R ead() function (see chapter 4.1 Driver Layer XXX_Read)

Write

The function pointer to the CAN low level device driver XXX_W rite() function (see chapter 4.1 Driver Layer XXX_Write)

Io

The map for all needed IO function codes. The corresponding function codes shall be provided by the CAN low level device driver (see chapter 4.1.4 XXX_IoCtlIoCtl)

Additional Information

Separation of bus node from driver device is necessary when different CAN modules are used, i.e. on a processor with integrated CAN module and also external CAN module(s).

...

In this case a possible configuration could be:

Configuration TouCAN A
Bus node 0
Driver device 0

Configuration TouCAN B
Bus node 1
Driver device 1

Configuration TouCAN C
Bus node 4
Driver device 2

Configuration SJA1000 1
Bus node 5
Driver device 0

Configuration SJA1000 2
Bus node 2
Driver device 1

Configuration SJA1000 3
Bus node 3
Driver device 2

If only one CAN device is used then bus node and driver device should be set to equal values.