@ -110,12 +110,6 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
{
{
if ( EndpointData - > EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN )
if ( EndpointData - > EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN )
{
{
if ( Pipe_IsEndpointBound ( EndpointData - > EndpointAddress ) )
{
RNDISInterfaceInfo - > State . BidirectionalDataEndpoints = true ;
Pipe_DisablePipe ( ) ;
}
Pipe_ConfigurePipe ( RNDISInterfaceInfo - > Config . DataINPipeNumber , EP_TYPE_BULK , PIPE_TOKEN_IN ,
Pipe_ConfigurePipe ( RNDISInterfaceInfo - > Config . DataINPipeNumber , EP_TYPE_BULK , PIPE_TOKEN_IN ,
EndpointData - > EndpointAddress , EndpointData - > EndpointSize ,
EndpointData - > EndpointAddress , EndpointData - > EndpointSize ,
RNDISInterfaceInfo - > Config . DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE ) ;
RNDISInterfaceInfo - > Config . DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE ) ;
@ -124,17 +118,10 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
FoundEndpoints | = RNDIS_FOUND_DATAPIPE_IN ;
FoundEndpoints | = RNDIS_FOUND_DATAPIPE_IN ;
}
}
else
else
{
if ( Pipe_IsEndpointBound ( EndpointData - > EndpointAddress ) )
{
RNDISInterfaceInfo - > State . BidirectionalDataEndpoints = true ;
}
else
{
{
Pipe_ConfigurePipe ( RNDISInterfaceInfo - > Config . DataOUTPipeNumber , EP_TYPE_BULK , PIPE_TOKEN_OUT ,
Pipe_ConfigurePipe ( RNDISInterfaceInfo - > Config . DataOUTPipeNumber , EP_TYPE_BULK , PIPE_TOKEN_OUT ,
EndpointData - > EndpointAddress , EndpointData - > EndpointSize ,
EndpointData - > EndpointAddress , EndpointData - > EndpointSize ,
RNDISInterfaceInfo - > Config . DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE ) ;
RNDISInterfaceInfo - > Config . DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE ) ;
}
RNDISInterfaceInfo - > State . DataOUTPipeSize = EndpointData - > EndpointSize ;
RNDISInterfaceInfo - > State . DataOUTPipeSize = EndpointData - > EndpointSize ;
@ -422,28 +409,12 @@ uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
RNDIS_Packet_Message_t DeviceMessage ;
RNDIS_Packet_Message_t DeviceMessage ;
if ( Pipe_BytesInPipe ( ) < sizeof ( RNDIS_Packet_Message_t ) )
{
printf ( " *SIZE YARG: %d* \r \n " , Pipe_BytesInPipe ( ) ) ;
* PacketLength = 0 ;
Pipe_ClearIN ( ) ;
return RNDIS_COMMAND_FAILED ;
}
if ( ( ErrorCode = Pipe_Read_Stream_LE ( & DeviceMessage , sizeof ( RNDIS_Packet_Message_t ) ,
if ( ( ErrorCode = Pipe_Read_Stream_LE ( & DeviceMessage , sizeof ( RNDIS_Packet_Message_t ) ,
NO_STREAM_CALLBACK ) ) ! = PIPE_RWSTREAM_NoError )
NO_STREAM_CALLBACK ) ) ! = PIPE_RWSTREAM_NoError )
{
{
return ErrorCode ;
return ErrorCode ;
}
}
if ( DeviceMessage . MessageType ! = REMOTE_NDIS_PACKET_MSG )
{
printf ( " ****YARG**** \r \n " ) ;
* PacketLength = 0 ;
Pipe_ClearIN ( ) ;
return RNDIS_COMMAND_FAILED ;
}
* PacketLength = ( uint16_t ) DeviceMessage . DataLength ;
* PacketLength = ( uint16_t ) DeviceMessage . DataLength ;
Pipe_Discard_Stream ( DeviceMessage . DataOffset - ( sizeof ( RNDIS_Packet_Message_t ) - sizeof ( RNDIS_Message_Header_t ) ) ,
Pipe_Discard_Stream ( DeviceMessage . DataOffset - ( sizeof ( RNDIS_Packet_Message_t ) - sizeof ( RNDIS_Message_Header_t ) ) ,
@ -466,16 +437,6 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
if ( ( USB_HostState ! = HOST_STATE_Configured ) | | ! ( RNDISInterfaceInfo - > State . IsActive ) )
if ( ( USB_HostState ! = HOST_STATE_Configured ) | | ! ( RNDISInterfaceInfo - > State . IsActive ) )
return PIPE_READYWAIT_DeviceDisconnected ;
return PIPE_READYWAIT_DeviceDisconnected ;
if ( RNDISInterfaceInfo - > State . BidirectionalDataEndpoints )
{
Pipe_SelectPipe ( RNDISInterfaceInfo - > Config . DataINPipeNumber ) ;
Pipe_SetPipeToken ( PIPE_TOKEN_OUT ) ;
}
else
{
Pipe_SelectPipe ( RNDISInterfaceInfo - > Config . DataOUTPipeNumber ) ;
}
RNDIS_Packet_Message_t DeviceMessage ;
RNDIS_Packet_Message_t DeviceMessage ;
memset ( & DeviceMessage , 0 , sizeof ( RNDIS_Packet_Message_t ) ) ;
memset ( & DeviceMessage , 0 , sizeof ( RNDIS_Packet_Message_t ) ) ;
@ -484,14 +445,12 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
DeviceMessage . DataOffset = ( sizeof ( RNDIS_Packet_Message_t ) - sizeof ( RNDIS_Message_Header_t ) ) ;
DeviceMessage . DataOffset = ( sizeof ( RNDIS_Packet_Message_t ) - sizeof ( RNDIS_Message_Header_t ) ) ;
DeviceMessage . DataLength = PacketLength ;
DeviceMessage . DataLength = PacketLength ;
Pipe_SelectPipe ( RNDISInterfaceInfo - > Config . DataOUTPipeNumber ) ;
Pipe_Unfreeze ( ) ;
Pipe_Unfreeze ( ) ;
if ( ( ErrorCode = Pipe_Write_Stream_LE ( & DeviceMessage , sizeof ( RNDIS_Packet_Message_t ) ,
if ( ( ErrorCode = Pipe_Write_Stream_LE ( & DeviceMessage , sizeof ( RNDIS_Packet_Message_t ) ,
NO_STREAM_CALLBACK ) ) ! = PIPE_RWSTREAM_NoError )
NO_STREAM_CALLBACK ) ) ! = PIPE_RWSTREAM_NoError )
{
{
if ( RNDISInterfaceInfo - > State . BidirectionalDataEndpoints )
Pipe_SetPipeToken ( PIPE_TOKEN_IN ) ;
return ErrorCode ;
return ErrorCode ;
}
}
@ -500,9 +459,6 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
Pipe_Freeze ( ) ;
Pipe_Freeze ( ) ;
if ( RNDISInterfaceInfo - > State . BidirectionalDataEndpoints )
Pipe_SetPipeToken ( PIPE_TOKEN_IN ) ;
return PIPE_RWSTREAM_NoError ;
return PIPE_RWSTREAM_NoError ;
}
}