Changed to new device mode Class Driver function name prefixes to make way for similar host mode Class drivers.
This commit is contained in:
		
							parent
							
								
									b2330934b9
								
							
						
					
					
						commit
						9798440ca4
					
				
					 34 changed files with 213 additions and 211 deletions
				
			
		| 
						 | 
				
			
			@ -30,7 +30,7 @@
 | 
			
		|||
 | 
			
		||||
#include "Audio.h"
 | 
			
		||||
 | 
			
		||||
void USB_Audio_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		||||
void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(Endpoint_IsSETUPReceived()))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ void USB_Audio_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool USB_Audio_ConfigureEndpoints(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		||||
bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (AudioInterfaceInfo->DataINEndpointNumber)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -80,12 +80,12 @@ bool USB_Audio_ConfigureEndpoints(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		|||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_Audio_USBTask(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		||||
void Audio_Device_USBTask(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int8_t USB_Audio_ReadSample8(void)
 | 
			
		||||
int8_t Audio_Device_ReadSample8(void)
 | 
			
		||||
{
 | 
			
		||||
	int8_t Sample;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -97,7 +97,7 @@ int8_t USB_Audio_ReadSample8(void)
 | 
			
		|||
	return Sample;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int16_t USB_Audio_ReadSample16(void)
 | 
			
		||||
int16_t Audio_Device_ReadSample16(void)
 | 
			
		||||
{
 | 
			
		||||
	int16_t Sample;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -109,7 +109,7 @@ int16_t USB_Audio_ReadSample16(void)
 | 
			
		|||
	return Sample;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int32_t USB_Audio_ReadSample24(void)
 | 
			
		||||
int32_t Audio_Device_ReadSample24(void)
 | 
			
		||||
{
 | 
			
		||||
	int32_t Sample;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -121,7 +121,7 @@ int32_t USB_Audio_ReadSample24(void)
 | 
			
		|||
	return Sample;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_Audio_WriteSample8(int8_t Sample)
 | 
			
		||||
void Audio_Device_WriteSample8(int8_t Sample)
 | 
			
		||||
{
 | 
			
		||||
	Endpoint_Write_Byte(Sample);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -129,7 +129,7 @@ void USB_Audio_WriteSample8(int8_t Sample)
 | 
			
		|||
	  Endpoint_ClearIN();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_Audio_WriteSample16(int16_t Sample)
 | 
			
		||||
void Audio_Device_WriteSample16(int16_t Sample)
 | 
			
		||||
{
 | 
			
		||||
	Endpoint_Write_Word_LE(Sample);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -137,7 +137,7 @@ void USB_Audio_WriteSample16(int16_t Sample)
 | 
			
		|||
	  Endpoint_ClearIN();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_Audio_WriteSample24(int32_t Sample)
 | 
			
		||||
void Audio_Device_WriteSample24(int32_t Sample)
 | 
			
		||||
{
 | 
			
		||||
	Endpoint_Write_Byte(Sample >> 16);
 | 
			
		||||
	Endpoint_Write_Word_LE(Sample);
 | 
			
		||||
| 
						 | 
				
			
			@ -146,13 +146,13 @@ void USB_Audio_WriteSample24(int32_t Sample)
 | 
			
		|||
	  Endpoint_ClearIN();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool USB_Audio_IsSampleReceived(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		||||
bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	Endpoint_SelectEndpoint(AudioInterfaceInfo->DataOUTEndpointNumber);
 | 
			
		||||
	return Endpoint_IsOUTReceived();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool USB_Audio_IsReadyForNextSample(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		||||
bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	Endpoint_SelectEndpoint(AudioInterfaceInfo->DataINEndpointNumber);
 | 
			
		||||
	return Endpoint_IsINReady();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -390,21 +390,21 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Boolean true if the endpoints were sucessfully configured, false otherwise
 | 
			
		||||
		 */
 | 
			
		||||
		bool USB_Audio_ConfigureEndpoints(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
 | 
			
		||||
		bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** Processes incomming control requests from the host, that are directed to the given Audio class interface. This should be
 | 
			
		||||
		 *  linked to the library \ref EVENT_USB_UnhandledControlPacket() event.
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param AudioInterfaceInfo  Pointer to a structure containing an Audio Class configuration and state.
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_Audio_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
 | 
			
		||||
		void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** General management task for a given Audio class interface, required for the correct operation of the interface. This should
 | 
			
		||||
		 *  be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param AudioInterfaceInfo  Pointer to a structure containing an Audio Class configuration and state.
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_Audio_USBTask(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
 | 
			
		||||
		void Audio_Device_USBTask(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
		/** Reads the next 8-bit audio sample from the current audio interface.
 | 
			
		||||
		 *
 | 
			
		||||
| 
						 | 
				
			
			@ -413,7 +413,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return  Signed 8-bit audio sample from the audio interface
 | 
			
		||||
		 */
 | 
			
		||||
		int8_t USB_Audio_ReadSample8(void);
 | 
			
		||||
		int8_t Audio_Device_ReadSample8(void);
 | 
			
		||||
 | 
			
		||||
		/** Reads the next 16-bit audio sample from the current audio interface.
 | 
			
		||||
		 *
 | 
			
		||||
| 
						 | 
				
			
			@ -422,7 +422,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return  Signed 16-bit audio sample from the audio interface
 | 
			
		||||
		 */
 | 
			
		||||
		int16_t USB_Audio_ReadSample16(void);
 | 
			
		||||
		int16_t Audio_Device_ReadSample16(void);
 | 
			
		||||
 | 
			
		||||
		/** Reads the next 24-bit audio sample from the current audio interface.
 | 
			
		||||
		 *
 | 
			
		||||
| 
						 | 
				
			
			@ -431,7 +431,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return  Signed 24-bit audio sample from the audio interface
 | 
			
		||||
		 */
 | 
			
		||||
		int32_t USB_Audio_ReadSample24(void);
 | 
			
		||||
		int32_t Audio_Device_ReadSample24(void);
 | 
			
		||||
 | 
			
		||||
		/** Writes the next 8-bit audio sample to the current audio interface.
 | 
			
		||||
		 *
 | 
			
		||||
| 
						 | 
				
			
			@ -440,7 +440,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \param Sample  Signed 8-bit audio sample
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_Audio_WriteSample8(int8_t Sample);
 | 
			
		||||
		void Audio_Device_WriteSample8(int8_t Sample);
 | 
			
		||||
 | 
			
		||||
		/** Writes the next 16-bit audio sample to the current audio interface.
 | 
			
		||||
		 *
 | 
			
		||||
| 
						 | 
				
			
			@ -449,7 +449,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \param Sample  Signed 16-bit audio sample
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_Audio_WriteSample16(int16_t Sample);
 | 
			
		||||
		void Audio_Device_WriteSample16(int16_t Sample);
 | 
			
		||||
 | 
			
		||||
		/** Writes the next 24-bit audio sample to the current audio interface.
 | 
			
		||||
		 *
 | 
			
		||||
| 
						 | 
				
			
			@ -458,7 +458,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \param Sample  Signed 24-bit audio sample
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_Audio_WriteSample24(int32_t Sample);
 | 
			
		||||
		void Audio_Device_WriteSample24(int32_t Sample);
 | 
			
		||||
 | 
			
		||||
		/** Determines if the given audio interface is ready for a sample to be read from it.
 | 
			
		||||
		 *
 | 
			
		||||
| 
						 | 
				
			
			@ -466,7 +466,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Boolean true if the given Audio interface has a sample to be read, false otherwise
 | 
			
		||||
		 */
 | 
			
		||||
		bool USB_Audio_IsSampleReceived(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
 | 
			
		||||
		bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** Determines if the given audio interface is ready to accept the next sample to be written to it.
 | 
			
		||||
		 *
 | 
			
		||||
| 
						 | 
				
			
			@ -474,7 +474,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Boolean true if the given Audio interface is ready to accept the next sample, false otherwise
 | 
			
		||||
		 */
 | 
			
		||||
		bool USB_Audio_IsReadyForNextSample(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
 | 
			
		||||
		bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
	/* Disable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,12 +31,12 @@
 | 
			
		|||
#define  INCLUDE_FROM_CDC_CLASS_C
 | 
			
		||||
#include "CDC.h"
 | 
			
		||||
 | 
			
		||||
void USB_CDC_Event_Stub(void)
 | 
			
		||||
void CDC_Device_Event_Stub(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_CDC_ProcessControlPacket(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
void CDC_Device_ProcessControlPacket(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(Endpoint_IsSETUPReceived()))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -62,7 +62,7 @@ void USB_CDC_ProcessControlPacket(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		|||
				Endpoint_Read_Control_Stream_LE(&CDCInterfaceInfo->LineEncoding, sizeof(CDCInterfaceInfo->LineEncoding));
 | 
			
		||||
				Endpoint_ClearIN();
 | 
			
		||||
 | 
			
		||||
				EVENT_USB_CDC_LineEncodingChanged(CDCInterfaceInfo);
 | 
			
		||||
				EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo);
 | 
			
		||||
			}
 | 
			
		||||
	
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -73,7 +73,7 @@ void USB_CDC_ProcessControlPacket(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		|||
				
 | 
			
		||||
				CDCInterfaceInfo->ControlLineState = USB_ControlRequest.wValue;
 | 
			
		||||
				
 | 
			
		||||
				EVENT_USB_CDC_ControLineStateChanged(CDCInterfaceInfo);
 | 
			
		||||
				EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
				while (!(Endpoint_IsINReady()));
 | 
			
		||||
				Endpoint_ClearIN();
 | 
			
		||||
| 
						 | 
				
			
			@ -83,7 +83,7 @@ void USB_CDC_ProcessControlPacket(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool USB_CDC_ConfigureEndpoints(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->DataINEndpointNumber, EP_TYPE_BULK,
 | 
			
		||||
							         ENDPOINT_DIR_IN, CDCInterfaceInfo->DataINEndpointSize,
 | 
			
		||||
| 
						 | 
				
			
			@ -109,7 +109,7 @@ bool USB_CDC_ConfigureEndpoints(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		|||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_CDC_USBTask(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
void CDC_Device_USBTask(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(USB_IsConnected))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -128,7 +128,7 @@ void USB_CDC_USBTask(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		|||
	Endpoint_ClearIN();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_CDC_SendString(USB_ClassInfo_CDC_t* CDCInterfaceInfo, char* Data, uint16_t Length)
 | 
			
		||||
void CDC_Device_SendString(USB_ClassInfo_CDC_t* CDCInterfaceInfo, char* Data, uint16_t Length)
 | 
			
		||||
{
 | 
			
		||||
	if (!(USB_IsConnected))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -137,7 +137,7 @@ void USB_CDC_SendString(USB_ClassInfo_CDC_t* CDCInterfaceInfo, char* Data, uint1
 | 
			
		|||
	Endpoint_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_CDC_SendByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo, uint8_t Data)
 | 
			
		||||
void CDC_Device_SendByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo, uint8_t Data)
 | 
			
		||||
{
 | 
			
		||||
	if (!(USB_IsConnected))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -153,14 +153,14 @@ void USB_CDC_SendByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo, uint8_t Data)
 | 
			
		|||
	Endpoint_Write_Byte(Data);	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint16_t USB_CDC_BytesReceived(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	Endpoint_SelectEndpoint(CDCInterfaceInfo->DataOUTEndpointNumber);
 | 
			
		||||
 | 
			
		||||
	return Endpoint_BytesInEndpoint();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t USB_CDC_ReceiveByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(USB_IsConnected))
 | 
			
		||||
	  return 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -175,7 +175,7 @@ uint8_t USB_CDC_ReceiveByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		|||
	return DataByte;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_CDC_SendSerialLineStateChange(USB_ClassInfo_CDC_t* CDCInterfaceInfo, uint16_t LineStateMask)
 | 
			
		||||
void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_t* CDCInterfaceInfo, uint16_t LineStateMask)
 | 
			
		||||
{
 | 
			
		||||
	if (!(USB_IsConnected))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -186,11 +186,11 @@
 | 
			
		|||
		
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
		#if defined(INCLUDE_FROM_CDC_CLASS_C)
 | 
			
		||||
			void USB_CDC_Event_Stub(void);
 | 
			
		||||
			void EVENT_USB_CDC_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
												   ATTR_WEAK ATTR_ALIAS(USB_CDC_Event_Stub);
 | 
			
		||||
			void EVENT_USB_CDC_ControLineStateChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
			                                          ATTR_WEAK ATTR_ALIAS(USB_CDC_Event_Stub);
 | 
			
		||||
			void CDC_Device_Event_Stub(void);
 | 
			
		||||
			void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
												      ATTR_WEAK ATTR_ALIAS(CDC_Device_Event_Stub);
 | 
			
		||||
			void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
 | 
			
		||||
			                                             ATTR_WEAK ATTR_ALIAS(CDC_Device_Event_Stub);
 | 
			
		||||
		#endif
 | 
			
		||||
	
 | 
			
		||||
		/** Configures the endpoints of a given CDC interface, ready for use. This should be linked to the library
 | 
			
		||||
| 
						 | 
				
			
			@ -201,21 +201,21 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Boolean true if the endpoints were sucessfully configured, false otherwise
 | 
			
		||||
		 */
 | 
			
		||||
		bool USB_CDC_ConfigureEndpoints(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
		bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** Processes incomming control requests from the host, that are directed to the given CDC class interface. This should be
 | 
			
		||||
		 *  linked to the library \ref EVENT_USB_UnhandledControlPacket() event.
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param CDCInterfaceInfo  Pointer to a structure containing a CDC Class configuration and state.
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_CDC_ProcessControlPacket(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
		void CDC_Device_ProcessControlPacket(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** General management task for a given CDC class interface, required for the correct operation of the interface. This should
 | 
			
		||||
		 *  be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param CDCInterfaceInfo  Pointer to a structure containing a CDC Class configuration and state.
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_CDC_USBTask(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
		void CDC_Device_USBTask(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** CDC class driver event for a line encoding change on a CDC interface. This event fires each time the host requests a
 | 
			
		||||
		 *  line encoding change (containing the serial parity, baud and other configuration information) and may be hooked in the
 | 
			
		||||
| 
						 | 
				
			
			@ -224,7 +224,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \param CDCInterfaceInfo  Pointer to a structure containing a CDC Class configuration and state.
 | 
			
		||||
		 */
 | 
			
		||||
		void EVENT_USB_CDC_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
		void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
		/** CDC class driver event for a control line state change on a CDC interface. This event fires each time the host requests a
 | 
			
		||||
		 *  control line state change (containing the virtual serial control line states, such as DTR) and may be hooked in the
 | 
			
		||||
| 
						 | 
				
			
			@ -234,7 +234,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \param CDCInterfaceInfo  Pointer to a structure containing a CDC Class configuration and state.
 | 
			
		||||
		 */		
 | 
			
		||||
		void EVENT_USB_CDC_ControLineStateChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
		void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** Sends a given string to the attached USB host, if connected. If a host is not connected when the function is called, the
 | 
			
		||||
		 *  string is discarded.
 | 
			
		||||
| 
						 | 
				
			
			@ -243,7 +243,7 @@
 | 
			
		|||
		 *  \param Data  Pointer to the string to send to the host
 | 
			
		||||
		 *  \param Length  Size in bytes of the string to send to the host
 | 
			
		||||
		 */
 | 
			
		||||
		void     USB_CDC_SendString(USB_ClassInfo_CDC_t* CDCInterfaceInfo, char* Data, uint16_t Length);
 | 
			
		||||
		void CDC_Device_SendString(USB_ClassInfo_CDC_t* CDCInterfaceInfo, char* Data, uint16_t Length);
 | 
			
		||||
		
 | 
			
		||||
		/** Sends a given byte to the attached USB host, if connected. If a host is not connected when the function is called, the
 | 
			
		||||
		 *  byte is discarded.
 | 
			
		||||
| 
						 | 
				
			
			@ -251,7 +251,7 @@
 | 
			
		|||
		 *  \param CDCInterfaceInfo  Pointer to a structure containing a CDC Class configuration and state.
 | 
			
		||||
		 *  \param Data  Byte of data to send to the host
 | 
			
		||||
		 */
 | 
			
		||||
		void     USB_CDC_SendByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo, uint8_t Data);
 | 
			
		||||
		void CDC_Device_SendByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo, uint8_t Data);
 | 
			
		||||
		
 | 
			
		||||
		/** Determines the number of bytes received by the CDC interface from the host, waiting to be read.
 | 
			
		||||
		 *
 | 
			
		||||
| 
						 | 
				
			
			@ -259,7 +259,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Total number of buffered bytes received from the host
 | 
			
		||||
		 */
 | 
			
		||||
		uint16_t USB_CDC_BytesReceived(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
		uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
		/** Reads a byte of data from the host. If no data is waiting to be read of if a USB host is not connected, the function
 | 
			
		||||
		 *  returns 0. The USB_CDC_BytesReceived() function should be queried before data is recieved to ensure that no data
 | 
			
		||||
| 
						 | 
				
			
			@ -269,7 +269,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Next received byte from the host, or 0 if no data received
 | 
			
		||||
		 */
 | 
			
		||||
		uint8_t  USB_CDC_ReceiveByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
		uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
		/** Sends a Serial Control Line State Change notification to the host. This should be called when the virtual serial control
 | 
			
		||||
		 *  lines (DCD, DSR, etc.) have changed states, or to give BREAK notfications to the host. Line states persist until they are
 | 
			
		||||
| 
						 | 
				
			
			@ -278,7 +278,7 @@
 | 
			
		|||
		 *  \param CDCInterfaceInfo  Pointer to a structure containing a CDC Class configuration and state.
 | 
			
		||||
		 *  \param LineStateMask  Mask of CDC_CONTROL_LINE_IN_* masks giving the current control line states
 | 
			
		||||
		 */
 | 
			
		||||
		void     USB_CDC_SendSerialLineStateChange(USB_ClassInfo_CDC_t* CDCInterfaceInfo, uint16_t LineStateMask);
 | 
			
		||||
		void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_t* CDCInterfaceInfo, uint16_t LineStateMask);
 | 
			
		||||
 | 
			
		||||
	/* Disable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,7 +30,7 @@
 | 
			
		|||
 | 
			
		||||
#include "HID.h"
 | 
			
		||||
 | 
			
		||||
void USB_HID_ProcessControlPacket(USB_ClassInfo_HID_t* HIDInterfaceInfo)
 | 
			
		||||
void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_t* HIDInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(Endpoint_IsSETUPReceived()))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -51,7 +51,7 @@ void USB_HID_ProcessControlPacket(USB_ClassInfo_HID_t* HIDInterfaceInfo)
 | 
			
		|||
 | 
			
		||||
				memset(ReportINData, 0, sizeof(ReportINData));
 | 
			
		||||
				
 | 
			
		||||
				ReportINSize = CALLBACK_USB_HID_CreateNextHIDReport(HIDInterfaceInfo, &ReportID, ReportINData);
 | 
			
		||||
				ReportINSize = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportINData);
 | 
			
		||||
 | 
			
		||||
				Endpoint_Write_Control_Stream_LE(ReportINData, ReportINSize);
 | 
			
		||||
				Endpoint_ClearOUT();
 | 
			
		||||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ void USB_HID_ProcessControlPacket(USB_ClassInfo_HID_t* HIDInterfaceInfo)
 | 
			
		|||
				Endpoint_Read_Control_Stream_LE(ReportOUTData, ReportOUTSize);
 | 
			
		||||
				Endpoint_ClearIN();
 | 
			
		||||
				
 | 
			
		||||
				CALLBACK_USB_HID_ProcessReceivedHIDReport(HIDInterfaceInfo, ReportID, ReportOUTData, ReportOUTSize);
 | 
			
		||||
				CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportOUTData, ReportOUTSize);
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +127,7 @@ void USB_HID_ProcessControlPacket(USB_ClassInfo_HID_t* HIDInterfaceInfo)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool USB_HID_ConfigureEndpoints(USB_ClassInfo_HID_t* HIDInterfaceInfo)
 | 
			
		||||
bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_t* HIDInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	HIDInterfaceInfo->UsingReportProtocol = true;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -140,7 +140,7 @@ bool USB_HID_ConfigureEndpoints(USB_ClassInfo_HID_t* HIDInterfaceInfo)
 | 
			
		|||
	return true;
 | 
			
		||||
}
 | 
			
		||||
		
 | 
			
		||||
void USB_HID_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo)
 | 
			
		||||
void HID_Device_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(USB_IsConnected))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -159,7 +159,7 @@ void USB_HID_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo)
 | 
			
		|||
 | 
			
		||||
		memset(ReportINData, 0, sizeof(ReportINData));
 | 
			
		||||
 | 
			
		||||
		ReportINSize = CALLBACK_USB_HID_CreateNextHIDReport(HIDInterfaceInfo, &ReportID, ReportINData);
 | 
			
		||||
		ReportINSize = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportINData);
 | 
			
		||||
 | 
			
		||||
		if (ReportINSize)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -131,21 +131,21 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Boolean true if the endpoints were sucessfully configured, false otherwise
 | 
			
		||||
		 */
 | 
			
		||||
		bool USB_HID_ConfigureEndpoints(USB_ClassInfo_HID_t* HIDInterfaceInfo);
 | 
			
		||||
		bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_t* HIDInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
		/** Processes incomming control requests from the host, that are directed to the given HID class interface. This should be
 | 
			
		||||
		 *  linked to the library \ref EVENT_USB_UnhandledControlPacket() event.
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param HIDInterfaceInfo  Pointer to a structure containing a HID Class configuration and state.
 | 
			
		||||
		 */		
 | 
			
		||||
		void USB_HID_ProcessControlPacket(USB_ClassInfo_HID_t* HIDInterfaceInfo);
 | 
			
		||||
		void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_t* HIDInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** General management task for a given HID class interface, required for the correct operation of the interface. This should
 | 
			
		||||
		 *  be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param HIDInterfaceInfo  Pointer to a structure containing a HID Class configuration and state.
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_HID_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo);
 | 
			
		||||
		void HID_Device_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
		/** HID class driver callback for the user creation of a HID input report. This callback may fire in response to either
 | 
			
		||||
		 *  HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback the
 | 
			
		||||
| 
						 | 
				
			
			@ -159,7 +159,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return  Number of bytes in the generated input report, or zero if no report is to be sent
 | 
			
		||||
		 */
 | 
			
		||||
		uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
 | 
			
		||||
		uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
 | 
			
		||||
 | 
			
		||||
		/** HID class driver callback for the user processing of a received HID input report. This callback may fire in response to
 | 
			
		||||
		 *  either HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback
 | 
			
		||||
| 
						 | 
				
			
			@ -171,7 +171,8 @@
 | 
			
		|||
		 *  \param ReportData  Pointer to a buffer where the received HID report is stored.
 | 
			
		||||
		 *  \param ReportSize  Size in bytes of the received report from the host.
 | 
			
		||||
		 */
 | 
			
		||||
		void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID, void* ReportData, uint16_t ReportSize);
 | 
			
		||||
		void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID, void* ReportData,
 | 
			
		||||
		                                          uint16_t ReportSize);
 | 
			
		||||
 | 
			
		||||
	/* Disable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,12 +30,12 @@
 | 
			
		|||
 | 
			
		||||
#include "MIDI.h"
 | 
			
		||||
 | 
			
		||||
void USB_MIDI_ProcessControlPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo)
 | 
			
		||||
void MIDI_Device_ProcessControlPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool USB_MIDI_ConfigureEndpoints(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo)
 | 
			
		||||
bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (MIDIInterfaceInfo->DataINEndpointNumber)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -60,12 +60,12 @@ bool USB_MIDI_ConfigureEndpoints(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo)
 | 
			
		|||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_MIDI_USBTask(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo)
 | 
			
		||||
void MIDI_Device_USBTask(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_MIDI_SendEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event)
 | 
			
		||||
void MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event)
 | 
			
		||||
{
 | 
			
		||||
	if (!(USB_IsConnected))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -79,7 +79,7 @@ void USB_MIDI_SendEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool USB_MIDI_ReceiveEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event)
 | 
			
		||||
bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event)
 | 
			
		||||
{
 | 
			
		||||
	if (!(USB_IsConnected))
 | 
			
		||||
	  return false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -181,28 +181,28 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Boolean true if the endpoints were sucessfully configured, false otherwise
 | 
			
		||||
		 */
 | 
			
		||||
		bool USB_MIDI_ConfigureEndpoints(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo);
 | 
			
		||||
		bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
		/** Processes incomming control requests from the host, that are directed to the given MIDI class interface. This should be
 | 
			
		||||
		 *  linked to the library \ref EVENT_USB_UnhandledControlPacket() event.
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param MIDIInterfaceInfo  Pointer to a structure containing a MIDI Class configuration and state.
 | 
			
		||||
		 */		
 | 
			
		||||
		void USB_MIDI_ProcessControlPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo);
 | 
			
		||||
		void MIDI_Device_ProcessControlPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** General management task for a given MIDI class interface, required for the correct operation of the interface. This should
 | 
			
		||||
		 *  be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param MIDIInterfaceInfo  Pointer to a structure containing a MIDI Class configuration and state.
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_MIDI_USBTask(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo);
 | 
			
		||||
		void MIDI_Device_USBTask(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** Sends a MIDI event packet to the host. If no host is connected, the event packet is discarded.
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param MIDIInterfaceInfo  Pointer to a structure containing a MIDI Class configuration and state.
 | 
			
		||||
		 *  \param Event  Pointer to a populated USB_MIDI_EventPacket_t structure containing the MIDI event to send
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_MIDI_SendEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event);
 | 
			
		||||
		void MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event);
 | 
			
		||||
 | 
			
		||||
		/** Receives a MIDI event packet from the host.
 | 
			
		||||
		 *
 | 
			
		||||
| 
						 | 
				
			
			@ -211,7 +211,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Boolean true if a MIDI event packet was received, false otherwise
 | 
			
		||||
		 */
 | 
			
		||||
		bool USB_MIDI_ReceiveEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event);
 | 
			
		||||
		bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event);
 | 
			
		||||
 | 
			
		||||
	/* Disable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@
 | 
			
		|||
 | 
			
		||||
static USB_ClassInfo_MS_t* CallbackMSInterfaceInfo;
 | 
			
		||||
 | 
			
		||||
void USB_MS_ProcessControlPacket(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		||||
void MS_Device_ProcessControlPacket(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(Endpoint_IsSETUPReceived()))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -72,7 +72,7 @@ void USB_MS_ProcessControlPacket(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool USB_MS_ConfigureEndpoints(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		||||
bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(Endpoint_ConfigureEndpoint(MSInterfaceInfo->DataINEndpointNumber, EP_TYPE_BULK,
 | 
			
		||||
							         ENDPOINT_DIR_IN, MSInterfaceInfo->DataINEndpointSize,
 | 
			
		||||
| 
						 | 
				
			
			@ -91,7 +91,7 @@ bool USB_MS_ConfigureEndpoints(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		|||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_MS_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		||||
void MS_Device_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(USB_IsConnected))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -100,12 +100,12 @@ void USB_MS_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		|||
		
 | 
			
		||||
	if (Endpoint_IsReadWriteAllowed())
 | 
			
		||||
	{
 | 
			
		||||
		if (USB_MS_ReadInCommandBlock(MSInterfaceInfo))
 | 
			
		||||
		if (MS_Device_ReadInCommandBlock(MSInterfaceInfo))
 | 
			
		||||
		{
 | 
			
		||||
			if (MSInterfaceInfo->CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
 | 
			
		||||
			  Endpoint_SelectEndpoint(MSInterfaceInfo->DataINEndpointNumber);
 | 
			
		||||
			  
 | 
			
		||||
			MSInterfaceInfo->CommandStatus.Status              = CALLBACK_USB_MS_SCSICommandReceived(MSInterfaceInfo) ?
 | 
			
		||||
			MSInterfaceInfo->CommandStatus.Status              = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo) ?
 | 
			
		||||
			                                                      SCSI_Command_Pass : SCSI_Command_Fail;
 | 
			
		||||
			MSInterfaceInfo->CommandStatus.Signature           = MS_CSW_SIGNATURE;
 | 
			
		||||
			MSInterfaceInfo->CommandStatus.Tag                 = MSInterfaceInfo->CommandBlock.Tag;
 | 
			
		||||
| 
						 | 
				
			
			@ -114,7 +114,7 @@ void USB_MS_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		|||
			if ((MSInterfaceInfo->CommandStatus.Status == SCSI_Command_Fail) && (MSInterfaceInfo->CommandStatus.DataTransferResidue))
 | 
			
		||||
			  Endpoint_StallTransaction();
 | 
			
		||||
			
 | 
			
		||||
			USB_MS_ReturnCommandStatus(MSInterfaceInfo);
 | 
			
		||||
			MS_Device_ReturnCommandStatus(MSInterfaceInfo);
 | 
			
		||||
			
 | 
			
		||||
			if (MSInterfaceInfo->IsMassStoreReset)
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			@ -132,14 +132,14 @@ void USB_MS_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool USB_MS_ReadInCommandBlock(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		||||
static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	Endpoint_SelectEndpoint(MSInterfaceInfo->DataOUTEndpointNumber);
 | 
			
		||||
 | 
			
		||||
	CallbackMSInterfaceInfo = MSInterfaceInfo;
 | 
			
		||||
	Endpoint_Read_Stream_LE(&MSInterfaceInfo->CommandBlock,
 | 
			
		||||
	                        (sizeof(CommandBlockWrapper_t) - 16),
 | 
			
		||||
	                        StreamCallback_AbortOnMassStoreReset);
 | 
			
		||||
	                        StreamCallback_MS_Device_AbortOnMassStoreReset);
 | 
			
		||||
 | 
			
		||||
	if ((MSInterfaceInfo->CommandBlock.Signature         != MS_CBW_SIGNATURE)           ||
 | 
			
		||||
	    (MSInterfaceInfo->CommandBlock.LUN               >= MSInterfaceInfo->TotalLUNs) ||
 | 
			
		||||
| 
						 | 
				
			
			@ -155,7 +155,7 @@ static bool USB_MS_ReadInCommandBlock(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		|||
	CallbackMSInterfaceInfo = MSInterfaceInfo;
 | 
			
		||||
	Endpoint_Read_Stream_LE(&MSInterfaceInfo->CommandBlock.SCSICommandData,
 | 
			
		||||
	                        MSInterfaceInfo->CommandBlock.SCSICommandLength,
 | 
			
		||||
	                        StreamCallback_AbortOnMassStoreReset);
 | 
			
		||||
	                        StreamCallback_MS_Device_AbortOnMassStoreReset);
 | 
			
		||||
							
 | 
			
		||||
	Endpoint_ClearOUT();
 | 
			
		||||
	  
 | 
			
		||||
| 
						 | 
				
			
			@ -165,7 +165,7 @@ static bool USB_MS_ReadInCommandBlock(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		|||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void USB_MS_ReturnCommandStatus(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		||||
static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	Endpoint_SelectEndpoint(MSInterfaceInfo->DataOUTEndpointNumber);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -189,7 +189,7 @@ static void USB_MS_ReturnCommandStatus(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		|||
	
 | 
			
		||||
	CallbackMSInterfaceInfo = MSInterfaceInfo;
 | 
			
		||||
	Endpoint_Write_Stream_LE(&MSInterfaceInfo->CommandStatus, sizeof(CommandStatusWrapper_t),
 | 
			
		||||
	                         StreamCallback_AbortOnMassStoreReset);
 | 
			
		||||
	                         StreamCallback_MS_Device_AbortOnMassStoreReset);
 | 
			
		||||
	
 | 
			
		||||
	Endpoint_ClearIN();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -197,9 +197,9 @@ static void USB_MS_ReturnCommandStatus(USB_ClassInfo_MS_t* MSInterfaceInfo)
 | 
			
		|||
	  return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static uint8_t StreamCallback_AbortOnMassStoreReset(void)
 | 
			
		||||
static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void)
 | 
			
		||||
{
 | 
			
		||||
	USB_MS_USBTask(CallbackMSInterfaceInfo);
 | 
			
		||||
	MS_Device_USBTask(CallbackMSInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
	if (CallbackMSInterfaceInfo->IsMassStoreReset)
 | 
			
		||||
	  return STREAMCALLBACK_Abort;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -137,9 +137,9 @@
 | 
			
		|||
		
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
		#if defined(INCLUDE_FROM_MS_CLASS_C)
 | 
			
		||||
			static void    USB_MS_ReturnCommandStatus(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
			static bool    USB_MS_ReadInCommandBlock(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
			static uint8_t StreamCallback_AbortOnMassStoreReset(void);
 | 
			
		||||
			static void    MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
			static bool    MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
			static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void);
 | 
			
		||||
		#endif
 | 
			
		||||
	
 | 
			
		||||
		/** Configures the endpoints of a given Mass Storage interface, ready for use. This should be linked to the library
 | 
			
		||||
| 
						 | 
				
			
			@ -150,21 +150,21 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Boolean true if the endpoints were sucessfully configured, false otherwise
 | 
			
		||||
		 */
 | 
			
		||||
		bool USB_MS_ConfigureEndpoints(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
		bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
		/** Processes incomming control requests from the host, that are directed to the given Mass Storage class interface. This should be
 | 
			
		||||
		 *  linked to the library \ref EVENT_USB_UnhandledControlPacket() event.
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param MSInterfaceInfo  Pointer to a structure containing a Mass Storage Class configuration and state.
 | 
			
		||||
		 */		
 | 
			
		||||
		void USB_MS_ProcessControlPacket(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
		void MS_Device_ProcessControlPacket(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** General management task for a given Mass Storage class interface, required for the correct operation of the interface. This should
 | 
			
		||||
		 *  be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param MSInterfaceInfo  Pointer to a structure containing a Mass Storage configuration and state.
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_MS_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
		void MS_Device_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
		/** Mass Storage class driver callback for the user processing of a received SCSI command. This callback will fire each time the
 | 
			
		||||
		 *  host sends a SCSI command which requires processing by the user application. Inside this callback the user is responsible
 | 
			
		||||
| 
						 | 
				
			
			@ -175,7 +175,7 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Boolean true if the SCSI command was successfully processed, false otherwise
 | 
			
		||||
		 */
 | 
			
		||||
		bool CALLBACK_USB_MS_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
		bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
	/* Disable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,7 +62,7 @@ static const uint32_t PROGMEM AdapterSupportedOIDList[]  =
 | 
			
		|||
		OID_802_3_XMIT_MORE_COLLISIONS,
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
void USB_RNDIS_ProcessControlPacket(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		||||
void RNDIS_Device_ProcessControlPacket(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(Endpoint_IsSETUPReceived()))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -80,7 +80,7 @@ void USB_RNDIS_ProcessControlPacket(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		|||
				Endpoint_Read_Control_Stream_LE(RNDISInterfaceInfo->RNDISMessageBuffer, USB_ControlRequest.wLength);
 | 
			
		||||
				Endpoint_ClearIN();
 | 
			
		||||
 | 
			
		||||
				USB_RNDIS_ProcessRNDISControlMessage(RNDISInterfaceInfo);
 | 
			
		||||
				RNDIS_Device_ProcessRNDISControlMessage(RNDISInterfaceInfo);
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +107,7 @@ void USB_RNDIS_ProcessControlPacket(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool USB_RNDIS_ConfigureEndpoints(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		||||
bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->DataINEndpointNumber, EP_TYPE_BULK,
 | 
			
		||||
							         ENDPOINT_DIR_IN, RNDISInterfaceInfo->DataINEndpointSize,
 | 
			
		||||
| 
						 | 
				
			
			@ -133,7 +133,7 @@ bool USB_RNDIS_ConfigureEndpoints(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		|||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB_RNDIS_USBTask(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		||||
void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	if (!(USB_IsConnected))
 | 
			
		||||
	  return;
 | 
			
		||||
| 
						 | 
				
			
			@ -205,7 +205,7 @@ void USB_RNDIS_USBTask(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		|||
	}
 | 
			
		||||
}							
 | 
			
		||||
 | 
			
		||||
void USB_RNDIS_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		||||
void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo)
 | 
			
		||||
{
 | 
			
		||||
	/* Note: Only a single buffer is used for both the received message and its response to save SRAM. Because of
 | 
			
		||||
	         this, response bytes should be filled in order so that they do not clobber unread data in the buffer. */
 | 
			
		||||
| 
						 | 
				
			
			@ -260,8 +260,8 @@ void USB_RNDIS_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_t* RNDISInterfaceI
 | 
			
		|||
			QUERY_Response->MessageType         = REMOTE_NDIS_QUERY_CMPLT;
 | 
			
		||||
			QUERY_Response->MessageLength       = sizeof(RNDIS_QUERY_CMPLT_t);
 | 
			
		||||
						
 | 
			
		||||
			if (USB_RNDIS_ProcessNDISQuery(RNDISInterfaceInfo, Query_Oid, QueryData, QUERY_Message->InformationBufferLength,
 | 
			
		||||
			                               ResponseData, &ResponseSize))
 | 
			
		||||
			if (RNDIS_Device_ProcessNDISQuery(RNDISInterfaceInfo, Query_Oid, QueryData, QUERY_Message->InformationBufferLength,
 | 
			
		||||
			                                  ResponseData, &ResponseSize))
 | 
			
		||||
			{
 | 
			
		||||
				QUERY_Response->Status                  = REMOTE_NDIS_STATUS_SUCCESS;
 | 
			
		||||
				QUERY_Response->MessageLength          += ResponseSize;
 | 
			
		||||
| 
						 | 
				
			
			@ -292,7 +292,7 @@ void USB_RNDIS_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_t* RNDISInterfaceI
 | 
			
		|||
			void* SetData                   = &RNDISInterfaceInfo->RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
 | 
			
		||||
			                                                                          SET_Message->InformationBufferOffset];
 | 
			
		||||
						
 | 
			
		||||
			if (USB_RNDIS_ProcessNDISSet(RNDISInterfaceInfo, SET_Oid, SetData, SET_Message->InformationBufferLength))
 | 
			
		||||
			if (RNDIS_Device_ProcessNDISSet(RNDISInterfaceInfo, SET_Oid, SetData, SET_Message->InformationBufferLength))
 | 
			
		||||
			  SET_Response->Status        = REMOTE_NDIS_STATUS_SUCCESS;
 | 
			
		||||
			else
 | 
			
		||||
			  SET_Response->Status        = REMOTE_NDIS_STATUS_NOT_SUPPORTED;
 | 
			
		||||
| 
						 | 
				
			
			@ -324,9 +324,9 @@ void USB_RNDIS_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_t* RNDISInterfaceI
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool USB_RNDIS_ProcessNDISQuery(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo,
 | 
			
		||||
                                       uint32_t OId, void* QueryData, uint16_t QuerySize,
 | 
			
		||||
                                       void* ResponseData, uint16_t* ResponseSize)
 | 
			
		||||
static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo,
 | 
			
		||||
                                          uint32_t OId, void* QueryData, uint16_t QuerySize,
 | 
			
		||||
                                          void* ResponseData, uint16_t* ResponseSize)
 | 
			
		||||
{
 | 
			
		||||
	switch (OId)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -436,7 +436,7 @@ static bool USB_RNDIS_ProcessNDISQuery(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool USB_RNDIS_ProcessNDISSet(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo, uint32_t OId, void* SetData, uint16_t SetSize)
 | 
			
		||||
static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo, uint32_t OId, void* SetData, uint16_t SetSize)
 | 
			
		||||
{
 | 
			
		||||
	switch (OId)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -277,12 +277,12 @@
 | 
			
		|||
				
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
		#if defined(INCLUDE_FROM_RNDIS_CLASS_C)
 | 
			
		||||
			static void USB_RNDIS_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
 | 
			
		||||
			static bool USB_RNDIS_ProcessNDISQuery(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo, 
 | 
			
		||||
			                                       uint32_t OId, void* QueryData, uint16_t QuerySize,
 | 
			
		||||
										           void* ResponseData, uint16_t* ResponseSize);
 | 
			
		||||
			static bool USB_RNDIS_ProcessNDISSet(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo, uint32_t OId,
 | 
			
		||||
			                                     void* SetData, uint16_t SetSize);	
 | 
			
		||||
			static void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
 | 
			
		||||
			static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo, 
 | 
			
		||||
			                                          uint32_t OId, void* QueryData, uint16_t QuerySize,
 | 
			
		||||
										              void* ResponseData, uint16_t* ResponseSize);
 | 
			
		||||
			static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo, uint32_t OId,
 | 
			
		||||
			                                        void* SetData, uint16_t SetSize);	
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		/** Configures the endpoints of a given RNDIS interface, ready for use. This should be linked to the library
 | 
			
		||||
| 
						 | 
				
			
			@ -293,21 +293,21 @@
 | 
			
		|||
		 *
 | 
			
		||||
		 *  \return Boolean true if the endpoints were sucessfully configured, false otherwise
 | 
			
		||||
		 */
 | 
			
		||||
		bool USB_RNDIS_ConfigureEndpoints(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
 | 
			
		||||
		bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
 | 
			
		||||
 | 
			
		||||
		/** Processes incomming control requests from the host, that are directed to the given RNDIS class interface. This should be
 | 
			
		||||
		 *  linked to the library \ref EVENT_USB_UnhandledControlPacket() event.
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param RNDISInterfaceInfo  Pointer to a structure containing a RNDIS Class configuration and state.
 | 
			
		||||
		 */		
 | 
			
		||||
		void USB_RNDIS_ProcessControlPacket(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
 | 
			
		||||
		void RNDIS_Device_ProcessControlPacket(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
		/** General management task for a given HID class interface, required for the correct operation of the interface. This should
 | 
			
		||||
		 *  be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param RNDISInterfaceInfo  Pointer to a structure containing a RNDIS Class configuration and state.
 | 
			
		||||
		 */
 | 
			
		||||
		void USB_RNDIS_USBTask(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
 | 
			
		||||
		void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
 | 
			
		||||
		
 | 
			
		||||
	/* Disable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue