Reintegrate the FullEPAddresses development branch into trunk.
This commit is contained in:
		
							parent
							
								
									e8570c4a37
								
							
						
					
					
						commit
						47f6a35013
					
				
					 265 changed files with 2120 additions and 2486 deletions
				
			
		|  | @ -89,45 +89,19 @@ uint8_t AOA_Host_ConfigurePipes(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo | |||
| 		  DataOUTEndpoint = EndpointData; | ||||
| 	} | ||||
| 
 | ||||
| 	for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++) | ||||
| 	{ | ||||
| 		uint16_t Size; | ||||
| 		uint8_t  Type; | ||||
| 		uint8_t  Token; | ||||
| 		uint8_t  EndpointAddress; | ||||
| 		bool     DoubleBanked; | ||||
| 
 | ||||
| 		if (PipeNum == AOAInterfaceInfo->Config.DataINPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = AOAInterfaceInfo->Config.DataINPipeDoubleBank; | ||||
| 
 | ||||
| 			AOAInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == AOAInterfaceInfo->Config.DataOUTPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_OUT; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = AOAInterfaceInfo->Config.DataOUTPipeDoubleBank; | ||||
| 
 | ||||
| 			AOAInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			continue; | ||||
| 		} | ||||
| 		 | ||||
| 		if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size, | ||||
| 		                         DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE))) | ||||
| 		{ | ||||
| 			return AOA_ENUMERROR_PipeConfigurationFailed; | ||||
| 		} | ||||
| 	} | ||||
| 	AOAInterfaceInfo->Config.DataINPipe.Size  = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 	AOAInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 	AOAInterfaceInfo->Config.DataINPipe.Type  = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	AOAInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 	AOAInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 	AOAInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataINPipe, 1))) | ||||
| 	  return false; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataOUTPipe, 1))) | ||||
| 	  return false; | ||||
| 
 | ||||
| 	AOAInterfaceInfo->State.IsActive        = true; | ||||
| 	AOAInterfaceInfo->State.InterfaceNumber = AOAInterface->InterfaceNumber; | ||||
|  | @ -260,7 +234,7 @@ uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 
 | ||||
| 	Pipe_Unfreeze(); | ||||
| 	ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL); | ||||
|  | @ -277,7 +251,7 @@ uint8_t AOA_Host_SendString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 
 | ||||
| 	Pipe_Unfreeze(); | ||||
| 	ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL); | ||||
|  | @ -294,7 +268,7 @@ uint8_t AOA_Host_SendByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (!(Pipe_IsReadWriteAllowed())) | ||||
|  | @ -316,7 +290,7 @@ uint16_t AOA_Host_BytesReceived(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) | ||||
| 	  return 0; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (Pipe_IsINReceived()) | ||||
|  | @ -348,7 +322,7 @@ int16_t AOA_Host_ReceiveByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) | |||
| 
 | ||||
| 	int16_t ReceivedByte = -1; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (Pipe_IsINReceived()) | ||||
|  | @ -372,7 +346,7 @@ uint8_t AOA_Host_Flush(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (!(Pipe_BytesInPipe())) | ||||
|  |  | |||
|  | @ -85,11 +85,8 @@ | |||
| 			{ | ||||
| 				struct | ||||
| 				{ | ||||
| 					uint8_t  DataINPipeNumber; /**< Pipe number of the AOA interface's IN data pipe. */ | ||||
| 					bool     DataINPipeDoubleBank; /**< Indicates if the AOA interface's IN data pipe should use double banking. */ | ||||
| 
 | ||||
| 					uint8_t  DataOUTPipeNumber; /**< Pipe number of the AOA interface's OUT data pipe. */ | ||||
| 					bool     DataOUTPipeDoubleBank; /**< Indicates if the AOA interface's OUT data pipe should use double banking. */ | ||||
| 					USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ | ||||
| 					 | ||||
| 					char*    PropertyStrings[AOA_STRING_TOTAL_STRINGS]; /**< Android Accessory property strings, sent to identify the accessory when the
 | ||||
| 					                                                     *   Android device is switched into Open Accessory mode. */ | ||||
|  | @ -103,9 +100,6 @@ | |||
| 					                *   Configured state. | ||||
| 					                */ | ||||
| 					uint8_t  InterfaceNumber; /**< Interface index of the AOA interface within the attached device. */ | ||||
| 
 | ||||
| 					uint16_t DataINPipeSize; /**< Size in bytes of the AOA interface's IN data pipe. */ | ||||
| 					uint16_t DataOUTPipeSize;  /**< Size in bytes of the AOA interface's OUT data pipe. */ | ||||
| 				} State; /**< State data for the USB class interface within the device. All elements in this section
 | ||||
| 						  *   <b>may</b> be set to initial values, but may also be ignored to default to sane values when | ||||
| 						  *   the interface is enumerated. | ||||
|  |  | |||
|  | @ -51,8 +51,8 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa | |||
| 	if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) | ||||
| 	  return AUDIO_ENUMERROR_InvalidConfigDescriptor; | ||||
| 
 | ||||
| 	while ((AudioInterfaceInfo->Config.DataINPipeNumber  && !(DataINEndpoint)) || | ||||
| 	       (AudioInterfaceInfo->Config.DataOUTPipeNumber && !(DataOUTEndpoint))) | ||||
| 	while ((AudioInterfaceInfo->Config.DataINPipe.Address  && !(DataINEndpoint)) || | ||||
| 	       (AudioInterfaceInfo->Config.DataOUTPipe.Address && !(DataOUTEndpoint))) | ||||
| 	{ | ||||
| 		if (!(AudioControlInterface) || | ||||
| 		    USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, | ||||
|  | @ -93,45 +93,21 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa | |||
| 		  DataOUTEndpoint = EndpointData; | ||||
| 	} | ||||
| 
 | ||||
| 	for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++) | ||||
| 	{ | ||||
| 		uint16_t Size; | ||||
| 		uint8_t  Type; | ||||
| 		uint8_t  Token; | ||||
| 		uint8_t  EndpointAddress; | ||||
| 		bool     DoubleBanked; | ||||
| 
 | ||||
| 		if (PipeNum == AudioInterfaceInfo->Config.DataINPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_ISOCHRONOUS; | ||||
| 			DoubleBanked    = true; | ||||
| 
 | ||||
| 			AudioInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == AudioInterfaceInfo->Config.DataOUTPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_OUT; | ||||
| 			Type            = EP_TYPE_ISOCHRONOUS; | ||||
| 			DoubleBanked    = true; | ||||
| 
 | ||||
| 			AudioInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size, | ||||
| 		                         DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE))) | ||||
| 		{ | ||||
| 			return AUDIO_ENUMERROR_PipeConfigurationFailed; | ||||
| 		} | ||||
| 	} | ||||
| 	AudioInterfaceInfo->Config.DataINPipe.Size   = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 	AudioInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 	AudioInterfaceInfo->Config.DataINPipe.Type   = EP_TYPE_ISOCHRONOUS; | ||||
| 	AudioInterfaceInfo->Config.DataINPipe.Banks  = 2; | ||||
| 	 | ||||
| 	AudioInterfaceInfo->Config.DataOUTPipe.Size  = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 	AudioInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 	AudioInterfaceInfo->Config.DataOUTPipe.Type  = EP_TYPE_ISOCHRONOUS; | ||||
| 	AudioInterfaceInfo->Config.DataOUTPipe.Banks = 2; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&AudioInterfaceInfo->Config.DataINPipe, 1))) | ||||
| 	  return false; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&AudioInterfaceInfo->Config.DataOUTPipe, 1))) | ||||
| 	  return false; | ||||
| 
 | ||||
| 	AudioInterfaceInfo->State.ControlInterfaceNumber    = AudioControlInterface->InterfaceNumber; | ||||
| 	AudioInterfaceInfo->State.StreamingInterfaceNumber  = AudioStreamingInterface->InterfaceNumber; | ||||
|  |  | |||
|  | @ -79,14 +79,8 @@ | |||
| 			{ | ||||
| 				struct | ||||
| 				{ | ||||
| 					uint8_t  DataINPipeNumber; /**< Pipe number of the Audio interface's IN data pipe. If this interface should not
 | ||||
| 					                            *   bind to an IN endpoint, this may be set to 0 to disable audio input streaming for | ||||
| 					                            *   this driver instance. | ||||
| 					                            */ | ||||
| 					uint8_t  DataOUTPipeNumber; /**< Pipe number of the Audio interface's OUT data pipe. If this interface should not
 | ||||
| 					                            *   bind to an OUT endpoint, this may be set to 0 to disable audio output streaming for | ||||
| 					                            *   this driver instance. | ||||
| 					                            */ | ||||
| 					USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ | ||||
| 				} Config; /**< Config data for the USB class interface within the device. All elements in this section
 | ||||
| 				           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly. | ||||
| 				           */ | ||||
|  | @ -100,9 +94,6 @@ | |||
| 					uint8_t StreamingInterfaceNumber; /**< Interface index of the Audio Streaming interface within the attached device. */ | ||||
| 
 | ||||
| 					uint8_t EnabledStreamingAltIndex; /**< Alternative setting index of the Audio Streaming interface when the stream is enabled. */ | ||||
| 
 | ||||
| 					uint16_t DataINPipeSize; /**< Size in bytes of the Audio interface's IN data pipe. */ | ||||
| 					uint16_t DataOUTPipeSize;  /**< Size in bytes of the Audio interface's OUT data pipe. */ | ||||
| 				} State; /**< State data for the USB class interface within the device. All elements in this section
 | ||||
| 						  *   <b>may</b> be set to initial values, but may also be ignored to default to sane values when | ||||
| 						  *   the interface is enumerated. | ||||
|  | @ -201,7 +192,7 @@ | |||
| 
 | ||||
| 				bool SampleReceived = false; | ||||
| 
 | ||||
| 				Pipe_SelectPipe(AudioInterfaceInfo->Config.DataINPipeNumber); | ||||
| 				Pipe_SelectPipe(AudioInterfaceInfo->Config.DataINPipe.Address); | ||||
| 				Pipe_Unfreeze(); | ||||
| 				SampleReceived = Pipe_IsINReceived(); | ||||
| 				Pipe_Freeze(); | ||||
|  | @ -226,7 +217,7 @@ | |||
| 				if ((USB_HostState != HOST_STATE_Configured) || !(AudioInterfaceInfo->State.IsActive)) | ||||
| 				  return false; | ||||
| 
 | ||||
| 				Pipe_SelectPipe(AudioInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 				Pipe_SelectPipe(AudioInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 				return Pipe_IsOUTReady(); | ||||
| 			} | ||||
| 
 | ||||
|  |  | |||
|  | @ -99,62 +99,26 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++) | ||||
| 	{ | ||||
| 		uint16_t Size; | ||||
| 		uint8_t  Type; | ||||
| 		uint8_t  Token; | ||||
| 		uint8_t  EndpointAddress; | ||||
| 		uint8_t  InterruptPeriod; | ||||
| 		bool     DoubleBanked; | ||||
| 	CDCInterfaceInfo->Config.DataINPipe.Size  = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 	CDCInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 	CDCInterfaceInfo->Config.DataINPipe.Type  = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	CDCInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 	CDCInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 	CDCInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	CDCInterfaceInfo->Config.NotificationPipe.Size = le16_to_cpu(NotificationEndpoint->EndpointSize); | ||||
| 	CDCInterfaceInfo->Config.NotificationPipe.EndpointAddress = NotificationEndpoint->EndpointAddress; | ||||
| 	CDCInterfaceInfo->Config.NotificationPipe.Type = EP_TYPE_INTERRUPT; | ||||
| 
 | ||||
| 		if (PipeNum == CDCInterfaceInfo->Config.DataINPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = CDCInterfaceInfo->Config.DataINPipeDoubleBank; | ||||
| 			InterruptPeriod = 0; | ||||
| 	if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.DataINPipe, 1))) | ||||
| 	  return false; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.DataOUTPipe, 1))) | ||||
| 	  return false; | ||||
| 
 | ||||
| 			CDCInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == CDCInterfaceInfo->Config.DataOUTPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_OUT; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = CDCInterfaceInfo->Config.DataOUTPipeDoubleBank; | ||||
| 			InterruptPeriod = 0; | ||||
| 
 | ||||
| 			CDCInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == CDCInterfaceInfo->Config.NotificationPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(NotificationEndpoint->EndpointSize); | ||||
| 			EndpointAddress = NotificationEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_INTERRUPT; | ||||
| 			DoubleBanked    = CDCInterfaceInfo->Config.NotificationPipeDoubleBank; | ||||
| 			InterruptPeriod = NotificationEndpoint->PollingIntervalMS; | ||||
| 
 | ||||
| 			CDCInterfaceInfo->State.NotificationPipeSize = NotificationEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size, | ||||
| 		                         DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE))) | ||||
| 		{ | ||||
| 			return CDC_ENUMERROR_PipeConfigurationFailed; | ||||
| 		} | ||||
| 
 | ||||
| 		if (InterruptPeriod) | ||||
| 		  Pipe_SetInterruptPeriod(InterruptPeriod); | ||||
| 	} | ||||
| 	if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.NotificationPipe, 1))) | ||||
| 	  return false; | ||||
| 
 | ||||
| 	CDCInterfaceInfo->State.ControlInterfaceNumber = CDCControlInterface->InterfaceNumber; | ||||
| 	CDCInterfaceInfo->State.ControlLineStates.HostToDevice = (CDC_CONTROL_LINE_OUT_RTS | CDC_CONTROL_LINE_OUT_DTR); | ||||
|  | @ -231,7 +195,7 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive)) | ||||
| 	  return; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipeNumber); | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (Pipe_IsINReceived()) | ||||
|  | @ -321,7 +285,7 @@ uint8_t CDC_Host_SendData(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 
 | ||||
| 	Pipe_Unfreeze(); | ||||
| 	ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL); | ||||
|  | @ -338,7 +302,7 @@ uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 
 | ||||
| 	Pipe_Unfreeze(); | ||||
| 	ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL); | ||||
|  | @ -355,7 +319,7 @@ uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (!(Pipe_IsReadWriteAllowed())) | ||||
|  | @ -377,7 +341,7 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive)) | ||||
| 	  return 0; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (Pipe_IsINReceived()) | ||||
|  | @ -409,7 +373,7 @@ int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) | |||
| 
 | ||||
| 	int16_t ReceivedByte = -1; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (Pipe_IsINReceived()) | ||||
|  | @ -433,7 +397,7 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (!(Pipe_BytesInPipe())) | ||||
|  |  | |||
|  | @ -81,14 +81,9 @@ | |||
| 			{ | ||||
| 				struct | ||||
| 				{ | ||||
| 					uint8_t  DataINPipeNumber; /**< Pipe number of the CDC interface's IN data pipe. */ | ||||
| 					bool     DataINPipeDoubleBank; /**< Indicates if the CDC interface's IN data pipe should use double banking. */ | ||||
| 
 | ||||
| 					uint8_t  DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe. */ | ||||
| 					bool     DataOUTPipeDoubleBank; /**< Indicates if the CDC interface's OUT data pipe should use double banking. */ | ||||
| 
 | ||||
| 					uint8_t  NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used. */ | ||||
| 					bool     NotificationPipeDoubleBank; /**< Indicates if the CDC interface's notification pipe should use double banking. */ | ||||
| 					USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t NotificationPipe; /**< Notification IN Pipe configuration table. */ | ||||
| 				} Config; /**< Config data for the USB class interface within the device. All elements in this section
 | ||||
| 				           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly. | ||||
| 				           */ | ||||
|  | @ -100,10 +95,6 @@ | |||
| 					                */ | ||||
| 					uint8_t  ControlInterfaceNumber; /**< Interface index of the CDC-ACM control interface within the attached device. */ | ||||
| 
 | ||||
| 					uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe. */ | ||||
| 					uint16_t DataOUTPipeSize;  /**< Size in bytes of the CDC interface's OUT data pipe. */ | ||||
| 					uint16_t NotificationPipeSize;  /**< Size in bytes of the CDC interface's IN notification pipe, if used. */ | ||||
| 
 | ||||
| 					struct | ||||
| 					{ | ||||
| 						uint16_t HostToDevice; /**< Control line states from the host to device, as a set of \c CDC_CONTROL_LINE_OUT_*
 | ||||
|  |  | |||
|  | @ -94,55 +94,19 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo | |||
| 		  DataOUTEndpoint = EndpointData; | ||||
| 	} | ||||
| 
 | ||||
| 	for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++) | ||||
| 	{ | ||||
| 		uint16_t Size; | ||||
| 		uint8_t  Type; | ||||
| 		uint8_t  Token; | ||||
| 		uint8_t  EndpointAddress; | ||||
| 		uint8_t  InterruptPeriod; | ||||
| 		bool     DoubleBanked; | ||||
| 
 | ||||
| 		if (PipeNum == HIDInterfaceInfo->Config.DataINPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_INTERRUPT; | ||||
| 			DoubleBanked    = HIDInterfaceInfo->Config.DataINPipeDoubleBank; | ||||
| 			InterruptPeriod = DataINEndpoint->PollingIntervalMS; | ||||
| 
 | ||||
| 			HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber) | ||||
| 		{ | ||||
| 			if (DataOUTEndpoint == NULL) | ||||
| 			  continue; | ||||
| 
 | ||||
| 			Size            = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_OUT; | ||||
| 			Type            = EP_TYPE_INTERRUPT; | ||||
| 			DoubleBanked    = HIDInterfaceInfo->Config.DataOUTPipeDoubleBank; | ||||
| 			InterruptPeriod = DataOUTEndpoint->PollingIntervalMS; | ||||
| 
 | ||||
| 			HIDInterfaceInfo->State.DataOUTPipeSize   = DataOUTEndpoint->EndpointSize; | ||||
| 			HIDInterfaceInfo->State.DeviceUsesOUTPipe = true; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size, | ||||
| 		                         DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE))) | ||||
| 		{ | ||||
| 			return HID_ENUMERROR_PipeConfigurationFailed; | ||||
| 		} | ||||
| 
 | ||||
| 		if (InterruptPeriod) | ||||
| 		  Pipe_SetInterruptPeriod(InterruptPeriod); | ||||
| 	} | ||||
| 	HIDInterfaceInfo->Config.DataINPipe.Size  = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 	HIDInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 	HIDInterfaceInfo->Config.DataINPipe.Type  = EP_TYPE_INTERRUPT; | ||||
| 	 | ||||
| 	HIDInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 	HIDInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 	HIDInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_INTERRUPT; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataINPipe, 1))) | ||||
| 	  return false; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataOUTPipe, 1))) | ||||
| 	  return false; | ||||
| 
 | ||||
| 	HIDInterfaceInfo->State.InterfaceNumber      = HIDInterface->InterfaceNumber; | ||||
| 	HIDInterfaceInfo->State.HIDReportSize        = LE16_TO_CPU(HIDDescriptor->HIDReportLength); | ||||
|  | @ -227,7 +191,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	uint16_t ReportSize; | ||||
|  | @ -277,7 +241,7 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo | |||
| 	{ | ||||
| 		uint8_t ErrorCode; | ||||
| 
 | ||||
| 		Pipe_SelectPipe(HIDInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 		Pipe_SelectPipe(HIDInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 		Pipe_Unfreeze(); | ||||
| 
 | ||||
| 		if (ReportID) | ||||
|  | @ -320,7 +284,7 @@ bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) | |||
| 
 | ||||
| 	bool ReportReceived; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	ReportReceived = Pipe_IsINReceived(); | ||||
|  |  | |||
|  | @ -83,11 +83,8 @@ | |||
| 			{ | ||||
| 				struct | ||||
| 				{ | ||||
| 					uint8_t  DataINPipeNumber; /**< Pipe number of the HID interface's IN data pipe. */ | ||||
| 					bool     DataINPipeDoubleBank; /**< Indicates if the HID interface's IN data pipe should use double banking. */ | ||||
| 
 | ||||
| 					uint8_t  DataOUTPipeNumber; /**< Pipe number of the HID interface's OUT data pipe. */ | ||||
| 					bool     DataOUTPipeDoubleBank; /**< Indicates if the HID interface's OUT data pipe should use double banking. */ | ||||
| 					USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ | ||||
| 
 | ||||
| 					uint8_t  HIDInterfaceProtocol; /**< HID interface protocol value to match against if a specific
 | ||||
| 					                                *   boot subclass protocol is required, a protocol value from the | ||||
|  | @ -112,9 +109,6 @@ | |||
| 					                */ | ||||
| 					uint8_t InterfaceNumber; /**< Interface index of the HID interface within the attached device. */ | ||||
| 
 | ||||
| 					uint16_t DataINPipeSize; /**< Size in bytes of the HID interface's IN data pipe. */ | ||||
| 					uint16_t DataOUTPipeSize;  /**< Size in bytes of the HID interface's OUT data pipe. */ | ||||
| 
 | ||||
| 					bool SupportsBootProtocol; /**< Indicates if the current interface instance supports the HID Boot
 | ||||
| 					                            *   Protocol when enabled via \ref HID_Host_SetBootProtocol(). | ||||
| 					                            */ | ||||
|  |  | |||
|  | @ -78,45 +78,19 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI | |||
| 		  DataOUTEndpoint = EndpointData; | ||||
| 	} | ||||
| 
 | ||||
| 	for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++) | ||||
| 	{ | ||||
| 		uint16_t Size; | ||||
| 		uint8_t  Type; | ||||
| 		uint8_t  Token; | ||||
| 		uint8_t  EndpointAddress; | ||||
| 		bool     DoubleBanked; | ||||
| 
 | ||||
| 		if (PipeNum == MIDIInterfaceInfo->Config.DataINPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = MIDIInterfaceInfo->Config.DataINPipeDoubleBank; | ||||
| 
 | ||||
| 			MIDIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == MIDIInterfaceInfo->Config.DataOUTPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_OUT; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank; | ||||
| 
 | ||||
| 			MIDIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size, | ||||
| 		                         DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE))) | ||||
| 		{ | ||||
| 			return MIDI_ENUMERROR_PipeConfigurationFailed; | ||||
| 		} | ||||
| 	} | ||||
| 	MIDIInterfaceInfo->Config.DataINPipe.Size  = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 	MIDIInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 	MIDIInterfaceInfo->Config.DataINPipe.Type  = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	MIDIInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 	MIDIInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 	MIDIInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&MIDIInterfaceInfo->Config.DataINPipe, 1))) | ||||
| 	  return false; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&MIDIInterfaceInfo->Config.DataOUTPipe, 1))) | ||||
| 	  return false;	 | ||||
| 
 | ||||
| 	MIDIInterfaceInfo->State.InterfaceNumber = MIDIInterface->InterfaceNumber; | ||||
| 	MIDIInterfaceInfo->State.IsActive = true; | ||||
|  | @ -181,7 +155,7 @@ uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 
 | ||||
| 	if (Pipe_BytesInPipe()) | ||||
| 	{ | ||||
|  | @ -202,7 +176,7 @@ uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 
 | ||||
| 	if ((ErrorCode = Pipe_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != PIPE_RWSTREAM_NoError) | ||||
| 	  return ErrorCode; | ||||
|  | @ -219,7 +193,7 @@ bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive)) | ||||
| 	  return HOST_SENDCONTROL_DeviceDisconnected; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataINPipe.Address); | ||||
| 
 | ||||
| 	if (!(Pipe_IsReadWriteAllowed())) | ||||
| 	  return false; | ||||
|  |  | |||
|  | @ -79,11 +79,8 @@ | |||
| 			{ | ||||
| 				struct | ||||
| 				{ | ||||
| 					uint8_t  DataINPipeNumber; /**< Pipe number of the MIDI interface's streaming IN data pipe. */ | ||||
| 					bool     DataINPipeDoubleBank; /**< Indicates if the MIDI interface's IN data pipe should use double banking. */ | ||||
| 
 | ||||
| 					uint8_t  DataOUTPipeNumber; /**< Pipe number of the MIDI interface's streaming OUT data pipe. */ | ||||
| 					bool     DataOUTPipeDoubleBank; /**< Indicates if the MIDI interface's OUT data pipe should use double banking. */ | ||||
| 					USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ | ||||
| 				} Config; /**< Config data for the USB class interface within the device. All elements in this section
 | ||||
| 				           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly. | ||||
| 				           */ | ||||
|  | @ -94,9 +91,6 @@ | |||
| 					                    *   Configured state. | ||||
| 					                    */ | ||||
| 					uint8_t  InterfaceNumber; /**< Interface index of the MIDI interface within the attached device. */ | ||||
| 
 | ||||
| 					uint16_t DataINPipeSize; /**< Size in bytes of the MIDI Streaming Data interface's IN data pipe. */ | ||||
| 					uint16_t DataOUTPipeSize;  /**< Size in bytes of the MIDI Streaming Data interface's OUT data pipe. */ | ||||
| 				} State; /**< State data for the USB class interface within the device. All elements in this section
 | ||||
| 						  *   <b>may</b> be set to initial values, but may also be ignored to default to sane values when | ||||
| 						  *   the interface is enumerated. | ||||
|  |  | |||
|  | @ -78,45 +78,19 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, | |||
| 		  DataOUTEndpoint = EndpointData; | ||||
| 	} | ||||
| 
 | ||||
| 	for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++) | ||||
| 	{ | ||||
| 		uint16_t Size; | ||||
| 		uint8_t  Type; | ||||
| 		uint8_t  Token; | ||||
| 		uint8_t  EndpointAddress; | ||||
| 		bool     DoubleBanked; | ||||
| 
 | ||||
| 		if (PipeNum == MSInterfaceInfo->Config.DataINPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = MSInterfaceInfo->Config.DataINPipeDoubleBank; | ||||
| 
 | ||||
| 			MSInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == MSInterfaceInfo->Config.DataOUTPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_OUT; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = MSInterfaceInfo->Config.DataOUTPipeDoubleBank; | ||||
| 
 | ||||
| 			MSInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size, | ||||
| 		                         DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE))) | ||||
| 		{ | ||||
| 			return MS_ENUMERROR_PipeConfigurationFailed; | ||||
| 		} | ||||
| 	} | ||||
| 	MSInterfaceInfo->Config.DataINPipe.Size  = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 	MSInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 	MSInterfaceInfo->Config.DataINPipe.Type  = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	MSInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 	MSInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 	MSInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&MSInterfaceInfo->Config.DataINPipe, 1))) | ||||
| 	  return false; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&MSInterfaceInfo->Config.DataOUTPipe, 1))) | ||||
| 	  return false; | ||||
| 
 | ||||
| 	MSInterfaceInfo->State.InterfaceNumber = MassStorageInterface->InterfaceNumber; | ||||
| 	MSInterfaceInfo->State.IsActive = true; | ||||
|  | @ -178,7 +152,7 @@ static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInf | |||
| 	SCSICommandBlock->Signature = CPU_TO_LE32(MS_CBW_SIGNATURE); | ||||
| 	SCSICommandBlock->Tag       = cpu_to_le32(MSInterfaceInfo->State.TransactionTag); | ||||
| 
 | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if ((ErrorCode = Pipe_Write_Stream_LE(SCSICommandBlock, sizeof(MS_CommandBlockWrapper_t), | ||||
|  | @ -212,7 +186,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte | |||
| 	uint16_t TimeoutMSRem        = MS_COMMAND_DATA_TIMEOUT_MS; | ||||
| 	uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber(); | ||||
| 
 | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	while (!(Pipe_IsINReceived())) | ||||
|  | @ -228,7 +202,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte | |||
| 		} | ||||
| 
 | ||||
| 		Pipe_Freeze(); | ||||
| 		Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 		Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 		Pipe_Unfreeze(); | ||||
| 
 | ||||
| 		if (Pipe_IsStalled()) | ||||
|  | @ -238,7 +212,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte | |||
| 		} | ||||
| 
 | ||||
| 		Pipe_Freeze(); | ||||
| 		Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber); | ||||
| 		Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); | ||||
| 		Pipe_Unfreeze(); | ||||
| 
 | ||||
| 		if (Pipe_IsStalled()) | ||||
|  | @ -251,10 +225,10 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte | |||
| 		  return PIPE_RWSTREAM_DeviceDisconnected; | ||||
| 	}; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Freeze(); | ||||
| 
 | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Freeze(); | ||||
| 
 | ||||
| 	return PIPE_RWSTREAM_NoError; | ||||
|  | @ -275,7 +249,7 @@ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfac | |||
| 			return ErrorCode; | ||||
| 		} | ||||
| 
 | ||||
| 		Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber); | ||||
| 		Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); | ||||
| 		Pipe_Unfreeze(); | ||||
| 
 | ||||
| 		if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError) | ||||
|  | @ -285,7 +259,7 @@ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfac | |||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 		Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 		Pipe_Unfreeze(); | ||||
| 
 | ||||
| 		if ((ErrorCode = Pipe_Write_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError) | ||||
|  | @ -313,7 +287,7 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterf | |||
| 	if ((ErrorCode = MS_Host_WaitForDataReceived(MSInterfaceInfo)) != PIPE_RWSTREAM_NoError) | ||||
| 	  return ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t), | ||||
|  | @ -349,12 +323,12 @@ uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) | |||
| 	if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) | ||||
| 	  return ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); | ||||
| 
 | ||||
| 	if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) | ||||
| 	  return ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 
 | ||||
| 	if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) | ||||
| 	  return ErrorCode; | ||||
|  |  | |||
|  | @ -83,11 +83,8 @@ | |||
| 			{ | ||||
| 				struct | ||||
| 				{ | ||||
| 					uint8_t  DataINPipeNumber; /**< Pipe number of the Mass Storage interface's IN data pipe. */ | ||||
| 					bool     DataINPipeDoubleBank; /**< Indicates if the Mass Storage interface's IN data pipe should use double banking. */ | ||||
| 
 | ||||
| 					uint8_t  DataOUTPipeNumber; /**< Pipe number of the Mass Storage interface's OUT data pipe. */ | ||||
| 					bool     DataOUTPipeDoubleBank; /**< Indicates if the Mass Storage interface's OUT data pipe should use double banking. */ | ||||
| 					USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ | ||||
| 				} Config; /**< Config data for the USB class interface within the device. All elements in this section
 | ||||
| 				           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly. | ||||
| 				           */ | ||||
|  | @ -99,9 +96,6 @@ | |||
| 					                    */ | ||||
| 					uint8_t  InterfaceNumber; /**< Interface index of the Mass Storage interface within the attached device. */ | ||||
| 
 | ||||
| 					uint16_t DataINPipeSize; /**< Size in bytes of the Mass Storage interface's IN data pipe. */ | ||||
| 					uint16_t DataOUTPipeSize;  /**< Size in bytes of the Mass Storage interface's OUT data pipe. */ | ||||
| 
 | ||||
| 					uint32_t TransactionTag; /**< Current transaction tag for data synchronizing of packets. */ | ||||
| 				} State; /**< State data for the USB class interface within the device. All elements in this section
 | ||||
| 						  *   <b>may</b> be set to initial values, but may also be ignored to default to sane values when | ||||
|  |  | |||
|  | @ -78,45 +78,19 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI | |||
| 		  DataOUTEndpoint = EndpointData; | ||||
| 	} | ||||
| 
 | ||||
| 	for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++) | ||||
| 	{ | ||||
| 		uint16_t Size; | ||||
| 		uint8_t  Type; | ||||
| 		uint8_t  Token; | ||||
| 		uint8_t  EndpointAddress; | ||||
| 		bool     DoubleBanked; | ||||
| 
 | ||||
| 		if (PipeNum == PRNTInterfaceInfo->Config.DataINPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = PRNTInterfaceInfo->Config.DataINPipeDoubleBank; | ||||
| 
 | ||||
| 			PRNTInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == PRNTInterfaceInfo->Config.DataOUTPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_OUT; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank; | ||||
| 
 | ||||
| 			PRNTInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size, | ||||
| 		                         DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE))) | ||||
| 		{ | ||||
| 			return PRNT_ENUMERROR_PipeConfigurationFailed; | ||||
| 		} | ||||
| 	} | ||||
| 	PRNTInterfaceInfo->Config.DataINPipe.Size  = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 	PRNTInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 	PRNTInterfaceInfo->Config.DataINPipe.Type  = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	PRNTInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 	PRNTInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 	PRNTInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&PRNTInterfaceInfo->Config.DataINPipe, 1))) | ||||
| 	  return false; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&PRNTInterfaceInfo->Config.DataOUTPipe, 1))) | ||||
| 	  return false;	 | ||||
| 
 | ||||
| 	PRNTInterfaceInfo->State.InterfaceNumber  = PrinterInterface->InterfaceNumber; | ||||
| 	PRNTInterfaceInfo->State.AlternateSetting = PrinterInterface->AlternateSetting; | ||||
|  | @ -229,7 +203,7 @@ uint8_t PRNT_Host_Flush(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (!(Pipe_BytesInPipe())) | ||||
|  | @ -260,7 +234,7 @@ uint8_t PRNT_Host_SendByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, | |||
| 
 | ||||
| 	uint8_t ErrorCode; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (!(Pipe_IsReadWriteAllowed())) | ||||
|  | @ -285,7 +259,7 @@ uint8_t PRNT_Host_SendString(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive)) | ||||
| 	  return PIPE_RWSTREAM_DeviceDisconnected; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if ((ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL)) != PIPE_RWSTREAM_NoError) | ||||
|  | @ -309,7 +283,7 @@ uint8_t PRNT_Host_SendData(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive)) | ||||
| 	  return PIPE_RWSTREAM_DeviceDisconnected; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL)) != PIPE_RWSTREAM_NoError) | ||||
|  | @ -329,7 +303,7 @@ uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive)) | ||||
| 	  return 0; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (Pipe_IsINReceived()) | ||||
|  | @ -361,7 +335,7 @@ int16_t PRNT_Host_ReceiveByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo | |||
| 
 | ||||
| 	int16_t ReceivedByte = -1; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (Pipe_IsINReceived()) | ||||
|  |  | |||
|  | @ -79,11 +79,8 @@ | |||
| 			{ | ||||
| 				struct | ||||
| 				{ | ||||
| 					uint8_t  DataINPipeNumber; /**< Pipe number of the Printer interface's IN data pipe. */ | ||||
| 					bool     DataINPipeDoubleBank; /**< Indicates if the Printer interface's IN data pipe should use double banking. */ | ||||
| 
 | ||||
| 					uint8_t  DataOUTPipeNumber; /**< Pipe number of the Printer interface's OUT data pipe. */ | ||||
| 					bool     DataOUTPipeDoubleBank; /**< Indicates if the Printer interface's OUT data pipe should use double banking. */ | ||||
| 					USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ | ||||
| 				} Config; /**< Config data for the USB class interface within the device. All elements in this section
 | ||||
| 				           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly. | ||||
| 				           */ | ||||
|  | @ -95,9 +92,6 @@ | |||
| 					                */ | ||||
| 					uint8_t InterfaceNumber; /**< Interface index of the Printer interface within the attached device. */ | ||||
| 					uint8_t AlternateSetting; /**< Alternate setting within the Printer Interface in the attached device. */ | ||||
| 
 | ||||
| 					uint16_t DataINPipeSize; /**< Size in bytes of the Printer interface's IN data pipe. */ | ||||
| 					uint16_t DataOUTPipeSize;  /**< Size in bytes of the Printer interface's OUT data pipe. */ | ||||
| 				} State; /**< State data for the USB class interface within the device. All elements in this section
 | ||||
| 						  *   <b>may</b> be set to initial values, but may also be ignored to default to sane values when | ||||
| 						  *   the interface is enumerated. | ||||
|  |  | |||
|  | @ -101,62 +101,26 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++) | ||||
| 	{ | ||||
| 		uint16_t Size; | ||||
| 		uint8_t  Type; | ||||
| 		uint8_t  Token; | ||||
| 		uint8_t  EndpointAddress; | ||||
| 		uint8_t  InterruptPeriod; | ||||
| 		bool     DoubleBanked; | ||||
| 	RNDISInterfaceInfo->Config.DataINPipe.Size  = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 	RNDISInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 	RNDISInterfaceInfo->Config.DataINPipe.Type  = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	RNDISInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 	RNDISInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 	RNDISInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	RNDISInterfaceInfo->Config.NotificationPipe.Size = le16_to_cpu(NotificationEndpoint->EndpointSize); | ||||
| 	RNDISInterfaceInfo->Config.NotificationPipe.EndpointAddress = NotificationEndpoint->EndpointAddress; | ||||
| 	RNDISInterfaceInfo->Config.NotificationPipe.Type = EP_TYPE_INTERRUPT; | ||||
| 
 | ||||
| 		if (PipeNum == RNDISInterfaceInfo->Config.DataINPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = RNDISInterfaceInfo->Config.DataINPipeDoubleBank; | ||||
| 			InterruptPeriod = 0; | ||||
| 	if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.DataINPipe, 1))) | ||||
| 	  return false; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.DataOUTPipe, 1))) | ||||
| 	  return false; | ||||
| 
 | ||||
| 			RNDISInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == RNDISInterfaceInfo->Config.DataOUTPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 			EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_OUT; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = RNDISInterfaceInfo->Config.DataOUTPipeDoubleBank; | ||||
| 			InterruptPeriod = 0; | ||||
| 
 | ||||
| 			RNDISInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == RNDISInterfaceInfo->Config.NotificationPipeNumber) | ||||
| 		{ | ||||
| 			Size            = le16_to_cpu(NotificationEndpoint->EndpointSize); | ||||
| 			EndpointAddress = NotificationEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_INTERRUPT; | ||||
| 			DoubleBanked    = RNDISInterfaceInfo->Config.NotificationPipeDoubleBank; | ||||
| 			InterruptPeriod = NotificationEndpoint->PollingIntervalMS; | ||||
| 
 | ||||
| 			RNDISInterfaceInfo->State.NotificationPipeSize = NotificationEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size, | ||||
| 		                         DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE))) | ||||
| 		{ | ||||
| 			return CDC_ENUMERROR_PipeConfigurationFailed; | ||||
| 		} | ||||
| 
 | ||||
| 		if (InterruptPeriod) | ||||
| 		  Pipe_SetInterruptPeriod(InterruptPeriod); | ||||
| 	} | ||||
| 	if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.NotificationPipe, 1))) | ||||
| 	  return false; | ||||
| 
 | ||||
| 	RNDISInterfaceInfo->State.ControlInterfaceNumber = RNDISControlInterface->InterfaceNumber; | ||||
| 	RNDISInterfaceInfo->State.IsActive = true; | ||||
|  | @ -419,7 +383,7 @@ bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfac | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive)) | ||||
| 	  return false; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipe.Address); | ||||
| 
 | ||||
| 	Pipe_Unfreeze(); | ||||
| 	PacketWaiting = Pipe_IsINReceived(); | ||||
|  | @ -437,7 +401,7 @@ uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive)) | ||||
| 	  return PIPE_READYWAIT_DeviceDisconnected; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (!(Pipe_IsReadWriteAllowed())) | ||||
|  | @ -491,7 +455,7 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn | |||
| 	DeviceMessage.DataOffset    = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)); | ||||
| 	DeviceMessage.DataLength    = cpu_to_le32(PacketLength); | ||||
| 
 | ||||
| 	Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if ((ErrorCode = Pipe_Write_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t), | ||||
|  |  | |||
|  | @ -80,14 +80,9 @@ | |||
| 			{ | ||||
| 				struct | ||||
| 				{ | ||||
| 					uint8_t  DataINPipeNumber; /**< Pipe number of the RNDIS interface's IN data pipe. */ | ||||
| 					bool     DataINPipeDoubleBank; /**< Indicates if the RNDIS interface's IN data pipe should use double banking. */ | ||||
| 
 | ||||
| 					uint8_t  DataOUTPipeNumber; /**< Pipe number of the RNDIS interface's OUT data pipe. */ | ||||
| 					bool     DataOUTPipeDoubleBank; /**< Indicates if the RNDIS interface's OUT data pipe should use double banking. */ | ||||
| 
 | ||||
| 					uint8_t  NotificationPipeNumber; /**< Pipe number of the RNDIS interface's IN notification endpoint, if used. */ | ||||
| 					bool     NotificationPipeDoubleBank; /**< Indicates if the RNDIS interface's notification pipe should use double banking. */ | ||||
| 					USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t NotificationPipe; /**< Notification IN Pipe configuration table. */ | ||||
| 
 | ||||
| 					uint32_t HostMaxPacketSize; /**< Maximum size of a packet which can be buffered by the host. */ | ||||
| 				} Config; /**< Config data for the USB class interface within the device. All elements in this section
 | ||||
|  | @ -101,10 +96,6 @@ | |||
| 					                */ | ||||
| 					uint8_t ControlInterfaceNumber; /**< Interface index of the RNDIS control interface within the attached device. */ | ||||
| 
 | ||||
| 					uint16_t DataINPipeSize; /**< Size in bytes of the RNDIS interface's IN data pipe. */ | ||||
| 					uint16_t DataOUTPipeSize;  /**< Size in bytes of the RNDIS interface's OUT data pipe. */ | ||||
| 					uint16_t NotificationPipeSize;  /**< Size in bytes of the RNDIS interface's IN notification pipe, if used. */ | ||||
| 
 | ||||
| 					uint32_t DeviceMaxPacketSize; /**< Maximum size of a packet which can be buffered by the attached RNDIS device. */ | ||||
| 
 | ||||
| 					uint32_t RequestID; /**< Request ID counter to give a unique ID for each command/response pair. */ | ||||
|  |  | |||
|  | @ -87,63 +87,27 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++) | ||||
| 	{ | ||||
| 		uint16_t Size; | ||||
| 		uint8_t  Type; | ||||
| 		uint8_t  Token; | ||||
| 		uint8_t  EndpointAddress; | ||||
| 		uint8_t  InterruptPeriod; | ||||
| 		bool     DoubleBanked; | ||||
| 	SIInterfaceInfo->Config.DataINPipe.Size  = le16_to_cpu(DataINEndpoint->EndpointSize); | ||||
| 	SIInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 	SIInterfaceInfo->Config.DataINPipe.Type  = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	SIInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); | ||||
| 	SIInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 	SIInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; | ||||
| 	 | ||||
| 	SIInterfaceInfo->Config.EventsPipe.Size = le16_to_cpu(EventsEndpoint->EndpointSize); | ||||
| 	SIInterfaceInfo->Config.EventsPipe.EndpointAddress = EventsEndpoint->EndpointAddress; | ||||
| 	SIInterfaceInfo->Config.EventsPipe.Type = EP_TYPE_INTERRUPT; | ||||
| 
 | ||||
| 		if (PipeNum == SIInterfaceInfo->Config.DataINPipeNumber) | ||||
| 		{ | ||||
| 			Size            = DataINEndpoint->EndpointSize; | ||||
| 			EndpointAddress = DataINEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = SIInterfaceInfo->Config.DataINPipeDoubleBank; | ||||
| 			InterruptPeriod = 0; | ||||
| 
 | ||||
| 			SIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == SIInterfaceInfo->Config.DataOUTPipeNumber) | ||||
| 		{ | ||||
| 			Size            = DataOUTEndpoint->EndpointSize; | ||||
| 			EndpointAddress = DataOUTEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_OUT; | ||||
| 			Type            = EP_TYPE_BULK; | ||||
| 			DoubleBanked    = SIInterfaceInfo->Config.DataOUTPipeDoubleBank; | ||||
| 			InterruptPeriod = 0; | ||||
| 
 | ||||
| 			SIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else if (PipeNum == SIInterfaceInfo->Config.EventsPipeNumber) | ||||
| 		{ | ||||
| 			Size            = EventsEndpoint->EndpointSize; | ||||
| 			EndpointAddress = EventsEndpoint->EndpointAddress; | ||||
| 			Token           = PIPE_TOKEN_IN; | ||||
| 			Type            = EP_TYPE_INTERRUPT; | ||||
| 			DoubleBanked    = SIInterfaceInfo->Config.EventsPipeDoubleBank; | ||||
| 			InterruptPeriod = EventsEndpoint->PollingIntervalMS; | ||||
| 
 | ||||
| 			SIInterfaceInfo->State.EventsPipeSize = EventsEndpoint->EndpointSize; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size, | ||||
| 		                         DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE))) | ||||
| 		{ | ||||
| 			return SI_ENUMERROR_PipeConfigurationFailed; | ||||
| 		} | ||||
| 
 | ||||
| 		if (InterruptPeriod) | ||||
| 		  Pipe_SetInterruptPeriod(InterruptPeriod); | ||||
| 	} | ||||
| 	if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.DataINPipe, 1))) | ||||
| 	  return false; | ||||
| 	 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.DataOUTPipe, 1))) | ||||
| 	  return false; | ||||
| 
 | ||||
| 	if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.EventsPipe, 1))) | ||||
| 	  return false; | ||||
| 	 | ||||
| 	SIInterfaceInfo->State.InterfaceNumber = StillImageInterface->InterfaceNumber; | ||||
| 	SIInterfaceInfo->State.IsActive = true; | ||||
| 
 | ||||
|  | @ -204,7 +168,7 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, | |||
| 	if (SIInterfaceInfo->State.IsSessionOpen) | ||||
| 	  PIMAHeader->TransactionID = cpu_to_le32(SIInterfaceInfo->State.TransactionID++); | ||||
| 
 | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if ((ErrorCode = Pipe_Write_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NULL)) != PIPE_RWSTREAM_NoError) | ||||
|  | @ -233,7 +197,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) | ||||
| 	  return PIPE_RWSTREAM_DeviceDisconnected; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	while (!(Pipe_IsINReceived())) | ||||
|  | @ -249,7 +213,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf | |||
| 		} | ||||
| 
 | ||||
| 		Pipe_Freeze(); | ||||
| 		Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 		Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 		Pipe_Unfreeze(); | ||||
| 
 | ||||
| 		if (Pipe_IsStalled()) | ||||
|  | @ -259,7 +223,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf | |||
| 		} | ||||
| 
 | ||||
| 		Pipe_Freeze(); | ||||
| 		Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipeNumber); | ||||
| 		Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipe.Address); | ||||
| 		Pipe_Unfreeze(); | ||||
| 
 | ||||
| 		if (Pipe_IsStalled()) | ||||
|  | @ -298,7 +262,7 @@ uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) | ||||
| 	  return PIPE_RWSTREAM_DeviceDisconnected; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber); | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes, NULL); | ||||
|  | @ -318,7 +282,7 @@ uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) | ||||
| 	  return PIPE_RWSTREAM_DeviceDisconnected; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipeNumber); | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes, NULL); | ||||
|  | @ -335,7 +299,7 @@ bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) | ||||
| 	  return false; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber); | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	if (Pipe_BytesInPipe()) | ||||
|  | @ -354,7 +318,7 @@ uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf | |||
| 	if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) | ||||
| 	  return PIPE_RWSTREAM_DeviceDisconnected; | ||||
| 
 | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber); | ||||
| 	Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipe.Address); | ||||
| 	Pipe_Unfreeze(); | ||||
| 
 | ||||
| 	ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(PIMA_Container_t), NULL); | ||||
|  |  | |||
|  | @ -83,14 +83,9 @@ | |||
| 			{ | ||||
| 				struct | ||||
| 				{ | ||||
| 					uint8_t  DataINPipeNumber; /**< Pipe number of the Still Image interface's IN data pipe. */ | ||||
| 					bool     DataINPipeDoubleBank; /**< Indicates if the Still Image interface's IN data pipe should use double banking. */ | ||||
| 
 | ||||
| 					uint8_t  DataOUTPipeNumber; /**< Pipe number of the Still Image interface's OUT data pipe. */ | ||||
| 					bool     DataOUTPipeDoubleBank; /**< Indicates if the Still Image interface's OUT data pipe should use double banking. */ | ||||
| 
 | ||||
| 					uint8_t  EventsPipeNumber; /**< Pipe number of the Still Image interface's IN events endpoint, if used. */ | ||||
| 					bool     EventsPipeDoubleBank; /**< Indicates if the Still Image interface's events data pipe should use double banking. */ | ||||
| 					USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ | ||||
| 					USB_Pipe_Table_t EventsPipe; /**< Event notification IN Pipe configuration table. */ | ||||
| 				} Config; /**< Config data for the USB class interface within the device. All elements in this section
 | ||||
| 				           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly. | ||||
| 				           */ | ||||
|  | @ -102,10 +97,6 @@ | |||
| 					                    */ | ||||
| 					uint8_t  InterfaceNumber; /**< Interface index of the Still Image interface within the attached device. */ | ||||
| 
 | ||||
| 					uint16_t DataINPipeSize; /**< Size in bytes of the Still Image interface's IN data pipe. */ | ||||
| 					uint16_t DataOUTPipeSize;  /**< Size in bytes of the Still Image interface's OUT data pipe. */ | ||||
| 					uint16_t EventsPipeSize;  /**< Size in bytes of the Still Image interface's IN events pipe. */ | ||||
| 
 | ||||
| 					bool IsSessionOpen; /**< Indicates if a PIMA session is currently open with the attached device. */ | ||||
| 					uint32_t TransactionID; /**< Transaction ID for the next transaction to send to the device. */ | ||||
| 				} State; /**< State data for the USB class interface within the device. All elements in this section
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dean Camera
						Dean Camera