aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan/sbni.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/net/wan/sbni.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/net/wan/sbni.h')
-rw-r--r--drivers/net/wan/sbni.h141
1 files changed, 141 insertions, 0 deletions
diff --git a/drivers/net/wan/sbni.h b/drivers/net/wan/sbni.h
new file mode 100644
index 000000000000..27715e70f28b
--- /dev/null
+++ b/drivers/net/wan/sbni.h
@@ -0,0 +1,141 @@
1/* sbni.h: definitions for a Granch SBNI12 driver, version 5.0.0
2 * Written 2001 Denis I.Timofeev (timofeev@granch.ru)
3 * This file is distributed under the GNU GPL
4 */
5
6#ifndef SBNI_H
7#define SBNI_H
8
9#ifdef SBNI_DEBUG
10#define DP( A ) A
11#else
12#define DP( A )
13#endif
14
15
16/* We don't have official vendor id yet... */
17#define SBNI_PCI_VENDOR 0x55
18#define SBNI_PCI_DEVICE 0x9f
19
20#define ISA_MODE 0x00
21#define PCI_MODE 0x01
22
23#define SBNI_IO_EXTENT 4
24
25enum sbni_reg {
26 CSR0 = 0,
27 CSR1 = 1,
28 DAT = 2
29};
30
31/* CSR0 mapping */
32enum {
33 BU_EMP = 0x02,
34 RC_CHK = 0x04,
35 CT_ZER = 0x08,
36 TR_REQ = 0x10,
37 TR_RDY = 0x20,
38 EN_INT = 0x40,
39 RC_RDY = 0x80
40};
41
42
43/* CSR1 mapping */
44#define PR_RES 0x80
45
46struct sbni_csr1 {
47 unsigned rxl : 5;
48 unsigned rate : 2;
49 unsigned : 1;
50};
51
52/* fields in frame header */
53#define FRAME_ACK_MASK (unsigned short)0x7000
54#define FRAME_LEN_MASK (unsigned short)0x03FF
55#define FRAME_FIRST (unsigned short)0x8000
56#define FRAME_RETRY (unsigned short)0x0800
57
58#define FRAME_SENT_BAD (unsigned short)0x4000
59#define FRAME_SENT_OK (unsigned short)0x3000
60
61
62/* state flags */
63enum {
64 FL_WAIT_ACK = 0x01,
65 FL_NEED_RESEND = 0x02,
66 FL_PREV_OK = 0x04,
67 FL_SLOW_MODE = 0x08,
68 FL_SECONDARY = 0x10,
69#ifdef CONFIG_SBNI_MULTILINE
70 FL_SLAVE = 0x20,
71#endif
72 FL_LINE_DOWN = 0x40
73};
74
75
76enum {
77 DEFAULT_IOBASEADDR = 0x210,
78 DEFAULT_INTERRUPTNUMBER = 5,
79 DEFAULT_RATE = 0,
80 DEFAULT_FRAME_LEN = 1012
81};
82
83#define DEF_RXL_DELTA -1
84#define DEF_RXL 0xf
85
86#define SBNI_SIG 0x5a
87
88#define SBNI_MIN_LEN 60 /* Shortest Ethernet frame without FCS */
89#define SBNI_MAX_FRAME 1023
90#define ETHER_MAX_LEN 1518
91
92#define SBNI_TIMEOUT (HZ/10)
93
94#define TR_ERROR_COUNT 32
95#define CHANGE_LEVEL_START_TICKS 4
96
97#define SBNI_MAX_NUM_CARDS 16
98
99/* internal SBNI-specific statistics */
100struct sbni_in_stats {
101 u32 all_rx_number;
102 u32 bad_rx_number;
103 u32 timeout_number;
104 u32 all_tx_number;
105 u32 resend_tx_number;
106};
107
108/* SBNI ioctl params */
109#define SIOCDEVGETINSTATS SIOCDEVPRIVATE
110#define SIOCDEVRESINSTATS SIOCDEVPRIVATE+1
111#define SIOCDEVGHWSTATE SIOCDEVPRIVATE+2
112#define SIOCDEVSHWSTATE SIOCDEVPRIVATE+3
113#define SIOCDEVENSLAVE SIOCDEVPRIVATE+4
114#define SIOCDEVEMANSIPATE SIOCDEVPRIVATE+5
115
116
117/* data packet for SIOCDEVGHWSTATE/SIOCDEVSHWSTATE ioctl requests */
118struct sbni_flags {
119 u32 rxl : 4;
120 u32 rate : 2;
121 u32 fixed_rxl : 1;
122 u32 slow_mode : 1;
123 u32 mac_addr : 24;
124};
125
126/*
127 * CRC-32 stuff
128 */
129#define CRC32(c,crc) (crc32tab[((size_t)(crc) ^ (c)) & 0xff] ^ (((crc) >> 8) & 0x00FFFFFF))
130 /* CRC generator 0xEDB88320 */
131 /* CRC remainder 0x2144DF1C */
132 /* CRC initial value 0x00000000 */
133#define CRC32_REMAINDER 0x2144DF1C
134#define CRC32_INITIAL 0x00000000
135
136#ifndef __initdata
137#define __initdata
138#endif
139
140#endif
141