Fixed incorrect/missing control status stage transfers on demos, bootloaders and applications (thanks to Nate Lawson).
This commit is contained in:
		
							parent
							
								
									4a09da2098
								
							
						
					
					
						commit
						3803976534
					
				
					 23 changed files with 157 additions and 67 deletions
				
			
		| 
						 | 
				
			
			@ -163,7 +163,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
					Scheduler_SetTaskMode(USB_Audio_Task, TASK_STOP);				
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				/* Handshake the request */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -193,7 +193,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
					Scheduler_SetTaskMode(USB_Audio_Task, TASK_STOP);				
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				/* Handshake the request */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -249,7 +250,7 @@ TASK(USB_Audio_Task)
 | 
			
		|||
		/* Check to see if the bank is now empty */
 | 
			
		||||
		if (!(Endpoint_ReadWriteAllowed()))
 | 
			
		||||
		{
 | 
			
		||||
			/* Acknowedge the packet, clear the bank ready for the next packet */
 | 
			
		||||
			/* Acknowledge the packet, clear the bank ready for the next packet */
 | 
			
		||||
			Endpoint_ClearCurrentBank();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -171,7 +171,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
		case REQ_GetLineEncoding:
 | 
			
		||||
			if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{	
 | 
			
		||||
				/* Acknowedge the SETUP packet, ready for data transfer */
 | 
			
		||||
				/* Acknowledge the SETUP packet, ready for data transfer */
 | 
			
		||||
				Endpoint_ClearSetupReceived();
 | 
			
		||||
 | 
			
		||||
				/* Write the line coding data to the control endpoint */
 | 
			
		||||
| 
						 | 
				
			
			@ -185,7 +185,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
		case REQ_SetLineEncoding:
 | 
			
		||||
			if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{
 | 
			
		||||
				/* Acknowedge the SETUP packet, ready for data transfer */
 | 
			
		||||
				/* Acknowledge the SETUP packet, ready for data transfer */
 | 
			
		||||
				Endpoint_ClearSetupReceived();
 | 
			
		||||
 | 
			
		||||
				/* Read the line coding data in from the host into the global struct */
 | 
			
		||||
| 
						 | 
				
			
			@ -210,10 +210,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				// Do something with the given line states in wIndex
 | 
			
		||||
#endif
 | 
			
		||||
				
 | 
			
		||||
				/* Acknowedge the SETUP packet, ready for data transfer */
 | 
			
		||||
				/* Acknowledge the SETUP packet, ready for data transfer */
 | 
			
		||||
				Endpoint_ClearSetupReceived();
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -209,7 +209,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
		case REQ_GetLineEncoding:
 | 
			
		||||
			if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{	
 | 
			
		||||
				/* Acknowedge the SETUP packet, ready for data transfer */
 | 
			
		||||
				/* Acknowledge the SETUP packet, ready for data transfer */
 | 
			
		||||
				Endpoint_ClearSetupReceived();
 | 
			
		||||
 | 
			
		||||
				/* Write the line coding data to the control endpoint */
 | 
			
		||||
| 
						 | 
				
			
			@ -223,7 +223,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
		case REQ_SetLineEncoding:
 | 
			
		||||
			if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{
 | 
			
		||||
				/* Acknowedge the SETUP packet, ready for data transfer */
 | 
			
		||||
				/* Acknowledge the SETUP packet, ready for data transfer */
 | 
			
		||||
				Endpoint_ClearSetupReceived();
 | 
			
		||||
 | 
			
		||||
				/* Read the line coding data in from the host into the global struct */
 | 
			
		||||
| 
						 | 
				
			
			@ -237,10 +237,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
		case REQ_SetControlLineState:
 | 
			
		||||
			if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{
 | 
			
		||||
				/* Acknowedge the SETUP packet, ready for data transfer */
 | 
			
		||||
				/* Acknowledge the SETUP packet, ready for data transfer */
 | 
			
		||||
				Endpoint_ClearSetupReceived();
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command (currently unused) */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -210,10 +210,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Clear the endpoint data */
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
 | 
			
		||||
				/* Wait until the host is ready to receive the request confirmation */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				
 | 
			
		||||
				/* Handshake the request by sending an empty IN packet */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -228,6 +226,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
				
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -242,7 +244,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
 | 
			
		||||
				UsingReportProtocol = (wValue != 0x0000);
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -258,7 +261,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Get idle period in MSB */
 | 
			
		||||
				IdleCount = (wValue >> 8);
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -273,6 +277,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -212,10 +212,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Clear the endpoint data */
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
 | 
			
		||||
				/* Wait until the host is ready to receive the request confirmation */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				
 | 
			
		||||
				/* Handshake the request by sending an empty IN packet */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -230,6 +228,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -244,7 +246,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
 | 
			
		||||
				UsingReportProtocol = (wValue != 0x0000);
 | 
			
		||||
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -260,7 +263,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Get idle period in MSB */
 | 
			
		||||
				IdleCount = (wValue >> 8);
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -275,6 +279,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -213,10 +213,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Clear the endpoint data */
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
 | 
			
		||||
				/* Wait until the host is ready to receive the request confirmation */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				
 | 
			
		||||
				/* Handshake the request by sending an empty IN packet */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -211,10 +211,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Clear the endpoint data */
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
 | 
			
		||||
				/* Wait until the host is ready to receive the request confirmation */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				
 | 
			
		||||
				/* Handshake the request by sending an empty IN packet */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -229,6 +227,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -243,7 +245,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
 | 
			
		||||
				UsingReportProtocol = (wValue != 0x0000);
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -259,7 +262,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Get idle period in MSB */
 | 
			
		||||
				IdleCount = (wValue >> 8);
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -274,6 +278,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -159,10 +159,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
		case REQ_MassStorageReset:
 | 
			
		||||
			if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{
 | 
			
		||||
				/* Indicate that the current transfer should be aborted */
 | 
			
		||||
				IsMassStoreReset = true;
 | 
			
		||||
			
 | 
			
		||||
				Endpoint_ClearSetupReceived();
 | 
			
		||||
 | 
			
		||||
				/* Indicate that the current transfer should be aborted */
 | 
			
		||||
				IsMassStoreReset = true;			
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -171,9 +174,15 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
			if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{
 | 
			
		||||
				/* Indicate to the host the number of supported LUNs (virtual disks) on the device */
 | 
			
		||||
				Endpoint_ClearSetupReceived();			
 | 
			
		||||
				Endpoint_ClearSetupReceived();
 | 
			
		||||
 | 
			
		||||
				Endpoint_Write_Byte(TOTAL_LUNS - 1);
 | 
			
		||||
				
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
				
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -201,6 +201,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -215,7 +219,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
 | 
			
		||||
				UsingReportProtocol = (wValue != 0x0000);
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -231,7 +236,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Get idle period in MSB */
 | 
			
		||||
				IdleCount = (wValue >> 8);
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -246,6 +252,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -200,6 +200,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -214,7 +218,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
 | 
			
		||||
				UsingReportProtocol = (wValue != 0x0000);
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -230,7 +235,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Get idle period in MSB */
 | 
			
		||||
				IdleCount = (wValue >> 8);
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -245,6 +251,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -198,6 +198,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -212,7 +216,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
 | 
			
		||||
				UsingReportProtocol = (wValue != 0x0000);
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -228,7 +233,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				/* Get idle period in MSB */
 | 
			
		||||
				IdleCount = (wValue >> 8);
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			@ -243,6 +249,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				
 | 
			
		||||
				/* Send the flag to the host */
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupOUTReceived()));
 | 
			
		||||
				Endpoint_ClearSetupOUT();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -164,7 +164,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
		case REQ_GetLineEncoding:
 | 
			
		||||
			if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{	
 | 
			
		||||
				/* Acknowedge the SETUP packet, ready for data transfer */
 | 
			
		||||
				/* Acknowledge the SETUP packet, ready for data transfer */
 | 
			
		||||
				Endpoint_ClearSetupReceived();
 | 
			
		||||
 | 
			
		||||
				/* Write the line coding data to the control endpoint */
 | 
			
		||||
| 
						 | 
				
			
			@ -178,7 +178,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
		case REQ_SetLineEncoding:
 | 
			
		||||
			if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{
 | 
			
		||||
				/* Acknowedge the SETUP packet, ready for data transfer */
 | 
			
		||||
				/* Acknowledge the SETUP packet, ready for data transfer */
 | 
			
		||||
				Endpoint_ClearSetupReceived();
 | 
			
		||||
 | 
			
		||||
				/* Read the line coding data in from the host into the global struct */
 | 
			
		||||
| 
						 | 
				
			
			@ -206,10 +206,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
 | 
			
		|||
				// Do something with the given line states in wIndex
 | 
			
		||||
#endif
 | 
			
		||||
				
 | 
			
		||||
				/* Acknowedge the SETUP packet, ready for data transfer */
 | 
			
		||||
				/* Acknowledge the SETUP packet, ready for data transfer */
 | 
			
		||||
				Endpoint_ClearSetupReceived();
 | 
			
		||||
				
 | 
			
		||||
				/* Send an empty packet to acknowedge the command */
 | 
			
		||||
				/* Acknowledge status stage */
 | 
			
		||||
				while (!(Endpoint_IsSetupINReady()));
 | 
			
		||||
				Endpoint_ClearSetupIN();
 | 
			
		||||
			}
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue