Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / mac68k / dev / if_mcvar.h
blobb881b91dade0044d463a47a87a4633c7dbc95d69
1 /* $NetBSD: if_mcvar.h,v 1.14 2007/03/05 21:16:58 he Exp $ */
3 /*-
4 * Copyright (c) 1997 David Huang <khym@azeotrope.org>
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. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 /* XXX this file depends on opt_ddb.h */
29 #ifdef DDB
30 #define integrate
31 #define hide
32 #else
33 #define integrate static inline
34 #define hide static
35 #endif
37 #define MC_REGSPACING 16
38 #define MC_REGSIZE MACE_NREGS * MC_REGSPACING
39 #define MACE_REG(x) ((x)*MC_REGSPACING)
41 #define NIC_GET(sc, reg) (bus_space_read_1((sc)->sc_regt, \
42 (sc)->sc_regh, MACE_REG(reg)))
44 #define NIC_PUT(sc, reg, val) (bus_space_write_1((sc)->sc_regt, \
45 (sc)->sc_regh, MACE_REG(reg), (val)))
47 #ifndef MC_RXDMABUFS
48 #define MC_RXDMABUFS 4
49 #endif
50 #if (MC_RXDMABUFS < 2)
51 #error Must have at least two buffers for DMA!
52 #endif
54 #define MC_NPAGES ((MC_RXDMABUFS * 0x800 + PAGE_SIZE - 1) / PAGE_SIZE)
56 struct mc_rxframe {
57 u_int8_t rx_rcvcnt;
58 u_int8_t rx_rcvsts;
59 u_int8_t rx_rntpc;
60 u_int8_t rx_rcvcc;
61 u_char *rx_frame;
64 struct mc_softc {
65 struct device sc_dev; /* base device glue */
66 struct ethercom sc_ethercom; /* Ethernet common part */
67 #define sc_if sc_ethercom.ec_if
69 struct mc_rxframe sc_rxframe;
70 u_int8_t sc_biucc;
71 u_int8_t sc_fifocc;
72 u_int8_t sc_plscc;
73 u_int8_t sc_enaddr[6];
74 u_int8_t sc_pad[2];
75 int sc_havecarrier; /* carrier status */
76 void (*sc_bus_init)(struct mc_softc *);
77 void (*sc_putpacket)(struct mc_softc *, u_int);
79 bus_space_tag_t sc_regt;
80 bus_space_handle_t sc_regh;
81 bus_dma_tag_t sc_dmat;
82 bus_dmamap_t sc_dmam_tx, sc_dmam_rx;
83 bus_dma_segment_t sc_dmasegs_tx, sc_dmasegs_rx;
85 uint8_t *sc_txbuf, *sc_rxbuf;
86 bus_addr_t sc_txbuf_phys, sc_rxbuf_phys;
87 int sc_tail;
88 int sc_rxset;
89 int sc_txset, sc_txseti;
92 int mcsetup(struct mc_softc *, u_int8_t *);
93 void mcintr(void *arg);
94 void mc_rint(struct mc_softc *);
95 u_char mc_get_enaddr(bus_space_tag_t, bus_space_handle_t, bus_size_t,
96 u_char *);