Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
35bdada2
Commit
35bdada2
authored
Jun 19, 2009
by
Dean Camera
Browse files
Clean up RNDIS demo type define names.
parent
feabfd12
Changes
9
Hide whitespace changes
Inline
Side-by-side
Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c
View file @
35bdada2
...
...
@@ -82,7 +82,7 @@ static const uint32_t PROGMEM AdapterSupportedOIDList[] =
* Supported OID list, plus the response header. The buffer is half-duplex, and is written to as it is read to save on SRAM - for this
* reason, care must be taken when constructing RNDIS responses that unread data is not overwritten when writing in responses.
*/
uint8_t
RNDISMessageBuffer
[
sizeof
(
AdapterSupportedOIDList
)
+
sizeof
(
RNDIS_Q
UERY_CMPLT
_t
)];
uint8_t
RNDISMessageBuffer
[
sizeof
(
AdapterSupportedOIDList
)
+
sizeof
(
RNDIS_Q
uery_Complete
_t
)];
/** Pointer to the RNDIS message header at the top of the RNDIS message buffer, for convenience. */
RNDIS_Message_Header_t
*
MessageHeader
=
(
RNDIS_Message_Header_t
*
)
&
RNDISMessageBuffer
;
...
...
@@ -112,11 +112,11 @@ void ProcessRNDISControlMessage(void)
ResponseReady
=
true
;
RNDIS_I
NITIALIZE_MSG
_t
*
INITIALIZE_Message
=
(
RNDIS_I
NITIALIZE_MSG
_t
*
)
&
RNDISMessageBuffer
;
RNDIS_I
NITIALIZE_CMPLT
_t
*
INITIALIZE_Response
=
(
RNDIS_I
NITIALIZE_CMPLT
_t
*
)
&
RNDISMessageBuffer
;
RNDIS_I
nitialize_Message
_t
*
INITIALIZE_Message
=
(
RNDIS_I
nitialize_Message
_t
*
)
&
RNDISMessageBuffer
;
RNDIS_I
nitialize_Complete
_t
*
INITIALIZE_Response
=
(
RNDIS_I
nitialize_Complete
_t
*
)
&
RNDISMessageBuffer
;
INITIALIZE_Response
->
MessageType
=
REMOTE_NDIS_INITIALIZE_CMPLT
;
INITIALIZE_Response
->
MessageLength
=
sizeof
(
RNDIS_I
NITIALIZE_CMPLT
_t
);
INITIALIZE_Response
->
MessageLength
=
sizeof
(
RNDIS_I
nitialize_Complete
_t
);
INITIALIZE_Response
->
RequestId
=
INITIALIZE_Message
->
RequestId
;
INITIALIZE_Response
->
Status
=
REMOTE_NDIS_STATUS_SUCCESS
;
...
...
@@ -125,7 +125,7 @@ void ProcessRNDISControlMessage(void)
INITIALIZE_Response
->
DeviceFlags
=
REMOTE_NDIS_DF_CONNECTIONLESS
;
INITIALIZE_Response
->
Medium
=
REMOTE_NDIS_MEDIUM_802_3
;
INITIALIZE_Response
->
MaxPacketsPerTransfer
=
1
;
INITIALIZE_Response
->
MaxTransferSize
=
(
sizeof
(
RNDIS_P
ACKET_MSG
_t
)
+
ETHERNET_FRAME_SIZE_MAX
);
INITIALIZE_Response
->
MaxTransferSize
=
(
sizeof
(
RNDIS_P
acket_Message
_t
)
+
ETHERNET_FRAME_SIZE_MAX
);
INITIALIZE_Response
->
PacketAlignmentFactor
=
0
;
INITIALIZE_Response
->
AFListOffset
=
0
;
INITIALIZE_Response
->
AFListSize
=
0
;
...
...
@@ -147,17 +147,17 @@ void ProcessRNDISControlMessage(void)
ResponseReady
=
true
;
RNDIS_Q
UERY_MSG
_t
*
QUERY_Message
=
(
RNDIS_Q
UERY_MSG
_t
*
)
&
RNDISMessageBuffer
;
RNDIS_Q
UERY_CMPLT
_t
*
QUERY_Response
=
(
RNDIS_Q
UERY_CMPLT
_t
*
)
&
RNDISMessageBuffer
;
uint32_t
Query_Oid
=
QUERY_Message
->
Oid
;
RNDIS_Q
uery_Message
_t
*
QUERY_Message
=
(
RNDIS_Q
uery_Message
_t
*
)
&
RNDISMessageBuffer
;
RNDIS_Q
uery_Complete
_t
*
QUERY_Response
=
(
RNDIS_Q
uery_Complete
_t
*
)
&
RNDISMessageBuffer
;
uint32_t
Query_Oid
=
QUERY_Message
->
Oid
;
void
*
QueryData
=
&
RNDISMessageBuffer
[
sizeof
(
RNDIS_Message_Header_t
)
+
QUERY_Message
->
InformationBufferOffset
];
void
*
ResponseData
=
&
RNDISMessageBuffer
[
sizeof
(
RNDIS_Q
UERY_CMPLT
_t
)];
void
*
ResponseData
=
&
RNDISMessageBuffer
[
sizeof
(
RNDIS_Q
uery_Complete
_t
)];
uint16_t
ResponseSize
;
QUERY_Response
->
MessageType
=
REMOTE_NDIS_QUERY_CMPLT
;
QUERY_Response
->
MessageLength
=
sizeof
(
RNDIS_Q
UERY_CMPLT
_t
);
QUERY_Response
->
MessageLength
=
sizeof
(
RNDIS_Q
uery_Complete
_t
);
if
(
ProcessNDISQuery
(
Query_Oid
,
QueryData
,
QUERY_Message
->
InformationBufferLength
,
ResponseData
,
&
ResponseSize
))
...
...
@@ -166,7 +166,7 @@ void ProcessRNDISControlMessage(void)
QUERY_Response
->
MessageLength
+=
ResponseSize
;
QUERY_Response
->
InformationBufferLength
=
ResponseSize
;
QUERY_Response
->
InformationBufferOffset
=
(
sizeof
(
RNDIS_Q
UERY_CMPLT
_t
)
-
sizeof
(
RNDIS_Message_Header_t
));
QUERY_Response
->
InformationBufferOffset
=
(
sizeof
(
RNDIS_Q
uery_Complete
_t
)
-
sizeof
(
RNDIS_Message_Header_t
));
}
else
{
...
...
@@ -182,12 +182,12 @@ void ProcessRNDISControlMessage(void)
ResponseReady
=
true
;
RNDIS_S
ET_MSG
_t
*
SET_Message
=
(
RNDIS_S
ET_MSG
_t
*
)
&
RNDISMessageBuffer
;
RNDIS_S
ET_CMPLT
_t
*
SET_Response
=
(
RNDIS_S
ET_CMPLT
_t
*
)
&
RNDISMessageBuffer
;
uint32_t
SET_Oid
=
SET_Message
->
Oid
;
RNDIS_S
et_Message
_t
*
SET_Message
=
(
RNDIS_S
et_Message
_t
*
)
&
RNDISMessageBuffer
;
RNDIS_S
et_Complete
_t
*
SET_Response
=
(
RNDIS_S
et_Complete
_t
*
)
&
RNDISMessageBuffer
;
uint32_t
SET_Oid
=
SET_Message
->
Oid
;
SET_Response
->
MessageType
=
REMOTE_NDIS_SET_CMPLT
;
SET_Response
->
MessageLength
=
sizeof
(
RNDIS_S
ET_CMPLT
_t
);
SET_Response
->
MessageLength
=
sizeof
(
RNDIS_S
et_Complete
_t
);
SET_Response
->
RequestId
=
SET_Message
->
RequestId
;
void
*
SetData
=
&
RNDISMessageBuffer
[
sizeof
(
RNDIS_Message_Header_t
)
+
...
...
@@ -204,10 +204,10 @@ void ProcessRNDISControlMessage(void)
ResponseReady
=
true
;
RNDIS_R
ESET_CMPLT
_t
*
RESET_Response
=
(
RNDIS_R
ESET_CMPLT
_t
*
)
&
RNDISMessageBuffer
;
RNDIS_R
eset_Complete
_t
*
RESET_Response
=
(
RNDIS_R
eset_Complete
_t
*
)
&
RNDISMessageBuffer
;
RESET_Response
->
MessageType
=
REMOTE_NDIS_RESET_CMPLT
;
RESET_Response
->
MessageLength
=
sizeof
(
RNDIS_R
ESET_CMPLT
_t
);
RESET_Response
->
MessageLength
=
sizeof
(
RNDIS_R
eset_Complete
_t
);
RESET_Response
->
Status
=
REMOTE_NDIS_STATUS_SUCCESS
;
RESET_Response
->
AddressingReset
=
0
;
...
...
@@ -217,11 +217,11 @@ void ProcessRNDISControlMessage(void)
ResponseReady
=
true
;
RNDIS_K
EEPALIVE_MSG
_t
*
KEEPALIVE_Message
=
(
RNDIS_K
EEPALIVE_MSG
_t
*
)
&
RNDISMessageBuffer
;
RNDIS_K
EEPALIVE_CMPLT
_t
*
KEEPALIVE_Response
=
(
RNDIS_K
EEPALIVE_CMPLT
_t
*
)
&
RNDISMessageBuffer
;
RNDIS_K
eepAlive_Message
_t
*
KEEPALIVE_Message
=
(
RNDIS_K
eepAlive_Message
_t
*
)
&
RNDISMessageBuffer
;
RNDIS_K
eepAlive_Complete
_t
*
KEEPALIVE_Response
=
(
RNDIS_K
eepAlive_Complete
_t
*
)
&
RNDISMessageBuffer
;
KEEPALIVE_Response
->
MessageType
=
REMOTE_NDIS_KEEPALIVE_CMPLT
;
KEEPALIVE_Response
->
MessageLength
=
sizeof
(
RNDIS_K
EEPALIVE_CMPLT
_t
);
KEEPALIVE_Response
->
MessageLength
=
sizeof
(
RNDIS_K
eepAlive_Complete
_t
);
KEEPALIVE_Response
->
RequestId
=
KEEPALIVE_Message
->
RequestId
;
KEEPALIVE_Response
->
Status
=
REMOTE_NDIS_STATUS_SUCCESS
;
...
...
Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h
View file @
35bdada2
...
...
@@ -101,7 +101,7 @@
uint32_t
PerPacketInfoLength
;
uint32_t
VcHandle
;
uint32_t
Reserved
;
}
RNDIS_P
ACKET_MSG
_t
;
}
RNDIS_P
acket_Message
_t
;
/** Type define for a RNDIS Initialize command message */
typedef
struct
...
...
@@ -113,7 +113,7 @@
uint32_t
MajorVersion
;
uint32_t
MinorVersion
;
uint32_t
MaxTransferSize
;
}
RNDIS_I
NITIALIZE_MSG
_t
;
}
RNDIS_I
nitialize_Message
_t
;
/** Type define for a RNDIS Initialize complete response message */
typedef
struct
...
...
@@ -132,7 +132,7 @@
uint32_t
PacketAlignmentFactor
;
uint32_t
AFListOffset
;
uint32_t
AFListSize
;
}
RNDIS_I
NITIALIZE_CMPLT
_t
;
}
RNDIS_I
nitialize_Complete
_t
;
/** Type define for a RNDIS Keepalive command message */
typedef
struct
...
...
@@ -140,7 +140,7 @@
uint32_t
MessageType
;
uint32_t
MessageLength
;
uint32_t
RequestId
;
}
RNDIS_K
EEPALIVE_MSG
_t
;
}
RNDIS_K
eepAlive_Message
_t
;
/** Type define for a RNDIS Keepalive complete message */
typedef
struct
...
...
@@ -149,7 +149,7 @@
uint32_t
MessageLength
;
uint32_t
RequestId
;
uint32_t
Status
;
}
RNDIS_K
EEPALIVE_CMPLT
_t
;
}
RNDIS_K
eepAlive_Complete
_t
;
/** Type define for a RNDIS Reset complete message */
typedef
struct
...
...
@@ -159,7 +159,7 @@
uint32_t
Status
;
uint32_t
AddressingReset
;
}
RNDIS_R
ESET_CMPLT
_t
;
}
RNDIS_R
eset_Complete
_t
;
/** Type define for a RNDIS Set command message */
typedef
struct
...
...
@@ -172,7 +172,7 @@
uint32_t
InformationBufferLength
;
uint32_t
InformationBufferOffset
;
uint32_t
DeviceVcHandle
;
}
RNDIS_S
ET_MSG
_t
;
}
RNDIS_S
et_Message
_t
;
/** Type define for a RNDIS Set complete response message */
typedef
struct
...
...
@@ -181,7 +181,7 @@
uint32_t
MessageLength
;
uint32_t
RequestId
;
uint32_t
Status
;
}
RNDIS_S
ET_CMPLT
_t
;
}
RNDIS_S
et_Complete
_t
;
/** Type define for a RNDIS Query command message */
typedef
struct
...
...
@@ -194,7 +194,7 @@
uint32_t
InformationBufferLength
;
uint32_t
InformationBufferOffset
;
uint32_t
DeviceVcHandle
;
}
RNDIS_Q
UERY_MSG
_t
;
}
RNDIS_Q
uery_Message
_t
;
/** Type define for a RNDIS Query complete response message */
typedef
struct
...
...
@@ -206,7 +206,7 @@
uint32_t
InformationBufferLength
;
uint32_t
InformationBufferOffset
;
}
RNDIS_Q
UERY_CMPLT
_t
;
}
RNDIS_Q
uery_Complete
_t
;
/* External Variables: */
extern
uint8_t
RNDISMessageBuffer
[];
...
...
Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c
View file @
35bdada2
...
...
@@ -214,7 +214,7 @@ void RNDIS_Task(void)
if
((
CurrRNDISState
==
RNDIS_Data_Initialized
)
&&
!
(
MessageHeader
->
MessageLength
))
{
/* Create a new packet header for reading/writing */
RNDIS_P
ACKET_MSG
_t
RNDISPacketHeader
;
RNDIS_P
acket_Message
_t
RNDISPacketHeader
;
/* Select the data OUT endpoint */
Endpoint_SelectEndpoint
(
CDC_RX_EPNUM
);
...
...
@@ -223,7 +223,7 @@ void RNDIS_Task(void)
if
(
Endpoint_IsOUTReceived
()
&&
!
(
FrameIN
.
FrameInBuffer
))
{
/* Read in the packet message header */
Endpoint_Read_Stream_LE
(
&
RNDISPacketHeader
,
sizeof
(
RNDIS_P
ACKET_MSG
_t
));
Endpoint_Read_Stream_LE
(
&
RNDISPacketHeader
,
sizeof
(
RNDIS_P
acket_Message
_t
));
/* Stall the request if the data is too large */
if
(
RNDISPacketHeader
.
DataLength
>
ETHERNET_FRAME_SIZE_MAX
)
...
...
@@ -252,16 +252,16 @@ void RNDIS_Task(void)
if
(
Endpoint_IsINReady
()
&&
FrameOUT
.
FrameInBuffer
)
{
/* Clear the packet header with all 0s so that the relevant fields can be filled */
memset
(
&
RNDISPacketHeader
,
0
,
sizeof
(
RNDIS_P
ACKET_MSG
_t
));
memset
(
&
RNDISPacketHeader
,
0
,
sizeof
(
RNDIS_P
acket_Message
_t
));
/* Construct the required packet header fields in the buffer */
RNDISPacketHeader
.
MessageType
=
REMOTE_NDIS_PACKET_MSG
;
RNDISPacketHeader
.
MessageLength
=
(
sizeof
(
RNDIS_P
ACKET_MSG
_t
)
+
FrameOUT
.
FrameLength
);
RNDISPacketHeader
.
DataOffset
=
(
sizeof
(
RNDIS_P
ACKET_MSG
_t
)
-
sizeof
(
RNDIS_Message_Header_t
));
RNDISPacketHeader
.
MessageLength
=
(
sizeof
(
RNDIS_P
acket_Message
_t
)
+
FrameOUT
.
FrameLength
);
RNDISPacketHeader
.
DataOffset
=
(
sizeof
(
RNDIS_P
acket_Message
_t
)
-
sizeof
(
RNDIS_Message_Header_t
));
RNDISPacketHeader
.
DataLength
=
FrameOUT
.
FrameLength
;
/* Send the packet header to the host */
Endpoint_Write_Stream_LE
(
&
RNDISPacketHeader
,
sizeof
(
RNDIS_P
ACKET_MSG
_t
));
Endpoint_Write_Stream_LE
(
&
RNDISPacketHeader
,
sizeof
(
RNDIS_P
acket_Message
_t
));
/* Send the Ethernet frame data to the host */
Endpoint_Write_Stream_LE
(
FrameOUT
.
FrameData
,
RNDISPacketHeader
.
DataLength
);
...
...
LUFA/Drivers/USB/Class/Common/CDC.h
View file @
35bdada2
...
...
@@ -123,7 +123,7 @@
/* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */
enum
CDCDevice_
CDC_LineCodingFormats_t
enum
CDC_LineCodingFormats_t
{
CDC_LINEENCODING_OneStopBit
=
0
,
/**< Each frame contains one stop bit */
CDC_LINEENCODING_OneAndAHalfStopBits
=
1
,
/**< Each frame contains one and a half stop bits */
...
...
@@ -131,7 +131,7 @@
};
/** Enum for the possible line encoding parity settings of a virtual serial port. */
enum
CDC
Device
_LineCodingParity_t
enum
CDC_LineCodingParity_t
{
CDC_PARITY_None
=
0
,
/**< No parity bit mode on each frame */
CDC_PARITY_Odd
=
1
,
/**< Odd parity bit mode on each frame */
...
...
LUFA/Drivers/USB/Class/Common/RNDIS.h
View file @
35bdada2
...
...
@@ -122,7 +122,7 @@
uint32_t
PerPacketInfoLength
;
uint32_t
VcHandle
;
uint32_t
Reserved
;
}
RNDIS_P
ACKET_MSG
_t
;
}
RNDIS_P
acket_Message
_t
;
/** Type define for a RNDIS Initialize command message */
typedef
struct
...
...
@@ -134,7 +134,7 @@
uint32_t
MajorVersion
;
uint32_t
MinorVersion
;
uint32_t
MaxTransferSize
;
}
RNDIS_I
NITIALIZE_MSG
_t
;
}
RNDIS_I
nitialize_Message
_t
;
/** Type define for a RNDIS Initialize complete response message */
typedef
struct
...
...
@@ -153,7 +153,7 @@
uint32_t
PacketAlignmentFactor
;
uint32_t
AFListOffset
;
uint32_t
AFListSize
;
}
RNDIS_I
NITIALIZE_CMPLT
_t
;
}
RNDIS_I
nitialize_Complete
_t
;
/** Type define for a RNDIS Keepalive command message */
typedef
struct
...
...
@@ -161,7 +161,7 @@
uint32_t
MessageType
;
uint32_t
MessageLength
;
uint32_t
RequestId
;
}
RNDIS_K
EEPALIVE_MSG
_t
;
}
RNDIS_K
eepAlive_Message
_t
;
/** Type define for a RNDIS Keepalive complete message */
typedef
struct
...
...
@@ -170,7 +170,7 @@
uint32_t
MessageLength
;
uint32_t
RequestId
;
uint32_t
Status
;
}
RNDIS_K
EEPALIVE_CMPLT
_t
;
}
RNDIS_K
eepAlive_Complete
_t
;
/** Type define for a RNDIS Reset complete message */
typedef
struct
...
...
@@ -180,7 +180,7 @@
uint32_t
Status
;
uint32_t
AddressingReset
;
}
RNDIS_R
ESET_CMPLT
_t
;
}
RNDIS_R
eset_Complete
_t
;
/** Type define for a RNDIS Set command message */
typedef
struct
...
...
@@ -193,7 +193,7 @@
uint32_t
InformationBufferLength
;
uint32_t
InformationBufferOffset
;
uint32_t
DeviceVcHandle
;
}
RNDIS_S
ET_MSG
_t
;
}
RNDIS_S
et_Message
_t
;
/** Type define for a RNDIS Set complete response message */
typedef
struct
...
...
@@ -202,7 +202,7 @@
uint32_t
MessageLength
;
uint32_t
RequestId
;
uint32_t
Status
;
}
RNDIS_S
ET_CMPLT
_t
;
}
RNDIS_S
et_Complete
_t
;
/** Type define for a RNDIS Query command message */
typedef
struct
...
...
@@ -215,7 +215,7 @@
uint32_t
InformationBufferLength
;
uint32_t
InformationBufferOffset
;
uint32_t
DeviceVcHandle
;
}
RNDIS_Q
UERY_MSG
_t
;
}
RNDIS_Q
uery_Message
_t
;
/** Type define for a RNDIS Query complete response message */
typedef
struct
...
...
@@ -227,7 +227,7 @@
uint32_t
InformationBufferLength
;
uint32_t
InformationBufferOffset
;
}
RNDIS_Q
UERY_CMPLT
_t
;
}
RNDIS_Q
uery_Complete
_t
;
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
...
...
LUFA/Drivers/USB/Class/Device/HID.h
View file @
35bdada2
...
...
@@ -71,7 +71,8 @@
{
bool
UsingReportProtocol
;
/**< Indicates if the HID interface is set to Boot or Report protocol mode */
uint16_t
IdleCount
;
/**< Report idle period, in ms, set by the host */
uint16_t
IdleMSRemaining
;
/**< Total number of ms remaining before the idle period elapses */
uint16_t
IdleMSRemaining
;
/**< Total number of ms remaining before the idle period elapsed - this should be
* decremented by the user application if non-zero each millisecond */
}
USB_ClassInfo_HID_Device_State_t
;
/** Class state structure. An instance of this structure should be made for each HID interface
...
...
LUFA/Drivers/USB/Class/Device/MIDI.h
View file @
35bdada2
...
...
@@ -69,7 +69,7 @@
/** Current State information structure for \ref USB_ClassInfo_MIDI_Device_t MIDI device interface structures. */
typedef
struct
{
// No state information for this class yet
}
USB_ClassInfo_MIDI_Device_State_t
;
/** Class state structure. An instance of this structure should be made for each MIDI interface
...
...
LUFA/Drivers/USB/Class/Device/MassStorage.h
View file @
35bdada2
...
...
@@ -70,11 +70,11 @@
/** Current State information structure for \ref USB_ClassInfo_MS_Device_t Mass Storage device interface structures. */
typedef
struct
{
CommandBlockWrapper_t
CommandBlock
;
/**< Mass Storage class command block structure,
used internally
* by the class driver
CommandBlockWrapper_t
CommandBlock
;
/**< Mass Storage class command block structure,
stores the received SCSI
* command from the host which is to be processed
*/
CommandStatusWrapper_t
CommandStatus
;
/**< Mass Storage class command status structure,
u
se
d internally
*
by
the
class driver
CommandStatusWrapper_t
CommandStatus
;
/**< Mass Storage class command status structure, se
t elements to indicate
* the
issued command's success or failure to the host
*/
bool
IsMassStoreReset
;
/**< Flag indicating that the host has requested that the Mass Storage interface be reset
...
...
LUFA/Drivers/USB/Class/Device/RNDIS.c
View file @
35bdada2
...
...
@@ -165,13 +165,13 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* RNDISInterfaceInfo)
if
((
RNDISInterfaceInfo
->
State
.
CurrRNDISState
==
RNDIS_Data_Initialized
)
&&
!
(
MessageHeader
->
MessageLength
))
{
RNDIS_P
ACKET_MSG
_t
RNDISPacketHeader
;
RNDIS_P
acket_Message
_t
RNDISPacketHeader
;
Endpoint_SelectEndpoint
(
RNDISInterfaceInfo
->
Config
.
DataOUTEndpointNumber
);
if
(
Endpoint_IsOUTReceived
()
&&
!
(
RNDISInterfaceInfo
->
State
.
FrameIN
.
FrameInBuffer
))
{
Endpoint_Read_Stream_LE
(
&
RNDISPacketHeader
,
sizeof
(
RNDIS_P
ACKET_MSG
_t
),
NO_STREAM_CALLBACK
);
Endpoint_Read_Stream_LE
(
&
RNDISPacketHeader
,
sizeof
(
RNDIS_P
acket_Message
_t
),
NO_STREAM_CALLBACK
);
if
(
RNDISPacketHeader
.
DataLength
>
ETHERNET_FRAME_SIZE_MAX
)
{
...
...
@@ -192,14 +192,14 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* RNDISInterfaceInfo)
if
(
Endpoint_IsINReady
()
&&
RNDISInterfaceInfo
->
State
.
FrameOUT
.
FrameInBuffer
)
{
memset
(
&
RNDISPacketHeader
,
0
,
sizeof
(
RNDIS_P
ACKET_MSG
_t
));
memset
(
&
RNDISPacketHeader
,
0
,
sizeof
(
RNDIS_P
acket_Message
_t
));
RNDISPacketHeader
.
MessageType
=
REMOTE_NDIS_PACKET_MSG
;
RNDISPacketHeader
.
MessageLength
=
(
sizeof
(
RNDIS_P
ACKET_MSG
_t
)
+
RNDISInterfaceInfo
->
State
.
FrameOUT
.
FrameLength
);
RNDISPacketHeader
.
DataOffset
=
(
sizeof
(
RNDIS_P
ACKET_MSG
_t
)
-
sizeof
(
RNDIS_Message_Header_t
));
RNDISPacketHeader
.
MessageLength
=
(
sizeof
(
RNDIS_P
acket_Message
_t
)
+
RNDISInterfaceInfo
->
State
.
FrameOUT
.
FrameLength
);
RNDISPacketHeader
.
DataOffset
=
(
sizeof
(
RNDIS_P
acket_Message
_t
)
-
sizeof
(
RNDIS_Message_Header_t
));
RNDISPacketHeader
.
DataLength
=
RNDISInterfaceInfo
->
State
.
FrameOUT
.
FrameLength
;
Endpoint_Write_Stream_LE
(
&
RNDISPacketHeader
,
sizeof
(
RNDIS_P
ACKET_MSG
_t
),
NO_STREAM_CALLBACK
);
Endpoint_Write_Stream_LE
(
&
RNDISPacketHeader
,
sizeof
(
RNDIS_P
acket_Message
_t
),
NO_STREAM_CALLBACK
);
Endpoint_Write_Stream_LE
(
RNDISInterfaceInfo
->
State
.
FrameOUT
.
FrameData
,
RNDISPacketHeader
.
DataLength
,
NO_STREAM_CALLBACK
);
Endpoint_ClearIN
();
...
...
@@ -220,11 +220,13 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
case
REMOTE_NDIS_INITIALIZE_MSG
:
RNDISInterfaceInfo
->
State
.
ResponseReady
=
true
;
RNDIS_INITIALIZE_MSG_t
*
INITIALIZE_Message
=
(
RNDIS_INITIALIZE_MSG_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RNDIS_INITIALIZE_CMPLT_t
*
INITIALIZE_Response
=
(
RNDIS_INITIALIZE_CMPLT_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RNDIS_Initialize_Message_t
*
INITIALIZE_Message
=
(
RNDIS_Initialize_Message_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RNDIS_Initialize_Complete_t
*
INITIALIZE_Response
=
(
RNDIS_Initialize_Complete_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
INITIALIZE_Response
->
MessageType
=
REMOTE_NDIS_INITIALIZE_CMPLT
;
INITIALIZE_Response
->
MessageLength
=
sizeof
(
RNDIS_I
NITIALIZE_CMPLT
_t
);
INITIALIZE_Response
->
MessageLength
=
sizeof
(
RNDIS_I
nitialize_Complete
_t
);
INITIALIZE_Response
->
RequestId
=
INITIALIZE_Message
->
RequestId
;
INITIALIZE_Response
->
Status
=
REMOTE_NDIS_STATUS_SUCCESS
;
...
...
@@ -233,7 +235,7 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
INITIALIZE_Response
->
DeviceFlags
=
REMOTE_NDIS_DF_CONNECTIONLESS
;
INITIALIZE_Response
->
Medium
=
REMOTE_NDIS_MEDIUM_802_3
;
INITIALIZE_Response
->
MaxPacketsPerTransfer
=
1
;
INITIALIZE_Response
->
MaxTransferSize
=
(
sizeof
(
RNDIS_P
ACKET_MSG
_t
)
+
ETHERNET_FRAME_SIZE_MAX
);
INITIALIZE_Response
->
MaxTransferSize
=
(
sizeof
(
RNDIS_P
acket_Message
_t
)
+
ETHERNET_FRAME_SIZE_MAX
);
INITIALIZE_Response
->
PacketAlignmentFactor
=
0
;
INITIALIZE_Response
->
AFListOffset
=
0
;
INITIALIZE_Response
->
AFListSize
=
0
;
...
...
@@ -251,17 +253,17 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
case
REMOTE_NDIS_QUERY_MSG
:
RNDISInterfaceInfo
->
State
.
ResponseReady
=
true
;
RNDIS_Q
UERY_MSG
_t
*
QUERY_Message
=
(
RNDIS_Q
UERY_MSG
_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RNDIS_Q
UERY_CMPLT
_t
*
QUERY_Response
=
(
RNDIS_Q
UERY_CMPLT
_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
uint32_t
Query_Oid
=
QUERY_Message
->
Oid
;
RNDIS_Q
uery_Message
_t
*
QUERY_Message
=
(
RNDIS_Q
uery_Message
_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RNDIS_Q
uery_Complete
_t
*
QUERY_Response
=
(
RNDIS_Q
uery_Complete
_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
uint32_t
Query_Oid
=
QUERY_Message
->
Oid
;
void
*
QueryData
=
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
[
sizeof
(
RNDIS_Message_Header_t
)
+
QUERY_Message
->
InformationBufferOffset
];
void
*
ResponseData
=
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
[
sizeof
(
RNDIS_Q
UERY_CMPLT
_t
)];
void
*
ResponseData
=
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
[
sizeof
(
RNDIS_Q
uery_Complete
_t
)];
uint16_t
ResponseSize
;
QUERY_Response
->
MessageType
=
REMOTE_NDIS_QUERY_CMPLT
;
QUERY_Response
->
MessageLength
=
sizeof
(
RNDIS_Q
UERY_CMPLT
_t
);
QUERY_Response
->
MessageLength
=
sizeof
(
RNDIS_Q
uery_Complete
_t
);
if
(
RNDIS_Device_ProcessNDISQuery
(
RNDISInterfaceInfo
,
Query_Oid
,
QueryData
,
QUERY_Message
->
InformationBufferLength
,
ResponseData
,
&
ResponseSize
))
...
...
@@ -270,7 +272,7 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
QUERY_Response
->
MessageLength
+=
ResponseSize
;
QUERY_Response
->
InformationBufferLength
=
ResponseSize
;
QUERY_Response
->
InformationBufferOffset
=
(
sizeof
(
RNDIS_Q
UERY_CMPLT
_t
)
-
sizeof
(
RNDIS_Message_Header_t
));
QUERY_Response
->
InformationBufferOffset
=
(
sizeof
(
RNDIS_Q
uery_Complete
_t
)
-
sizeof
(
RNDIS_Message_Header_t
));
}
else
{
...
...
@@ -284,12 +286,12 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
case
REMOTE_NDIS_SET_MSG
:
RNDISInterfaceInfo
->
State
.
ResponseReady
=
true
;
RNDIS_S
ET_MSG
_t
*
SET_Message
=
(
RNDIS_S
ET_MSG
_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RNDIS_S
ET_CMPLT
_t
*
SET_Response
=
(
RNDIS_S
ET_CMPLT
_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
uint32_t
SET_Oid
=
SET_Message
->
Oid
;
RNDIS_S
et_Message
_t
*
SET_Message
=
(
RNDIS_S
et_Message
_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RNDIS_S
et_Complete
_t
*
SET_Response
=
(
RNDIS_S
et_Complete
_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
uint32_t
SET_Oid
=
SET_Message
->
Oid
;
SET_Response
->
MessageType
=
REMOTE_NDIS_SET_CMPLT
;
SET_Response
->
MessageLength
=
sizeof
(
RNDIS_S
ET_CMPLT
_t
);
SET_Response
->
MessageLength
=
sizeof
(
RNDIS_S
et_Complete
_t
);
SET_Response
->
RequestId
=
SET_Message
->
RequestId
;
void
*
SetData
=
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
[
sizeof
(
RNDIS_Message_Header_t
)
+
...
...
@@ -304,10 +306,10 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
case
REMOTE_NDIS_RESET_MSG
:
RNDISInterfaceInfo
->
State
.
ResponseReady
=
true
;
RNDIS_R
ESET_CMPLT
_t
*
RESET_Response
=
(
RNDIS_R
ESET_CMPLT
_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RNDIS_R
eset_Complete
_t
*
RESET_Response
=
(
RNDIS_R
eset_Complete
_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RESET_Response
->
MessageType
=
REMOTE_NDIS_RESET_CMPLT
;
RESET_Response
->
MessageLength
=
sizeof
(
RNDIS_R
ESET_CMPLT
_t
);
RESET_Response
->
MessageLength
=
sizeof
(
RNDIS_R
eset_Complete
_t
);
RESET_Response
->
Status
=
REMOTE_NDIS_STATUS_SUCCESS
;
RESET_Response
->
AddressingReset
=
0
;
...
...
@@ -315,11 +317,13 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
case
REMOTE_NDIS_KEEPALIVE_MSG
:
RNDISInterfaceInfo
->
State
.
ResponseReady
=
true
;
RNDIS_KEEPALIVE_MSG_t
*
KEEPALIVE_Message
=
(
RNDIS_KEEPALIVE_MSG_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RNDIS_KEEPALIVE_CMPLT_t
*
KEEPALIVE_Response
=
(
RNDIS_KEEPALIVE_CMPLT_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RNDIS_KeepAlive_Message_t
*
KEEPALIVE_Message
=
(
RNDIS_KeepAlive_Message_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
RNDIS_KeepAlive_Complete_t
*
KEEPALIVE_Response
=
(
RNDIS_KeepAlive_Complete_t
*
)
&
RNDISInterfaceInfo
->
State
.
RNDISMessageBuffer
;
KEEPALIVE_Response
->
MessageType
=
REMOTE_NDIS_KEEPALIVE_CMPLT
;
KEEPALIVE_Response
->
MessageLength
=
sizeof
(
RNDIS_K
EEPALIVE_CMPLT
_t
);
KEEPALIVE_Response
->
MessageLength
=
sizeof
(
RNDIS_K
eepAlive_Complete
_t
);
KEEPALIVE_Response
->
RequestId
=
KEEPALIVE_Message
->
RequestId
;
KEEPALIVE_Response
->
Status
=
REMOTE_NDIS_STATUS_SUCCESS
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment