xref: /netbsd/sys/dev/ic/seeq8005var.h (revision 7c77bcc9)
1*7c77bcc9Sriastradh /* $NetBSD: seeq8005var.h,v 1.9 2015/04/13 16:33:24 riastradh Exp $ */
240aba7cdSbjh21 
340aba7cdSbjh21 /*
440aba7cdSbjh21  * Copyright (c) 2000 Ben Harris
540aba7cdSbjh21  * Copyright (c) 1995 Mark Brinicombe
640aba7cdSbjh21  * All rights reserved.
740aba7cdSbjh21  *
840aba7cdSbjh21  * Redistribution and use in source and binary forms, with or without
940aba7cdSbjh21  * modification, are permitted provided that the following conditions
1040aba7cdSbjh21  * are met:
1140aba7cdSbjh21  * 1. Redistributions of source code must retain the above copyright
1240aba7cdSbjh21  *    notice, this list of conditions and the following disclaimer.
1340aba7cdSbjh21  * 2. Redistributions in binary form must reproduce the above copyright
1440aba7cdSbjh21  *    notice, this list of conditions and the following disclaimer in the
1540aba7cdSbjh21  *    documentation and/or other materials provided with the distribution.
1640aba7cdSbjh21  * 3. All advertising materials mentioning features or use of this software
1740aba7cdSbjh21  *    must display the following acknowledgement:
1840aba7cdSbjh21  *	This product includes software developed by Mark Brinicombe.
1940aba7cdSbjh21  * 4. The name of the company nor the name of the author may be used to
2040aba7cdSbjh21  *    endorse or promote products derived from this software without specific
2140aba7cdSbjh21  *    prior written permission.
2240aba7cdSbjh21  *
2340aba7cdSbjh21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
2440aba7cdSbjh21  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2540aba7cdSbjh21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2640aba7cdSbjh21  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
2740aba7cdSbjh21  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2840aba7cdSbjh21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2940aba7cdSbjh21  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3040aba7cdSbjh21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3140aba7cdSbjh21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3240aba7cdSbjh21  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3340aba7cdSbjh21  * SUCH DAMAGE.
3440aba7cdSbjh21  */
3540aba7cdSbjh21 
3640aba7cdSbjh21 #ifndef _SEEQ8005VAR_H_
3740aba7cdSbjh21 #define _SEEQ8005VAR_H_
3840aba7cdSbjh21 
39b94b953eSbjh21 #include <net/if_media.h>
40b94b953eSbjh21 
41*7c77bcc9Sriastradh #include <sys/rndsource.h>
42479d71beSbjh21 
43b94b953eSbjh21 /* Enumerate the possible cip variants */
44b94b953eSbjh21 enum seeq_variant {
45b94b953eSbjh21 	SEEQ_8004, SEEQ_8005
46b94b953eSbjh21 };
47b94b953eSbjh21 
4840aba7cdSbjh21 /*
4940aba7cdSbjh21  * per-line info and status
5040aba7cdSbjh21  */
5140aba7cdSbjh21 
5240aba7cdSbjh21 struct seeq8005_softc {
53b7c974daSskrll 	device_t sc_dev;
54b94b953eSbjh21 
55f3ef35c4Sbjh21 	/* These fields should be initialised by the board driver. */
5640aba7cdSbjh21 	bus_space_tag_t sc_iot;		/* I/O base addr */
5740aba7cdSbjh21 	bus_space_handle_t sc_ioh;
58b94b953eSbjh21 
59b94b953eSbjh21 	int (*sc_mediachange)(struct seeq8005_softc *);
60b94b953eSbjh21 	void (*sc_mediastatus)(struct seeq8005_softc *, struct ifmediareq *);
61b94b953eSbjh21 
62f3ef35c4Sbjh21 	/* These fields are used internally by the seeq8005 driver. */
6340aba7cdSbjh21 	struct ethercom sc_ethercom;	/* Ethernet common */
64b94b953eSbjh21 	struct ifmedia sc_media;	/* supported media information */
65b94b953eSbjh21 
6640aba7cdSbjh21 	int sc_config1;			/* Current config1 bits */
6740aba7cdSbjh21 	int sc_config2;			/* Current config2 bits */
68b94b953eSbjh21 	int sc_config3;			/* Current config3 bits 8004 only */
6940aba7cdSbjh21 	int sc_command;			/* Current command bits */
7040aba7cdSbjh21 	u_int sc_rx_ptr;		/* Receive buffer pointer */
71b94b953eSbjh21 
72b94b953eSbjh21 	u_int sc_tx_bufs;		/* Number of tx buffers */
73b94b953eSbjh21 	u_int sc_tx_used;		/* Number of tx buffers in use */
74b94b953eSbjh21 	u_int sc_tx_cur;		/* Next tx buffer to transmit */
75b94b953eSbjh21 	u_int sc_tx_next;		/* Next tx buffer to fill */
76b94b953eSbjh21 
77b94b953eSbjh21 	u_int sc_buffersize;		/* Size of packet buffer */
78b94b953eSbjh21 	u_int sc_tx_bufsize;		/* Size of TX packet buffer */
79b94b953eSbjh21 	u_int sc_rx_bufsize;		/* Size of RX packet buffer */
80b94b953eSbjh21 
81b94b953eSbjh21 	int sc_enabled;			/* Enabled state */
82b94b953eSbjh21 	enum seeq_variant sc_variant;	/* Chip variant */
8327a2f91bSbjh21 	int sc_flags;
8427a2f91bSbjh21 #define SF_8BIT		0x01
858e933452Stls 	krndsource_t rnd_source;
8640aba7cdSbjh21 };
8740aba7cdSbjh21 
88b94b953eSbjh21 extern void seeq8005_attach(struct seeq8005_softc *, const u_int8_t *, int *,
89b94b953eSbjh21     int, int);
9040aba7cdSbjh21 extern int seeq8005intr(void *);
9140aba7cdSbjh21 
9240aba7cdSbjh21 #endif
93