Removed two-step endpoint/pipe bank clear and switch sequence for smaller, faster endpoint/pipe code.
Added spacing between multiple paragraphs in Doxygen \note sections. Removed call to the clock prescaler reset function in the Teensy bootloader to save space - the user application is accessed via a watchdog reset anyway, so the prescale reset would only affect the speed of the bootloader itself.
This commit is contained in:
		
							parent
							
								
									19ecd04f37
								
							
						
					
					
						commit
						7b79325aa0
					
				
					 17 changed files with 76 additions and 37 deletions
				
			
		| 
						 | 
				
			
			@ -103,6 +103,7 @@
 | 
			
		|||
				 *
 | 
			
		||||
				 *  \note This variable should be treated as read-only in the user application, and never manually
 | 
			
		||||
				 *        changed in value.
 | 
			
		||||
				 *        \n\n
 | 
			
		||||
				 *
 | 
			
		||||
				 *  \note To reduce FLASH usage of the compiled applications where Remote Wakeup is not supported,
 | 
			
		||||
				 *        this global and the underlying management code can be disabled by defining the 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -73,6 +73,7 @@
 | 
			
		|||
				 *  USB interface should be initialized in low speed (1.5Mb/s) mode.
 | 
			
		||||
				 *
 | 
			
		||||
				 *  \note Low Speed mode is not available on all USB AVR models.
 | 
			
		||||
				 *        \n\n
 | 
			
		||||
				 *
 | 
			
		||||
				 *  \note Restrictions apply on the number, size and type of endpoints which can be used
 | 
			
		||||
				 *        when running in low speed mode -- refer to the USB 2.0 standard.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -405,15 +405,13 @@
 | 
			
		|||
				#define Endpoint_ClearSETUP()                 MACROS{ UEINTX &= ~(1 << RXSTPI); }MACROE
 | 
			
		||||
 | 
			
		||||
				#if !defined(CONTROL_ONLY_DEVICE)
 | 
			
		||||
					#define Endpoint_ClearIN()                MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << TXINI)); \
 | 
			
		||||
					                                                  UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE
 | 
			
		||||
					#define Endpoint_ClearIN()                MACROS{ UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); }MACROE
 | 
			
		||||
				#else
 | 
			
		||||
					#define Endpoint_ClearIN()                MACROS{ UEINTX &= ~(1 << TXINI); }MACROE
 | 
			
		||||
				#endif
 | 
			
		||||
 | 
			
		||||
				#if !defined(CONTROL_ONLY_DEVICE)
 | 
			
		||||
					#define Endpoint_ClearOUT()               MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << RXOUTI)); \
 | 
			
		||||
					                                                  UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE
 | 
			
		||||
					#define Endpoint_ClearOUT()               MACROS{ UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); }MACROE
 | 
			
		||||
				#else
 | 
			
		||||
					#define Endpoint_ClearOUT()               MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE			
 | 
			
		||||
				#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -747,7 +745,8 @@
 | 
			
		|||
			 *  The banking mode may be either \ref ENDPOINT_BANK_SINGLE or \ref ENDPOINT_BANK_DOUBLE.
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note The default control endpoint does not have to be manually configured, as it is automatically
 | 
			
		||||
			 *  configured by the library internally.
 | 
			
		||||
			 *        configured by the library internally.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine will select the specified endpoint, and the endpoint will remain selected
 | 
			
		||||
			 *        once the routine completes regardless of if the endpoint configuration succeeds.
 | 
			
		||||
| 
						 | 
				
			
			@ -971,6 +970,7 @@
 | 
			
		|||
			 *
 | 
			
		||||
			 *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
 | 
			
		||||
			 *        to clear the status stage when using this routine in a control transaction.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine should only be used on CONTROL type endpoints.
 | 
			
		||||
			 *
 | 
			
		||||
| 
						 | 
				
			
			@ -990,6 +990,7 @@
 | 
			
		|||
			 *
 | 
			
		||||
			 *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
 | 
			
		||||
			 *        to clear the status stage when using this routine in a control transaction.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine should only be used on CONTROL type endpoints.
 | 
			
		||||
			 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1009,8 +1010,10 @@
 | 
			
		|||
			 *
 | 
			
		||||
			 *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
 | 
			
		||||
			 *        to clear the status stage when using this routine in a control transaction.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine should only be used on CONTROL type endpoints.
 | 
			
		||||
			 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1033,6 +1036,7 @@
 | 
			
		|||
			 *
 | 
			
		||||
			 *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
 | 
			
		||||
			 *        to clear the status stage when using this routine in a control transaction.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine should only be used on CONTROL type endpoints.
 | 
			
		||||
			 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1052,6 +1056,7 @@
 | 
			
		|||
			 *
 | 
			
		||||
			 *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
 | 
			
		||||
			 *        to clear the status stage when using this routine in a control transaction.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine should only be used on CONTROL type endpoints.
 | 
			
		||||
			 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1071,8 +1076,10 @@
 | 
			
		|||
			 *
 | 
			
		||||
			 *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
 | 
			
		||||
			 *        to clear the status stage when using this routine in a control transaction.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine should only be used on CONTROL type endpoints.
 | 
			
		||||
			 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1095,6 +1102,7 @@
 | 
			
		|||
			 *
 | 
			
		||||
			 *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
 | 
			
		||||
			 *        to clear the status stage when using this routine in a control transaction.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine should only be used on CONTROL type endpoints.
 | 
			
		||||
			 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1114,6 +1122,7 @@
 | 
			
		|||
			 *
 | 
			
		||||
			 *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
 | 
			
		||||
			 *        to clear the status stage when using this routine in a control transaction.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine should only be used on CONTROL type endpoints.
 | 
			
		||||
			 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1136,6 +1145,7 @@
 | 
			
		|||
			 *
 | 
			
		||||
			 *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
 | 
			
		||||
			 *        to clear the status stage when using this routine in a control transaction.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine should only be used on CONTROL type endpoints.
 | 
			
		||||
			 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1155,6 +1165,7 @@
 | 
			
		|||
			 *
 | 
			
		||||
			 *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
 | 
			
		||||
			 *        to clear the status stage when using this routine in a control transaction.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine should only be used on CONTROL type endpoints.
 | 
			
		||||
			 *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -113,9 +113,18 @@ void USB_ShutDown(void)
 | 
			
		|||
	USB_Detach();
 | 
			
		||||
	USB_Controller_Disable();
 | 
			
		||||
	
 | 
			
		||||
	USB_INT_DisableAllInterrupts();
 | 
			
		||||
	USB_INT_ClearAllInterrupts();
 | 
			
		||||
 | 
			
		||||
	#if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
 | 
			
		||||
	UHWCON &= ~(1 << UIMOD);
 | 
			
		||||
	#endif
 | 
			
		||||
	
 | 
			
		||||
	if (!(USB_Options & USB_OPT_MANUAL_PLL))
 | 
			
		||||
	  USB_PLL_Off();
 | 
			
		||||
	
 | 
			
		||||
	USB_REG_Off();
 | 
			
		||||
 | 
			
		||||
	#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
 | 
			
		||||
	USB_OTGPAD_Off();
 | 
			
		||||
	#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -145,11 +154,11 @@ void USB_ResetInterface(void)
 | 
			
		|||
	USB_ConfigurationNumber  = 0;
 | 
			
		||||
 | 
			
		||||
	#if !defined(NO_DEVICE_REMOTE_WAKEUP)
 | 
			
		||||
		USB_RemoteWakeupEnabled  = false;
 | 
			
		||||
	USB_RemoteWakeupEnabled  = false;
 | 
			
		||||
	#endif
 | 
			
		||||
	
 | 
			
		||||
	#if !defined(NO_DEVICE_SELF_POWER)
 | 
			
		||||
		USB_CurrentlySelfPowered = false;
 | 
			
		||||
	USB_CurrentlySelfPowered = false;
 | 
			
		||||
	#endif
 | 
			
		||||
	#endif
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			@ -217,9 +226,9 @@ void USB_ResetInterface(void)
 | 
			
		|||
	USB_INT_Clear(USB_INT_EORSTI);
 | 
			
		||||
	USB_INT_Enable(USB_INT_EORSTI);
 | 
			
		||||
 | 
			
		||||
		#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
 | 
			
		||||
		USB_INT_Enable(USB_INT_VBUS);
 | 
			
		||||
		#endif
 | 
			
		||||
	#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
 | 
			
		||||
	USB_INT_Enable(USB_INT_VBUS);
 | 
			
		||||
	#endif
 | 
			
		||||
	#elif defined(USB_HOST_ONLY)
 | 
			
		||||
	USB_Host_HostMode_On();
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -252,16 +252,18 @@
 | 
			
		|||
			 *                      mode speed.
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note To reduce the FLASH requirements of the library if only device or host mode is required, 
 | 
			
		||||
			 *        this can be statically set via defining the token USB_DEVICE_ONLY for device mode or 
 | 
			
		||||
			 *        USB_HOST_ONLY for host mode in the use project makefile, passing the token to the compiler 
 | 
			
		||||
			 *        the mode can be statically set in the project makefile by defining the token USB_DEVICE_ONLY
 | 
			
		||||
			 *        (for device mode) or USB_HOST_ONLY (for host mode), passing the token to the compiler 
 | 
			
		||||
			 *        via the -D switch. If the mode is statically set, this parameter does not exist in the
 | 
			
		||||
			 *        function prototype.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note To reduce the FLASH requirements of the library if only fixed settings are are required,
 | 
			
		||||
			 *        the options may be set statically in the same manner as the mode (see the Mode parameter of 
 | 
			
		||||
			 *        this function). To statically set the USB options, pass in the USE_STATIC_OPTIONS token,
 | 
			
		||||
			 *        defined to the appropriate options masks. When the options are statically set, this
 | 
			
		||||
			 *        parameter does not exist in the function prototype.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *        
 | 
			
		||||
			 *  \note The mode parameter does not exist on devices where only one mode is possible, such as USB 
 | 
			
		||||
			 *        AVR models which only implement the USB device mode in hardware.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -493,14 +493,11 @@
 | 
			
		|||
 | 
			
		||||
				#define Pipe_IsSETUPSent()             ((UPINTX & (1 << TXSTPI)) ? true : false)
 | 
			
		||||
 | 
			
		||||
				#define Pipe_ClearIN()                 MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << RXINI)); \
 | 
			
		||||
				                                               UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE
 | 
			
		||||
				#define Pipe_ClearIN()                 MACROS{ UPINTX &= ~((1 << RXINI) | (1 << FIFOCON)); }MACROE
 | 
			
		||||
 | 
			
		||||
				#define Pipe_ClearOUT()                MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << TXOUTI)); \
 | 
			
		||||
				                                               UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE
 | 
			
		||||
				#define Pipe_ClearOUT()                MACROS{ UPINTX &= ~((1 << TXOUTI) | (1 << FIFOCON)); }MACROE
 | 
			
		||||
				
 | 
			
		||||
				#define Pipe_ClearSETUP()              MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << TXSTPI)); \
 | 
			
		||||
				                                               UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE
 | 
			
		||||
				#define Pipe_ClearSETUP()              MACROS{ UPINTX &= ~((1 << TXSTPI) | (1 << FIFOCON)); }MACROE
 | 
			
		||||
 | 
			
		||||
				#define Pipe_IsNAKReceived()           ((UPINTX & (1 << NAKEDI)) ? true : false)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -803,7 +800,8 @@
 | 
			
		|||
			 *  \ref Pipe_SetFiniteINRequests().
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note The default control pipe does not have to be manually configured, as it is automatically
 | 
			
		||||
			 *  configured by the library internally.
 | 
			
		||||
			 *        configured by the library internally.
 | 
			
		||||
			 *        \n\n
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \note This routine will select the specified pipe, and the pipe will remain selected once the
 | 
			
		||||
			 *        routine completes regardless of if the pipe configuration succeeds.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue