From 8f4f48d963d0dd5751298a3a301dcbb32e26082b Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sat, 7 Apr 2012 17:01:46 +0000 Subject: [PATCH] Add architecture guards to all architecture-specific files, so that they can be bulk-added to existing IDE projects without having to exclude unused architecture files. --- LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c | 5 +++++ LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c | 4 ++++ LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c | 5 +++++ LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c | 4 ++++ LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c | 4 ++++ LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c | 4 ++++ LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c | 4 ++++ LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c | 7 ++++++- LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c | 4 ++++ LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c | 4 ++++ LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c | 5 +++++ LUFA/Drivers/USB/Core/UC3/Device_UC3.c | 4 ++++ LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c | 4 ++++ LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c | 4 ++++ LUFA/Drivers/USB/Core/UC3/Host_UC3.c | 4 ++++ LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c | 4 ++++ LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c | 4 ++++ LUFA/Drivers/USB/Core/UC3/USBController_UC3.c | 4 ++++ LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c | 4 ++++ LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c | 5 +++++ LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c | 4 ++++ LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c | 5 +++++ LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c | 4 ++++ LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c | 4 ++++ LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c | 4 ++++ LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c | 4 ++++ LUFA/Platform/UC3/Exception.S | 3 +++ LUFA/Platform/UC3/InterruptManagement.c | 4 ++++ 28 files changed, 118 insertions(+), 1 deletion(-) diff --git a/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c b/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c index f391c06e0f2..89d75bf855b 100644 --- a/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c +++ b/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + #define __INCLUDE_FROM_SERIAL_C #include "../Serial.h" @@ -112,3 +115,5 @@ void Serial_CreateBlockingStream(FILE* Stream) *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar_Blocking, _FDEV_SETUP_RW); } + +#endif diff --git a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c index 34e64151458..45477fd5208 100644 --- a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c +++ b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + #define __INCLUDE_FROM_TWI_C #include "../TWI.h" @@ -201,3 +204,4 @@ uint8_t TWI_WritePacket(const uint8_t SlaveAddress, return ErrorCode; } +#endif diff --git a/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c b/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c index accdc659f49..8ec0390f339 100644 --- a/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c +++ b/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + #define __INCLUDE_FROM_SERIAL_C #include "../Serial.h" @@ -115,3 +118,5 @@ void Serial_CreateBlockingStream(FILE* Stream) *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar_Blocking, _FDEV_SETUP_RW); } + +#endif diff --git a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c index 61f445644db..bccbc13865d 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -51,3 +54,4 @@ void USB_Device_SendRemoteWakeup(void) #endif +#endif diff --git a/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c index 1e7ed9ce52c..0117a1d665f 100644 --- a/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -269,3 +272,4 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, #endif +#endif diff --git a/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c index a6032a6f44a..bcf904d99f4 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -180,3 +183,4 @@ uint8_t Endpoint_WaitUntilReady(void) #endif +#endif diff --git a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c index fd311e335ad..3f27c76319c 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -292,3 +295,4 @@ static void USB_Host_ResetDevice(void) #endif +#endif diff --git a/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c index 2d8e0f7fea7..e71a7bd3272 100644 --- a/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -213,4 +216,6 @@ uint8_t Pipe_Null_Stream(uint16_t Length, #include "Template/Template_Pipe_RW.c" #endif - + +#endif + diff --git a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c index a6e629cd961..5e68cc7256e 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -179,3 +182,4 @@ uint8_t Pipe_WaitUntilReady(void) #endif +#endif diff --git a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c index 239373ce746..e31b88d5ff7 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + #define __INCLUDE_FROM_USB_DRIVER #define __INCLUDE_FROM_USB_CONTROLLER_C #include "../USBController.h" @@ -260,3 +263,4 @@ static void USB_Init_Host(void) } #endif +#endif diff --git a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c index 8dfb0923e18..f63cf3eb9e9 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBInterrupt.h" @@ -273,3 +276,5 @@ ISR(USB_COM_vect, ISR_BLOCK) } #endif +#endif + diff --git a/LUFA/Drivers/USB/Core/UC3/Device_UC3.c b/LUFA/Drivers/USB/Core/UC3/Device_UC3.c index b30edf03985..db7286ebae9 100644 --- a/LUFA/Drivers/USB/Core/UC3/Device_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/Device_UC3.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_UC3) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -45,3 +48,4 @@ void USB_Device_SendRemoteWakeup(void) #endif +#endif diff --git a/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c b/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c index c099c875335..b4e130e7469 100644 --- a/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_UC3) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -229,3 +232,4 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, #endif +#endif diff --git a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c index 3ad806db493..fc1b18a2e8d 100644 --- a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_UC3) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -173,3 +176,4 @@ uint8_t Endpoint_WaitUntilReady(void) #endif +#endif diff --git a/LUFA/Drivers/USB/Core/UC3/Host_UC3.c b/LUFA/Drivers/USB/Core/UC3/Host_UC3.c index ef47b6040a9..49d43f9b562 100644 --- a/LUFA/Drivers/USB/Core/UC3/Host_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/Host_UC3.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_UC3) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -292,3 +295,4 @@ static void USB_Host_ResetDevice(void) #endif +#endif diff --git a/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c b/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c index 0d40f921661..bb4cbc65932 100644 --- a/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_UC3) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -160,3 +163,4 @@ uint8_t Pipe_Null_Stream(uint16_t Length, #endif +#endif diff --git a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c index dbd03c7cd12..4e77a28ffef 100644 --- a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_UC3) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -178,3 +181,4 @@ uint8_t Pipe_WaitUntilReady(void) #endif +#endif diff --git a/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c b/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c index a9a6d35d9a9..95ca7d9aa97 100644 --- a/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_UC3) + #define __INCLUDE_FROM_USB_DRIVER #define __INCLUDE_FROM_USB_CONTROLLER_C #include "../USBController.h" @@ -217,3 +220,4 @@ static void USB_Init_Host(void) } #endif +#endif diff --git a/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c b/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c index a62646ae89d..d411a930530 100644 --- a/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_UC3) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBInterrupt.h" @@ -223,3 +226,4 @@ ISR(USB_COM_vect) } #endif +#endif diff --git a/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c index fa1b474a989..130d07116df 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -42,3 +45,5 @@ void USB_Device_SendRemoteWakeup(void) #endif +#endif + diff --git a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c index ce19dcac2ec..774a574f385 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -269,3 +272,4 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, #endif +#endif diff --git a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c index 662f4a3c183..98e35e59ae4 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -145,3 +148,5 @@ uint8_t Endpoint_WaitUntilReady(void) #endif +#endif + diff --git a/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c index b2ec9717f8b..549ad8b63ad 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -35,3 +38,4 @@ #endif +#endif diff --git a/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c index b2ec9717f8b..549ad8b63ad 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBMode.h" @@ -35,3 +38,4 @@ #endif +#endif diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c index a7fa9d17e33..387e8e417e6 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + #define __INCLUDE_FROM_USB_DRIVER #define __INCLUDE_FROM_USB_CONTROLLER_C #include "../USBController.h" @@ -178,3 +181,4 @@ static void USB_Init_Device(void) } #endif +#endif diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c index 27ffb065a91..b0e52d06e9f 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c @@ -28,6 +28,9 @@ this software. */ +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + #define __INCLUDE_FROM_USB_DRIVER #include "../USBInterrupt.h" @@ -101,3 +104,4 @@ ISR(USB_BUSEVENT_vect) } } +#endif diff --git a/LUFA/Platform/UC3/Exception.S b/LUFA/Platform/UC3/Exception.S index ddfe0098482..50f52bdddba 100644 --- a/LUFA/Platform/UC3/Exception.S +++ b/LUFA/Platform/UC3/Exception.S @@ -28,6 +28,7 @@ this software. */ +#if defined(__AVR32__) #include .section .exception_handlers, "ax", @progbits @@ -123,3 +124,5 @@ Autovector_Table: .word ((AVR32_INTC_INT0 + \Level) << AVR32_INTC_IPR_INTLEVEL_OFFSET) | (Exception_INT\Level - EVBA_Table) .endr // === END OF GENERAL INTERRUPT HANDLER OFFSET TABLE === + +#endif diff --git a/LUFA/Platform/UC3/InterruptManagement.c b/LUFA/Platform/UC3/InterruptManagement.c index 7d883c639bc..b4fd198422f 100644 --- a/LUFA/Platform/UC3/InterruptManagement.c +++ b/LUFA/Platform/UC3/InterruptManagement.c @@ -28,6 +28,9 @@ this software. */ +#include "../../Common/Common.h" +#if (ARCH == ARCH_UC3) + #define __INCLUDE_FROM_INTMANAGEMENT_C #include "InterruptManagement.h" @@ -62,3 +65,4 @@ void INTC_Init(void) __builtin_mtsr(AVR32_EVBA, (uintptr_t)&EVBA_Table); } +#endif