The eCos CAN subsystem supports the BasicCAN and FullCAN mode. The architecture and the interface of the eCos CAN driver is quite similar to the eCos serial driver and supports the same interface.
The eCos CAN support for any given platform is spread over a number of different packages:
This package, CYGPKG_IO_CAN
, exports a generic
device independent CAN I/O API for accessing devices attached to a CAN
network. This API handles issues such as locking between threads. The
package does not contain any hardware-specific code. Instead it will
call into a CAN device driver to handle the hardware device
access. This package also defines the inderface that such hardware
drivers should provide.
Each CAN device will have its own device driver, which is implemented
as a separate package, for example
CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN
. For devices that may
be attached to a variety of different boards the device driver will be
generic and a second platform specific package will be used to customize
it to each platform. For devices that are associated with a specific
chipset, only a single package may be present.
Typically all appropriate packages will be loaded automatically when you configure eCos for a given platform. If the application does not use any of the CAN I/O facilities, directly or indirectly, then linker garbage collection should eliminate all unnecessary code and data. All necessary initialization should happen automatically. However the exact details may depend on the platform, so the platform HAL documentation should be checked for further details.
There is an important exception to this: if the CAN devices are attached to an expansion connector, such as PCI, then the platform HAL will not know about these devices. Instead the necessary packages will need to be added explicitly during configuration.