Annotation of sys/arch/mac68k/dev/if_mcvar.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: if_mcvar.h,v 1.5 2006/06/24 13:23:27 miod Exp $ */
2: /* $NetBSD: if_mcvar.h,v 1.8 2004/03/26 12:15:46 wiz Exp $ */
3:
4: /*-
5: * Copyright (c) 1997 David Huang <khym@azeotrope.org>
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. The name of the author may not be used to endorse or promote products
14: * derived from this software without specific prior written permission
15: *
16: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26: *
27: */
28:
29: #define MC_REGSPACING 16
30: #define MC_REGSIZE MACE_NREGS * MC_REGSPACING
31: #define MACE_REG(x) ((x)*MC_REGSPACING)
32:
33: #define NIC_GET(sc, reg) (bus_space_read_1((sc)->sc_regt, \
34: (sc)->sc_regh, MACE_REG(reg)))
35:
36: #define NIC_PUT(sc, reg, val) (bus_space_write_1((sc)->sc_regt, \
37: (sc)->sc_regh, MACE_REG(reg), (val)))
38:
39: #ifndef MC_RXDMABUFS
40: #define MC_RXDMABUFS 4
41: #endif
42: #if (MC_RXDMABUFS < 2)
43: #error Must have at least two buffers for DMA!
44: #endif
45:
46: #define MC_NPAGES ((MC_RXDMABUFS * 0x800 + PAGE_SIZE - 1) / PAGE_SIZE)
47:
48: struct mc_rxframe {
49: u_int8_t rx_rcvcnt;
50: u_int8_t rx_rcvsts;
51: u_int8_t rx_rntpc;
52: u_int8_t rx_rcvcc;
53: u_char *rx_frame;
54: };
55:
56: struct mc_softc {
57: struct device sc_dev; /* base device glue */
58: struct arpcom sc_ethercom; /* Ethernet common part */
59: #define sc_if sc_ethercom.ac_if
60:
61: struct mc_rxframe sc_rxframe;
62: u_int8_t sc_biucc;
63: u_int8_t sc_fifocc;
64: u_int8_t sc_plscc;
65: u_int8_t sc_enaddr[6];
66: u_int8_t sc_pad[2];
67: int sc_havecarrier; /* carrier status */
68: void (*sc_bus_init)(struct mc_softc *);
69: void (*sc_putpacket)(struct mc_softc *, u_int);
70:
71: bus_space_tag_t sc_regt;
72: bus_space_handle_t sc_regh;
73:
74: u_char *sc_txbuf, *sc_rxbuf;
75: paddr_t sc_txbuf_phys, sc_rxbuf_phys;
76: int sc_tail;
77: int sc_rxset;
78: int sc_txset, sc_txseti;
79: };
80:
81: int mcsetup(struct mc_softc *, u_int8_t *);
82: void mcintr(void *arg);
83: void mc_rint(struct mc_softc *sc);
84: u_char mc_get_enaddr(bus_space_tag_t t, bus_space_handle_t h,
85: bus_size_t o, u_char *dst);
CVSweb