mirror of
https://github.com/golang/sys.git
synced 2026-02-09 04:06:04 +03:00
unix: add can netlink types and constants
Change-Id: Ie234f26c38a9ced6407f2970fa97b49d18119f06 Reviewed-on: https://go-review.googlesource.com/c/sys/+/387474 Reviewed-by: Matt Layher <mdlayher@gmail.com> Trust: Matt Layher <mdlayher@gmail.com> Run-TryBot: Matt Layher <mdlayher@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Trust: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
This commit is contained in:
committed by
Matt Layher
parent
f2425489ef
commit
96fed51e14
@@ -82,6 +82,7 @@ struct termios2 {
|
||||
#include <linux/blkpg.h>
|
||||
#include <linux/bpf.h>
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/netlink.h>
|
||||
#include <linux/can/raw.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/cgroupstats.h>
|
||||
@@ -426,6 +427,19 @@ struct tipc_service_name {
|
||||
// From the union.
|
||||
__u32 domain;
|
||||
};
|
||||
|
||||
// copied from /usr/include/linux/can/netlink.h modified with explicit unsigned chars.
|
||||
struct my_can_bittiming_const {
|
||||
uint8_t name[16];
|
||||
__u32 tseg1_min;
|
||||
__u32 tseg1_max;
|
||||
__u32 tseg2_min;
|
||||
__u32 tseg2_max;
|
||||
__u32 sjw_max;
|
||||
__u32 brp_min;
|
||||
__u32 brp_max;
|
||||
__u32 brp_inc;
|
||||
};
|
||||
*/
|
||||
import "C"
|
||||
|
||||
@@ -3982,3 +3996,50 @@ const (
|
||||
NL_POLICY_TYPE_ATTR_MASK = C.NL_POLICY_TYPE_ATTR_MASK
|
||||
NL_POLICY_TYPE_ATTR_MAX = C.NL_POLICY_TYPE_ATTR_MAX
|
||||
)
|
||||
|
||||
// CAN netlink types
|
||||
|
||||
type CANBitTiming C.struct_can_bittiming
|
||||
|
||||
type CANBitTimingConst C.struct_my_can_bittiming_const
|
||||
|
||||
type CANClock C.struct_can_clock
|
||||
|
||||
type CANBusErrorCounters C.struct_can_berr_counter
|
||||
|
||||
type CANCtrlMode C.struct_can_ctrlmode
|
||||
|
||||
type CANDeviceStats C.struct_can_device_stats
|
||||
|
||||
// Generated by:
|
||||
// perl -nlE '/^\s*(CAN_STATE\w+)/ && say "$1 = C.$1"' /usr/include/linux/can/netlink.h
|
||||
const (
|
||||
CAN_STATE_ERROR_ACTIVE = C.CAN_STATE_ERROR_ACTIVE
|
||||
CAN_STATE_ERROR_WARNING = C.CAN_STATE_ERROR_WARNING
|
||||
CAN_STATE_ERROR_PASSIVE = C.CAN_STATE_ERROR_PASSIVE
|
||||
CAN_STATE_BUS_OFF = C.CAN_STATE_BUS_OFF
|
||||
CAN_STATE_STOPPED = C.CAN_STATE_STOPPED
|
||||
CAN_STATE_SLEEPING = C.CAN_STATE_SLEEPING
|
||||
CAN_STATE_MAX = C.CAN_STATE_MAX
|
||||
)
|
||||
|
||||
// Generated by:
|
||||
// perl -nlE '/^\s*(IFLA_CAN\w+)/ && say "$1 = C.$1"' /usr/include/linux/can/netlink.h
|
||||
const (
|
||||
IFLA_CAN_UNSPEC = C.IFLA_CAN_UNSPEC
|
||||
IFLA_CAN_BITTIMING = C.IFLA_CAN_BITTIMING
|
||||
IFLA_CAN_BITTIMING_CONST = C.IFLA_CAN_BITTIMING_CONST
|
||||
IFLA_CAN_CLOCK = C.IFLA_CAN_CLOCK
|
||||
IFLA_CAN_STATE = C.IFLA_CAN_STATE
|
||||
IFLA_CAN_CTRLMODE = C.IFLA_CAN_CTRLMODE
|
||||
IFLA_CAN_RESTART_MS = C.IFLA_CAN_RESTART_MS
|
||||
IFLA_CAN_RESTART = C.IFLA_CAN_RESTART
|
||||
IFLA_CAN_BERR_COUNTER = C.IFLA_CAN_BERR_COUNTER
|
||||
IFLA_CAN_DATA_BITTIMING = C.IFLA_CAN_DATA_BITTIMING
|
||||
IFLA_CAN_DATA_BITTIMING_CONST = C.IFLA_CAN_DATA_BITTIMING_CONST
|
||||
IFLA_CAN_TERMINATION = C.IFLA_CAN_TERMINATION
|
||||
IFLA_CAN_TERMINATION_CONST = C.IFLA_CAN_TERMINATION_CONST
|
||||
IFLA_CAN_BITRATE_CONST = C.IFLA_CAN_BITRATE_CONST
|
||||
IFLA_CAN_DATA_BITRATE_CONST = C.IFLA_CAN_DATA_BITRATE_CONST
|
||||
IFLA_CAN_BITRATE_MAX = C.IFLA_CAN_BITRATE_MAX
|
||||
)
|
||||
|
||||
@@ -205,6 +205,7 @@ struct ltchars {
|
||||
#include <linux/bpf.h>
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/error.h>
|
||||
#include <linux/can/netlink.h>
|
||||
#include <linux/can/raw.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/cryptouser.h>
|
||||
|
||||
@@ -260,6 +260,17 @@ const (
|
||||
BUS_USB = 0x3
|
||||
BUS_VIRTUAL = 0x6
|
||||
CAN_BCM = 0x2
|
||||
CAN_CTRLMODE_3_SAMPLES = 0x4
|
||||
CAN_CTRLMODE_BERR_REPORTING = 0x10
|
||||
CAN_CTRLMODE_CC_LEN8_DLC = 0x100
|
||||
CAN_CTRLMODE_FD = 0x20
|
||||
CAN_CTRLMODE_FD_NON_ISO = 0x80
|
||||
CAN_CTRLMODE_LISTENONLY = 0x2
|
||||
CAN_CTRLMODE_LOOPBACK = 0x1
|
||||
CAN_CTRLMODE_ONE_SHOT = 0x8
|
||||
CAN_CTRLMODE_PRESUME_ACK = 0x40
|
||||
CAN_CTRLMODE_TDC_AUTO = 0x200
|
||||
CAN_CTRLMODE_TDC_MANUAL = 0x400
|
||||
CAN_EFF_FLAG = 0x80000000
|
||||
CAN_EFF_ID_BITS = 0x1d
|
||||
CAN_EFF_MASK = 0x1fffffff
|
||||
@@ -337,6 +348,7 @@ const (
|
||||
CAN_RTR_FLAG = 0x40000000
|
||||
CAN_SFF_ID_BITS = 0xb
|
||||
CAN_SFF_MASK = 0x7ff
|
||||
CAN_TERMINATION_DISABLED = 0x0
|
||||
CAN_TP16 = 0x3
|
||||
CAN_TP20 = 0x4
|
||||
CAP_AUDIT_CONTROL = 0x1e
|
||||
|
||||
@@ -4070,3 +4070,78 @@ const (
|
||||
NL_POLICY_TYPE_ATTR_MASK = 0xc
|
||||
NL_POLICY_TYPE_ATTR_MAX = 0xc
|
||||
)
|
||||
|
||||
type CANBitTiming struct {
|
||||
Bitrate uint32
|
||||
Sample_point uint32
|
||||
Tq uint32
|
||||
Prop_seg uint32
|
||||
Phase_seg1 uint32
|
||||
Phase_seg2 uint32
|
||||
Sjw uint32
|
||||
Brp uint32
|
||||
}
|
||||
|
||||
type CANBitTimingConst struct {
|
||||
Name [16]uint8
|
||||
Tseg1_min uint32
|
||||
Tseg1_max uint32
|
||||
Tseg2_min uint32
|
||||
Tseg2_max uint32
|
||||
Sjw_max uint32
|
||||
Brp_min uint32
|
||||
Brp_max uint32
|
||||
Brp_inc uint32
|
||||
}
|
||||
|
||||
type CANClock struct {
|
||||
Freq uint32
|
||||
}
|
||||
|
||||
type CANBusErrorCounters struct {
|
||||
Txerr uint16
|
||||
Rxerr uint16
|
||||
}
|
||||
|
||||
type CANCtrlMode struct {
|
||||
Mask uint32
|
||||
Flags uint32
|
||||
}
|
||||
|
||||
type CANDeviceStats struct {
|
||||
Bus_error uint32
|
||||
Error_warning uint32
|
||||
Error_passive uint32
|
||||
Bus_off uint32
|
||||
Arbitration_lost uint32
|
||||
Restarts uint32
|
||||
}
|
||||
|
||||
const (
|
||||
CAN_STATE_ERROR_ACTIVE = 0x0
|
||||
CAN_STATE_ERROR_WARNING = 0x1
|
||||
CAN_STATE_ERROR_PASSIVE = 0x2
|
||||
CAN_STATE_BUS_OFF = 0x3
|
||||
CAN_STATE_STOPPED = 0x4
|
||||
CAN_STATE_SLEEPING = 0x5
|
||||
CAN_STATE_MAX = 0x6
|
||||
)
|
||||
|
||||
const (
|
||||
IFLA_CAN_UNSPEC = 0x0
|
||||
IFLA_CAN_BITTIMING = 0x1
|
||||
IFLA_CAN_BITTIMING_CONST = 0x2
|
||||
IFLA_CAN_CLOCK = 0x3
|
||||
IFLA_CAN_STATE = 0x4
|
||||
IFLA_CAN_CTRLMODE = 0x5
|
||||
IFLA_CAN_RESTART_MS = 0x6
|
||||
IFLA_CAN_RESTART = 0x7
|
||||
IFLA_CAN_BERR_COUNTER = 0x8
|
||||
IFLA_CAN_DATA_BITTIMING = 0x9
|
||||
IFLA_CAN_DATA_BITTIMING_CONST = 0xa
|
||||
IFLA_CAN_TERMINATION = 0xb
|
||||
IFLA_CAN_TERMINATION_CONST = 0xc
|
||||
IFLA_CAN_BITRATE_CONST = 0xd
|
||||
IFLA_CAN_DATA_BITRATE_CONST = 0xe
|
||||
IFLA_CAN_BITRATE_MAX = 0xf
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user