2 * sbni.h - header file for sbni linux device driver
4 * Copyright (C) 1999 Granch ltd., Yaroslav Polyakov (xenon@granch.ru).
11 * Revision 2.0.0 1997/08/27
14 * Revision 2.1.0 1999/04/26
15 * dev_priv structure changed to support balancing and some other features.
30 typedef unsigned char BOOLEAN
;
35 #define SBNI_IO_EXTENT 0x4
36 #define SB_MAX_BUFFER_ARRAY 1023
44 #define BU_EMP (1 << 1) /* r z */
45 #define RC_CHK (1 << 2) /* rw */
46 #define CT_ZER (1 << 3) /* w */
47 #define TR_REQ (1 << 4) /* rwz* */
49 #define TR_RDY (1 << 5) /* r z */
50 #define EN_INT (1 << 6) /* rwz* */
51 #define RC_RDY (1 << 7) /* r z */
54 #define PR_RES (1 << 7) /* w */
62 #define DEF_RXL_DELTA -1
65 #define DEF_FRAME_LEN (1023 - 14 - 9)
69 #define SBNI_MAX_NUM_CARDS 8
70 #define SBNI_MAX_SLAVES 8
77 #define SB_ETHER_MIN_LEN 60
79 #define SB_FILLING_CHAR (unsigned char)0x00
80 #define TR_ERROR_COUNT 32
81 #define CHANGE_LEVEL_START_TICKS 4
82 #define SBNI_INTERNAL_QUEUE_SIZE 10 /* 100 ? */
84 #define PACKET_FIRST_FRAME (unsigned short)0x8000
85 #define RECEIVE_FRAME_RESEND (unsigned short)0x0800
86 #define PACKET_RESEND 0x4000
87 #define PACKET_SEND_OK 0x3000
88 #define PACKET_LEN_MASK (unsigned short)0x03ff
89 #define PACKET_INF_MASK (unsigned short)0x7000
91 #define ETHER_ADDR_LEN 6
93 #define SBNI_TIMEOUT HZ/10 /* ticks to wait for pong or packet */
94 /* sbni watchdog called SBNI_HZ times per sec. */
96 struct sbni_in_stats
{
97 unsigned int all_rx_number
;
98 unsigned int bad_rx_number
;
99 unsigned int timeout_number
;
100 unsigned int all_tx_number
;
101 unsigned int resend_tx_number
;
106 * Board-specific info in dev->priv.
109 struct enet_statistics stats
;
111 struct timer_list watchdog
;
112 unsigned int realframelen
; /* the current size of the SB-frame */
113 unsigned int eth_trans_buffer_len
; /* tx buffer length */
116 unsigned int frame_len
; /* The set SB-frame size */
118 unsigned int timer_ticks
;
119 BOOLEAN last_receive_OK
;
122 unsigned char wait_frame_number
;
123 unsigned char eth_trans_buffer
[1520]; /* tx buffer */
124 unsigned char HSCounter
; /* Reserved field */
125 unsigned char eth_rcv_buffer
[2600]; /* rx buffer */
126 struct sbni_csr1 csr1
;
127 /* Internal Statistics */
128 struct sbni_in_stats in_stats
;
130 int rxl_curr
; /* current receive level value [0..0xf] */
131 int rxl_delta
; /* receive level delta (+1, -1)
132 rxl_delta == 0 - receive level
135 unsigned int ok_curr
; /* current ok frames received */
136 unsigned int ok_prev
; /* previous ok frames received */
137 unsigned int timeout_rxl
;
139 struct sk_buff_head queue
;
140 struct sk_buff
*currframe
;
143 struct net_device
*m
; /* master */
144 struct net_device
*me
; /* me */
145 struct net_local
*next_lp
; /* next lp */
153 struct sbni_hard_header
{
155 /* internal sbni stuff */
156 unsigned int crc
; /* 4 */
157 unsigned short packetlen
; /* 2 */
158 unsigned char number
; /* 1 */
159 unsigned char reserv
; /* 1 */
164 unsigned char h_dest
[ETH_ALEN
]; /* destination eth addr */
165 unsigned char h_source
[ETH_ALEN
]; /* source ether addr */
166 unsigned short h_proto
; /* packet type ID field */
172 #define SBNI_HH_SZ 22
177 unsigned fixed_rxl
:1;
178 unsigned fixed_rate
:1;
186 #define SIOCDEVGETINSTATS SIOCDEVPRIVATE
187 #define SIOCDEVRESINSTATS SIOCDEVPRIVATE+1
188 #define SIOCDEVGHWSTATE SIOCDEVPRIVATE+2
189 #define SIOCDEVSHWSTATE SIOCDEVPRIVATE+3
190 #define SIOCDEVENSLAVE SIOCDEVPRIVATE+4
191 #define SIOCDEVEMANSIPATE SIOCDEVPRIVATE+5
194 #endif /* __SBNI_H */