linux/drivers/net/can/softing/softing.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * softing common interfaces
 *
 * by Kurt Van Dijck, 2008-2010
 */

#include <linux/atomic.h>
#include <linux/netdevice.h>
#include <linux/ktime.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/can.h>
#include <linux/can/dev.h>

#include "softing_platform.h"

struct softing;

struct softing_priv {};
#define netdev2softing(netdev)

struct softing {};

int softing_default_output(struct net_device *netdev);

ktime_t softing_raw2ktime(struct softing *card, u32 raw);

int softing_chip_poweron(struct softing *card);

int softing_bootloader_command(struct softing *card, int16_t cmd,
			       const char *msg);

/* Load firmware after reset */
int softing_load_fw(const char *file, struct softing *card,
		    __iomem uint8_t *virt, unsigned int size, int offset);

/* Load final application firmware after bootloader */
int softing_load_app_fw(const char *file, struct softing *card);

/*
 * enable or disable irq
 * only called with fw.lock locked
 */
int softing_enable_irq(struct softing *card, int enable);

/* start/stop 1 bus on card */
int softing_startstop(struct net_device *netdev, int up);

/* netif_rx() */
int softing_netdev_rx(struct net_device *netdev, const struct can_frame *msg,
		      ktime_t ktime);

/* SOFTING DPRAM mappings */
#define DPRAM_RX
	#define DPRAM_RX_SIZE
	#define DPRAM_RX_CNT
#define DPRAM_RX_RD
#define DPRAM_RX_WR
#define DPRAM_RX_LOST

#define DPRAM_FCT_PARAM
#define DPRAM_FCT_RESULT
#define DPRAM_FCT_HOST

#define DPRAM_INFO_BUSSTATE
#define DPRAM_INFO_BUSSTATE2
#define DPRAM_INFO_ERRSTATE
#define DPRAM_INFO_ERRSTATE2
#define DPRAM_RESET
#define DPRAM_CLR_RECV_FIFO
#define DPRAM_RESET_TIME
#define DPRAM_TIME
#define DPRAM_WR_START
#define DPRAM_WR_END
#define DPRAM_RESET_RX_FIFO
#define DPRAM_RESET_TX_FIFO
#define DPRAM_READ_FIFO_LEVEL
#define DPRAM_RX_FIFO_LEVEL
#define DPRAM_TX_FIFO_LEVEL

#define DPRAM_TX
	#define DPRAM_TX_SIZE
	#define DPRAM_TX_CNT
#define DPRAM_TX_RD
#define DPRAM_TX_WR

#define DPRAM_COMMAND
#define DPRAM_RECEIPT
#define DPRAM_IRQ_TOHOST
#define DPRAM_IRQ_TOCARD

#define DPRAM_V2_RESET
#define DPRAM_V2_IRQ_TOHOST

#define TXMAX

/* DPRAM return codes */
#define RES_NONE
#define RES_OK
#define RES_NOK
#define RES_UNKNOWN
/* DPRAM flags */
#define CMD_TX
#define CMD_ACK
#define CMD_XTD
#define CMD_RTR
#define CMD_ERR
#define CMD_BUS2

/* returned fifo entry bus state masks */
#define SF_MASK_BUSOFF
#define SF_MASK_EPASSIVE

/* bus states */
#define STATE_BUSOFF
#define STATE_EPASSIVE
#define STATE_EACTIVE