Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / net / if_eco.h
blob7f3f3429e6580d953742e7252afaf8918a0dbef4
1 /* $NetBSD: if_eco.h,v 1.7 2007/12/25 18:33:44 perry Exp $ */
3 /*-
4 * Copyright (c) 2001 Ben Harris
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #ifndef _NET_IF_ECO_H_
31 #define _NET_IF_ECO_H_
33 #include <sys/callout.h>
34 #include <sys/mbuf.h>
35 #include <sys/queue.h>
37 #include <net/if.h>
40 * Econet headers come in two forms. The initial frame of an exchange
41 * has source and destination addresses, a control byte and a port.
42 * Later frames just have source and destination addresses.
44 * Complete packets are generally passed around with the full header on,
45 * even if this means assembling them from two separate frames.
47 #define ECO_ADDR_LEN 2 /* Length of an Econet address */
48 #define ECO_HDR_LEN 6 /* Two addresses, a port and a control byte */
49 #define ECO_SHDR_LEN 4 /* "Short" Econet header: just two addresses */
50 /* #define ECO_MTU 8192 * Default MTU */
51 #define ECO_IPMTU 1280 /* MTU for IP used by RISC iX */
52 #define ECO_MTU ECO_IPMTU
54 struct eco_header {
55 uint8_t eco_dhost[ECO_ADDR_LEN];
56 uint8_t eco_shost[ECO_ADDR_LEN];
57 uint8_t eco_control;
58 uint8_t eco_port;
59 } __packed;
61 #define ECO_PORT_IMMEDIATE 0x00
62 #define ECO_PORT_DSTAPE 0x54 /* DigitalServicesTapeStore */
63 #define ECO_PORT_FS 0x99 /* FileServerCommand */
64 #define ECO_PORT_BRIDGE 0x9C /* Bridge */
65 #define ECO_PORT_PSINQREP 0x9E /* PrinterServerInquiryReply */
66 #define ECO_PORT_PSINQ 0x9F /* PrinterServerInquiry */
67 #define ECO_PORT_FAST 0xA0 /* SJ *FAST protocol */
68 #define ECO_PORT_NEXNETFIND 0xA1 /* SJ Nexus net find reply port */
69 #define ECO_PORT_FINDSRV 0xB0 /* FindServer */
70 #define ECO_PORT_FINDSRVREP 0xB1 /* FindServerReply */
71 #define ECO_PORT_TTXTCMD 0xB2 /* TeletextServerCommand */
72 #define ECO_PORT_TTXTPAGE 0xB3 /* TeletextServerPage */
73 #define ECO_PORT_OLDPSDATA 0xD0 /* OldPrinterServer */
74 #define ECO_PORT_PSDATA 0xD1 /* PrinterServer */
75 #define ECO_PORT_IP 0xD2 /* TCPIPProtocolSuite */
76 #define ECO_PORT_SIDSLAVE 0xD3 /* SIDFrameSlave */
77 #define ECO_PORT_SCROLLARAMA 0xD4 /* Scrollarama */
78 #define ECO_PORT_PHONE 0xD5 /* Phone */
79 #define ECO_PORT_BCASTCTL 0xD6 /* BroadcastControl */
80 #define ECO_PORT_BCASTDATA 0xD7 /* BroadcastData */
81 #define ECO_PORT_IMPLICENCE 0xD8 /* ImpressionLicenceChecker */
82 #define ECO_PORT_SQUIRREL 0xD9 /* DigitalServicesSquirrel */
83 #define ECO_PORT_SID2NDARY 0xDA /* SIDSecondary */
84 #define ECO_PORT_SQUIRREL2 0xDB /* DigitalServicesSquirrel2 */
85 #define ECO_PORT_DDCTL 0xDC /* DataDistributionControl */
86 #define ECO_PORT_DDDATA 0xDD /* DataDistributionData */
87 #define ECO_PORT_CLASSROM 0xDE /* ClassROM */
88 #define ECO_PORT_PSCMD 0xDF /* PrinterSpoolerCommand */
90 /* Control bytes for immediate operations. */
91 #define ECO_CTL_PEEK 0x81
92 #define ECO_CTL_POKE 0x82
93 #define ECO_CTL_JSR 0x83
94 #define ECO_CTL_USERPROC 0x84
95 #define ECO_CTL_OSPROC 0x85
96 #define ECO_CTL_HALT 0x86
97 #define ECO_CTL_CONTINUE 0x87
98 #define ECO_CTL_MACHINEPEEK 0x88
99 #define ECO_CTL_GETREGISTERS 0x89
101 /* Control bytes for IP */
102 #define ECO_CTL_IP 0x81
103 #define ECO_CTL_IPBCAST_REPLY 0x8E
104 #define ECO_CTL_IPBCAST_REQUEST 0x8F
105 #define ECO_CTL_ARP_REQUEST 0xA1
106 #define ECO_CTL_ARP_REPLY 0xA2
108 struct eco_arp {
109 uint8_t ecar_spa[4];
110 uint8_t ecar_tpa[4];
113 enum eco_state {
114 ECO_UNKNOWN, ECO_IDLE, ECO_SCOUT_RCVD,
115 ECO_SCOUT_SENT, ECO_DATA_SENT, ECO_IMMED_SENT,
116 ECO_DONE
121 * This structure contains a packet that might need retransmitting,
122 * together with a callout to trigger retransmission. They're kept on
123 * a per-interface list so they can be freed when an interface is
124 * downed.
126 struct eco_retry {
127 LIST_ENTRY(eco_retry) er_link;
128 struct callout er_callout;
129 struct mbuf *er_packet;
130 struct ifnet *er_ifp;
134 * Common structure used to store state about an Econet interface.
136 struct ecocom {
137 struct ifnet ec_if;
138 int (*ec_claimwire)(struct ifnet *);
139 void (*ec_txframe)(struct ifnet *, struct mbuf *);
140 enum eco_state ec_state;
141 struct mbuf *ec_scout;
142 struct mbuf *ec_packet;
143 LIST_HEAD(, eco_retry) ec_retries;
146 #ifdef _KERNEL
147 void eco_ifattach(struct ifnet *, const uint8_t *);
148 void eco_ifdetach(struct ifnet *);
149 int eco_init(struct ifnet *);
150 void eco_stop(struct ifnet *, int);
152 char *eco_sprintf(const uint8_t *);
154 struct mbuf * eco_inputframe(struct ifnet *, struct mbuf *);
155 void eco_inputidle(struct ifnet *);
156 #endif
158 #endif /* !_NET_IF_ECO_H_ */