Commit Graph

6 Commits (2643d28a57ce8637ca31ef4af91873c9f91bc532)

Author SHA1 Message Date
Kurt Van Dijck 6382765bf6 canbusload: count databitrate seperately
Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
2021-06-24 14:44:50 +02:00
Oliver Hartkopp 5d5ccf38ee fix include order and unify local include placement
In commit https://github.com/linux-can/can-utils/commit/b153fe3f3591
("clang-tidy: sort includes alphabetically") the position of the "lib.h"
include has been moved in a way that struct canfd_frame has not been
defined anymore and lead to a warning when compiling cangen.c

This patch reverts that specific move and unifies the location of local
includes at the end of the include list.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-10-13 10:03:19 +02:00
Rosen Penev b153fe3f35
clang-tidy: sort includes alphabetically
Found with llvm-include-order

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:28:58 -07:00
Yegor Yefremov 7b7331976a Add SPDX identifiers
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-06-19 12:24:24 +02:00
Michal Sojka d6b576c012 canbusload: Fix worst-case frame length estimation
The Tindell's method used previously is incorrect. It does not account for
the fact that the stuffed bits are themselves also subject to bit stuffing.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-30 16:23:32 +01:00
Michal Sojka 2206f92de7 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>
2014-01-30 16:23:25 +01:00