[PATCH 03/17] can: ems_usb: Added CAN FD message representation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Gerhard Uttenthaler <uttenthaler@xxxxxxxxxxxxxxxx>
---
 drivers/net/can/usb/ems_usb.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 50736e031eb2..fa96217c7d72 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -114,12 +114,33 @@ MODULE_LICENSE("GPL v2");
  * CPC_MSG_TYPE_CAN_FRAME or CPC_MSG_TYPE_RTR_FRAME or
  * CPC_MSG_TYPE_EXT_CAN_FRAME or CPC_MSG_TYPE_EXT_RTR_FRAME.
  */
-struct cpc_can_msg {
+struct __packed cpc_can_msg {
 	__le32 id;
 	u8 length;
 	u8 msg[8];
 };
 
+/* CAN FD message representation in a CPC_MSG.
+ * Message object type is CPC_MSG_T_CANFD.
+ */
+struct __packed cpc_canfd_msg {
+	__le32 id;
+	u8  length;
+	u8  flags;
+	u8  msg[64];
+};
+
+/* This defines are used with the flags variable
+ * within the struct cpc_canfd_msg. A cpc_canfd_msg
+ * can also be used to send a classic CAN frame including
+ * RTR frames when CPC_FDFLAG_NONCANFD_MSG is set.
+ */
+#define CPC_FDFLAG_ESI          0x08
+#define CPC_FDFLAG_RTR          0x10
+#define CPC_FDFLAG_NONCANFD_MSG 0x20
+#define CPC_FDFLAG_BRS          0x40
+#define CPC_FDFLAG_XTD          0x80
+
 /* Representation of the CAN parameters for the SJA1000 controller */
 struct cpc_sja1000_params {
 	u8 mode;
@@ -194,8 +215,9 @@ struct __packed ems_cpc_msg {
 	__le32 ts_nsec;	/* timestamp in nano seconds */
 
 	union {
-		u8 generic[64];
+		u8 generic[70];
 		struct cpc_can_msg can_msg;
+		struct cpc_canfd_msg canfd_msg;
 		struct cpc_can_params can_params;
 		struct cpc_confirm confirmation;
 		struct cpc_overrun overrun;
-- 
2.26.2

-- 
EMS Dr. Thomas Wuensche e.K.
Sonnenhang 3
85304 Ilmmuenster
HR Ingolstadt, HRA 170106

Phone: +49-8441-490260
Fax  : +49-8441-81860
http://www.ems-wuensche.com



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux