]> rtime.felk.cvut.cz Git - can-utils.git/commit
canbusload: Add exact CAN frame length calculation (including bitstuffing)
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 30 Jan 2014 13:38:58 +0000 (14:38 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 30 Jan 2014 15:23:25 +0000 (16:23 +0100)
commit2206f92de7fd6239af1ed4d8f2bab0a6f7280f61
tree42cfe6aeb699a7fc3d45205fa4ef33220b9e2286
parent4ddde7b966ae1ffd5f3353c40fc7ad7d20c45d22
canbusload: Add exact CAN frame length calculation (including bitstuffing)

This adds an algorithm for calculating the exact number of bits a CAN
frame occupies on the bus and uses this algorithm in canbusload. It
also moves the other methods for CAN frame length calculation, already
present in canbusload, to the new file.

The added algorithm calculates the exact number of stuffed bit in a
CAN frame. Note that in order to calculate that correctly, we must
also know the frame's CRC. Hence, the algorithm also includes CRC
calculation routine.

The correctness of the algorithm was verified on an oscilloscope for
several different SFF and EFF frames.

Currently only CAN frames are supported. For CANFD frames, a different
algorithm is needed. CANFD uses different CRC polynomials and
calculates the CRC from the staffed bit-stream (CAN calculates CRC
from de-stuffed bit-stream).

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
GNUmakefile.am
Makefile
canbusload.c
canframelen.c [new file with mode: 0644]
canframelen.h [new file with mode: 0644]