102ac6454SAndrew Thompson /*- 202ac6454SAndrew Thompson * Copyright (c) 2003-2005 Craig Boston 302ac6454SAndrew Thompson * All rights reserved. 402ac6454SAndrew Thompson * 502ac6454SAndrew Thompson * Redistribution and use in source and binary forms, with or without 602ac6454SAndrew Thompson * modification, are permitted provided that the following conditions 702ac6454SAndrew Thompson * are met: 802ac6454SAndrew Thompson * 1. Redistributions of source code must retain the above copyright 902ac6454SAndrew Thompson * notice, this list of conditions and the following disclaimer. 1002ac6454SAndrew Thompson * 2. Redistributions in binary form must reproduce the above copyright 1102ac6454SAndrew Thompson * notice, this list of conditions and the following disclaimer in the 1202ac6454SAndrew Thompson * documentation and/or other materials provided with the distribution. 1302ac6454SAndrew Thompson * 3. All advertising materials mentioning features or use of this software 1402ac6454SAndrew Thompson * must display the following acknowledgement: 1502ac6454SAndrew Thompson * This product includes software developed by Bill Paul. 1602ac6454SAndrew Thompson * 4. Neither the name of the author nor the names of any co-contributors 1702ac6454SAndrew Thompson * may be used to endorse or promote products derived from this software 1802ac6454SAndrew Thompson * without specific prior written permission. 1902ac6454SAndrew Thompson * 2002ac6454SAndrew Thompson * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 2102ac6454SAndrew Thompson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2202ac6454SAndrew Thompson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2302ac6454SAndrew Thompson * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul, THE VOICES IN HIS HEAD OR 2402ac6454SAndrew Thompson * THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 2502ac6454SAndrew Thompson * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2602ac6454SAndrew Thompson * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 2702ac6454SAndrew Thompson * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2802ac6454SAndrew Thompson * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 2902ac6454SAndrew Thompson * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 3002ac6454SAndrew Thompson * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3102ac6454SAndrew Thompson * 3202ac6454SAndrew Thompson * $FreeBSD$ 3302ac6454SAndrew Thompson */ 3402ac6454SAndrew Thompson 3502ac6454SAndrew Thompson #ifndef _USB_IF_CDCEREG_H_ 3602ac6454SAndrew Thompson #define _USB_IF_CDCEREG_H_ 3702ac6454SAndrew Thompson 3802ac6454SAndrew Thompson #define CDCE_FRAMES_MAX 8 /* units */ 3902ac6454SAndrew Thompson #define CDCE_IND_SIZE_MAX 32 /* bytes */ 4002ac6454SAndrew Thompson 4102ac6454SAndrew Thompson enum { 4202ac6454SAndrew Thompson CDCE_BULK_A, 4302ac6454SAndrew Thompson CDCE_BULK_B, 4402ac6454SAndrew Thompson CDCE_INTR, 4502ac6454SAndrew Thompson CDCE_N_TRANSFER, 4602ac6454SAndrew Thompson }; 4702ac6454SAndrew Thompson 4802ac6454SAndrew Thompson struct cdce_softc { 4902ac6454SAndrew Thompson struct usb2_ether sc_ue; 5002ac6454SAndrew Thompson struct mtx sc_mtx; 5102ac6454SAndrew Thompson struct usb2_xfer *sc_xfer[CDCE_N_TRANSFER]; 5202ac6454SAndrew Thompson struct mbuf *sc_rx_buf[CDCE_FRAMES_MAX]; 5302ac6454SAndrew Thompson struct mbuf *sc_tx_buf[CDCE_FRAMES_MAX]; 5402ac6454SAndrew Thompson 5502ac6454SAndrew Thompson int sc_flags; 5602ac6454SAndrew Thompson #define CDCE_FLAG_ZAURUS 0x0001 5702ac6454SAndrew Thompson #define CDCE_FLAG_NO_UNION 0x0002 5802ac6454SAndrew Thompson #define CDCE_FLAG_RX_DATA 0x0010 5902ac6454SAndrew Thompson 6002ac6454SAndrew Thompson uint8_t sc_eaddr_str_index; 6102ac6454SAndrew Thompson uint8_t sc_data_iface_no; 6202ac6454SAndrew Thompson uint8_t sc_ifaces_index[2]; 6302ac6454SAndrew Thompson }; 6402ac6454SAndrew Thompson 6502ac6454SAndrew Thompson #define CDCE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) 6602ac6454SAndrew Thompson #define CDCE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) 6702ac6454SAndrew Thompson #define CDCE_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t) 6802ac6454SAndrew Thompson #endif /* _USB_IF_CDCEREG_H_ */ 69