if_cdcereg.h revision 187259
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_cdcereg.h 187259 2009-01-15 02:35:40Z thompsa $ 33 */ 34 35#ifndef _USB_IF_CDCEREG_H_ 36#define _USB_IF_CDCEREG_H_ 37 38#define CDCE_IND_SIZE_MAX 32 /* bytes */ 39#define CDCE_512X4_IFQ_MAXLEN MAX((2*CDCE_512X4_FRAMES_MAX), IFQ_MAXLEN) 40 41union cdce_eth_rx { /* multiframe header */ 42 struct usb2_cdc_mf_eth_512x4_header hdr; 43 uint8_t data[MCLBYTES]; 44} __aligned(USB_HOST_ALIGN); 45 46union cdce_eth_tx { /* multiframe header */ 47 struct usb2_cdc_mf_eth_512x4_header hdr; 48} __aligned(USB_HOST_ALIGN); 49 50struct cdce_mq { /* mini-queue */ 51 struct mbuf *ifq_head; 52 struct mbuf *ifq_tail; 53 uint16_t ifq_len; 54}; 55 56enum { 57 CDCE_BULK_A, 58 CDCE_BULK_B, 59 CDCE_INTR, 60 CDCE_N_TRANSFER = 3, 61}; 62 63struct cdce_softc { 64 void *sc_evilhack; /* XXX this pointer must be first */ 65 66 union cdce_eth_tx sc_tx; 67 union cdce_eth_rx sc_rx; 68 struct ifmedia sc_ifmedia; 69 struct mtx sc_mtx; 70 struct cdce_mq sc_rx_mq; 71 struct cdce_mq sc_tx_mq; 72 73 struct ifnet *sc_ifp; 74 struct usb2_xfer *sc_xfer[CDCE_N_TRANSFER]; 75 struct usb2_device *sc_udev; 76 device_t sc_dev; 77 78 uint32_t sc_unit; 79 80 uint16_t sc_flags; 81#define CDCE_FLAG_ZAURUS 0x0001 82#define CDCE_FLAG_NO_UNION 0x0002 83#define CDCE_FLAG_LL_READY 0x0004 84#define CDCE_FLAG_HL_READY 0x0008 85#define CDCE_FLAG_RX_DATA 0x0010 86 87 uint8_t sc_name[16]; 88 uint8_t sc_data_iface_no; 89 uint8_t sc_ifaces_index[2]; 90 uint8_t sc_iface_protocol; 91}; 92 93#endif /* _USB_IF_CDCEREG_H_ */ 94