if_cdcereg.h revision 190734
1184610Salfred/*-
2184610Salfred * Copyright (c) 2003-2005 Craig Boston
3184610Salfred * All rights reserved.
4184610Salfred *
5184610Salfred * Redistribution and use in source and binary forms, with or without
6184610Salfred * modification, are permitted provided that the following conditions
7184610Salfred * are met:
8184610Salfred * 1. Redistributions of source code must retain the above copyright
9184610Salfred *    notice, this list of conditions and the following disclaimer.
10184610Salfred * 2. Redistributions in binary form must reproduce the above copyright
11184610Salfred *    notice, this list of conditions and the following disclaimer in the
12184610Salfred *    documentation and/or other materials provided with the distribution.
13184610Salfred * 3. All advertising materials mentioning features or use of this software
14184610Salfred *    must display the following acknowledgement:
15184610Salfred *      This product includes software developed by Bill Paul.
16184610Salfred * 4. Neither the name of the author nor the names of any co-contributors
17184610Salfred *    may be used to endorse or promote products derived from this software
18184610Salfred *    without specific prior written permission.
19184610Salfred *
20184610Salfred * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
21184610Salfred * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22184610Salfred * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23184610Salfred * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul, THE VOICES IN HIS HEAD OR
24184610Salfred * THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25184610Salfred * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26184610Salfred * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27184610Salfred * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28184610Salfred * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29184610Salfred * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30184610Salfred * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31184610Salfred *
32184610Salfred * $FreeBSD: head/sys/dev/usb/net/if_cdcereg.h 190734 2009-04-05 18:20:38Z thompsa $
33184610Salfred */
34184610Salfred
35184610Salfred#ifndef _USB_IF_CDCEREG_H_
36184610Salfred#define	_USB_IF_CDCEREG_H_
37184610Salfred
38188412Sthompsa#define	CDCE_FRAMES_MAX	8		/* units */
39188412Sthompsa#define	CDCE_IND_SIZE_MAX 32            /* bytes */
40184610Salfred
41187259Sthompsaenum {
42190734Sthompsa	CDCE_BULK_RX,
43190734Sthompsa	CDCE_BULK_TX,
44190734Sthompsa	CDCE_INTR_RX,
45190734Sthompsa	CDCE_INTR_TX,
46188412Sthompsa	CDCE_N_TRANSFER,
47187259Sthompsa};
48187259Sthompsa
49184610Salfredstruct cdce_softc {
50188412Sthompsa	struct usb2_ether	sc_ue;
51188412Sthompsa	struct mtx		sc_mtx;
52188412Sthompsa	struct usb2_xfer	*sc_xfer[CDCE_N_TRANSFER];
53188412Sthompsa	struct mbuf		*sc_rx_buf[CDCE_FRAMES_MAX];
54188412Sthompsa	struct mbuf		*sc_tx_buf[CDCE_FRAMES_MAX];
55184610Salfred
56188412Sthompsa	int 			sc_flags;
57184610Salfred#define	CDCE_FLAG_ZAURUS	0x0001
58184610Salfred#define	CDCE_FLAG_NO_UNION	0x0002
59184610Salfred#define	CDCE_FLAG_RX_DATA	0x0010
60184610Salfred
61188412Sthompsa	uint8_t sc_eaddr_str_index;
62184610Salfred	uint8_t	sc_data_iface_no;
63184610Salfred	uint8_t	sc_ifaces_index[2];
64184610Salfred};
65184610Salfred
66188412Sthompsa#define	CDCE_LOCK(_sc)			mtx_lock(&(_sc)->sc_mtx)
67188412Sthompsa#define	CDCE_UNLOCK(_sc)		mtx_unlock(&(_sc)->sc_mtx)
68188412Sthompsa#define	CDCE_LOCK_ASSERT(_sc, t)	mtx_assert(&(_sc)->sc_mtx, t)
69184610Salfred#endif					/* _USB_IF_CDCEREG_H_ */
70