Functions

int platform_can_exists( unsigned id );

Checks if the platform has the hardware CAN specified as argument. Implemented in src/common.c, it uses the NUM_CAN macro that must be defined in the platform's platform_conf.h file (see here for details). For example:

#define NUM_CAN 1 // The platform has one CAN interface

Arguments: id - CAN interface ID.

Returns: 1 if the CAN interface exists, 0 otherwise

u32 platform_can_setup( unsigned id, u23 clock );

This function is used to initialize the CAN hardware and set the bus clock.

Arguments:

id - CAN interface ID.

clock - the clock of the CAN bus, maximum speed is generally 1000000 (1 Mbit)

Returns: the actual speed set for the CAN interface. Depending on the hardware, this may have a different value than the clock argument.