mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
can: error: add definitions for the different CAN error thresholds
Currently, drivers are using magic numbers to derive the CAN error states from the error counter. Add three macro declarations to remediate this. For reference, the error-active, error-passive and bus-off are defined in ISO 11898, section 12.1.4.2 "Error counting". Although ISO 11898 does not define error-warning state, this extra value is also commonly used and is thus also added. Link: https://lore.kernel.org/all/20220719143550.3681-13-mailhol.vincent@wanadoo.fr Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
3e5c291c79
commit
3f9c26210c
1 changed files with 13 additions and 0 deletions
|
@ -127,4 +127,17 @@
|
|||
/* TX error counter / data[6] */
|
||||
/* RX error counter / data[7] */
|
||||
|
||||
/* CAN state thresholds
|
||||
*
|
||||
* Error counter Error state
|
||||
* -----------------------------------
|
||||
* 0 - 95 Error-active
|
||||
* 96 - 127 Error-warning
|
||||
* 128 - 255 Error-passive
|
||||
* 256 and greater Bus-off
|
||||
*/
|
||||
#define CAN_ERROR_WARNING_THRESHOLD 96
|
||||
#define CAN_ERROR_PASSIVE_THRESHOLD 128
|
||||
#define CAN_BUS_OFF_THRESHOLD 256
|
||||
|
||||
#endif /* _UAPI_CAN_ERROR_H */
|
||||
|
|
Loading…
Reference in a new issue