eCosPro-CAN - CAN API and drivers for the eCosPro RTOS
eCosPro-CAN is an optional middleware package for the eCosPro RTOS providing standard Controller Area Network support for automotive and industrial applications. It combines a straightforward intuitive CAN API with support for an extensible range of external and on-chip CAN controllers.
eCosPro-CAN is supplied as an installable and configurable eCos EPK module. Full source code and documentation are included along with engineering technical support. It is also royalty free and can be deployed in any number of products and devices without incurring additional cost.
Developed by eCosCentric, the implementation is efficient both in terms communications performance and resource footprint, generally consuming less than 10KB total memory for both generic API and typical device driver portions.
Supported devices include NXP external SJA1000 CAN devices, Freescale Coldfire and PowerPC FlexCAN on-chip devices, ST STR71x on-chip devices, ST STM32 F2- and F4-based on-chip devices, Atmel AT91SAM microcontrollers on-chip devices, and NXP ARM LPC2xxx series on-chip devices.
Alternative hardware support can be either be added by following the supplied driver template, examples and documentation, or by eCosCentric developing a custom CAN device driver for your specified hardware.
The CAN package provides a straightforward, generic, portable API that manages all the essential CAN operations including initialization, device access, buffer management, message transmission and reception, and packet filtering.
If the hardware does not directly support packet filtering then the driver implements this feature in software.
int cyg_can_init(void); int cyg_can_open(char* devname, cyg_can_dev* dev); int cyg_can_close(cyg_can_dev dev); cyg_can_msg* cyg_can_msg_alloc(void); void cyg_can_msg_free(cyg_can_msg* msg); int cyg_can_send(cyg_can_dev dev, cyg_can_msg* msg); int cyg_can_send_nowait(cyg_can_dev dev, cyg_can_msg* msg); int cyg_can_recv(cyg_can_dev dev, cyg_can_msg** msg); int cyg_can_recv_poll(cyg_can_dev dev, cyg_can_msg** msg); int cyg_can_recv_timeout(cyg_can_dev dev, cyg_can_msg** msg, cyg_tick_count_t timeout); void cyg_can_poll(void); int cyg_can_filter_set(cyg_can_dev dev, cyg_bool ide, cyg_uint32 match, cyg_uint32 mask); int cyg_can_filter_get(cyg_can_dev dev, cyg_bool* ide, cyg_uint32* match, cyg_uint32* mask); int cyg_can_baud_set(cyg_can_dev dev, cyg_uint32 baud); int cyg_can_baud_get(cyg_can_dev dev, cyg_uint32* baud); const char cyg_can_error_string(int code);
A standards compliant CANopen protocol stack is also available for industrial automation applications. The stack is fully compatible with the eCosPro-CAN drivers.