can: dev: move bittiming related code into seperate file

This patch moves the bittiming related code of the CAN device infrastructure
into a separate file.

Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/r/20210111141930.693847-4-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
Marc Kleine-Budde
2021-01-11 15:19:18 +01:00
parent 3e77f70e73
commit 5a9d5ecd69
6 changed files with 308 additions and 276 deletions

View File

@@ -15,6 +15,7 @@
#define _CAN_DEV_H
#include <linux/can.h>
#include <linux/can/bittiming.h>
#include <linux/can/error.h>
#include <linux/can/led.h>
#include <linux/can/netlink.h>
@@ -82,21 +83,6 @@ struct can_priv {
#endif
};
#define CAN_SYNC_SEG 1
/*
* can_bit_time() - Duration of one bit
*
* Please refer to ISO 11898-1:2015, section 11.3.1.1 "Bit time" for
* additional information.
*
* Return: the number of time quanta in one bit.
*/
static inline unsigned int can_bit_time(const struct can_bittiming *bt)
{
return CAN_SYNC_SEG + bt->prop_seg + bt->phase_seg1 + bt->phase_seg2;
}
/*
* can_cc_dlc2len(value) - convert a given data length code (dlc) of a
* Classical CAN frame into a valid data length of max. 8 bytes.