• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ----------------------------------------------------------------------------
2  * Copyright (c) Huawei Technologies Co., Ltd. 2016-2019. All rights reserved.
3  * Description: LiteOS USB Driver RNDIS Protocol HeadFile
4  * Author: huangjieliang
5  * Create: 2016-07-13
6  * Redistribution and use in source and binary forms, with or without modification,
7  * are permitted provided that the following conditions are met:
8  * 1. Redistributions of source code must retain the above copyright notice, this list of
9  * conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11  * of conditions and the following disclaimer in the documentation and/or other materials
12  * provided with the distribution.
13  * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14  * to endorse or promote products derived from this software without specific prior written
15  * permission.
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  * --------------------------------------------------------------------------- */
28 /* ----------------------------------------------------------------------------
29  * Notice of Export Control Law
30  * ===============================================
31  * Huawei LiteOS may be subject to applicable export control laws and regulations, which might
32  * include those applicable to Huawei LiteOS of U.S. and the country in which you are located.
33  * Import, export and usage of Huawei LiteOS in any manner by you shall be in compliance with such
34  * applicable export control laws and regulations.
35  * --------------------------------------------------------------------------- */
36 
37 #ifndef F_ETHER_H
38 #define F_ETHER_H
39 
40 #include <los_mac.h>
41 #include "gadget/usbdev.h"
42 #include "implementation/freebsd_sys.h"
43 
44 #ifdef __cplusplus
45 #if __cplusplus
46 extern "C" {
47 #endif /* __cplusplus */
48 #endif /* __cplusplus */
49 
50 struct fether_rndis_config_desc
51 {
52   struct usb_config_descriptor confd;
53   struct usb_interface_assoc_descriptor ifcad;
54   struct usb_interface_descriptor ifcd;
55   struct usb_cdc_header_desc cdc_desc;
56   struct usb_cdc_call_mgmt_descriptor cdc_call_desc;
57   struct usb_cdc_acm_descriptor cdc_acm_desc;
58   struct usb_cdc_union_desc cdc_union_desc;
59   struct usb_endpoint_descriptor nepd;
60   struct usb_interface_descriptor ifdd;
61   struct usb_endpoint_descriptor iepd;
62   struct usb_endpoint_descriptor oepd;
63 } __packed;
64 
65 /* Device descriptor */
66 
67 struct rndis_hs_function_descriptor
68 {
69   struct usb_interface_assoc_descriptor ifcad;
70   struct usb_interface_descriptor ifcd;
71   struct usb_cdc_header_desc cdc_desc;
72   struct usb_cdc_call_mgmt_descriptor cdc_call_desc;
73   struct usb_cdc_acm_descriptor cdc_acm_desc;
74   struct usb_cdc_union_desc cdc_union_desc;
75   struct usb_endpoint_descriptor nepd;
76 #ifdef LOSCFG_DRIVERS_USB3_DEVICE_CONTROLLER
77   struct usb_endpoint_ss_comp_descriptor ncompd;
78 #endif
79   struct usb_interface_descriptor ifdd;
80   struct usb_endpoint_descriptor iepd;
81 #ifdef LOSCFG_DRIVERS_USB3_DEVICE_CONTROLLER
82   struct usb_endpoint_ss_comp_descriptor icompd;
83 #endif
84   struct usb_endpoint_descriptor oepd;
85 #ifdef LOSCFG_DRIVERS_USB3_DEVICE_CONTROLLER
86   struct usb_endpoint_ss_comp_descriptor ocompd;
87 #endif
88 } __packed;
89 
90 struct rndis_hs_descriptor
91 {
92   struct usb_config_descriptor        *rndis_config;
93   struct rndis_hs_function_descriptor *rndis_func;
94 };
95 
96 extern void rndis_get_composite_devdesc(struct composite_devdesc_s *dev);
97 extern void eth_rx(struct los_eth_driver *sc, const struct usbdev_req_s *req);
98 extern void netdev_register(struct los_eth_driver *sc);
99 extern void netdev_unregister(struct los_eth_driver *sc);
100 extern void eth_random_addr(uint8_t *addr);
101 
102 #ifdef __cplusplus
103 #if __cplusplus
104 }
105 #endif /* __cplusplus */
106 #endif /* __cplusplus */
107 
108 #endif
109