3 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
5 * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
6 * Copyright (c) 2009 Diego Giagio. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * Thanks to Diego Giagio for figuring out the programming details for
32 * the Apple iPhone Ethernet driver.
35 #ifndef _IF_IPHETHVAR_H_
36 #define _IF_IPHETHVAR_H_
38 #define IPHETH_USBINTF_CLASS 255
39 #define IPHETH_USBINTF_SUBCLASS 253
40 #define IPHETH_USBINTF_PROTO 1
42 #define IPHETH_BUF_SIZE 1516
43 #define IPHETH_TX_TIMEOUT 5000 /* ms */
45 #define IPHETH_RX_FRAMES_MAX 1
46 #define IPHETH_TX_FRAMES_MAX 8
48 #define IPHETH_RX_ADJ 2
50 #define IPHETH_CFG_INDEX 0
51 #define IPHETH_IF_INDEX 2
52 #define IPHETH_ALT_INTFNUM 1
54 #define IPHETH_CTRL_ENDP 0x00
55 #define IPHETH_CTRL_BUF_SIZE 0x40
56 #define IPHETH_CTRL_TIMEOUT 5000 /* ms */
58 #define IPHETH_CMD_GET_MACADDR 0x00
59 #define IPHETH_CMD_CARRIER_CHECK 0x45
61 #define IPHETH_CARRIER_ON 0x04
70 struct usb_ether sc_ue;
73 struct usb_xfer *sc_xfer[IPHETH_N_TRANSFER];
74 struct mbuf *sc_rx_buf[IPHETH_RX_FRAMES_MAX];
75 struct mbuf *sc_tx_buf[IPHETH_TX_FRAMES_MAX];
77 uint8_t sc_data[IPHETH_CTRL_BUF_SIZE];
79 uint8_t sc_carrier_on;
82 #define IPHETH_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
83 #define IPHETH_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
84 #define IPHETH_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t)
86 #endif /* _IF_IPHETHVAR_H_ */