- Andries Brouwer: final isofs pieces.
[davej-history.git] / drivers / net / hamradio / 6pack.h
blob08cee0485699d67d995edb6ec899f3b74d036cc2
1 /*
2 * 6pack.h Define the 6pack device driver interface and constants.
4 * NOTE: THIS FILE WILL BE MOVED TO THE LINUX INCLUDE DIRECTORY
5 * AS SOON AS POSSIBLE!
7 * Version: @(#)6pack.h 0.3.0 04/07/98
9 * Fixes:
11 * Author: Andreas Könsgen <ajk@iehk.rwth-aachen.de>
13 * This file is derived from slip.h, written by
14 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
17 #ifndef _LINUX_6PACK_H
18 #define _LINUX_6PACK_H
20 #define SIXPACK_VERSION "Revision: 0.3.0"
22 #ifdef __KERNEL__
24 /* sixpack priority commands */
25 #define SIXP_SEOF 0x40 /* start and end of a 6pack frame */
26 #define SIXP_TX_URUN 0x48 /* transmit overrun */
27 #define SIXP_RX_ORUN 0x50 /* receive overrun */
28 #define SIXP_RX_BUF_OVL 0x58 /* receive buffer overflow */
30 #define SIXP_CHKSUM 0xFF /* valid checksum of a 6pack frame */
32 /* masks to get certain bits out of the status bytes sent by the TNC */
34 #define SIXP_CMD_MASK 0xC0
35 #define SIXP_CHN_MASK 0x07
36 #define SIXP_PRIO_CMD_MASK 0x80
37 #define SIXP_STD_CMD_MASK 0x40
38 #define SIXP_PRIO_DATA_MASK 0x38
39 #define SIXP_TX_MASK 0x20
40 #define SIXP_RX_MASK 0x10
41 #define SIXP_RX_DCD_MASK 0x18
42 #define SIXP_LEDS_ON 0x78
43 #define SIXP_LEDS_OFF 0x60
44 #define SIXP_CON 0x08
45 #define SIXP_STA 0x10
47 #define SIXP_FOUND_TNC 0xe9
48 #define SIXP_CON_ON 0x68
49 #define SIXP_DCD_MASK 0x08
50 #define SIXP_DAMA_OFF 0
52 /* default level 2 parameters */
53 #define SIXP_TXDELAY 25 /* in 10 ms */
54 #define SIXP_PERSIST 50 /* in 256ths */
55 #define SIXP_SLOTTIME 10 /* in 10 ms */
56 #define SIXP_INIT_RESYNC_TIMEOUT 150 /* in 10 ms */
57 #define SIXP_RESYNC_TIMEOUT 500 /* in 10 ms */
59 /* 6pack configuration. */
60 #define SIXP_NRUNIT 256 /* MAX number of 6pack channels */
61 #define SIXP_MTU 256 /* Default MTU */
63 enum sixpack_flags {
64 SIXPF_INUSE, /* Channel in use */
65 SIXPF_ERROR, /* Parity, etc. error */
68 struct sixpack {
69 int magic;
71 /* Various fields. */
72 struct tty_struct *tty; /* ptr to TTY structure */
73 struct net_device *dev; /* easy for intr handling */
75 /* These are pointers to the malloc()ed frame buffers. */
76 unsigned char *rbuff; /* receiver buffer */
77 int rcount; /* received chars counter */
78 unsigned char *xbuff; /* transmitter buffer */
79 unsigned char *xhead; /* pointer to next byte to XMIT */
80 int xleft; /* bytes left in XMIT queue */
82 unsigned char raw_buf[4];
83 unsigned char cooked_buf[400];
85 unsigned int rx_count;
86 unsigned int rx_count_cooked;
88 /* 6pack interface statistics. */
89 unsigned long rx_packets; /* inbound frames counter */
90 unsigned long tx_packets; /* outbound frames counter */
91 unsigned long rx_bytes; /* inbound bytes counter */
92 unsigned long tx_bytes; /* outboud bytes counter */
93 unsigned long rx_errors; /* Parity, etc. errors */
94 unsigned long tx_errors; /* Planned stuff */
95 unsigned long rx_dropped; /* No memory for skb */
96 unsigned long tx_dropped; /* When MTU change */
97 unsigned long rx_over_errors; /* Frame bigger then 6pack buf. */
99 /* Detailed 6pack statistics. */
101 int mtu; /* Our mtu (to spot changes!) */
102 int buffsize; /* Max buffers sizes */
104 unsigned long flags; /* Flag values/ mode etc */
105 /* long req'd for set_bit --RR */
106 unsigned char mode; /* 6pack mode */
108 /* 6pack stuff */
110 unsigned char tx_delay;
111 unsigned char persistance;
112 unsigned char slottime;
113 unsigned char duplex;
114 unsigned char led_state;
115 unsigned char status;
116 unsigned char status1;
117 unsigned char status2;
118 unsigned char tx_enable;
119 unsigned char tnc_ok;
121 /* unsigned char retval; */
123 struct timer_list tx_t;
124 struct timer_list resync_t;
125 }; /* struct sixpack */
128 /* should later be moved to include/net/ax25.h */
129 #define AX25_6PACK_HEADER_LEN 0
130 #define SIXPACK_MAGIC 0x5304
132 extern int sixpack_init(struct net_device *dev);
134 #endif
136 #endif /* _LINUX_6PACK.H */