Skip to content

Draft: cpukit: add support for common CAN/CAN FD stack

Michal Lenc requested to merge michallenc/rtems:canfd-stack-support into main

This is a draft MR to provide better review environment compared to mailing list. Some parts of the stack already went through initial review (mostly general code structure, documentation etc.), see threads on devel list [1] and [2]. The stack web manual is available at [3] and will be submitted to RTEMS documentation once this is merged. The functions, variables and structures are documented with Doxygen. The generated documentation for the stack can be found here [4].

You may use our development git repository to test the stack and CTU CAN FD controller on Xilinx Zynq target or using mainline QEMU qemu-system-x86_64 by compiling the application for i386 target. If you do not want to fetch this branch and build RTEMS again, you may build the stack located in lib/candrv. Just enable CONFIG_OC_APP_CAN_TEST_WITH_CANDRV in config.omk.

Also another (perhaps more detailed) description of the stack is in my diploma thesis in chapter 3.

Summary

This adds support for common full-featured CAN/CAN FD stack to RTEMS. The API is provided in form the form of the POSIX character driver with each CAN controller (chip) registered as node into “/dev” namespace.

The stack utilizes FIFO queues (also called edges) organized into oriented edges between controller side and application side. Edges, responsible for message transfers from application to controller and vice versa, can have different priorities and function as priority classes.

The stack provides run time configuration options to create new queues with desired priority, direction and filter, making it suitable for various applications requirements. There is also a possibility to configure controller’s characteristics (bit rate, mode, chip specific ioctl calls). Both blocking and nonblocking mode is supported.

Virtual CAN controller and CTU CAN FD controller are also added.

Merge request reports