diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-07-21 12:20:34 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-07-21 12:20:34 +0000 |
commit | 99d8a3936384d1e9286dfecfb6f7896294cd6c11 (patch) | |
tree | 40db0dfda49d5727454c28daea895c9ab028c15f /LUFA/Drivers/USB | |
parent | 5f57785404e671f136f8c7e325922076d16fee30 (diff) | |
download | lufa-99d8a3936384d1e9286dfecfb6f7896294cd6c11.tar.gz lufa-99d8a3936384d1e9286dfecfb6f7896294cd6c11.tar.bz2 lufa-99d8a3936384d1e9286dfecfb6f7896294cd6c11.zip |
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.
Diffstat (limited to 'LUFA/Drivers/USB')
15 files changed, 58 insertions, 46 deletions
diff --git a/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h b/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h index 76b734bd7..9d4a2b3b1 100644 --- a/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h +++ b/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h @@ -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) diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.c b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c index 544531b8d..64af1406b 100644 --- a/LUFA/Drivers/USB/LowLevel/DevChapter9.c +++ b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c @@ -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; } diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.h b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.h index ab62c535a..a65b93b62 100644 --- a/LUFA/Drivers/USB/LowLevel/DevChapter9.h +++ b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.h @@ -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); diff --git a/LUFA/Drivers/USB/HighLevel/Events.h b/LUFA/Drivers/USB/HighLevel/Events.h index d88c47123..ab63c7bfe 100644 --- a/LUFA/Drivers/USB/HighLevel/Events.h +++ b/LUFA/Drivers/USB/HighLevel/Events.h @@ -69,7 +69,7 @@ #define __USBEVENTS_H__ /* Includes: */ - #include <avr/io.h> + #include <stdint.h> #include "../../../Common/Common.h" #include "USBMode.h" diff --git a/LUFA/Drivers/USB/LowLevel/HostChapter9.c b/LUFA/Drivers/USB/HighLevel/HostStandardReq.c index 69575f18b..cc6dc41e6 100644 --- a/LUFA/Drivers/USB/LowLevel/HostChapter9.c +++ b/LUFA/Drivers/USB/HighLevel/HostStandardReq.c @@ -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) { diff --git a/LUFA/Drivers/USB/LowLevel/HostChapter9.h b/LUFA/Drivers/USB/HighLevel/HostStandardReq.h index 0518855ad..4a527faee 100644 --- a/LUFA/Drivers/USB/LowLevel/HostChapter9.h +++ b/LUFA/Drivers/USB/HighLevel/HostStandardReq.h @@ -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 diff --git a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h index 1798365c5..6768b59f0 100644 --- a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h +++ b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h @@ -52,6 +52,7 @@ /* Includes: */ #include <avr/pgmspace.h> #include <stdbool.h> + #include <stdint.h> #include <stddef.h> #include "../../../Common/Common.h" diff --git a/LUFA/Drivers/USB/HighLevel/StdRequestType.h b/LUFA/Drivers/USB/HighLevel/StdRequestType.h index 505ccd3c2..f8e4f45f4 100644 --- a/LUFA/Drivers/USB/HighLevel/StdRequestType.h +++ b/LUFA/Drivers/USB/HighLevel/StdRequestType.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. diff --git a/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h b/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h index d3334e72f..dc3495285 100644 --- a/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h +++ b/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h @@ -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. diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.h b/LUFA/Drivers/USB/HighLevel/USBTask.h index cce7bb29e..faff2a3bb 100644 --- a/LUFA/Drivers/USB/HighLevel/USBTask.h +++ b/LUFA/Drivers/USB/HighLevel/USBTask.h @@ -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: */ diff --git a/LUFA/Drivers/USB/LowLevel/Device.h b/LUFA/Drivers/USB/LowLevel/Device.h index 27bc42828..02dd8cf0d 100644 --- a/LUFA/Drivers/USB/LowLevel/Device.h +++ b/LUFA/Drivers/USB/LowLevel/Device.h @@ -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 diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.c b/LUFA/Drivers/USB/LowLevel/USBController.c index 4c742102b..907e2bab0 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.c +++ b/LUFA/Drivers/USB/LowLevel/USBController.c @@ -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; diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.h b/LUFA/Drivers/USB/LowLevel/USBController.h index 4f27216b1..ef670a456 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.h +++ b/LUFA/Drivers/USB/LowLevel/USBController.h @@ -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: */ diff --git a/LUFA/Drivers/USB/LowLevel/USBInterrupt.h b/LUFA/Drivers/USB/LowLevel/USBInterrupt.h index 6f8bf7cea..f954468be 100644 --- a/LUFA/Drivers/USB/LowLevel/USBInterrupt.h +++ b/LUFA/Drivers/USB/LowLevel/USBInterrupt.h @@ -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) diff --git a/LUFA/Drivers/USB/USB.h b/LUFA/Drivers/USB/USB.h index 3cc1593fc..c63582bad 100644 --- a/LUFA/Drivers/USB/USB.h +++ b/LUFA/Drivers/USB/USB.h @@ -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__) |