3 Copyright (C) Dean Camera, 2010.
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
10 Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
33 * Header file for RNDISCommands.c.
36 #ifndef _RNDIS_COMMANDS_H_
37 #define _RNDIS_COMMANDS_H_
44 #include <LUFA/Drivers/USB/USB.h>
46 #include "RNDISConstants.h"
47 #include "../RNDISEthernetHost.h"
50 /** Type define for a RNDIS message header, sent before RNDIS messages. */
53 uint32_t MessageType
; /**< RNDIS message type, a REMOTE_NDIS_*_MSG constant */
54 uint32_t MessageLength
; /**< Total length of the RNDIS message, in bytes */
55 } RNDIS_Message_Header_t
;
57 /** Type define for a RNDIS packet message, used to encapsulate Ethernet packets sent to and from the adapter. */
61 uint32_t MessageLength
;
64 uint32_t OOBDataOffset
;
65 uint32_t OOBDataLength
;
66 uint32_t NumOOBDataElements
;
67 uint32_t PerPacketInfoOffset
;
68 uint32_t PerPacketInfoLength
;
71 } RNDIS_Packet_Message_t
;
73 /** Type define for a RNDIS Initialize command message. */
77 uint32_t MessageLength
;
80 uint32_t MajorVersion
;
81 uint32_t MinorVersion
;
82 uint32_t MaxTransferSize
;
83 } RNDIS_Initialize_Message_t
;
85 /** Type define for a RNDIS Initialize complete response message. */
89 uint32_t MessageLength
;
93 uint32_t MajorVersion
;
94 uint32_t MinorVersion
;
97 uint32_t MaxPacketsPerTransfer
;
98 uint32_t MaxTransferSize
;
99 uint32_t PacketAlignmentFactor
;
100 uint32_t AFListOffset
;
102 } RNDIS_Initialize_Complete_t
;
104 /** Type define for a RNDIS Keep-alive command message. */
107 uint32_t MessageType
;
108 uint32_t MessageLength
;
110 } RNDIS_KeepAlive_Message_t
;
112 /** Type define for a RNDIS Keep-alive complete message. */
115 uint32_t MessageType
;
116 uint32_t MessageLength
;
119 } RNDIS_KeepAlive_Complete_t
;
121 /** Type define for a RNDIS Reset complete message. */
124 uint32_t MessageType
;
125 uint32_t MessageLength
;
128 uint32_t AddressingReset
;
129 } RNDIS_Reset_Complete_t
;
131 /** Type define for a RNDIS Set command message. */
134 uint32_t MessageType
;
135 uint32_t MessageLength
;
139 uint32_t InformationBufferLength
;
140 uint32_t InformationBufferOffset
;
141 uint32_t DeviceVcHandle
;
142 } RNDIS_Set_Message_t
;
144 /** Type define for a RNDIS Set complete response message. */
147 uint32_t MessageType
;
148 uint32_t MessageLength
;
151 } RNDIS_Set_Complete_t
;
153 /** Type define for a RNDIS Query command message. */
156 uint32_t MessageType
;
157 uint32_t MessageLength
;
161 uint32_t InformationBufferLength
;
162 uint32_t InformationBufferOffset
;
163 uint32_t DeviceVcHandle
;
164 } RNDIS_Query_Message_t
;
166 /** Type define for a RNDIS Query complete response message. */
169 uint32_t MessageType
;
170 uint32_t MessageLength
;
174 uint32_t InformationBufferLength
;
175 uint32_t InformationBufferOffset
;
176 } RNDIS_Query_Complete_t
;
179 /** RNDIS request to issue a host-to-device NDIS command. */
180 #define REQ_SendEncapsulatedCommand 0x00
182 /** RNDIS request to issue a device-to-host NDIS response. */
183 #define REQ_GetEncapsulatedResponse 0x01
185 /** Implemented RNDIS Version Major. */
186 #define REMOTE_NDIS_VERSION_MAJOR 0x01
188 /** Implemented RNDIS Version Minor. */
189 #define REMOTE_NDIS_VERSION_MINOR 0x00
191 /** Additional error code for RNDIS functions when a device returns a logical command failure. */
192 #define RNDIS_COMMAND_FAILED 0xC0
194 /* Function Prototypes: */
195 uint8_t RNDIS_SendEncapsulatedCommand(void* const Buffer
,
196 const uint16_t Length
);
197 uint8_t RNDIS_GetEncapsulatedResponse(void* const Buffer
,
198 const uint16_t Length
);
200 uint8_t RNDIS_SendKeepAlive(void);
201 uint8_t RNDIS_InitializeDevice(const uint16_t HostMaxPacketSize
,
202 uint16_t* const DeviceMaxPacketSize
);
203 uint8_t RNDIS_SetRNDISProperty(const uint32_t Oid
,
205 const uint16_t Length
);
206 uint8_t RNDIS_QueryRNDISProperty(const uint32_t Oid
,
208 const uint16_t MaxLength
);
209 uint8_t RNDIS_GetPacketLength(uint16_t* const PacketLength
);