~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/can/bittiming.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/can/bittiming.h (Version linux-6.11.5) and /include/linux/can/bittiming.h (Version linux-6.1.114)


  1 /* SPDX-License-Identifier: GPL-2.0-only */         1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /* Copyright (c) 2020 Pengutronix, Marc Kleine      2 /* Copyright (c) 2020 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de>
  3  * Copyright (c) 2021 Vincent Mailhol <mailhol      3  * Copyright (c) 2021 Vincent Mailhol <mailhol.vincent@wanadoo.fr>
  4  */                                                 4  */
  5                                                     5 
  6 #ifndef _CAN_BITTIMING_H                            6 #ifndef _CAN_BITTIMING_H
  7 #define _CAN_BITTIMING_H                            7 #define _CAN_BITTIMING_H
  8                                                     8 
  9 #include <linux/netdevice.h>                        9 #include <linux/netdevice.h>
 10 #include <linux/can/netlink.h>                     10 #include <linux/can/netlink.h>
 11                                                    11 
 12 #define CAN_SYNC_SEG 1                             12 #define CAN_SYNC_SEG 1
 13                                                    13 
 14 #define CAN_BITRATE_UNSET 0                        14 #define CAN_BITRATE_UNSET 0
 15 #define CAN_BITRATE_UNKNOWN (-1U)                  15 #define CAN_BITRATE_UNKNOWN (-1U)
 16                                                    16 
 17 #define CAN_CTRLMODE_TDC_MASK                      17 #define CAN_CTRLMODE_TDC_MASK                                   \
 18         (CAN_CTRLMODE_TDC_AUTO | CAN_CTRLMODE_     18         (CAN_CTRLMODE_TDC_AUTO | CAN_CTRLMODE_TDC_MANUAL)
 19                                                    19 
 20 /*                                                 20 /*
 21  * struct can_tdc - CAN FD Transmission Delay      21  * struct can_tdc - CAN FD Transmission Delay Compensation parameters
 22  *                                                 22  *
 23  * At high bit rates, the propagation delay fr     23  * At high bit rates, the propagation delay from the TX pin to the RX
 24  * pin of the transceiver causes measurement e     24  * pin of the transceiver causes measurement errors: the sample point
 25  * on the RX pin might occur on the previous b     25  * on the RX pin might occur on the previous bit.
 26  *                                                 26  *
 27  * To solve this issue, ISO 11898-1 introduces     27  * To solve this issue, ISO 11898-1 introduces in section 11.3.3
 28  * "Transmitter delay compensation" a SSP (Sec     28  * "Transmitter delay compensation" a SSP (Secondary Sample Point)
 29  * equal to the distance from the start of the     29  * equal to the distance from the start of the bit time on the TX pin
 30  * to the actual measurement on the RX pin.        30  * to the actual measurement on the RX pin.
 31  *                                                 31  *
 32  * This structure contains the parameters to c     32  * This structure contains the parameters to calculate that SSP.
 33  *                                                 33  *
 34  * -+----------- one bit ----------+-- TX pin      34  * -+----------- one bit ----------+-- TX pin
 35  *  |<--- Sample Point --->|                       35  *  |<--- Sample Point --->|
 36  *                                                 36  *
 37  *                         --+----------- one      37  *                         --+----------- one bit ----------+-- RX pin
 38  *  |<-------- TDCV -------->|                     38  *  |<-------- TDCV -------->|
 39  *                           |<------- TDCO --     39  *                           |<------- TDCO ------->|
 40  *  |<----------- Secondary Sample Point -----     40  *  |<----------- Secondary Sample Point ---------->|
 41  *                                                 41  *
 42  * To increase precision, contrary to the othe     42  * To increase precision, contrary to the other bittiming parameters
 43  * which are measured in time quanta, the TDC      43  * which are measured in time quanta, the TDC parameters are measured
 44  * in clock periods (also referred as "minimum     44  * in clock periods (also referred as "minimum time quantum" in ISO
 45  * 11898-1).                                       45  * 11898-1).
 46  *                                                 46  *
 47  * @tdcv: Transmitter Delay Compensation Value     47  * @tdcv: Transmitter Delay Compensation Value. The time needed for
 48  *      the signal to propagate, i.e. the dist     48  *      the signal to propagate, i.e. the distance, in clock periods,
 49  *      from the start of the bit on the TX pi     49  *      from the start of the bit on the TX pin to when it is received
 50  *      on the RX pin. @tdcv depends on the co     50  *      on the RX pin. @tdcv depends on the controller modes:
 51  *                                                 51  *
 52  *        CAN_CTRLMODE_TDC_AUTO is set: The tr     52  *        CAN_CTRLMODE_TDC_AUTO is set: The transceiver dynamically
 53  *        measures @tdcv for each transmitted      53  *        measures @tdcv for each transmitted CAN FD frame and the
 54  *        value provided here should be ignore     54  *        value provided here should be ignored.
 55  *                                                 55  *
 56  *        CAN_CTRLMODE_TDC_MANUAL is set: use      56  *        CAN_CTRLMODE_TDC_MANUAL is set: use the fixed provided @tdcv
 57  *        value.                                   57  *        value.
 58  *                                                 58  *
 59  *      N.B. CAN_CTRLMODE_TDC_AUTO and CAN_CTR     59  *      N.B. CAN_CTRLMODE_TDC_AUTO and CAN_CTRLMODE_TDC_MANUAL are
 60  *      mutually exclusive. Only one can be se     60  *      mutually exclusive. Only one can be set at a time. If both
 61  *      CAN_TDC_CTRLMODE_AUTO and CAN_TDC_CTRL     61  *      CAN_TDC_CTRLMODE_AUTO and CAN_TDC_CTRLMODE_MANUAL are unset,
 62  *      TDC is disabled and all the values of      62  *      TDC is disabled and all the values of this structure should be
 63  *      ignored.                                   63  *      ignored.
 64  *                                                 64  *
 65  * @tdco: Transmitter Delay Compensation Offse     65  * @tdco: Transmitter Delay Compensation Offset. Offset value, in
 66  *      clock periods, defining the distance b     66  *      clock periods, defining the distance between the start of the
 67  *      bit reception on the RX pin of the tra     67  *      bit reception on the RX pin of the transceiver and the SSP
 68  *      position such that SSP = @tdcv + @tdco     68  *      position such that SSP = @tdcv + @tdco.
 69  *                                                 69  *
 70  * @tdcf: Transmitter Delay Compensation Filte     70  * @tdcf: Transmitter Delay Compensation Filter window. Defines the
 71  *      minimum value for the SSP position in      71  *      minimum value for the SSP position in clock periods. If the
 72  *      SSP position is less than @tdcf, then      72  *      SSP position is less than @tdcf, then no delay compensations
 73  *      occur and the normal sampling point is     73  *      occur and the normal sampling point is used instead. The
 74  *      feature is enabled if and only if @tdc     74  *      feature is enabled if and only if @tdcv is set to zero
 75  *      (automatic mode) and @tdcf is configur     75  *      (automatic mode) and @tdcf is configured to a value greater
 76  *      than @tdco.                                76  *      than @tdco.
 77  */                                                77  */
 78 struct can_tdc {                                   78 struct can_tdc {
 79         u32 tdcv;                                  79         u32 tdcv;
 80         u32 tdco;                                  80         u32 tdco;
 81         u32 tdcf;                                  81         u32 tdcf;
 82 };                                                 82 };
 83                                                    83 
 84 /*                                                 84 /*
 85  * struct can_tdc_const - CAN hardware-depende     85  * struct can_tdc_const - CAN hardware-dependent constant for
 86  *      Transmission Delay Compensation            86  *      Transmission Delay Compensation
 87  *                                                 87  *
 88  * @tdcv_min: Transmitter Delay Compensation V     88  * @tdcv_min: Transmitter Delay Compensation Value minimum value. If
 89  *      the controller does not support manual     89  *      the controller does not support manual mode for tdcv
 90  *      (c.f. flag CAN_CTRLMODE_TDC_MANUAL) th     90  *      (c.f. flag CAN_CTRLMODE_TDC_MANUAL) then this value is
 91  *      ignored.                                   91  *      ignored.
 92  * @tdcv_max: Transmitter Delay Compensation V     92  * @tdcv_max: Transmitter Delay Compensation Value maximum value. If
 93  *      the controller does not support manual     93  *      the controller does not support manual mode for tdcv
 94  *      (c.f. flag CAN_CTRLMODE_TDC_MANUAL) th     94  *      (c.f. flag CAN_CTRLMODE_TDC_MANUAL) then this value is
 95  *      ignored.                                   95  *      ignored.
 96  *                                                 96  *
 97  * @tdco_min: Transmitter Delay Compensation O     97  * @tdco_min: Transmitter Delay Compensation Offset minimum value.
 98  * @tdco_max: Transmitter Delay Compensation O     98  * @tdco_max: Transmitter Delay Compensation Offset maximum value.
 99  *      Should not be zero. If the controller      99  *      Should not be zero. If the controller does not support TDC,
100  *      then the pointer to this structure sho    100  *      then the pointer to this structure should be NULL.
101  *                                                101  *
102  * @tdcf_min: Transmitter Delay Compensation F    102  * @tdcf_min: Transmitter Delay Compensation Filter window minimum
103  *      value. If @tdcf_max is zero, this valu    103  *      value. If @tdcf_max is zero, this value is ignored.
104  * @tdcf_max: Transmitter Delay Compensation F    104  * @tdcf_max: Transmitter Delay Compensation Filter window maximum
105  *      value. Should be set to zero if the co    105  *      value. Should be set to zero if the controller does not
106  *      support this feature.                     106  *      support this feature.
107  */                                               107  */
108 struct can_tdc_const {                            108 struct can_tdc_const {
109         u32 tdcv_min;                             109         u32 tdcv_min;
110         u32 tdcv_max;                             110         u32 tdcv_max;
111         u32 tdco_min;                             111         u32 tdco_min;
112         u32 tdco_max;                             112         u32 tdco_max;
113         u32 tdcf_min;                             113         u32 tdcf_min;
114         u32 tdcf_max;                             114         u32 tdcf_max;
115 };                                                115 };
116                                                   116 
117 #ifdef CONFIG_CAN_CALC_BITTIMING                  117 #ifdef CONFIG_CAN_CALC_BITTIMING
118 int can_calc_bittiming(const struct net_device    118 int can_calc_bittiming(const struct net_device *dev, struct can_bittiming *bt,
119                        const struct can_bittim !! 119                        const struct can_bittiming_const *btc);
120                                                   120 
121 void can_calc_tdco(struct can_tdc *tdc, const     121 void can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const,
122                    const struct can_bittiming     122                    const struct can_bittiming *dbt,
123                    u32 *ctrlmode, u32 ctrlmode    123                    u32 *ctrlmode, u32 ctrlmode_supported);
124 #else /* !CONFIG_CAN_CALC_BITTIMING */            124 #else /* !CONFIG_CAN_CALC_BITTIMING */
125 static inline int                                 125 static inline int
126 can_calc_bittiming(const struct net_device *de    126 can_calc_bittiming(const struct net_device *dev, struct can_bittiming *bt,
127                    const struct can_bittiming_ !! 127                    const struct can_bittiming_const *btc)
128 {                                                 128 {
129         netdev_err(dev, "bit-timing calculatio    129         netdev_err(dev, "bit-timing calculation not available\n");
130         return -EINVAL;                           130         return -EINVAL;
131 }                                                 131 }
132                                                   132 
133 static inline void                                133 static inline void
134 can_calc_tdco(struct can_tdc *tdc, const struc    134 can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const,
135               const struct can_bittiming *dbt,    135               const struct can_bittiming *dbt,
136               u32 *ctrlmode, u32 ctrlmode_supp    136               u32 *ctrlmode, u32 ctrlmode_supported)
137 {                                                 137 {
138 }                                                 138 }
139 #endif /* CONFIG_CAN_CALC_BITTIMING */            139 #endif /* CONFIG_CAN_CALC_BITTIMING */
140                                                   140 
141 void can_sjw_set_default(struct can_bittiming  << 
142                                                << 
143 int can_sjw_check(const struct net_device *dev << 
144                   const struct can_bittiming_c << 
145                                                << 
146 int can_get_bittiming(const struct net_device     141 int can_get_bittiming(const struct net_device *dev, struct can_bittiming *bt,
147                       const struct can_bittimi    142                       const struct can_bittiming_const *btc,
148                       const u32 *bitrate_const    143                       const u32 *bitrate_const,
149                       const unsigned int bitra !! 144                       const unsigned int bitrate_const_cnt);
150                       struct netlink_ext_ack * << 
151                                                   145 
152 /*                                                146 /*
153  * can_bit_time() - Duration of one bit           147  * can_bit_time() - Duration of one bit
154  *                                                148  *
155  * Please refer to ISO 11898-1:2015, section 1    149  * Please refer to ISO 11898-1:2015, section 11.3.1.1 "Bit time" for
156  * additional information.                        150  * additional information.
157  *                                                151  *
158  * Return: the number of time quanta in one bi    152  * Return: the number of time quanta in one bit.
159  */                                               153  */
160 static inline unsigned int can_bit_time(const     154 static inline unsigned int can_bit_time(const struct can_bittiming *bt)
161 {                                                 155 {
162         return CAN_SYNC_SEG + bt->prop_seg + b    156         return CAN_SYNC_SEG + bt->prop_seg + bt->phase_seg1 + bt->phase_seg2;
163 }                                                 157 }
164                                                   158 
165 #endif /* !_CAN_BITTIMING_H */                    159 #endif /* !_CAN_BITTIMING_H */
166                                                   160 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php