linux/include/linux/can/dev/peak_canfd.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * CAN driver for PEAK System micro-CAN based adapters
 *
 * Copyright (C) 2003-2011 PEAK System-Technik GmbH
 * Copyright (C) 2011-2013 Stephane Grosjean <[email protected]>
 */
#ifndef PUCAN_H
#define PUCAN_H

/* uCAN commands opcodes list (low-order 10 bits) */
#define PUCAN_CMD_NOP
#define PUCAN_CMD_RESET_MODE
#define PUCAN_CMD_NORMAL_MODE
#define PUCAN_CMD_LISTEN_ONLY_MODE
#define PUCAN_CMD_TIMING_SLOW
#define PUCAN_CMD_TIMING_FAST
#define PUCAN_CMD_SET_STD_FILTER
#define PUCAN_CMD_RESERVED2
#define PUCAN_CMD_FILTER_STD
#define PUCAN_CMD_TX_ABORT
#define PUCAN_CMD_WR_ERR_CNT
#define PUCAN_CMD_SET_EN_OPTION
#define PUCAN_CMD_CLR_DIS_OPTION
#define PUCAN_CMD_RX_BARRIER
#define PUCAN_CMD_END_OF_COLLECTION

/* uCAN received messages list */
#define PUCAN_MSG_CAN_RX
#define PUCAN_MSG_ERROR
#define PUCAN_MSG_STATUS
#define PUCAN_MSG_BUSLOAD

#define PUCAN_MSG_CACHE_CRITICAL

/* uCAN transmitted messages */
#define PUCAN_MSG_CAN_TX

/* uCAN command common header */
struct __packed pucan_command {};

/* return the opcode from the opcode_channel field of a command */
static inline u16 pucan_cmd_get_opcode(struct pucan_command *c)
{}

#define PUCAN_TSLOW_BRP_BITS
#define PUCAN_TSLOW_TSGEG1_BITS
#define PUCAN_TSLOW_TSGEG2_BITS
#define PUCAN_TSLOW_SJW_BITS

#define PUCAN_TSLOW_BRP_MASK
#define PUCAN_TSLOW_TSEG1_MASK
#define PUCAN_TSLOW_TSEG2_MASK
#define PUCAN_TSLOW_SJW_MASK

/* uCAN TIMING_SLOW command fields */
#define PUCAN_TSLOW_SJW_T(s, t)
#define PUCAN_TSLOW_TSEG2(t)
#define PUCAN_TSLOW_TSEG1(t)
#define PUCAN_TSLOW_BRP(b)

struct __packed pucan_timing_slow {};

#define PUCAN_TFAST_BRP_BITS
#define PUCAN_TFAST_TSGEG1_BITS
#define PUCAN_TFAST_TSGEG2_BITS
#define PUCAN_TFAST_SJW_BITS

#define PUCAN_TFAST_BRP_MASK
#define PUCAN_TFAST_TSEG1_MASK
#define PUCAN_TFAST_TSEG2_MASK
#define PUCAN_TFAST_SJW_MASK

/* uCAN TIMING_FAST command fields */
#define PUCAN_TFAST_SJW(s)
#define PUCAN_TFAST_TSEG2(t)
#define PUCAN_TFAST_TSEG1(t)
#define PUCAN_TFAST_BRP(b)

struct __packed pucan_timing_fast {};

/* uCAN FILTER_STD command fields */
#define PUCAN_FLTSTD_ROW_IDX_BITS

struct __packed pucan_filter_std {};

#define PUCAN_FLTSTD_ROW_IDX_MAX

/* uCAN SET_STD_FILTER command fields */
struct __packed pucan_std_filter {};

/* uCAN TX_ABORT commands fields */
#define PUCAN_TX_ABORT_FLUSH

struct __packed pucan_tx_abort {};

/* uCAN WR_ERR_CNT command fields */
#define PUCAN_WRERRCNT_TE
#define PUCAN_WRERRCNT_RE

struct __packed pucan_wr_err_cnt {};

/* uCAN SET_EN/CLR_DIS _OPTION command fields */
#define PUCAN_OPTION_ERROR
#define PUCAN_OPTION_BUSLOAD
#define PUCAN_OPTION_CANDFDISO

struct __packed pucan_options {};

/* uCAN received messages global format */
struct __packed pucan_msg {};

/* uCAN flags for CAN/CANFD messages */
#define PUCAN_MSG_SELF_RECEIVE
#define PUCAN_MSG_ERROR_STATE_IND
#define PUCAN_MSG_BITRATE_SWITCH
#define PUCAN_MSG_EXT_DATA_LEN
#define PUCAN_MSG_SINGLE_SHOT
#define PUCAN_MSG_LOOPED_BACK
#define PUCAN_MSG_EXT_ID
#define PUCAN_MSG_RTR

struct __packed pucan_rx_msg {};

/* uCAN error types */
#define PUCAN_ERMSG_BIT_ERROR
#define PUCAN_ERMSG_FORM_ERROR
#define PUCAN_ERMSG_STUFF_ERROR
#define PUCAN_ERMSG_OTHER_ERROR
#define PUCAN_ERMSG_ERR_CNT_DEC

struct __packed pucan_error_msg {};

static inline int pucan_error_get_channel(const struct pucan_error_msg *msg)
{}

#define PUCAN_RX_BARRIER
#define PUCAN_BUS_PASSIVE
#define PUCAN_BUS_WARNING
#define PUCAN_BUS_BUSOFF

struct __packed pucan_status_msg {};

static inline int pucan_status_get_channel(const struct pucan_status_msg *msg)
{}

static inline int pucan_status_is_rx_barrier(const struct pucan_status_msg *msg)
{}

static inline int pucan_status_is_passive(const struct pucan_status_msg *msg)
{}

static inline int pucan_status_is_warning(const struct pucan_status_msg *msg)
{}

static inline int pucan_status_is_busoff(const struct pucan_status_msg *msg)
{}

/* uCAN transmitted message format */
#define PUCAN_MSG_CHANNEL_DLC(c, d)

struct __packed pucan_tx_msg {};

/* build the cmd opcode_channel field with respect to the correct endianness */
static inline __le16 pucan_cmd_opcode_channel(int index, int opcode)
{}

/* return the channel number part from any received message channel_dlc field */
static inline int pucan_msg_get_channel(const struct pucan_rx_msg *msg)
{}

/* return the dlc value from any received message channel_dlc field */
static inline u8 pucan_msg_get_dlc(const struct pucan_rx_msg *msg)
{}

static inline int pucan_ermsg_get_channel(const struct pucan_error_msg *msg)
{}

static inline int pucan_stmsg_get_channel(const struct pucan_status_msg *msg)
{}

#endif