linux/drivers/net/arcnet/arcdevice.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * INET         An implementation of the TCP/IP protocol suite for the LINUX
 *              operating system.  NET  is implemented using the  BSD Socket
 *              interface as the means of communication with the user level.
 *
 *              Definitions used by the ARCnet driver.
 *
 * Authors:     Avery Pennarun and David Woodhouse
 */
#ifndef _LINUX_ARCDEVICE_H
#define _LINUX_ARCDEVICE_H

#include <asm/timex.h>
#include <linux/if_arcnet.h>

#ifdef __KERNEL__
#include <linux/interrupt.h>
#include <linux/workqueue.h>

/*
 * RECON_THRESHOLD is the maximum number of RECON messages to receive
 * within one minute before printing a "cabling problem" warning. The
 * default value should be fine.
 *
 * After that, a "cabling restored" message will be printed on the next IRQ
 * if no RECON messages have been received for 10 seconds.
 *
 * Do not define RECON_THRESHOLD at all if you want to disable this feature.
 */
#define RECON_THRESHOLD

/*
 * Define this to the minimum "timeout" value.  If a transmit takes longer
 * than TX_TIMEOUT jiffies, Linux will abort the TX and retry.  On a large
 * network, or one with heavy network traffic, this timeout may need to be
 * increased.  The larger it is, though, the longer it will be between
 * necessary transmits - don't set this too high.
 */
#define TX_TIMEOUT

/* Display warnings about the driver being an ALPHA version. */
#undef ALPHA_WARNING

/*
 * Debugging bitflags: each option can be enabled individually.
 *
 * Note: only debug flags included in the ARCNET_DEBUG_MAX define will
 *   actually be available.  GCC will (at least, GCC 2.7.0 will) notice
 *   lines using a BUGLVL not in ARCNET_DEBUG_MAX and automatically optimize
 *   them out.
 */
#define D_NORMAL
#define D_EXTRA
#define D_INIT
#define D_INIT_REASONS
#define D_RECON
#define D_PROTO
/* debug levels below give LOTS of output during normal operation! */
#define D_DURING
#define D_TX
#define D_RX
#define D_SKB
#define D_SKB_SIZE
#define D_TIMING
#define D_DEBUG

#ifndef ARCNET_DEBUG_MAX
#define ARCNET_DEBUG_MAX
#endif

#ifndef ARCNET_DEBUG
#define ARCNET_DEBUG
#endif
extern int arcnet_debug;

#define BUGLVL(x)

/* macros to simplify debug checking */
#define arc_printk(x, dev, fmt, ...)

#define arc_cont(x, fmt, ...)

/* see how long a function call takes to run, expressed in CPU cycles */
#define TIME(dev, name, bytes, call)

/*
 * Time needed to reset the card - in ms (milliseconds).  This works on my
 * SMC PC100.  I can't find a reference that tells me just how long I
 * should wait.
 */
#define RESETtime

/*
 * These are the max/min lengths of packet payload, not including the
 * arc_hardware header, but definitely including the soft header.
 *
 * Note: packet sizes 254, 255, 256 are impossible because of the way
 * ARCnet registers work  That's why RFC1201 defines "exception" packets.
 * In non-RFC1201 protocols, we have to just tack some extra bytes on the
 * end.
 */
#define MTU
#define MinTU
#define XMTU

/* status/interrupt mask bit fields */
#define TXFREEflag
#define TXACKflag
#define RECONflag
#define TESTflag
#define EXCNAKflag
#define RESETflag
#define RES1flag
#define RES2flag
#define NORXflag

/* Flags used for IO-mapped memory operations */
#define AUTOINCflag
#define IOMAPflag
#define ENABLE16flag

/* in the command register, the following bits have these meanings:
 *                0-2     command
 *                3-4     page number (for enable rcv/xmt command)
 *                 7      receive broadcasts
 */
#define NOTXcmd
#define NORXcmd
#define TXcmd
#define RXcmd
#define CONFIGcmd
#define CFLAGScmd
#define TESTcmd
#define STARTIOcmd

/* flags for "clear flags" command */
#define RESETclear
#define CONFIGclear

#define EXCNAKclear

/* flags for "load test flags" command */
#define TESTload

/* byte deposited into first address of buffers on reset */
#define TESTvalue

/* for "enable receiver" command */
#define RXbcasts

/* flags for "define configuration" command */
#define NORMALconf
#define EXTconf

/* card feature flags, set during auto-detection.
 * (currently only used by com20020pci)
 */
#define ARC_IS_5MBIT
#define ARC_CAN_10MBIT
#define ARC_HAS_LED
#define ARC_HAS_ROTARY

/* information needed to define an encapsulation driver */
struct ArcProto {};

extern struct ArcProto *arc_proto_map[256], *arc_proto_default,
	*arc_bcast_proto, *arc_raw_proto;

/*
 * "Incoming" is information needed for each address that could be sending
 * to us.  Mostly for partially-received split packets.
 */
struct Incoming {};

/* only needed for RFC1201 */
struct Outgoing {};

#define ARCNET_LED_NAME_SZ

struct arcnet_local {};

enum arcnet_led_event {};

void arcnet_led_event(struct net_device *netdev, enum arcnet_led_event event);
void devm_arcnet_led_init(struct net_device *netdev, int index, int subid);

#if ARCNET_DEBUG_MAX & D_SKB
void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
#else
static inline
void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc)
{}
#endif

void arcnet_unregister_proto(struct ArcProto *proto);
irqreturn_t arcnet_interrupt(int irq, void *dev_id);

struct net_device *alloc_arcdev(const char *name);
void free_arcdev(struct net_device *dev);

int arcnet_open(struct net_device *dev);
int arcnet_close(struct net_device *dev);
netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
			       struct net_device *dev);
void arcnet_timeout(struct net_device *dev, unsigned int txqueue);

static inline void arcnet_set_addr(struct net_device *dev, u8 addr)
{}

/* I/O equivalents */

#ifdef CONFIG_SA1100_CT6001
#define BUS_ALIGN
#else
#define BUS_ALIGN
#endif

/* addr and offset allow register like names to define the actual IO  address.
 * A configuration option multiplies the offset for alignment.
 */
#define arcnet_inb(addr, offset)
#define arcnet_outb(value, addr, offset)

#define arcnet_insb(addr, offset, buffer, count)
#define arcnet_outsb(addr, offset, buffer, count)

#define arcnet_readb(addr, offset)
#define arcnet_writeb(value, addr, offset)

#endif				/* __KERNEL__ */
#endif				/* _LINUX_ARCDEVICE_H */