MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / linux / com20020.h
blobc88d530bf637288fe67e6c99de6c460dbfc8a2ac
1 /*
2 * Linux ARCnet driver - COM20020 chipset support - function declarations
3 *
4 * Written 1997 by David Woodhouse.
5 * Written 1994-1999 by Avery Pennarun.
6 * Derived from skeleton.c by Donald Becker.
8 * Special thanks to Contemporary Controls, Inc. (www.ccontrols.com)
9 * for sponsoring the further development of this driver.
11 * **********************
13 * The original copyright of skeleton.c was as follows:
15 * skeleton.c Written 1993 by Donald Becker.
16 * Copyright 1993 United States Government as represented by the
17 * Director, National Security Agency. This software may only be used
18 * and distributed according to the terms of the GNU General Public License as
19 * modified by SRC, incorporated herein by reference.
21 * **********************
23 * For more details, see drivers/net/arcnet.c
25 * **********************
27 #ifndef __COM20020_H
28 #define __COM20020_H
30 int com20020_check(struct net_device *dev);
31 int com20020_found(struct net_device *dev, int shared);
33 /* The number of low I/O ports used by the card. */
34 #define ARCNET_TOTAL_SIZE 8
36 /* various register addresses */
37 #define _INTMASK (ioaddr+0) /* writable */
38 #define _STATUS (ioaddr+0) /* readable */
39 #define _COMMAND (ioaddr+1) /* standard arcnet commands */
40 #define _DIAGSTAT (ioaddr+1) /* diagnostic status register */
41 #define _ADDR_HI (ioaddr+2) /* control registers for IO-mapped memory */
42 #define _ADDR_LO (ioaddr+3)
43 #define _MEMDATA (ioaddr+4) /* data port for IO-mapped memory */
44 #define _SUBADR (ioaddr+5) /* the extended port _XREG refers to */
45 #define _CONFIG (ioaddr+6) /* configuration register */
46 #define _XREG (ioaddr+7) /* extra registers (indexed by _CONFIG
47 or _SUBADR) */
49 /* in the ADDR_HI register */
50 #define RDDATAflag 0x80 /* next access is a read (not a write) */
52 /* in the DIAGSTAT register */
53 #define NEWNXTIDflag 0x02 /* ID to which token is passed has changed */
55 /* in the CONFIG register */
56 #define RESETcfg 0x80 /* put card in reset state */
57 #define TXENcfg 0x20 /* enable TX */
59 /* in SETUP register */
60 #define PROMISCset 0x10 /* enable RCV_ALL */
61 #define P1MODE 0x80 /* enable P1-MODE for Backplane */
62 #define SLOWARB 0x01 /* enable Slow Arbitration for >=5Mbps */
64 /* COM2002x */
65 #define SUB_TENTATIVE 0 /* tentative node ID */
66 #define SUB_NODE 1 /* node ID */
67 #define SUB_SETUP1 2 /* various options */
68 #define SUB_TEST 3 /* test/diag register */
70 /* COM20022 only */
71 #define SUB_SETUP2 4 /* sundry options */
72 #define SUB_BUSCTL 5 /* bus control options */
73 #define SUB_DMACOUNT 6 /* DMA count options */
75 #define SET_SUBADR(x) do { \
76 if ((x) < 4) \
77 { \
78 lp->config = (lp->config & ~0x03) | (x); \
79 SETCONF; \
80 } \
81 else \
82 { \
83 outb(x, _SUBADR); \
84 } \
85 } while (0)
87 #undef ARCRESET
88 #undef ASTATUS
89 #undef ACOMMAND
90 #undef AINTMASK
92 #define ARCRESET { outb(lp->config | 0x80, _CONFIG); \
93 udelay(5); \
94 outb(lp->config , _CONFIG); \
96 #define ARCRESET0 { outb(0x18 | 0x80, _CONFIG); \
97 udelay(5); \
98 outb(0x18 , _CONFIG); \
101 #define ASTATUS() inb(_STATUS)
102 #define ACOMMAND(cmd) outb((cmd),_COMMAND)
103 #define AINTMASK(msk) outb((msk),_INTMASK)
105 #define SETCONF outb(lp->config, _CONFIG)
107 #endif /* __COM20020_H */