summaryrefslogtreecommitdiff
path: root/src/unix/linux_like
diff options
context:
space:
mode:
Diffstat (limited to 'src/unix/linux_like')
-rw-r--r--src/unix/linux_like/linux/align.rs11
-rw-r--r--src/unix/linux_like/linux/mod.rs18
2 files changed, 29 insertions, 0 deletions
diff --git a/src/unix/linux_like/linux/align.rs b/src/unix/linux_like/linux/align.rs
index cd4bbc7213..97f811dac1 100644
--- a/src/unix/linux_like/linux/align.rs
+++ b/src/unix/linux_like/linux/align.rs
@@ -176,6 +176,17 @@ macro_rules! expand_align {
__res1: u8,
pub data: [u8; CANFD_MAX_DLEN],
}
+
+ #[repr(align(8))]
+ #[allow(missing_debug_implementations)]
+ pub struct canxl_frame {
+ pub prio: canid_t,
+ pub flags: u8,
+ pub sdt: u8,
+ pub len: u16,
+ pub af: u32,
+ pub data: [u8; CANXL_MAX_DLEN],
+ }
}
};
}
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs
index 45a383b405..4b58361a26 100644
--- a/src/unix/linux_like/linux/mod.rs
+++ b/src/unix/linux_like/linux/mod.rs
@@ -3723,9 +3723,11 @@ pub const CAN_ERR_FLAG: canid_t = 0x20000000;
pub const CAN_SFF_MASK: canid_t = 0x000007FF;
pub const CAN_EFF_MASK: canid_t = 0x1FFFFFFF;
pub const CAN_ERR_MASK: canid_t = 0x1FFFFFFF;
+pub const CANXL_PRIO_MASK: ::canid_t = CAN_SFF_MASK;
pub const CAN_SFF_ID_BITS: ::c_int = 11;
pub const CAN_EFF_ID_BITS: ::c_int = 29;
+pub const CANXL_PRIO_BITS: ::c_int = CAN_SFF_ID_BITS;
pub const CAN_MAX_DLC: ::c_int = 8;
pub const CAN_MAX_DLEN: usize = 8;
@@ -3735,10 +3737,26 @@ pub const CANFD_MAX_DLEN: usize = 64;
pub const CANFD_BRS: ::c_int = 0x01;
pub const CANFD_ESI: ::c_int = 0x02;
+pub const CANXL_MIN_DLC: ::c_int = 0;
+pub const CANXL_MAX_DLC: ::c_int = 2047;
+pub const CANXL_MAX_DLC_MASK: ::c_int = 0x07FF;
+pub const CANXL_MIN_DLEN: usize = 1;
+pub const CANXL_MAX_DLEN: usize = 2048;
+
+pub const CANXL_XLF: ::c_int = 0x80;
+pub const CANXL_SEC: ::c_int = 0x01;
+
cfg_if! {
if #[cfg(libc_align)] {
pub const CAN_MTU: usize = ::mem::size_of::<can_frame>();
pub const CANFD_MTU: usize = ::mem::size_of::<canfd_frame>();
+ pub const CANXL_MTU: usize = ::mem::size_of::<canxl_frame>();
+ // FIXME: use `core::mem::offset_of!` once that is available
+ // https://github.com/rust-lang/rfcs/pull/3308
+ // pub const CANXL_HDR_SIZE: usize = core::mem::offset_of!(canxl_frame, data);
+ pub const CANXL_HDR_SIZE: usize = 12;
+ pub const CANXL_MIN_MTU: usize = CANXL_HDR_SIZE + 64;
+ pub const CANXL_MAX_MTU: usize = CANXL_MTU;
}
}