Create a new function pointer type in StreamCallbacks.h for endpoint/pipe stream callbacks, to make stream function prototypes clearer.
This commit is contained in:
		
							parent
							
								
									76d5e99bb8
								
							
						
					
					
						commit
						eeba38e343
					
				
					 11 changed files with 64 additions and 37 deletions
				
			
		| 
						 | 
				
			
			@ -74,7 +74,11 @@ void Endpoint_ClearEndpoints(void)
 | 
			
		|||
#if !defined(CONTROL_ONLY_DEVICE)
 | 
			
		||||
uint8_t Endpoint_WaitUntilReady(void)
 | 
			
		||||
{
 | 
			
		||||
	#if (USB_STREAM_TIMEOUT_MS < 0xFF)
 | 
			
		||||
	uint8_t  TimeoutMSRem = USB_STREAM_TIMEOUT_MS;	
 | 
			
		||||
	#else
 | 
			
		||||
	uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
 | 
			
		||||
	#endif
 | 
			
		||||
 | 
			
		||||
	USB_INT_Clear(USB_INT_SOFI);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -108,7 +112,7 @@ uint8_t Endpoint_WaitUntilReady(void)
 | 
			
		|||
 | 
			
		||||
uint8_t Endpoint_Discard_Stream(uint16_t Length
 | 
			
		||||
#if !defined(NO_STREAM_CALLBACKS)
 | 
			
		||||
                                , uint8_t (* const Callback)(void)
 | 
			
		||||
                                , StreamCallbackPtr_t Callback
 | 
			
		||||
#endif
 | 
			
		||||
								)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +147,7 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
 | 
			
		|||
 | 
			
		||||
uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
 | 
			
		||||
#if !defined(NO_STREAM_CALLBACKS)
 | 
			
		||||
                                 , uint8_t (* const Callback)(void)
 | 
			
		||||
                                 , StreamCallbackPtr_t Callback
 | 
			
		||||
#endif
 | 
			
		||||
								 )
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -179,7 +183,7 @@ uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
 | 
			
		|||
 | 
			
		||||
uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
 | 
			
		||||
#if !defined(NO_STREAM_CALLBACKS)
 | 
			
		||||
                                 , uint8_t (* const Callback)(void)
 | 
			
		||||
                                 , StreamCallbackPtr_t Callback
 | 
			
		||||
#endif
 | 
			
		||||
								 )
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -215,7 +219,7 @@ uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
 | 
			
		|||
 | 
			
		||||
uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
 | 
			
		||||
#if !defined(NO_STREAM_CALLBACKS)
 | 
			
		||||
                                 , uint8_t (* const Callback)(void)
 | 
			
		||||
                                 , StreamCallbackPtr_t Callback
 | 
			
		||||
#endif
 | 
			
		||||
								 )
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -251,7 +255,7 @@ uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
 | 
			
		|||
 | 
			
		||||
uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length
 | 
			
		||||
#if !defined(NO_STREAM_CALLBACKS)
 | 
			
		||||
                                 , uint8_t (* const Callback)(void)
 | 
			
		||||
                                 , StreamCallbackPtr_t Callback
 | 
			
		||||
#endif
 | 
			
		||||
								 )
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -727,7 +727,7 @@
 | 
			
		|||
			 */
 | 
			
		||||
			uint8_t Endpoint_Discard_Stream(uint16_t Length
 | 
			
		||||
			#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
 | 
			
		||||
			                                , uint8_t (* const Callback)(void)
 | 
			
		||||
			                                , StreamCallbackPtr_t Callback
 | 
			
		||||
			#endif
 | 
			
		||||
			                                );
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -754,7 +754,7 @@
 | 
			
		|||
			 */
 | 
			
		||||
			uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
 | 
			
		||||
			#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
 | 
			
		||||
			                                 , uint8_t (* const Callback)(void)
 | 
			
		||||
			                                 , StreamCallbackPtr_t Callback
 | 
			
		||||
			#endif
 | 
			
		||||
			                                 ) ATTR_NON_NULL_PTR_ARG(1);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -781,7 +781,7 @@
 | 
			
		|||
			 */
 | 
			
		||||
			uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
 | 
			
		||||
			#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
 | 
			
		||||
			                                 , uint8_t (* const Callback)(void)
 | 
			
		||||
			                                 , StreamCallbackPtr_t Callback
 | 
			
		||||
			#endif
 | 
			
		||||
			                                 ) ATTR_NON_NULL_PTR_ARG(1);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -808,7 +808,7 @@
 | 
			
		|||
			 */
 | 
			
		||||
			uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
 | 
			
		||||
			#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
 | 
			
		||||
			                                , uint8_t (* const Callback)(void)
 | 
			
		||||
			                                , StreamCallbackPtr_t Callback
 | 
			
		||||
			#endif
 | 
			
		||||
			                                ) ATTR_NON_NULL_PTR_ARG(1);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -835,7 +835,7 @@
 | 
			
		|||
			 */
 | 
			
		||||
			uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length
 | 
			
		||||
			#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
 | 
			
		||||
			                                , uint8_t (* const Callback)(void)
 | 
			
		||||
			                                , StreamCallbackPtr_t Callback
 | 
			
		||||
			#endif
 | 
			
		||||
			                                ) ATTR_NON_NULL_PTR_ARG(1);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -153,7 +153,11 @@ End_Of_Control_Send:
 | 
			
		|||
 | 
			
		||||
static uint8_t USB_Host_Wait_For_Setup_IOS(const uint8_t WaitType)
 | 
			
		||||
{
 | 
			
		||||
	#if (USB_HOST_TIMEOUT_MS < 0xFF)
 | 
			
		||||
	uint8_t  TimeoutCounter = USB_HOST_TIMEOUT_MS;	
 | 
			
		||||
	#else
 | 
			
		||||
	uint16_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
 | 
			
		||||
	#endif
 | 
			
		||||
	
 | 
			
		||||
	while (!(((WaitType == USB_HOST_WAITFOR_SetupSent)  && Pipe_IsSETUPSent())  ||
 | 
			
		||||
	         ((WaitType == USB_HOST_WAITFOR_InReceived) && Pipe_IsINReceived()) ||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,11 @@ void Pipe_ClearPipes(void)
 | 
			
		|||
 | 
			
		||||
uint8_t Pipe_WaitUntilReady(void)
 | 
			
		||||
{
 | 
			
		||||
	#if (USB_STREAM_TIMEOUT_MS < 0xFF)
 | 
			
		||||
	uint8_t  TimeoutMSRem = USB_STREAM_TIMEOUT_MS;	
 | 
			
		||||
	#else
 | 
			
		||||
	uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
 | 
			
		||||
	#endif
 | 
			
		||||
 | 
			
		||||
	USB_INT_Clear(USB_INT_HSOFI);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -104,7 +108,7 @@ uint8_t Pipe_WaitUntilReady(void)
 | 
			
		|||
 | 
			
		||||
uint8_t Pipe_Write_Stream_LE(const void* Data, uint16_t Length
 | 
			
		||||
#if !defined(NO_STREAM_CALLBACKS)
 | 
			
		||||
                                 , uint8_t (* const Callback)(void)
 | 
			
		||||
                                 , StreamCallbackPtr_t Callback
 | 
			
		||||
#endif
 | 
			
		||||
								 )
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -140,7 +144,7 @@ uint8_t Pipe_Write_Stream_LE(const void* Data, uint16_t Length
 | 
			
		|||
 | 
			
		||||
uint8_t Pipe_Write_Stream_BE(const void* Data, uint16_t Length
 | 
			
		||||
#if !defined(NO_STREAM_CALLBACKS)
 | 
			
		||||
                                 , uint8_t (* const Callback)(void)
 | 
			
		||||
                                 , StreamCallbackPtr_t Callback
 | 
			
		||||
#endif
 | 
			
		||||
								 )
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -176,7 +180,7 @@ uint8_t Pipe_Write_Stream_BE(const void* Data, uint16_t Length
 | 
			
		|||
 | 
			
		||||
uint8_t Pipe_Discard_Stream(uint16_t Length
 | 
			
		||||
#if !defined(NO_STREAM_CALLBACKS)
 | 
			
		||||
                                 , uint8_t (* const Callback)(void)
 | 
			
		||||
                                 , StreamCallbackPtr_t Callback
 | 
			
		||||
#endif
 | 
			
		||||
								 )
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -211,7 +215,7 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
 | 
			
		|||
 | 
			
		||||
uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length
 | 
			
		||||
#if !defined(NO_STREAM_CALLBACKS)
 | 
			
		||||
                                 , uint8_t (* const Callback)(void)
 | 
			
		||||
                                 , StreamCallbackPtr_t Callback
 | 
			
		||||
#endif
 | 
			
		||||
								 )
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -247,7 +251,7 @@ uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length
 | 
			
		|||
 | 
			
		||||
uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length
 | 
			
		||||
#if !defined(NO_STREAM_CALLBACKS)
 | 
			
		||||
                                 , uint8_t (* const Callback)(void)
 | 
			
		||||
                                 , StreamCallbackPtr_t Callback
 | 
			
		||||
#endif
 | 
			
		||||
								 )
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -759,7 +759,7 @@
 | 
			
		|||
			 */
 | 
			
		||||
			uint8_t Pipe_Write_Stream_LE(const void* Buffer, uint16_t Length
 | 
			
		||||
			#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
 | 
			
		||||
			                             , uint8_t (* const Callback)(void)
 | 
			
		||||
			                             , StreamCallbackPtr_t Callback
 | 
			
		||||
			#endif
 | 
			
		||||
			                             ) ATTR_NON_NULL_PTR_ARG(1);				
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -783,7 +783,7 @@
 | 
			
		|||
			 */
 | 
			
		||||
			uint8_t Pipe_Write_Stream_BE(const void* Buffer, uint16_t Length
 | 
			
		||||
			#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
 | 
			
		||||
			                             , uint8_t (* const Callback)(void)
 | 
			
		||||
			                             , StreamCallbackPtr_t Callback
 | 
			
		||||
			#endif
 | 
			
		||||
			                             ) ATTR_NON_NULL_PTR_ARG(1);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -806,7 +806,7 @@
 | 
			
		|||
			 */
 | 
			
		||||
			uint8_t Pipe_Discard_Stream(uint16_t Length
 | 
			
		||||
			#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
 | 
			
		||||
			                            , uint8_t (* const Callback)(void)
 | 
			
		||||
			                            , StreamCallbackPtr_t Callback
 | 
			
		||||
			#endif
 | 
			
		||||
			                            );
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -830,7 +830,7 @@
 | 
			
		|||
			 */
 | 
			
		||||
			uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length
 | 
			
		||||
			#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
 | 
			
		||||
			                            , uint8_t (* const Callback)(void)
 | 
			
		||||
			                            , StreamCallbackPtr_t Callback
 | 
			
		||||
			#endif
 | 
			
		||||
			                            ) ATTR_NON_NULL_PTR_ARG(1);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -854,7 +854,7 @@
 | 
			
		|||
			 */
 | 
			
		||||
			uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length
 | 
			
		||||
			#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
 | 
			
		||||
			                            , uint8_t (* const Callback)(void)
 | 
			
		||||
			                            , StreamCallbackPtr_t Callback
 | 
			
		||||
			#endif
 | 
			
		||||
			                            ) ATTR_NON_NULL_PTR_ARG(1);
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue