Clean up RNDIS demo type define names.

pull/1469/head
Dean Camera 16 years ago
parent feabfd12ce
commit 35bdada24b

@ -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 * 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. * 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_QUERY_CMPLT_t)]; uint8_t RNDISMessageBuffer[sizeof(AdapterSupportedOIDList) + sizeof(RNDIS_Query_Complete_t)];
/** Pointer to the RNDIS message header at the top of the RNDIS message buffer, for convenience. */ /** 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; RNDIS_Message_Header_t* MessageHeader = (RNDIS_Message_Header_t*)&RNDISMessageBuffer;
@ -112,11 +112,11 @@ void ProcessRNDISControlMessage(void)
ResponseReady = true; ResponseReady = true;
RNDIS_INITIALIZE_MSG_t* INITIALIZE_Message = (RNDIS_INITIALIZE_MSG_t*)&RNDISMessageBuffer; RNDIS_Initialize_Message_t* INITIALIZE_Message = (RNDIS_Initialize_Message_t*)&RNDISMessageBuffer;
RNDIS_INITIALIZE_CMPLT_t* INITIALIZE_Response = (RNDIS_INITIALIZE_CMPLT_t*)&RNDISMessageBuffer; RNDIS_Initialize_Complete_t* INITIALIZE_Response = (RNDIS_Initialize_Complete_t*)&RNDISMessageBuffer;
INITIALIZE_Response->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT; INITIALIZE_Response->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT;
INITIALIZE_Response->MessageLength = sizeof(RNDIS_INITIALIZE_CMPLT_t); INITIALIZE_Response->MessageLength = sizeof(RNDIS_Initialize_Complete_t);
INITIALIZE_Response->RequestId = INITIALIZE_Message->RequestId; INITIALIZE_Response->RequestId = INITIALIZE_Message->RequestId;
INITIALIZE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS; INITIALIZE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
@ -125,7 +125,7 @@ void ProcessRNDISControlMessage(void)
INITIALIZE_Response->DeviceFlags = REMOTE_NDIS_DF_CONNECTIONLESS; INITIALIZE_Response->DeviceFlags = REMOTE_NDIS_DF_CONNECTIONLESS;
INITIALIZE_Response->Medium = REMOTE_NDIS_MEDIUM_802_3; INITIALIZE_Response->Medium = REMOTE_NDIS_MEDIUM_802_3;
INITIALIZE_Response->MaxPacketsPerTransfer = 1; INITIALIZE_Response->MaxPacketsPerTransfer = 1;
INITIALIZE_Response->MaxTransferSize = (sizeof(RNDIS_PACKET_MSG_t) + ETHERNET_FRAME_SIZE_MAX); INITIALIZE_Response->MaxTransferSize = (sizeof(RNDIS_Packet_Message_t) + ETHERNET_FRAME_SIZE_MAX);
INITIALIZE_Response->PacketAlignmentFactor = 0; INITIALIZE_Response->PacketAlignmentFactor = 0;
INITIALIZE_Response->AFListOffset = 0; INITIALIZE_Response->AFListOffset = 0;
INITIALIZE_Response->AFListSize = 0; INITIALIZE_Response->AFListSize = 0;
@ -147,17 +147,17 @@ void ProcessRNDISControlMessage(void)
ResponseReady = true; ResponseReady = true;
RNDIS_QUERY_MSG_t* QUERY_Message = (RNDIS_QUERY_MSG_t*)&RNDISMessageBuffer; RNDIS_Query_Message_t* QUERY_Message = (RNDIS_Query_Message_t*)&RNDISMessageBuffer;
RNDIS_QUERY_CMPLT_t* QUERY_Response = (RNDIS_QUERY_CMPLT_t*)&RNDISMessageBuffer; RNDIS_Query_Complete_t* QUERY_Response = (RNDIS_Query_Complete_t*)&RNDISMessageBuffer;
uint32_t Query_Oid = QUERY_Message->Oid; uint32_t Query_Oid = QUERY_Message->Oid;
void* QueryData = &RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) + void* QueryData = &RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
QUERY_Message->InformationBufferOffset]; QUERY_Message->InformationBufferOffset];
void* ResponseData = &RNDISMessageBuffer[sizeof(RNDIS_QUERY_CMPLT_t)]; void* ResponseData = &RNDISMessageBuffer[sizeof(RNDIS_Query_Complete_t)];
uint16_t ResponseSize; uint16_t ResponseSize;
QUERY_Response->MessageType = REMOTE_NDIS_QUERY_CMPLT; QUERY_Response->MessageType = REMOTE_NDIS_QUERY_CMPLT;
QUERY_Response->MessageLength = sizeof(RNDIS_QUERY_CMPLT_t); QUERY_Response->MessageLength = sizeof(RNDIS_Query_Complete_t);
if (ProcessNDISQuery(Query_Oid, QueryData, QUERY_Message->InformationBufferLength, if (ProcessNDISQuery(Query_Oid, QueryData, QUERY_Message->InformationBufferLength,
ResponseData, &ResponseSize)) ResponseData, &ResponseSize))
@ -166,7 +166,7 @@ void ProcessRNDISControlMessage(void)
QUERY_Response->MessageLength += ResponseSize; QUERY_Response->MessageLength += ResponseSize;
QUERY_Response->InformationBufferLength = ResponseSize; QUERY_Response->InformationBufferLength = ResponseSize;
QUERY_Response->InformationBufferOffset = (sizeof(RNDIS_QUERY_CMPLT_t) - sizeof(RNDIS_Message_Header_t)); QUERY_Response->InformationBufferOffset = (sizeof(RNDIS_Query_Complete_t) - sizeof(RNDIS_Message_Header_t));
} }
else else
{ {
@ -182,12 +182,12 @@ void ProcessRNDISControlMessage(void)
ResponseReady = true; ResponseReady = true;
RNDIS_SET_MSG_t* SET_Message = (RNDIS_SET_MSG_t*)&RNDISMessageBuffer; RNDIS_Set_Message_t* SET_Message = (RNDIS_Set_Message_t*)&RNDISMessageBuffer;
RNDIS_SET_CMPLT_t* SET_Response = (RNDIS_SET_CMPLT_t*)&RNDISMessageBuffer; RNDIS_Set_Complete_t* SET_Response = (RNDIS_Set_Complete_t*)&RNDISMessageBuffer;
uint32_t SET_Oid = SET_Message->Oid; uint32_t SET_Oid = SET_Message->Oid;
SET_Response->MessageType = REMOTE_NDIS_SET_CMPLT; SET_Response->MessageType = REMOTE_NDIS_SET_CMPLT;
SET_Response->MessageLength = sizeof(RNDIS_SET_CMPLT_t); SET_Response->MessageLength = sizeof(RNDIS_Set_Complete_t);
SET_Response->RequestId = SET_Message->RequestId; SET_Response->RequestId = SET_Message->RequestId;
void* SetData = &RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) + void* SetData = &RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
@ -204,10 +204,10 @@ void ProcessRNDISControlMessage(void)
ResponseReady = true; ResponseReady = true;
RNDIS_RESET_CMPLT_t* RESET_Response = (RNDIS_RESET_CMPLT_t*)&RNDISMessageBuffer; RNDIS_Reset_Complete_t* RESET_Response = (RNDIS_Reset_Complete_t*)&RNDISMessageBuffer;
RESET_Response->MessageType = REMOTE_NDIS_RESET_CMPLT; RESET_Response->MessageType = REMOTE_NDIS_RESET_CMPLT;
RESET_Response->MessageLength = sizeof(RNDIS_RESET_CMPLT_t); RESET_Response->MessageLength = sizeof(RNDIS_Reset_Complete_t);
RESET_Response->Status = REMOTE_NDIS_STATUS_SUCCESS; RESET_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
RESET_Response->AddressingReset = 0; RESET_Response->AddressingReset = 0;
@ -217,11 +217,11 @@ void ProcessRNDISControlMessage(void)
ResponseReady = true; ResponseReady = true;
RNDIS_KEEPALIVE_MSG_t* KEEPALIVE_Message = (RNDIS_KEEPALIVE_MSG_t*)&RNDISMessageBuffer; RNDIS_KeepAlive_Message_t* KEEPALIVE_Message = (RNDIS_KeepAlive_Message_t*)&RNDISMessageBuffer;
RNDIS_KEEPALIVE_CMPLT_t* KEEPALIVE_Response = (RNDIS_KEEPALIVE_CMPLT_t*)&RNDISMessageBuffer; RNDIS_KeepAlive_Complete_t* KEEPALIVE_Response = (RNDIS_KeepAlive_Complete_t*)&RNDISMessageBuffer;
KEEPALIVE_Response->MessageType = REMOTE_NDIS_KEEPALIVE_CMPLT; KEEPALIVE_Response->MessageType = REMOTE_NDIS_KEEPALIVE_CMPLT;
KEEPALIVE_Response->MessageLength = sizeof(RNDIS_KEEPALIVE_CMPLT_t); KEEPALIVE_Response->MessageLength = sizeof(RNDIS_KeepAlive_Complete_t);
KEEPALIVE_Response->RequestId = KEEPALIVE_Message->RequestId; KEEPALIVE_Response->RequestId = KEEPALIVE_Message->RequestId;
KEEPALIVE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS; KEEPALIVE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;

@ -101,7 +101,7 @@
uint32_t PerPacketInfoLength; uint32_t PerPacketInfoLength;
uint32_t VcHandle; uint32_t VcHandle;
uint32_t Reserved; uint32_t Reserved;
} RNDIS_PACKET_MSG_t; } RNDIS_Packet_Message_t;
/** Type define for a RNDIS Initialize command message */ /** Type define for a RNDIS Initialize command message */
typedef struct typedef struct
@ -113,7 +113,7 @@
uint32_t MajorVersion; uint32_t MajorVersion;
uint32_t MinorVersion; uint32_t MinorVersion;
uint32_t MaxTransferSize; uint32_t MaxTransferSize;
} RNDIS_INITIALIZE_MSG_t; } RNDIS_Initialize_Message_t;
/** Type define for a RNDIS Initialize complete response message */ /** Type define for a RNDIS Initialize complete response message */
typedef struct typedef struct
@ -132,7 +132,7 @@
uint32_t PacketAlignmentFactor; uint32_t PacketAlignmentFactor;
uint32_t AFListOffset; uint32_t AFListOffset;
uint32_t AFListSize; uint32_t AFListSize;
} RNDIS_INITIALIZE_CMPLT_t; } RNDIS_Initialize_Complete_t;
/** Type define for a RNDIS Keepalive command message */ /** Type define for a RNDIS Keepalive command message */
typedef struct typedef struct
@ -140,7 +140,7 @@
uint32_t MessageType; uint32_t MessageType;
uint32_t MessageLength; uint32_t MessageLength;
uint32_t RequestId; uint32_t RequestId;
} RNDIS_KEEPALIVE_MSG_t; } RNDIS_KeepAlive_Message_t;
/** Type define for a RNDIS Keepalive complete message */ /** Type define for a RNDIS Keepalive complete message */
typedef struct typedef struct
@ -149,7 +149,7 @@
uint32_t MessageLength; uint32_t MessageLength;
uint32_t RequestId; uint32_t RequestId;
uint32_t Status; uint32_t Status;
} RNDIS_KEEPALIVE_CMPLT_t; } RNDIS_KeepAlive_Complete_t;
/** Type define for a RNDIS Reset complete message */ /** Type define for a RNDIS Reset complete message */
typedef struct typedef struct
@ -159,7 +159,7 @@
uint32_t Status; uint32_t Status;
uint32_t AddressingReset; uint32_t AddressingReset;
} RNDIS_RESET_CMPLT_t; } RNDIS_Reset_Complete_t;
/** Type define for a RNDIS Set command message */ /** Type define for a RNDIS Set command message */
typedef struct typedef struct
@ -172,7 +172,7 @@
uint32_t InformationBufferLength; uint32_t InformationBufferLength;
uint32_t InformationBufferOffset; uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle; uint32_t DeviceVcHandle;
} RNDIS_SET_MSG_t; } RNDIS_Set_Message_t;
/** Type define for a RNDIS Set complete response message */ /** Type define for a RNDIS Set complete response message */
typedef struct typedef struct
@ -181,7 +181,7 @@
uint32_t MessageLength; uint32_t MessageLength;
uint32_t RequestId; uint32_t RequestId;
uint32_t Status; uint32_t Status;
} RNDIS_SET_CMPLT_t; } RNDIS_Set_Complete_t;
/** Type define for a RNDIS Query command message */ /** Type define for a RNDIS Query command message */
typedef struct typedef struct
@ -194,7 +194,7 @@
uint32_t InformationBufferLength; uint32_t InformationBufferLength;
uint32_t InformationBufferOffset; uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle; uint32_t DeviceVcHandle;
} RNDIS_QUERY_MSG_t; } RNDIS_Query_Message_t;
/** Type define for a RNDIS Query complete response message */ /** Type define for a RNDIS Query complete response message */
typedef struct typedef struct
@ -206,7 +206,7 @@
uint32_t InformationBufferLength; uint32_t InformationBufferLength;
uint32_t InformationBufferOffset; uint32_t InformationBufferOffset;
} RNDIS_QUERY_CMPLT_t; } RNDIS_Query_Complete_t;
/* External Variables: */ /* External Variables: */
extern uint8_t RNDISMessageBuffer[]; extern uint8_t RNDISMessageBuffer[];

@ -214,7 +214,7 @@ void RNDIS_Task(void)
if ((CurrRNDISState == RNDIS_Data_Initialized) && !(MessageHeader->MessageLength)) if ((CurrRNDISState == RNDIS_Data_Initialized) && !(MessageHeader->MessageLength))
{ {
/* Create a new packet header for reading/writing */ /* Create a new packet header for reading/writing */
RNDIS_PACKET_MSG_t RNDISPacketHeader; RNDIS_Packet_Message_t RNDISPacketHeader;
/* Select the data OUT endpoint */ /* Select the data OUT endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM); Endpoint_SelectEndpoint(CDC_RX_EPNUM);
@ -223,7 +223,7 @@ void RNDIS_Task(void)
if (Endpoint_IsOUTReceived() && !(FrameIN.FrameInBuffer)) if (Endpoint_IsOUTReceived() && !(FrameIN.FrameInBuffer))
{ {
/* Read in the packet message header */ /* Read in the packet message header */
Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_PACKET_MSG_t)); Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t));
/* Stall the request if the data is too large */ /* Stall the request if the data is too large */
if (RNDISPacketHeader.DataLength > ETHERNET_FRAME_SIZE_MAX) if (RNDISPacketHeader.DataLength > ETHERNET_FRAME_SIZE_MAX)
@ -252,16 +252,16 @@ void RNDIS_Task(void)
if (Endpoint_IsINReady() && FrameOUT.FrameInBuffer) if (Endpoint_IsINReady() && FrameOUT.FrameInBuffer)
{ {
/* Clear the packet header with all 0s so that the relevant fields can be filled */ /* Clear the packet header with all 0s so that the relevant fields can be filled */
memset(&RNDISPacketHeader, 0, sizeof(RNDIS_PACKET_MSG_t)); memset(&RNDISPacketHeader, 0, sizeof(RNDIS_Packet_Message_t));
/* Construct the required packet header fields in the buffer */ /* Construct the required packet header fields in the buffer */
RNDISPacketHeader.MessageType = REMOTE_NDIS_PACKET_MSG; RNDISPacketHeader.MessageType = REMOTE_NDIS_PACKET_MSG;
RNDISPacketHeader.MessageLength = (sizeof(RNDIS_PACKET_MSG_t) + FrameOUT.FrameLength); RNDISPacketHeader.MessageLength = (sizeof(RNDIS_Packet_Message_t) + FrameOUT.FrameLength);
RNDISPacketHeader.DataOffset = (sizeof(RNDIS_PACKET_MSG_t) - sizeof(RNDIS_Message_Header_t)); RNDISPacketHeader.DataOffset = (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
RNDISPacketHeader.DataLength = FrameOUT.FrameLength; RNDISPacketHeader.DataLength = FrameOUT.FrameLength;
/* Send the packet header to the host */ /* Send the packet header to the host */
Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_PACKET_MSG_t)); Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t));
/* Send the Ethernet frame data to the host */ /* Send the Ethernet frame data to the host */
Endpoint_Write_Stream_LE(FrameOUT.FrameData, RNDISPacketHeader.DataLength); Endpoint_Write_Stream_LE(FrameOUT.FrameData, RNDISPacketHeader.DataLength);

@ -123,7 +123,7 @@
/* Enums: */ /* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */ /** 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_OneStopBit = 0, /**< Each frame contains one stop bit */
CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */ 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 for the possible line encoding parity settings of a virtual serial port. */
enum CDCDevice_LineCodingParity_t enum CDC_LineCodingParity_t
{ {
CDC_PARITY_None = 0, /**< No parity bit mode on each frame */ CDC_PARITY_None = 0, /**< No parity bit mode on each frame */
CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame */ CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame */

@ -122,7 +122,7 @@
uint32_t PerPacketInfoLength; uint32_t PerPacketInfoLength;
uint32_t VcHandle; uint32_t VcHandle;
uint32_t Reserved; uint32_t Reserved;
} RNDIS_PACKET_MSG_t; } RNDIS_Packet_Message_t;
/** Type define for a RNDIS Initialize command message */ /** Type define for a RNDIS Initialize command message */
typedef struct typedef struct
@ -134,7 +134,7 @@
uint32_t MajorVersion; uint32_t MajorVersion;
uint32_t MinorVersion; uint32_t MinorVersion;
uint32_t MaxTransferSize; uint32_t MaxTransferSize;
} RNDIS_INITIALIZE_MSG_t; } RNDIS_Initialize_Message_t;
/** Type define for a RNDIS Initialize complete response message */ /** Type define for a RNDIS Initialize complete response message */
typedef struct typedef struct
@ -153,7 +153,7 @@
uint32_t PacketAlignmentFactor; uint32_t PacketAlignmentFactor;
uint32_t AFListOffset; uint32_t AFListOffset;
uint32_t AFListSize; uint32_t AFListSize;
} RNDIS_INITIALIZE_CMPLT_t; } RNDIS_Initialize_Complete_t;
/** Type define for a RNDIS Keepalive command message */ /** Type define for a RNDIS Keepalive command message */
typedef struct typedef struct
@ -161,7 +161,7 @@
uint32_t MessageType; uint32_t MessageType;
uint32_t MessageLength; uint32_t MessageLength;
uint32_t RequestId; uint32_t RequestId;
} RNDIS_KEEPALIVE_MSG_t; } RNDIS_KeepAlive_Message_t;
/** Type define for a RNDIS Keepalive complete message */ /** Type define for a RNDIS Keepalive complete message */
typedef struct typedef struct
@ -170,7 +170,7 @@
uint32_t MessageLength; uint32_t MessageLength;
uint32_t RequestId; uint32_t RequestId;
uint32_t Status; uint32_t Status;
} RNDIS_KEEPALIVE_CMPLT_t; } RNDIS_KeepAlive_Complete_t;
/** Type define for a RNDIS Reset complete message */ /** Type define for a RNDIS Reset complete message */
typedef struct typedef struct
@ -180,7 +180,7 @@
uint32_t Status; uint32_t Status;
uint32_t AddressingReset; uint32_t AddressingReset;
} RNDIS_RESET_CMPLT_t; } RNDIS_Reset_Complete_t;
/** Type define for a RNDIS Set command message */ /** Type define for a RNDIS Set command message */
typedef struct typedef struct
@ -193,7 +193,7 @@
uint32_t InformationBufferLength; uint32_t InformationBufferLength;
uint32_t InformationBufferOffset; uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle; uint32_t DeviceVcHandle;
} RNDIS_SET_MSG_t; } RNDIS_Set_Message_t;
/** Type define for a RNDIS Set complete response message */ /** Type define for a RNDIS Set complete response message */
typedef struct typedef struct
@ -202,7 +202,7 @@
uint32_t MessageLength; uint32_t MessageLength;
uint32_t RequestId; uint32_t RequestId;
uint32_t Status; uint32_t Status;
} RNDIS_SET_CMPLT_t; } RNDIS_Set_Complete_t;
/** Type define for a RNDIS Query command message */ /** Type define for a RNDIS Query command message */
typedef struct typedef struct
@ -215,7 +215,7 @@
uint32_t InformationBufferLength; uint32_t InformationBufferLength;
uint32_t InformationBufferOffset; uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle; uint32_t DeviceVcHandle;
} RNDIS_QUERY_MSG_t; } RNDIS_Query_Message_t;
/** Type define for a RNDIS Query complete response message */ /** Type define for a RNDIS Query complete response message */
typedef struct typedef struct
@ -227,7 +227,7 @@
uint32_t InformationBufferLength; uint32_t InformationBufferLength;
uint32_t InformationBufferOffset; uint32_t InformationBufferOffset;
} RNDIS_QUERY_CMPLT_t; } RNDIS_Query_Complete_t;
/* Disable C linkage for C++ Compilers: */ /* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus) #if defined(__cplusplus)

@ -71,7 +71,8 @@
{ {
bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode */ 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 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; } USB_ClassInfo_HID_Device_State_t;
/** Class state structure. An instance of this structure should be made for each HID interface /** Class state structure. An instance of this structure should be made for each HID interface

@ -69,7 +69,7 @@
/** Current State information structure for \ref USB_ClassInfo_MIDI_Device_t MIDI device interface structures. */ /** Current State information structure for \ref USB_ClassInfo_MIDI_Device_t MIDI device interface structures. */
typedef struct typedef struct
{ {
// No state information for this class yet
} USB_ClassInfo_MIDI_Device_State_t; } USB_ClassInfo_MIDI_Device_State_t;
/** Class state structure. An instance of this structure should be made for each MIDI interface /** Class state structure. An instance of this structure should be made for each MIDI interface

@ -70,11 +70,11 @@
/** Current State information structure for \ref USB_ClassInfo_MS_Device_t Mass Storage device interface structures. */ /** Current State information structure for \ref USB_ClassInfo_MS_Device_t Mass Storage device interface structures. */
typedef struct typedef struct
{ {
CommandBlockWrapper_t CommandBlock; /**< Mass Storage class command block structure, used internally CommandBlockWrapper_t CommandBlock; /**< Mass Storage class command block structure, stores the received SCSI
* by the class driver * command from the host which is to be processed
*/ */
CommandStatusWrapper_t CommandStatus; /**< Mass Storage class command status structure, used internally CommandStatusWrapper_t CommandStatus; /**< Mass Storage class command status structure, set elements to indicate
* by the class driver * 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 bool IsMassStoreReset; /**< Flag indicating that the host has requested that the Mass Storage interface be reset

@ -165,13 +165,13 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* RNDISInterfaceInfo)
if ((RNDISInterfaceInfo->State.CurrRNDISState == RNDIS_Data_Initialized) && !(MessageHeader->MessageLength)) if ((RNDISInterfaceInfo->State.CurrRNDISState == RNDIS_Data_Initialized) && !(MessageHeader->MessageLength))
{ {
RNDIS_PACKET_MSG_t RNDISPacketHeader; RNDIS_Packet_Message_t RNDISPacketHeader;
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpointNumber); Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpointNumber);
if (Endpoint_IsOUTReceived() && !(RNDISInterfaceInfo->State.FrameIN.FrameInBuffer)) if (Endpoint_IsOUTReceived() && !(RNDISInterfaceInfo->State.FrameIN.FrameInBuffer))
{ {
Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_PACKET_MSG_t), NO_STREAM_CALLBACK); Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NO_STREAM_CALLBACK);
if (RNDISPacketHeader.DataLength > ETHERNET_FRAME_SIZE_MAX) 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) if (Endpoint_IsINReady() && RNDISInterfaceInfo->State.FrameOUT.FrameInBuffer)
{ {
memset(&RNDISPacketHeader, 0, sizeof(RNDIS_PACKET_MSG_t)); memset(&RNDISPacketHeader, 0, sizeof(RNDIS_Packet_Message_t));
RNDISPacketHeader.MessageType = REMOTE_NDIS_PACKET_MSG; RNDISPacketHeader.MessageType = REMOTE_NDIS_PACKET_MSG;
RNDISPacketHeader.MessageLength = (sizeof(RNDIS_PACKET_MSG_t) + RNDISInterfaceInfo->State.FrameOUT.FrameLength); RNDISPacketHeader.MessageLength = (sizeof(RNDIS_Packet_Message_t) + RNDISInterfaceInfo->State.FrameOUT.FrameLength);
RNDISPacketHeader.DataOffset = (sizeof(RNDIS_PACKET_MSG_t) - sizeof(RNDIS_Message_Header_t)); RNDISPacketHeader.DataOffset = (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
RNDISPacketHeader.DataLength = RNDISInterfaceInfo->State.FrameOUT.FrameLength; RNDISPacketHeader.DataLength = RNDISInterfaceInfo->State.FrameOUT.FrameLength;
Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_PACKET_MSG_t), NO_STREAM_CALLBACK); Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(RNDISInterfaceInfo->State.FrameOUT.FrameData, RNDISPacketHeader.DataLength, NO_STREAM_CALLBACK); Endpoint_Write_Stream_LE(RNDISInterfaceInfo->State.FrameOUT.FrameData, RNDISPacketHeader.DataLength, NO_STREAM_CALLBACK);
Endpoint_ClearIN(); Endpoint_ClearIN();
@ -220,11 +220,13 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
case REMOTE_NDIS_INITIALIZE_MSG: case REMOTE_NDIS_INITIALIZE_MSG:
RNDISInterfaceInfo->State.ResponseReady = true; RNDISInterfaceInfo->State.ResponseReady = true;
RNDIS_INITIALIZE_MSG_t* INITIALIZE_Message = (RNDIS_INITIALIZE_MSG_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; RNDIS_Initialize_Message_t* INITIALIZE_Message =
RNDIS_INITIALIZE_CMPLT_t* INITIALIZE_Response = (RNDIS_INITIALIZE_CMPLT_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; (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->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT;
INITIALIZE_Response->MessageLength = sizeof(RNDIS_INITIALIZE_CMPLT_t); INITIALIZE_Response->MessageLength = sizeof(RNDIS_Initialize_Complete_t);
INITIALIZE_Response->RequestId = INITIALIZE_Message->RequestId; INITIALIZE_Response->RequestId = INITIALIZE_Message->RequestId;
INITIALIZE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS; 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->DeviceFlags = REMOTE_NDIS_DF_CONNECTIONLESS;
INITIALIZE_Response->Medium = REMOTE_NDIS_MEDIUM_802_3; INITIALIZE_Response->Medium = REMOTE_NDIS_MEDIUM_802_3;
INITIALIZE_Response->MaxPacketsPerTransfer = 1; INITIALIZE_Response->MaxPacketsPerTransfer = 1;
INITIALIZE_Response->MaxTransferSize = (sizeof(RNDIS_PACKET_MSG_t) + ETHERNET_FRAME_SIZE_MAX); INITIALIZE_Response->MaxTransferSize = (sizeof(RNDIS_Packet_Message_t) + ETHERNET_FRAME_SIZE_MAX);
INITIALIZE_Response->PacketAlignmentFactor = 0; INITIALIZE_Response->PacketAlignmentFactor = 0;
INITIALIZE_Response->AFListOffset = 0; INITIALIZE_Response->AFListOffset = 0;
INITIALIZE_Response->AFListSize = 0; INITIALIZE_Response->AFListSize = 0;
@ -251,17 +253,17 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
case REMOTE_NDIS_QUERY_MSG: case REMOTE_NDIS_QUERY_MSG:
RNDISInterfaceInfo->State.ResponseReady = true; RNDISInterfaceInfo->State.ResponseReady = true;
RNDIS_QUERY_MSG_t* QUERY_Message = (RNDIS_QUERY_MSG_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; RNDIS_Query_Message_t* QUERY_Message = (RNDIS_Query_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
RNDIS_QUERY_CMPLT_t* QUERY_Response = (RNDIS_QUERY_CMPLT_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; RNDIS_Query_Complete_t* QUERY_Response = (RNDIS_Query_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
uint32_t Query_Oid = QUERY_Message->Oid; uint32_t Query_Oid = QUERY_Message->Oid;
void* QueryData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) + void* QueryData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
QUERY_Message->InformationBufferOffset]; QUERY_Message->InformationBufferOffset];
void* ResponseData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_QUERY_CMPLT_t)]; void* ResponseData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Query_Complete_t)];
uint16_t ResponseSize; uint16_t ResponseSize;
QUERY_Response->MessageType = REMOTE_NDIS_QUERY_CMPLT; QUERY_Response->MessageType = REMOTE_NDIS_QUERY_CMPLT;
QUERY_Response->MessageLength = sizeof(RNDIS_QUERY_CMPLT_t); QUERY_Response->MessageLength = sizeof(RNDIS_Query_Complete_t);
if (RNDIS_Device_ProcessNDISQuery(RNDISInterfaceInfo, Query_Oid, QueryData, QUERY_Message->InformationBufferLength, if (RNDIS_Device_ProcessNDISQuery(RNDISInterfaceInfo, Query_Oid, QueryData, QUERY_Message->InformationBufferLength,
ResponseData, &ResponseSize)) ResponseData, &ResponseSize))
@ -270,7 +272,7 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
QUERY_Response->MessageLength += ResponseSize; QUERY_Response->MessageLength += ResponseSize;
QUERY_Response->InformationBufferLength = ResponseSize; QUERY_Response->InformationBufferLength = ResponseSize;
QUERY_Response->InformationBufferOffset = (sizeof(RNDIS_QUERY_CMPLT_t) - sizeof(RNDIS_Message_Header_t)); QUERY_Response->InformationBufferOffset = (sizeof(RNDIS_Query_Complete_t) - sizeof(RNDIS_Message_Header_t));
} }
else else
{ {
@ -284,12 +286,12 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
case REMOTE_NDIS_SET_MSG: case REMOTE_NDIS_SET_MSG:
RNDISInterfaceInfo->State.ResponseReady = true; RNDISInterfaceInfo->State.ResponseReady = true;
RNDIS_SET_MSG_t* SET_Message = (RNDIS_SET_MSG_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; RNDIS_Set_Message_t* SET_Message = (RNDIS_Set_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
RNDIS_SET_CMPLT_t* SET_Response = (RNDIS_SET_CMPLT_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; RNDIS_Set_Complete_t* SET_Response = (RNDIS_Set_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
uint32_t SET_Oid = SET_Message->Oid; uint32_t SET_Oid = SET_Message->Oid;
SET_Response->MessageType = REMOTE_NDIS_SET_CMPLT; SET_Response->MessageType = REMOTE_NDIS_SET_CMPLT;
SET_Response->MessageLength = sizeof(RNDIS_SET_CMPLT_t); SET_Response->MessageLength = sizeof(RNDIS_Set_Complete_t);
SET_Response->RequestId = SET_Message->RequestId; SET_Response->RequestId = SET_Message->RequestId;
void* SetData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) + 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: case REMOTE_NDIS_RESET_MSG:
RNDISInterfaceInfo->State.ResponseReady = true; RNDISInterfaceInfo->State.ResponseReady = true;
RNDIS_RESET_CMPLT_t* RESET_Response = (RNDIS_RESET_CMPLT_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; RNDIS_Reset_Complete_t* RESET_Response = (RNDIS_Reset_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
RESET_Response->MessageType = REMOTE_NDIS_RESET_CMPLT; RESET_Response->MessageType = REMOTE_NDIS_RESET_CMPLT;
RESET_Response->MessageLength = sizeof(RNDIS_RESET_CMPLT_t); RESET_Response->MessageLength = sizeof(RNDIS_Reset_Complete_t);
RESET_Response->Status = REMOTE_NDIS_STATUS_SUCCESS; RESET_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
RESET_Response->AddressingReset = 0; RESET_Response->AddressingReset = 0;
@ -315,11 +317,13 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* RNDIS
case REMOTE_NDIS_KEEPALIVE_MSG: case REMOTE_NDIS_KEEPALIVE_MSG:
RNDISInterfaceInfo->State.ResponseReady = true; RNDISInterfaceInfo->State.ResponseReady = true;
RNDIS_KEEPALIVE_MSG_t* KEEPALIVE_Message = (RNDIS_KEEPALIVE_MSG_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; RNDIS_KeepAlive_Message_t* KEEPALIVE_Message =
RNDIS_KEEPALIVE_CMPLT_t* KEEPALIVE_Response = (RNDIS_KEEPALIVE_CMPLT_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; (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->MessageType = REMOTE_NDIS_KEEPALIVE_CMPLT;
KEEPALIVE_Response->MessageLength = sizeof(RNDIS_KEEPALIVE_CMPLT_t); KEEPALIVE_Response->MessageLength = sizeof(RNDIS_KeepAlive_Complete_t);
KEEPALIVE_Response->RequestId = KEEPALIVE_Message->RequestId; KEEPALIVE_Response->RequestId = KEEPALIVE_Message->RequestId;
KEEPALIVE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS; KEEPALIVE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;

Loading…
Cancel
Save