]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - sys/dev/usb/usb_ethersubr.h
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / sys / dev / usb / usb_ethersubr.h
1 /*-
2  * Copyright (c) 1997, 1998, 1999, 2000
3  *      Bill Paul <wpaul@ee.columbia.edu>.  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 OR THE VOICES IN HIS HEAD
24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30  * THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * $FreeBSD$
33  */
34
35 #ifndef _USB_ETHERSUBR_H_
36 #define _USB_ETHERSUBR_H_
37
38 #include <sys/bus.h>
39 #include <sys/module.h>
40
41 #include <dev/usb/usbdi.h>
42
43 #define UE_TX_LIST_CNT          1
44 #define UE_RX_LIST_CNT          1
45 #define UE_BUFSZ                1536
46
47 struct usb_qdat {
48         struct ifnet            *ifp;
49         void (*if_rxstart)      (struct ifnet *);
50 };
51
52 struct ue_chain {
53         void                    *ue_sc;
54         usbd_xfer_handle        ue_xfer;
55         char                    *ue_buf;
56         struct mbuf             *ue_mbuf;
57         int                     ue_idx;
58         usbd_status             ue_status;
59 };
60
61 struct ue_cdata {
62         struct ue_chain         ue_tx_chain[UE_TX_LIST_CNT];
63         struct ue_chain         ue_rx_chain[UE_RX_LIST_CNT];
64         void                    *ue_ibuf;
65         int                     ue_tx_prod;
66         int                     ue_tx_cons;
67         int                     ue_tx_cnt;
68         int                     ue_rx_prod;
69 };
70
71 void usb_register_netisr        (void);
72 void usb_ether_input            (struct mbuf *);
73 void usb_tx_done                (struct mbuf *);
74 struct mbuf *usb_ether_newbuf   (void);
75 int usb_ether_rx_list_init      (void *, struct ue_cdata *,
76     usbd_device_handle);
77 int usb_ether_tx_list_init      (void *, struct ue_cdata *,
78     usbd_device_handle);
79 void usb_ether_rx_list_free     (struct ue_cdata *);
80 void usb_ether_tx_list_free     (struct ue_cdata *);
81
82 struct usb_taskqueue {
83         int dummy;
84 };
85
86 void usb_ether_task_init(device_t, int, struct usb_taskqueue *);
87 void usb_ether_task_enqueue(struct usb_taskqueue *, struct task *);
88 void usb_ether_task_drain(struct usb_taskqueue *, struct task *);
89 void usb_ether_task_destroy(struct usb_taskqueue *);
90
91 #endif /* _USB_ETHERSUBR_H_ */