if_cdcereg.h revision 184610
1/*-
2 * Copyright (c) 2003-2005 Craig Boston
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *      This product includes software developed by Bill Paul.
16 * 4. Neither the name of the author nor the names of any co-contributors
17 *    may be used to endorse or promote products derived from this software
18 *    without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul, THE VOICES IN HIS HEAD OR
24 * THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * $FreeBSD: head/sys/dev/usb2/ethernet/if_cdce2_reg.h 184610 2008-11-04 02:31:03Z alfred $
33 */
34
35#ifndef _USB_IF_CDCEREG_H_
36#define	_USB_IF_CDCEREG_H_
37
38#define	CDCE_N_TRANSFER	3		/* units */
39#define	CDCE_IND_SIZE_MAX 32		/* bytes */
40#define	CDCE_512X4_IFQ_MAXLEN MAX((2*CDCE_512X4_FRAMES_MAX), IFQ_MAXLEN)
41
42union cdce_eth_rx {			/* multiframe header */
43	struct usb2_cdc_mf_eth_512x4_header hdr;
44	uint8_t	data[MCLBYTES];
45} __aligned(USB_HOST_ALIGN);
46
47union cdce_eth_tx {			/* multiframe header */
48	struct usb2_cdc_mf_eth_512x4_header hdr;
49} __aligned(USB_HOST_ALIGN);
50
51struct cdce_mq {			/* mini-queue */
52	struct mbuf *ifq_head;
53	struct mbuf *ifq_tail;
54	uint16_t ifq_len;
55};
56
57struct cdce_softc {
58	void   *sc_evilhack;		/* XXX this pointer must be first */
59
60	union cdce_eth_tx sc_tx;
61	union cdce_eth_rx sc_rx;
62	struct ifmedia sc_ifmedia;
63	struct mtx sc_mtx;
64	struct cdce_mq sc_rx_mq;
65	struct cdce_mq sc_tx_mq;
66
67	struct ifnet *sc_ifp;
68	struct usb2_xfer *sc_xfer[CDCE_N_TRANSFER];
69	struct usb2_device *sc_udev;
70	device_t sc_dev;
71
72	uint32_t sc_unit;
73
74	uint16_t sc_flags;
75#define	CDCE_FLAG_ZAURUS	0x0001
76#define	CDCE_FLAG_NO_UNION	0x0002
77#define	CDCE_FLAG_LL_READY	0x0004
78#define	CDCE_FLAG_HL_READY	0x0008
79#define	CDCE_FLAG_RX_DATA	0x0010
80
81	uint8_t	sc_name[16];
82	uint8_t	sc_data_iface_no;
83	uint8_t	sc_ifaces_index[2];
84	uint8_t	sc_iface_protocol;
85};
86
87#endif					/* _USB_IF_CDCEREG_H_ */
88