Cleanups to RNDIS device demos. Fix issue in RNDIS demos where the memory would become corrupted due to an incorrect bounds check when iterating over the port state table, causing random resets.
Revert change to Template_Endpoint_Control_R.c, which broke control stream reads. Remove uneeded ADC.h include in the class driver AudioOutput demo.
This commit is contained in:
		
							parent
							
								
									85c2716f2d
								
							
						
					
					
						commit
						d423090b26
					
				
					 16 changed files with 75 additions and 70 deletions
				
			
		| 
						 | 
				
			
			@ -1,12 +1,8 @@
 | 
			
		|||
uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
 | 
			
		||||
{
 | 
			
		||||
	uint8_t* DataStream     = (uint8_t*)(Buffer + TEMPLATE_BUFFER_OFFSET(Length));
 | 
			
		||||
	bool     LastPacketFull = false;
 | 
			
		||||
	uint8_t* DataStream = (uint8_t*)(Buffer + TEMPLATE_BUFFER_OFFSET(Length));
 | 
			
		||||
	
 | 
			
		||||
	if (Length > USB_ControlRequest.wLength)
 | 
			
		||||
	  Length = USB_ControlRequest.wLength;
 | 
			
		||||
 | 
			
		||||
	while (Length || LastPacketFull)
 | 
			
		||||
	while (Length)
 | 
			
		||||
	{
 | 
			
		||||
		if (Endpoint_IsSETUPReceived())
 | 
			
		||||
		  return ENDPOINT_RWCSTREAM_HostAborted;
 | 
			
		||||
| 
						 | 
				
			
			@ -16,8 +12,6 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
 | 
			
		|||
		  
 | 
			
		||||
		if (Endpoint_IsOUTReceived())
 | 
			
		||||
		{
 | 
			
		||||
			LastPacketFull = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize);
 | 
			
		||||
		
 | 
			
		||||
			while (Length && Endpoint_BytesInEndpoint())
 | 
			
		||||
			{
 | 
			
		||||
				TEMPLATE_TRANSFER_BYTE(DataStream);
 | 
			
		||||
| 
						 | 
				
			
			@ -25,9 +19,6 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
 | 
			
		|||
			}
 | 
			
		||||
			
 | 
			
		||||
			Endpoint_ClearOUT();
 | 
			
		||||
			
 | 
			
		||||
			if (!(LastPacketFull))
 | 
			
		||||
			  Length = 0;
 | 
			
		||||
		}		  
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue