usbd_rndis.h
Go to the documentation of this file.
1 /**
2  * @file usbd_rndis.h
3  * @brief USB RNDIS class
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _USB_RNDIS_H
32 #define _USB_RNDIS_H
33 
34 //Dependencies
35 #include "usbd_ioreq.h"
36 
37 //USB endpoints
38 #define RNDIS_NOTIFICATION_EP 0x81
39 #define RNDIS_DATA_IN_EP 0x82
40 #define RNDIS_DATA_OUT_EP 0x03
41 
42 //Endpoint maximum packet size
43 #define RNDIS_NOTIFICATION_EP_MPS 64
44 #define RNDIS_DATA_IN_EP_MPS_FS 64
45 #define RNDIS_DATA_OUT_EP_MPS_FS 64
46 #define RNDIS_DATA_IN_EP_MPS_HS 512
47 #define RNDIS_DATA_OUT_EP_MPS_HS 512
48 
49 //RNDIS Class specific requests
50 #define RNDIS_SEND_ENCAPSULATED_COMMAND 0x00
51 #define RNDIS_GET_ENCAPSULATED_RESPONSE 0x01
52 
53 //Global variables
54 extern USBD_HandleTypeDef USBD_Device;
55 extern USBD_ClassTypeDef usbdRndisClass;
56 #define USBD_RNDIS_CLASS &usbdRndisClass
57 
58 //RNDIS related functions
59 uint8_t usbdRndisInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
60 uint8_t usbdRndisDeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
61 uint8_t usbdRndisSetup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
62 uint8_t usbdRndisEp0RxReady(USBD_HandleTypeDef *pdev);
63 uint8_t usbdRndisDataIn(USBD_HandleTypeDef *pdev, uint8_t epnum);
64 uint8_t usbdRndisDataOut(USBD_HandleTypeDef *pdev, uint8_t epnum);
65 uint8_t *usbdRndisGetHighSpeedConfigDesc(uint16_t *length);
66 uint8_t *usbdRndisGetFullSpeedConfigDesc(uint16_t *length);
67 uint8_t *usbdRndisGetOtherSpeedConfigDesc(uint16_t *length);
68 uint8_t *usbdRndisGetDeviceQualifierDesc(uint16_t *length);
69 
70 #endif
uint8_t length
Definition: tcp.h:368
uint8_t usbdRndisEp0RxReady(USBD_HandleTypeDef *pdev)
Handle data stage (control endpoint)
Definition: usbd_rndis.c:266
uint8_t usbdRndisSetup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
Process incoming setup request.
Definition: usbd_rndis.c:169
uint8_t usbdRndisDataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
DATA IN callback.
Definition: usbd_rndis.c:292
uint8_t usbdRndisInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
RNDIS class initialization.
Definition: usbd_rndis.c:83
USBD_HandleTypeDef USBD_Device
uint8_t usbdRndisDeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
RNDIS class de-initialization.
Definition: usbd_rndis.c:142
uint8_t * usbdRndisGetFullSpeedConfigDesc(uint16_t *length)
Retrieve configuration descriptor (full speed)
Definition: usbd_rndis.c:442
uint8_t usbdRndisDataOut(USBD_HandleTypeDef *pdev, uint8_t epnum)
DATA OUT callback.
Definition: usbd_rndis.c:337
uint8_t * usbdRndisGetDeviceQualifierDesc(uint16_t *length)
Retrieve device qualifier descriptor.
Definition: usbd_rndis.c:470
uint8_t * usbdRndisGetHighSpeedConfigDesc(uint16_t *length)
Retrieve configuration descriptor (high speed)
Definition: usbd_rndis.c:428
USBD_ClassTypeDef usbdRndisClass
RNDIS class callbacks.
Definition: usbd_rndis.c:57
uint8_t * usbdRndisGetOtherSpeedConfigDesc(uint16_t *length)
Retrieve configuration descriptor (other speed)
Definition: usbd_rndis.c:456