| 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
RNDISClassCommon.h
Go to the documentation of this file.
1 /*
2 * @brief Common definitions and declarations 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
43 #ifndef _RNDIS_CLASS_COMMON_H_
44 #define _RNDIS_CLASS_COMMON_H_
45
46 /* Macros: */
47 #define __INCLUDE_FROM_CDC_DRIVER
48
49 /* Includes: */
50 #include "../../Core/StdDescriptors.h"
51 #include "CDCClassCommon.h"
52
53 /* Enable C linkage for C++ Compilers: */
54 #if defined(__cplusplus)
55 extern "C" {
56 #endif
57
58 /* Preprocessor Checks: */
59 #if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
60 #error Do not include this file directly. Include LPCUSBlib/Drivers/USB.h instead.
61 #endif
62
63 /* Macros: */
65 #define RNDIS_ERROR_LOGICAL_CMD_FAILED 0x80
66
68 #define REMOTE_NDIS_VERSION_MAJOR 0x01
69
71 #define REMOTE_NDIS_VERSION_MINOR 0x00
72
75 #define REMOTE_NDIS_PACKET_MSG 0x00000001UL
76 #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002UL
77 #define REMOTE_NDIS_HALT_MSG 0x00000003UL
78 #define REMOTE_NDIS_QUERY_MSG 0x00000004UL
79 #define REMOTE_NDIS_SET_MSG 0x00000005UL
80 #define REMOTE_NDIS_RESET_MSG 0x00000006UL
81 #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007UL
82 #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008UL
83
84
87 #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002UL
88 #define REMOTE_NDIS_QUERY_CMPLT 0x80000004UL
89 #define REMOTE_NDIS_SET_CMPLT 0x80000005UL
90 #define REMOTE_NDIS_RESET_CMPLT 0x80000006UL
91 #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008UL
92
93
96 #define REMOTE_NDIS_STATUS_SUCCESS 0x00000000UL
97 #define REMOTE_NDIS_STATUS_FAILURE 0xC0000001UL
98 #define REMOTE_NDIS_STATUS_INVALID_DATA 0xC0010015UL
99 #define REMOTE_NDIS_STATUS_NOT_SUPPORTED 0xC00000BBUL
100 #define REMOTE_NDIS_STATUS_MEDIA_CONNECT 0x4001000BUL
101 #define REMOTE_NDIS_STATUS_MEDIA_DISCONNECT 0x4001000CUL
102
103
106 #define REMOTE_NDIS_MEDIA_STATE_CONNECTED 0x00000000UL
107 #define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL
108
109
110 #define REMOTE_NDIS_MEDIUM_802_3 0x00000000UL
111
114 #define REMOTE_NDIS_DF_CONNECTIONLESS 0x00000001UL
115 #define REMOTE_NDIS_DF_CONNECTION_ORIENTED 0x00000002UL
116
117
120 #define REMOTE_NDIS_PACKET_DIRECTED 0x00000001UL
121 #define REMOTE_NDIS_PACKET_MULTICAST 0x00000002UL
122 #define REMOTE_NDIS_PACKET_ALL_MULTICAST 0x00000004UL
123 #define REMOTE_NDIS_PACKET_BROADCAST 0x00000008UL
124 #define REMOTE_NDIS_PACKET_SOURCE_ROUTING 0x00000010UL
125 #define REMOTE_NDIS_PACKET_PROMISCUOUS 0x00000020UL
126 #define REMOTE_NDIS_PACKET_SMT 0x00000040UL
127 #define REMOTE_NDIS_PACKET_ALL_LOCAL 0x00000080UL
128 #define REMOTE_NDIS_PACKET_GROUP 0x00001000UL
129 #define REMOTE_NDIS_PACKET_ALL_FUNCTIONAL 0x00002000UL
130 #define REMOTE_NDIS_PACKET_FUNCTIONAL 0x00004000UL
131 #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
132
133
136 #define OID_GEN_SUPPORTED_LIST 0x00010101UL
137 #define OID_GEN_HARDWARE_STATUS 0x00010102UL
138 #define OID_GEN_MEDIA_SUPPORTED 0x00010103UL
139 #define OID_GEN_MEDIA_IN_USE 0x00010104UL
140 #define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106UL
141 #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL
142 #define OID_GEN_LINK_SPEED 0x00010107UL
143 #define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010AUL
144 #define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010BUL
145 #define OID_GEN_VENDOR_ID 0x0001010CUL
146 #define OID_GEN_VENDOR_DESCRIPTION 0x0001010DUL
147 #define OID_GEN_CURRENT_PACKET_FILTER 0x0001010EUL
148 #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL
149 #define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114UL
150 #define OID_GEN_PHYSICAL_MEDIUM 0x00010202UL
151 #define OID_GEN_XMIT_OK 0x00020101UL
152 #define OID_GEN_RCV_OK 0x00020102UL
153 #define OID_GEN_XMIT_ERROR 0x00020103UL
154 #define OID_GEN_RCV_ERROR 0x00020104UL
155 #define OID_GEN_RCV_NO_BUFFER 0x00020105UL
156 #define OID_802_3_PERMANENT_ADDRESS 0x01010101UL
157 #define OID_802_3_CURRENT_ADDRESS 0x01010102UL
158 #define OID_802_3_MULTICAST_LIST 0x01010103UL
159 #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104UL
160 #define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101UL
161 #define OID_802_3_XMIT_ONE_COLLISION 0x01020102UL
162 #define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL
163
164
166 #define RNDIS_MESSAGE_BUFFER_SIZE 128
167
169 #define ETHERNET_FRAME_SIZE_MAX 1500
170
171 /* Enums: */
173 enum RNDIS_ClassRequests_t
174 {
175 RNDIS_REQ_SendEncapsulatedCommand = 0x00,
176 RNDIS_REQ_GetEncapsulatedResponse = 0x01,
177 };
178
180 enum RNDIS_States_t
181 {
182 RNDIS_Uninitialized = 0,
183 RNDIS_Initialized = 1,
184 RNDIS_Data_Initialized = 2,
185 };
186
188 enum RNDIS_ClassNotifications_t
189 {
190 RNDIS_NOTIF_ResponseAvailable = 0x01,
191 };
192
194 enum NDIS_Hardware_Status_t
195 {
196 NDIS_HardwareStatus_Ready,
197 NDIS_HardwareStatus_Initializing,
198 NDIS_HardwareStatus_Reset,
199 NDIS_HardwareStatus_Closing,
200 NDIS_HardwareStatus_NotReady
201 };
202
203 /* Type Defines: */
208 typedef ATTR_IAR_PACKED struct
209 {
210 uint8_t Octets[6];
211 } ATTR_PACKED MAC_Address_t;
212
219 typedef ATTR_IAR_PACKED struct
220 {
221 uint32_t MessageType;
222 uint32_t MessageLength;
223 } ATTR_PACKED RNDIS_Message_Header_t;
224
231 typedef ATTR_IAR_PACKED struct
232 {
233 uint32_t MessageType;
234 uint32_t MessageLength;
235 uint32_t DataOffset;
236 uint32_t DataLength;
237 uint32_t OOBDataOffset;
238 uint32_t OOBDataLength;
239 uint32_t NumOOBDataElements;
240 uint32_t PerPacketInfoOffset;
241 uint32_t PerPacketInfoLength;
242 uint32_t VcHandle;
243 uint32_t Reserved;
244 } ATTR_PACKED RNDIS_Packet_Message_t;
245
252 typedef ATTR_IAR_PACKED struct
253 {
254 uint32_t MessageType;
255 uint32_t MessageLength;
256 uint32_t RequestId;
257
258 uint32_t MajorVersion;
259 uint32_t MinorVersion;
260 uint32_t MaxTransferSize;
261 } ATTR_PACKED RNDIS_Initialize_Message_t;
262
269 typedef ATTR_IAR_PACKED struct
270 {
271 uint32_t MessageType;
272 uint32_t MessageLength;
273 uint32_t RequestId;
274 uint32_t Status;
275
276 uint32_t MajorVersion;
277 uint32_t MinorVersion;
278 uint32_t DeviceFlags;
279 uint32_t Medium;
280 uint32_t MaxPacketsPerTransfer;
281 uint32_t MaxTransferSize;
282 uint32_t PacketAlignmentFactor;
283 uint32_t AFListOffset;
284 uint32_t AFListSize;
285 } ATTR_PACKED RNDIS_Initialize_Complete_t;
286
293 typedef ATTR_IAR_PACKED struct
294 {
295 uint32_t MessageType;
296 uint32_t MessageLength;
297 uint32_t RequestId;
298 } ATTR_PACKED RNDIS_KeepAlive_Message_t;
299
306 typedef ATTR_IAR_PACKED struct
307 {
308 uint32_t MessageType;
309 uint32_t MessageLength;
310 uint32_t RequestId;
311 uint32_t Status;
312 } ATTR_PACKED RNDIS_KeepAlive_Complete_t;
313
320 typedef ATTR_IAR_PACKED struct
321 {
322 uint32_t MessageType;
323 uint32_t MessageLength;
324 uint32_t Status;
325
326 uint32_t AddressingReset;
327 } ATTR_PACKED RNDIS_Reset_Complete_t;
328
335 typedef ATTR_IAR_PACKED struct
336 {
337 uint32_t MessageType;
338 uint32_t MessageLength;
339 uint32_t RequestId;
340
341 uint32_t Oid;
342 uint32_t InformationBufferLength;
343 uint32_t InformationBufferOffset;
344 uint32_t DeviceVcHandle;
345 } ATTR_PACKED RNDIS_Set_Message_t;
346
353 typedef ATTR_IAR_PACKED struct
354 {
355 uint32_t MessageType;
356 uint32_t MessageLength;
357 uint32_t RequestId;
358 uint32_t Status;
359 } ATTR_PACKED RNDIS_Set_Complete_t;
360
367 typedef ATTR_IAR_PACKED struct
368 {
369 uint32_t MessageType;
370 uint32_t MessageLength;
371 uint32_t RequestId;
372
373 uint32_t Oid;
374 uint32_t InformationBufferLength;
375 uint32_t InformationBufferOffset;
376 uint32_t DeviceVcHandle;
377 } ATTR_PACKED RNDIS_Query_Message_t;
378
385 typedef ATTR_IAR_PACKED struct
386 {
387 uint32_t MessageType;
388 uint32_t MessageLength;
389 uint32_t RequestId;
390 uint32_t Status;
391
392 uint32_t InformationBufferLength;
393 uint32_t InformationBufferOffset;
394 } ATTR_PACKED RNDIS_Query_Complete_t;
395
396 /* Disable C linkage for C++ Compilers: */
397 #if defined(__cplusplus)
398 }
399 #endif
400
401 #endif
402