| 1 | /* $NetBSD: if_cdcereg.h,v 1.9 2016/04/23 10:15:31 skrll Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> |
| 5 | * Copyright (c) 2003 Craig Boston |
| 6 | * Copyright (c) 2004 Daniel Hartmeier |
| 7 | * All rights reserved. |
| 8 | * |
| 9 | * Redistribution and use in source and binary forms, with or without |
| 10 | * modification, are permitted provided that the following conditions |
| 11 | * are met: |
| 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer in the |
| 16 | * documentation and/or other materials provided with the distribution. |
| 17 | * 3. All advertising materials mentioning features or use of this software |
| 18 | * must display the following acknowledgement: |
| 19 | * This product includes software developed by Bill Paul. |
| 20 | * 4. Neither the name of the author nor the names of any co-contributors |
| 21 | * may be used to endorse or promote products derived from this software |
| 22 | * without specific prior written permission. |
| 23 | * |
| 24 | * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND |
| 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 27 | * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul, THE VOICES IN HIS HEAD OR |
| 28 | * THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 29 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 30 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 31 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 32 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 33 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 34 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 35 | */ |
| 36 | |
| 37 | #include <sys/rndsource.h> |
| 38 | |
| 39 | #define CDCE_RX_LIST_CNT 1 |
| 40 | #define CDCE_TX_LIST_CNT 1 |
| 41 | #define CDCE_BUFSZ 1542 |
| 42 | |
| 43 | struct cdce_type { |
| 44 | struct usb_devno cdce_dev; |
| 45 | uint16_t cdce_flags; |
| 46 | #define CDCE_ZAURUS 1 |
| 47 | #define CDCE_NO_UNION 2 |
| 48 | }; |
| 49 | |
| 50 | struct cdce_softc; |
| 51 | |
| 52 | struct cdce_chain { |
| 53 | struct cdce_softc *cdce_sc; |
| 54 | struct usbd_xfer *cdce_xfer; |
| 55 | char *cdce_buf; |
| 56 | struct mbuf *cdce_mbuf; |
| 57 | int cdce_accum; |
| 58 | int cdce_idx; |
| 59 | }; |
| 60 | |
| 61 | struct cdce_cdata { |
| 62 | struct cdce_chain cdce_rx_chain[CDCE_RX_LIST_CNT]; |
| 63 | struct cdce_chain cdce_tx_chain[CDCE_TX_LIST_CNT]; |
| 64 | int cdce_tx_prod; |
| 65 | int cdce_tx_cons; |
| 66 | int cdce_tx_cnt; |
| 67 | int cdce_rx_prod; |
| 68 | }; |
| 69 | |
| 70 | struct cdce_softc { |
| 71 | device_t cdce_dev; |
| 72 | struct ethercom cdce_ec; |
| 73 | krndsource_t rnd_source; |
| 74 | #define GET_IFP(sc) (&(sc)->cdce_ec.ec_if) |
| 75 | struct usbd_device * cdce_udev; |
| 76 | struct usbd_interface * cdce_ctl_iface; |
| 77 | struct usbd_interface * cdce_data_iface; |
| 78 | int cdce_bulkin_no; |
| 79 | struct usbd_pipe * cdce_bulkin_pipe; |
| 80 | int cdce_bulkout_no; |
| 81 | struct usbd_pipe * cdce_bulkout_pipe; |
| 82 | char cdce_dying; |
| 83 | int cdce_unit; |
| 84 | struct cdce_cdata cdce_cdata; |
| 85 | int cdce_rxeof_errors; |
| 86 | uint16_t cdce_flags; |
| 87 | char cdce_attached; |
| 88 | }; |
| 89 | |