1139749Simp/*-
271316Simp * Copyright (c) 1999 M. Warner Losh <imp@village.org>
371316Simp * All rights reserved.
471316Simp *
571316Simp * Redistribution and use in source and binary forms, with or without
671316Simp * modification, are permitted provided that the following conditions
771316Simp * are met:
871316Simp * 1. Redistributions of source code must retain the above copyright
971316Simp *    notice, this list of conditions and the following disclaimer.
1071316Simp * 2. Redistributions in binary form must reproduce the above copyright
1171316Simp *    notice, this list of conditions and the following disclaimer in the
1271316Simp *    documentation and/or other materials provided with the distribution.
1371316Simp *
1471316Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1571316Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1671316Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1771316Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1871316Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1971316Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2071316Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2171316Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2271316Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2371316Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2471316Simp *
2571316Simp * $FreeBSD$
2671316Simp */
2771316Simp
2871316Simp#ifndef _IF_CSVAR_H
2971316Simp#define _IF_CSVAR_H
3071316Simp
3171316Simp/*
3271316Simp * cs_softc: per line info and status
3371316Simp */
3471316Simpstruct cs_softc {
35140927Simp	/* Ethernet common code */
36147256Sbrooks	struct ifnet *ifp;
37162321Sglebius	device_t dev;
3871316Simp
39140927Simp	/* Configuration words from EEPROM */
40140927Simp	int auto_neg_cnf;               /* AutoNegotitation configuration */
4171316Simp	int adapter_cnf;                /* Adapter configuration */
42140927Simp	int isa_config;                 /* ISA configuration */
43140927Simp	int chip_type;			/* Type of chip */
4471316Simp
45155526Simp	u_char	enaddr[ETHER_ADDR_LEN];
46147256Sbrooks
47140927Simp	struct ifmedia media;		/* Media information */
4871316Simp
4971316Simp	int     port_rid;		/* resource id for port range */
5071316Simp	struct resource* port_res;	/* resource for port range */
51140927Simp	int     irq_rid;		/* resource id for irq */
52140927Simp	struct resource* irq_res;	/* resource for irq */
53140927Simp	void*   irq_handle;		/* handle for irq handler */
5471316Simp
55140926Simp	int	flags;
56140926Simp#define	CS_NO_IRQ	0x1
5771316Simp	int	send_cmd;
58140927Simp	int	line_ctl;		/* */
59140927Simp	int	send_underrun;
60140927Simp	void	*recv_ring;
6171316Simp
62140927Simp	unsigned char *buffer;
63140927Simp	int buf_len;
64179560Sjhb	struct mtx lock;
65179560Sjhb	struct callout timer;
66179560Sjhb	int	tx_timeout;
6771316Simp};
6871316Simp
69179560Sjhb#define	CS_LOCK(sc)		mtx_lock(&(sc)->lock)
70179560Sjhb#define	CS_UNLOCK(sc)		mtx_unlock(&(sc)->lock)
71179560Sjhb#define	CS_ASSERT_LOCKED(sc)	mtx_assert(&(sc)->lock, MA_OWNED)
72179560Sjhb
7371316Simpint	cs_alloc_port(device_t dev, int rid, int size);
74179597Simpint	cs_alloc_irq(device_t dev, int rid);
75121816Sbrooksint	cs_attach(device_t dev);
7671316Simpint	cs_cs89x0_probe(device_t dev);
77140888Simpint	cs_detach(device_t dev);
7871316Simpvoid	cs_release_resources(device_t dev);
7971316Simp
8071316Simp#endif /* _IF_CSVAR_H */
81