Move and rename DevChaper9.c/.h and HostChapter9.c/.h to the HighLevel directory, new named DeviceStandardReq.c/.h and HostStandardReq.c/.h.
Rename LowLevel.c/.h to USBController.c/.h. Remove dependancies on the complete <avr/io.h> header in the HighLevel USB driver directory, to ensure less work is required in later (possible) ports.
This commit is contained in:
		
							parent
							
								
									5f57785404
								
							
						
					
					
						commit
						99d8a39363
					
				
					 20 changed files with 72 additions and 53 deletions
				
			
		| 
						 | 
				
			
			@ -51,12 +51,12 @@
 | 
			
		|||
#define __CONFIGDESCRIPTOR_H__
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <stdint.h>
 | 
			
		||||
		
 | 
			
		||||
		#include "../../../Common/Common.h"
 | 
			
		||||
		#include "../HighLevel/USBMode.h"
 | 
			
		||||
		#include "../LowLevel/HostChapter9.h"
 | 
			
		||||
		#include "../HighLevel/StdDescriptors.h"
 | 
			
		||||
		#include "HostStandardReq.h"
 | 
			
		||||
		#include "USBMode.h"
 | 
			
		||||
		#include "StdDescriptors.h"
 | 
			
		||||
		
 | 
			
		||||
	/* Enable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,12 +29,12 @@
 | 
			
		|||
*/
 | 
			
		||||
 | 
			
		||||
#define  __INCLUDE_FROM_USB_DRIVER
 | 
			
		||||
#include "../HighLevel/USBMode.h"
 | 
			
		||||
#include "USBMode.h"
 | 
			
		||||
 | 
			
		||||
#if defined(USB_CAN_BE_DEVICE)
 | 
			
		||||
 | 
			
		||||
#define  __INCLUDE_FROM_DEVCHAPTER9_C
 | 
			
		||||
#include "DevChapter9.h"
 | 
			
		||||
#define  __INCLUDE_FROM_DEVICESTDREQ_C
 | 
			
		||||
#include "DeviceStandardReq.h"
 | 
			
		||||
 | 
			
		||||
uint8_t USB_ConfigurationNumber;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -138,7 +138,7 @@ static void USB_Device_SetAddress(void)
 | 
			
		|||
 | 
			
		||||
	USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
 | 
			
		||||
 | 
			
		||||
	UDADDR = ((1 << ADDEN) | DeviceAddress);
 | 
			
		||||
	USB_Device_SetDeviceAddress(DeviceAddress);
 | 
			
		||||
 | 
			
		||||
	return;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -38,21 +38,22 @@
 | 
			
		|||
 *        dispatch header located in LUFA/Drivers/USB/USB.h.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __DEVCHAPTER9_H__
 | 
			
		||||
#define __DEVCHAPTER9_H__
 | 
			
		||||
#ifndef __DEVICESTDREQ_H__
 | 
			
		||||
#define __DEVICESTDREQ_H__
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <avr/pgmspace.h>
 | 
			
		||||
		#include <avr/eeprom.h>
 | 
			
		||||
		#include <avr/boot.h>
 | 
			
		||||
		#include <util/atomic.h>
 | 
			
		||||
		#include <stdint.h>
 | 
			
		||||
		#include <stdbool.h>
 | 
			
		||||
		
 | 
			
		||||
		#include "../HighLevel/StdDescriptors.h"
 | 
			
		||||
		#include "../HighLevel/Events.h"
 | 
			
		||||
		#include "../HighLevel/StdRequestType.h"
 | 
			
		||||
		#include "../HighLevel/USBTask.h"
 | 
			
		||||
		#include "LowLevel.h"
 | 
			
		||||
		#include "StdDescriptors.h"
 | 
			
		||||
		#include "Events.h"
 | 
			
		||||
		#include "StdRequestType.h"
 | 
			
		||||
		#include "USBTask.h"
 | 
			
		||||
		#include "../LowLevel/USBController.h"
 | 
			
		||||
 | 
			
		||||
	/* Enable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +142,7 @@
 | 
			
		|||
		/* Function Prototypes: */
 | 
			
		||||
			void USB_Device_ProcessControlRequest(void);
 | 
			
		||||
			
 | 
			
		||||
			#if defined(__INCLUDE_FROM_DEVCHAPTER9_C)
 | 
			
		||||
			#if defined(__INCLUDE_FROM_DEVICESTDREQ_C)
 | 
			
		||||
				static void USB_Device_SetAddress(void);
 | 
			
		||||
				static void USB_Device_SetConfiguration(void);
 | 
			
		||||
				static void USB_Device_GetConfiguration(void);
 | 
			
		||||
| 
						 | 
				
			
			@ -69,7 +69,7 @@
 | 
			
		|||
#define __USBEVENTS_H__
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <stdint.h>
 | 
			
		||||
		
 | 
			
		||||
		#include "../../../Common/Common.h"
 | 
			
		||||
		#include "USBMode.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,12 +29,12 @@
 | 
			
		|||
*/
 | 
			
		||||
 | 
			
		||||
#define  __INCLUDE_FROM_USB_DRIVER
 | 
			
		||||
#include "../HighLevel/USBMode.h"
 | 
			
		||||
#include "USBMode.h"
 | 
			
		||||
 | 
			
		||||
#if defined(USB_CAN_BE_HOST)
 | 
			
		||||
 | 
			
		||||
#define  __INCLUDE_FROM_HOSTCHAPTER9_C
 | 
			
		||||
#include "HostChapter9.h"
 | 
			
		||||
#define  __INCLUDE_FROM_HOSTSTDREQ_C
 | 
			
		||||
#include "HostStandardReq.h"
 | 
			
		||||
 | 
			
		||||
uint8_t USB_Host_SendControlRequest(void* BufferPtr)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -38,17 +38,17 @@
 | 
			
		|||
 *        dispatch header located in LUFA/Drivers/USB/USB.h.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __HOSTCHAPTER9_H__
 | 
			
		||||
#define __HOSTCHAPTER9_H__
 | 
			
		||||
#ifndef __HOSTSTDREQ_H__
 | 
			
		||||
#define __HOSTSTDREQ_H__
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <stdint.h>
 | 
			
		||||
		#include <stdbool.h>
 | 
			
		||||
		
 | 
			
		||||
		#include "LowLevel.h"
 | 
			
		||||
		#include "../HighLevel/USBMode.h"
 | 
			
		||||
		#include "../HighLevel/StdRequestType.h"
 | 
			
		||||
 | 
			
		||||
		#include "USBMode.h"
 | 
			
		||||
		#include "StdRequestType.h"
 | 
			
		||||
		#include "../LowLevel/USBController.h"
 | 
			
		||||
		
 | 
			
		||||
	/* Enable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
			extern "C" {
 | 
			
		||||
| 
						 | 
				
			
			@ -104,7 +104,7 @@
 | 
			
		|||
			};
 | 
			
		||||
	
 | 
			
		||||
		/* Function Prototypes: */
 | 
			
		||||
			#if defined(__INCLUDE_FROM_HOSTCHAPTER9_C)
 | 
			
		||||
			#if defined(__INCLUDE_FROM_HOSTSTDREQ_C)
 | 
			
		||||
				static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType);
 | 
			
		||||
			#endif
 | 
			
		||||
	#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -52,6 +52,7 @@
 | 
			
		|||
	/* Includes: */
 | 
			
		||||
		#include <avr/pgmspace.h>
 | 
			
		||||
		#include <stdbool.h>
 | 
			
		||||
		#include <stdint.h>
 | 
			
		||||
		#include <stddef.h>
 | 
			
		||||
 | 
			
		||||
		#include "../../../Common/Common.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,6 +49,9 @@
 | 
			
		|||
#ifndef __STDREQTYPE_H__
 | 
			
		||||
#define __STDREQTYPE_H__
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
	/* Preprocessor Checks: */
 | 
			
		||||
		#if !defined(__INCLUDE_FROM_USB_DRIVER)
 | 
			
		||||
			#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,6 +51,9 @@
 | 
			
		|||
#ifndef __STREAMCALLBACK_H__
 | 
			
		||||
#define __STREAMCALLBACK_H__
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
	/* Preprocessor Checks: */
 | 
			
		||||
		#if !defined(__INCLUDE_FROM_USB_DRIVER)
 | 
			
		||||
			#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,22 +42,22 @@
 | 
			
		|||
#define __USBTASK_H__
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <avr/interrupt.h>
 | 
			
		||||
		#include <stdint.h>
 | 
			
		||||
		#include <stdbool.h>
 | 
			
		||||
		
 | 
			
		||||
		#include "../LowLevel/LowLevel.h"
 | 
			
		||||
		#include "../LowLevel/USBController.h"
 | 
			
		||||
		#include "Events.h"
 | 
			
		||||
		#include "StdRequestType.h"
 | 
			
		||||
		#include "StdDescriptors.h"
 | 
			
		||||
		#include "USBMode.h"
 | 
			
		||||
 | 
			
		||||
		#if defined(USB_CAN_BE_DEVICE)
 | 
			
		||||
			#include "../LowLevel/DevChapter9.h"
 | 
			
		||||
			#include "DeviceStandardReq.h"
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		#if defined(USB_CAN_BE_HOST)
 | 
			
		||||
			#include "../LowLevel/HostChapter9.h"
 | 
			
		||||
			#include "HostStandardReq.h"
 | 
			
		||||
		#endif
 | 
			
		||||
		
 | 
			
		||||
	/* Enable C linkage for C++ Compilers: */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -191,8 +191,11 @@
 | 
			
		|||
	/* Private Interface - For use in library only: */
 | 
			
		||||
	#if !defined(__DOXYGEN__)
 | 
			
		||||
		/* Macros: */		
 | 
			
		||||
			#define USB_Device_SetLowSpeed()        MACROS{ UDCON |=  (1 << LSM);   }MACROE
 | 
			
		||||
			#define USB_Device_SetFullSpeed()       MACROS{ UDCON &= ~(1 << LSM);   }MACROE
 | 
			
		||||
			#define USB_Device_SetLowSpeed()          MACROS{ UDCON |=  (1 << LSM);   }MACROE
 | 
			
		||||
			#define USB_Device_SetFullSpeed()         MACROS{ UDCON &= ~(1 << LSM);   }MACROE
 | 
			
		||||
			
 | 
			
		||||
			#define USB_Device_SetDeviceAddress(addr) MACROS{ UDADDR = ((1 << ADDEN) | (addr & 0x7F)); }MACROE
 | 
			
		||||
			
 | 
			
		||||
	#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,7 +29,7 @@
 | 
			
		|||
*/
 | 
			
		||||
 | 
			
		||||
#define  __INCLUDE_FROM_USB_DRIVER
 | 
			
		||||
#include "LowLevel.h"
 | 
			
		||||
#include "USBController.h"
 | 
			
		||||
 | 
			
		||||
#if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY))
 | 
			
		||||
volatile uint8_t USB_CurrentMode = USB_MODE_NONE;
 | 
			
		||||
| 
						 | 
				
			
			@ -46,8 +46,8 @@
 | 
			
		|||
 *  @{
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __USBLOWLEVEL_H__
 | 
			
		||||
#define __USBLOWLEVEL_H__
 | 
			
		||||
#ifndef __USBCONTROLLER_H__
 | 
			
		||||
#define __USBCONTROLLER_H__
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -66,12 +66,13 @@
 | 
			
		|||
			#include "Host.h"
 | 
			
		||||
			#include "Pipe.h"
 | 
			
		||||
			#include "OTG.h"
 | 
			
		||||
			#include "../HighLevel/HostStandardReq.h"
 | 
			
		||||
		#endif
 | 
			
		||||
		
 | 
			
		||||
		#if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)
 | 
			
		||||
			#include "Device.h"
 | 
			
		||||
			#include "Endpoint.h"
 | 
			
		||||
			#include "DevChapter9.h"
 | 
			
		||||
			#include "../HighLevel/DeviceStandardReq.h"
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
	/* Enable C linkage for C++ Compilers: */
 | 
			
		||||
| 
						 | 
				
			
			@ -50,7 +50,7 @@
 | 
			
		|||
		#include "../../../Common/Common.h"
 | 
			
		||||
		#include "../HighLevel/USBMode.h"
 | 
			
		||||
		#include "../HighLevel/Events.h"
 | 
			
		||||
		#include "LowLevel.h"
 | 
			
		||||
		#include "USBController.h"
 | 
			
		||||
		
 | 
			
		||||
	/* Enable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,16 +41,16 @@
 | 
			
		|||
 *
 | 
			
		||||
 *  \section Sec_Dependencies Module Source Dependencies
 | 
			
		||||
 *  The following files must be built with any user project that uses this module:
 | 
			
		||||
 *    - LUFA/Drivers/USB/LowLevel/DevChapter9.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/LowLevel/Device.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/LowLevel/Endpoint.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/LowLevel/Host.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/LowLevel/HostChapter9.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/LowLevel/LowLevel.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/LowLevel/Pipe.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/LowLevel/USBController.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/LowLevel/USBInterrupt.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/HighLevel/Events.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/HighLevel/HostStandardReq.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *    - LUFA/Drivers/USB/HighLevel/USBTask.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
 | 
			
		||||
 *
 | 
			
		||||
 *  \section Module Description
 | 
			
		||||
| 
						 | 
				
			
			@ -372,19 +372,19 @@
 | 
			
		|||
		#include "HighLevel/StdDescriptors.h"
 | 
			
		||||
		#include "HighLevel/ConfigDescriptor.h"
 | 
			
		||||
 | 
			
		||||
		#include "LowLevel/LowLevel.h"
 | 
			
		||||
		#include "LowLevel/USBController.h"
 | 
			
		||||
		#include "LowLevel/USBInterrupt.h"
 | 
			
		||||
	
 | 
			
		||||
		#if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)
 | 
			
		||||
			#include "LowLevel/Host.h"
 | 
			
		||||
			#include "LowLevel/HostChapter9.h"
 | 
			
		||||
			#include "LowLevel/Pipe.h"
 | 
			
		||||
			#include "HighLevel/HostStandardReq.h"
 | 
			
		||||
		#endif
 | 
			
		||||
		
 | 
			
		||||
		#if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)
 | 
			
		||||
			#include "LowLevel/Device.h"
 | 
			
		||||
			#include "LowLevel/DevChapter9.h"
 | 
			
		||||
			#include "LowLevel/Endpoint.h"
 | 
			
		||||
			#include "HighLevel/DeviceStandardReq.h"
 | 
			
		||||
		#endif
 | 
			
		||||
		
 | 
			
		||||
		#if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue