| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
RNDISClassHost.h
Go to the documentation of this file.
1 /*
2 * @brief Host mode driver for the library USB RNDIS Class driver
3 *
4 * @note
5 * Copyright(C) NXP Semiconductors, 2012
6 * Copyright(C) Dean Camera, 2011, 2012
7 * All rights reserved.
8 *
9 * @par
10 * Software that is described herein is for illustrative purposes only
11 * which provides customers with programming information regarding the
12 * LPC products. This software is supplied "AS IS" without any warranties of
13 * any kind, and NXP Semiconductors and its licensor disclaim any and
14 * all warranties, express or implied, including all implied warranties of
15 * merchantability, fitness for a particular purpose and non-infringement of
16 * intellectual property rights. NXP Semiconductors assumes no responsibility
17 * or liability for the use of the software, conveys no license or rights under any
18 * patent, copyright, mask work right, or any other intellectual property rights in
19 * or to any products. NXP Semiconductors reserves the right to make changes
20 * in the software without notification. NXP Semiconductors also makes no
21 * representation or warranty that such application will be suitable for the
22 * specified use without further testing or modification.
23 *
24 * @par
25 * Permission to use, copy, modify, and distribute this software and its
26 * documentation is hereby granted, under NXP Semiconductors' and its
27 * licensor's relevant copyrights in the software, without fee, provided that it
28 * is used in conjunction with NXP Semiconductors microcontrollers. This
29 * copyright, permission, and disclaimer notice must appear in all copies of
30 * this code.
31 */
32
47 #ifndef __RNDIS_CLASS_HOST_H__
48 #define __RNDIS_CLASS_HOST_H__
49
50 /* Includes: */
51 #include "../../USB.h"
52 #include "../Common/RNDISClassCommon.h"
53
54 /* Enable C linkage for C++ Compilers: */
55 #if defined(__cplusplus)
56 extern "C" {
57 #endif
58
59 /* Preprocessor Checks: */
60 #if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
61 #error Do not include this file directly. Include LPCUSBlib/Drivers/USB.h instead.
62 #endif
63
64 /* Public Interface - May be used in end-application: */
65 /* Type Defines: */
72 typedef struct
73 {
74 const struct
75 {
76 uint8_t DataINPipeNumber;
77 bool DataINPipeDoubleBank;
79 uint8_t DataOUTPipeNumber;
80 bool DataOUTPipeDoubleBank;
82 uint8_t NotificationPipeNumber;
83 bool NotificationPipeDoubleBank;
85 uint32_t HostMaxPacketSize;
86 uint8_t PortNumber;
88 } Config;
91 struct
92 {
93 bool IsActive;
97 uint8_t ControlInterfaceNumber;
99 uint16_t DataINPipeSize;
100 uint16_t DataOUTPipeSize;
101 uint16_t NotificationPipeSize;
103 uint32_t DeviceMaxPacketSize;
105 uint32_t RequestID;
106 } State;
110 } USB_ClassInfo_RNDIS_Host_t;
111
112 /* Enums: */
114 enum RNDIS_Host_EnumerationFailure_ErrorCodes_t
115 {
116 RNDIS_ENUMERROR_NoError = 0,
117 RNDIS_ENUMERROR_InvalidConfigDescriptor = 1,
118 RNDIS_ENUMERROR_NoCompatibleInterfaceFound = 2,
119 RNDIS_ENUMERROR_PipeConfigurationFailed = 3,
120 };
121
122 /* Function Prototypes: */
135 uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
136 uint16_t ConfigDescriptorSize,
137 void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
138
147 uint8_t RNDIS_Host_SendKeepAlive(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
148
157 uint8_t RNDIS_Host_InitializeDevice(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
158
169 uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
170 const uint32_t Oid,
171 void* Buffer,
172 const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
173
184 uint8_t RNDIS_Host_QueryRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
185 const uint32_t Oid,
186 void* Buffer,
187 const uint16_t MaxLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
188
198 bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
199
212 uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
213 void* Buffer,
214 uint16_t* const PacketLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2)
215 ATTR_NON_NULL_PTR_ARG(3);
216
228 uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
229 void* Buffer,
230 const uint16_t PacketLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
231
232 /* Inline Functions: */
239 static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
240 static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo)
241 {
242 (void)RNDISInterfaceInfo;
243 }
244
245 /* Private Interface - For use in library only: */
246 #if !defined(__DOXYGEN__)
247 /* Function Prototypes: */
248 #if defined(__INCLUDE_FROM_RNDIS_HOST_C)
249 static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
250 void* Buffer,
251 const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1)
252 ATTR_NON_NULL_PTR_ARG(2);
253 static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
254 void* Buffer,
255 const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1)
256 ATTR_NON_NULL_PTR_ARG(2);
257
258 static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDescriptor)
259 ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
260 static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescriptor)
261 ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
262 static uint8_t DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDescriptor)
263 ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
264 #endif
265 #endif
266
267 /* Disable C linkage for C++ Compilers: */
268 #if defined(__cplusplus)
269 }
270 #endif
271
272 #endif
273