Deleted Added
full compact
if_udavreg.h (187378) if_udavreg.h (188412)
1/* $NetBSD: if_udavreg.h,v 1.2 2003/09/04 15:17:39 tsutsui Exp $ */
2/* $nabe: if_udavreg.h,v 1.2 2003/08/21 16:26:40 nabe Exp $ */
1/* $NetBSD: if_udavreg.h,v 1.2 2003/09/04 15:17:39 tsutsui Exp $ */
2/* $nabe: if_udavreg.h,v 1.2 2003/08/21 16:26:40 nabe Exp $ */
3/* $FreeBSD: head/sys/dev/usb2/ethernet/if_udavreg.h 187378 2009-01-18 05:35:58Z thompsa $ */
3/* $FreeBSD: head/sys/dev/usb2/ethernet/if_udavreg.h 188412 2009-02-09 22:02:38Z thompsa $ */
4/*-
5 * Copyright (c) 2003
6 * Shingo WATANABE <nabe@nabechan.org>. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 */
33
34#define UDAV_IFACE_INDEX 0
35#define UDAV_CONFIG_INDEX 0 /* config number 1 */
36
4/*-
5 * Copyright (c) 2003
6 * Shingo WATANABE <nabe@nabechan.org>. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 */
33
34#define UDAV_IFACE_INDEX 0
35#define UDAV_CONFIG_INDEX 0 /* config number 1 */
36
37#define UDAV_TX_TIMEOUT 1000
38#define UDAV_TIMEOUT 10000
39
40#define UDAV_TX_TIMEOUT 1000
41#define UDAV_TIMEOUT 10000
42
37/* Packet length */
38#define UDAV_MIN_FRAME_LEN 60
39
40/* Request */
41#define UDAV_REQ_REG_READ 0x00 /* Read from register(s) */
42#define UDAV_REQ_REG_WRITE 0x01 /* Write to register(s) */
43#define UDAV_REQ_REG_WRITE1 0x03 /* Write to a register */
44

--- 81 unchanged lines hidden (view full) ---

126#define UDAV_GPR_GEPIO6 (1<<6) /* General purpose 6 */
127#define UDAV_GPR_GEPIO5 (1<<5) /* General purpose 5 */
128#define UDAV_GPR_GEPIO4 (1<<4) /* General purpose 4 */
129#define UDAV_GPR_GEPIO3 (1<<3) /* General purpose 3 */
130#define UDAV_GPR_GEPIO2 (1<<2) /* General purpose 2 */
131#define UDAV_GPR_GEPIO1 (1<<1) /* General purpose 1 */
132#define UDAV_GPR_GEPIO0 (1<<0) /* General purpose 0 */
133
43/* Packet length */
44#define UDAV_MIN_FRAME_LEN 60
45
46/* Request */
47#define UDAV_REQ_REG_READ 0x00 /* Read from register(s) */
48#define UDAV_REQ_REG_WRITE 0x01 /* Write to register(s) */
49#define UDAV_REQ_REG_WRITE1 0x03 /* Write to a register */
50

--- 81 unchanged lines hidden (view full) ---

132#define UDAV_GPR_GEPIO6 (1<<6) /* General purpose 6 */
133#define UDAV_GPR_GEPIO5 (1<<5) /* General purpose 5 */
134#define UDAV_GPR_GEPIO4 (1<<4) /* General purpose 4 */
135#define UDAV_GPR_GEPIO3 (1<<3) /* General purpose 3 */
136#define UDAV_GPR_GEPIO2 (1<<2) /* General purpose 2 */
137#define UDAV_GPR_GEPIO1 (1<<1) /* General purpose 1 */
138#define UDAV_GPR_GEPIO0 (1<<0) /* General purpose 0 */
139
134#define GET_MII(sc) ((sc)->sc_miibus ? \
135 device_get_softc((sc)->sc_miibus) : NULL)
140#define GET_MII(sc) usb2_ether_getmii(&(sc)->sc_ue)
136
141
142struct udav_rxpkt {
143 uint8_t rxstat;
144 uint16_t pktlen;
145} __packed;
146
137enum {
138 UDAV_BULK_DT_WR,
139 UDAV_BULK_DT_RD,
147enum {
148 UDAV_BULK_DT_WR,
149 UDAV_BULK_DT_RD,
140 UDAV_BULK_CS_WR,
141 UDAV_BULK_CS_RD,
142 UDAV_INTR_DT_RD,
150 UDAV_INTR_DT_RD,
143 UDAV_INTR_CS_RD,
144 UDAV_N_TRANSFER = 6,
151 UDAV_N_TRANSFER,
145};
146
147struct udav_softc {
152};
153
154struct udav_softc {
148 struct ifnet *sc_ifp;
155 struct usb2_ether sc_ue;
156 struct mtx sc_mtx;
157 struct usb2_xfer *sc_xfer[UDAV_N_TRANSFER];
149
158
150 struct usb2_config_td sc_config_td;
151 struct usb2_callout sc_watchdog;
152 struct mtx sc_mtx;
153
154 struct usb2_device *sc_udev;
155 struct usb2_xfer *sc_xfer[UDAV_N_TRANSFER];
156 device_t sc_miibus;
157 device_t sc_dev;
158
159 uint32_t sc_unit;
160 uint32_t sc_media_active;
161 uint32_t sc_media_status;
162
163 uint16_t sc_flags;
164#define UDAV_FLAG_WAIT_LINK 0x0001
165#define UDAV_FLAG_INTR_STALL 0x0002
166#define UDAV_FLAG_READ_STALL 0x0004
167#define UDAV_FLAG_WRITE_STALL 0x0008
168#define UDAV_FLAG_LL_READY 0x0010
169#define UDAV_FLAG_HL_READY 0x0020
159 int sc_flags;
160#define UDAV_FLAG_LINK 0x0001
170#define UDAV_FLAG_EXT_PHY 0x0040
161#define UDAV_FLAG_EXT_PHY 0x0040
171
172 uint8_t sc_name[16];
173};
162};
163
164#define UDAV_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
165#define UDAV_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
166#define UDAV_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t)