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

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

 



On 11/6/20 6:01 PM, Gerhard Uttenthaler wrote:
> 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 {

unrelated, please make that a separate patch.

>  	__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

BIT()

> +
>  /* 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;
> 

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: OpenPGP digital signature


[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