diff --git a/Bootloaders/CDC/BootloaderAPI.c b/Bootloaders/CDC/BootloaderAPI.c index 60b2d94b2..bac078f50 100644 --- a/Bootloaders/CDC/BootloaderAPI.c +++ b/Bootloaders/CDC/BootloaderAPI.c @@ -38,12 +38,14 @@ void BootloaderAPI_ErasePage(const uint32_t Address) { boot_page_erase_safe(Address); + boot_spm_busy_wait(); boot_rww_enable(); } void BootloaderAPI_WritePage(const uint32_t Address) { boot_page_write_safe(Address); + boot_spm_busy_wait(); boot_rww_enable(); } diff --git a/Bootloaders/CDC/BootloaderAPITable.S b/Bootloaders/CDC/BootloaderAPITable.S index a8e38861d..060a7abea 100644 --- a/Bootloaders/CDC/BootloaderAPITable.S +++ b/Bootloaders/CDC/BootloaderAPITable.S @@ -1,6 +1,6 @@ /* LUFA Library - Copyright (C) Dean Camera, 2011. + Copyright (C) Dean Camera, 2012. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org @@ -28,41 +28,44 @@ this software. */ -; Bootloader API Jump Table -.section .apitable, "ax" - ; Trampolines to actual API implementations if the target address is outside the ; range of a rjmp instruction (can happen with large bootloader sections) -.org 0 -BootloaderAPI_ErasePage_Trampoline: - jmp BootloaderAPI_ErasePage -BootloaderAPI_WritePage_Trampoline: - jmp BootloaderAPI_WritePage -BootloaderAPI_FillWord_Trampoline: - jmp BootloaderAPI_FillWord -BootloaderAPI_ReadSignature_Trampoline: - jmp BootloaderAPI_ReadSignature -BootloaderAPI_ReadFuse_Trampoline: - jmp BootloaderAPI_ReadFuse -BootloaderAPI_ReadLock_Trampoline: - jmp BootloaderAPI_ReadLock -BootloaderAPI_WriteLock_Trampoline: - jmp BootloaderAPI_WriteLock -BootloaderAPU_UNUSED1: - ret -BootloaderAPU_UNUSED2: - ret -BootloaderAPU_UNUSED3: - ret -BootloaderAPU_UNUSED4: - ret -BootloaderAPU_UNUSED5: - ret +.section .apitable_trampolines, "ax" +.global BootloaderAPI_Trampolines +BootloaderAPI_Trampolines: + + BootloaderAPI_ErasePage_Trampoline: + jmp BootloaderAPI_ErasePage + BootloaderAPI_WritePage_Trampoline: + jmp BootloaderAPI_WritePage + BootloaderAPI_FillWord_Trampoline: + jmp BootloaderAPI_FillWord + BootloaderAPI_ReadSignature_Trampoline: + jmp BootloaderAPI_ReadSignature + BootloaderAPI_ReadFuse_Trampoline: + jmp BootloaderAPI_ReadFuse + BootloaderAPI_ReadLock_Trampoline: + jmp BootloaderAPI_ReadLock + BootloaderAPI_WriteLock_Trampoline: + jmp BootloaderAPI_WriteLock + BootloaderAPU_UNUSED1: + ret + BootloaderAPU_UNUSED2: + ret + BootloaderAPU_UNUSED3: + ret + BootloaderAPU_UNUSED4: + ret + BootloaderAPU_UNUSED5: + ret + + ; API function jump table -.org (96 - 32) +.section .apitable_jumptable, "ax" .global BootloaderAPI_JumpTable BootloaderAPI_JumpTable: + rjmp BootloaderAPI_ErasePage_Trampoline rjmp BootloaderAPI_WritePage_Trampoline rjmp BootloaderAPI_FillWord_Trampoline @@ -76,10 +79,13 @@ BootloaderAPI_JumpTable: rjmp BootloaderAPU_UNUSED4 ; UNUSED ENTRY 4 rjmp BootloaderAPU_UNUSED5 ; UNUSED ENTRY 5 + + ; Bootloader table signatures and information -.org (96 - 8) -BootloaderAPI_Signatures: +.section .apitable_signatures, "ax" .global BootloaderAPI_Signatures +BootloaderAPI_Signatures: + .long BOOT_START_ADDR ; Start address of the bootloader - .word 0xCDC1 ; Signature for the CDC class bootloader, V1 + .word 0xDFB1 ; Signature for the DFU class bootloader, V1 .word 0xDCFB ; Signature for a LUFA class bootloader diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index ef68e148c..af778c76f 100644 --- a/Bootloaders/CDC/BootloaderCDC.c +++ b/Bootloaders/CDC/BootloaderCDC.c @@ -61,7 +61,7 @@ static bool RunBootloader = true; * low when the application attempts to start via a watchdog reset, the bootloader will re-start. If set to the value * \ref MAGIC_BOOT_KEY the special init function \ref Application_Jump_Check() will force the application to start. */ -uint32_t MagicBootKey ATTR_NO_INIT; +uint16_t MagicBootKey ATTR_NO_INIT; /** Special startup routine to check if the bootloader was started via a watchdog reset, and if the magic application @@ -70,8 +70,29 @@ uint32_t MagicBootKey ATTR_NO_INIT; */ void Application_Jump_Check(void) { + bool JumpToApplication = false; + + #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)) + /* Disable JTAG debugging */ + JTAG_DISABLE(); + + /* Enable pull-up on the JTAG TCK pin so we can use it to select the mode */ + PORTF |= (1 << 4); + Delay_MS(10); + + /* If the TCK pin is not jumpered to ground, start the user application instead */ + JumpToApplication |= ((PINF & (1 << 4)) != 0); + + /* Re-enable JTAG debugging */ + JTAG_ENABLE(); + #endif + /* If the reset source was the bootloader and the key is correct, clear it and jump to the application */ if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY)) + JumpToApplication |= true; + + /* If a request has been made to jump to the user application, honor it */ + if (JumpToApplication) { /* Turn off the watchdog */ MCUSR &= ~(1< * * Supported USB Speeds: - * Full Speed Mode + * Low Speed Mode \n + * Full Speed Mode * * * diff --git a/Bootloaders/DFU/Descriptors.c b/Bootloaders/DFU/Descriptors.c index ff33b6b64..3a1a2e2b3 100644 --- a/Bootloaders/DFU/Descriptors.c +++ b/Bootloaders/DFU/Descriptors.c @@ -57,8 +57,8 @@ const USB_Descriptor_Device_t DeviceDescriptor = .ProductID = PRODUCT_ID_CODE, .ReleaseNumber = VERSION_BCD(00.00), - .ManufacturerStrIndex = NO_DESCRIPTOR, - .ProductStrIndex = 0x01, + .ManufacturerStrIndex = 0x01, + .ProductStrIndex = 0x02, .SerialNumStrIndex = NO_DESCRIPTOR, .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS @@ -126,6 +126,17 @@ const USB_Descriptor_String_t LanguageString = .UnicodeString = {LANGUAGE_ID_ENG} }; +/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable + * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +const USB_Descriptor_String_t PROGMEM ManufacturerString = +{ + .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String}, + + .UnicodeString = L"Dean Camera" +}; + /** Product descriptor string. This is a Unicode string containing the product's details in human readable form, * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. @@ -169,7 +180,12 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, Address = &LanguageString; Size = LanguageString.Header.Size; } - else + else if (DescriptorNumber == 0x01) + { + Address = &ManufacturerString; + Size = ManufacturerString.Header.Size; + } + else if (DescriptorNumber == 0x02) { Address = &ProductString; Size = ProductString.Header.Size; diff --git a/Bootloaders/DFU/makefile b/Bootloaders/DFU/makefile index 22ae1d67e..8a9a5adf7 100644 --- a/Bootloaders/DFU/makefile +++ b/Bootloaders/DFU/makefile @@ -9,20 +9,6 @@ # LUFA Project Makefile. # -------------------------------------- -# Starting byte address of the bootloader, as a byte address - computed via the formula -# BOOT_START = ((FLASH_SIZE_KB - BOOT_SECTION_SIZE_KB) * 1024) -# -# Note that the bootloader size and start address given in AVRStudio is in words and not -# bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC. -FLASH_SIZE_KB = 128 -BOOT_SECTION_SIZE_KB = 8 - -# Formulas used to calculate the starting address of the Bootloader section, and the User Application -# API jump table (for more information on the latter, see the bootloader documentation). These formulas -# should not need to be altered - modify the FLASH_SIZE_KB and BOOT_SECTION_KB values above instead. -BOOT_START = 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc) -BOOT_API_TABLESTART = 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc) - MCU = at90usb1287 ARCH = AVR8 BOARD = USBKEY @@ -31,16 +17,36 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = BootloaderDFU SRC = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S $(LUFA_SRC_USB) -LUFA_PATH = ../../LUFA/ -CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START) -LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START) -Wl,--section-start=.apitable=$(BOOT_API_TABLESTART) -Wl,--undefined=BootloaderAPI_JumpTable +LUFA_PATH = ../../LUFA +CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET) +LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS) + +# Flash size and bootloader section sizes of the target, in KB. These must +# match the target's total FLASH size and the bootloader size set in the +# device's fuses. +FLASH_SIZE_KB = 128 +BOOT_SECTION_SIZE_KB = 8 + +# Bootloader address calculation formulas (requires the "bc" unix utility) +# Do not modify these macros, but rather modify the depedant values above. +BOOT_START_OFFSET = 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc) +BOOT_SEC_OFFSET = 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - $(strip $(1)))" | bc) + +# Bootloader linker section flags for relocating the API table sections to +# known FLASH addresses - these should not normally be user-edited. +BOOT_SECTION_LD_FLAG = -Wl,--section-start=.apitable_$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=BootloaderAPI_$(strip $(2)) +BOOT_API_LD_FLAGS = $(call BOOT_SECTION_LD_FLAG, trampolines, Trampolines, 96) +BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, jumptable, JumpTable, 32) +BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, signatures, Signatures, 8) # Default target all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Bootloaders/HID/BootloaderHID.c b/Bootloaders/HID/BootloaderHID.c index acc351a30..c32dddc15 100644 --- a/Bootloaders/HID/BootloaderHID.c +++ b/Bootloaders/HID/BootloaderHID.c @@ -46,7 +46,7 @@ static bool RunBootloader = true; * low when the application attempts to start via a watchdog reset, the bootloader will re-start. If set to the value * \ref MAGIC_BOOT_KEY the special init function \ref Application_Jump_Check() will force the application to start. */ -uint32_t MagicBootKey ATTR_NO_INIT; +uint16_t MagicBootKey ATTR_NO_INIT; /** Special startup routine to check if the bootloader was started via a watchdog reset, and if the magic application diff --git a/Bootloaders/HID/BootloaderHID.h b/Bootloaders/HID/BootloaderHID.h index af2812a7d..e83aad33c 100644 --- a/Bootloaders/HID/BootloaderHID.h +++ b/Bootloaders/HID/BootloaderHID.h @@ -30,11 +30,11 @@ /** \file * - * Header file for TeensyHID.c. + * Header file for BootloaderHID.c. */ -#ifndef _TEENSYHID_H_ -#define _TEENSYHID_H_ +#ifndef _BOOTLOADERHID_H_ +#define _BOOTLOADERHID_H_ /* Includes: */ #include @@ -53,7 +53,7 @@ #define COMMAND_STARTAPPLICATION 0xFFFF /** Magic bootloader key to unlock forced application start mode. */ - #define MAGIC_BOOT_KEY 0xDC42CACA + #define MAGIC_BOOT_KEY 0xDC42 /* Function Prototypes: */ static void SetupHardware(void); diff --git a/Bootloaders/HID/makefile b/Bootloaders/HID/makefile index 9e33f7bfe..b6477f961 100644 --- a/Bootloaders/HID/makefile +++ b/Bootloaders/HID/makefile @@ -9,20 +9,6 @@ # LUFA Project Makefile. # -------------------------------------- -# Starting byte address of the bootloader, as a byte address - computed via the formula -# BOOT_START = ((FLASH_SIZE_KB - BOOT_SECTION_SIZE_KB) * 1024) -# -# Note that the bootloader size and start address given in AVRStudio is in words and not -# bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC. -FLASH_SIZE_KB = 128 -BOOT_SECTION_SIZE_KB = 8 - -# Formulas used to calculate the starting address of the Bootloader section, and the User Application -# API jump table (for more information on the latter, see the bootloader documentation). These formulas -# should not need to be altered - modify the FLASH_SIZE_KB and BOOT_SECTION_KB values above instead. -BOOT_START = 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc) -BOOT_API_TABLESTART = 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc) - MCU = at90usb1287 ARCH = AVR8 BOARD = USBKEY @@ -31,16 +17,29 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = BootloaderHID SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START) +LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) + +# Flash size and bootloader section sizes of the target, in KB. These must +# match the target's total FLASH size and the bootloader size set in the +# device's fuses. +FLASH_SIZE_KB := 128 +BOOT_SECTION_SIZE_KB := 8 + +# Bootloader address calculation formulas (requires the "bc" unix utility) +# Do not modify these macros, but rather modify the depedant values above. +BOOT_START_OFFSET = 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc) +BOOT_SEC_OFFSET = 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - $(strip $(1)))" | bc) # Default target all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Bootloaders/makefile b/Bootloaders/makefile index c9f494182..003069b9a 100644 --- a/Bootloaders/makefile +++ b/Bootloaders/makefile @@ -13,18 +13,34 @@ # custom LUFA library build options are reflected in the compiled # code. -all: - $(MAKE) -C CDC clean - $(MAKE) -C CDC all +PROJECT_DIRECTORIES := $(shell ls -d */) - $(MAKE) -C HID clean - $(MAKE) -C HID all +# This makefile is potentially infinitely recursive if something really bad +# happens when determining the set of project directories - hard-abort if +# more than 10 levels deep to avoid angry emails. +ifeq ($(MAKELEVEL), 10) + $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) +endif - $(MAKE) -C DFU clean - $(MAKE) -C DFU all +# Need to special-case building without a per-project object directory +ifeq ($(OBJDIR),) + # If no target specified, force "clean all" and disallow parallel build + ifeq ($(MAKECMDGOALS),) + MAKECMDGOALS := clean all + .NOTPARALLEL: + endif -%: - $(MAKE) -C CDC $@ - $(MAKE) -C DFU $@ - $(MAKE) -C HID $@ + # If one of the targets is to build, force "clean" beforehand and disallow parallel build + ifneq ($(findstring all, $(MAKECMDGOALS)),) + MAKECMDGOALS := clean $(MAKECMDGOALS) + .NOTPARALLEL: + endif +endif +%: $(PROJECT_DIRECTORIES) + @echo . > /dev/null + +$(PROJECT_DIRECTORIES): + @$(MAKE) -C $@ $(MAKECMDGOALS) + +.PHONY: $(PROJECT_DIRECTORIES) diff --git a/BuildTests/BoardDriverTest/BoardDeviceMap.cfg b/BuildTests/BoardDriverTest/BoardDeviceMap.cfg index 5ef6db233..2b80fa0c0 100644 --- a/BuildTests/BoardDriverTest/BoardDeviceMap.cfg +++ b/BuildTests/BoardDriverTest/BoardDeviceMap.cfg @@ -1,73 +1,73 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# -# -# ============================================================================= -# Board configuration map script, processed with the "BoardDriverTest" -# makefile. This script file maps the possible LUFA target BOARD makefile -# value in user projects to a specific architecture and device. This mapping is -# then used by the makefile to build all possible drivers for that board, to -# detect any missing or erroneous functions. To add a new board mapping, use -# the syntax: -# -# BOARD DEFINE = {ARCH} : {MCU} : -# -# And re-run the makefile. Note that each board may have only one target. -# ============================================================================= -# -# -BOARD_USER = avr8 : at90usb1287 : -BOARD_NONE = avr8 : at90usb1287 : -BOARD_USBKEY = avr8 : at90usb1287 : -BOARD_STK525 = avr8 : at90usb647 : -BOARD_STK526 = avr8 : at90usb162 : -BOARD_RZUSBSTICK = avr8 : at90usb1287 : -BOARD_ATAVRUSBRF01 = avr8 : at90usb1287 : -BOARD_BUMBLEB = avr8 : at90usb162 : -BOARD_XPLAIN = avr8 : at90usb1287 : -BOARD_XPLAIN_REV1 = avr8 : at90usb1287 : -BOARD_EVK527 = avr8 : atmega32u4 : -BOARD_TEENSY = avr8 : at90usb162 : -BOARD_USBTINYMKII = avr8 : at90usb162 : -BOARD_BENITO = avr8 : at90usb162 : -BOARD_JMDBU2 = avr8 : atmega32u2 : -BOARD_OLIMEX162 = avr8 : at90usb162 : -BOARD_UDIP = avr8 : atmega32u2 : -BOARD_BUI = avr8 : at90usb646 : -BOARD_UNO = avr8 : atmega8u2 : -BOARD_CULV3 = avr8 : atmega32u4 : -BOARD_BLACKCAT = avr8 : at90usb162 : -BOARD_MAXIMUS = avr8 : at90usb162 : -BOARD_MINIMUS = avr8 : atmega32u2 : -BOARD_ADAFRUITU4 = avr8 : atmega32u4 : -BOARD_MICROSIN162 = avr8 : atmega162 : -BOARD_USBFOO = avr8 : atmega162 : -BOARD_SPARKFUN8U2 = avr8 : atmega8u2 : -BOARD_EVK1101 = uc3 : uc3b0256 : -BOARD_TUL = avr8 : atmega32u4 : -BOARD_EVK1100 = uc3 : uc3a0512 : -BOARD_EVK1104 = uc3 : uc3a3256 : -BOARD_A3BU_XPLAINED = xmega : atxmega256a3bu : -BOARD_TEENSY2 = avr8 : at90usb646 : -BOARD_USB2AX = avr8 : atmega32u4 : -BOARD_USB2AX_V3 = avr8 : atmega32u4 : -BOARD_MICROPENDOUS_32U2 = avr8 : atmega32u2 : -BOARD_MICROPENDOUS_A = avr8 : at90usb1287 : -BOARD_MICROPENDOUS_1 = avr8 : at90usb162 : -BOARD_MICROPENDOUS_2 = avr8 : atmega32u4 : -BOARD_MICROPENDOUS_3 = avr8 : at90usb1287 : -BOARD_MICROPENDOUS_4 = avr8 : at90usb1287 : -BOARD_MICROPENDOUS_DIP = avr8 : at90usb1287 : -BOARD_MICROPENDOUS_REV1 = avr8 : at90usb1287 : -BOARD_MICROPENDOUS_REV2 = avr8 : at90usb1287 : -BOARD_B1_XPLAINED = xmega : atxmega128b1 : -BOARD_MULTIO = avr8 : at90usb162 : -BOARD_BIGMULTIO = avr8 : atmega32u4 : -BOARD_DUCE = avr8 : atmega32u2 : -BOARD_OLIMEX32U4 = avr8 : atmega32u4 : -BOARD_OLIMEXT32U4 = avr8 : atmega32u4 : +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# +# +# ============================================================================= +# Board configuration map script, processed with the "BoardDriverTest" +# makefile. This script file maps the possible LUFA target BOARD makefile +# value in user projects to a specific architecture and device. This mapping is +# then used by the makefile to build all possible drivers for that board, to +# detect any missing or erroneous functions. To add a new board mapping, use +# the syntax: +# +# BOARD DEFINE = {ARCH} : {MCU} : +# +# And re-run the makefile. Note that each board may have only one target. +# ============================================================================= +# +# +BOARD_USER = AVR8 : at90usb1287 : +BOARD_NONE = AVR8 : at90usb1287 : +BOARD_USBKEY = AVR8 : at90usb1287 : +BOARD_STK525 = AVR8 : at90usb647 : +BOARD_STK526 = AVR8 : at90usb162 : +BOARD_RZUSBSTICK = AVR8 : at90usb1287 : +BOARD_ATAVRUSBRF01 = AVR8 : at90usb1287 : +BOARD_BUMBLEB = AVR8 : at90usb162 : +BOARD_XPLAIN = AVR8 : at90usb1287 : +BOARD_XPLAIN_REV1 = AVR8 : at90usb1287 : +BOARD_EVK527 = AVR8 : atmega32u4 : +BOARD_TEENSY = AVR8 : at90usb162 : +BOARD_USBTINYMKII = AVR8 : at90usb162 : +BOARD_BENITO = AVR8 : at90usb162 : +BOARD_JMDBU2 = AVR8 : atmega32u2 : +BOARD_OLIMEX162 = AVR8 : at90usb162 : +BOARD_UDIP = AVR8 : atmega32u2 : +BOARD_BUI = AVR8 : at90usb646 : +BOARD_UNO = AVR8 : atmega8u2 : +BOARD_CULV3 = AVR8 : atmega32u4 : +BOARD_BLACKCAT = AVR8 : at90usb162 : +BOARD_MAXIMUS = AVR8 : at90usb162 : +BOARD_MINIMUS = AVR8 : atmega32u2 : +BOARD_ADAFRUITU4 = AVR8 : atmega32u4 : +BOARD_MICROSIN162 = AVR8 : atmega162 : +BOARD_USBFOO = AVR8 : atmega162 : +BOARD_SPARKFUN8U2 = AVR8 : atmega8u2 : +BOARD_EVK1101 = UC3 : uc3b0256 : +BOARD_TUL = AVR8 : atmega32u4 : +BOARD_EVK1100 = UC3 : uc3a0512 : +BOARD_EVK1104 = UC3 : uc3a3256 : +BOARD_A3BU_XPLAINED = XMEGA : atxmega256a3bu : +BOARD_TEENSY2 = AVR8 : at90usb646 : +BOARD_USB2AX = AVR8 : atmega32u4 : +BOARD_USB2AX_V3 = AVR8 : atmega32u4 : +BOARD_MICROPENDOUS_32U2 = AVR8 : atmega32u2 : +BOARD_MICROPENDOUS_A = AVR8 : at90usb1287 : +BOARD_MICROPENDOUS_1 = AVR8 : at90usb162 : +BOARD_MICROPENDOUS_2 = AVR8 : atmega32u4 : +BOARD_MICROPENDOUS_3 = AVR8 : at90usb1287 : +BOARD_MICROPENDOUS_4 = AVR8 : at90usb1287 : +BOARD_MICROPENDOUS_DIP = AVR8 : at90usb1287 : +BOARD_MICROPENDOUS_REV1 = AVR8 : at90usb1287 : +BOARD_MICROPENDOUS_REV2 = AVR8 : at90usb1287 : +BOARD_B1_XPLAINED = XMEGA : atxmega128b1 : +BOARD_MULTIO = AVR8 : at90usb162 : +BOARD_BIGMULTIO = AVR8 : atmega32u4 : +BOARD_DUCE = AVR8 : atmega32u2 : +BOARD_OLIMEX32U4 = AVR8 : atmega32u4 : +BOARD_OLIMEXT32U4 = AVR8 : atmega32u4 : # \ No newline at end of file diff --git a/BuildTests/BoardDriverTest/makefile b/BuildTests/BoardDriverTest/makefile index cb1ed62bc..c46a00c0b 100644 --- a/BuildTests/BoardDriverTest/makefile +++ b/BuildTests/BoardDriverTest/makefile @@ -1,63 +1,68 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -# Makefile for the board driver build test. This -# test attempts to build a dummy project with all -# possible board targets using their respective -# compiler. - -# Path to the root of the LUFA tree to scan -LUFA_ROOT_PATH = ../.. - - -all: begin makeboardlist testboards clean end - -begin: - @echo Executing build test "BoardDriverTest". - @echo - -end: - @echo Build test "BoardDriverTest" complete. - @echo - -makeboardlist: - @grep "BOARD_" $(LUFA_ROOT_PATH)/LUFA/Common/BoardTypes.h | cut -d'#' -f2 | cut -d' ' -f2 | grep "BOARD_" > BoardList.txt - -testboards: - @echo "buildtest:" > BuildMakefile - - @while read line; \ - do \ - build_cfg=`grep "$$line " BoardDeviceMap.cfg | grep -v "#" | cut -d'=' -f2- | sed 's/ //g'`; \ - \ - build_board=$$line; \ - build_arch=`echo $$build_cfg | cut -d':' -f1`; \ - build_mcu=`echo $$build_cfg | cut -d':' -f2`; \ - \ - if ( test -z "$$build_cfg" ); then \ - echo "No matching information set for board $$build_board"; \ - else \ - echo "Found board configuration for $$build_board - $$build_arch, $$build_mcu"; \ - \ - printf "\t@echo Building dummy project for $$build_board...\n" >> BuildMakefile; \ - printf "\tmake -s -f makefile.%s clean\n" $$build_arch >> BuildMakefile; \ - printf "\tmake -s -f makefile.%s MCU=%s BOARD=%s elf\n\n" $$build_arch $$build_mcu $$build_board >> BuildMakefile; \ - fi; \ - done < BoardList.txt - - $(MAKE) -f BuildMakefile buildtest - -clean: - rm -f BuildMakefile - rm -f BoardList.txt - $(MAKE) -f makefile.avr8 clean - $(MAKE) -f makefile.xmega clean - $(MAKE) -f makefile.uc3 clean - -%: - \ No newline at end of file +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +# Makefile for the board driver build test. This +# test attempts to build a dummy project with all +# possible board targets using their respective +# compiler. + +# Path to the LUFA library core +LUFA_PATH := ../../LUFA/ + +# Build test cannot be run with multiple parallel jobs +.NOTPARALLEL: + +all: begin makeboardlist testboards clean end + +begin: + @echo Executing build test "BoardDriverTest". + @echo + +end: + @echo Build test "BoardDriverTest" complete. + @echo + +makeboardlist: + @grep "BOARD_" $(patsubst %/,%,$(LUFA_PATH))/Common/BoardTypes.h | cut -d'#' -f2 | cut -d' ' -f2 | grep "BOARD_" > BoardList.txt + +testboards: + @echo "buildtest:" > BuildMakefile + + @while read line; \ + do \ + build_cfg=`grep "$$line " BoardDeviceMap.cfg | grep -v "#" | cut -d'=' -f2- | sed 's/ //g'`; \ + \ + build_board=$$line; \ + build_arch=`echo $$build_cfg | cut -d':' -f1`; \ + build_mcu=`echo $$build_cfg | cut -d':' -f2`; \ + \ + if ( test -z "$$build_cfg" ); then \ + echo "No matching information set for board $$build_board"; \ + else \ + echo "Found board configuration for $$build_board - $$build_arch, $$build_mcu"; \ + \ + printf "\t@echo Building dummy project for $$build_board...\n" >> BuildMakefile; \ + printf "\t$(MAKE) -f makefile.test clean elf MCU=%s ARCH=%s BOARD=%s\n\n" $$build_mcu $$build_arch $$build_board >> BuildMakefile; \ + fi; \ + done < BoardList.txt + + $(MAKE) -f BuildMakefile buildtest + +clean: + rm -f BuildMakefile + rm -f BoardList.txt + $(MAKE) -f makefile.test clean BOARD=NONE ARCH=AVR8 MCU=at90usb1287 + $(MAKE) -f makefile.test clean BOARD=NONE ARCH=XMEGA MCU=atxmega128a1u + $(MAKE) -f makefile.test clean BOARD=NONE ARCH=UC3 MCU=uc3a0256 + +%: + +.PHONY: all begin end makeboardlist testboards clean + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_core.mk diff --git a/BuildTests/BoardDriverTest/makefile.avr8 b/BuildTests/BoardDriverTest/makefile.avr8 deleted file mode 100644 index 8840cee81..000000000 --- a/BuildTests/BoardDriverTest/makefile.avr8 +++ /dev/null @@ -1,723 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make coff = Convert ELF to AVR COFF. -# -# make extcoff = Convert ELF to AVR Extended COFF. -# -# make program = Download the hex file to the device, using avrdude. -# Please customize the avrdude settings below first! -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make dfu-ee = Download the eeprom file to the device, using dfu-programmer -# (must have dfu-programmer installed). -# -# make flip-ee = Download the eeprom file to the device, using Atmel FLIP -# (must have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make debug = Start either simulavr or avarice as specified for debugging, -# with avr-gdb or avr-insight as the front end for debugging. -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = at90usb1287 - - -# Target architecture (see library "Board Types" documentation). -ARCH = AVR8 - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = NONE - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This will be an integer division of F_USB below, as it is sourced by -# F_USB after it has run through any CPU prescalers. Note that this value -# does not *change* the processor frequency - it should merely be updated to -# reflect the processor speed set externally so that the code can use accurate -# software delays. -F_CPU = 16000000 - - -# Input clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency (before any prescaling is performed) in Hz. This value may -# differ from F_CPU if prescaling is used on the latter, and is required as the -# raw input clock is fed directly to the PLL sections of the AVR for high speed -# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' -# at the end, this will be done automatically to create a 32-bit value in your -# source code. -# -# If no clock division is performed on the input clock inside the AVR (via the -# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. -F_USB = $(F_CPU) - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = Test - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ../.. - - -# LUFA library compile-time options and predefined tokens -LUFA_OPTS = - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = Test.c - - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = 1 - - -# Debugging format. -# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. -# AVR Studio 4.10 requires dwarf-2. -# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. -DEBUG = dwarf-2 - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=c99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += $(LUFA_OPTS) -#CPPDEFS += -D__STDC_LIMIT_MACROS -#CPPDEFS += -D__STDC_CONSTANT_MACROS - - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-inline-small-functions -CFLAGS += -fpack-struct -CFLAGS += -fshort-enums -CFLAGS += -fno-strict-aliasing -CFLAGS += -fno-split-wide-types -CFLAGS += -Wall -CFLAGS += -Wstrict-prototypes -#CFLAGS += -mshort-calls -#CFLAGS += -fno-unit-at-a-time -#CFLAGS += -Wundef -#CFLAGS += -Wunreachable-code -#CFLAGS += -Wsign-compare -#CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -fpack-struct -CPPFLAGS += -fshort-enums -CPPFLAGS += -fno-exceptions -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -#CPPFLAGS += -mshort-calls -#CPPFLAGS += -fno-unit-at-a-time -#CPPFLAGS += -Wstrict-prototypes -#CPPFLAGS += -Wunreachable-code -#CPPFLAGS += -Wsign-compare -#CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -#ASFLAGS += -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Library Options ---------------- -# Minimalistic printf version -PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min - -# Floating point printf version (requires MATH_LIB = -lm below) -PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt - -# If this is left blank, then it will use the Standard printf version. -PRINTF_LIB = -#PRINTF_LIB = $(PRINTF_LIB_MIN) -#PRINTF_LIB = $(PRINTF_LIB_FLOAT) - - -# Minimalistic scanf version -SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min - -# Floating point + %[ scanf version (requires MATH_LIB = -lm below) -SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt - -# If this is left blank, then it will use the Standard scanf version. -SCANF_LIB = -#SCANF_LIB = $(SCANF_LIB_MIN) -#SCANF_LIB = $(SCANF_LIB_FLOAT) - - -MATH_LIB = -lm - - -# List any extra directories to look for libraries here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = - - - -#---------------- External Memory Options ---------------- - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# used for variables (.data/.bss) and heap (malloc()). -#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# only used for heap (malloc()). -#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff - -EXTMEMOPTS = - - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -#LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--relax -LDFLAGS += -Wl,--gc-sections -LDFLAGS += $(EXTMEMOPTS) -LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) -LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) -#LDFLAGS += -T linker_script.x - - - -#---------------- Programming Options (avrdude) ---------------- - -# Programming hardware -# Type: avrdude -c ? -# to get a full listing. -# -AVRDUDE_PROGRAMMER = jtagmkII - -# com1 = serial port. Use lpt1 to connect to parallel port. -AVRDUDE_PORT = usb - -AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex -#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep - - -# Uncomment the following if you want avrdude's erase cycle counter. -# Note that this counter needs to be initialized first using -Yn, -# see avrdude manual. -#AVRDUDE_ERASE_COUNTER = -y - -# Uncomment the following if you do /not/ wish a verification to be -# performed after programming the device. -#AVRDUDE_NO_VERIFY = -V - -# Increase verbosity level. Please use this when submitting bug -# reports about avrdude. See -# to submit bug reports. -#AVRDUDE_VERBOSE = -v -v - -AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) -AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) -AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) - - - -#---------------- Debugging Options ---------------- - -# For simulavr only - target MCU frequency. -DEBUG_MFREQ = $(F_CPU) - -# Set the DEBUG_UI to either gdb or insight. -# DEBUG_UI = gdb -DEBUG_UI = insight - -# Set the debugging back-end to either avarice, simulavr. -DEBUG_BACKEND = avarice -#DEBUG_BACKEND = simulavr - -# GDB Init Filename. -GDBINIT_FILE = __avr_gdbinit - -# When using avarice settings for the JTAG -JTAG_DEV = /dev/com1 - -# Debugging port used to communicate between GDB / avarice / simulavr. -DEBUG_PORT = 4242 - -# Debugging host used to communicate between GDB / avarice / simulavr, normally -# just set to localhost unless doing some sort of crazy debugging when -# avarice is running on a different computer. -DEBUG_HOST = localhost - - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr-gcc -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AR = avr-ar rcs -NM = avr-nm -AVRDUDE = avrdude -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_EXTENDED_COFF = Converting to AVR Extended COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex eep lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -eep: $(TARGET).eep -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -program: $(TARGET).hex $(TARGET).eep - $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) - -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - -flip-ee: $(TARGET).hex $(TARGET).eep - $(COPY) $(TARGET).eep $(TARGET)eep.hex - batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase - batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - $(REMOVE) $(TARGET)eep.hex - -dfu-ee: $(TARGET).hex $(TARGET).eep - dfu-programmer $(MCU) eeprom-flash $(TARGET).eep - dfu-programmer $(MCU) reset - - -# Generate avr-gdb config/init file which does the following: -# define the reset signal, load the target file, connect to target, and set -# a breakpoint at main(). -gdb-config: - @$(REMOVE) $(GDBINIT_FILE) - @echo define reset >> $(GDBINIT_FILE) - @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) - @echo end >> $(GDBINIT_FILE) - @echo file $(TARGET).elf >> $(GDBINIT_FILE) - @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) -ifeq ($(DEBUG_BACKEND),simulavr) - @echo load >> $(GDBINIT_FILE) -endif - @echo break main >> $(GDBINIT_FILE) - -debug: gdb-config $(TARGET).elf -ifeq ($(DEBUG_BACKEND), avarice) - @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. - @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ - $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) - @$(WINSHELL) /c pause - -else - @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ - $(DEBUG_MFREQ) --port $(DEBUG_PORT) -endif - @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) - - - - -# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. -COFFCONVERT = $(OBJCOPY) --debugging -COFFCONVERT += --change-section-address .data-0x800000 -COFFCONVERT += --change-section-address .bss-0x800000 -COFFCONVERT += --change-section-address .noinit-0x800000 -COFFCONVERT += --change-section-address .eeprom-0x810000 - - - -coff: $(TARGET).elf - @echo - @echo $(MSG_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-avr $< $(TARGET).cof - - -extcoff: $(TARGET).elf - @echo - @echo $(MSG_EXTENDED_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof - - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@ - -%.eep: %.elf - @echo - @echo $(MSG_EEPROM) $@ - -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).eep - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex eep lss sym coff extcoff doxygen clean \ -clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ -debug gdb-config checksource diff --git a/BuildTests/BoardDriverTest/makefile.test b/BuildTests/BoardDriverTest/makefile.test new file mode 100644 index 000000000..234add1a3 --- /dev/null +++ b/BuildTests/BoardDriverTest/makefile.test @@ -0,0 +1,25 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# +# -------------------------------------- +# LUFA Project Makefile. +# -------------------------------------- + +MCU = +ARCH = +BOARD = +F_CPU = $(F_USB) +F_USB = 8000000 +OPTIMIZATION = 1 +TARGET = Test +SRC = $(TARGET).c +LUFA_PATH = ../../LUFA +CC_FLAGS = -Werror +DEBUG_LEVEL = 0 + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_build.mk \ No newline at end of file diff --git a/BuildTests/BoardDriverTest/makefile.uc3 b/BuildTests/BoardDriverTest/makefile.uc3 deleted file mode 100644 index be9e93156..000000000 --- a/BuildTests/BoardDriverTest/makefile.uc3 +++ /dev/null @@ -1,486 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = uc3a3256 - - -# Targeted chip architecture (see library "Architectures" documentation) -ARCH = UC3 - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = NONE - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This should be the frequency the system core runs at, after the system clock -# has been set up correctly and started. -F_CPU = 12000000 - - -# USB controller master clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency of the USB controller's clock generator in Hz. -# -# For the UC3 chips, this should be equal to 48MHz or 96MHz. -F_USB = 48000000 - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = Test - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ../.. - - -# LUFA library compile-time options and predefined tokens (add '-D' before each token) -LUFA_OPTS = - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = Test.c - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = 1 - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=gnu99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -CDEFS += -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += -DARCH=ARCH_$(ARCH) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += -DARCH=ARCH_$(ARCH) -CPPDEFS += $(LUFA_OPTS) - - -# Debugging level. -DEBUG = 3 - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-strict-aliasing -CFLAGS += -Wall -CFLAGS += -Wstrict-prototypes -CFLAGS += -masm-addr-pseudos -#CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -ffunction-sections -CPPFLAGS += -fno-strict-aliasing -CPPFLAGS += -fno-exceptions -CPPFLAGS += -masm-addr-pseudos -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -#CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -#ASFLAGS += -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -#LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--gc-sections --rodata-writable -LDFLAGS += -Wl,--direct-data -#LDFLAGS += -T linker_script.x - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr32-gcc -OBJCOPY = avr32-objcopy -OBJDUMP = avr32-objdump -SIZE = avr32-size -AR = avr32-ar rcs -NM = avr32-nm -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mpart=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mpart=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mpart=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex lss sym doxygen clean clean_list clean_doxygen \ -dfu flip checksource - diff --git a/BuildTests/BoardDriverTest/makefile.xmega b/BuildTests/BoardDriverTest/makefile.xmega deleted file mode 100644 index ef6dfe10a..000000000 --- a/BuildTests/BoardDriverTest/makefile.xmega +++ /dev/null @@ -1,705 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make coff = Convert ELF to AVR COFF. -# -# make extcoff = Convert ELF to AVR Extended COFF. -# -# make program = Download the hex file to the device, using avrdude. -# Please customize the avrdude settings below first! -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make dfu-ee = Download the eeprom file to the device, using dfu-programmer -# (must have dfu-programmer installed). -# -# make flip-ee = Download the eeprom file to the device, using Atmel FLIP -# (must have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make debug = Start either simulavr or avarice as specified for debugging, -# with avr-gdb or avr-insight as the front end for debugging. -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = atxmega128a1u - - -# Targeted chip architecture (see library "Architectures" documentation) -ARCH = XMEGA - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = NONE - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This should be the frequency the system core runs at, after the system clock -# has been set up correctly and started. -F_CPU = 24000000 - - -# USB controller master clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency of the USB controller's clock generator in Hz. -# -# For the XMEGA chips, this should be equal to a multiple of 6MHz for Low -# Speed USB mode, or a multiple of 48MHz for Full Speed USB mode. -F_USB = 48000000 - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = Test - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ../.. - - -# LUFA library compile-time options and predefined tokens -LUFA_OPTS = - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = Test.c - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = 1 - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=gnu99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -CDEFS += -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += -DARCH=ARCH_$(ARCH) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += -DARCH=ARCH_$(ARCH) -CPPDEFS += $(LUFA_OPTS) - - -# Debugging format. -# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. -# AVR Studio 4.10 requires dwarf-2. -# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. -DEBUG = dwarf-2 - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-inline-small-functions -CFLAGS += -fpack-struct -CFLAGS += -fshort-enums -CFLAGS += -fno-strict-aliasing -CFLAGS += -Wall -CFLAGS += -Wstrict-prototypes -#CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -fpack-struct -CPPFLAGS += -fshort-enums -CPPFLAGS += -ffunction-sections -CPPFLAGS += -fno-strict-aliasing -CPPFLAGS += -fno-exceptions -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -#CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -#ASFLAGS += -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Library Options ---------------- -# Minimalistic printf version -PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min - -# Floating point printf version (requires MATH_LIB = -lm below) -PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt - -# If this is left blank, then it will use the Standard printf version. -PRINTF_LIB = -#PRINTF_LIB = $(PRINTF_LIB_MIN) -#PRINTF_LIB = $(PRINTF_LIB_FLOAT) - - -# Minimalistic scanf version -SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min - -# Floating point + %[ scanf version (requires MATH_LIB = -lm below) -SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt - -# If this is left blank, then it will use the Standard scanf version. -SCANF_LIB = -#SCANF_LIB = $(SCANF_LIB_MIN) -#SCANF_LIB = $(SCANF_LIB_FLOAT) - - -MATH_LIB = -lm - - -# List any extra directories to look for libraries here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = - - - -#---------------- External Memory Options ---------------- - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# used for variables (.data/.bss) and heap (malloc()). -#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# only used for heap (malloc()). -#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff - -EXTMEMOPTS = - - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -#LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--relax -LDFLAGS += -Wl,--gc-sections -LDFLAGS += $(EXTMEMOPTS) -LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) -LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) -#LDFLAGS += -T linker_script.x - - - -#---------------- Programming Options (avrdude) ---------------- - -# Programming hardware -# Type: avrdude -c ? -# to get a full listing. -# -AVRDUDE_PROGRAMMER = jtagmkII - -# com1 = serial port. Use lpt1 to connect to parallel port. -AVRDUDE_PORT = usb - -AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex -#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep - - -# Uncomment the following if you want avrdude's erase cycle counter. -# Note that this counter needs to be initialized first using -Yn, -# see avrdude manual. -#AVRDUDE_ERASE_COUNTER = -y - -# Uncomment the following if you do /not/ wish a verification to be -# performed after programming the device. -#AVRDUDE_NO_VERIFY = -V - -# Increase verbosity level. Please use this when submitting bug -# reports about avrdude. See -# to submit bug reports. -#AVRDUDE_VERBOSE = -v -v - -AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) -AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) -AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) - - - -#---------------- Debugging Options ---------------- - -# For simulavr only - target MCU frequency. -DEBUG_MFREQ = $(F_CPU) - -# Set the DEBUG_UI to either gdb or insight. -# DEBUG_UI = gdb -DEBUG_UI = insight - -# Set the debugging back-end to either avarice, simulavr. -DEBUG_BACKEND = avarice -#DEBUG_BACKEND = simulavr - -# GDB Init Filename. -GDBINIT_FILE = __avr_gdbinit - -# When using avarice settings for the JTAG -JTAG_DEV = /dev/com1 - -# Debugging port used to communicate between GDB / avarice / simulavr. -DEBUG_PORT = 4242 - -# Debugging host used to communicate between GDB / avarice / simulavr, normally -# just set to localhost unless doing some sort of crazy debugging when -# avarice is running on a different computer. -DEBUG_HOST = localhost - - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr-gcc -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AR = avr-ar rcs -NM = avr-nm -AVRDUDE = avrdude -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_EXTENDED_COFF = Converting to AVR Extended COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex eep lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -eep: $(TARGET).eep -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -program: $(TARGET).hex $(TARGET).eep - $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) - -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - -flip-ee: $(TARGET).hex $(TARGET).eep - $(COPY) $(TARGET).eep $(TARGET)eep.hex - batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase - batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - $(REMOVE) $(TARGET)eep.hex - -dfu-ee: $(TARGET).hex $(TARGET).eep - dfu-programmer $(MCU) eeprom-flash $(TARGET).eep - dfu-programmer $(MCU) reset - - -# Generate avr-gdb config/init file which does the following: -# define the reset signal, load the target file, connect to target, and set -# a breakpoint at main(). -gdb-config: - @$(REMOVE) $(GDBINIT_FILE) - @echo define reset >> $(GDBINIT_FILE) - @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) - @echo end >> $(GDBINIT_FILE) - @echo file $(TARGET).elf >> $(GDBINIT_FILE) - @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) -ifeq ($(DEBUG_BACKEND),simulavr) - @echo load >> $(GDBINIT_FILE) -endif - @echo break main >> $(GDBINIT_FILE) - -debug: gdb-config $(TARGET).elf -ifeq ($(DEBUG_BACKEND), avarice) - @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. - @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ - $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) - @$(WINSHELL) /c pause - -else - @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ - $(DEBUG_MFREQ) --port $(DEBUG_PORT) -endif - @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) - - - - -# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. -COFFCONVERT = $(OBJCOPY) --debugging -COFFCONVERT += --change-section-address .data-0x800000 -COFFCONVERT += --change-section-address .bss-0x800000 -COFFCONVERT += --change-section-address .noinit-0x800000 -COFFCONVERT += --change-section-address .eeprom-0x810000 - - - -coff: $(TARGET).elf - @echo - @echo $(MSG_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-avr $< $(TARGET).cof - - -extcoff: $(TARGET).elf - @echo - @echo $(MSG_EXTENDED_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof - - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -%.eep: %.elf - @echo - @echo $(MSG_EEPROM) $@ - -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).eep - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex eep lss sym coff extcoff doxygen clean \ -clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ -debug gdb-config checksource diff --git a/BuildTests/BootloaderTest/BootloaderDeviceMap.cfg b/BuildTests/BootloaderTest/BootloaderDeviceMap.cfg index 082b8f508..614b6b564 100644 --- a/BuildTests/BootloaderTest/BootloaderDeviceMap.cfg +++ b/BuildTests/BootloaderTest/BootloaderDeviceMap.cfg @@ -1,63 +1,63 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# -# -# ============================================================================= -# Bootloader configuration map script, processed with the "BootloaderTest" -# makefile. This script file defines the targets for each LUFA bootloader, -# which are then built as part of the build test to ensure that there are no -# failures on all standard configurations. To add a new build target for a -# bootloader to this script, use the format: -# -# BOOTLOADER = {ARCH} : {MCU} : {BOARD} : {FLASH SIZE KB} : {BOOT SIZE KB} : -# -# And re-run the makefile. -# ============================================================================= -# -# -# ------------ CDC Bootloader ------------- -CDC = avr8 : at90usb1287 : NONE : 128 : 8 : -CDC = avr8 : at90usb647 : NONE : 64 : 4 : -CDC = avr8 : at90usb1286 : NONE : 128 : 8 : -CDC = avr8 : at90usb646 : NONE : 64 : 4 : -CDC = avr8 : atmega32u6 : NONE : 32 : 4 : -CDC = avr8 : atmega32u4 : NONE : 32 : 4 : -CDC = avr8 : atmega16u4 : NONE : 16 : 4 : -CDC = avr8 : atmega32u2 : NONE : 32 : 4 : -CDC = avr8 : atmega16u2 : NONE : 16 : 4 : -CDC = avr8 : atmega8u2 : NONE : 8 : 4 : -CDC = avr8 : at90usb162 : NONE : 16 : 4 : -CDC = avr8 : at90usb82 : NONE : 8 : 4 : -# -# ------------ DFU Bootloader ------------- -DFU = avr8 : at90usb1287 : NONE : 128 : 8 : -DFU = avr8 : at90usb647 : NONE : 64 : 4 : -DFU = avr8 : at90usb1286 : NONE : 128 : 8 : -DFU = avr8 : at90usb646 : NONE : 64 : 4 : -DFU = avr8 : atmega32u6 : NONE : 32 : 4 : -DFU = avr8 : atmega32u4 : NONE : 32 : 4 : -DFU = avr8 : atmega16u4 : NONE : 16 : 4 : -DFU = avr8 : atmega32u2 : NONE : 32 : 4 : -DFU = avr8 : atmega16u2 : NONE : 16 : 4 : -DFU = avr8 : atmega8u2 : NONE : 8 : 4 : -DFU = avr8 : at90usb162 : NONE : 16 : 4 : -DFU = avr8 : at90usb82 : NONE : 8 : 4 : -# -# ------------ HID Bootloader ------------- -HID = avr8 : at90usb1287 : NONE : 128 : 4 : -HID = avr8 : at90usb647 : NONE : 64 : 4 : -HID = avr8 : at90usb1286 : NONE : 128 : 4 : -HID = avr8 : at90usb646 : NONE : 64 : 4 : -HID = avr8 : atmega32u6 : NONE : 32 : 4 : -HID = avr8 : atmega32u4 : NONE : 32 : 4 : -HID = avr8 : atmega16u4 : NONE : 16 : 4 : -HID = avr8 : atmega32u2 : NONE : 32 : 2 : -HID = avr8 : atmega16u2 : NONE : 16 : 2 : -HID = avr8 : atmega8u2 : NONE : 8 : 2 : -HID = avr8 : at90usb162 : NONE : 16 : 2 : -HID = avr8 : at90usb82 : NONE : 8 : 2 : +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# +# +# ============================================================================= +# Bootloader configuration map script, processed with the "BootloaderTest" +# makefile. This script file defines the targets for each LUFA bootloader, +# which are then built as part of the build test to ensure that there are no +# failures on all standard configurations. To add a new build target for a +# bootloader to this script, use the format: +# +# BOOTLOADER = {ARCH} : {MCU} : {BOARD} : {FLASH SIZE KB} : {BOOT SIZE KB} : +# +# And re-run the makefile. +# ============================================================================= +# +# +# ------------ CDC Bootloader ------------- +CDC = AVR8 : at90usb1287 : NONE : 128 : 8 : +CDC = AVR8 : at90usb647 : NONE : 64 : 4 : +CDC = AVR8 : at90usb1286 : NONE : 128 : 8 : +CDC = AVR8 : at90usb646 : NONE : 64 : 4 : +CDC = AVR8 : atmega32u6 : NONE : 32 : 4 : +CDC = AVR8 : atmega32u4 : NONE : 32 : 4 : +CDC = AVR8 : atmega16u4 : NONE : 16 : 4 : +CDC = AVR8 : atmega32u2 : NONE : 32 : 4 : +CDC = AVR8 : atmega16u2 : NONE : 16 : 4 : +CDC = AVR8 : atmega8u2 : NONE : 8 : 4 : +CDC = AVR8 : at90usb162 : NONE : 16 : 4 : +CDC = AVR8 : at90usb82 : NONE : 8 : 4 : +# +# ------------ DFU Bootloader ------------- +DFU = AVR8 : at90usb1287 : NONE : 128 : 8 : +DFU = AVR8 : at90usb647 : NONE : 64 : 4 : +DFU = AVR8 : at90usb1286 : NONE : 128 : 8 : +DFU = AVR8 : at90usb646 : NONE : 64 : 4 : +DFU = AVR8 : atmega32u6 : NONE : 32 : 4 : +DFU = AVR8 : atmega32u4 : NONE : 32 : 4 : +DFU = AVR8 : atmega16u4 : NONE : 16 : 4 : +DFU = AVR8 : atmega32u2 : NONE : 32 : 4 : +DFU = AVR8 : atmega16u2 : NONE : 16 : 4 : +DFU = AVR8 : atmega8u2 : NONE : 8 : 4 : +DFU = AVR8 : at90usb162 : NONE : 16 : 4 : +DFU = AVR8 : at90usb82 : NONE : 8 : 4 : +# +# ------------ HID Bootloader ------------- +HID = AVR8 : at90usb1287 : NONE : 128 : 4 : +HID = AVR8 : at90usb647 : NONE : 64 : 4 : +HID = AVR8 : at90usb1286 : NONE : 128 : 4 : +HID = AVR8 : at90usb646 : NONE : 64 : 4 : +HID = AVR8 : atmega32u6 : NONE : 32 : 4 : +HID = AVR8 : atmega32u4 : NONE : 32 : 4 : +HID = AVR8 : atmega16u4 : NONE : 16 : 4 : +HID = AVR8 : atmega32u2 : NONE : 32 : 2 : +HID = AVR8 : atmega16u2 : NONE : 16 : 2 : +HID = AVR8 : atmega8u2 : NONE : 8 : 2 : +HID = AVR8 : at90usb162 : NONE : 16 : 2 : +HID = AVR8 : at90usb82 : NONE : 8 : 2 : # \ No newline at end of file diff --git a/BuildTests/BootloaderTest/makefile b/BuildTests/BootloaderTest/makefile index 71fa21a4b..e3f60d77a 100644 --- a/BuildTests/BootloaderTest/makefile +++ b/BuildTests/BootloaderTest/makefile @@ -1,58 +1,63 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -# Makefile for the bootloader build test. This -# test attempts to build all the bootloaders -# with all supported device configurations. - -# Path to the root of the LUFA tree to scan -LUFA_ROOT_PATH = ../.. - - -all: begin testbootloaders clean end - -begin: - @echo Executing build test "BootloaderTest". - @echo - -end: - @echo Build test "BootloaderTest" complete. - @echo - -testbootloaders: - @echo "buildtest:" > BuildMakefile - - @while read line; \ - do \ - build_cfg=`echo $$line | grep -v "#" | sed 's/ //g'`; \ - \ - if ( test -n "$$build_cfg" ); then \ - build_bootloader=`echo $$build_cfg | cut -d'=' -f1`; \ - build_cfg=`echo $$build_cfg | cut -d'=' -f2-`; \ - \ - build_arch=`echo $$build_cfg | cut -d':' -f1`; \ - build_mcu=`echo $$build_cfg | cut -d':' -f2`; \ - build_board=`echo $$build_cfg | cut -d':' -f3`; \ - build_flashsize=`echo $$build_cfg | cut -d':' -f4`; \ - build_bootsize=`echo $$build_cfg | cut -d':' -f5`; \ - \ - printf "Found bootloader configuration for bootloader '%s' (FLASH: %3s KB | BOOT: %3s KB | MCU: %12s / %4s)\n" $$build_bootloader $$build_flashsize $$build_bootsize $$build_mcu $$build_arch; \ - \ - printf "\t@echo Building bootloader %s - %s - FLASH: %s KB, BOOT: %s KB\n" $$build_bootloader $$build_mcu $$build_flashsize $$build_bootsize >> BuildMakefile; \ - printf "\tmake -s -C $(LUFA_ROOT_PATH)/Bootloaders/%s/ clean\n" $$build_bootloader >> BuildMakefile; \ - printf "\tmake -s -C $(LUFA_ROOT_PATH)/Bootloaders/%s/ MCU=%s BOARD=%s FLASH_SIZE_KB=%s BOOT_SECTION_SIZE_KB=%s elf\n\n" $$build_bootloader $$build_mcu $$build_board $$build_flashsize $$build_bootsize >> BuildMakefile; \ - fi; \ - done < BootloaderDeviceMap.cfg - - $(MAKE) -f BuildMakefile buildtest - -clean: - rm -f BuildMakefile - -%: - \ No newline at end of file +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +# Makefile for the bootloader build test. This +# test attempts to build all the bootloaders +# with all supported device configurations. + +# Path to the LUFA library core +LUFA_PATH := ../../LUFA/ + +# Build test cannot be run with multiple parallel jobs +.NOTPARALLEL: + +all: begin testbootloaders clean end + +begin: + @echo Executing build test "BootloaderTest". + @echo + +end: + @echo Build test "BootloaderTest" complete. + @echo + +testbootloaders: + @echo "buildtest:" > BuildMakefile + + @while read line; \ + do \ + build_cfg=`echo $$line | grep -v "#" | sed 's/ //g'`; \ + \ + if ( test -n "$$build_cfg" ); then \ + build_bootloader=`echo $$build_cfg | cut -d'=' -f1`; \ + build_cfg=`echo $$build_cfg | cut -d'=' -f2-`; \ + \ + build_arch=`echo $$build_cfg | cut -d':' -f1`; \ + build_mcu=`echo $$build_cfg | cut -d':' -f2`; \ + build_board=`echo $$build_cfg | cut -d':' -f3`; \ + build_flashsize=`echo $$build_cfg | cut -d':' -f4`; \ + build_bootsize=`echo $$build_cfg | cut -d':' -f5`; \ + \ + printf "Found '%s' bootloader configuration (FLASH: %3s KB | BOOT: %3s KB | MCU: %12s / %4s)\n" $$build_bootloader $$build_flashsize $$build_bootsize $$build_mcu $$build_arch; \ + \ + printf "\t@echo Building bootloader %s - %s - FLASH: %s KB, BOOT: %s KB\n" $$build_bootloader $$build_mcu $$build_flashsize $$build_bootsize >> BuildMakefile; \ + printf "\t$(MAKE) -C $(patsubst %/,%,$(LUFA_PATH))/../Bootloaders/%s/ clean elf ARCH=%s MCU=%s BOARD=%s FLASH_SIZE_KB=%s BOOT_SECTION_SIZE_KB=%s DEBUG_LEVEL=0\n\n" $$build_bootloader $$build_arch $$build_mcu $$build_board $$build_flashsize $$build_bootsize >> BuildMakefile; \ + fi; \ + done < BootloaderDeviceMap.cfg + + $(MAKE) -f BuildMakefile buildtest + +clean: + rm -f BuildMakefile + +%: + +.PHONY: all begin end testbootloaders clean + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_core.mk diff --git a/BuildTests/ModuleTest/Dummy.S b/BuildTests/ModuleTest/Dummy.S index bc13b31eb..659d144cb 100644 --- a/BuildTests/ModuleTest/Dummy.S +++ b/BuildTests/ModuleTest/Dummy.S @@ -1,41 +1,41 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -.section .text - - -# Mandatory entry point for successful compilation and link -.global main -main: - - -# Mandatory callback needed for base compile of the USB driver -.global CALLBACK_USB_GetDescriptor -CALLBACK_USB_GetDescriptor: +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +.section .text + + +# Mandatory entry point for successful compilation and link +.global main +main: + + +# Mandatory callback needed for base compile of the USB driver +.global CALLBACK_USB_GetDescriptor +CALLBACK_USB_GetDescriptor: diff --git a/BuildTests/ModuleTest/Modules.h b/BuildTests/ModuleTest/Modules.h index 00f7b8913..9dd7c4638 100644 --- a/BuildTests/ModuleTest/Modules.h +++ b/BuildTests/ModuleTest/Modules.h @@ -1,58 +1,58 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include - -#include -#include -#include - -#if (ARCH == ARCH_AVR8) - #if defined(TWCR) - #include - #endif - - #if defined(ADC) - #include - #endif - - #include - #include - #include -#elif (ARCH == ARCH_XMEGA) - #include - #include - #include - - #include -#elif (ARCH == ARCH_UC3) - #include - #include +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +#include + +#include +#include +#include + +#if (ARCH == ARCH_AVR8) + #if defined(TWCR) + #include + #endif + + #if defined(ADC) + #include + #endif + + #include + #include + #include +#elif (ARCH == ARCH_XMEGA) + #include + #include + #include + + #include +#elif (ARCH == ARCH_UC3) + #include + #include #endif \ No newline at end of file diff --git a/BuildTests/ModuleTest/Test_C.c b/BuildTests/ModuleTest/Test_C.c index 6cbf8fac5..98c17c3fd 100644 --- a/BuildTests/ModuleTest/Test_C.c +++ b/BuildTests/ModuleTest/Test_C.c @@ -1,31 +1,31 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + #include "Modules.h" \ No newline at end of file diff --git a/BuildTests/ModuleTest/Test_CPP.cpp b/BuildTests/ModuleTest/Test_CPP.cpp index 6cbf8fac5..98c17c3fd 100644 --- a/BuildTests/ModuleTest/Test_CPP.cpp +++ b/BuildTests/ModuleTest/Test_CPP.cpp @@ -1,31 +1,31 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + #include "Modules.h" \ No newline at end of file diff --git a/BuildTests/ModuleTest/makefile b/BuildTests/ModuleTest/makefile index 6811e1a2f..738152eab 100644 --- a/BuildTests/ModuleTest/makefile +++ b/BuildTests/ModuleTest/makefile @@ -1,57 +1,66 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -# Makefile for the module build test. This test -# attempts to build as many modules as possible -# under all supported architectures, and include -# all module headers in a simple C and C++ -# application. - - -# List of device families per architecture, one device per architecture sub-family -AVR8_FAMILIES = at90usb1287 at90usb1286 atmega16u4 atmega16u2 at90usb162 -XMEGA_FAMILIES = atxmega128a1u atxmega128a3u atxmega256a3bu atxmega128a4u atxmega128b1 atxmega128b3 atxmega128c3 atxmega32c4 -UC3_FAMILIES = uc3a0256 uc3a1256 uc3a3256 uc3a4256 uc3b0256 uc3b1256 - -# List of all device families, with a family postfix -DEVICE_FAMILIES = $(AVR8_FAMILIES:%=%.avr8) $(XMEGA_FAMILIES:%=%.xmega) $(UC3_FAMILIES:%=%.uc3) - - -all: begin $(DEVICE_FAMILIES) clean end - -arch_avr8: begin $(AVR8_FAMILIES:%=%.avr8) end -arch_xmega: begin $(XMEGA_FAMILIES:%=%.xmega) end -arch_uc3: begin $(UC3_FAMILIES:%=%.uc3) end - -begin: - @echo Executing build test "ModuleTest". - @echo - -end: - @echo Build test "ModuleTest" complete. - @echo - -%.avr8: - $(MAKE) -s -f makefile.avr8 clean - $(MAKE) -s -f makefile.avr8 all MCU=$(@:%.avr8=%) elf - -%.xmega: - $(MAKE) -s -f makefile.xmega clean - $(MAKE) -s -f makefile.xmega all MCU=$(@:%.xmega=%) elf - -%.uc3: - $(MAKE) -s -f makefile.uc3 clean - $(MAKE) -s -f makefile.uc3 all MCU=$(@:%.uc3=%) elf - -clean: - $(MAKE) -s -f makefile.avr8 clean - $(MAKE) -s -f makefile.xmega clean - $(MAKE) -s -f makefile.uc3 clean - -%: - \ No newline at end of file +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +# Makefile for the module build test. This test +# attempts to build as many modules as possible +# under all supported architectures, and include +# all module headers in a simple C and C++ +# application. + +# Path to the LUFA library core +LUFA_PATH := ../../LUFA/ + +# Build test cannot be run with multiple parallel jobs +.NOTPARALLEL: + +# List of device families per architecture, one device per architecture sub-family +AVR8_FAMILIES := at90usb1287 at90usb1286 atmega16u4 atmega16u2 at90usb162 +XMEGA_FAMILIES := atxmega128a1u atxmega128a3u atxmega256a3bu atxmega128a4u atxmega128b1 atxmega128b3 atxmega128c3 atxmega32c4 +UC3_FAMILIES := uc3a0256 uc3a1256 uc3a3256 uc3a4256 uc3b0256 uc3b1256 + +# List of all device families, with a family postfix +DEVICE_FAMILIES := $(AVR8_FAMILIES:%=%.avr8) $(XMEGA_FAMILIES:%=%.xmega) $(UC3_FAMILIES:%=%.uc3) + + +all: begin $(DEVICE_FAMILIES) clean end + +arch_avr8: begin $(AVR8_FAMILIES:%=%.avr8) end +arch_xmega: begin $(XMEGA_FAMILIES:%=%.xmega) end +arch_uc3: begin $(UC3_FAMILIES:%=%.uc3) end + +begin: + @echo Executing build test "ModuleTest". + @echo + +end: + @echo Build test "ModuleTest" complete. + @echo + +%.avr8: + @echo Building ModuleTest for ARCH=AVR8 MCU=$(@:%.avr8=%)... + $(MAKE) -f makefile.test clean elf ARCH=AVR8 MCU=$(@:%.avr8=%) + +%.xmega: + @echo Building ModuleTest for ARCH=XMEGA MCU=$(@:%.xmega=%)... + $(MAKE) -f makefile.test clean elf ARCH=XMEGA MCU=$(@:%.xmega=%) + +%.uc3: + @echo Building ModuleTest for ARCH=UC3 MCU=$(@:%.uc3=%)... + $(MAKE) -f makefile.test clean elf ARCH=UC3 MCU=$(@:%.uc3=%) + +clean: + $(MAKE) -f makefile.test clean ARCH=AVR8 MCU=$(firstword $(AVR8_FAMILIES)) + $(MAKE) -f makefile.test clean ARCH=XMEGA MCU=$(firstword $(XMEGA_FAMILIES)) + $(MAKE) -f makefile.test clean ARCH=UC3 MCU=$(firstword $(UC3_FAMILIES)) + +%: + +.PHONY: all arch_avr8 arch_xmega arch_uc3 begin end + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_core.mk diff --git a/BuildTests/ModuleTest/makefile.avr8 b/BuildTests/ModuleTest/makefile.avr8 deleted file mode 100644 index 867320945..000000000 --- a/BuildTests/ModuleTest/makefile.avr8 +++ /dev/null @@ -1,742 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make coff = Convert ELF to AVR COFF. -# -# make extcoff = Convert ELF to AVR Extended COFF. -# -# make program = Download the hex file to the device, using avrdude. -# Please customize the avrdude settings below first! -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make dfu-ee = Download the eeprom file to the device, using dfu-programmer -# (must have dfu-programmer installed). -# -# make flip-ee = Download the eeprom file to the device, using Atmel FLIP -# (must have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make debug = Start either simulavr or avarice as specified for debugging, -# with avr-gdb or avr-insight as the front end for debugging. -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = at90usb1287 - - -# Target architecture (see library "Board Types" documentation). -ARCH = AVR8 - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = NONE - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This will be an integer division of F_USB below, as it is sourced by -# F_USB after it has run through any CPU prescalers. Note that this value -# does not *change* the processor frequency - it should merely be updated to -# reflect the processor speed set externally so that the code can use accurate -# software delays. -F_CPU = 16000000 - - -# Input clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency (before any prescaling is performed) in Hz. This value may -# differ from F_CPU if prescaling is used on the latter, and is required as the -# raw input clock is fed directly to the PLL sections of the AVR for high speed -# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' -# at the end, this will be done automatically to create a 32-bit value in your -# source code. -# -# If no clock division is performed on the input clock inside the AVR (via the -# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. -F_USB = $(F_CPU) - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = Test - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ../.. - - -# LUFA library compile-time options and predefined tokens -LUFA_OPTS = - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = Test_C.c \ - $(LUFA_SRC_USB) \ - $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_TEMPERATURE) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_TWI) \ - - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = Test_CPP.cpp - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = Dummy.S - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = 1 - - -# Debugging format. -# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. -# AVR Studio 4.10 requires dwarf-2. -# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. -DEBUG = dwarf-2 - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=c99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += $(LUFA_OPTS) -#CPPDEFS += -D__STDC_LIMIT_MACROS -#CPPDEFS += -D__STDC_CONSTANT_MACROS - - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-inline-small-functions -CFLAGS += -fpack-struct -CFLAGS += -fshort-enums -CFLAGS += -fno-strict-aliasing -CFLAGS += -fno-split-wide-types -#CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) -CFLAGS += -Werror -CFLAGS += -Wall -CFLAGS += -Wextra -CFLAGS += -Wstrict-prototypes -CFLAGS += -Wformat=2 -CFLAGS += -Winit-self -CFLAGS += -Wswitch-enum -CFLAGS += -Wunused -CFLAGS += -Wundef -CFLAGS += -Wpointer-arith -CFLAGS += -Wcast-align -CFLAGS += -Wwrite-strings -CFLAGS += -Wlogical-op -CFLAGS += -Wmissing-parameter-type -CFLAGS += -Wmissing-declarations -CFLAGS += -Wmissing-field-initializers -CFLAGS += -Wmissing-format-attribute -CFLAGS += -Wredundant-decls -CFLAGS += -Wnested-externs -CFLAGS += -Woverlength-strings -#CFLAGS += -Wswitch-default -#CFLAGS += -Wc++-compat -#CFLAGS += -Wcast-qual -#CFLAGS += -Wconversion -#CFLAGS += -Wjump-misses-init -#CFLAGS += -pedantic - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -fpack-struct -CPPFLAGS += -fshort-enums -CPPFLAGS += -fno-exceptions -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -#CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -#ASFLAGS += -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Library Options ---------------- -# Minimalistic printf version -PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min - -# Floating point printf version (requires MATH_LIB = -lm below) -PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt - -# If this is left blank, then it will use the Standard printf version. -PRINTF_LIB = -#PRINTF_LIB = $(PRINTF_LIB_MIN) -#PRINTF_LIB = $(PRINTF_LIB_FLOAT) - - -# Minimalistic scanf version -SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min - -# Floating point + %[ scanf version (requires MATH_LIB = -lm below) -SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt - -# If this is left blank, then it will use the Standard scanf version. -SCANF_LIB = -#SCANF_LIB = $(SCANF_LIB_MIN) -#SCANF_LIB = $(SCANF_LIB_FLOAT) - - -MATH_LIB = -lm - - -# List any extra directories to look for libraries here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = - - - -#---------------- External Memory Options ---------------- - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# used for variables (.data/.bss) and heap (malloc()). -#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# only used for heap (malloc()). -#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff - -EXTMEMOPTS = - - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -#LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--relax -LDFLAGS += -Wl,--gc-sections -LDFLAGS += $(EXTMEMOPTS) -LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) -LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) -#LDFLAGS += -T linker_script.x - - - -#---------------- Programming Options (avrdude) ---------------- - -# Programming hardware -# Type: avrdude -c ? -# to get a full listing. -# -AVRDUDE_PROGRAMMER = jtagmkII - -# com1 = serial port. Use lpt1 to connect to parallel port. -AVRDUDE_PORT = usb - -AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex -#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep - - -# Uncomment the following if you want avrdude's erase cycle counter. -# Note that this counter needs to be initialized first using -Yn, -# see avrdude manual. -#AVRDUDE_ERASE_COUNTER = -y - -# Uncomment the following if you do /not/ wish a verification to be -# performed after programming the device. -#AVRDUDE_NO_VERIFY = -V - -# Increase verbosity level. Please use this when submitting bug -# reports about avrdude. See -# to submit bug reports. -#AVRDUDE_VERBOSE = -v -v - -AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) -AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) -AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) - - - -#---------------- Debugging Options ---------------- - -# For simulavr only - target MCU frequency. -DEBUG_MFREQ = $(F_CPU) - -# Set the DEBUG_UI to either gdb or insight. -# DEBUG_UI = gdb -DEBUG_UI = insight - -# Set the debugging back-end to either avarice, simulavr. -DEBUG_BACKEND = avarice -#DEBUG_BACKEND = simulavr - -# GDB Init Filename. -GDBINIT_FILE = __avr_gdbinit - -# When using avarice settings for the JTAG -JTAG_DEV = /dev/com1 - -# Debugging port used to communicate between GDB / avarice / simulavr. -DEBUG_PORT = 4242 - -# Debugging host used to communicate between GDB / avarice / simulavr, normally -# just set to localhost unless doing some sort of crazy debugging when -# avarice is running on a different computer. -DEBUG_HOST = localhost - - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr-gcc -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AR = avr-ar rcs -NM = avr-nm -AVRDUDE = avrdude -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_EXTENDED_COFF = Converting to AVR Extended COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex eep lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -eep: $(TARGET).eep -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -program: $(TARGET).hex $(TARGET).eep - $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) - -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - -flip-ee: $(TARGET).hex $(TARGET).eep - $(COPY) $(TARGET).eep $(TARGET)eep.hex - batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase - batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - $(REMOVE) $(TARGET)eep.hex - -dfu-ee: $(TARGET).hex $(TARGET).eep - dfu-programmer $(MCU) eeprom-flash $(TARGET).eep - dfu-programmer $(MCU) reset - - -# Generate avr-gdb config/init file which does the following: -# define the reset signal, load the target file, connect to target, and set -# a breakpoint at main(). -gdb-config: - @$(REMOVE) $(GDBINIT_FILE) - @echo define reset >> $(GDBINIT_FILE) - @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) - @echo end >> $(GDBINIT_FILE) - @echo file $(TARGET).elf >> $(GDBINIT_FILE) - @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) -ifeq ($(DEBUG_BACKEND),simulavr) - @echo load >> $(GDBINIT_FILE) -endif - @echo break main >> $(GDBINIT_FILE) - -debug: gdb-config $(TARGET).elf -ifeq ($(DEBUG_BACKEND), avarice) - @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. - @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ - $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) - @$(WINSHELL) /c pause - -else - @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ - $(DEBUG_MFREQ) --port $(DEBUG_PORT) -endif - @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) - - - - -# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. -COFFCONVERT = $(OBJCOPY) --debugging -COFFCONVERT += --change-section-address .data-0x800000 -COFFCONVERT += --change-section-address .bss-0x800000 -COFFCONVERT += --change-section-address .noinit-0x800000 -COFFCONVERT += --change-section-address .eeprom-0x810000 - - - -coff: $(TARGET).elf - @echo - @echo $(MSG_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-avr $< $(TARGET).cof - - -extcoff: $(TARGET).elf - @echo - @echo $(MSG_EXTENDED_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof - - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@ - -%.eep: %.elf - @echo - @echo $(MSG_EEPROM) $@ - -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).eep - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex eep lss sym coff extcoff doxygen clean \ -clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ -debug gdb-config checksource diff --git a/BuildTests/ModuleTest/makefile.test b/BuildTests/ModuleTest/makefile.test new file mode 100644 index 000000000..b01998f4b --- /dev/null +++ b/BuildTests/ModuleTest/makefile.test @@ -0,0 +1,66 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# +# -------------------------------------- +# LUFA Project Makefile. +# -------------------------------------- + +MCU = +ARCH = +BOARD = NONE +F_CPU = $(F_USB) +OPTIMIZATION = 1 +TARGET = Test +SRC = $(TARGET)_C.c $(TARGET)_CPP.cpp Dummy.S $(LUFA_SRC_USB) +LUFA_PATH = ../../LUFA +DEBUG_LEVEL = 0 + +ifeq ($(ARCH), AVR8) +F_USB = 8000000 +else ifeq ($(ARCH), XMEGA) +F_USB = 48000000 +else ifeq ($(ARCH), UC3) +F_USB = 48000000 +endif + +# Generic C/C++ compiler flags +CC_FLAGS = -Wextra +CC_FLAGS += -Werror +CC_FLAGS += -Wformat=2 +CC_FLAGS += -Winit-self +CC_FLAGS += -Wswitch-enum +CC_FLAGS += -Wunused +CC_FLAGS += -Wundef +CC_FLAGS += -Wpointer-arith +CC_FLAGS += -Wcast-align +CC_FLAGS += -Wwrite-strings +CC_FLAGS += -Wlogical-op +CC_FLAGS += -Wmissing-declarations +CC_FLAGS += -Wmissing-field-initializers +CC_FLAGS += -Wmissing-format-attribute +CC_FLAGS += -Woverlength-strings + +# Only enable rendundant declaration warnings for AVR8 target (FIXME) +ifeq ($(ARCH), AVR8) +CC_FLAGS += -Wredundant-decls +endif + +# C compiler only flags +C_FLAGS += -Wmissing-parameter-type +C_FLAGS += -Wnested-externs + +# Potential additional warnings to enable in the future (FIXME) +#CC_FLAGS += -Wswitch-default +#CC_FLAGS += -Wc++-compat +#CC_FLAGS += -Wcast-qual +#CC_FLAGS += -Wconversion +#CC_FLAGS += -Wjump-misses-init +#CC_FLAGS += -pedantic + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk \ No newline at end of file diff --git a/BuildTests/ModuleTest/makefile.uc3 b/BuildTests/ModuleTest/makefile.uc3 deleted file mode 100644 index 5628748ee..000000000 --- a/BuildTests/ModuleTest/makefile.uc3 +++ /dev/null @@ -1,513 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = uc3a3256 - - -# Targeted chip architecture (see library "Architectures" documentation) -ARCH = UC3 - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = NONE - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This should be the frequency the system core runs at, after the system clock -# has been set up correctly and started. -F_CPU = 12000000 - - -# USB controller master clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency of the USB controller's clock generator in Hz. -# -# For the UC3 chips, this should be equal to 48MHz or 96MHz. -F_USB = 48000000 - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = Test - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ../.. - - -# LUFA library compile-time options and predefined tokens (add '-D' before each token) -LUFA_OPTS = - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = Test_C.c \ - $(LUFA_SRC_USB) \ - $(LUFA_SRC_USBCLASS) - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = Test_CPP.cpp - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = Dummy.S \ - $(LUFA_PATH)/LUFA/Platform/UC3/Exception.S - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = 1 - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=gnu99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -CDEFS += -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += -DARCH=ARCH_$(ARCH) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += -DARCH=ARCH_$(ARCH) -CPPDEFS += $(LUFA_OPTS) - - -# Debugging level. -DEBUG = 3 - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-strict-aliasing -CFLAGS += -masm-addr-pseudos -#CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) -CFLAGS += -Werror -CFLAGS += -Wall -CFLAGS += -Wextra -CFLAGS += -Wstrict-prototypes -CFLAGS += -Wformat=2 -CFLAGS += -Winit-self -CFLAGS += -Wswitch-enum -CFLAGS += -Wunused -CFLAGS += -Wundef -CFLAGS += -Wpointer-arith -CFLAGS += -Wcast-align -CFLAGS += -Wwrite-strings -CFLAGS += -Wlogical-op -CFLAGS += -Wmissing-parameter-type -CFLAGS += -Wmissing-declarations -CFLAGS += -Wmissing-field-initializers -CFLAGS += -Wmissing-format-attribute -#CFLAGS += -Wredundant-decls -CFLAGS += -Wnested-externs -CFLAGS += -Woverlength-strings -#CFLAGS += -Wswitch-default -#CFLAGS += -Wc++-compat -#CFLAGS += -Wcast-qual -#CFLAGS += -Wconversion -#CFLAGS += -Wjump-misses-init -#CFLAGS += -pedantic - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -ffunction-sections -CPPFLAGS += -fno-strict-aliasing -CPPFLAGS += -fno-exceptions -CPPFLAGS += -masm-addr-pseudos -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -#CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -#ASFLAGS += -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -#LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--gc-sections --rodata-writable -LDFLAGS += -Wl,--direct-data -#LDFLAGS += -T linker_script.x - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr32-gcc -OBJCOPY = avr32-objcopy -OBJDUMP = avr32-objdump -SIZE = avr32-size -AR = avr32-ar rcs -NM = avr32-nm -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mpart=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mpart=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mpart=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex lss sym doxygen clean clean_list clean_doxygen \ -dfu flip checksource - diff --git a/BuildTests/ModuleTest/makefile.xmega b/BuildTests/ModuleTest/makefile.xmega deleted file mode 100644 index 0a2f50147..000000000 --- a/BuildTests/ModuleTest/makefile.xmega +++ /dev/null @@ -1,733 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make coff = Convert ELF to AVR COFF. -# -# make extcoff = Convert ELF to AVR Extended COFF. -# -# make program = Download the hex file to the device, using avrdude. -# Please customize the avrdude settings below first! -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make dfu-ee = Download the eeprom file to the device, using dfu-programmer -# (must have dfu-programmer installed). -# -# make flip-ee = Download the eeprom file to the device, using Atmel FLIP -# (must have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make debug = Start either simulavr or avarice as specified for debugging, -# with avr-gdb or avr-insight as the front end for debugging. -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = atxmega128a1u - - -# Targeted chip architecture (see library "Architectures" documentation) -ARCH = XMEGA - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = NONE - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This should be the frequency the system core runs at, after the system clock -# has been set up correctly and started. -F_CPU = 24000000 - - -# USB controller master clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency of the USB controller's clock generator in Hz. -# -# For the XMEGA chips, this should be equal to a multiple of 6MHz for Low -# Speed USB mode, or a multiple of 48MHz for Full Speed USB mode. -F_USB = 48000000 - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = Test - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ../.. - - -# LUFA library compile-time options and predefined tokens -LUFA_OPTS = - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = Test_C.c \ - $(LUFA_SRC_USB) \ - $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = Test_CPP.cpp - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = Dummy.S - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = 1 - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=gnu99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -CDEFS += -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += -DARCH=ARCH_$(ARCH) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += -DARCH=ARCH_$(ARCH) -CPPDEFS += $(LUFA_OPTS) - - -# Debugging format. -# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. -# AVR Studio 4.10 requires dwarf-2. -# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. -DEBUG = dwarf-2 - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-inline-small-functions -CFLAGS += -fpack-struct -CFLAGS += -fshort-enums -CFLAGS += -fno-strict-aliasing -CFLAGS += -fno-split-wide-types -#CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) -CFLAGS += -Werror -CFLAGS += -Wall -CFLAGS += -Wextra -CFLAGS += -Wstrict-prototypes -CFLAGS += -Wformat=2 -CFLAGS += -Winit-self -CFLAGS += -Wswitch-enum -CFLAGS += -Wunused -CFLAGS += -Wundef -CFLAGS += -Wpointer-arith -CFLAGS += -Wcast-align -CFLAGS += -Wwrite-strings -CFLAGS += -Wlogical-op -CFLAGS += -Wmissing-parameter-type -CFLAGS += -Wmissing-declarations -CFLAGS += -Wmissing-field-initializers -CFLAGS += -Wmissing-format-attribute -CFLAGS += -Wredundant-decls -CFLAGS += -Wnested-externs -CFLAGS += -Woverlength-strings -#CFLAGS += -Wswitch-default -#CFLAGS += -Wc++-compat -#CFLAGS += -Wcast-qual -#CFLAGS += -Wconversion -#CFLAGS += -Wjump-misses-init -#CFLAGS += -pedantic - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -fpack-struct -CPPFLAGS += -fshort-enums -CPPFLAGS += -ffunction-sections -CPPFLAGS += -fno-strict-aliasing -CPPFLAGS += -fno-exceptions -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -#CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -#ASFLAGS += -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Library Options ---------------- -# Minimalistic printf version -PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min - -# Floating point printf version (requires MATH_LIB = -lm below) -PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt - -# If this is left blank, then it will use the Standard printf version. -PRINTF_LIB = -#PRINTF_LIB = $(PRINTF_LIB_MIN) -#PRINTF_LIB = $(PRINTF_LIB_FLOAT) - - -# Minimalistic scanf version -SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min - -# Floating point + %[ scanf version (requires MATH_LIB = -lm below) -SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt - -# If this is left blank, then it will use the Standard scanf version. -SCANF_LIB = -#SCANF_LIB = $(SCANF_LIB_MIN) -#SCANF_LIB = $(SCANF_LIB_FLOAT) - - -MATH_LIB = -lm - - -# List any extra directories to look for libraries here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = - - - -#---------------- External Memory Options ---------------- - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# used for variables (.data/.bss) and heap (malloc()). -#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# only used for heap (malloc()). -#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff - -EXTMEMOPTS = - - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -#LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--relax -LDFLAGS += -Wl,--gc-sections -LDFLAGS += $(EXTMEMOPTS) -LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) -LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) -#LDFLAGS += -T linker_script.x - - - -#---------------- Programming Options (avrdude) ---------------- - -# Programming hardware -# Type: avrdude -c ? -# to get a full listing. -# -AVRDUDE_PROGRAMMER = jtagmkII - -# com1 = serial port. Use lpt1 to connect to parallel port. -AVRDUDE_PORT = usb - -AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex -#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep - - -# Uncomment the following if you want avrdude's erase cycle counter. -# Note that this counter needs to be initialized first using -Yn, -# see avrdude manual. -#AVRDUDE_ERASE_COUNTER = -y - -# Uncomment the following if you do /not/ wish a verification to be -# performed after programming the device. -#AVRDUDE_NO_VERIFY = -V - -# Increase verbosity level. Please use this when submitting bug -# reports about avrdude. See -# to submit bug reports. -#AVRDUDE_VERBOSE = -v -v - -AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) -AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) -AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) - - - -#---------------- Debugging Options ---------------- - -# For simulavr only - target MCU frequency. -DEBUG_MFREQ = $(F_CPU) - -# Set the DEBUG_UI to either gdb or insight. -# DEBUG_UI = gdb -DEBUG_UI = insight - -# Set the debugging back-end to either avarice, simulavr. -DEBUG_BACKEND = avarice -#DEBUG_BACKEND = simulavr - -# GDB Init Filename. -GDBINIT_FILE = __avr_gdbinit - -# When using avarice settings for the JTAG -JTAG_DEV = /dev/com1 - -# Debugging port used to communicate between GDB / avarice / simulavr. -DEBUG_PORT = 4242 - -# Debugging host used to communicate between GDB / avarice / simulavr, normally -# just set to localhost unless doing some sort of crazy debugging when -# avarice is running on a different computer. -DEBUG_HOST = localhost - - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr-gcc -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AR = avr-ar rcs -NM = avr-nm -AVRDUDE = avrdude -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_EXTENDED_COFF = Converting to AVR Extended COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex eep lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -eep: $(TARGET).eep -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -program: $(TARGET).hex $(TARGET).eep - $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) - -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - -flip-ee: $(TARGET).hex $(TARGET).eep - $(COPY) $(TARGET).eep $(TARGET)eep.hex - batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase - batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - $(REMOVE) $(TARGET)eep.hex - -dfu-ee: $(TARGET).hex $(TARGET).eep - dfu-programmer $(MCU) eeprom-flash $(TARGET).eep - dfu-programmer $(MCU) reset - - -# Generate avr-gdb config/init file which does the following: -# define the reset signal, load the target file, connect to target, and set -# a breakpoint at main(). -gdb-config: - @$(REMOVE) $(GDBINIT_FILE) - @echo define reset >> $(GDBINIT_FILE) - @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) - @echo end >> $(GDBINIT_FILE) - @echo file $(TARGET).elf >> $(GDBINIT_FILE) - @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) -ifeq ($(DEBUG_BACKEND),simulavr) - @echo load >> $(GDBINIT_FILE) -endif - @echo break main >> $(GDBINIT_FILE) - -debug: gdb-config $(TARGET).elf -ifeq ($(DEBUG_BACKEND), avarice) - @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. - @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ - $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) - @$(WINSHELL) /c pause - -else - @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ - $(DEBUG_MFREQ) --port $(DEBUG_PORT) -endif - @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) - - - - -# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. -COFFCONVERT = $(OBJCOPY) --debugging -COFFCONVERT += --change-section-address .data-0x800000 -COFFCONVERT += --change-section-address .bss-0x800000 -COFFCONVERT += --change-section-address .noinit-0x800000 -COFFCONVERT += --change-section-address .eeprom-0x810000 - - - -coff: $(TARGET).elf - @echo - @echo $(MSG_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-avr $< $(TARGET).cof - - -extcoff: $(TARGET).elf - @echo - @echo $(MSG_EXTENDED_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof - - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -%.eep: %.elf - @echo - @echo $(MSG_EEPROM) $@ - -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).eep - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex eep lss sym coff extcoff doxygen clean \ -clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ -debug gdb-config checksource diff --git a/BuildTests/SingleUSBModeTest/Dummy.S b/BuildTests/SingleUSBModeTest/Dummy.S index bc13b31eb..0a1763587 100644 --- a/BuildTests/SingleUSBModeTest/Dummy.S +++ b/BuildTests/SingleUSBModeTest/Dummy.S @@ -1,41 +1,42 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -.section .text - - -# Mandatory entry point for successful compilation and link -.global main -main: - - -# Mandatory callback needed for base compile of the USB driver -.global CALLBACK_USB_GetDescriptor -CALLBACK_USB_GetDescriptor: +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +.section .text + + +# Mandatory entry point for successful compilation and link +.global main +main: + # Force code generation of the base USB stack + call USB_Init + +# Mandatory callback needed for base compile of the USB driver +.global CALLBACK_USB_GetDescriptor +CALLBACK_USB_GetDescriptor: diff --git a/BuildTests/SingleUSBModeTest/Test.c b/BuildTests/SingleUSBModeTest/Test.c index e361b251a..887344bb0 100644 --- a/BuildTests/SingleUSBModeTest/Test.c +++ b/BuildTests/SingleUSBModeTest/Test.c @@ -1,32 +1,32 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include -#include +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +#include +#include diff --git a/BuildTests/SingleUSBModeTest/makefile b/BuildTests/SingleUSBModeTest/makefile index 82ed94a79..bef8a5c70 100644 --- a/BuildTests/SingleUSBModeTest/makefile +++ b/BuildTests/SingleUSBModeTest/makefile @@ -1,45 +1,56 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -# Makefile for the module build test. This test -# attempts to build as many modules as possible -# under all supported architectures, and include -# all module headers in a simple C and C++ -# application. - -all: begin compile clean end - -begin: - @echo Executing build test "SingleUSBModeTest". - @echo - -end: - @echo Build test "SingleUSBModeTest" complete. - @echo - -compile: - $(MAKE) -s -f makefile.avr8 clean - $(MAKE) -s -f makefile.avr8 LUFA_OPTS='-D USB_DEVICE_ONLY' elf - $(MAKE) -s -f makefile.avr8 clean - $(MAKE) -s -f makefile.avr8 LUFA_OPTS='-D USB_HOST_ONLY' elf - - $(MAKE) -s -f makefile.xmega clean - $(MAKE) -s -f makefile.xmega LUFA_OPTS='-D USB_DEVICE_ONLY' elf - - $(MAKE) -s -f makefile.uc3 clean - $(MAKE) -s -f makefile.uc3 LUFA_OPTS='-D USB_DEVICE_ONLY' elf - $(MAKE) -s -f makefile.uc3 clean - $(MAKE) -s -f makefile.uc3 LUFA_OPTS='-D USB_HOST_ONLY' elf - -clean: - $(MAKE) -s -f makefile.avr8 clean - $(MAKE) -s -f makefile.xmega clean - $(MAKE) -s -f makefile.uc3 clean - -%: - \ No newline at end of file +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +# Makefile for the single USB mode build test. +# This test attempts to build the USB module +# under fixed device and fixed host modes under +# all supported architectures + +# Path to the LUFA library core +LUFA_PATH := ../../LUFA/ + +# Build test cannot be run with multiple parallel jobs +.NOTPARALLEL: + +all: begin compile clean end + +begin: + @echo Executing build test "SingleUSBModeTest". + @echo + +end: + @echo Build test "SingleUSBModeTest" complete. + @echo + +compile: + @echo Building SingleUSBModeTest for ARCH=AVR8 in device only mode... + $(MAKE) -f makefile.test clean elf ARCH=AVR8 MCU=at90usb1287 CC_FLAGS='-D USB_DEVICE_ONLY' + + @echo Building SingleUSBModeTest for ARCH=AVR8 in host only mode... + $(MAKE) -f makefile.test clean elf ARCH=AVR8 MCU=at90usb1287 CC_FLAGS='-D USB_HOST_ONLY' + + @echo Building SingleUSBModeTest for ARCH=XMEGA in device only mode... + $(MAKE) -f makefile.test clean elf ARCH=XMEGA MCU=atxmega128a1u CC_FLAGS='-D USB_DEVICE_ONLY' + + @echo Building SingleUSBModeTest for ARCH=UC3 in device only mode... + $(MAKE) -f makefile.test clean elf ARCH=UC3 MCU=uc3a0256 CC_FLAGS='-D USB_DEVICE_ONLY' + + @echo Building SingleUSBModeTest for ARCH=UC3 in host only mode... + $(MAKE) -f makefile.test clean elf ARCH=UC3 MCU=uc3a0256 CC_FLAGS='-D USB_HOST_ONLY' + +clean: + $(MAKE) -f makefile.test clean ARCH=AVR8 MCU=at90usb1287 + $(MAKE) -f makefile.test clean ARCH=XMEGA MCU=atxmega128a1u + $(MAKE) -f makefile.test clean ARCH=UC3 MCU=uc3a0256 + +%: + +.PHONY: begin end compile clean + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_core.mk diff --git a/BuildTests/SingleUSBModeTest/makefile.avr8 b/BuildTests/SingleUSBModeTest/makefile.avr8 deleted file mode 100644 index d38b0e12b..000000000 --- a/BuildTests/SingleUSBModeTest/makefile.avr8 +++ /dev/null @@ -1,724 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make coff = Convert ELF to AVR COFF. -# -# make extcoff = Convert ELF to AVR Extended COFF. -# -# make program = Download the hex file to the device, using avrdude. -# Please customize the avrdude settings below first! -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make dfu-ee = Download the eeprom file to the device, using dfu-programmer -# (must have dfu-programmer installed). -# -# make flip-ee = Download the eeprom file to the device, using Atmel FLIP -# (must have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make debug = Start either simulavr or avarice as specified for debugging, -# with avr-gdb or avr-insight as the front end for debugging. -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = at90usb1287 - - -# Target architecture (see library "Board Types" documentation). -ARCH = AVR8 - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = NONE - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This will be an integer division of F_USB below, as it is sourced by -# F_USB after it has run through any CPU prescalers. Note that this value -# does not *change* the processor frequency - it should merely be updated to -# reflect the processor speed set externally so that the code can use accurate -# software delays. -F_CPU = 16000000 - - -# Input clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency (before any prescaling is performed) in Hz. This value may -# differ from F_CPU if prescaling is used on the latter, and is required as the -# raw input clock is fed directly to the PLL sections of the AVR for high speed -# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' -# at the end, this will be done automatically to create a 32-bit value in your -# source code. -# -# If no clock division is performed on the input clock inside the AVR (via the -# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. -F_USB = $(F_CPU) - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = Test - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ../.. - - -# LUFA library compile-time options and predefined tokens -LUFA_OPTS = - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = Test.c \ - $(LUFA_SRC_USB) - - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = Dummy.S - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = 1 - - -# Debugging format. -# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. -# AVR Studio 4.10 requires dwarf-2. -# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. -DEBUG = dwarf-2 - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=c99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += $(LUFA_OPTS) -#CPPDEFS += -D__STDC_LIMIT_MACROS -#CPPDEFS += -D__STDC_CONSTANT_MACROS - - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-inline-small-functions -CFLAGS += -fpack-struct -CFLAGS += -fshort-enums -CFLAGS += -fno-strict-aliasing -CFLAGS += -fno-split-wide-types -CFLAGS += -Wall -CFLAGS += -Wstrict-prototypes -#CFLAGS += -mshort-calls -#CFLAGS += -fno-unit-at-a-time -#CFLAGS += -Wundef -#CFLAGS += -Wunreachable-code -#CFLAGS += -Wsign-compare -#CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -fpack-struct -CPPFLAGS += -fshort-enums -CPPFLAGS += -fno-exceptions -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -#CPPFLAGS += -mshort-calls -#CPPFLAGS += -fno-unit-at-a-time -#CPPFLAGS += -Wstrict-prototypes -#CPPFLAGS += -Wunreachable-code -#CPPFLAGS += -Wsign-compare -#CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -#ASFLAGS += -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Library Options ---------------- -# Minimalistic printf version -PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min - -# Floating point printf version (requires MATH_LIB = -lm below) -PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt - -# If this is left blank, then it will use the Standard printf version. -PRINTF_LIB = -#PRINTF_LIB = $(PRINTF_LIB_MIN) -#PRINTF_LIB = $(PRINTF_LIB_FLOAT) - - -# Minimalistic scanf version -SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min - -# Floating point + %[ scanf version (requires MATH_LIB = -lm below) -SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt - -# If this is left blank, then it will use the Standard scanf version. -SCANF_LIB = -#SCANF_LIB = $(SCANF_LIB_MIN) -#SCANF_LIB = $(SCANF_LIB_FLOAT) - - -MATH_LIB = -lm - - -# List any extra directories to look for libraries here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = - - - -#---------------- External Memory Options ---------------- - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# used for variables (.data/.bss) and heap (malloc()). -#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# only used for heap (malloc()). -#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff - -EXTMEMOPTS = - - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -#LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--relax -LDFLAGS += -Wl,--gc-sections -LDFLAGS += $(EXTMEMOPTS) -LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) -LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) -#LDFLAGS += -T linker_script.x - - - -#---------------- Programming Options (avrdude) ---------------- - -# Programming hardware -# Type: avrdude -c ? -# to get a full listing. -# -AVRDUDE_PROGRAMMER = jtagmkII - -# com1 = serial port. Use lpt1 to connect to parallel port. -AVRDUDE_PORT = usb - -AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex -#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep - - -# Uncomment the following if you want avrdude's erase cycle counter. -# Note that this counter needs to be initialized first using -Yn, -# see avrdude manual. -#AVRDUDE_ERASE_COUNTER = -y - -# Uncomment the following if you do /not/ wish a verification to be -# performed after programming the device. -#AVRDUDE_NO_VERIFY = -V - -# Increase verbosity level. Please use this when submitting bug -# reports about avrdude. See -# to submit bug reports. -#AVRDUDE_VERBOSE = -v -v - -AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) -AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) -AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) - - - -#---------------- Debugging Options ---------------- - -# For simulavr only - target MCU frequency. -DEBUG_MFREQ = $(F_CPU) - -# Set the DEBUG_UI to either gdb or insight. -# DEBUG_UI = gdb -DEBUG_UI = insight - -# Set the debugging back-end to either avarice, simulavr. -DEBUG_BACKEND = avarice -#DEBUG_BACKEND = simulavr - -# GDB Init Filename. -GDBINIT_FILE = __avr_gdbinit - -# When using avarice settings for the JTAG -JTAG_DEV = /dev/com1 - -# Debugging port used to communicate between GDB / avarice / simulavr. -DEBUG_PORT = 4242 - -# Debugging host used to communicate between GDB / avarice / simulavr, normally -# just set to localhost unless doing some sort of crazy debugging when -# avarice is running on a different computer. -DEBUG_HOST = localhost - - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr-gcc -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AR = avr-ar rcs -NM = avr-nm -AVRDUDE = avrdude -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_EXTENDED_COFF = Converting to AVR Extended COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex eep lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -eep: $(TARGET).eep -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -program: $(TARGET).hex $(TARGET).eep - $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) - -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - -flip-ee: $(TARGET).hex $(TARGET).eep - $(COPY) $(TARGET).eep $(TARGET)eep.hex - batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase - batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - $(REMOVE) $(TARGET)eep.hex - -dfu-ee: $(TARGET).hex $(TARGET).eep - dfu-programmer $(MCU) eeprom-flash $(TARGET).eep - dfu-programmer $(MCU) reset - - -# Generate avr-gdb config/init file which does the following: -# define the reset signal, load the target file, connect to target, and set -# a breakpoint at main(). -gdb-config: - @$(REMOVE) $(GDBINIT_FILE) - @echo define reset >> $(GDBINIT_FILE) - @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) - @echo end >> $(GDBINIT_FILE) - @echo file $(TARGET).elf >> $(GDBINIT_FILE) - @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) -ifeq ($(DEBUG_BACKEND),simulavr) - @echo load >> $(GDBINIT_FILE) -endif - @echo break main >> $(GDBINIT_FILE) - -debug: gdb-config $(TARGET).elf -ifeq ($(DEBUG_BACKEND), avarice) - @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. - @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ - $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) - @$(WINSHELL) /c pause - -else - @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ - $(DEBUG_MFREQ) --port $(DEBUG_PORT) -endif - @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) - - - - -# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. -COFFCONVERT = $(OBJCOPY) --debugging -COFFCONVERT += --change-section-address .data-0x800000 -COFFCONVERT += --change-section-address .bss-0x800000 -COFFCONVERT += --change-section-address .noinit-0x800000 -COFFCONVERT += --change-section-address .eeprom-0x810000 - - - -coff: $(TARGET).elf - @echo - @echo $(MSG_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-avr $< $(TARGET).cof - - -extcoff: $(TARGET).elf - @echo - @echo $(MSG_EXTENDED_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof - - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@ - -%.eep: %.elf - @echo - @echo $(MSG_EEPROM) $@ - -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).eep - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex eep lss sym coff extcoff doxygen clean \ -clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ -debug gdb-config checksource diff --git a/BuildTests/SingleUSBModeTest/makefile.test b/BuildTests/SingleUSBModeTest/makefile.test new file mode 100644 index 000000000..800e3c3a6 --- /dev/null +++ b/BuildTests/SingleUSBModeTest/makefile.test @@ -0,0 +1,67 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# +# -------------------------------------- +# LUFA Project Makefile. +# -------------------------------------- + +MCU = +ARCH = +BOARD = NONE +F_CPU = $(F_USB) +DEBUG_LEVEL = 0 + +ifeq ($(ARCH), AVR8) + F_USB = 8000000 +else ifeq ($(ARCH), XMEGA) + F_USB = 48000000 +else ifeq ($(ARCH), UC3) + F_USB = 48000000 +endif + +OPTIMIZATION = 1 +TARGET = Test +SRC = Test.c Dummy.S $(LUFA_SRC_USB) +LUFA_PATH = ../../LUFA + +# Generic C/C++ compiler flags +CC_FLAGS = -Wextra +CC_FLAGS += -Werror +CC_FLAGS += -Wformat=2 +CC_FLAGS += -Winit-self +CC_FLAGS += -Wswitch-enum +CC_FLAGS += -Wunused +CC_FLAGS += -Wundef +CC_FLAGS += -Wpointer-arith +CC_FLAGS += -Wcast-align +CC_FLAGS += -Wwrite-strings +CC_FLAGS += -Wlogical-op +CC_FLAGS += -Wmissing-declarations +CC_FLAGS += -Wmissing-field-initializers +CC_FLAGS += -Wmissing-format-attribute +CC_FLAGS += -Woverlength-strings + +# Only enable rendundant declaration warnings for AVR8 target (FIXME) +ifeq ($(ARCH), AVR8) +CC_FLAGS += -Wredundant-decls +endif + +# C compiler only flags +C_FLAGS += -Wmissing-parameter-type +C_FLAGS += -Wnested-externs + +# Potential additional warnings to enable in the future (FIXME) +#CC_FLAGS += -Wswitch-default +#CC_FLAGS += -Wc++-compat +#CC_FLAGS += -Wcast-qual +#CC_FLAGS += -Wconversion +#CC_FLAGS += -Wjump-misses-init +#CC_FLAGS += -pedantic + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk \ No newline at end of file diff --git a/BuildTests/SingleUSBModeTest/makefile.uc3 b/BuildTests/SingleUSBModeTest/makefile.uc3 deleted file mode 100644 index b86bb886b..000000000 --- a/BuildTests/SingleUSBModeTest/makefile.uc3 +++ /dev/null @@ -1,487 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = uc3a3256 - - -# Targeted chip architecture (see library "Architectures" documentation) -ARCH = UC3 - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = NONE - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This should be the frequency the system core runs at, after the system clock -# has been set up correctly and started. -F_CPU = 12000000 - - -# USB controller master clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency of the USB controller's clock generator in Hz. -# -# For the UC3 chips, this should be equal to 48MHz or 96MHz. -F_USB = 48000000 - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = Test - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ../.. - - -# LUFA library compile-time options and predefined tokens (add '-D' before each token) -LUFA_OPTS = - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = Test.c \ - $(LUFA_SRC_USB) - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = Dummy.S - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = 1 - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=gnu99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -CDEFS += -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += -DARCH=ARCH_$(ARCH) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += -DARCH=ARCH_$(ARCH) -CPPDEFS += $(LUFA_OPTS) - - -# Debugging level. -DEBUG = 3 - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-strict-aliasing -CFLAGS += -Wall -CFLAGS += -Wstrict-prototypes -CFLAGS += -masm-addr-pseudos -#CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -ffunction-sections -CPPFLAGS += -fno-strict-aliasing -CPPFLAGS += -fno-exceptions -CPPFLAGS += -masm-addr-pseudos -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -#CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -#ASFLAGS += -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -#LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--gc-sections --rodata-writable -LDFLAGS += -Wl,--direct-data -#LDFLAGS += -T linker_script.x - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr32-gcc -OBJCOPY = avr32-objcopy -OBJDUMP = avr32-objdump -SIZE = avr32-size -AR = avr32-ar rcs -NM = avr32-nm -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mpart=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mpart=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mpart=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex lss sym doxygen clean clean_list clean_doxygen \ -dfu flip checksource - diff --git a/BuildTests/SingleUSBModeTest/makefile.xmega b/BuildTests/SingleUSBModeTest/makefile.xmega deleted file mode 100644 index 868bb500a..000000000 --- a/BuildTests/SingleUSBModeTest/makefile.xmega +++ /dev/null @@ -1,706 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make coff = Convert ELF to AVR COFF. -# -# make extcoff = Convert ELF to AVR Extended COFF. -# -# make program = Download the hex file to the device, using avrdude. -# Please customize the avrdude settings below first! -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make dfu-ee = Download the eeprom file to the device, using dfu-programmer -# (must have dfu-programmer installed). -# -# make flip-ee = Download the eeprom file to the device, using Atmel FLIP -# (must have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make debug = Start either simulavr or avarice as specified for debugging, -# with avr-gdb or avr-insight as the front end for debugging. -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = atxmega128a1u - - -# Targeted chip architecture (see library "Architectures" documentation) -ARCH = XMEGA - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = NONE - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This should be the frequency the system core runs at, after the system clock -# has been set up correctly and started. -F_CPU = 24000000 - - -# USB controller master clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency of the USB controller's clock generator in Hz. -# -# For the XMEGA chips, this should be equal to a multiple of 6MHz for Low -# Speed USB mode, or a multiple of 48MHz for Full Speed USB mode. -F_USB = 48000000 - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = Test - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ../.. - - -# LUFA library compile-time options and predefined tokens -LUFA_OPTS = - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = Test.c \ - $(LUFA_SRC_USB) - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = Dummy.S - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = 1 - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=gnu99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -CDEFS += -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += -DARCH=ARCH_$(ARCH) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += -DARCH=ARCH_$(ARCH) -CPPDEFS += $(LUFA_OPTS) - - -# Debugging format. -# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. -# AVR Studio 4.10 requires dwarf-2. -# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. -DEBUG = dwarf-2 - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-inline-small-functions -CFLAGS += -fpack-struct -CFLAGS += -fshort-enums -CFLAGS += -fno-strict-aliasing -CFLAGS += -Wall -CFLAGS += -Wstrict-prototypes -#CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -fpack-struct -CPPFLAGS += -fshort-enums -CPPFLAGS += -ffunction-sections -CPPFLAGS += -fno-strict-aliasing -CPPFLAGS += -fno-exceptions -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -#CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -#ASFLAGS += -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Library Options ---------------- -# Minimalistic printf version -PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min - -# Floating point printf version (requires MATH_LIB = -lm below) -PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt - -# If this is left blank, then it will use the Standard printf version. -PRINTF_LIB = -#PRINTF_LIB = $(PRINTF_LIB_MIN) -#PRINTF_LIB = $(PRINTF_LIB_FLOAT) - - -# Minimalistic scanf version -SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min - -# Floating point + %[ scanf version (requires MATH_LIB = -lm below) -SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt - -# If this is left blank, then it will use the Standard scanf version. -SCANF_LIB = -#SCANF_LIB = $(SCANF_LIB_MIN) -#SCANF_LIB = $(SCANF_LIB_FLOAT) - - -MATH_LIB = -lm - - -# List any extra directories to look for libraries here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = - - - -#---------------- External Memory Options ---------------- - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# used for variables (.data/.bss) and heap (malloc()). -#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# only used for heap (malloc()). -#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff - -EXTMEMOPTS = - - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -#LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--relax -LDFLAGS += -Wl,--gc-sections -LDFLAGS += $(EXTMEMOPTS) -LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) -LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) -#LDFLAGS += -T linker_script.x - - - -#---------------- Programming Options (avrdude) ---------------- - -# Programming hardware -# Type: avrdude -c ? -# to get a full listing. -# -AVRDUDE_PROGRAMMER = jtagmkII - -# com1 = serial port. Use lpt1 to connect to parallel port. -AVRDUDE_PORT = usb - -AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex -#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep - - -# Uncomment the following if you want avrdude's erase cycle counter. -# Note that this counter needs to be initialized first using -Yn, -# see avrdude manual. -#AVRDUDE_ERASE_COUNTER = -y - -# Uncomment the following if you do /not/ wish a verification to be -# performed after programming the device. -#AVRDUDE_NO_VERIFY = -V - -# Increase verbosity level. Please use this when submitting bug -# reports about avrdude. See -# to submit bug reports. -#AVRDUDE_VERBOSE = -v -v - -AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) -AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) -AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) - - - -#---------------- Debugging Options ---------------- - -# For simulavr only - target MCU frequency. -DEBUG_MFREQ = $(F_CPU) - -# Set the DEBUG_UI to either gdb or insight. -# DEBUG_UI = gdb -DEBUG_UI = insight - -# Set the debugging back-end to either avarice, simulavr. -DEBUG_BACKEND = avarice -#DEBUG_BACKEND = simulavr - -# GDB Init Filename. -GDBINIT_FILE = __avr_gdbinit - -# When using avarice settings for the JTAG -JTAG_DEV = /dev/com1 - -# Debugging port used to communicate between GDB / avarice / simulavr. -DEBUG_PORT = 4242 - -# Debugging host used to communicate between GDB / avarice / simulavr, normally -# just set to localhost unless doing some sort of crazy debugging when -# avarice is running on a different computer. -DEBUG_HOST = localhost - - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr-gcc -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AR = avr-ar rcs -NM = avr-nm -AVRDUDE = avrdude -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_EXTENDED_COFF = Converting to AVR Extended COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex eep lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -eep: $(TARGET).eep -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -program: $(TARGET).hex $(TARGET).eep - $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) - -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - -flip-ee: $(TARGET).hex $(TARGET).eep - $(COPY) $(TARGET).eep $(TARGET)eep.hex - batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase - batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - $(REMOVE) $(TARGET)eep.hex - -dfu-ee: $(TARGET).hex $(TARGET).eep - dfu-programmer $(MCU) eeprom-flash $(TARGET).eep - dfu-programmer $(MCU) reset - - -# Generate avr-gdb config/init file which does the following: -# define the reset signal, load the target file, connect to target, and set -# a breakpoint at main(). -gdb-config: - @$(REMOVE) $(GDBINIT_FILE) - @echo define reset >> $(GDBINIT_FILE) - @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) - @echo end >> $(GDBINIT_FILE) - @echo file $(TARGET).elf >> $(GDBINIT_FILE) - @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) -ifeq ($(DEBUG_BACKEND),simulavr) - @echo load >> $(GDBINIT_FILE) -endif - @echo break main >> $(GDBINIT_FILE) - -debug: gdb-config $(TARGET).elf -ifeq ($(DEBUG_BACKEND), avarice) - @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. - @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ - $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) - @$(WINSHELL) /c pause - -else - @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ - $(DEBUG_MFREQ) --port $(DEBUG_PORT) -endif - @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) - - - - -# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. -COFFCONVERT = $(OBJCOPY) --debugging -COFFCONVERT += --change-section-address .data-0x800000 -COFFCONVERT += --change-section-address .bss-0x800000 -COFFCONVERT += --change-section-address .noinit-0x800000 -COFFCONVERT += --change-section-address .eeprom-0x810000 - - - -coff: $(TARGET).elf - @echo - @echo $(MSG_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-avr $< $(TARGET).cof - - -extcoff: $(TARGET).elf - @echo - @echo $(MSG_EXTENDED_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof - - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -%.eep: %.elf - @echo - @echo $(MSG_EEPROM) $@ - -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).eep - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex eep lss sym coff extcoff doxygen clean \ -clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ -debug gdb-config checksource diff --git a/BuildTests/StaticAnalysisTest/makefile b/BuildTests/StaticAnalysisTest/makefile index 1578412f9..6e6ed3c36 100644 --- a/BuildTests/StaticAnalysisTest/makefile +++ b/BuildTests/StaticAnalysisTest/makefile @@ -1,49 +1,39 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -# Static anlysis of the entire LUFA source tree, using the free cross-platform "cppcheck" tool. - -# Path to the root of the LUFA tree to scan -LUFA_ROOT_PATH = ../.. - -# Filenames or directories (including fragments) to exclude from the analysis -EXCLUDE_LIST = FATFs/ \ - PetiteFATFs/ \ - uip/ - -# Output message template for found warnings and errors -MESSAGE_TEMPLATE = "{file}:{line}: {severity} ({id}): {message}" - -# Checks to suppress so that generated warnings are discarded -SUPPRESS_WARNINGS = variableScope \ - missingInclude - -# Extra paths to search for include files -INCLUDE_PATHS = $(LUFA_ROOT_PATH)/LUFA/CodeTemplates/ \ - $(LUFA_ROOT_PATH)/Projects/AVRISP-MKII/ - -# Configuration options to pass to cppcheck -CPPCHECK_OPTIONS = --template=$(MESSAGE_TEMPLATE) $(INCLUDE_PATHS:%=-I%) $(EXCLUDE_LIST:%=-i%) --inline-suppr --force --error-exitcode=1 --std=c99 - - -all: begin staticcheck end - -begin: - @echo Executing build test "StaticAnalysisTest". - @echo - -end: - @echo Build test "StaticAnalysisTest" complete. - @echo - -staticcheck: - cppcheck --quiet $(CPPCHECK_OPTIONS) --check-config $(LUFA_ROOT_PATH) - cppcheck --quiet $(CPPCHECK_OPTIONS) --enable=all $(SUPPRESS_WARNINGS:%=--suppress=%) $(LUFA_ROOT_PATH) - -%: - \ No newline at end of file +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +# Static anlysis of the entire LUFA source tree, using the free cross-platform "cppcheck" tool. + +# Path to the LUFA library core +LUFA_PATH := ../../LUFA/ + +CPPCHECK_EXCLUDES := FATFs/ \ + PetiteFATFs/ \ + uip/ +CPPCHECK_INCLUDES := $(patsubst %/,%,$(LUFA_PATH))/CodeTemplates/ \ + $(patsubst %/,%,$(LUFA_PATH))/../Projects/AVRISP-MKII/ + +SRC := $(patsubst %/,%,$(LUFA_PATH))/.. + +all: begin cppcheck end + +begin: + @echo Executing build test "StaticAnalysisTest". + @echo + +end: + @echo Build test "StaticAnalysisTest" complete. + @echo + +%: + + +.PHONY: all begin end + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk \ No newline at end of file diff --git a/BuildTests/makefile b/BuildTests/makefile index 604b2e56f..901dbadbb 100644 --- a/BuildTests/makefile +++ b/BuildTests/makefile @@ -1,19 +1,24 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -# Makefile to build all the LUFA Build Tests. Build Tests are -# used to verify the correctness of the LUFA library, and are -# not intended to be modified or compiled by non-developers. - -all: -%: - $(MAKE) -C BoardDriverTest $@ - $(MAKE) -C BootloaderTest $@ - $(MAKE) -C ModuleTest $@ - $(MAKE) -C SingleUSBModeTest $@ - $(MAKE) -C StaticAnalysisTest $@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +# Makefile to build all the LUFA Build Tests. Build Tests are +# used to verify the correctness of the LUFA library, and are +# not intended to be modified or compiled by non-developers. + +all: + +%: + @echo Executing \"make $@\" on all LUFA build tests. + @echo + $(MAKE) -C BoardDriverTest $@ + $(MAKE) -C BootloaderTest $@ + $(MAKE) -C ModuleTest $@ + $(MAKE) -C SingleUSBModeTest $@ + $(MAKE) -C StaticAnalysisTest $@ + @echo + @echo LUFA build test \"make $@\" operation complete. \ No newline at end of file diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index 953ecf8b6..66d78b8c8 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -175,7 +175,7 @@ void EVENT_USB_Device_ControlRequest(void) * * When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for * the given endpoint index, and should return as fast as possible. When non-NULL, this value may be altered for GET operations - * to indicate the size of the retreived data. + * to indicate the size of the retrieved data. * * \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value * of the \c DataLength parameter. @@ -243,7 +243,7 @@ bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* * * When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for * the given entity and should return as fast as possible. When non-NULL, this value may be altered for GET operations - * to indicate the size of the retreived data. + * to indicate the size of the retrieved data. * * \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value * of the \c DataLength parameter. diff --git a/Demos/Device/ClassDriver/AudioInput/makefile b/Demos/Device/ClassDriver/AudioInput/makefile index 33f7f9b35..eb8e0ad56 100644 --- a/Demos/Device/ClassDriver/AudioInput/makefile +++ b/Demos/Device/ClassDriver/AudioInput/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = AudioInput SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c index 82f664a9b..1869ac949 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c @@ -212,7 +212,7 @@ void EVENT_USB_Device_ControlRequest(void) * * When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for * the given endpoint index, and should return as fast as possible. When non-NULL, this value may be altered for GET operations - * to indicate the size of the retreived data. + * to indicate the size of the retrieved data. * * \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value * of the \c DataLength parameter. @@ -280,7 +280,7 @@ bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* * * When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for * the given entity and should return as fast as possible. When non-NULL, this value may be altered for GET operations - * to indicate the size of the retreived data. + * to indicate the size of the retrieved data. * * \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value * of the \c DataLength parameter. diff --git a/Demos/Device/ClassDriver/AudioOutput/makefile b/Demos/Device/ClassDriver/AudioOutput/makefile index 5cef72cfb..6fa1edafb 100644 --- a/Demos/Device/ClassDriver/AudioOutput/makefile +++ b/Demos/Device/ClassDriver/AudioOutput/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = AudioOutput SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/LUFA DualVirtualSerial.inf b/Demos/Device/ClassDriver/DualVirtualSerial/LUFA DualVirtualSerial.inf index dd721a710..54ef70d42 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/LUFA DualVirtualSerial.inf +++ b/Demos/Device/ClassDriver/DualVirtualSerial/LUFA DualVirtualSerial.inf @@ -1,78 +1,36 @@ ;************************************************************ ; Windows USB CDC ACM Setup File ; Copyright (c) 2000 Microsoft Corporation - +;************************************************************ [Version] Signature="$Windows NT$" Class=Ports ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} Provider=%MFGNAME% -LayoutFile=layout.inf -CatalogFile=%MFGFILENAME%.cat -DriverVer=11/15/2007,5.1.2600.0 +DriverVer=7/1/2012,10.0.0.0 [Manufacturer] -%MFGNAME%=DeviceList, NTamd64 - -[DestinationDirs] -DefaultDestDir=12 - - -;------------------------------------------------------------------------------ -; Windows 2000/XP/Vista-32bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.nt] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.nt -AddReg=DriverInstall.nt.AddReg - -[DriverCopyFiles.nt] -usbser.sys,,,0x20 - -[DriverInstall.nt.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 -[DriverInstall.nt.Services] -AddService=usbser, 0x00000002, DriverService.nt - -[DriverService.nt] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys - -;------------------------------------------------------------------------------ -; Vista-64bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.NTamd64] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.NTamd64 -AddReg=DriverInstall.NTamd64.AddReg +[SourceDisksNames] -[DriverCopyFiles.NTamd64] -%DRIVERFILENAME%.sys,,,0x20 +[SourceDisksFiles] -[DriverInstall.NTamd64.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +[DestinationDirs] +DefaultDestDir=12 -[DriverInstall.NTamd64.Services] -AddService=usbser, 0x00000002, DriverService.NTamd64 +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg -[DriverService.NTamd64] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" ;------------------------------------------------------------------------------ ; Vendor and Product ID Definitions @@ -83,14 +41,14 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ; Note: One INF file can be used for multiple devices with different VID and PIDs. ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. ;------------------------------------------------------------------------------ -[SourceDisksFiles] -[SourceDisksNames] [DeviceList] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204E&MI_00, USB\VID_03EB&PID_204E&MI_02 [DeviceList.NTamd64] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204E&MI_00, USB\VID_03EB&PID_204E&MI_02 +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204E&MI_00, USB\VID_03EB&PID_204E&MI_02 ;------------------------------------------------------------------------------ ; String Definitions @@ -98,9 +56,5 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ;Modify these strings to customize your device ;------------------------------------------------------------------------------ [Strings] -MFGFILENAME="CDC_vista" -DRIVERFILENAME ="usbser" MFGNAME="http://www.lufa-lib.org" -INSTDISK="LUFA Dual CDC Driver Installer" -DESCRIPTION="Communications Port" -SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file +DESCRIPTION="LUFA CDC-ACM Virtual Serial Port" \ No newline at end of file diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/makefile b/Demos/Device/ClassDriver/DualVirtualSerial/makefile index 8bb500a52..8bfe42ad3 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/makefile +++ b/Demos/Device/ClassDriver/DualVirtualSerial/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = DualVirtualSerial SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/GenericHID/makefile b/Demos/Device/ClassDriver/GenericHID/makefile index 783d561e2..b225ef581 100644 --- a/Demos/Device/ClassDriver/GenericHID/makefile +++ b/Demos/Device/ClassDriver/GenericHID/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = GenericHID SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/Joystick/makefile b/Demos/Device/ClassDriver/Joystick/makefile index fdfac0d71..2f13aa98d 100644 --- a/Demos/Device/ClassDriver/Joystick/makefile +++ b/Demos/Device/ClassDriver/Joystick/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = Joystick SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/Keyboard/makefile b/Demos/Device/ClassDriver/Keyboard/makefile index b6378a931..dcdec5bfb 100644 --- a/Demos/Device/ClassDriver/Keyboard/makefile +++ b/Demos/Device/ClassDriver/Keyboard/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = Keyboard SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/KeyboardMouse/makefile b/Demos/Device/ClassDriver/KeyboardMouse/makefile index 419d0b685..632be4c29 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/makefile +++ b/Demos/Device/ClassDriver/KeyboardMouse/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = KeyboardMouse SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/makefile b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/makefile index 217a109d2..f752bb5dc 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/makefile +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = KeyboardMouseMultiReport SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/MIDI/makefile b/Demos/Device/ClassDriver/MIDI/makefile index 6330047dd..193881b56 100644 --- a/Demos/Device/ClassDriver/MIDI/makefile +++ b/Demos/Device/ClassDriver/MIDI/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MIDI SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/MassStorage/makefile b/Demos/Device/ClassDriver/MassStorage/makefile index 66d8eb2ad..6a4743150 100644 --- a/Demos/Device/ClassDriver/MassStorage/makefile +++ b/Demos/Device/ClassDriver/MassStorage/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MassStorage SRC = $(TARGET).c Descriptors.c Lib/DataflashManager.c Lib/SCSI.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk \ No newline at end of file diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/makefile b/Demos/Device/ClassDriver/MassStorageKeyboard/makefile index c6feee3e8..44e725193 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/makefile +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MassStorageKeyboard SRC = $(TARGET).c Descriptors.c Lib/DataflashManager.c Lib/SCSI.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/Mouse/makefile b/Demos/Device/ClassDriver/Mouse/makefile index 6c6123e94..2e40960f9 100644 --- a/Demos/Device/ClassDriver/Mouse/makefile +++ b/Demos/Device/ClassDriver/Mouse/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = Mouse SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c index ca555caa5..ad79736f1 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c @@ -112,8 +112,8 @@ void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, ConnectionStateTable[CSTableEntry].Info.SequenceNumberOut += PacketSize; - TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, ServerIPAddress, - ConnectionStateTable[CSTableEntry].RemoteAddress, + TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, &ServerIPAddress, + &ConnectionStateTable[CSTableEntry].RemoteAddress, (sizeof(TCP_Header_t) + PacketSize)); PacketSize += sizeof(TCP_Header_t); @@ -250,7 +250,7 @@ uint8_t TCP_GetPortState(const uint16_t Port) * \return Boolean true if the connection was updated or created, false otherwise (no more space in the connection state table) */ bool TCP_SetConnectionState(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort, const uint8_t State) { @@ -260,7 +260,7 @@ bool TCP_SetConnectionState(const uint16_t Port, { /* Find port entry in the table */ if ((ConnectionStateTable[CSTableEntry].Port == Port) && - IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, &RemoteAddress) && + IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, RemoteAddress) && ConnectionStateTable[CSTableEntry].RemotePort == RemotePort) { ConnectionStateTable[CSTableEntry].State = State; @@ -274,7 +274,7 @@ bool TCP_SetConnectionState(const uint16_t Port, if (ConnectionStateTable[CSTableEntry].State == TCP_Connection_Closed) { ConnectionStateTable[CSTableEntry].Port = Port; - ConnectionStateTable[CSTableEntry].RemoteAddress = RemoteAddress; + ConnectionStateTable[CSTableEntry].RemoteAddress = *RemoteAddress; ConnectionStateTable[CSTableEntry].RemotePort = RemotePort; ConnectionStateTable[CSTableEntry].State = State; return true; @@ -293,7 +293,7 @@ bool TCP_SetConnectionState(const uint16_t Port, * \return A value from the \ref TCP_ConnectionStates_t enum */ uint8_t TCP_GetConnectionState(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort) { /* Note, Port number should be specified in BIG endian to simplify network code */ @@ -302,7 +302,7 @@ uint8_t TCP_GetConnectionState(const uint16_t Port, { /* Find port entry in the table */ if ((ConnectionStateTable[CSTableEntry].Port == Port) && - IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, &RemoteAddress) && + IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, RemoteAddress) && ConnectionStateTable[CSTableEntry].RemotePort == RemotePort) { @@ -322,7 +322,7 @@ uint8_t TCP_GetConnectionState(const uint16_t Port, * \return ConnectionInfo structure of the connection if found, NULL otherwise */ TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort) { /* Note, Port number should be specified in BIG endian to simplify network code */ @@ -331,7 +331,7 @@ TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port, { /* Find port entry in the table */ if ((ConnectionStateTable[CSTableEntry].Port == Port) && - IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, &RemoteAddress) && + IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, RemoteAddress) && ConnectionStateTable[CSTableEntry].RemotePort == RemotePort) { return &ConnectionStateTable[CSTableEntry].Info; @@ -371,12 +371,12 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, { /* Detect SYN from host to start a connection */ if (TCPHeaderIN->Flags & TCP_FLAG_SYN) - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Listen); + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Listen); /* Detect RST from host to abort existing connection */ if (TCPHeaderIN->Flags & TCP_FLAG_RST) { - if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Closed)) { TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK); @@ -386,18 +386,18 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, else { /* Process the incoming TCP packet based on the current connection state for the sender and port */ - switch (TCP_GetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort)) + switch (TCP_GetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort)) { case TCP_Connection_Listen: if (TCPHeaderIN->Flags == TCP_FLAG_SYN) { /* SYN connection starts a connection with a peer */ - if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_SYNReceived)) { TCPHeaderOUT->Flags = (TCP_FLAG_SYN | TCP_FLAG_ACK); - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); ConnectionInfo->SequenceNumberIn = (SwapEndian_32(TCPHeaderIN->SequenceNumber) + 1); ConnectionInfo->SequenceNumberOut = 0; @@ -417,10 +417,10 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, { /* ACK during the connection process completes the connection to a peer */ - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Established); - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); ConnectionInfo->SequenceNumberOut++; @@ -435,10 +435,10 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, TCPHeaderOUT->Flags = (TCP_FLAG_FIN | TCP_FLAG_ACK); PacketResponse = true; - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_CloseWait); - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); ConnectionInfo->SequenceNumberIn++; @@ -446,7 +446,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, } else if ((TCPHeaderIN->Flags == TCP_FLAG_ACK) || (TCPHeaderIN->Flags == (TCP_FLAG_ACK | TCP_FLAG_PSH))) { - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); /* Check if the buffer is currently in use either by a buffered data to send, or receive */ @@ -492,7 +492,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, break; case TCP_Connection_Closing: - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); TCPHeaderOUT->Flags = (TCP_FLAG_ACK | TCP_FLAG_FIN); @@ -500,14 +500,14 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, ConnectionInfo->Buffer.InUse = false; - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_FINWait1); break; case TCP_Connection_FINWait1: if (TCPHeaderIN->Flags == (TCP_FLAG_FIN | TCP_FLAG_ACK)) { - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); TCPHeaderOUT->Flags = TCP_FLAG_ACK; @@ -516,12 +516,12 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, ConnectionInfo->SequenceNumberIn++; ConnectionInfo->SequenceNumberOut++; - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Closed); } else if (TCPHeaderIN->Flags == TCP_FLAG_ACK) { - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_FINWait2); } @@ -529,7 +529,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, case TCP_Connection_FINWait2: if (TCPHeaderIN->Flags == (TCP_FLAG_FIN | TCP_FLAG_ACK)) { - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); TCPHeaderOUT->Flags = TCP_FLAG_ACK; @@ -538,7 +538,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, ConnectionInfo->SequenceNumberIn++; ConnectionInfo->SequenceNumberOut++; - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Closed); } @@ -546,7 +546,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, case TCP_Connection_CloseWait: if (TCPHeaderIN->Flags == TCP_FLAG_ACK) { - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Closed); } @@ -564,7 +564,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, /* Check if we need to respond to the sent packet */ if (PacketResponse) { - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); TCPHeaderOUT->SourcePort = TCPHeaderIN->DestinationPort; @@ -582,8 +582,8 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, TCPHeaderOUT->Checksum = 0; TCPHeaderOUT->Reserved = 0; - TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, IPHeaderIN->DestinationAddress, - IPHeaderIN->SourceAddress, sizeof(TCP_Header_t)); + TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, &IPHeaderIN->DestinationAddress, + &IPHeaderIN->SourceAddress, sizeof(TCP_Header_t)); return sizeof(TCP_Header_t); } @@ -602,19 +602,19 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, * \return A 16-bit TCP checksum value */ static uint16_t TCP_Checksum16(void* TCPHeaderOutStart, - const IP_Address_t SourceAddress, - const IP_Address_t DestinationAddress, - const uint16_t TCPOutSize) + const IP_Address_t* SourceAddress, + const IP_Address_t* DestinationAddress, + uint16_t TCPOutSize) { uint32_t Checksum = 0; /* TCP/IP checksums are the addition of the one's compliment of each word including the IP pseudo-header, complimented */ - Checksum += ((uint16_t*)&SourceAddress)[0]; - Checksum += ((uint16_t*)&SourceAddress)[1]; - Checksum += ((uint16_t*)&DestinationAddress)[0]; - Checksum += ((uint16_t*)&DestinationAddress)[1]; + Checksum += ((uint16_t*)SourceAddress)[0]; + Checksum += ((uint16_t*)SourceAddress)[1]; + Checksum += ((uint16_t*)DestinationAddress)[0]; + Checksum += ((uint16_t*)DestinationAddress)[1]; Checksum += SwapEndian_16(PROTOCOL_TCP); Checksum += SwapEndian_16(TCPOutSize); diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h index f27db1526..d8122707c 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h @@ -236,14 +236,14 @@ void (*Handler)(TCP_ConnectionState_t*, TCP_ConnectionBuffer_t*)); uint8_t TCP_GetPortState(const uint16_t Port); bool TCP_SetConnectionState(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort, const uint8_t State); uint8_t TCP_GetConnectionState(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort); TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort); int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, void* TCPHeaderInStart, @@ -251,8 +251,8 @@ #if defined(INCLUDE_FROM_TCP_C) static uint16_t TCP_Checksum16(void* TCPHeaderOutStart, - const IP_Address_t SourceAddress, - const IP_Address_t DestinationAddress, + const IP_Address_t* SourceAddress, + const IP_Address_t* DestinationAddress, uint16_t TCPOutSize); #endif diff --git a/Demos/Device/ClassDriver/RNDISEthernet/makefile b/Demos/Device/ClassDriver/RNDISEthernet/makefile index 5ec3fc205..1ce41fcd9 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/makefile +++ b/Demos/Device/ClassDriver/RNDISEthernet/makefile @@ -18,7 +18,7 @@ OPTIMIZATION = s TARGET = RNDISEthernet SRC = $(TARGET).c Descriptors.c Lib/Ethernet.c Lib/ProtocolDecoders.c Lib/ICMP.c Lib/TCP.c Lib/UDP.c Lib/DHCP.c Lib/ARP.c \ Lib/IP.c Lib/Webserver.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -26,9 +26,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/VirtualSerial/LUFA VirtualSerial.inf b/Demos/Device/ClassDriver/VirtualSerial/LUFA VirtualSerial.inf index 3951c22d9..8890ba1ad 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/LUFA VirtualSerial.inf +++ b/Demos/Device/ClassDriver/VirtualSerial/LUFA VirtualSerial.inf @@ -1,78 +1,36 @@ ;************************************************************ ; Windows USB CDC ACM Setup File ; Copyright (c) 2000 Microsoft Corporation - +;************************************************************ [Version] Signature="$Windows NT$" Class=Ports ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} Provider=%MFGNAME% -LayoutFile=layout.inf -CatalogFile=%MFGFILENAME%.cat -DriverVer=11/15/2007,5.1.2600.0 +DriverVer=7/1/2012,10.0.0.0 [Manufacturer] -%MFGNAME%=DeviceList, NTamd64 - -[DestinationDirs] -DefaultDestDir=12 - - -;------------------------------------------------------------------------------ -; Windows 2000/XP/Vista-32bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.nt] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.nt -AddReg=DriverInstall.nt.AddReg - -[DriverCopyFiles.nt] -usbser.sys,,,0x20 - -[DriverInstall.nt.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 -[DriverInstall.nt.Services] -AddService=usbser, 0x00000002, DriverService.nt - -[DriverService.nt] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys - -;------------------------------------------------------------------------------ -; Vista-64bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.NTamd64] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.NTamd64 -AddReg=DriverInstall.NTamd64.AddReg +[SourceDisksNames] -[DriverCopyFiles.NTamd64] -%DRIVERFILENAME%.sys,,,0x20 +[SourceDisksFiles] -[DriverInstall.NTamd64.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +[DestinationDirs] +DefaultDestDir=12 -[DriverInstall.NTamd64.Services] -AddService=usbser, 0x00000002, DriverService.NTamd64 +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg -[DriverService.NTamd64] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" ;------------------------------------------------------------------------------ ; Vendor and Product ID Definitions @@ -83,14 +41,14 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ; Note: One INF file can be used for multiple devices with different VID and PIDs. ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. ;------------------------------------------------------------------------------ -[SourceDisksFiles] -[SourceDisksNames] [DeviceList] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044 [DeviceList.NTamd64] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044 +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044 ;------------------------------------------------------------------------------ ; String Definitions @@ -98,9 +56,5 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ;Modify these strings to customize your device ;------------------------------------------------------------------------------ [Strings] -MFGFILENAME="CDC_vista" -DRIVERFILENAME ="usbser" MFGNAME="http://www.lufa-lib.org" -INSTDISK="LUFA CDC Driver Installer" -DESCRIPTION="Communications Port" -SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file +DESCRIPTION="LUFA CDC-ACM Virtual Serial Port" \ No newline at end of file diff --git a/Demos/Device/ClassDriver/VirtualSerial/makefile b/Demos/Device/ClassDriver/VirtualSerial/makefile index 5c1cc1c34..60b1918e3 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/makefile +++ b/Demos/Device/ClassDriver/VirtualSerial/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = VirtualSerial SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/LUFA VirtualSerialMassStorage.inf b/Demos/Device/ClassDriver/VirtualSerialMassStorage/LUFA VirtualSerialMassStorage.inf index dc90ffae0..afe36c6ef 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/LUFA VirtualSerialMassStorage.inf +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/LUFA VirtualSerialMassStorage.inf @@ -1,78 +1,36 @@ ;************************************************************ ; Windows USB CDC ACM Setup File ; Copyright (c) 2000 Microsoft Corporation - +;************************************************************ [Version] Signature="$Windows NT$" Class=Ports ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} Provider=%MFGNAME% -LayoutFile=layout.inf -CatalogFile=%MFGFILENAME%.cat -DriverVer=11/15/2007,5.1.2600.0 +DriverVer=7/1/2012,10.0.0.0 [Manufacturer] -%MFGNAME%=DeviceList, NTamd64 - -[DestinationDirs] -DefaultDestDir=12 - - -;------------------------------------------------------------------------------ -; Windows 2000/XP/Vista-32bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.nt] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.nt -AddReg=DriverInstall.nt.AddReg - -[DriverCopyFiles.nt] -usbser.sys,,,0x20 - -[DriverInstall.nt.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 -[DriverInstall.nt.Services] -AddService=usbser, 0x00000002, DriverService.nt - -[DriverService.nt] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys - -;------------------------------------------------------------------------------ -; Vista-64bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.NTamd64] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.NTamd64 -AddReg=DriverInstall.NTamd64.AddReg +[SourceDisksNames] -[DriverCopyFiles.NTamd64] -%DRIVERFILENAME%.sys,,,0x20 +[SourceDisksFiles] -[DriverInstall.NTamd64.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +[DestinationDirs] +DefaultDestDir=12 -[DriverInstall.NTamd64.Services] -AddService=usbser, 0x00000002, DriverService.NTamd64 +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg -[DriverService.NTamd64] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" ;------------------------------------------------------------------------------ ; Vendor and Product ID Definitions @@ -83,14 +41,14 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ; Note: One INF file can be used for multiple devices with different VID and PIDs. ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. ;------------------------------------------------------------------------------ -[SourceDisksFiles] -[SourceDisksNames] [DeviceList] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2068&MI_00 [DeviceList.NTamd64] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2068&MI_00 +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2068&MI_00 ;------------------------------------------------------------------------------ ; String Definitions @@ -98,9 +56,5 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ;Modify these strings to customize your device ;------------------------------------------------------------------------------ [Strings] -MFGFILENAME="CDC_vista" -DRIVERFILENAME ="usbser" MFGNAME="http://www.lufa-lib.org" -INSTDISK="LUFA CDC/Mass Storage Driver Installer" -DESCRIPTION="Communications Port" -SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file +DESCRIPTION="LUFA CDC-ACM Virtual Serial Port" \ No newline at end of file diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/makefile b/Demos/Device/ClassDriver/VirtualSerialMassStorage/makefile index 062846a37..16a9580a6 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/makefile +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = VirtualSerialMassStorage SRC = $(TARGET).c Descriptors.c Lib/DataflashManager.c Lib/SCSI.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/LUFA VirtualSerialMouse.inf b/Demos/Device/ClassDriver/VirtualSerialMouse/LUFA VirtualSerialMouse.inf index eca012bb2..f3a435271 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/LUFA VirtualSerialMouse.inf +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/LUFA VirtualSerialMouse.inf @@ -1,78 +1,36 @@ ;************************************************************ ; Windows USB CDC ACM Setup File ; Copyright (c) 2000 Microsoft Corporation - +;************************************************************ [Version] Signature="$Windows NT$" Class=Ports ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} Provider=%MFGNAME% -LayoutFile=layout.inf -CatalogFile=%MFGFILENAME%.cat -DriverVer=11/15/2007,5.1.2600.0 +DriverVer=7/1/2012,10.0.0.0 [Manufacturer] -%MFGNAME%=DeviceList, NTamd64 - -[DestinationDirs] -DefaultDestDir=12 - - -;------------------------------------------------------------------------------ -; Windows 2000/XP/Vista-32bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.nt] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.nt -AddReg=DriverInstall.nt.AddReg - -[DriverCopyFiles.nt] -usbser.sys,,,0x20 - -[DriverInstall.nt.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 -[DriverInstall.nt.Services] -AddService=usbser, 0x00000002, DriverService.nt - -[DriverService.nt] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys - -;------------------------------------------------------------------------------ -; Vista-64bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.NTamd64] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.NTamd64 -AddReg=DriverInstall.NTamd64.AddReg +[SourceDisksNames] -[DriverCopyFiles.NTamd64] -%DRIVERFILENAME%.sys,,,0x20 +[SourceDisksFiles] -[DriverInstall.NTamd64.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +[DestinationDirs] +DefaultDestDir=12 -[DriverInstall.NTamd64.Services] -AddService=usbser, 0x00000002, DriverService.NTamd64 +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg -[DriverService.NTamd64] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" ;------------------------------------------------------------------------------ ; Vendor and Product ID Definitions @@ -83,14 +41,14 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ; Note: One INF file can be used for multiple devices with different VID and PIDs. ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. ;------------------------------------------------------------------------------ -[SourceDisksFiles] -[SourceDisksNames] [DeviceList] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2062&MI_00 [DeviceList.NTamd64] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2062&MI_00 +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2062&MI_00 ;------------------------------------------------------------------------------ ; String Definitions @@ -98,9 +56,5 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ;Modify these strings to customize your device ;------------------------------------------------------------------------------ [Strings] -MFGFILENAME="CDC_vista" -DRIVERFILENAME ="usbser" MFGNAME="http://www.lufa-lib.org" -INSTDISK="LUFA CDC/Mouse Driver Installer" -DESCRIPTION="Communications Port" -SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file +DESCRIPTION="LUFA CDC-ACM Virtual Serial Port" \ No newline at end of file diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/makefile b/Demos/Device/ClassDriver/VirtualSerialMouse/makefile index fbefe3f55..e8cb8dee7 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/makefile +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = VirtualSerialMouse SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/ClassDriver/makefile b/Demos/Device/ClassDriver/makefile index 247eb7978..776288f29 100644 --- a/Demos/Device/ClassDriver/makefile +++ b/Demos/Device/ClassDriver/makefile @@ -13,39 +13,34 @@ # custom LUFA library build options are reflected in the compiled # code. -all: - $(MAKE) -s -C AudioInput clean all - $(MAKE) -s -C AudioOutput clean all - $(MAKE) -s -C DualVirtualSerial clean all - $(MAKE) -s -C GenericHID clean all - $(MAKE) -s -C Joystick clean all - $(MAKE) -s -C Keyboard clean all - $(MAKE) -s -C KeyboardMouse clean all - $(MAKE) -s -C KeyboardMouseMultiReport clean all - $(MAKE) -s -C MassStorage clean all - $(MAKE) -s -C MassStorageKeyboard clean all - $(MAKE) -s -C MIDI clean all - $(MAKE) -s -C Mouse clean all - $(MAKE) -s -C RNDISEthernet clean all - $(MAKE) -s -C VirtualSerial clean all - $(MAKE) -s -C VirtualSerialMouse clean all - $(MAKE) -s -C VirtualSerialMassStorage clean all - -%: - $(MAKE) -s -C AudioInput $@ - $(MAKE) -s -C AudioOutput $@ - $(MAKE) -s -C DualVirtualSerial $@ - $(MAKE) -s -C GenericHID $@ - $(MAKE) -s -C Joystick $@ - $(MAKE) -s -C Keyboard $@ - $(MAKE) -s -C KeyboardMouse $@ - $(MAKE) -s -C KeyboardMouseMultiReport $@ - $(MAKE) -s -C MassStorage $@ - $(MAKE) -s -C MassStorageKeyboard $@ - $(MAKE) -s -C MIDI $@ - $(MAKE) -s -C Mouse $@ - $(MAKE) -s -C RNDISEthernet $@ - $(MAKE) -s -C VirtualSerial $@ - $(MAKE) -s -C VirtualSerialMouse $@ - $(MAKE) -s -C VirtualSerialMassStorage $@ +PROJECT_DIRECTORIES := $(shell ls -d */) +# This makefile is potentially infinitely recursive if something really bad +# happens when determining the set of project directories - hard-abort if +# more than 10 levels deep to avoid angry emails. +ifeq ($(MAKELEVEL), 10) + $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) +endif + +# Need to special-case building without a per-project object directory +ifeq ($(OBJDIR),) + # If no target specified, force "clean all" and disallow parallel build + ifeq ($(MAKECMDGOALS),) + MAKECMDGOALS := clean all + .NOTPARALLEL: + endif + + # If one of the targets is to build, force "clean" beforehand and disallow parallel build + ifneq ($(findstring all, $(MAKECMDGOALS)),) + MAKECMDGOALS := clean $(MAKECMDGOALS) + .NOTPARALLEL: + endif +endif + +%: $(PROJECT_DIRECTORIES) + @echo . > /dev/null + +$(PROJECT_DIRECTORIES): + @$(MAKE) -C $@ $(MAKECMDGOALS) + +.PHONY: $(PROJECT_DIRECTORIES) diff --git a/Demos/Device/Incomplete/Sideshow/makefile b/Demos/Device/Incomplete/Sideshow/makefile index 7aa6495ef..07609c0a2 100644 --- a/Demos/Device/Incomplete/Sideshow/makefile +++ b/Demos/Device/Incomplete/Sideshow/makefile @@ -16,8 +16,9 @@ F_CPU = 8000000 F_USB = $(F_CPU) OPTIMIZATION = s TARGET = SideShow -SRC = $(TARGET).c Descriptors.c Lib/SideshowApplications.c Lib/SideshowCommands.c Lib/SideshowCommon.c Lib/SideshowContent.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +SRC = $(TARGET).c Descriptors.c Lib/SideshowApplications.c Lib/SideshowCommands.c \ + Lib/SideshowCommon.c Lib/SideshowContent.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +26,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -#include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h index e45654a27..17f68f3a3 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h +++ b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h @@ -1,84 +1,84 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Copyright 2010 Peter Lawrence (majbthrd [at] gmail [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Header file for Descriptors.c. - */ - -#ifndef _DESCRIPTORS_H_ -#define _DESCRIPTORS_H_ - - /* Includes: */ - #include - - #include - - /* Macros: */ - /** Endpoint address of the TMC notification IN endpoint. */ - #define TMC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2) - - /** Endpoint address of the TMC device-to-host data IN endpoint. */ - #define TMC_IN_EPADDR (ENDPOINT_DIR_IN | 3) - - /** Endpoint address of the TMC host-to-device data OUT endpoint. */ - #define TMC_OUT_EPADDR (ENDPOINT_DIR_OUT | 4) - - /** Size in bytes of the TMC data endpoints. */ - #define TMC_IO_EPSIZE 64 - - /** Size in bytes of the TMC notification endpoint. */ - #define TMC_NOTIFICATION_EPSIZE 8 - - /* Type Defines: */ - /** Type define for the device configuration descriptor structure. This must be defined in the - * application code, as the configuration descriptor contains several sub-descriptors which - * vary between devices, and which describe the device's usage to the host. - */ - typedef struct - { - USB_Descriptor_Configuration_Header_t Config; - - // Test and Measurement Interface - USB_Descriptor_Interface_t TM_Interface; - USB_Descriptor_Endpoint_t TM_DataOutEndpoint; - USB_Descriptor_Endpoint_t TM_DataInEndpoint; - USB_Descriptor_Endpoint_t TM_NotificationEndpoint; - } USB_Descriptor_Configuration_t; - - /* Function Prototypes: */ - uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint8_t wIndex, - const void** const DescriptorAddress) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); - -#endif +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2010 Peter Lawrence (majbthrd [at] gmail [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * Header file for Descriptors.c. + */ + +#ifndef _DESCRIPTORS_H_ +#define _DESCRIPTORS_H_ + + /* Includes: */ + #include + + #include + + /* Macros: */ + /** Endpoint address of the TMC notification IN endpoint. */ + #define TMC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2) + + /** Endpoint address of the TMC device-to-host data IN endpoint. */ + #define TMC_IN_EPADDR (ENDPOINT_DIR_IN | 3) + + /** Endpoint address of the TMC host-to-device data OUT endpoint. */ + #define TMC_OUT_EPADDR (ENDPOINT_DIR_OUT | 4) + + /** Size in bytes of the TMC data endpoints. */ + #define TMC_IO_EPSIZE 64 + + /** Size in bytes of the TMC notification endpoint. */ + #define TMC_NOTIFICATION_EPSIZE 8 + + /* Type Defines: */ + /** Type define for the device configuration descriptor structure. This must be defined in the + * application code, as the configuration descriptor contains several sub-descriptors which + * vary between devices, and which describe the device's usage to the host. + */ + typedef struct + { + USB_Descriptor_Configuration_Header_t Config; + + // Test and Measurement Interface + USB_Descriptor_Interface_t TM_Interface; + USB_Descriptor_Endpoint_t TM_DataOutEndpoint; + USB_Descriptor_Endpoint_t TM_DataInEndpoint; + USB_Descriptor_Endpoint_t TM_NotificationEndpoint; + } USB_Descriptor_Configuration_t; + + /* Function Prototypes: */ + uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress) + ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); + +#endif diff --git a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c index 5102f101c..027264ab5 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c +++ b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c @@ -71,7 +71,7 @@ static uint16_t LastTransferLength = 0; static uint8_t NextResponseBuffer[64]; /** Indicates the length of the next response to send */ -static uint8_t NextReponseLen; +static uint8_t NextResponseLen; /** Main program entry point. This routine contains the overall program flow, including initial * setup of all components and the main program loop. @@ -326,16 +326,16 @@ void ProcessSentMessage(uint8_t* const Data, const uint8_t Length) if (strncmp((char*)Data, "*IDN?", 5) == 0) strcpy((char*)NextResponseBuffer, "LUFA TMC DEMO"); - NextReponseLen = strlen((char*)NextResponseBuffer); + NextResponseLen = strlen((char*)NextResponseBuffer); } uint8_t GetNextMessage(uint8_t* const Data) { strcpy((char*)NextResponseBuffer, "LUFA TMC DEMO"); - NextReponseLen = strlen((char*)NextResponseBuffer); + NextResponseLen = strlen((char*)NextResponseBuffer); // --- - uint8_t DataLen = MIN(NextReponseLen, 64); + uint8_t DataLen = MIN(NextResponseLen, 64); strlcpy((char*)Data, (char*)NextResponseBuffer, DataLen); diff --git a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h index bd93154f8..9fa9f23d0 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h +++ b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h @@ -1,149 +1,149 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#ifndef _TESTANDMEASUREMENT_H_ -#define _TESTANDMEASUREMENT_H_ - - /* Includes: */ - #include - #include - #include - #include - - #include "Descriptors.h" - - #include - #include - - /* Macros: */ - /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ - #define LEDMASK_USB_NOTREADY LEDS_LED1 - - /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ - #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) - - /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ - #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) - - /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ - #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) - - /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ - #define LEDMASK_USB_BUSY LEDS_LED2 - - #define Req_InitiateAbortBulkOut 0x01 - #define Req_CheckAbortBulkOutStatus 0x02 - #define Req_InitiateAbortBulkIn 0x03 - #define Req_CheckAbortBulkInStatus 0x04 - #define Req_InitiateClear 0x05 - #define Req_CheckClearStatus 0x06 - #define Req_GetCapabilities 0x07 - #define Req_IndicatorPulse 0x40 - - #define TMC_STATUS_SUCCESS 0x01 - #define TMC_STATUS_PENDING 0x02 - #define TMC_STATUS_FAILED 0x80 - #define TMC_STATUS_TRANSFER_NOT_IN_PROGRESS 0x81 - #define TMC_STATUS_SPLIT_NOT_IN_PROGRESS 0x82 - #define TMC_STATUS_SPLIT_IN_PROGRESS 0x83 - - #define TMC_MESSAGEID_DEV_DEP_MSG_OUT 0x01 - #define TMC_MESSAGEID_DEV_DEP_MSG_IN 0x02 - #define TMC_MESSAGEID_DEV_VENDOR_OUT 0x7E - #define TMC_MESSAGEID_DEV_VENDOR_IN 0x7F - - /* Type Defines */ - typedef struct - { - uint8_t Status; - uint8_t Reserved; - - uint16_t TMCVersion; - - struct - { - unsigned ListenOnly : 1; - unsigned TalkOnly : 1; - unsigned PulseIndicateSupported : 1; - unsigned Reserved : 5; - } Interface; - - struct - { - unsigned SupportsAbortINOnMatch : 1; - unsigned Reserved : 7; - } Device; - - uint8_t Reserved2[6]; - uint8_t Reserved3[12]; - } TMC_Capabilities_t; - - typedef struct - { - uint8_t LastMessageTransaction; - uint8_t TermChar; - uint8_t Reserved[2]; - } TMC_DevOUTMessageHeader_t; - - typedef struct - { - uint8_t LastMessageTransaction; - uint8_t Reserved[3]; - } TMC_DevINMessageHeader_t; - - typedef struct - { - uint8_t MessageID; - uint8_t Tag; - uint8_t InverseTag; - uint8_t Reserved; - uint32_t TransferSize; - - union - { - TMC_DevOUTMessageHeader_t DeviceOUT; - TMC_DevINMessageHeader_t DeviceIN; - uint32_t VendorSpecific; - } MessageIDSpecific; - } TMC_MessageHeader_t; - - /* Function Prototypes: */ - void SetupHardware(void); - void TMC_Task(void); - bool ReadTMCHeader(TMC_MessageHeader_t* const MessageHeader); - bool WriteTMCHeader(TMC_MessageHeader_t* const MessageHeader); - - void EVENT_USB_Device_Connect(void); - void EVENT_USB_Device_Disconnect(void); - void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); - -#endif +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +#ifndef _TESTANDMEASUREMENT_H_ +#define _TESTANDMEASUREMENT_H_ + + /* Includes: */ + #include + #include + #include + #include + + #include "Descriptors.h" + + #include + #include + + /* Macros: */ + /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ + #define LEDMASK_USB_NOTREADY LEDS_LED1 + + /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ + #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) + + /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ + #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) + + /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ + #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) + + /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ + #define LEDMASK_USB_BUSY LEDS_LED2 + + #define Req_InitiateAbortBulkOut 0x01 + #define Req_CheckAbortBulkOutStatus 0x02 + #define Req_InitiateAbortBulkIn 0x03 + #define Req_CheckAbortBulkInStatus 0x04 + #define Req_InitiateClear 0x05 + #define Req_CheckClearStatus 0x06 + #define Req_GetCapabilities 0x07 + #define Req_IndicatorPulse 0x40 + + #define TMC_STATUS_SUCCESS 0x01 + #define TMC_STATUS_PENDING 0x02 + #define TMC_STATUS_FAILED 0x80 + #define TMC_STATUS_TRANSFER_NOT_IN_PROGRESS 0x81 + #define TMC_STATUS_SPLIT_NOT_IN_PROGRESS 0x82 + #define TMC_STATUS_SPLIT_IN_PROGRESS 0x83 + + #define TMC_MESSAGEID_DEV_DEP_MSG_OUT 0x01 + #define TMC_MESSAGEID_DEV_DEP_MSG_IN 0x02 + #define TMC_MESSAGEID_DEV_VENDOR_OUT 0x7E + #define TMC_MESSAGEID_DEV_VENDOR_IN 0x7F + + /* Type Defines */ + typedef struct + { + uint8_t Status; + uint8_t Reserved; + + uint16_t TMCVersion; + + struct + { + unsigned ListenOnly : 1; + unsigned TalkOnly : 1; + unsigned PulseIndicateSupported : 1; + unsigned Reserved : 5; + } Interface; + + struct + { + unsigned SupportsAbortINOnMatch : 1; + unsigned Reserved : 7; + } Device; + + uint8_t Reserved2[6]; + uint8_t Reserved3[12]; + } TMC_Capabilities_t; + + typedef struct + { + uint8_t LastMessageTransaction; + uint8_t TermChar; + uint8_t Reserved[2]; + } TMC_DevOUTMessageHeader_t; + + typedef struct + { + uint8_t LastMessageTransaction; + uint8_t Reserved[3]; + } TMC_DevINMessageHeader_t; + + typedef struct + { + uint8_t MessageID; + uint8_t Tag; + uint8_t InverseTag; + uint8_t Reserved; + uint32_t TransferSize; + + union + { + TMC_DevOUTMessageHeader_t DeviceOUT; + TMC_DevINMessageHeader_t DeviceIN; + uint32_t VendorSpecific; + } MessageIDSpecific; + } TMC_MessageHeader_t; + + /* Function Prototypes: */ + void SetupHardware(void); + void TMC_Task(void); + bool ReadTMCHeader(TMC_MessageHeader_t* const MessageHeader); + bool WriteTMCHeader(TMC_MessageHeader_t* const MessageHeader); + + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_ControlRequest(void); + +#endif diff --git a/Demos/Device/Incomplete/TestAndMeasurement/makefile b/Demos/Device/Incomplete/TestAndMeasurement/makefile index 43070333c..13501183a 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/makefile +++ b/Demos/Device/Incomplete/TestAndMeasurement/makefile @@ -17,17 +17,20 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = TestAndMeasurement SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -LD_FLAGS = +LD_FLAGS = # Default target all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -#include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/AudioInput/makefile b/Demos/Device/LowLevel/AudioInput/makefile index ec2ed17f1..573918363 100644 --- a/Demos/Device/LowLevel/AudioInput/makefile +++ b/Demos/Device/LowLevel/AudioInput/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = AudioInput SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/AudioOutput/makefile b/Demos/Device/LowLevel/AudioOutput/makefile index 336c7589f..f57433a3d 100644 --- a/Demos/Device/LowLevel/AudioOutput/makefile +++ b/Demos/Device/LowLevel/AudioOutput/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = AudioOutput SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/DualVirtualSerial/LUFA DualVirtualSerial.inf b/Demos/Device/LowLevel/DualVirtualSerial/LUFA DualVirtualSerial.inf index dd721a710..54ef70d42 100644 --- a/Demos/Device/LowLevel/DualVirtualSerial/LUFA DualVirtualSerial.inf +++ b/Demos/Device/LowLevel/DualVirtualSerial/LUFA DualVirtualSerial.inf @@ -1,78 +1,36 @@ ;************************************************************ ; Windows USB CDC ACM Setup File ; Copyright (c) 2000 Microsoft Corporation - +;************************************************************ [Version] Signature="$Windows NT$" Class=Ports ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} Provider=%MFGNAME% -LayoutFile=layout.inf -CatalogFile=%MFGFILENAME%.cat -DriverVer=11/15/2007,5.1.2600.0 +DriverVer=7/1/2012,10.0.0.0 [Manufacturer] -%MFGNAME%=DeviceList, NTamd64 - -[DestinationDirs] -DefaultDestDir=12 - - -;------------------------------------------------------------------------------ -; Windows 2000/XP/Vista-32bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.nt] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.nt -AddReg=DriverInstall.nt.AddReg - -[DriverCopyFiles.nt] -usbser.sys,,,0x20 - -[DriverInstall.nt.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 -[DriverInstall.nt.Services] -AddService=usbser, 0x00000002, DriverService.nt - -[DriverService.nt] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys - -;------------------------------------------------------------------------------ -; Vista-64bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.NTamd64] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.NTamd64 -AddReg=DriverInstall.NTamd64.AddReg +[SourceDisksNames] -[DriverCopyFiles.NTamd64] -%DRIVERFILENAME%.sys,,,0x20 +[SourceDisksFiles] -[DriverInstall.NTamd64.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +[DestinationDirs] +DefaultDestDir=12 -[DriverInstall.NTamd64.Services] -AddService=usbser, 0x00000002, DriverService.NTamd64 +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg -[DriverService.NTamd64] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" ;------------------------------------------------------------------------------ ; Vendor and Product ID Definitions @@ -83,14 +41,14 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ; Note: One INF file can be used for multiple devices with different VID and PIDs. ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. ;------------------------------------------------------------------------------ -[SourceDisksFiles] -[SourceDisksNames] [DeviceList] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204E&MI_00, USB\VID_03EB&PID_204E&MI_02 [DeviceList.NTamd64] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204E&MI_00, USB\VID_03EB&PID_204E&MI_02 +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204E&MI_00, USB\VID_03EB&PID_204E&MI_02 ;------------------------------------------------------------------------------ ; String Definitions @@ -98,9 +56,5 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ;Modify these strings to customize your device ;------------------------------------------------------------------------------ [Strings] -MFGFILENAME="CDC_vista" -DRIVERFILENAME ="usbser" MFGNAME="http://www.lufa-lib.org" -INSTDISK="LUFA Dual CDC Driver Installer" -DESCRIPTION="Communications Port" -SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file +DESCRIPTION="LUFA CDC-ACM Virtual Serial Port" \ No newline at end of file diff --git a/Demos/Device/LowLevel/DualVirtualSerial/makefile b/Demos/Device/LowLevel/DualVirtualSerial/makefile index c3f1a9a1f..9e53253ae 100644 --- a/Demos/Device/LowLevel/DualVirtualSerial/makefile +++ b/Demos/Device/LowLevel/DualVirtualSerial/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = DualVirtualSerial SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/GenericHID/makefile b/Demos/Device/LowLevel/GenericHID/makefile index 4579b6641..691efd531 100644 --- a/Demos/Device/LowLevel/GenericHID/makefile +++ b/Demos/Device/LowLevel/GenericHID/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = GenericHID SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/Joystick/makefile b/Demos/Device/LowLevel/Joystick/makefile index 729892e99..68dc16c9c 100644 --- a/Demos/Device/LowLevel/Joystick/makefile +++ b/Demos/Device/LowLevel/Joystick/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = Joystick SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/Keyboard/makefile b/Demos/Device/LowLevel/Keyboard/makefile index 31d1be650..e1783fd48 100644 --- a/Demos/Device/LowLevel/Keyboard/makefile +++ b/Demos/Device/LowLevel/Keyboard/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = Keyboard SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h index 178f5ed99..5a59b4d60 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h +++ b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h @@ -61,7 +61,6 @@ USB_Descriptor_Interface_t HID2_MouseInterface; USB_HID_Descriptor_HID_t HID2_MouseHID; USB_Descriptor_Endpoint_t HID2_ReportINEndpoint; - USB_Descriptor_Endpoint_t HID2_ReportOUTEndpoint; } USB_Descriptor_Configuration_t; /* Macros: */ diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c index a916659ea..f932a32f3 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c @@ -181,7 +181,7 @@ void EVENT_USB_Device_ControlRequest(void) /** Processes a given Keyboard LED report from the host, and sets the board LEDs to match. Since the Keyboard * LED report can be sent through either the control endpoint (via a HID SetReport request) or the HID OUT * endpoint, the processing code is placed here to avoid duplicating it and potentially having different - * behaviour depending on the method used to sent it. + * behavior depending on the method used to sent it. */ void Keyboard_ProcessLEDReport(const uint8_t LEDStatus) { diff --git a/Demos/Device/LowLevel/KeyboardMouse/makefile b/Demos/Device/LowLevel/KeyboardMouse/makefile index 697ab299f..6537983af 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/makefile +++ b/Demos/Device/LowLevel/KeyboardMouse/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = KeyboardMouse SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/MIDI/makefile b/Demos/Device/LowLevel/MIDI/makefile index 599cdb273..432ae46e6 100644 --- a/Demos/Device/LowLevel/MIDI/makefile +++ b/Demos/Device/LowLevel/MIDI/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MIDI SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/MassStorage/makefile b/Demos/Device/LowLevel/MassStorage/makefile index f677e9f31..5ad4ec025 100644 --- a/Demos/Device/LowLevel/MassStorage/makefile +++ b/Demos/Device/LowLevel/MassStorage/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MassStorage SRC = $(TARGET).c Descriptors.c Lib/DataflashManager.c Lib/SCSI.c $(LUFA_SRC_USB) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/Mouse/makefile b/Demos/Device/LowLevel/Mouse/makefile index c40abfa30..6df68a7f4 100644 --- a/Demos/Device/LowLevel/Mouse/makefile +++ b/Demos/Device/LowLevel/Mouse/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = Mouse SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c index 374a102bf..2e40cf54d 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c @@ -111,8 +111,8 @@ void TCP_Task(void) ConnectionStateTable[CSTableEntry].Info.SequenceNumberOut += PacketSize; - TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, ServerIPAddress, - ConnectionStateTable[CSTableEntry].RemoteAddress, + TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, &ServerIPAddress, + &ConnectionStateTable[CSTableEntry].RemoteAddress, (sizeof(TCP_Header_t) + PacketSize)); PacketSize += sizeof(TCP_Header_t); @@ -249,7 +249,7 @@ uint8_t TCP_GetPortState(const uint16_t Port) * \return Boolean true if the connection was updated or created, false otherwise (no more space in the connection state table) */ bool TCP_SetConnectionState(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort, const uint8_t State) { @@ -259,7 +259,7 @@ bool TCP_SetConnectionState(const uint16_t Port, { /* Find port entry in the table */ if ((ConnectionStateTable[CSTableEntry].Port == Port) && - IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, &RemoteAddress) && + IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, RemoteAddress) && ConnectionStateTable[CSTableEntry].RemotePort == RemotePort) { ConnectionStateTable[CSTableEntry].State = State; @@ -273,7 +273,7 @@ bool TCP_SetConnectionState(const uint16_t Port, if (ConnectionStateTable[CSTableEntry].State == TCP_Connection_Closed) { ConnectionStateTable[CSTableEntry].Port = Port; - ConnectionStateTable[CSTableEntry].RemoteAddress = RemoteAddress; + ConnectionStateTable[CSTableEntry].RemoteAddress = *RemoteAddress; ConnectionStateTable[CSTableEntry].RemotePort = RemotePort; ConnectionStateTable[CSTableEntry].State = State; return true; @@ -292,7 +292,7 @@ bool TCP_SetConnectionState(const uint16_t Port, * \return A value from the \ref TCP_ConnectionStates_t enum */ uint8_t TCP_GetConnectionState(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort) { /* Note, Port number should be specified in BIG endian to simplify network code */ @@ -301,7 +301,7 @@ uint8_t TCP_GetConnectionState(const uint16_t Port, { /* Find port entry in the table */ if ((ConnectionStateTable[CSTableEntry].Port == Port) && - IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, &RemoteAddress) && + IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, RemoteAddress) && ConnectionStateTable[CSTableEntry].RemotePort == RemotePort) { @@ -321,7 +321,7 @@ uint8_t TCP_GetConnectionState(const uint16_t Port, * \return ConnectionInfo structure of the connection if found, NULL otherwise */ TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort) { /* Note, Port number should be specified in BIG endian to simplify network code */ @@ -330,7 +330,7 @@ TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port, { /* Find port entry in the table */ if ((ConnectionStateTable[CSTableEntry].Port == Port) && - IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, &RemoteAddress) && + IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, RemoteAddress) && ConnectionStateTable[CSTableEntry].RemotePort == RemotePort) { return &ConnectionStateTable[CSTableEntry].Info; @@ -370,12 +370,12 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, { /* Detect SYN from host to start a connection */ if (TCPHeaderIN->Flags & TCP_FLAG_SYN) - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Listen); + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Listen); /* Detect RST from host to abort existing connection */ if (TCPHeaderIN->Flags & TCP_FLAG_RST) { - if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Closed)) { TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK); @@ -385,18 +385,18 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, else { /* Process the incoming TCP packet based on the current connection state for the sender and port */ - switch (TCP_GetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort)) + switch (TCP_GetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort)) { case TCP_Connection_Listen: if (TCPHeaderIN->Flags == TCP_FLAG_SYN) { /* SYN connection starts a connection with a peer */ - if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_SYNReceived)) { TCPHeaderOUT->Flags = (TCP_FLAG_SYN | TCP_FLAG_ACK); - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); ConnectionInfo->SequenceNumberIn = (SwapEndian_32(TCPHeaderIN->SequenceNumber) + 1); ConnectionInfo->SequenceNumberOut = 0; @@ -416,10 +416,10 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, { /* ACK during the connection process completes the connection to a peer */ - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Established); - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); ConnectionInfo->SequenceNumberOut++; @@ -434,10 +434,10 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, TCPHeaderOUT->Flags = (TCP_FLAG_FIN | TCP_FLAG_ACK); PacketResponse = true; - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_CloseWait); - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); ConnectionInfo->SequenceNumberIn++; @@ -445,7 +445,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, } else if ((TCPHeaderIN->Flags == TCP_FLAG_ACK) || (TCPHeaderIN->Flags == (TCP_FLAG_ACK | TCP_FLAG_PSH))) { - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); /* Check if the buffer is currently in use either by a buffered data to send, or receive */ @@ -491,7 +491,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, break; case TCP_Connection_Closing: - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); TCPHeaderOUT->Flags = (TCP_FLAG_ACK | TCP_FLAG_FIN); @@ -499,14 +499,14 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, ConnectionInfo->Buffer.InUse = false; - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_FINWait1); break; case TCP_Connection_FINWait1: if (TCPHeaderIN->Flags == (TCP_FLAG_FIN | TCP_FLAG_ACK)) { - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); TCPHeaderOUT->Flags = TCP_FLAG_ACK; @@ -515,12 +515,12 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, ConnectionInfo->SequenceNumberIn++; ConnectionInfo->SequenceNumberOut++; - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Closed); } else if (TCPHeaderIN->Flags == TCP_FLAG_ACK) { - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_FINWait2); } @@ -528,7 +528,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, case TCP_Connection_FINWait2: if (TCPHeaderIN->Flags == (TCP_FLAG_FIN | TCP_FLAG_ACK)) { - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); TCPHeaderOUT->Flags = TCP_FLAG_ACK; @@ -537,7 +537,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, ConnectionInfo->SequenceNumberIn++; ConnectionInfo->SequenceNumberOut++; - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Closed); } @@ -545,7 +545,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, case TCP_Connection_CloseWait: if (TCPHeaderIN->Flags == TCP_FLAG_ACK) { - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Closed); } @@ -563,7 +563,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, /* Check if we need to respond to the sent packet */ if (PacketResponse) { - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); TCPHeaderOUT->SourcePort = TCPHeaderIN->DestinationPort; @@ -581,8 +581,8 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, TCPHeaderOUT->Checksum = 0; TCPHeaderOUT->Reserved = 0; - TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, IPHeaderIN->DestinationAddress, - IPHeaderIN->SourceAddress, sizeof(TCP_Header_t)); + TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, &IPHeaderIN->DestinationAddress, + &IPHeaderIN->SourceAddress, sizeof(TCP_Header_t)); return sizeof(TCP_Header_t); } @@ -601,8 +601,8 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, * \return A 16-bit TCP checksum value */ static uint16_t TCP_Checksum16(void* TCPHeaderOutStart, - const IP_Address_t SourceAddress, - const IP_Address_t DestinationAddress, + const IP_Address_t* SourceAddress, + const IP_Address_t* DestinationAddress, uint16_t TCPOutSize) { uint32_t Checksum = 0; @@ -610,10 +610,10 @@ static uint16_t TCP_Checksum16(void* TCPHeaderOutStart, /* TCP/IP checksums are the addition of the one's compliment of each word including the IP pseudo-header, complimented */ - Checksum += ((uint16_t*)&SourceAddress)[0]; - Checksum += ((uint16_t*)&SourceAddress)[1]; - Checksum += ((uint16_t*)&DestinationAddress)[0]; - Checksum += ((uint16_t*)&DestinationAddress)[1]; + Checksum += ((uint16_t*)SourceAddress)[0]; + Checksum += ((uint16_t*)SourceAddress)[1]; + Checksum += ((uint16_t*)DestinationAddress)[0]; + Checksum += ((uint16_t*)DestinationAddress)[1]; Checksum += SwapEndian_16(PROTOCOL_TCP); Checksum += SwapEndian_16(TCPOutSize); diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h index e49433af9..4f901484e 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h @@ -236,14 +236,14 @@ void (*Handler)(TCP_ConnectionState_t*, TCP_ConnectionBuffer_t*)); uint8_t TCP_GetPortState(const uint16_t Port); bool TCP_SetConnectionState(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort, const uint8_t State); uint8_t TCP_GetConnectionState(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort); TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port, - const IP_Address_t RemoteAddress, + const IP_Address_t* RemoteAddress, const uint16_t RemotePort); int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, void* TCPHeaderInStart, @@ -251,8 +251,8 @@ #if defined(INCLUDE_FROM_TCP_C) static uint16_t TCP_Checksum16(void* TCPHeaderOutStart, - const IP_Address_t SourceAddress, - const IP_Address_t DestinationAddress, + const IP_Address_t* SourceAddress, + const IP_Address_t* DestinationAddress, uint16_t TCPOutSize); #endif diff --git a/Demos/Device/LowLevel/RNDISEthernet/makefile b/Demos/Device/LowLevel/RNDISEthernet/makefile index 096f8498d..37f70c271 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/makefile +++ b/Demos/Device/LowLevel/RNDISEthernet/makefile @@ -18,7 +18,7 @@ OPTIMIZATION = s TARGET = RNDISEthernet SRC = $(TARGET).c Descriptors.c Lib/Ethernet.c Lib/ProtocolDecoders.c Lib/RNDIS.c Lib/ICMP.c Lib/TCP.c Lib/UDP.c \ Lib/DHCP.c Lib/ARP.c Lib/IP.c Lib/Webserver.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -26,9 +26,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/VirtualSerial/LUFA VirtualSerial.inf b/Demos/Device/LowLevel/VirtualSerial/LUFA VirtualSerial.inf index 3951c22d9..8890ba1ad 100644 --- a/Demos/Device/LowLevel/VirtualSerial/LUFA VirtualSerial.inf +++ b/Demos/Device/LowLevel/VirtualSerial/LUFA VirtualSerial.inf @@ -1,78 +1,36 @@ ;************************************************************ ; Windows USB CDC ACM Setup File ; Copyright (c) 2000 Microsoft Corporation - +;************************************************************ [Version] Signature="$Windows NT$" Class=Ports ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} Provider=%MFGNAME% -LayoutFile=layout.inf -CatalogFile=%MFGFILENAME%.cat -DriverVer=11/15/2007,5.1.2600.0 +DriverVer=7/1/2012,10.0.0.0 [Manufacturer] -%MFGNAME%=DeviceList, NTamd64 - -[DestinationDirs] -DefaultDestDir=12 - - -;------------------------------------------------------------------------------ -; Windows 2000/XP/Vista-32bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.nt] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.nt -AddReg=DriverInstall.nt.AddReg - -[DriverCopyFiles.nt] -usbser.sys,,,0x20 - -[DriverInstall.nt.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 -[DriverInstall.nt.Services] -AddService=usbser, 0x00000002, DriverService.nt - -[DriverService.nt] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys - -;------------------------------------------------------------------------------ -; Vista-64bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.NTamd64] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.NTamd64 -AddReg=DriverInstall.NTamd64.AddReg +[SourceDisksNames] -[DriverCopyFiles.NTamd64] -%DRIVERFILENAME%.sys,,,0x20 +[SourceDisksFiles] -[DriverInstall.NTamd64.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +[DestinationDirs] +DefaultDestDir=12 -[DriverInstall.NTamd64.Services] -AddService=usbser, 0x00000002, DriverService.NTamd64 +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg -[DriverService.NTamd64] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" ;------------------------------------------------------------------------------ ; Vendor and Product ID Definitions @@ -83,14 +41,14 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ; Note: One INF file can be used for multiple devices with different VID and PIDs. ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. ;------------------------------------------------------------------------------ -[SourceDisksFiles] -[SourceDisksNames] [DeviceList] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044 [DeviceList.NTamd64] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044 +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044 ;------------------------------------------------------------------------------ ; String Definitions @@ -98,9 +56,5 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ;Modify these strings to customize your device ;------------------------------------------------------------------------------ [Strings] -MFGFILENAME="CDC_vista" -DRIVERFILENAME ="usbser" MFGNAME="http://www.lufa-lib.org" -INSTDISK="LUFA CDC Driver Installer" -DESCRIPTION="Communications Port" -SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file +DESCRIPTION="LUFA CDC-ACM Virtual Serial Port" \ No newline at end of file diff --git a/Demos/Device/LowLevel/VirtualSerial/makefile b/Demos/Device/LowLevel/VirtualSerial/makefile index 669cd4f7c..f005d1991 100644 --- a/Demos/Device/LowLevel/VirtualSerial/makefile +++ b/Demos/Device/LowLevel/VirtualSerial/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = VirtualSerial SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Device/LowLevel/makefile b/Demos/Device/LowLevel/makefile index 85c86058e..776288f29 100644 --- a/Demos/Device/LowLevel/makefile +++ b/Demos/Device/LowLevel/makefile @@ -13,31 +13,34 @@ # custom LUFA library build options are reflected in the compiled # code. -all: - $(MAKE) -s -C AudioInput clean all - $(MAKE) -s -C AudioOutput clean all - $(MAKE) -s -C DualVirtualSerial clean all - $(MAKE) -s -C GenericHID clean all - $(MAKE) -s -C Joystick clean all - $(MAKE) -s -C Keyboard clean all - $(MAKE) -s -C KeyboardMouse clean all - $(MAKE) -s -C MassStorage clean all - $(MAKE) -s -C MIDI clean all - $(MAKE) -s -C Mouse clean all - $(MAKE) -s -C RNDISEthernet clean all - $(MAKE) -s -C VirtualSerial clean all - -%: - $(MAKE) -s -C AudioInput $@ - $(MAKE) -s -C AudioOutput $@ - $(MAKE) -s -C DualVirtualSerial $@ - $(MAKE) -s -C GenericHID $@ - $(MAKE) -s -C Joystick $@ - $(MAKE) -s -C Keyboard $@ - $(MAKE) -s -C KeyboardMouse $@ - $(MAKE) -s -C MassStorage $@ - $(MAKE) -s -C MIDI $@ - $(MAKE) -s -C Mouse $@ - $(MAKE) -s -C RNDISEthernet $@ - $(MAKE) -s -C VirtualSerial $@ +PROJECT_DIRECTORIES := $(shell ls -d */) +# This makefile is potentially infinitely recursive if something really bad +# happens when determining the set of project directories - hard-abort if +# more than 10 levels deep to avoid angry emails. +ifeq ($(MAKELEVEL), 10) + $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) +endif + +# Need to special-case building without a per-project object directory +ifeq ($(OBJDIR),) + # If no target specified, force "clean all" and disallow parallel build + ifeq ($(MAKECMDGOALS),) + MAKECMDGOALS := clean all + .NOTPARALLEL: + endif + + # If one of the targets is to build, force "clean" beforehand and disallow parallel build + ifneq ($(findstring all, $(MAKECMDGOALS)),) + MAKECMDGOALS := clean $(MAKECMDGOALS) + .NOTPARALLEL: + endif +endif + +%: $(PROJECT_DIRECTORIES) + @echo . > /dev/null + +$(PROJECT_DIRECTORIES): + @$(MAKE) -C $@ $(MAKECMDGOALS) + +.PHONY: $(PROJECT_DIRECTORIES) diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/makefile b/Demos/DualRole/ClassDriver/MouseHostDevice/makefile index a04f53364..f979d02ce 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/makefile +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MouseHostDevice SRC = $(TARGET).c Descriptors.c DeviceFunctions.c HostFunctions.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/DualRole/ClassDriver/makefile b/Demos/DualRole/ClassDriver/makefile index 28e06a3c1..6d16493ee 100644 --- a/Demos/DualRole/ClassDriver/makefile +++ b/Demos/DualRole/ClassDriver/makefile @@ -13,9 +13,34 @@ # custom LUFA library build options are reflected in the compiled # code. -all: - $(MAKE) -s -C MouseHostDevice clean all +PROJECT_DIRECTORIES := $(shell ls -d */) -%: - $(MAKE) -s -C MouseHostDevice $@ +# This makefile is potentially infinitely recursive if something really bad +# happens when determining the set of project directories - hard-abort if +# more than 10 levels deep to avoid angry emails. +ifeq ($(MAKELEVEL), 10) + $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) +endif +# Need to special-case building without a per-project object directory +ifeq ($(OBJDIR),) + # If no target specified, force "clean all" and disallow parallel build + ifeq ($(MAKECMDGOALS),) + MAKECMDGOALS := clean all + .NOTPARALLEL: + endif + + # If one of the targets is to build, force "clean" beforehand and disallow parallel build + ifneq ($(findstring all, $(MAKECMDGOALS)),) + MAKECMDGOALS := clean $(MAKECMDGOALS) + .NOTPARALLEL: + endif +endif + +%: $(PROJECT_DIRECTORIES) + @echo . > /dev/null + +$(PROJECT_DIRECTORIES): + @$(MAKE) -C $@ $(MAKECMDGOALS) + +.PHONY: $(PROJECT_DIRECTORIES) diff --git a/Demos/DualRole/makefile b/Demos/DualRole/makefile index dbfe9995c..aaca62575 100644 --- a/Demos/DualRole/makefile +++ b/Demos/DualRole/makefile @@ -16,5 +16,5 @@ all: %: - $(MAKE) -C ClassDriver/ $@ + $(MAKE) -C ClassDriver $@ diff --git a/Demos/Host/ClassDriver/AndroidAccessoryHost/AndroidAccessoryHost.c b/Demos/Host/ClassDriver/AndroidAccessoryHost/AndroidAccessoryHost.c index 4c53cc221..b1e988cca 100644 --- a/Demos/Host/ClassDriver/AndroidAccessoryHost/AndroidAccessoryHost.c +++ b/Demos/Host/ClassDriver/AndroidAccessoryHost/AndroidAccessoryHost.c @@ -1,232 +1,232 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Main source file for the AndroidAccessoryHost demo. This file contains the main tasks of - * the demo and is responsible for the initial application hardware configuration. - */ - -#include "AndroidAccessoryHost.h" - -/** LUFA Android Open Accessory Class driver interface configuration and state information. This - * structure is passed to all Android Open Accessory Class driver functions, so that multiple - * instances of the same class within a device can be differentiated from one another. - */ -USB_ClassInfo_AOA_Host_t AndroidDevice_AOA_Interface = - { - .Config = - { - .DataINPipe = - { - .Address = (PIPE_DIR_IN | 1), - .Banks = 1, - }, - .DataOUTPipe = - { - .Address = (PIPE_DIR_OUT | 2), - .Banks = 1, - }, - .PropertyStrings = - { - [AOA_STRING_Manufacturer] = "Dean Camera", - [AOA_STRING_Model] = "LUFA Android Demo", - [AOA_STRING_Description] = "LUFA Android Demo", - [AOA_STRING_Version] = "1.0", - [AOA_STRING_URI] = "http://www.lufa-lib.org", - [AOA_STRING_Serial] = "0000000012345678", - }, - }, - }; - - -/** Main program entry point. This routine configures the hardware required by the application, then - * enters a loop to run the application tasks in sequence. - */ -int main(void) -{ - SetupHardware(); - - puts_P(PSTR(ESC_FG_CYAN "Android Accessory Host Demo running.\r\n" ESC_FG_WHITE)); - - LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); - sei(); - - for (;;) - { - AOAHost_Task(); - - AOA_Host_USBTask(&AndroidDevice_AOA_Interface); - USB_USBTask(); - } -} - -/** Configures the board hardware and chip peripherals for the demo's functionality. */ -void SetupHardware(void) -{ - /* Disable watchdog if enabled by bootloader/fuses */ - MCUSR &= ~(1 << WDRF); - wdt_disable(); - - /* Disable clock division */ - clock_prescale_set(clock_div_1); - - /* Hardware Initialization */ - Serial_Init(9600, false); - LEDs_Init(); - USB_Init(); - - /* Create a stdio stream for the serial port for stdin and stdout */ - Serial_CreateStream(NULL); -} - -/** Task to manage an enumerated USB Android Accessory device once connected, to print received data - * from the device to the serial port. - */ -void AOAHost_Task(void) -{ - if (USB_HostState != HOST_STATE_Configured) - return; - - if (AOA_Host_BytesReceived(&AndroidDevice_AOA_Interface)) - { - /* Echo received bytes from the attached device through the USART */ - int16_t ReceivedByte = AOA_Host_ReceiveByte(&AndroidDevice_AOA_Interface); - if (!(ReceivedByte < 0)) - putchar(ReceivedByte); - } -} - -/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and - * starts the library USB task to begin the enumeration and USB management process. - */ -void EVENT_USB_Host_DeviceAttached(void) -{ - puts_P(PSTR("Device Attached.\r\n")); - LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); -} - -/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and - * stops the library USB task management process. - */ -void EVENT_USB_Host_DeviceUnattached(void) -{ - puts_P(PSTR("\r\nDevice Unattached.\r\n")); - LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); -} - -/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully - * enumerated by the host and is now ready to be used by the application. - */ -void EVENT_USB_Host_DeviceEnumerationComplete(void) -{ - LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); - - USB_Descriptor_Device_t DeviceDescriptor; - - if (USB_Host_GetDeviceDescriptor(&DeviceDescriptor) != HOST_SENDCONTROL_Successful) - { - puts_P(PSTR("Error Retrieving Device Descriptor.\r\n")); - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - return; - } - - bool NeedModeSwitch; - if (!(AOA_Host_ValidateAccessoryDevice(&AndroidDevice_AOA_Interface, &DeviceDescriptor, &NeedModeSwitch))) - { - puts_P(PSTR("Not an Android device.\r\n")); - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - return; - } - - if (NeedModeSwitch) - { - puts_P(PSTR("Not in Accessory mode, switching...\r\n")); - AOA_Host_StartAccessoryMode(&AndroidDevice_AOA_Interface); - return; - } - - uint16_t ConfigDescriptorSize; - uint8_t ConfigDescriptorData[512]; - - if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData, - sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful) - { - puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n")); - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - return; - } - - if (AOA_Host_ConfigurePipes(&AndroidDevice_AOA_Interface, - ConfigDescriptorSize, ConfigDescriptorData) != AOA_ENUMERROR_NoError) - { - puts_P(PSTR("Attached Device Not a Valid Android Accessory Class Device.\r\n")); - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - return; - } - - if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful) - { - puts_P(PSTR("Error Setting Device Configuration.\r\n")); - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - return; - } - - puts_P(PSTR("Android Device Enumerated.\r\n")); - LEDs_SetAllLEDs(LEDMASK_USB_READY); -} - -/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_Host_HostError(const uint8_t ErrorCode) -{ - USB_Disable(); - - printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n" - " -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode); - - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - for(;;); -} - -/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while - * enumerating an attached USB device. - */ -void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, - const uint8_t SubErrorCode) -{ - printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n" - " -- Error Code %d\r\n" - " -- Sub Error Code %d\r\n" - " -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState); - - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); -} - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * Main source file for the AndroidAccessoryHost demo. This file contains the main tasks of + * the demo and is responsible for the initial application hardware configuration. + */ + +#include "AndroidAccessoryHost.h" + +/** LUFA Android Open Accessory Class driver interface configuration and state information. This + * structure is passed to all Android Open Accessory Class driver functions, so that multiple + * instances of the same class within a device can be differentiated from one another. + */ +USB_ClassInfo_AOA_Host_t AndroidDevice_AOA_Interface = + { + .Config = + { + .DataINPipe = + { + .Address = (PIPE_DIR_IN | 1), + .Banks = 1, + }, + .DataOUTPipe = + { + .Address = (PIPE_DIR_OUT | 2), + .Banks = 1, + }, + .PropertyStrings = + { + [AOA_STRING_Manufacturer] = "Dean Camera", + [AOA_STRING_Model] = "LUFA Android Demo", + [AOA_STRING_Description] = "LUFA Android Demo", + [AOA_STRING_Version] = "1.0", + [AOA_STRING_URI] = "http://www.lufa-lib.org", + [AOA_STRING_Serial] = "0000000012345678", + }, + }, + }; + + +/** Main program entry point. This routine configures the hardware required by the application, then + * enters a loop to run the application tasks in sequence. + */ +int main(void) +{ + SetupHardware(); + + puts_P(PSTR(ESC_FG_CYAN "Android Accessory Host Demo running.\r\n" ESC_FG_WHITE)); + + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); + sei(); + + for (;;) + { + AOAHost_Task(); + + AOA_Host_USBTask(&AndroidDevice_AOA_Interface); + USB_USBTask(); + } +} + +/** Configures the board hardware and chip peripherals for the demo's functionality. */ +void SetupHardware(void) +{ + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); + + /* Disable clock division */ + clock_prescale_set(clock_div_1); + + /* Hardware Initialization */ + Serial_Init(9600, false); + LEDs_Init(); + USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); +} + +/** Task to manage an enumerated USB Android Accessory device once connected, to print received data + * from the device to the serial port. + */ +void AOAHost_Task(void) +{ + if (USB_HostState != HOST_STATE_Configured) + return; + + if (AOA_Host_BytesReceived(&AndroidDevice_AOA_Interface)) + { + /* Echo received bytes from the attached device through the USART */ + int16_t ReceivedByte = AOA_Host_ReceiveByte(&AndroidDevice_AOA_Interface); + if (!(ReceivedByte < 0)) + putchar(ReceivedByte); + } +} + +/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and + * starts the library USB task to begin the enumeration and USB management process. + */ +void EVENT_USB_Host_DeviceAttached(void) +{ + puts_P(PSTR("Device Attached.\r\n")); + LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); +} + +/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and + * stops the library USB task management process. + */ +void EVENT_USB_Host_DeviceUnattached(void) +{ + puts_P(PSTR("\r\nDevice Unattached.\r\n")); + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); +} + +/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully + * enumerated by the host and is now ready to be used by the application. + */ +void EVENT_USB_Host_DeviceEnumerationComplete(void) +{ + LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); + + USB_Descriptor_Device_t DeviceDescriptor; + + if (USB_Host_GetDeviceDescriptor(&DeviceDescriptor) != HOST_SENDCONTROL_Successful) + { + puts_P(PSTR("Error Retrieving Device Descriptor.\r\n")); + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + return; + } + + bool NeedModeSwitch; + if (!(AOA_Host_ValidateAccessoryDevice(&AndroidDevice_AOA_Interface, &DeviceDescriptor, &NeedModeSwitch))) + { + puts_P(PSTR("Not an Android device.\r\n")); + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + return; + } + + if (NeedModeSwitch) + { + puts_P(PSTR("Not in Accessory mode, switching...\r\n")); + AOA_Host_StartAccessoryMode(&AndroidDevice_AOA_Interface); + return; + } + + uint16_t ConfigDescriptorSize; + uint8_t ConfigDescriptorData[512]; + + if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData, + sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful) + { + puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n")); + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + return; + } + + if (AOA_Host_ConfigurePipes(&AndroidDevice_AOA_Interface, + ConfigDescriptorSize, ConfigDescriptorData) != AOA_ENUMERROR_NoError) + { + puts_P(PSTR("Attached Device Not a Valid Android Accessory Class Device.\r\n")); + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + return; + } + + if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful) + { + puts_P(PSTR("Error Setting Device Configuration.\r\n")); + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + return; + } + + puts_P(PSTR("Android Device Enumerated.\r\n")); + LEDs_SetAllLEDs(LEDMASK_USB_READY); +} + +/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) +{ + USB_Disable(); + + printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n" + " -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode); + + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + for(;;); +} + +/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while + * enumerating an attached USB device. + */ +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, + const uint8_t SubErrorCode) +{ + printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n" + " -- Error Code %d\r\n" + " -- Sub Error Code %d\r\n" + " -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState); + + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); +} + diff --git a/Demos/Host/ClassDriver/AndroidAccessoryHost/AndroidAccessoryHost.h b/Demos/Host/ClassDriver/AndroidAccessoryHost/AndroidAccessoryHost.h index 95cecca5c..000069620 100644 --- a/Demos/Host/ClassDriver/AndroidAccessoryHost/AndroidAccessoryHost.h +++ b/Demos/Host/ClassDriver/AndroidAccessoryHost/AndroidAccessoryHost.h @@ -1,78 +1,78 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Header file for AndroidAccessoryHost.c. - */ - -#ifndef _ANDROIDACCESSORY_HOST_H_ -#define _ANDROIDACCESSORY_HOST_H_ - - /* Includes: */ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - - /* Macros: */ - /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ - #define LEDMASK_USB_NOTREADY LEDS_LED1 - - /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ - #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) - - /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ - #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) - - /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ - #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) - - /* Function Prototypes: */ - void SetupHardware(void); - void AOAHost_Task(void); - - void EVENT_USB_Host_HostError(const uint8_t ErrorCode); - void EVENT_USB_Host_DeviceAttached(void); - void EVENT_USB_Host_DeviceUnattached(void); - void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, - const uint8_t SubErrorCode); - void EVENT_USB_Host_DeviceEnumerationComplete(void); - -#endif - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * Header file for AndroidAccessoryHost.c. + */ + +#ifndef _ANDROIDACCESSORY_HOST_H_ +#define _ANDROIDACCESSORY_HOST_H_ + + /* Includes: */ + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + + /* Macros: */ + /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ + #define LEDMASK_USB_NOTREADY LEDS_LED1 + + /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ + #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) + + /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ + #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) + + /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ + #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) + + /* Function Prototypes: */ + void SetupHardware(void); + void AOAHost_Task(void); + + void EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, + const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); + +#endif + diff --git a/Demos/Host/ClassDriver/AndroidAccessoryHost/makefile b/Demos/Host/ClassDriver/AndroidAccessoryHost/makefile index ebdab99e8..ea34442f7 100644 --- a/Demos/Host/ClassDriver/AndroidAccessoryHost/makefile +++ b/Demos/Host/ClassDriver/AndroidAccessoryHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = AndroidAccessoryHost SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/AudioInputHost/makefile b/Demos/Host/ClassDriver/AudioInputHost/makefile index 8af053112..172d90d55 100644 --- a/Demos/Host/ClassDriver/AudioInputHost/makefile +++ b/Demos/Host/ClassDriver/AudioInputHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = AudioInputHost SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/AudioOutputHost/makefile b/Demos/Host/ClassDriver/AudioOutputHost/makefile index eb3b92e4f..0c5347db4 100644 --- a/Demos/Host/ClassDriver/AudioOutputHost/makefile +++ b/Demos/Host/ClassDriver/AudioOutputHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = AudioOutputHost SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/makefile b/Demos/Host/ClassDriver/JoystickHostWithParser/makefile index ee2c4b047..e04f86bfe 100644 --- a/Demos/Host/ClassDriver/JoystickHostWithParser/makefile +++ b/Demos/Host/ClassDriver/JoystickHostWithParser/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = JoystickHostWithParser SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/KeyboardHost/makefile b/Demos/Host/ClassDriver/KeyboardHost/makefile index f7ba17897..6f6056af8 100644 --- a/Demos/Host/ClassDriver/KeyboardHost/makefile +++ b/Demos/Host/ClassDriver/KeyboardHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = KeyboardHost SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile b/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile index 415af80c2..ef8c32791 100644 --- a/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile +++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = KeyboardHostWithParser SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c index 472d19aee..04a945429 100644 --- a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c +++ b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c @@ -101,7 +101,7 @@ void SetupHardware(void) } /** Task to manage an enumerated USB MIDI device once connected, to display received - * note events from the host and send note changes in response to tbe board's joystick. + * note events from the host and send note changes in response to the board's joystick. */ void JoystickHost_Task(void) { diff --git a/Demos/Host/ClassDriver/MIDIHost/makefile b/Demos/Host/ClassDriver/MIDIHost/makefile index eaf78f179..63cba2b48 100644 --- a/Demos/Host/ClassDriver/MIDIHost/makefile +++ b/Demos/Host/ClassDriver/MIDIHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MIDIHost SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/MassStorageHost/makefile b/Demos/Host/ClassDriver/MassStorageHost/makefile index 3c565ea3e..a626703cd 100644 --- a/Demos/Host/ClassDriver/MassStorageHost/makefile +++ b/Demos/Host/ClassDriver/MassStorageHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MassStorageHost SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/MouseHost/makefile b/Demos/Host/ClassDriver/MouseHost/makefile index 5d7d2f1a5..0dd25b73b 100644 --- a/Demos/Host/ClassDriver/MouseHost/makefile +++ b/Demos/Host/ClassDriver/MouseHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MouseHost SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/makefile b/Demos/Host/ClassDriver/MouseHostWithParser/makefile index 1aa1c9633..13d217d64 100644 --- a/Demos/Host/ClassDriver/MouseHostWithParser/makefile +++ b/Demos/Host/ClassDriver/MouseHostWithParser/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MouseHostWithParser SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/PrinterHost/makefile b/Demos/Host/ClassDriver/PrinterHost/makefile index 46ecd6314..8ef479e8f 100644 --- a/Demos/Host/ClassDriver/PrinterHost/makefile +++ b/Demos/Host/ClassDriver/PrinterHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = PrinterHost SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/makefile b/Demos/Host/ClassDriver/RNDISEthernetHost/makefile index aef7992ca..359800c21 100644 --- a/Demos/Host/ClassDriver/RNDISEthernetHost/makefile +++ b/Demos/Host/ClassDriver/RNDISEthernetHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = RNDISEthernetHost SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/StillImageHost/makefile b/Demos/Host/ClassDriver/StillImageHost/makefile index a1780b0ff..72eb8f814 100644 --- a/Demos/Host/ClassDriver/StillImageHost/makefile +++ b/Demos/Host/ClassDriver/StillImageHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = StillImageHost SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/VirtualSerialHost/makefile b/Demos/Host/ClassDriver/VirtualSerialHost/makefile index 04c9c9a74..29e5a2ad9 100644 --- a/Demos/Host/ClassDriver/VirtualSerialHost/makefile +++ b/Demos/Host/ClassDriver/VirtualSerialHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = VirtualSerialHost SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/ClassDriver/makefile b/Demos/Host/ClassDriver/makefile index aa8fa3696..e33bf963b 100644 --- a/Demos/Host/ClassDriver/makefile +++ b/Demos/Host/ClassDriver/makefile @@ -13,35 +13,34 @@ # custom LUFA library build options are reflected in the compiled # code. -all: - $(MAKE) -s -C AndroidAccessoryHost clean all - $(MAKE) -s -C AudioInputHost clean all - $(MAKE) -s -C AudioOutputHost clean all - $(MAKE) -s -C JoystickHostWithParser clean all - $(MAKE) -s -C KeyboardHost clean all - $(MAKE) -s -C KeyboardHostWithParser clean all - $(MAKE) -s -C MassStorageHost clean all - $(MAKE) -s -C MIDIHost clean all - $(MAKE) -s -C MouseHost clean all - $(MAKE) -s -C MouseHostWithParser clean all - $(MAKE) -s -C PrinterHost clean all - $(MAKE) -s -C RNDISEthernetHost clean all - $(MAKE) -s -C StillImageHost clean all - $(MAKE) -s -C VirtualSerialHost clean all - -%: - $(MAKE) -s -C AndroidAccessoryHost $@ - $(MAKE) -s -C AudioInputHost $@ - $(MAKE) -s -C AudioOutputHost $@ - $(MAKE) -s -C JoystickHostWithParser $@ - $(MAKE) -s -C KeyboardHost $@ - $(MAKE) -s -C KeyboardHostWithParser $@ - $(MAKE) -s -C MassStorageHost $@ - $(MAKE) -s -C MIDIHost $@ - $(MAKE) -s -C MouseHost $@ - $(MAKE) -s -C MouseHostWithParser $@ - $(MAKE) -s -C PrinterHost $@ - $(MAKE) -s -C RNDISEthernetHost $@ - $(MAKE) -s -C StillImageHost $@ - $(MAKE) -s -C VirtualSerialHost $@ +PROJECT_DIRECTORIES := $(shell ls -d */) +# This makefile is potentially infinitely recursive if something really bad +# happens when determining the set of project directories - hard-abort if +# more than 10 levels deep to avoid angry emails. +ifeq ($(MAKELEVEL), 10) + $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) +endif + +# Need to special-case building without a per-project object directory +ifeq ($(OBJDIR),) + # If no target specified, force "clean all" and disallow parallel build + ifeq ($(MAKECMDGOALS),) + MAKECMDGOALS := clean all + .NOTPARALLEL: + endif + + # If one of the targets is to build, force "clean" beforehand and disallow parallel build + ifneq ($(findstring all, $(MAKECMDGOALS)),) + MAKECMDGOALS := clean $(MAKECMDGOALS) + .NOTPARALLEL: + endif +endif + +%: $(PROJECT_DIRECTORIES) + @echo . > /dev/null + +$(PROJECT_DIRECTORIES): + @$(MAKE) -C $@ $(MAKECMDGOALS) + +.PHONY: $(PROJECT_DIRECTORIES) diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/makefile b/Demos/Host/LowLevel/AndroidAccessoryHost/makefile index 18bbeaf72..baacf57fb 100644 --- a/Demos/Host/LowLevel/AndroidAccessoryHost/makefile +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = AndroidAccessoryHost SRC = $(TARGET).c ConfigDescriptor.c DeviceDescriptor.c Lib/AndroidAccessoryCommands.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/AudioInputHost/makefile b/Demos/Host/LowLevel/AudioInputHost/makefile index 4536ed879..e64392815 100644 --- a/Demos/Host/LowLevel/AudioInputHost/makefile +++ b/Demos/Host/LowLevel/AudioInputHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = AudioInputHost SRC = $(TARGET).c ConfigDescriptor.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/AudioOutputHost/makefile b/Demos/Host/LowLevel/AudioOutputHost/makefile index 817f96337..effdf1948 100644 --- a/Demos/Host/LowLevel/AudioOutputHost/makefile +++ b/Demos/Host/LowLevel/AudioOutputHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = AudioOutputHost SRC = $(TARGET).c ConfigDescriptor.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/GenericHIDHost/makefile b/Demos/Host/LowLevel/GenericHIDHost/makefile index b4aa44e75..b3f0e08e0 100644 --- a/Demos/Host/LowLevel/GenericHIDHost/makefile +++ b/Demos/Host/LowLevel/GenericHIDHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = GenericHIDHost SRC = $(TARGET).c ConfigDescriptor.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/makefile b/Demos/Host/LowLevel/JoystickHostWithParser/makefile index 155c31c91..314253e4f 100644 --- a/Demos/Host/LowLevel/JoystickHostWithParser/makefile +++ b/Demos/Host/LowLevel/JoystickHostWithParser/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = JoystickHostWithParser SRC = $(TARGET).c ConfigDescriptor.c HIDReport.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/KeyboardHost/makefile b/Demos/Host/LowLevel/KeyboardHost/makefile index bc123ce01..77d5898a3 100644 --- a/Demos/Host/LowLevel/KeyboardHost/makefile +++ b/Demos/Host/LowLevel/KeyboardHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = KeyboardHost SRC = $(TARGET).c ConfigDescriptor.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/makefile b/Demos/Host/LowLevel/KeyboardHostWithParser/makefile index b0838113d..ded8c52ce 100644 --- a/Demos/Host/LowLevel/KeyboardHostWithParser/makefile +++ b/Demos/Host/LowLevel/KeyboardHostWithParser/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = KeyboardHostWithParser SRC = $(TARGET).c ConfigDescriptor.c HIDReport.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/MIDIHost/makefile b/Demos/Host/LowLevel/MIDIHost/makefile index c43ab0cb2..fa180e11d 100644 --- a/Demos/Host/LowLevel/MIDIHost/makefile +++ b/Demos/Host/LowLevel/MIDIHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MIDIHost SRC = $(TARGET).c ConfigDescriptor.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c index 390acfa90..e2887f513 100644 --- a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c +++ b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c @@ -283,7 +283,7 @@ static uint8_t MassStore_GetReturnedStatus(MS_CommandStatusWrapper_t* const SCSI /** Issues a Mass Storage class specific request to reset the attached device's Mass Storage interface, * readying the device for the next CBW. The Data endpoints are cleared of any STALL condition once this - * command completes sucessfuly. + * command completes successfully. * * \return A value from the USB_Host_SendControlErrorCodes_t enum, or MASS_STORE_SCSI_COMMAND_FAILED if the SCSI command fails */ diff --git a/Demos/Host/LowLevel/MassStorageHost/makefile b/Demos/Host/LowLevel/MassStorageHost/makefile index 14f2b05da..823b579bf 100644 --- a/Demos/Host/LowLevel/MassStorageHost/makefile +++ b/Demos/Host/LowLevel/MassStorageHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MassStorageHost SRC = $(TARGET).c ConfigDescriptor.c Lib/MassStoreCommands.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/MouseHost/makefile b/Demos/Host/LowLevel/MouseHost/makefile index efb24eca8..1724ca406 100644 --- a/Demos/Host/LowLevel/MouseHost/makefile +++ b/Demos/Host/LowLevel/MouseHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MouseHost SRC = $(TARGET).c ConfigDescriptor.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/MouseHostWithParser/makefile b/Demos/Host/LowLevel/MouseHostWithParser/makefile index 9500d987b..0db7cc71a 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/makefile +++ b/Demos/Host/LowLevel/MouseHostWithParser/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MouseHostWithParser SRC = $(TARGET).c ConfigDescriptor.c HIDReport.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/PrinterHost/makefile b/Demos/Host/LowLevel/PrinterHost/makefile index b738f966f..b840c5412 100644 --- a/Demos/Host/LowLevel/PrinterHost/makefile +++ b/Demos/Host/LowLevel/PrinterHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = PrinterHost SRC = $(TARGET).c ConfigDescriptor.c Lib/PrinterCommands.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/makefile b/Demos/Host/LowLevel/RNDISEthernetHost/makefile index baf98dbab..7da4d00f1 100644 --- a/Demos/Host/LowLevel/RNDISEthernetHost/makefile +++ b/Demos/Host/LowLevel/RNDISEthernetHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = RNDISEthernetHost SRC = $(TARGET).c ConfigDescriptor.c Lib/RNDISCommands.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/StillImageHost/makefile b/Demos/Host/LowLevel/StillImageHost/makefile index e01ee7e3f..c99387a85 100644 --- a/Demos/Host/LowLevel/StillImageHost/makefile +++ b/Demos/Host/LowLevel/StillImageHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = StillImageHost SRC = $(TARGET).c ConfigDescriptor.c Lib/StillImageCommands.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/VirtualSerialHost/makefile b/Demos/Host/LowLevel/VirtualSerialHost/makefile index a2bd7da0c..5400e5e5b 100644 --- a/Demos/Host/LowLevel/VirtualSerialHost/makefile +++ b/Demos/Host/LowLevel/VirtualSerialHost/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = VirtualSerialHost SRC = $(TARGET).c ConfigDescriptor.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../../../LUFA/ +LUFA_PATH = ../../../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Demos/Host/LowLevel/makefile b/Demos/Host/LowLevel/makefile index 8c32dc327..e33bf963b 100644 --- a/Demos/Host/LowLevel/makefile +++ b/Demos/Host/LowLevel/makefile @@ -13,36 +13,34 @@ # custom LUFA library build options are reflected in the compiled # code. -all: - $(MAKE) -s -C AndroidAccessoryHost clean all - $(MAKE) -s -C AudioInputHost clean all - $(MAKE) -s -C AudioOutputHost clean all - $(MAKE) -s -C GenericHIDHost clean all - $(MAKE) -s -C JoystickHostWithParser clean all - $(MAKE) -s -C KeyboardHost clean all - $(MAKE) -s -C MassStorageHost clean all - $(MAKE) -s -C MIDIHost clean all - $(MAKE) -s -C MouseHost clean all - $(MAKE) -s -C MouseHostWithParser clean all - $(MAKE) -s -C PrinterHost clean all - $(MAKE) -s -C RNDISEthernetHost clean all - $(MAKE) -s -C StillImageHost clean all - $(MAKE) -s -C VirtualSerialHost clean all - -%: - $(MAKE) -s -C AndroidAccessoryHost $@ - $(MAKE) -s -C AudioInputHost $@ - $(MAKE) -s -C AudioOutputHost $@ - $(MAKE) -s -C GenericHIDHost $@ - $(MAKE) -s -C JoystickHostWithParser $@ - $(MAKE) -s -C KeyboardHost $@ - $(MAKE) -s -C KeyboardHostWithParser $@ - $(MAKE) -s -C MassStorageHost $@ - $(MAKE) -s -C MIDIHost $@ - $(MAKE) -s -C MouseHost $@ - $(MAKE) -s -C MouseHostWithParser $@ - $(MAKE) -s -C PrinterHost $@ - $(MAKE) -s -C RNDISEthernetHost $@ - $(MAKE) -s -C StillImageHost $@ - $(MAKE) -s -C VirtualSerialHost $@ +PROJECT_DIRECTORIES := $(shell ls -d */) +# This makefile is potentially infinitely recursive if something really bad +# happens when determining the set of project directories - hard-abort if +# more than 10 levels deep to avoid angry emails. +ifeq ($(MAKELEVEL), 10) + $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) +endif + +# Need to special-case building without a per-project object directory +ifeq ($(OBJDIR),) + # If no target specified, force "clean all" and disallow parallel build + ifeq ($(MAKECMDGOALS),) + MAKECMDGOALS := clean all + .NOTPARALLEL: + endif + + # If one of the targets is to build, force "clean" beforehand and disallow parallel build + ifneq ($(findstring all, $(MAKECMDGOALS)),) + MAKECMDGOALS := clean $(MAKECMDGOALS) + .NOTPARALLEL: + endif +endif + +%: $(PROJECT_DIRECTORIES) + @echo . > /dev/null + +$(PROJECT_DIRECTORIES): + @$(MAKE) -C $@ $(MAKECMDGOALS) + +.PHONY: $(PROJECT_DIRECTORIES) diff --git a/LUFA.pnproj b/LUFA.pnproj index 4fa506c2d..392812118 100644 --- a/LUFA.pnproj +++ b/LUFA.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c b/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c new file mode 100644 index 000000000..2d20153e0 --- /dev/null +++ b/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c @@ -0,0 +1,61 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * Special application to extract an EEPROM image stored in FLASH memory, and + * copy it to the device EEPROM. This application is designed to be used with + * the HID build system module of LUFA to program the EEPROM of a target device + * that uses the HID bootloader protocol, which does not have native EEPROM + * programming support. + */ + +#include +#include +#include + +/* References to the binary EEPROM data linked in the AVR's FLASH memory space */ +extern const char _binary_InputEEData_bin_start[]; +extern const char _binary_InputEEData_bin_end[]; +extern const char _binary_InputEEData_bin_size[]; + +/* Friendly names for the embedded binary data stored in FLASH memory space */ +#define InputEEData _binary_InputEEData_bin_start +#define InputEEData_size ((int)_binary_InputEEData_bin_size) + +int main(void) +{ + /* Copy out the embedded EEPROM data from FLASH to EEPROM memory space */ + for (uint16_t i = 0; i < InputEEData_size; i++) + eeprom_update_byte((uint8_t*)i, pgm_read_byte(&InputEEData[i])); + + /* Infinite loop once complete */ + for (;;); +} diff --git a/LUFA/Build/HID_EEPROM_Loader/makefile b/LUFA/Build/HID_EEPROM_Loader/makefile new file mode 100644 index 000000000..f6dcbea67 --- /dev/null +++ b/LUFA/Build/HID_EEPROM_Loader/makefile @@ -0,0 +1,40 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# +# -------------------------------------- +# LUFA Project Makefile. +# -------------------------------------- + +MCU = at90usb1287 +ARCH = AVR8 +F_CPU = 1000000 +F_USB = $(F_CPU) +OPTIMIZATION = s +TARGET = HID_EEPROM_Loader +SRC = $(TARGET).c +LUFA_PATH = ../../../LUFA +CC_FLAGS = +LD_FLAGS = +OBJECT_FILES = InputEEData.o + +# Default target +all: + +# Determine the AVR sub-architecture of the build main application object file +FIND_AVR_SUBARCH = avr$(shell avr-objdump -f $(TARGET).o | grep architecture | cut -d':' -f3 | cut -d',' -f1) + +# Create a linkable object file with the input binary EEPROM data stored in the FLASH section +InputEEData.o: InputEEData.bin $(TARGET).o $(MAKEFILE_LIST) + @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a object file \"$@\" + avr-objcopy -I binary -O elf32-avr -B $(call FIND_AVR_SUBARCH) --rename-section .data=.progmem.data,contents,alloc,readonly,data $< $@ + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_hid.mk diff --git a/LUFA/Build/lufa.avrdude.in b/LUFA/Build/lufa.avrdude.in deleted file mode 100644 index f16a7720c..000000000 --- a/LUFA/Build/lufa.avrdude.in +++ /dev/null @@ -1,54 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += AVRDUDE -LUFA_BUILD_TARGETS += program - -# ----------------------------------------------------------------------------- -# LUFA DFU Bootloader Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of targets to re-program a device using the open source -# avr-dude utility. -# ----------------------------------------------------------------------------- -# TARGETS: -# -# program - Program target with application using avr-dude -# -# MANDATORY PARAMETERS: -# -# MCU - Microcontroller device model name -# TARGET - Application name -# -# OPTIONAL PARAMETERS: -# -# AVRDUDE_PROGRAMMER - Name of programming hardware to use -# AVRDUDE_PORT - Name of communication port to use -# AVRDUDE_FLAGS - Flags to pass to avr-dude -# -# ----------------------------------------------------------------------------- - -# Output Messages -MSG_AVRDUDE_CMD = ' [AVRDUDE] :' - -# Default values of user-supplied variables -AVRDUDE_PROGRAMMER ?= jtagicemkii -AVRDUDE_PORT ?= usb -AVRDUDE_FLAGS ?= -U flash:w:$(TARGET).hex - -# Sanity check the user MCU and TARGET makefile options -ifeq ($(MCU),) - $(error Makefile MCU value not set.) -endif -ifeq ($(TARGET),) - $(error Makefile TARGET value not set.) -endif - -program: $(TARGET).hex - @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" - avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) $(AVRDUDE_FLAGS) diff --git a/LUFA/Build/lufa.build.in b/LUFA/Build/lufa.build.in deleted file mode 100644 index e9921efb7..000000000 --- a/LUFA/Build/lufa.build.in +++ /dev/null @@ -1,182 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += BUILD -LUFA_BUILD_TARGETS += size checksource all elf hex clean - -# ----------------------------------------------------------------------------- -# LUFA Compiler Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of targets to build a C, C++ and/or Assembly application -# via the AVR-GCC compiler. -# ----------------------------------------------------------------------------- -# TARGETS: -# -# size - List application size -# checksource - Check existance of listed input source files -# all - Build application and list size -# elf - Build application ELF debug object file -# hex - Build application HEX object files -# clean - Remove output files -# -# MANDATORY PARAMETERS: -# -# TARGET - Application name -# ARCH - Device architecture name -# MCU - Microcontroller device model name -# SRC - List of input source files (.c, .cpp/.c++, .S) -# F_USB - Speed of the input clock of the USB controller -# in Hz -# LUFA_PATH - Path to the LUFA library core -# -# OPTIONAL PARAMETERS: -# -# BOARD - LUFA board hardware -# OPTIMIZATION - Optimization level -# C_STANDARD - C Language Standard to use -# CPP_STANDARD - C++ Language Standard to use -# F_CPU - Speed of the CPU, in Hz -# CC_FLAGS - Flags to pass to the compiler -# LD_FLAGS - Flags to pass to the linker -# -# ----------------------------------------------------------------------------- - -# Output Messages -MSG_BUILD_BEGIN = Begin compilation of project \"$(TARGET)\"... -MSG_BUILD_END = Finished building project \"$(TARGET)\"... -MSG_COMPILE_CMD = ' [CC] :' -MSG_REMOVE_CMD = ' [RM] :' -MSG_LINKER_CMD = ' [LNK] :' -MSG_SIZE_CMD = ' [SIZE] :' -MSG_OBJCPY_CMD = ' [OBJCPY] :' -MSG_OBJDMP_CMD = ' [OBJDMP] :' - -# Sanity check the user MCU, TARGET, ARCH, SRC, F_USB and LUFA_PATH makefile options -ifeq ($(TARGET),) - $(error Makefile TARGET value not set.) -endif -ifeq ($(ARCH),) - $(error Makefile ARCH value not set.) -endif -ifeq ($(MCU),) - $(error Makefile MCU value not set.) -endif -ifeq ($(SRC),) - $(error Makefile SRC value not set.) -endif -ifeq ($(F_USB),) - $(error Makefile F_USB value not set.) -endif -ifeq ($(LUFA_PATH),) - $(error Makefile LUFA_PATH value not set.) -endif - -# Default values of user-supplied variables -BOARD ?= NONE -OPTIMIZATION ?= s -F_CPU ?= -C_STANDARD ?= c99 -CPP_STANDARD ?= c++98 - -# Convert input source file list to differentiate them by type -C_SOURCE = $(filter %.c, $(SRC)) -CPP_SOURCE = $(filter %.cpp, $(SRC)) $(filter %.c++, $(SRC)) -ASM_SOURCE = $(filter %.S, $(SRC)) - -# Convert input source filenames into a list of required output object files -OBJECT_FILES = $(C_SOURCE:%.c=%.o) $(CPP_SOURCE:%.c++=%.o) $(CPP_SOURCE:%.c++=%.o) $(ASM_SOURCE:%.S=%.o) - -# Create a list of flags to pass to the compiler -CC_FLAGS += -mmcu=$(MCU) -I. -I$(LUFA_PATH)/.. -gdwarf-2 -pipe -CC_FLAGS += -Wall -Wstrict-prototypes -CC_FLAGS += -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -fshort-enums -fno-inline-small-functions -fpack-struct -fshort-enums -CC_FLAGS += -DARCH=ARCH_$(ARCH) -DBOARD=BOARD_$(BOARD) -DF_USB=$(F_USB)UL -ifneq ($(F_CPU),) - CC_FLAGS += -DF_CPU=$(F_CPU)UL -endif - -# Create a list of flags to pass to the linker -LD_FLAGS += -Wl,-Map=$(TARGET).map,--cref -Wl,--relax -Wl,--gc-sections -lm - -# Create a list of unknown source file types, if any are found throw an error -UNKNOWN_SOURCE = $(filter-out $(C_SOURCE) $(CPP_SOURCE) $(ASM_SOURCE), $(SRC)) -ifneq ($(UNKNOWN_SOURCE),) - $(error Unknown input source formats: $(UNKNOWN_SOURCE)) -endif - -# Determine flags to pass to the size utility based on its reported features -SIZE_MCU_FLAG = $(shell avr-size --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -SIZE_FORMAT_FLAG = $(shell avr-size --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -begin: - @echo "" - @echo $(MSG_BUILD_BEGIN) - -end: - @echo $(MSG_BUILD_END) - @echo "" - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; \ - done - -size: - @echo $(MSG_SIZE_CMD) Determining size of \"$(TARGET).elf\" - @if test -f $(TARGET).elf; then \ - avr-size $(SIZE_MCU_FLAG) $(SIZE_FORMAT_FLAG) $(TARGET).elf ; 2>/dev/null; \ - fi - -.PHONY: begin hex lss end size -all: begin hex end size - -elf: $(TARGET).elf -hex: $(TARGET).hex $(TARGET).eep -lss: $(TARGET).lss - -%.o: %.c - @echo $(MSG_COMPILE_CMD) Compiling C file \"$^\" - avr-gcc -c $(CC_FLAGS) -O$(OPTIMIZATION) --std=$(C_STANDARD) $< -o $@ - -%.o: %.cpp -%.o: %.c++ - @echo $(MSG_COMPILE_CMD) Compiling C++ file \"$^\" - avr-gcc -c $(CC_FLAGS) -O$(OPTIMIZATION) --std=$(CPP_STANDARD) -x c++ $< -o $@ - -%.o: %.S - @echo $(MSG_COMPILE_CMD) Assembling \"$^\" - avr-gcc -c $(CC_FLAGS) -x assembler-with-cpp $< -o $@ - -.PRECIOUS : $(OBJECT_FILES) -%.elf: $(OBJECT_FILES) - @echo $(MSG_LINKER_CMD) Linking object files into \"$@\" - avr-gcc $^ $(CC_FLAGS) $(LD_FLAGS) -o $@ - -%.hex: %.elf - @echo $(MSG_OBJCPY_CMD) Extracting HEX file data from \"$@\" - avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -%.eep: %.elf - @echo $(MSG_OBJCPY_CMD) Extracting EEP file data from \"$@\" - avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex $< $@ || exit 0 - -%.lss: %.elf - @echo $(MSG_OBJDMP_CMD) Extracting LSS file data from \"$@\" - avr-objdump -h -S -z $< > $@ - -clean: - @echo $(MSG_REMOVE_CMD) Removing object files \"$(OBJECT_FILES)\" - rm -f $(OBJECT_FILES) - @echo $(MSG_REMOVE_CMD) Removing output files \"$(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).map $(TARGET).lss\" - rm -f $(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).map $(TARGET).lss diff --git a/LUFA/Build/lufa.core.in b/LUFA/Build/lufa.core.in deleted file mode 100644 index 71c35e035..000000000 --- a/LUFA/Build/lufa.core.in +++ /dev/null @@ -1,73 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += CORE -LUFA_BUILD_TARGETS += list_targets list_modules help - -# ----------------------------------------------------------------------------- -# LUFA Core Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of core build targets for the LUFA buildsystem -# ----------------------------------------------------------------------------- -# TARGETS: -# -# info - Build system information -# help - Build system help -# list_targets - List all build targets -# list_modules - List all build modules -# -# MANDATORY PARAMETERS: -# -# (None) -# -# OPTIONAL PARAMETERS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -info: - @echo "===================================================================" - @echo " LUFA Build System 2.0 " - @echo " (C) Dean Camera { dean @ fourwalledcubicle . com } " - @echo "===================================================================" - -.PHONY: info -help: info - @echo "DESCRIPTION: " - @echo " This build system is a set of makefile modules for (GNU) Make, to " - @echo " provide a simple system for building LUFA powered applications. " - @echo " Each makefile module can be included from within a user makefile, " - @echo " to expose the build rules documented in the comments at the top of" - @echo " each build module. " - @echo " " - @echo "USAGE: " - @echo " To execute a rule, define all variables indicated in the desired " - @echo " module as a required parameter before including the build module " - @echo " in your project makefile. Parameters marked as optional will " - @echo " assume a default value in the module if not user-assigned. " - @echo "===================================================================" - @echo " Currently Used Modules in this application: " - @echo " " - @echo " [" $(sort $(LUFA_BUILD_MODULES)) "]" - @echo " " - @echo " " - @echo " Currently Available Build Targets in this application: " - @echo " " - @echo " [" $(sort $(LUFA_BUILD_TARGETS)) "]" - @echo "===================================================================" - @echo " The LUFA BuildSystem 2.0 - Powered By Unicorns (tm) " - @echo "===================================================================" - -list_targets: - @echo Currently Available Build Targets: $(sort $(LUFA_BUILD_TARGETS)) - -list_modules: - @echo Currently Build Modules: $(sort $(LUFA_BUILD_MODULES)) - diff --git a/LUFA/Build/lufa.doxygen.in b/LUFA/Build/lufa.doxygen.in deleted file mode 100644 index 9efbbcbcc..000000000 --- a/LUFA/Build/lufa.doxygen.in +++ /dev/null @@ -1,52 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += DOXYGEN -LUFA_BUILD_TARGETS += doxygen - -# ----------------------------------------------------------------------------- -# LUFA Doxygen Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of targets to automatically build Doxygen documentation for -# a project (see www.doxygen.org). -# ----------------------------------------------------------------------------- -# TARGETS: -# -# doxygen - Build Doxygen Documentation -# -# MANDATORY PARAMETERS: -# -# (None) -# -# OPTIONAL PARAMETERS: -# -# DOXYGEN_CONF - Doxygen configuration filename -# DOXYGEN_FAIL_ON_WARNING - Set to Y to fail the build on Doxygen warnings, -# N to continue even if warnings occur -# DOXYGEN_OVERRIDE_PARAMS - Parameters to override in the doxygen -# configuration file -# ----------------------------------------------------------------------------- - -# Output Messages -MSG_DOXYGEN_CMD = ' [DOXYGEN] :' - -# Default values of user-supplied variables -DOXYGEN_CONF ?= Doxygen.conf -DOXYGEN_FAIL_ON_WARNING ?= Y -DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES - -# Determine Doxygen invocation command -DOXYGEN_CMD = ( cat Doxygen.conf ; $(DOXYGEN_OVERRIDE_PARAMS:%=echo "%";)) | doxygen - -ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y) - DOXYGEN_CMD = if ( ( cat Doxygen.conf $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi; -endif - -doxygen: - @echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\" - $(DOXYGEN_CMD) diff --git a/LUFA/Build/lufa.sources.in b/LUFA/Build/lufa.sources.in deleted file mode 100644 index 9985933b6..000000000 --- a/LUFA/Build/lufa.sources.in +++ /dev/null @@ -1,86 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += SOURCES -LUFA_BUILD_TARGETS += - -# ----------------------------------------------------------------------------- -# LUFA Sources Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of makefile variables for the various LUFA module sources. -# Once included, the sources required to use a given LUFA module will become -# available using the makefile variable names listed in the LUFA project -# documentation. -# ----------------------------------------------------------------------------- -# TARGETS: -# -# (None) -# -# MANDATORY PARAMETERS: -# -# LUFA_PATH - Path to the LUFA library core -# ARCH - Device architecture name -# -# OPTIONAL PARAMETERS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -# Sanity check the user LUFA_PATH and ARCH makefile options -ifeq ($(LUFA_PATH),) - $(error Makefile LUFA_PATH value not set.) -endif -ifeq ($(ARCH),) - $(error Makefile ARCH value not set.) -endif - -# Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles -LUFA_ROOT_PATH ?= $(LUFA_PATH) - -# Construct LUFA module source variables -LUFA_SRC_USB = $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Device_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Endpoint_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Host_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Pipe_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBController_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBInterrupt_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/EndpointStream_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/PipeStream_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/ConfigDescriptor.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/DeviceStandardReq.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/Events.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/HostStandardReq.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/USBTask.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Common/HIDParser.c -LUFA_SRC_USBCLASS = $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/AudioClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/HIDClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MassStorageClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MIDIClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/RNDISClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AudioClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/CDCClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/HIDClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MassStorageClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MIDIClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/PrinterClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/RNDISClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/StillImageClassHost.c -LUFA_SRC_TEMPERATURE = $(LUFA_ROOT_PATH)/Drivers/Board/Temperature.c -LUFA_SRC_SERIAL = $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/Serial_$(ARCH).c -LUFA_SRC_TWI = $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/TWI_$(ARCH).c - -# Build a list of all available module sources -LUFA_SRC_ALL_FILES = $(LUFA_SRC_USB) \ - $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_TEMPERATURE) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_TWI) \ No newline at end of file diff --git a/LUFA/Build/lufa_atprogram.mk b/LUFA/Build/lufa_atprogram.mk new file mode 100644 index 000000000..f9f5dfc9c --- /dev/null +++ b/LUFA/Build/lufa_atprogram.mk @@ -0,0 +1,101 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +LUFA_BUILD_MODULES += ATPROGRAM +LUFA_BUILD_TARGETS += atprogram atprogram-ee +LUFA_BUILD_MANDATORY_VARS += MCU TARGET +LUFA_BUILD_OPTIONAL_VARS += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_PORT +LUFA_BUILD_PROVIDED_VARS += +LUFA_BUILD_PROVIDED_MACROS += + +# ----------------------------------------------------------------------------- +# LUFA ATPROGRAM Programmer Buildsystem Makefile Module. +# ----------------------------------------------------------------------------- +# DESCRIPTION: +# Provides a set of targets to re-program a device using the Atmel atprogram +# utility in AVR Studio 5.x and Atmel Studio 6.0 onwards. +# ----------------------------------------------------------------------------- +# TARGETS: +# +# atprogram - Program target FLASH with application using +# atprogram +# atprogram-ee - Program target EEPROM with application data +# using atprogram +# +# MANDATORY PARAMETERS: +# +# MCU - Microcontroller device model name +# TARGET - Application name +# +# OPTIONAL PARAMETERS: +# +# ATPROGRAM_PROGRAMMER - Name of programming hardware to use +# ATPROGRAM_INTERFACE - Name of programming interface to use +# ATPROGRAM_PORT - Name of communication port to use +# +# PROVIDED VARIABLES: +# +# (None) +# +# PROVIDED MACROS: +# +# (None) +# +# ----------------------------------------------------------------------------- + +SHELL = /bin/sh + +ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) +ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) +ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) + +# Default values of optionally user-supplied variables +ATPROGRAM_PROGRAMMER ?= jtagice3 +ATPROGRAM_INTERFACE ?= jtag +ATPROGRAM_PORT ?= + +# Sanity check user supplied values +$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) +$(call ERROR_IF_EMPTY, MCU) +$(call ERROR_IF_EMPTY, TARGET) +$(call ERROR_IF_EMPTY, ATPROGRAM_PROGRAMMER) +$(call ERROR_IF_EMPTY, ATPROGRAM_INTERFACE) + +# Output Messages +MSG_ATPROGRAM_CMD := ' [ATPRGRM] :' + +# Construct base atprogram command flags +BASE_ATPROGRAM_FLAGS := --tool $(ATPROGRAM_PROGRAMMER) --interface $(ATPROGRAM_INTERFACE) --device $(MCU) +ifneq ($(ATPROGRAM_PORT),) + BASE_ATPROGRAM_FLAGS += --port $(ATPROGRAM_PORT) +endif + +# Construct the flags to use for the various memory spaces +ifeq ($(ARCH), AVR8) + ATPROGRAM_FLASH_FLAGS := --chiperase --flash + ATPROGRAM_EEPROM_FLAGS := --eeprom +else ifeq ($(ARCH), XMEGA) + ATPROGRAM_FLASH_FLAGS := --erase --flash + ATPROGRAM_EEPROM_FLAGS := --eeprom +else ifeq ($(ARCH), UC3) + ATPROGRAM_FLASH_FLAGS := --erase + ATPROGRAM_EEPROM_FLAGS := --eeprom +else + $(error Unsupported architecture "$(ARCH)") +endif + +atprogram: $(TARGET).elf $(MAKEFILE_LIST) + @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\" + atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_FLASH_FLAGS) --file $< + +atprogram-ee: $(TARGET).elf $(MAKEFILE_LIST) + @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\" + atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_EEPROM_FLAGS) --file $< + +# Phony build targets for this module +.PHONY: atprogram atprogram-ee diff --git a/LUFA/Build/lufa_avrdude.mk b/LUFA/Build/lufa_avrdude.mk new file mode 100644 index 000000000..21f93ef26 --- /dev/null +++ b/LUFA/Build/lufa_avrdude.mk @@ -0,0 +1,84 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +LUFA_BUILD_MODULES += AVRDUDE +LUFA_BUILD_TARGETS += avrdude avrdude-ee +LUFA_BUILD_MANDATORY_VARS += MCU TARGET +LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS +LUFA_BUILD_PROVIDED_VARS += +LUFA_BUILD_PROVIDED_MACROS += + +# ----------------------------------------------------------------------------- +# LUFA AVRDUDE Programmer Buildsystem Makefile Module. +# ----------------------------------------------------------------------------- +# DESCRIPTION: +# Provides a set of targets to re-program a device using the open source +# avr-dude utility. +# ----------------------------------------------------------------------------- +# TARGETS: +# +# avrdude - Program target FLASH with application using +# avrdude +# avrdude-ee - Program target EEPROM with application data +# using avrdude +# +# MANDATORY PARAMETERS: +# +# MCU - Microcontroller device model name +# TARGET - Application name +# +# OPTIONAL PARAMETERS: +# +# AVRDUDE_PROGRAMMER - Name of programming hardware to use +# AVRDUDE_PORT - Name of communication port to use +# AVRDUDE_FLAGS - Flags to pass to avr-dude +# +# PROVIDED VARIABLES: +# +# (None) +# +# PROVIDED MACROS: +# +# (None) +# +# ----------------------------------------------------------------------------- + +SHELL = /bin/sh + +ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) +ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) +ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) + +# Default values of optionally user-supplied variables +AVRDUDE_PROGRAMMER ?= jtagicemkii +AVRDUDE_PORT ?= usb +AVRDUDE_FLAGS ?= + +# Sanity check user supplied values +$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) +$(call ERROR_IF_EMPTY, MCU) +$(call ERROR_IF_EMPTY, TARGET) +$(call ERROR_IF_EMPTY, AVRDUDE_PROGRAMMER) +$(call ERROR_IF_EMPTY, AVRDUDE_PORT) + +# Output Messages +MSG_AVRDUDE_CMD := ' [AVRDUDE] :' + +# Construct base avrdude command flags +BASE_AVRDUDE_FLAGS := -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) + +avrdude: $(TARGET).hex $(MAKEFILE_LIST) + @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" FLASH with settings \"$(AVRDUDE_FLASH_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" + avrdude $(BASE_AVRDUDE_FLAGS) -U flash:w:$< $(AVRDUDE_FLAGS) + +avrdude-ee: $(TARGET).eep $(MAKEFILE_LIST) + @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" EEPROM with settings \"$(AVRDUDE_EEP_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" + avrdude $(BASE_AVRDUDE_FLAGS) -U eeprom:w:$< $(AVRDUDE_FLAGS) + +# Phony build targets for this module +.PHONY: avrdude avrdude-ee diff --git a/LUFA/Build/lufa_build.mk b/LUFA/Build/lufa_build.mk new file mode 100644 index 000000000..bed98c272 --- /dev/null +++ b/LUFA/Build/lufa_build.mk @@ -0,0 +1,296 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +LUFA_BUILD_MODULES += BUILD +LUFA_BUILD_TARGETS += size check-source symbol-sizes all lib elf hex lss clean mostlyclean +LUFA_BUILD_MANDATORY_VARS += TARGET ARCH MCU SRC F_USB LUFA_PATH +LUFA_BUILD_OPTIONAL_VARS += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_FLAGS CPP_FLAGS ASM_FLAGS CC_FLAGS LD_FLAGS OBJDIR OBJECT_FILES DEBUG_TYPE DEBUG_LEVEL +LUFA_BUILD_PROVIDED_VARS += +LUFA_BUILD_PROVIDED_MACROS += + +# ----------------------------------------------------------------------------- +# LUFA GCC Compiler Buildsystem Makefile Module. +# ----------------------------------------------------------------------------- +# DESCRIPTION: +# Provides a set of targets to build a C, C++ and/or Assembly application +# via the AVR-GCC compiler. +# ----------------------------------------------------------------------------- +# TARGETS: +# +# size - List built application size +# symbol-sizes - Print application symbols from the binary ELF +# file as a list sorted by size in bytes +# check-source - Print a list of SRC source files that cannot +# be found +# all - Build application and list size +# lib - Build and archive source files into a library +# elf - Build application ELF debug object file +# hex - Build application HEX object files +# lss - Build application LSS assembly listing file +# clean - Remove all project intermediatary and binary +# output files +# mostlyclean - Remove intermediatary output files, but +# preserve binaries +# +# MANDATORY PARAMETERS: +# +# TARGET - Application name +# ARCH - Device architecture name +# MCU - Microcontroller device model name +# SRC - List of input source files (*.c, *.cpp, *.S) +# F_USB - Speed of the input clock of the USB controller +# in Hz +# LUFA_PATH - Path to the LUFA library core +# +# OPTIONAL PARAMETERS: +# +# BOARD - LUFA board hardware +# OPTIMIZATION - Optimization level +# C_STANDARD - C Language Standard to use +# CPP_STANDARD - C++ Language Standard to use +# F_CPU - Speed of the CPU, in Hz +# C_FLAGS - Flags to pass to the C compiler only +# CPP_FLAGS - Flags to pass to the C++ compiler only +# ASM_FLAGS - Flags to pass to the assembler only +# CC_FLAGS - Common flags to pass to the C/C++ compiler and +# assembler +# LD_FLAGS - Flags to pass to the linker +# OBJDIR - Directory for the output object and dependency +# files; if equal to ".", the output files will +# be generated in the same folder as the sources +# OBJECT_FILES - Extra object files to link in to the binaries +# DEBUG_FORMAT - Format of the debugging information to +# generate in the compiled object files +# DEBUG_LEVEL - Level the debugging information to generate in +# the compiled object files +# +# PROVIDED VARIABLES: +# +# (None) +# +# PROVIDED MACROS: +# +# (None) +# +# ----------------------------------------------------------------------------- + +SHELL = /bin/sh + +ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) +ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) +ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) + +# Default values of optionally user-supplied variables +BOARD ?= NONE +OPTIMIZATION ?= s +F_CPU ?= +C_STANDARD ?= gnu99 +CPP_STANDARD ?= gnu++98 +C_FLAGS ?= +CPP_FLAGS ?= +ASM_FLAGS ?= +CC_FLAGS ?= +OBJDIR ?= . +OBJECT_FILES ?= +DEBUG_FORMAT ?= dwarf-2 +DEBUG_LEVEL ?= 3 + +# Sanity check user supplied values +$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) +$(call ERROR_IF_EMPTY, MCU) +$(call ERROR_IF_EMPTY, TARGET) +$(call ERROR_IF_EMPTY, ARCH) +$(call ERROR_IF_EMPTY, F_USB) +$(call ERROR_IF_EMPTY, LUFA_PATH) +$(call ERROR_IF_EMPTY, BOARD) +$(call ERROR_IF_EMPTY, OPTIMIZATION) +$(call ERROR_IF_EMPTY, C_STANDARD) +$(call ERROR_IF_EMPTY, CPP_STANDARD) +$(call ERROR_IF_EMPTY, OBJDIR) +$(call ERROR_IF_EMPTY, DEBUG_FORMAT) +$(call ERROR_IF_EMPTY, DEBUG_LEVEL) + +# Determine the utility prefix to use for the selected architecture +ifeq ($(ARCH), AVR8) + CROSS := avr +else ifeq ($(ARCH), XMEGA) + CROSS := avr + $(warning The XMEGA device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.) +else ifeq ($(ARCH), UC3) + CROSS := avr32 + $(warning The UC3 device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.) +else + $(error Unsupported architecture "$(ARCH)") +endif + +# Output Messages +MSG_COMPILE_CMD := ' [GCC] :' +MSG_ASSEMBLE_CMD := ' [GAS] :' +MSG_NM_CMD := ' [NM] :' +MSG_REMOVE_CMD := ' [RM] :' +MSG_LINK_CMD := ' [LNK] :' +MSG_ARCHIVE_CMD := ' [AR] :' +MSG_SIZE_CMD := ' [SIZE] :' +MSG_OBJCPY_CMD := ' [OBJCPY] :' +MSG_OBJDMP_CMD := ' [OBJDMP] :' + +# Convert input source file list to differentiate them by type +C_SOURCE := $(filter %.c, $(SRC)) +CPP_SOURCE := $(filter %.cpp, $(SRC)) +ASM_SOURCE := $(filter %.S, $(SRC)) + +# Create a list of unknown source file types, if any are found throw an error +UNKNOWN_SOURCE := $(filter-out $(C_SOURCE) $(CPP_SOURCE) $(ASM_SOURCE), $(SRC)) +ifneq ($(UNKNOWN_SOURCE),) + $(error Unknown input source file formats: $(UNKNOWN_SOURCE)) +endif + +# Convert input source filenames into a list of required output object files +OBJECT_FILES += $(addsuffix .o, $(basename $(SRC))) +ifneq ($(OBJDIR),.) + $(shell mkdir $(OBJDIR) 2> /dev/null) + VPATH += $(dir $(SRC)) + OBJECT_FILES := $(addprefix $(patsubst %/,%,$(OBJDIR))/, $(notdir $(OBJECT_FILES))) + + # Check if any object file (without path) appears more than once in the object file list + ifneq ($(words $(sort $(OBJECT_FILES))), $(words $(OBJECT_FILES))) + $(error Cannot build with OBJDIR parameter set - one or more object file name is not unique) + endif +endif + +# Create a list of dependency files from the list of object files +DEPENDENCY_FILES := $(OBJECT_FILES:%.o=%.d) + +# Create a list of common flags to pass to the compiler/linker/assembler +BASE_CC_FLAGS := -pipe -g$(DEBUG_FORMAT) -g$(DEBUG_LEVEL) +ifeq ($(ARCH), AVR8) + BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct +else ifeq ($(ARCH), XMEGA) + BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct +else ifeq ($(ARCH), UC3) + BASE_CC_FLAGS += -mpart=$(MCU:at32%=%) -masm-addr-pseudos +endif +BASE_CC_FLAGS += -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections +BASE_CC_FLAGS += -I. -I$(patsubst %/,%,$(LUFA_PATH))/.. +BASE_CC_FLAGS += -DARCH=ARCH_$(ARCH) -DBOARD=BOARD_$(BOARD) -DF_USB=$(F_USB)UL +ifneq ($(F_CPU),) + BASE_CC_FLAGS += -DF_CPU=$(F_CPU)UL +endif + +# Additional language specific compiler flags +BASE_C_FLAGS := -x c -O$(OPTIMIZATION) -std=$(C_STANDARD) -Wstrict-prototypes +BASE_CPP_FLAGS := -x c++ -O$(OPTIMIZATION) -std=$(CPP_STANDARD) +BASE_ASM_FLAGS := -x assembler-with-cpp + +# Create a list of flags to pass to the linker +BASE_LD_FLAGS := -lm -Wl,-Map=$(TARGET).map,--cref -Wl,--gc-sections -Wl,--relax +ifeq ($(ARCH), AVR8) + BASE_LD_FLAGS += -mmcu=$(MCU) +else ifeq ($(ARCH), XMEGA) + BASE_LD_FLAGS += -mmcu=$(MCU) +else ifeq ($(ARCH), UC3) + BASE_LD_FLAGS += -mpart=$(MCU:at32%=%) --rodata-writable --direct-data +endif + +# Determine flags to pass to the size utility based on its reported features (only invoke if size target required) +size: SIZE_MCU_FLAG := $(shell $(CROSS)-size --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) +size: SIZE_FORMAT_FLAG := $(shell $(CROSS)-size --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) + + +build_begin: + @echo "" + @echo Begin compilation of project \"$(TARGET)\"... + @echo "" + +build_end: + @echo Finished building project \"$(TARGET)\". + @echo "" + +gcc-version: + @$(CROSS)-gcc --version + +check-source: + @for f in $(SRC); do \ + if [ ! -f $$f ]; then \ + echo "Error: Source file not found: $$f"; \ + exit 1; \ + fi; \ + done + +size: $(TARGET).elf + @echo $(MSG_SIZE_CMD) Determining size of \"$<\" + @echo "" + $(CROSS)-size $(SIZE_MCU_FLAG) $(SIZE_FORMAT_FLAG) $< ; 2>/dev/null; + +symbol-sizes: $(TARGET).elf + @echo $(MSG_NM_CMD) Extracting \"$<\" symbols with decimal byte sizes + $(CROSS)-nm --size-sort --demangle --radix=d $< + +mostlyclean: + @echo $(MSG_REMOVE_CMD) Removing object files of \"$(TARGET)\" + rm -f $(OBJECT_FILES) + @echo $(MSG_REMOVE_CMD) Removing dependency files of \"$(TARGET)\" + rm -f $(DEPENDENCY_FILES) + +clean: mostlyclean + @echo $(MSG_REMOVE_CMD) Removing output files of \"$(TARGET)\" + rm -f $(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).map $(TARGET).lss $(TARGET).sym $(TARGET).a + +all: build_begin check-source gcc-version elf hex lss sym size build_end + +lib: lib$(TARGET).a +elf: $(TARGET).elf +hex: $(TARGET).hex $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + +$(OBJDIR)/%.o: %.c $(MAKEFILE_LIST) + @echo $(MSG_COMPILE_CMD) Compiling C file \"$(notdir $<)\" + $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_C_FLAGS) $(CC_FLAGS) $(C_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@ + +$(OBJDIR)/%.o: %.cpp $(MAKEFILE_LIST) + @echo $(MSG_COMPILE_CMD) Compiling C++ file \"$(notdir $<)\" + $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_CPP_FLAGS) $(CC_FLAGS) $(CPP_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@ + +$(OBJDIR)/%.o: %.S $(MAKEFILE_LIST) + @echo $(MSG_ASSEMBLE_CMD) Assembling \"$(notdir $<)\" + $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_ASM_FLAGS) $(CC_FLAGS) $(ASM_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@ + +.PRECIOUS : $(OBJECT_FILES) +.SECONDARY : %.a +%.a: $(OBJECT_FILES) + @echo $(MSG_ARCHIVE_CMD) Archiving object files into \"$@\" + $(CROSS)-ar rcs $@ $(OBJECT_FILES) + +.PRECIOUS : $(OBJECT_FILES) +.SECONDARY : %.elf +%.elf: $(OBJECT_FILES) + @echo $(MSG_LINK_CMD) Linking object files into \"$@\" + $(CROSS)-gcc $(BASE_LD_FLAGS) $(LD_FLAGS) $^ -o $@ + +%.hex: %.elf + @echo $(MSG_OBJCPY_CMD) Extracting HEX file data from \"$<\" + $(CROSS)-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@ + +%.eep: %.elf + @echo $(MSG_OBJCPY_CMD) Extracting EEP file data from \"$<\" + $(CROSS)-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex $< $@ || exit 0 + +%.lss: %.elf + @echo $(MSG_OBJDMP_CMD) Extracting LSS file data from \"$<\" + $(CROSS)-objdump -h -S -z $< > $@ + +%.sym: %.elf + @echo $(MSG_NM_CMD) Extracting SYM file data from \"$<\" + $(CROSS)-nm -n $< > $@ + +# Include build dependency files +-include $(DEPENDENCY_FILES) + +# Phony build targets for this module +.PHONY: build_begin build_end gcc-version check-source size symbol-sizes lib elf hex lss clean mostlyclean diff --git a/LUFA/Build/lufa_core.mk b/LUFA/Build/lufa_core.mk new file mode 100644 index 000000000..f44b407ed --- /dev/null +++ b/LUFA/Build/lufa_core.mk @@ -0,0 +1,152 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +LUFA_BUILD_MODULES += CORE +LUFA_BUILD_TARGETS += help list_targets list_modules list_mandatory list_optional list_provided list_macros +LUFA_BUILD_MANDATORY_VARS += +LUFA_BUILD_OPTIONAL_VARS += +LUFA_BUILD_PROVIDED_VARS += +LUFA_BUILD_PROVIDED_MACROS += + +# ----------------------------------------------------------------------------- +# LUFA Core Build System Makefile Module. +# ----------------------------------------------------------------------------- +# DESCRIPTION: +# Provides a set of core build targets for the LUFA build system +# ----------------------------------------------------------------------------- +# TARGETS: +# +# help - Build system help +# list_targets - List all build targets +# list_modules - List all build modules +# list_mandatory - List all mandatory make variables required by +# the included build modules of the application +# list_optional - List all optional make variables required by +# the included build modules of the application +# list_provided - List all provided make variables from the +# included build modules of the application +# list_macros - List all provided make macros from the +# included build modules of the application +# +# MANDATORY PARAMETERS: +# +# (None) +# +# OPTIONAL PARAMETERS: +# +# (None) +# +# PROVIDED VARIABLES: +# +# (None) +# +# PROVIDED MACROS: +# +# (None) +# +# ----------------------------------------------------------------------------- + +SHELL = /bin/sh + +# Build sorted and filtered lists of the included build module data +SORTED_LUFA_BUILD_MODULES = $(sort $(LUFA_BUILD_MODULES)) +SORTED_LUFA_BUILD_TARGETS = $(sort $(LUFA_BUILD_TARGETS)) +SORTED_LUFA_MANDATORY_VARS = $(sort $(LUFA_BUILD_MANDATORY_VARS)) +SORTED_LUFA_OPTIONAL_VARS = $(filter-out $(SORTED_LUFA_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS))) +SORTED_LUFA_PROVIDED_VARS = $(sort $(LUFA_BUILD_PROVIDED_VARS)) +SORTED_LUFA_PROVIDED_MACROS = $(sort $(LUFA_BUILD_PROVIDED_MACROS)) + +# Create printable versions of the sorted build module data (use "(None)" when no data is available) +PRINTABLE_LUFA_BUILD_MODULES = $(if $(strip $(SORTED_LUFA_BUILD_MODULES)), $(SORTED_LUFA_BUILD_MODULES), (None)) +PRINTABLE_LUFA_BUILD_TARGETS = $(if $(strip $(SORTED_LUFA_BUILD_TARGETS)), $(SORTED_LUFA_BUILD_TARGETS), (None)) +PRINTABLE_LUFA_MANDATORY_VARS = $(if $(strip $(SORTED_LUFA_MANDATORY_VARS)), $(SORTED_LUFA_MANDATORY_VARS), (None)) +PRINTABLE_LUFA_OPTIONAL_VARS = $(if $(strip $(SORTED_LUFA_OPTIONAL_VARS)), $(SORTED_LUFA_OPTIONAL_VARS), (None)) +PRINTABLE_LUFA_PROVIDED_VARS = $(if $(strip $(SORTED_LUFA_PROVIDED_VARS)), $(SORTED_LUFA_PROVIDED_VARS), (None)) +PRINTABLE_LUFA_PROVIDED_MACROS = $(if $(strip $(SORTED_LUFA_PROVIDED_MACROS)), $(SORTED_LUFA_PROVIDED_MACROS), (None)) + +help: + @echo "===================================================================" + @echo " LUFA Build System 2.0 " + @echo " (C) Dean Camera, 2012 { dean @ fourwalledcubicle . com } " + @echo "===================================================================" + @echo "DESCRIPTION: " + @echo " This build system is a set of makefile modules for (GNU) Make, to " + @echo " provide a simple system for building LUFA powered applications. " + @echo " Each makefile module can be included from within a user makefile, " + @echo " to expose the build rules documented in the comments at the top of" + @echo " each build module. " + @echo " " + @echo "USAGE: " + @echo " To execute a rule, define all variables indicated in the desired " + @echo " module as a required parameter before including the build module " + @echo " in your project makefile. Parameters marked as optional will " + @echo " assume a default value in the modules if not user-assigned. " + @echo " " + @echo " By default the target output shows both a friendly summary, as " + @echo " well as the actual invoked command. To suppress the output of the " + @echo " invoked commands and show only the friendly command output, run " + @echo " make with the \"-s\" switch added before the target(s). " + @echo "===================================================================" + @echo " " + @echo " Currently used build system modules in this application: " + @echo " " + @printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%= - %\n)" + @echo " " + @echo " " + @echo " Currently available build targets in this application: " + @echo " " + @printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%= - %\n)" + @echo " " + @echo " " + @echo " Mandatory variables required by the selected build Modules: " + @echo " " + @printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%= - %\n)" + @echo " " + @echo " " + @echo " Optional variables required by the selected build Modules: " + @echo " " + @printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%= - %\n)" + @echo " " + @echo " " + @echo " Variables provided by the selected build Modules: " + @echo " " + @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%= - %\n)" + @echo " " + @echo " " + @echo " Macros provided by the selected build Modules: " + @echo " " + @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%= - %\n)" + @echo " " + @echo "===================================================================" + @echo " The LUFA BuildSystem 2.0 - Powered By Unicorns (tm) " + @echo "===================================================================" + +list_modules: + @echo Currently Used Build System Modules: $(PRINTABLE_LUFA_BUILD_MODULES) + +list_targets: + @echo Currently Available Build Targets: $(PRINTABLE_LUFA_BUILD_TARGETS) + +list_mandatory: + @echo Mandatory Variables for Included Modules: $(PRINTABLE_LUFA_MANDATORY_VARS) + +list_optional: + @echo Optional Variables for Included Modules: $(PRINTABLE_LUFA_OPTIONAL_VARS) + +list_provided: + @echo Variables Provided by the Included Modules: $(PRINTABLE_LUFA_PROVIDED_VARS) + +list_macros: + @echo Macros Provided by the Included Modules: $(PRINTABLE_LUFA_PROVIDED_MACROS) + +# Disable default in-built make rules (those that are needed are explicitly +# defined, and doing so has performance benefits when recursively building) +.SUFFIXES: + +# Phony build targets for this module +.PHONY: help list_modules list_targets list_mandatory list_optional list_provided list_macros diff --git a/LUFA/Build/lufa_cppcheck.mk b/LUFA/Build/lufa_cppcheck.mk new file mode 100644 index 000000000..1593a4279 --- /dev/null +++ b/LUFA/Build/lufa_cppcheck.mk @@ -0,0 +1,104 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +LUFA_BUILD_MODULES += CPPCHECK +LUFA_BUILD_TARGETS += cppcheck cppcheck-config +LUFA_BUILD_MANDATORY_VARS += SRC +LUFA_BUILD_OPTIONAL_VARS += CPPCHECK_INCLUDES CPPCHECK_EXCLUDES CPPCHECK_MSG_TEMPLATE CPPCHECK_ENABLE \ + CPPCHECK_SUPPRESS CPPCHECK_FAIL_ON_WARNING CPPCHECK_QUIET CPPCHECK_FLAGS +LUFA_BUILD_PROVIDED_VARS += +LUFA_BUILD_PROVIDED_MACROS += + +# ----------------------------------------------------------------------------- +# LUFA CPPCheck Buildsystem Makefile Module. +# ----------------------------------------------------------------------------- +# DESCRIPTION: +# Provides a set of targets to scan a project with the free "cppcheck" static +# analysis tool, to check for code errors at runtime (see http://cppcheck.sourceforge.net). +# ----------------------------------------------------------------------------- +# TARGETS: +# +# cppcheck - Scan the project with CPPCheck +# cppcheck-config - Use CPPCheck to look for missing include files +# +# MANDATORY PARAMETERS: +# +# SRC - List of source files to statically analyze +# +# OPTIONAL PARAMETERS: +# +# CPPCHECK_INCLUDES - Extra include paths to search for missing +# header files +# CPPCHECK_EXCLUDES - Source file paths to exclude checking (can be +# a path fragment if desired) +# CPPCHECK_MSG_TEMPLATE - Template for cppcheck error and warning output +# CPPCHECK_ENABLE - General cppcheck category checks to enable +# CPPCHECK_SUPPRESS - Specific cppcheck warnings to disable by ID +# CPPCHECK_FAIL_ON_WARNING - Set to Y to fail the build on cppcheck +# warnings, N to continue even if warnings occur +# CPPCHECK_QUIET - Enable cppcheck verbose or quiet output mode +# CPPCHECK_FLAGS - Additional flags to pass to cppcheck +# +# PROVIDED VARIABLES: +# +# (None) +# +# PROVIDED MACROS: +# +# (None) +# +# ----------------------------------------------------------------------------- + +SHELL = /bin/sh + +ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) +ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) +ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) + +# Default values of optionally user-supplied variables +CPPCHECK_INCLUDES ?= +CPPCHECK_EXCLUDES ?= +CPPCHECK_MSG_TEMPLATE ?= {file}:{line}: {severity} ({id}): {message} +CPPCHECK_ENABLE ?= all +CPPCHECK_SUPPRESS ?= variableScope missingInclude +CPPCHECK_FAIL_ON_WARNING ?= Y +CPPCHECK_QUIET ?= Y +CPPCHECK_FLAGS ?= + +# Sanity check user supplied values +$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) +$(call ERROR_IF_EMPTY, SRC) +$(call ERROR_IF_EMPTY, CPPCHECK_MSG_TEMPLATE) +$(call ERROR_IF_EMPTY, CPPCHECK_ENABLE) +$(call ERROR_IF_NONBOOL, CPPCHECK_FAIL_ON_WARNING) +$(call ERROR_IF_NONBOOL, CPPCHECK_QUIET) + +# Build a default argument list for cppcheck +BASE_CPPCHECK_FLAGS := --template="$(CPPCHECK_MSG_TEMPLATE)" $(CPPCHECK_INCLUDES:%=-I%) $(CPPCHECK_EXCLUDES:%=-i%) --inline-suppr --force --std=c99 + +# Sanity check parameters and construct additional command line arguments to cppcheck +ifeq ($(CPPCHECK_FAIL_ON_WARNING), Y) + BASE_CPPCHECK_FLAGS += --error-exitcode=1 +endif +ifeq ($(CPPCHECK_QUIET), Y) + BASE_CPPCHECK_FLAGS += --quiet +endif + +# Output Messages +MSG_CPPCHECK_CMD := ' [CPPCHECK]:' + +cppcheck-config: + @echo $(MSG_CPPCHECK_CMD) Checking cppcheck configuration check on source files + cppcheck $(BASE_CPPCHECK_FLAGS) --check-config $(CPPCHECK_FLAGS) $(SRC) + +cppcheck: + @echo $(MSG_CPPCHECK_CMD) Performing static analysis on source files + cppcheck $(BASE_CPPCHECK_FLAGS) --enable=$(CPPCHECK_ENABLE) $(CPPCHECK_SUPPRESS:%=--suppress=%) $(CPPCHECK_FLAGS) $(SRC) + +# Phony build targets for this module +.PHONY: cppcheck-config cppcheck diff --git a/LUFA/Build/lufa.dfu.in b/LUFA/Build/lufa_dfu.mk similarity index 52% rename from LUFA/Build/lufa.dfu.in rename to LUFA/Build/lufa_dfu.mk index f04472e3b..ba75f14a7 100644 --- a/LUFA/Build/lufa.dfu.in +++ b/LUFA/Build/lufa_dfu.mk @@ -1,71 +1,93 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += DFU -LUFA_BUILD_TARGETS += flip flip-ee dfu dfu-ee - -# ----------------------------------------------------------------------------- -# LUFA DFU Bootloader Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of targets to re-program a device currently running a DFU -# class bootloader with a project's FLASH and EEPROM files. -# ----------------------------------------------------------------------------- -# TARGETS: -# -# flip - Program FLASH into target via Atmel FLIP -# flip-ee - Program EEPROM into target via Atmel FLIP -# dfu - Program FLASH into target via dfu-programmer -# dfu-ee - Program EEPROM into target via dfu-programmer -# -# MANDATORY PARAMETERS: -# -# MCU - Microcontroller device model name -# TARGET - Application name -# -# OPTIONAL PARAMETERS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -# Output Messages -MSG_DFU_CMD = ' [DFU] :' - -# Sanity check the user MCU and TARGET makefile options -ifeq ($(MCU),) - $(error Makefile MCU value not set.) -endif -ifeq ($(TARGET),) - $(error Makefile TARGET value not set.) -endif - -flip: $(TARGET).hex - @echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$(TARGET).hex\" - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -flip-ee: $(TARGET).eep - cp $(TARGET).eep $(TARGET)eep.hex - @echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$(TARGET).eep\" - batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase - batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - rm $(TARGET)eep.hex - -dfu: $(TARGET).hex - @echo $(MSG_DFU_CMD) Programming FLASH with dfu-programmer using \"$(TARGET).hex\" - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - -dfu-ee: $(TARGET).hex $(TARGET).eep - @echo $(MSG_DFU_CMD) Programming EEPROM with dfu-programmer using \"$(TARGET).eep\" - dfu-programmer $(MCU) eeprom-flash $(TARGET).eep - dfu-programmer $(MCU) reset \ No newline at end of file +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +LUFA_BUILD_MODULES += DFU +LUFA_BUILD_TARGETS += flip flip-ee dfu dfu-ee +LUFA_BUILD_MANDATORY_VARS += MCU TARGET +LUFA_BUILD_OPTIONAL_VARS += +LUFA_BUILD_PROVIDED_VARS += +LUFA_BUILD_PROVIDED_MACROS += + +# ----------------------------------------------------------------------------- +# LUFA DFU Bootloader Buildsystem Makefile Module. +# ----------------------------------------------------------------------------- +# DESCRIPTION: +# Provides a set of targets to re-program a device currently running a DFU +# class bootloader with a project's FLASH and EEPROM files. +# ----------------------------------------------------------------------------- +# TARGETS: +# +# flip - Program FLASH into target via Atmel FLIP +# flip-ee - Program EEPROM into target via Atmel FLIP +# dfu - Program FLASH into target via dfu-programmer +# dfu-ee - Program EEPROM into target via dfu-programmer +# +# MANDATORY PARAMETERS: +# +# MCU - Microcontroller device model name +# TARGET - Application name +# +# OPTIONAL PARAMETERS: +# +# (None) +# +# PROVIDED VARIABLES: +# +# (None) +# +# PROVIDED MACROS: +# +# (None) +# +# ----------------------------------------------------------------------------- + +SHELL = /bin/sh + +ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) +ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) +ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) + +# Sanity-check values of mandatory user-supplied variables +$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) +$(call ERROR_IF_EMPTY, MCU) +$(call ERROR_IF_EMPTY, TARGET) + +# Output Messages +MSG_COPY_CMD := ' [CP] :' +MSG_REMOVE_CMD := ' [RM] :' +MSG_DFU_CMD := ' [DFU] :' + +flip: $(TARGET).hex $(MAKEFILE_LIST) + @echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$<\" + batchisp -hardware usb -device $(MCU) -operation erase f + batchisp -hardware usb -device $(MCU) -operation loadbuffer $< program + batchisp -hardware usb -device $(MCU) -operation start reset 0 + +flip-ee: $(TARGET).eep $(MAKEFILE_LIST) + @echo $(MSG_DFU_CMD) Copying EEP file to temporary file \"$<.hex\" + cp $< $<.hex + @echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$<.hex\" + batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase + batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $<.hex program + batchisp -hardware usb -device $(MCU) -operation start reset 0 + @echo $(MSG_DFU_CMD) Removing temporary file \"$<.hex\" + rm $<.hex + +dfu: $(TARGET).hex $(MAKEFILE_LIST) + @echo $(MSG_DFU_CMD) Programming FLASH with dfu-programmer using \"$<\" + dfu-programmer $(MCU) erase + dfu-programmer $(MCU) flash $< + dfu-programmer $(MCU) reset + +dfu-ee: $(TARGET).eep $(MAKEFILE_LIST) + @echo $(MSG_DFU_CMD) Programming EEPROM with dfu-programmer using \"$<\" + dfu-programmer $(MCU) eeprom-flash $< + dfu-programmer $(MCU) reset + +# Phony build targets for this module +.PHONY: flip flip-ee dfu dfu-ee diff --git a/LUFA/Build/lufa_doxygen.mk b/LUFA/Build/lufa_doxygen.mk new file mode 100644 index 000000000..7f7334311 --- /dev/null +++ b/LUFA/Build/lufa_doxygen.mk @@ -0,0 +1,81 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +LUFA_BUILD_MODULES += DOXYGEN +LUFA_BUILD_TARGETS += doxygen +LUFA_BUILD_MANDATORY_VARS += LUFA_PATH +LUFA_BUILD_OPTIONAL_VARS += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRIDE_PARAMS +LUFA_BUILD_PROVIDED_VARS += +LUFA_BUILD_PROVIDED_MACROS += + +# ----------------------------------------------------------------------------- +# LUFA Doxygen Buildsystem Makefile Module. +# ----------------------------------------------------------------------------- +# DESCRIPTION: +# Provides a set of targets to automatically build Doxygen documentation for +# a project (see www.doxygen.org). +# ----------------------------------------------------------------------------- +# TARGETS: +# +# doxygen - Build Doxygen Documentation +# +# MANDATORY PARAMETERS: +# +# LUFA_PATH - Path to the LUFA library core +# +# OPTIONAL PARAMETERS: +# +# DOXYGEN_CONF - Doxygen configuration filename +# DOXYGEN_FAIL_ON_WARNING - Set to Y to fail the build on Doxygen warnings, +# N to continue even if warnings occur +# DOXYGEN_OVERRIDE_PARAMS - Parameters to override in the doxygen +# configuration file +# PROVIDED VARIABLES: +# +# (None) +# +# PROVIDED MACROS: +# +# (None) +# +# ----------------------------------------------------------------------------- + +SHELL = /bin/sh + +ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) +ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) +ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) + +# Default values of optionally user-supplied variables +DOXYGEN_CONF ?= Doxygen.conf +DOXYGEN_FAIL_ON_WARNING ?= Y +DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css + +# Sanity check user supplied values +$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) +$(call ERROR_IF_EMPTY, DOXYGEN_CONF) +$(call ERROR_IF_EMPTY, LUFA_PATH) +$(call ERROR_IF_NONBOOL, DOXYGEN_FAIL_ON_WARNING) + +# Output Messages +MSG_DOXYGEN_CMD := ' [DOXYGEN] :' + +# Determine Doxygen invocation command +BASE_DOXYGEN_CMD := ( cat $(DOXYGEN_CONF) $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen - +ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y) + DOXYGEN_CMD := if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi; +else + DOXYGEN_CMD := $(BASE_DOXYGEN_CMD) +endif + +doxygen: + @echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\" + $(DOXYGEN_CMD) + +# Phony build targets for this module +.PHONY: doxygen diff --git a/LUFA/Build/lufa_hid.mk b/LUFA/Build/lufa_hid.mk new file mode 100644 index 000000000..a74197a0b --- /dev/null +++ b/LUFA/Build/lufa_hid.mk @@ -0,0 +1,88 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +LUFA_BUILD_MODULES += HID +LUFA_BUILD_TARGETS += hid hid-ee teensy teensy-ee +LUFA_BUILD_MANDATORY_VARS += MCU TARGET +LUFA_BUILD_OPTIONAL_VARS += +LUFA_BUILD_PROVIDED_VARS += +LUFA_BUILD_PROVIDED_MACROS += + +# ----------------------------------------------------------------------------- +# LUFA HID Bootloader Buildsystem Makefile Module. +# ----------------------------------------------------------------------------- +# DESCRIPTION: +# Provides a set of targets to re-program a device currently running a HID +# class bootloader with a project's FLASH files. +# ----------------------------------------------------------------------------- +# TARGETS: +# +# hid - Program FLASH into target via +# hid_bootloader_cli +# hid-ee - Program EEPROM into target via a temporary +# AVR application and hid_bootloader_cli +# teensy - Program FLASH into target via +# teensy_loader_cli +# teensy-ee - Program EEPROM into target via a temporary +# AVR application and teensy_loader_cli +# +# MANDATORY PARAMETERS: +# +# MCU - Microcontroller device model name +# TARGET - Application name +# +# OPTIONAL PARAMETERS: +# +# (None) +# +# PROVIDED VARIABLES: +# +# (None) +# +# PROVIDED MACROS: +# +# (None) +# +# ----------------------------------------------------------------------------- + +ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) +ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) +ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) + +# Sanity-check values of mandatory user-supplied variables +$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) +$(call ERROR_IF_EMPTY, MCU) +$(call ERROR_IF_EMPTY, TARGET) + +# Output Messages +MSG_HID_BOOTLOADER_CMD := ' [HID] :' +MSG_OBJCPY_CMD := ' [OBJCPY] :' +MSG_MAKE_CMD := ' [MAKE] :' + +hid: $(TARGET).hex $(MAKEFILE_LIST) + @echo $(MSG_HID_BOOTLOADER_CMD) Programming FLASH with hid_bootloader_cli using \"$<\" + hid_bootloader_cli -mmcu=$(MCU) -v $< + +hid-ee: $(TARGET).eep $(MAKEFILE_LIST) + @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a binary file \"InputEEData.bin\" + avr-objcopy -I ihex -O binary $< $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/InputEEData.bin + @echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\" + make -C $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/ MCU=$(MCU) clean hid + +teensy: $(TARGET).hex $(MAKEFILE_LIST) + @echo $(MSG_HID_BOOTLOADER_CMD) Programming FLASH with teensy_loader_cli using \"$<\" + teensy_loader_cli -mmcu=$(MCU) -v $< + +teensy-ee: $(TARGET).hex $(MAKEFILE_LIST) + @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a binary file \"InputEEData.bin\" + avr-objcopy -I ihex -O binary $< $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/InputEEData.bin + @echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\" + make -s -C $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/ MCU=$(MCU) clean hid-teensy + +# Phony build targets for this module +.PHONY: hid hid-ee teensy teensy-ee diff --git a/LUFA/Build/lufa_sources.mk b/LUFA/Build/lufa_sources.mk new file mode 100644 index 000000000..0e026c54e --- /dev/null +++ b/LUFA/Build/lufa_sources.mk @@ -0,0 +1,116 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +LUFA_BUILD_MODULES += SOURCES +LUFA_BUILD_TARGETS += +LUFA_BUILD_MANDATORY_VARS += LUFA_PATH ARCH +LUFA_BUILD_OPTIONAL_VARS += +LUFA_BUILD_PROVIDED_VARS += LUFA_SRC_USB LUFA_SRC_USBCLASS LUFA_SRC_TEMPERATURE LUFA_SRC_SERIAL LUFA_SRC_TWI LUFA_SRC_PLATFORM +LUFA_BUILD_PROVIDED_MACROS += + +# ----------------------------------------------------------------------------- +# LUFA Sources Buildsystem Makefile Module. +# ----------------------------------------------------------------------------- +# DESCRIPTION: +# Provides a set of makefile variables for the various LUFA module sources. +# Once included, the sources required to use a given LUFA module will become +# available using the makefile variable names listed in the LUFA project +# documentation. +# ----------------------------------------------------------------------------- +# TARGETS: +# +# (None) +# +# MANDATORY PARAMETERS: +# +# LUFA_PATH - Path to the LUFA library core +# ARCH - Device architecture name +# +# OPTIONAL PARAMETERS: +# +# (None) +# +# PROVIDED VARIABLES: +# +# LUFA_SRC_USB - List of LUFA USB driver source files +# LUFA_SRC_USBCLASS - List of LUFA USB Class driver source files +# LUFA_SRC_TEMPERATURE - List of LUFA temperature sensor driver source +# files +# LUFA_SRC_SERIAL - List of LUFA Serial U(S)ART driver source files +# LUFA_SRC_TWI - List of LUFA TWI driver source files +# LUFA_SRC_PLATFORM - List of LUFA architecture specific platform +# management source files +# +# PROVIDED MACROS: +# +# (None) +# +# ----------------------------------------------------------------------------- + +SHELL = /bin/sh + +ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) +ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) +ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) + +# Sanity check user supplied values +$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) +$(call ERROR_IF_EMPTY, LUFA_PATH) +$(call ERROR_IF_EMPTY, ARCH) + +# Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles +LUFA_ROOT_PATH ?= $(patsubst %/,%,$(LUFA_PATH)) + +# Construct LUFA module source variables +LUFA_SRC_USB := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Device_$(ARCH).c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Endpoint_$(ARCH).c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Host_$(ARCH).c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Pipe_$(ARCH).c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBController_$(ARCH).c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBInterrupt_$(ARCH).c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/EndpointStream_$(ARCH).c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/PipeStream_$(ARCH).c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/ConfigDescriptors.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/DeviceStandardReq.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/Events.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/HostStandardReq.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Core/USBTask.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Common/HIDParser.c +LUFA_SRC_USBCLASS := $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/AudioClassDevice.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/HIDClassDevice.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MassStorageClassDevice.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MIDIClassDevice.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/RNDISClassDevice.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AudioClassHost.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/CDCClassHost.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/HIDClassHost.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MassStorageClassHost.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MIDIClassHost.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/PrinterClassHost.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/RNDISClassHost.c \ + $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/StillImageClassHost.c +LUFA_SRC_TEMPERATURE := $(LUFA_ROOT_PATH)/Drivers/Board/Temperature.c +LUFA_SRC_SERIAL := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/Serial_$(ARCH).c +LUFA_SRC_TWI := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/TWI_$(ARCH).c + +ifeq ($(ARCH), UC3) + LUFA_SRC_PLATFORM := $(LUFA_ROOT_PATH)/Platform/UC3/Exception.S \ + $(LUFA_ROOT_PATH)/Platform/UC3/InterruptManagement.c +else + LUFA_SRC_PLATFORM := +endif + +# Build a list of all available module sources +LUFA_SRC_ALL_FILES := $(LUFA_SRC_USB) \ + $(LUFA_SRC_USBCLASS) \ + $(LUFA_SRC_TEMPERATURE) \ + $(LUFA_SRC_SERIAL) \ + $(LUFA_SRC_TWI) \ + $(LUFA_SRC_PLATFORM) diff --git a/LUFA/CodeTemplates/LUFAConfig.h b/LUFA/CodeTemplates/LUFAConfig.h index 0c9dca363..06882dcc4 100644 --- a/LUFA/CodeTemplates/LUFAConfig.h +++ b/LUFA/CodeTemplates/LUFAConfig.h @@ -117,6 +117,7 @@ // #define DEVICE_STATE_AS_GPIOR {Insert Value Here} // #define FIXED_NUM_CONFIGURATIONS {Insert Value Here} // #define CONTROL_ONLY_DEVICE +// #define MAX_ENDPOINT_INDEX {Insert Value Here} // #define NO_DEVICE_REMOTE_WAKEUP // #define NO_DEVICE_SELF_POWER diff --git a/LUFA/CodeTemplates/makefile_template b/LUFA/CodeTemplates/makefile_template index 6f3c1c706..655408a07 100644 --- a/LUFA/CodeTemplates/makefile_template +++ b/LUFA/CodeTemplates/makefile_template @@ -1,33 +1,36 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# -# -------------------------------------- -# LUFA Project Makefile. -# -------------------------------------- - -MCU = at90usb1287 -ARCH = AVR8 -BOARD = USBKEY -F_CPU = 8000000 -F_USB = $(F_CPU) -OPTIMIZATION = s -TARGET = Target -SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../LUFA/ -CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -LD_FLAGS = - -# Default target -all: - -# Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# +# -------------------------------------- +# LUFA Project Makefile. +# -------------------------------------- + +MCU = at90usb1287 +ARCH = AVR8 +BOARD = USBKEY +F_CPU = 8000000 +F_USB = $(F_CPU) +OPTIMIZATION = s +TARGET = Target +SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_PLATFORM) +LUFA_PATH = ../../LUFA +CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig +LD_FLAGS = + +# Default target +all: + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/LUFA/CodeTemplates/makefile_template.avr8 b/LUFA/CodeTemplates/makefile_template.avr8 deleted file mode 100644 index bdae557b5..000000000 --- a/LUFA/CodeTemplates/makefile_template.avr8 +++ /dev/null @@ -1,715 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make coff = Convert ELF to AVR COFF. -# -# make extcoff = Convert ELF to AVR Extended COFF. -# -# make program = Download the hex file to the device, using avrdude. -# Please customize the avrdude settings below first! -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make dfu-ee = Download the eeprom file to the device, using dfu-programmer -# (must have dfu-programmer installed). -# -# make flip-ee = Download the eeprom file to the device, using Atmel FLIP -# (must have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make debug = Start either simulavr or avarice as specified for debugging, -# with avr-gdb or avr-insight as the front end for debugging. -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = ### INSERT NAME OF MICROCONTROLLER MODEL HERE ### - - -# Targeted chip architecture (see library "Architectures" documentation) -ARCH = AVR8 - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = ### INSERT NAME OF BOARD HERE, OR NONE IF NO BOARD DRIVERS USED ### - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This will be an integer division of F_CLOCK below, as it is sourced by -# F_CLOCK after it has run through any CPU prescalers. Note that this value -# does not *change* the processor frequency - it should merely be updated to -# reflect the processor speed set externally so that the code can use accurate -# software delays. -F_CPU = ### INSERT PRESCALED SYSTEM CLOCK SPEED HERE, IN HZ ### - - -# Input clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency (before any prescaling is performed) in Hz. This value may -# differ from F_CPU if prescaling is used on the latter, and is required as the -# raw input clock is fed directly to the PLL sections of the AVR for high speed -# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' -# at the end, this will be done automatically to create a 32-bit value in your -# source code. -# -# If no clock division is performed on the input clock inside the AVR (via the -# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. -F_USB = ### INSERT CLOCK TO USB MODULE HERE, IN HZ ### - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = ### INSERT NAME OF MAIN FILENAME HERE, WITHOUT EXTENSION ### - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ### INSERT PATH TO LUFA LIBRARY RELATIVE TO PROJECT DIRECTORY HERE ### - - -# LUFA library compile-time options and predefined tokens (add '-D' before each token) -LUFA_OPTS = ### INSERT LUFA COMPILE TIME TOKENS HERE ### - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = $(TARGET).c \ - $(LUFA_SRC_USB) \ - $(LUFA_SRC_USBCLASS) - ### INSERT ADDITIONAL PROJECT SOURCE FILENAMES OR LUFA MODULE NAMES HERE ### - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = s - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=gnu99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -CDEFS += -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += -DARCH=ARCH_$(ARCH) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += -DARCH=ARCH_$(ARCH) -CPPDEFS += $(LUFA_OPTS) - - -# Debugging format. -# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. -# AVR Studio 4.10 requires dwarf-2. -# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. -DEBUG = dwarf-2 - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-inline-small-functions -CFLAGS += -fpack-struct -CFLAGS += -fshort-enums -CFLAGS += -fno-strict-aliasing -CFLAGS += -Wall -CFLAGS += -Wstrict-prototypes -CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -fpack-struct -CPPFLAGS += -fshort-enums -CPPFLAGS += -ffunction-sections -CPPFLAGS += -fno-strict-aliasing -CPPFLAGS += -fno-exceptions -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Library Options ---------------- -# Minimalistic printf version -PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min - -# Floating point printf version (requires MATH_LIB = -lm below) -PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt - -# If this is left blank, then it will use the Standard printf version. -PRINTF_LIB = -#PRINTF_LIB = $(PRINTF_LIB_MIN) -#PRINTF_LIB = $(PRINTF_LIB_FLOAT) - - -# Minimalistic scanf version -SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min - -# Floating point + %[ scanf version (requires MATH_LIB = -lm below) -SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt - -# If this is left blank, then it will use the Standard scanf version. -SCANF_LIB = -#SCANF_LIB = $(SCANF_LIB_MIN) -#SCANF_LIB = $(SCANF_LIB_FLOAT) - - -MATH_LIB = -lm - - -# List any extra directories to look for libraries here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = - - - -#---------------- External Memory Options ---------------- - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# used for variables (.data/.bss) and heap (malloc()). -#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# only used for heap (malloc()). -#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff - -EXTMEMOPTS = - - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--relax -LDFLAGS += -Wl,--gc-sections -LDFLAGS += $(EXTMEMOPTS) -LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) -LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) -#LDFLAGS += -T linker_script.x - - - -#---------------- Programming Options (avrdude) ---------------- - -# Programming hardware -# Type: avrdude -c ? -# to get a full listing. -# -AVRDUDE_PROGRAMMER = jtagmkII - -# com1 = serial port. Use lpt1 to connect to parallel port. -AVRDUDE_PORT = usb - -AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex -#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep - - -# Uncomment the following if you want avrdude's erase cycle counter. -# Note that this counter needs to be initialized first using -Yn, -# see avrdude manual. -#AVRDUDE_ERASE_COUNTER = -y - -# Uncomment the following if you do /not/ wish a verification to be -# performed after programming the device. -#AVRDUDE_NO_VERIFY = -V - -# Increase verbosity level. Please use this when submitting bug -# reports about avrdude. See -# to submit bug reports. -#AVRDUDE_VERBOSE = -v -v - -AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) -AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) -AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) - - - -#---------------- Debugging Options ---------------- - -# For simulavr only - target MCU frequency. -DEBUG_MFREQ = $(F_CPU) - -# Set the DEBUG_UI to either gdb or insight. -# DEBUG_UI = gdb -DEBUG_UI = insight - -# Set the debugging back-end to either avarice, simulavr. -DEBUG_BACKEND = avarice -#DEBUG_BACKEND = simulavr - -# GDB Init Filename. -GDBINIT_FILE = __avr_gdbinit - -# When using avarice settings for the JTAG -JTAG_DEV = /dev/com1 - -# Debugging port used to communicate between GDB / avarice / simulavr. -DEBUG_PORT = 4242 - -# Debugging host used to communicate between GDB / avarice / simulavr, normally -# just set to localhost unless doing some sort of crazy debugging when -# avarice is running on a different computer. -DEBUG_HOST = localhost - - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr-gcc -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AR = avr-ar rcs -NM = avr-nm -AVRDUDE = avrdude -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_EXTENDED_COFF = Converting to AVR Extended COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex eep lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -eep: $(TARGET).eep -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -program: $(TARGET).hex $(TARGET).eep - $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) - -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - -flip-ee: $(TARGET).hex $(TARGET).eep - $(COPY) $(TARGET).eep $(TARGET)eep.hex - batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase - batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - $(REMOVE) $(TARGET)eep.hex - -dfu-ee: $(TARGET).hex $(TARGET).eep - dfu-programmer $(MCU) eeprom-flash $(TARGET).eep - dfu-programmer $(MCU) reset - - -# Generate avr-gdb config/init file which does the following: -# define the reset signal, load the target file, connect to target, and set -# a breakpoint at main(). -gdb-config: - @$(REMOVE) $(GDBINIT_FILE) - @echo define reset >> $(GDBINIT_FILE) - @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) - @echo end >> $(GDBINIT_FILE) - @echo file $(TARGET).elf >> $(GDBINIT_FILE) - @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) -ifeq ($(DEBUG_BACKEND),simulavr) - @echo load >> $(GDBINIT_FILE) -endif - @echo break main >> $(GDBINIT_FILE) - -debug: gdb-config $(TARGET).elf -ifeq ($(DEBUG_BACKEND), avarice) - @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. - @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ - $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) - @$(WINSHELL) /c pause - -else - @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ - $(DEBUG_MFREQ) --port $(DEBUG_PORT) -endif - @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) - - - - -# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. -COFFCONVERT = $(OBJCOPY) --debugging -COFFCONVERT += --change-section-address .data-0x800000 -COFFCONVERT += --change-section-address .bss-0x800000 -COFFCONVERT += --change-section-address .noinit-0x800000 -COFFCONVERT += --change-section-address .eeprom-0x810000 - - - -coff: $(TARGET).elf - @echo - @echo $(MSG_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-avr $< $(TARGET).cof - - -extcoff: $(TARGET).elf - @echo - @echo $(MSG_EXTENDED_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof - - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -%.eep: %.elf - @echo - @echo $(MSG_EEPROM) $@ - -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).eep - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex eep lss sym coff extcoff doxygen clean \ -clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ -debug gdb-config checksource diff --git a/LUFA/CodeTemplates/makefile_template.uc3 b/LUFA/CodeTemplates/makefile_template.uc3 deleted file mode 100644 index 1a9dff952..000000000 --- a/LUFA/CodeTemplates/makefile_template.uc3 +++ /dev/null @@ -1,489 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = ### INSERT NAME OF MICROCONTROLLER MODEL HERE ### - - -# Targeted chip architecture (see library "Architectures" documentation) -ARCH = UC3 - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = ### INSERT NAME OF BOARD HERE, OR NONE IF NO BOARD DRIVERS USED ### - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This should be the frequency the system core runs at, after the system clock -# has been set up correctly and started. -F_CPU = ### INSERT PRESCALED SYSTEM CLOCK SPEED HERE, IN HZ ### - - -# USB controller master clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency of the USB controller's clock generator in Hz. -# -# For the UC3 chips, this should be equal to 48MHz or 96MHz. -F_USB = ### INSERT CLOCK TO USB MODULE HERE, IN HZ ### - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = ### INSERT NAME OF MAIN FILENAME HERE, WITHOUT EXTENSION ### - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ### INSERT PATH TO LUFA LIBRARY RELATIVE TO PROJECT DIRECTORY HERE ### - - -# LUFA library compile-time options and predefined tokens (add '-D' before each token) -LUFA_OPTS = ### INSERT LUFA COMPILE TIME TOKENS HERE ### - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = $(TARGET).c \ - $(LUFA_SRC_USB) \ - $(LUFA_SRC_USBCLASS) - ### INSERT ADDITIONAL PROJECT SOURCE FILENAMES OR LUFA MODULE NAMES HERE ### - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = s - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=gnu99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -CDEFS += -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += -DARCH=ARCH_$(ARCH) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += -DARCH=ARCH_$(ARCH) -CPPDEFS += $(LUFA_OPTS) - - -# Debugging level. -DEBUG = 3 - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-strict-aliasing -CFLAGS += -Wall -CFLAGS += -Wstrict-prototypes -CFLAGS += -masm-addr-pseudos -#CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -ffunction-sections -CPPFLAGS += -fno-strict-aliasing -CPPFLAGS += -fno-exceptions -CPPFLAGS += -masm-addr-pseudos -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -#CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -#ASFLAGS += -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--gc-sections --rodata-writable -LDFLAGS += -Wl,--direct-data -#LDFLAGS += -T linker_script.x - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr32-gcc -OBJCOPY = avr32-objcopy -OBJDUMP = avr32-objdump -SIZE = avr32-size -AR = avr32-ar rcs -NM = avr32-nm -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mpart=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mpart=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mpart=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex lss sym doxygen clean clean_list clean_doxygen \ -dfu flip checksource - diff --git a/LUFA/CodeTemplates/makefile_template.xmega b/LUFA/CodeTemplates/makefile_template.xmega deleted file mode 100644 index 4f10f84cd..000000000 --- a/LUFA/CodeTemplates/makefile_template.xmega +++ /dev/null @@ -1,707 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. -# >> Modified for use with the LUFA project. << -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# Dean Camera -# Opendous Inc. -# Denver Gingerich -# -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make coff = Convert ELF to AVR COFF. -# -# make extcoff = Convert ELF to AVR Extended COFF. -# -# make program = Download the hex file to the device, using avrdude. -# Please customize the avrdude settings below first! -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make dfu-ee = Download the eeprom file to the device, using dfu-programmer -# (must have dfu-programmer installed). -# -# make flip-ee = Download the eeprom file to the device, using Atmel FLIP -# (must have Atmel FLIP installed). -# -# make doxygen = Generate DoxyGen documentation for the project (must have -# DoxyGen installed) -# -# make debug = Start either simulavr or avarice as specified for debugging, -# with avr-gdb or avr-insight as the front end for debugging. -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - - -# MCU name -MCU = ### INSERT NAME OF MICROCONTROLLER MODEL HERE ### - - -# Targeted chip architecture (see library "Architectures" documentation) -ARCH = XMEGA - - -# Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called -# "Board" inside the application directory. -BOARD = ### INSERT NAME OF BOARD HERE, OR NONE IF NO BOARD DRIVERS USED ### - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This should be the frequency the system core runs at, after the system clock -# has been set up correctly and started. -F_CPU = ### INSERT PRESCALED SYSTEM CLOCK SPEED HERE, IN HZ ### - - -# USB controller master clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency of the USB controller's clock generator in Hz. -# -# For the XMEGA chips, this should be equal to a multiple of 6MHz for Low -# Speed USB mode, or a multiple of 48MHz for Full Speed USB mode. -F_USB = ### INSERT CLOCK TO USB MODULE HERE, IN HZ ### - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Target file name (without extension). -TARGET = ### INSERT NAME OF MAIN FILENAME HERE, WITHOUT EXTENSION ### - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = . - - -# Path to the LUFA library -LUFA_PATH = ### INSERT PATH TO LUFA LIBRARY RELATIVE TO PROJECT DIRECTORY HERE ### - - -# LUFA library compile-time options and predefined tokens (add '-D' before each token) -LUFA_OPTS = ### INSERT LUFA COMPILE TIME TOKENS HERE ### - - -# Create the LUFA source path variables by including the LUFA root makefile -include $(LUFA_PATH)/LUFA/makefile - - -# List C source files here. (C dependencies are automatically generated.) -SRC = $(TARGET).c \ - $(LUFA_SRC_USB) \ - $(LUFA_SRC_USBCLASS) - ### INSERT ADDITIONAL PROJECT SOURCE FILENAMES OR LUFA MODULE NAMES HERE ### - - -# List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = - - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = s - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(LUFA_PATH)/ - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=gnu99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += -DF_USB=$(F_USB)UL -CDEFS += -DBOARD=BOARD_$(BOARD) -CDEFS += -DARCH=ARCH_$(ARCH) -CDEFS += $(LUFA_OPTS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += -DF_USB=$(F_USB)UL -ADEFS += -DBOARD=BOARD_$(BOARD) -ADEFS += -DARCH=ARCH_$(ARCH) -ADEFS += $(LUFA_OPTS) - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -CPPDEFS += -DF_USB=$(F_USB)UL -CPPDEFS += -DBOARD=BOARD_$(BOARD) -CPPDEFS += -DARCH=ARCH_$(ARCH) -CPPDEFS += $(LUFA_OPTS) - - -# Debugging format. -# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. -# AVR Studio 4.10 requires dwarf-2. -# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. -DEBUG = dwarf-2 - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fno-inline-small-functions -CFLAGS += -fpack-struct -CFLAGS += -fshort-enums -CFLAGS += -fno-strict-aliasing -CFLAGS += -Wall -CFLAGS += -Wstrict-prototypes -CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -fpack-struct -CPPFLAGS += -fshort-enums -CPPFLAGS += -ffunction-sections -CPPFLAGS += -fno-strict-aliasing -CPPFLAGS += -fno-exceptions -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 - - -#---------------- Library Options ---------------- -# Minimalistic printf version -PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min - -# Floating point printf version (requires MATH_LIB = -lm below) -PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt - -# If this is left blank, then it will use the Standard printf version. -PRINTF_LIB = -#PRINTF_LIB = $(PRINTF_LIB_MIN) -#PRINTF_LIB = $(PRINTF_LIB_FLOAT) - - -# Minimalistic scanf version -SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min - -# Floating point + %[ scanf version (requires MATH_LIB = -lm below) -SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt - -# If this is left blank, then it will use the Standard scanf version. -SCANF_LIB = -#SCANF_LIB = $(SCANF_LIB_MIN) -#SCANF_LIB = $(SCANF_LIB_FLOAT) - - -MATH_LIB = -lm - - -# List any extra directories to look for libraries here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = - - - -#---------------- External Memory Options ---------------- - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# used for variables (.data/.bss) and heap (malloc()). -#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# only used for heap (malloc()). -#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff - -EXTMEMOPTS = - - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--relax -LDFLAGS += -Wl,--gc-sections -LDFLAGS += $(EXTMEMOPTS) -LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) -LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) -#LDFLAGS += -T linker_script.x - - - -#---------------- Programming Options (avrdude) ---------------- - -# Programming hardware -# Type: avrdude -c ? -# to get a full listing. -# -AVRDUDE_PROGRAMMER = jtagmkII - -# com1 = serial port. Use lpt1 to connect to parallel port. -AVRDUDE_PORT = usb - -AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex -#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep - - -# Uncomment the following if you want avrdude's erase cycle counter. -# Note that this counter needs to be initialized first using -Yn, -# see avrdude manual. -#AVRDUDE_ERASE_COUNTER = -y - -# Uncomment the following if you do /not/ wish a verification to be -# performed after programming the device. -#AVRDUDE_NO_VERIFY = -V - -# Increase verbosity level. Please use this when submitting bug -# reports about avrdude. See -# to submit bug reports. -#AVRDUDE_VERBOSE = -v -v - -AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) -AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) -AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) - - - -#---------------- Debugging Options ---------------- - -# For simulavr only - target MCU frequency. -DEBUG_MFREQ = $(F_CPU) - -# Set the DEBUG_UI to either gdb or insight. -# DEBUG_UI = gdb -DEBUG_UI = insight - -# Set the debugging back-end to either avarice, simulavr. -DEBUG_BACKEND = avarice -#DEBUG_BACKEND = simulavr - -# GDB Init Filename. -GDBINIT_FILE = __avr_gdbinit - -# When using avarice settings for the JTAG -JTAG_DEV = /dev/com1 - -# Debugging port used to communicate between GDB / avarice / simulavr. -DEBUG_PORT = 4242 - -# Debugging host used to communicate between GDB / avarice / simulavr, normally -# just set to localhost unless doing some sort of crazy debugging when -# avarice is running on a different computer. -DEBUG_HOST = localhost - - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr-gcc -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AR = avr-ar rcs -NM = avr-nm -AVRDUDE = avrdude -REMOVE = rm -f -REMOVEDIR = rm -rf -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_EXTENDED_COFF = Converting to AVR Extended COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - -# Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - - -# Compiler flags to generate dependency files. -GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex eep lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -eep: $(TARGET).eep -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf -MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - -# Program the device. -program: $(TARGET).hex $(TARGET).eep - $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) - -flip: $(TARGET).hex - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -dfu: $(TARGET).hex - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $(TARGET).hex - dfu-programmer $(MCU) reset - -flip-ee: $(TARGET).hex $(TARGET).eep - $(COPY) $(TARGET).eep $(TARGET)eep.hex - batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase - batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - $(REMOVE) $(TARGET)eep.hex - -dfu-ee: $(TARGET).hex $(TARGET).eep - dfu-programmer $(MCU) eeprom-flash $(TARGET).eep - dfu-programmer $(MCU) reset - - -# Generate avr-gdb config/init file which does the following: -# define the reset signal, load the target file, connect to target, and set -# a breakpoint at main(). -gdb-config: - @$(REMOVE) $(GDBINIT_FILE) - @echo define reset >> $(GDBINIT_FILE) - @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) - @echo end >> $(GDBINIT_FILE) - @echo file $(TARGET).elf >> $(GDBINIT_FILE) - @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) -ifeq ($(DEBUG_BACKEND),simulavr) - @echo load >> $(GDBINIT_FILE) -endif - @echo break main >> $(GDBINIT_FILE) - -debug: gdb-config $(TARGET).elf -ifeq ($(DEBUG_BACKEND), avarice) - @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. - @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ - $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) - @$(WINSHELL) /c pause - -else - @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ - $(DEBUG_MFREQ) --port $(DEBUG_PORT) -endif - @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) - - - - -# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. -COFFCONVERT = $(OBJCOPY) --debugging -COFFCONVERT += --change-section-address .data-0x800000 -COFFCONVERT += --change-section-address .bss-0x800000 -COFFCONVERT += --change-section-address .noinit-0x800000 -COFFCONVERT += --change-section-address .eeprom-0x810000 - - - -coff: $(TARGET).elf - @echo - @echo $(MSG_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-avr $< $(TARGET).cof - - -extcoff: $(TARGET).elf - @echo - @echo $(MSG_EXTENDED_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof - - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -%.eep: %.elf - @echo - @echo $(MSG_EEPROM) $@ - -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).eep - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) - $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) - $(REMOVE) $(SRC:.c=.i) - $(REMOVEDIR) .dep - -doxygen: - @echo Generating Project Documentation \($(TARGET)\)... - @if ( ( cat Doxygen.conf ; echo "HTML_STYLESHEET=$(LUFA_PATH)/LUFA/DoxygenPages/Style/Style.css" ) | doxygen - 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \ - exit 1; \ - fi; - @echo Documentation Generation Complete. - -clean_doxygen: - rm -rf Documentation - -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ - fi; done - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex eep lss sym coff extcoff doxygen clean \ -clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ -debug gdb-config checksource diff --git a/LUFA/Common/ArchitectureSpecific.h b/LUFA/Common/ArchitectureSpecific.h index f7dca6631..9b719a221 100644 --- a/LUFA/Common/ArchitectureSpecific.h +++ b/LUFA/Common/ArchitectureSpecific.h @@ -65,6 +65,24 @@ /* Macros: */ #if (ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA) || defined(__DOXYGEN__) #if (ARCH == ARCH_AVR8) || defined(__DOXYGEN__) + /** Re-enables the AVR's JTAG bus in software, until a system reset. This will re-enable JTAG debugging + * interface after is has been disabled in software via \ref JTAG_DISABLE(). + * + * \note This macro is not available for all architectures. + */ + #define JTAG_ENABLE() MACROS{ \ + __asm__ __volatile__ ( \ + "in __tmp_reg__,__SREG__" "\n\t" \ + "cli" "\n\t" \ + "out %1, %0" "\n\t" \ + "out __SREG__, __tmp_reg__" "\n\t" \ + "out %1, %0" "\n\t" \ + : \ + : "r" (MCUCR & ~(1 << JTD)), \ + "M" (_SFR_IO_ADDR(MCUCR)) \ + : "r0"); \ + }MACROE + /** Disables the AVR's JTAG bus in software, until a system reset. This will override the current JTAG * status as set by the JTAGEN fuse, disabling JTAG debugging and reverting the JTAG pins back to GPIO * mode. @@ -79,7 +97,7 @@ "out __SREG__, __tmp_reg__" "\n\t" \ "out %1, %0" "\n\t" \ : \ - : "r" (1 << JTD), \ + : "r" (MCUCR | (1 << JTD)), \ "M" (_SFR_IO_ADDR(MCUCR)) \ : "r0"); \ }MACROE diff --git a/LUFA/Common/Attributes.h b/LUFA/Common/Attributes.h index f4040b23e..b058eed8f 100644 --- a/LUFA/Common/Attributes.h +++ b/LUFA/Common/Attributes.h @@ -116,7 +116,7 @@ /** Forces the compiler to not automatically zero the given global variable on startup, so that the * current RAM contents is retained. Under most conditions this value will be random due to the - * behaviour of volatile memory once power is removed, but may be used in some specific circumstances, + * behavior of volatile memory once power is removed, but may be used in some specific circumstances, * like the passing of values back after a system watchdog reset. */ #define ATTR_NO_INIT __attribute__ ((section (".noinit"))) diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h index 54d738682..d2d657a39 100644 --- a/LUFA/Common/Common.h +++ b/LUFA/Common/Common.h @@ -109,9 +109,10 @@ #include "Endianness.h" #elif (ARCH == ARCH_UC3) #include + #include // === TODO: Find abstracted way to handle these === - #define PROGMEM const + #define PROGMEM #define pgm_read_byte(x) *x #define memcmp_P(...) memcmp(__VA_ARGS__) #define memcpy_P(...) memcpy(__VA_ARGS__) diff --git a/LUFA/Doxygen.conf b/LUFA/Doxygen.conf index 5c3bf65b8..5280ae973 100644 --- a/LUFA/Doxygen.conf +++ b/LUFA/Doxygen.conf @@ -728,7 +728,7 @@ EXCLUDE_SYMBOLS = _* \ # directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = ../ +EXAMPLE_PATH = ./ CodeTemplates/ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp diff --git a/LUFA/DoxygenPages/BuildSystem.txt b/LUFA/DoxygenPages/BuildSystem.txt new file mode 100644 index 000000000..c30a88bb4 --- /dev/null +++ b/LUFA/DoxygenPages/BuildSystem.txt @@ -0,0 +1,846 @@ +/** \file + * + * This file contains special DoxyGen information for the generation of the main page and other special + * documentation pages. It is not a project source file. + */ + +/** \page Page_BuildSystem The LUFA Build System + * + * \section Sec_BuildSystemOverview Overview of the LUFA Build System + * The LUFA build system is an attempt at making a set of re-usable, modular build make files which + * can be referenced in a LUFA powered project, to minimise the amount of code required in an + * application makefile. The system is written in GNU Make, and each module is independant of + * one-another. + * + * For details on the prerequisites needed for Linux and Windows machines to be able to use the LUFA + * build system, see \ref Sec_Prerequisites. + * + * To use a LUFA build system module, simply add an include to your project makefile: + * \code + * include $(LUFA_PATH)/Build/lufa_core.mk + * \endcode + * + * And the associated build module targets will be added to your project's build makefile automatically. + * To call a build target, run make {TARGET_NAME} from the command line, substituting in + * the appropriate target name. + * + * \see \ref Sec_AppConfigParams for a copy of the sample LUFA project makefile. + * + * Each build module may have one or more mandatory parameters (GNU Make variables) which must + * be supplied in the project makefile for the module to work, and one or more optional parameters which + * may be defined and which will assume a sensible default if not. + * + * \section SSec_BuildSystemModules Available Modules + * + * The following modules are included in this LUFA release: + * + * \li \subpage Page_BuildModule_ATPROGRAM - Device Programming + * \li \subpage Page_BuildModule_AVRDUDE - Device Programming + * \li \subpage Page_BuildModule_BUILD - Compiling/Assembling/Linking + * \li \subpage Page_BuildModule_CORE - Core Build System Functions + * \li \subpage Page_BuildModule_CPPCHECK - Static Code Analysis + * \li \subpage Page_BuildModule_DFU - Device Programming + * \li \subpage Page_BuildModule_DOXYGEN - Automated Source Code Documentation + * \li \subpage Page_BuildModule_HID - Device Programming + * \li \subpage Page_BuildModule_SOURCES - LUFA Module Source Code Variables + */ + + /** \page Page_BuildModule_BUILD The BUILD build module + * + * The BUILD LUFA build system module, providing targets for the compilation, + * assembling and linking of an application from source code into binary files + * suitable for programming into a target device. + * + * To use this module in your application makefile, add the following code: + * \code + * include $(LUFA_PATH)/Build/lufa_build.mk + * \endcode + * + * \section SSec_BuildModule_BUILD_Requirements Requirements + * This module requires the the architecture appropriate binaries of the GCC compiler are available in your + * system's PATH variable. The GCC compiler and associated toolchain is distributed in Atmel AVR Studio + * 5.x and Atmel Studio 6.x installation directories, as well as in many third party distribution packages. + * + * \section SSec_BuildModule_BUILD_Targets Targets + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
sizeDisplay size of the compiled application FLASH and SRAM segments.
symbol-sizesDisplay a size-sorted list of symbols from the compiled application, in decimal bytes.
check-sourceDisplay a list of input SRC source files which cannot be found (if any).
libBuild and archive all source files into a library A binary file.
allBuild and link the application into ELF debug and HEX binary files.
elfBuild and link the application into an ELF debug file.
hexBuild and link the application and produce HEX and EEP binary files.
lssBuild and link the application and produce a LSS source code/assembly code mixed listing file.
cleanRemove all intermediatary files and binary output files.
mostlycleanRemove all intermediatary files but preserve any binary output files.
+ * + * \section SSec_BuildModule_BUILD_MandatoryParams Mandatory Parameters + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
TARGETName of the application output file prefix (e.g. TestApplication).
ARCHArchitecture of the target processor (see \ref Page_DeviceSupport).
MCUName of the Atmel processor model (e.g. at90usb1287).
SRCList of relative or absolute paths to the application C (.c), C++ (.cpp) and Assembly (.S) source files.
F_USBSpeed in Hz of the input clock frequency to the target's USB controller.
LUFA_PATHPath to the LUFA library core, either relative or absolute (e.g. ../LUFA-000000/LUFA/).
+ * + * \section SSec_BuildModule_BUILD_OptionalParams Optional Parameters + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
BOARDLUFA board hardware drivers to use (see \ref Page_DeviceSupport).
OPTIMIZATIONOptimization level to use when compiling source files (see GCC manual).
C_STANDARDVersion of the C standard to apply when compiling C++ source files (see GCC manual).
CPP_STANDARDVersion of the C++ standard to apply when compiling C++ source files (see GCC manual).
DEBUG_FORMATFormat of the debug information to embed in the generated object files (see GCC manual).
DEBUG_LEVELLevel of the debugging information to embed in the generated object files (see GCC manual).
F_CPUSpeed of the processor CPU clock, in Hz.
C_FLAGSFlags to pass to the C compiler only, after the automatically generated flags.
CPP_FLAGSFlags to pass to the C++ compiler only, after the automatically generated flags.
ASM_FLAGSFlags to pass to the assembler only, after the automatically generated flags.
CC_FLAGSCommon flags to pass to the C/C++ compiler and assembler, after the automatically generated flags.
LD_FLAGSFlags to pass to the linker, after the automatically generated flags.
OBJDIRDirectory to place the generated object and dependency files. If set to "." the same folder as the source file will be used. + * \note When this option is enabled, all source filenames must be unique.
OBJECT_FILESList of additional object files that should be linked into the resulting binary.
+ * + * \section SSec_BuildModule_BUILD_ProvidedVariables Module Provided Variables + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_BUILD_ProvidedMacros Module Provided Macros + * + * + * + * + * + *
None
+ */ + +/** \page Page_BuildModule_CORE The CORE build module + * + * The core LUFA build system module, providing common build system help and information targets. + * + * To use this module in your application makefile, add the following code: + * \code + * include $(LUFA_PATH)/Build/lufa_core.mk + * \endcode + * + * \section SSec_BuildModule_CORE_Requirements Requirements + * This module has no requirements outside a standard *nix shell like environment; the sh + * shell, GNU make and *nix CoreUtils (echo, printf, etc.). + * + * \section SSec_BuildModule_CORE_Targets Targets + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
helpDisplay build system help and configuration information.
list_targetsList all available build targets from the build system.
list_modulesList all available build modules from the build system.
list_mandatoryList all mandatory parameters required by the included modules.
list_optionalList all optional parameters required by the included modules.
list_providedList all variables provided by the included modules.
list_macrosList all macros provided by the included modules.
+ * + * \section SSec_BuildModule_CORE_MandatoryParams Mandatory Parameters + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_CORE_OptionalParams Optional Parameters + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_CORE_ProvidedVariables Module Provided Variables + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_CORE_ProvidedMacros Module Provided Macros + * + * + * + * + * + *
None
+ */ + +/** \page Page_BuildModule_ATPROGRAM The ATPROGRAM build module + * + * The ATPROGRAM programming utility LUFA build system module, providing targets to reprogram an + * Atmel processor FLASH and EEPROM memories with a project's compiled binary output files. + * + * To use this module in your application makefile, add the following code: + * \code + * include $(LUFA_PATH)/Build/lufa_atprogram.mk + * \endcode + * + * \section SSec_BuildModule_ATPROGRAM_Requirements Requirements + * This module requires the atprogram.exe utility to be available in your system's PATH + * variable. The atprogram.exe utility is distributed in Atmel AVR Studio 5.x and Atmel Studio 6.x + * inside the application install folder's "\avrdbg" subdirectory. + * + * \section SSec_BuildModule_ATPROGRAM_Targets Targets + * + * + * + * + * + * + * + * + * + * + *
atprogramProgram the device FLASH memory with the application's executable data.
atprogram-eeProgram the device EEPROM memory with the application's EEPROM data.
+ * + * \section SSec_BuildModule_ATPROGRAM_MandatoryParams Mandatory Parameters + * + * + * + * + * + * + * + * + * + * + *
MCUName of the Atmel processor model (e.g. at90usb1287).
TARGETName of the application output file prefix (e.g. TestApplication).
+ * + * \section SSec_BuildModule_ATPROGRAM_OptionalParams Optional Parameters + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
ATPROGRAM_PROGRAMMERName of the Atmel programmer or debugger tool to communicate with (e.g. jtagice3).
ATPROGRAM_INTERFACEName of the programming interface to use when programming the target (e.g. spi).
ATPROGRAM_PORTName of the communication port to use when when programming with a serially connected tool (e.g. COM2).
+ * + * \section SSec_BuildModule_ATPROGRAM_ProvidedVariables Module Provided Variables + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_ATPROGRAM_ProvidedMacros Module Provided Macros + * + * + * + * + * + *
None
+ */ + +/** \page Page_BuildModule_AVRDUDE The AVRDUDE build module + * + * The AVRDUDE programming utility LUFA build system module, providing targets to reprogram an + * Atmel processor FLASH and EEPROM memories with a project's compiled binary output files. + * + * To use this module in your application makefile, add the following code: + * \code + * include $(LUFA_PATH)/Build/lufa_avrdude.mk + * \endcode + * + * \section SSec_BuildModule_AVRDUDE_Requirements Requirements + * This module requires the avrdude utility to be available in your system's PATH + * variable. The avrdude utility is distributed in the old WinAVR project releases for + * Windows (winavr.sourceforge.net) or can be installed on *nix systems via the project's + * source code (https://savannah.nongnu.org/projects/avrdude) or through the package manager. + * + * \section SSec_BuildModule_AVRDUDE_Targets Targets + * + * + * + * + * + * + * + * + * + * + *
avrdudeProgram the device FLASH memory with the application's executable data.
avrdudeProgram the device EEPROM memory with the application's EEPROM data.
+ * + * \section SSec_BuildModule_AVRDUDE_MandatoryParams Mandatory Parameters + * + * + * + * + * + * + * + * + * + * + *
MCUName of the Atmel processor model (e.g. at90usb1287).
TARGETName of the application output file prefix (e.g. TestApplication).
+ * + * \section SSec_BuildModule_AVRDUDE_OptionalParams Optional Parameters + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
AVRDUDE_PROGRAMMERName of the programmer or debugger tool to communicate with (e.g. jtagicemkii).
ATPROGRAM_PORTName of the communication port to use when when programming with the connected tool (e.g. COM2, /dev/ttyUSB0 or usb).
ATPROGRAM_FLAGSAdditional flags to pass to avrdude when programming, applied after the automatically generated flags.
+ * + * \section SSec_BuildModule_AVRDUDE_ProvidedVariables Module Provided Variables + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_AVRDUDE_ProvidedMacros Module Provided Macros + * + * + * + * + * + *
None
+ */ + + /** \page Page_BuildModule_CPPCHECK The CPPCHECK build module + * + * The CPPCHECK programming utility LUFA build system module, providing targets to statically + * analyze C and C++ source code for errors and performance/style issues. + * + * To use this module in your application makefile, add the following code: + * \code + * include $(LUFA_PATH)/Build/lufa_cppcheck.mk + * \endcode + * + * \section SSec_BuildModule_CPPCHECK_Requirements Requirements + * This module requires the cppcheck utility to be available in your system's PATH + * variable. The cppcheck utility is distributed through the project's home page + * (http://cppcheck.sourceforge.net) for Windows, and can be installed on *nix systems via + * the project's source code or through the package manager. + * + * \section SSec_BuildModule_CPPCHECK_Targets Targets + * + * + * + * + * + * + * + * + * + * + *
cppcheckStatically analyze the project source code for issues.
cppcheck-configCheck the cppcheck configuration - scan source code and warn about missing header files and other issues.
+ * + * \section SSec_BuildModule_CPPCHECK_MandatoryParams Mandatory Parameters + * + * + * + * + * + * + *
SRCList of source files to statically analyze.
+ * + * \section SSec_BuildModule_CPPCHECK_OptionalParams Optional Parameters + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
CPPCHECK_INCLUDESPath of extra directories to check when attemting to resolve C/C++ header file includes.
CPPCHECK_EXCLUDESPaths or path fragments to exclude when analyzing.
CPPCHECK_MSG_TEMPLATEOutput message template to use when printing errors, warnings and information (see cppcheck documentation).
CPPCHECK_ENABLEAnalysis rule categories to enable (see cppcheck documentation).
CPPCHECK_SUPPRESSSpecific analysis rules to suppress (see cppcheck documentation).
CPPCHECK_FAIL_ON_WARNINGSet to Y to fail the analysis job with an error exit code if warnings are found, N to continue without failing.
CPPCHECK_QUIETSet to Y to suppress all output except warnings and errors, N to show verbose output information.
CPPCHECK_FLAGSExtra flags to pass to cppcheck, after the automatically generated flags.
+ * + * \section SSec_BuildModule_CPPCHECK_ProvidedVariables Module Provided Variables + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_CPPCHECK_ProvidedMacros Module Provided Macros + * + * + * + * + * + *
None
+ */ + + /** \page Page_BuildModule_DFU The DFU build module + * + * The DFU programming utility LUFA build system module, providing targets to reprogram an + * Atmel processor FLASH and EEPROM memories with a project's compiled binary output files. + * This module requires a DFU class bootloader to be running in the target, compatible with + * the DFU bootloader protocol as published by Atmel. + * + * To use this module in your application makefile, add the following code: + * \code + * include $(LUFA_PATH)/Build/lufa_dfu.mk + * \endcode + * + * \section SSec_BuildModule_DFU_Requirements Requirements + * This module requires either the batchisp utility from Atmel's FLIP utility, or the open + * source dfu-programmer utility (http://dfu-programmer.sourceforge.net/) to be + * available in your system's PATH variable. On *nix systems the dfu-programmer utility + * can be installed via the project's source code or through the package manager. + * + * \section SSec_BuildModule_DFU_Targets Targets + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
dfuProgram the device FLASH memory with the application's executable data using dfu-programmer.
dfu-eeProgram the device EEPROM memory with the application's EEPROM data using dfu-programmer.
flipProgram the device FLASH memory with the application's executable data using batchisp.
flip-eeProgram the device EEPROM memory with the application's EEPROM data using batchisp.
+ * + * \section SSec_BuildModule_DFU_MandatoryParams Mandatory Parameters + * + * + * + * + * + * + * + * + * + * + *
MCUName of the Atmel processor model (e.g. at90usb1287).
TARGETName of the application output file prefix (e.g. TestApplication).
+ * + * \section SSec_BuildModule_DFU_OptionalParams Optional Parameters + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_DFU_ProvidedVariables Module Provided Variables + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_DFU_ProvidedMacros Module Provided Macros + * + * + * + * + * + *
None
+ */ + + /** \page Page_BuildModule_DOXYGEN The DOXYGEN build module + * + * The DOXYGEN code documentation utility LUFA build system module, providing targets to generate + * project HTML and other format documentation from a set of source files that include special + * Doxygen comments. + * + * To use this module in your application makefile, add the following code: + * \code + * include $(LUFA_PATH)/Build/lufa_doxygen.mk + * \endcode + * + * \section SSec_BuildModule_DOXYGEN_Requirements Requirements + * This module requires the doxygen utility from the Doxygen website + * (http://www.stack.nl/~dimitri/doxygen/) to be available in your system's PATH + * variable. On *nix systems the doxygen utility can be installed via the project's source + * code or through the package manager. + * + * \section SSec_BuildModule_DOXYGEN_Targets Targets + * + * + * + * + * + * + *
doxygenGenerate project documentation.
+ * + * \section SSec_BuildModule_DOXYGEN_MandatoryParams Mandatory Parameters + * + * + * + * + * + * + *
LUFA_PATHPath to the LUFA library core, either relative or absolute (e.g. ../LUFA-000000/LUFA/).
+ * + * \section SSec_BuildModule_DOXYGEN_OptionalParams Optional Parameters + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
DOXYGEN_CONFName and path of the base Doxygen configuration file for the project.
DOXYGEN_FAIL_ON_WARNINGSet to Y to fail the generation with an error exit code if warnings are found other than unsupported configuration parameters, N to continue without failing.
DOXYGEN_OVERRIDE_PARAMSExtra Doxygen configuration parameters to apply, overriding the corresponding config entry in the project's configuration file (e.g. QUIET=YES).
+ * + * \section SSec_BuildModule_DOXYGEN_ProvidedVariables Module Provided Variables + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_DOXYGEN_ProvidedMacros Module Provided Macros + * + * + * + * + * + *
None
+ */ + + /** \page Page_BuildModule_HID The HID build module + * + * The HID programming utility LUFA build system module, providing targets to reprogram an + * Atmel processor's FLASH memory with a project's compiled binary output file. This module + * requires a HID class bootloader to be running in the target, using a protocol compatible + * with the PJRC "HalfKay" protocol (http://www.pjrc.com/teensy/halfkay_protocol.html). + * + * To use this module in your application makefile, add the following code: + * \code + * include $(LUFA_PATH)/Build/lufa_hid.mk + * \endcode + * + * \section SSec_BuildModule_HID_Requirements Requirements + * This module requires either the hid_bootloader_cli utility from the included LUFA HID + * class bootloader API subdirectory, or the teensy_loader_cli utility from PJRC + * (http://www.pjrc.com/teensy/loader_cli.html) to be available in your system's PATH + * variable. + * + * \section SSec_BuildModule_HID_Targets Targets + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
hidProgram the device FLASH memory with the application's executable data using hid_bootloader_cli.
hid-eeProgram the device EEPROM memory with the application's EEPROM data using hid_bootloader_cli and + * a temporary AVR application programmed into the target's FLASH. + * \note This will erase the currently loaded application in the target.
teensyProgram the device FLASH memory with the application's executable data using teensy_loader_cli.
teensy-eeProgram the device EEPROM memory with the application's EEPROM data using teensy_loader_cli and + * a temporary AVR application programmed into the target's FLASH. + * \note This will erase the currently loaded application in the target.
+ * + * \section SSec_BuildModule_HID_MandatoryParams Mandatory Parameters + * + * + * + * + * + * + * + * + * + * + *
MCUName of the Atmel processor model (e.g. at90usb1287).
TARGETName of the application output file prefix (e.g. TestApplication).
+ * + * \section SSec_BuildModule_HID_OptionalParams Optional Parameters + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_HID_ProvidedVariables Module Provided Variables + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_HID_ProvidedMacros Module Provided Macros + * + * + * + * + * + *
None
+ */ + + /** \page Page_BuildModule_SOURCES The SOURCES build module + * + * The SOURCES LUFA build system module, providing variables listing the various LUFA source files + * required to be build by a project for a given LUFA module. This module gives a way to reference + * LUFA source files symbollically, so that changes to the library structure do not break the library + * makefile. + * + * To use this module in your application makefile, add the following code: + * \code + * include $(LUFA_PATH)/Build/lufa_sources.mk + * \endcode + * + * \section SSec_BuildModule_SOURCES_Requirements Requirements + * None. + * + * \section SSec_BuildModule_SOURCES_Targets Targets + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_SOURCES_MandatoryParams Mandatory Parameters + * + * + * + * + * + * + * + * + * + * + *
LUFA_PATHPath to the LUFA library core, either relative or absolute (e.g. ../LUFA-000000/LUFA/).
ARCHArchitecture of the target processor (see \ref Page_DeviceSupport).
+ * + * \section SSec_BuildModule_SOURCES_OptionalParams Optional Parameters + * + * + * + * + * + *
None
+ * + * \section SSec_BuildModule_SOURCES_ProvidedVariables Module Provided Variables + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
LUFA_SRC_USBList of LUFA USB driver source files.
LUFA_SRC_USBCLASSList of LUFA USB Class driver source files.
LUFA_SRC_TEMPERATUREList of LUFA temperature sensor driver source files.
LUFA_SRC_SERIALList of LUFA Serial U(S)ART driver source files.
LUFA_SRC_TWIList of LUFA TWI driver source files.
LUFA_SRC_PLATFORMList of LUFA architecture specific platform management source files.
+ * + * \section SSec_BuildModule_SOURCES_ProvidedMacros Module Provided Macros + * + * + * + * + * + *
None
+ */ diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt index 14c9ef0b3..999af82e1 100644 --- a/LUFA/DoxygenPages/ChangeLog.txt +++ b/LUFA/DoxygenPages/ChangeLog.txt @@ -6,7 +6,7 @@ /** \page Page_ChangeLog Project Changelog * - * \section Sec_ChangeLogXXXXXX Version XXXXXX + * \section Sec_ChangeLog120730 Version 120730 (BETA) * New: * - Core: * - Added new, revamped modular build system with new makefile templates @@ -18,7 +18,8 @@ * - Added new Pipe_ConfigurePipeTable() function * - Added build test to verify correct compilation of all board drivers using all driver APIs * - Added build test to verify correct compilation of all bootloaders using all supported devices - * - Added build test to verify that there are no detectable errors in the codebase via static analysis + * - Added build test to verify that there are no detectable errors in the codebase via static analysis + * - Added new JTAG_ENABLE() macro for the AVR8 architecture * - Library Applications: * - Modified the CDC Host demos to set a default CDC Line Encoding on enumerated devices * - Added Dataflash operational checks and aborts to all projects using the Dataflash to ensure it is working correctly before use @@ -66,6 +67,8 @@ * the stack (thanks to Jonathan Hudgins) * - Fixed broken MIDI host driver MIDI_Host_ReceiveEventPacket() function due to not unfreezing the MIDI data IN pipe before use (thanks to Michael Brown) * - Fixed swapped Little Endian/Big Endian endpoint and pipe write code for the UC3 devices (thanks to Andrew Chu) + * - Fixed the JTAG_DISABLE() macro clearing all other bits in MCUSR when called + * - Fixed incorrect Micropendous board LED driver LEDs_SetAllLEDs() and LEDs_ChangeLEDs() function implementations (thanks to MitchJS) * - Library Applications: * - Fixed error in the AVRISP-MKII programmer when ISP mode is used at 64KHz (thanks to Ben R. Porter) * - Fixed AVRISP-MKII programmer project failing to compile for the U4 chips when VTARGET_ADC_CHANNEL is defined to an invalid channel and NO_VTARGET_DETECT is @@ -75,6 +78,8 @@ * - Fixed CDC and DFU bootloaders API function offsets incorrect on some devices (thanks to Rod DeMay) * - Fixed incorrect DFU version number reported to the host in the DFU bootloader descriptors (thanks to Georg Glock) * - Fixed incorrect version hundredths value encoding in VERSION_BCD() macro (thanks to Georg Glock) + * - Fixed invalid configuration descriptor in the low level KeyboardMouse device demo (thanks to Jun Wako) + * - Fixed CDC and DFU bootloaders API page erase and write function failures (thanks to Martin Lambert) * * \section Sec_ChangeLog120219 Version 120219 * New: diff --git a/LUFA/DoxygenPages/CompileTimeTokens.txt b/LUFA/DoxygenPages/CompileTimeTokens.txt index 8c348dd9a..79c4cd4f1 100644 --- a/LUFA/DoxygenPages/CompileTimeTokens.txt +++ b/LUFA/DoxygenPages/CompileTimeTokens.txt @@ -168,6 +168,10 @@ * is through control endpoint requests. Defining this token will remove several features related to the selection and control of device * endpoints internally, saving space. Generally, this is usually only useful in (some) bootloaders and is best avoided. * + * - MAX_ENDPOINT_INDEX - (\ref Group_Device) - XMEGA Only \n + * Defining this value to the highest index (not address - this excludes the direction flag) endpoint within the device will restrict the + * number of FIFOs created internally for the endpoint buffers, reducing the total RAM usage. + * * - INTERRUPT_CONTROL_ENDPOINT - (\ref Group_USBManagement) - All Architectures \n * Some applications prefer to not call the USB_USBTask() management task regularly while in device mode, as it can complicate code significantly. * Instead, when device mode is used this token can be passed to the library via the -D switch to allow the library to manage the USB control diff --git a/LUFA/DoxygenPages/CompilingApps.txt b/LUFA/DoxygenPages/CompilingApps.txt index bbed994c8..40e03a7aa 100644 --- a/LUFA/DoxygenPages/CompilingApps.txt +++ b/LUFA/DoxygenPages/CompilingApps.txt @@ -37,7 +37,7 @@ * each individual demo, bootloader and project folder, as well as scripts in the Demos/, Bootloaders/, Projects/ * and the LUFA root directory. Compilation of projects can be started from any of the above directories, with a build * started from an upper directory in the directory structure executing build of all child directories under it. This - * means that while a build inside a particular demo directory will build only that particular demo, a build stated from + * means that while a build inside a particular demo directory will build only that particular demo, a build started from * the /Demos/ directory will build all LUFA demo projects sequentially. * * To build a project from the source via the command line, the command "make all" should be executed from the command @@ -45,4 +45,6 @@ * diagnostic output files), execute "make clean". Once a "make all" has been run and no errors were encountered, the * resulting binary will be located in the generated ".HEX" file. If your project makes use of pre-initialized EEPROM * variables, the generated ".EEP" file will contain the project's EEPROM data. + * + * \see \ref Page_BuildSystem for information on the LUFA build system. */ diff --git a/LUFA/DoxygenPages/ConfiguringApps.txt b/LUFA/DoxygenPages/ConfiguringApps.txt index 6caf185c1..976927ae0 100644 --- a/LUFA/DoxygenPages/ConfiguringApps.txt +++ b/LUFA/DoxygenPages/ConfiguringApps.txt @@ -8,44 +8,54 @@ * * If the target microcontroller model, architecture, clock speed, board or other settings are different from the current * settings, they must be changed and the project recompiled from the source code before being programmed into the microcontroller. - * Most project configuration options are located in the "makefile" build script inside each LUFA application's folder, however - * some demo or application-specific configuration settings (such as the output format in the AudioOut demo) are located in one or - * more of the source files of the project. See each project's individual documentation for application-specific configuration - * values. + * Most project configuration options are located in the makefile build script inside each LUFA application's folder, + * however some demo or application-specific configuration settings are located in one or more of the source files of the project. + * See each project's individual documentation for application-specific configuration values. * * Each project "makefile" contains all the script and configuration data required to compile each project. When opened with * any regular basic text editor such as Notepad or WordPad (ensure that the save format is a pure ASCII text format) the * build configuration settings may be altered. * - * Inside each makefile, a number of configuration variables are located, with the format " = ". For - * each application, the important variables which should be altered are: + * \see \ref Page_BuildSystem for information on the LUFA build system. + * + * \section Sec_AppConfigParams The Default Application Template + * + * Below is a copy of the default LUFA application makefile, which can be used as a template for each application. + * + * \verbinclude makefile_template + * + * Inside each makefile, a number of configuration variables are listed with the syntax " = ". For + * each application, the important standard variables which should be altered are: * * - MCU, the target processor model * - ARCH, the target microcontroller architecture * - BOARD, the target board hardware * - F_CPU, the target CPU master clock frequency, after any prescaling * - F_USB, the target raw input clock to the USB module of the processor - * - CDEFS, the C preprocessor defines which configure options the source code - * - LUFA_PATH, the path to the LUFA library source code - * - LUFA_OPTS, the compile time LUFA options which configure the library features + * - OPTIMIZATION, the level of optimization to compile with + * - TARGET, the name of the target output binary and other files + * - SRC, the list of source files to compile/assemble/link + * - LUFA_PATH, the path to the LUFA library core source code + * - CC_FLAGS, the common command line flags to pass to the C/C++ compiler, assembler and linker + * - LD_FLAGS, the command line flags to pass to the linker * * These values should be changed to reflect the build hardware. * - * \section Sec_MCU The MCU Parameter + * \subsection SSec_MCU The MCU Parameter * This parameter indicates the target microcontroller model for the compiled application. This should be set to the model of the target * microcontroller (such as the AT90USB1287, or the ATMEGA32U4), in all lower-case (e.g. "at90usb1287"). Note that not all demos support all the * microcontroller models and architectures, as they may make use of peripherals or modes only present in some devices. * * For supported processor models, see \ref Page_DeviceSupport. * - * \section Sec_ARCH The ARCH Parameter + * \subsection SSec_ARCH The ARCH Parameter * This parameter indicates the target microcontroller architecture the library is to be compiled for. Different microcontroller * architectures require different source files to be compiled into the final binary, and so this option must be set to the correct * architecture for the selected platform. * * For supported processor architectures, see \ref Page_DeviceSupport. * - * \section Sec_BOARD The BOARD Parameter + * \subsection SSec_BOARD The BOARD Parameter * This parameter indicates the target board hardware for the compiled application. Some LUFA library drivers are board-specific, * such as the LED driver, and the library needs to know the layout of the target board. If you are using one of the board models listed * on the main library page, change this parameter to the board name in all UPPER-case. @@ -58,32 +68,37 @@ * * For boards with built in hardware driver support within the LUFA library, see \ref Page_DeviceSupport. * - * \section Sec_F_CPU The F_CPU Parameter + * \subsection SSec_F_CPU The F_CPU Parameter * This parameter indicates the target microcontroller's main CPU clock frequency, in Hz. This is used by many libraries (and applications) for * timing related purposes, and should reflect the actual CPU speed after any prescaling or adjustments are performed. * - * \section Sec_F_USB The F_USB Parameter + * \subsection SSec_F_USB The F_USB Parameter * This parameter indicates the raw input clock frequency to the USB module within the microcontroller in Hz. This may be very different on some platforms * to the main CPU clock or other peripheral/bus clocks. * - * \section Sec_CDEFS The CDEFS Parameter - * Many applications have features which can be controlled by the defining of specially named preprocessor tokens at the point of compilation - for example, - * an application might use a compile time token to turn on or off optional or mutually exclusive portions of code. Preprocessor tokens can be - * defined here by listing each one with the -D command line switch, and each token can optionally be defined to a specific value. When defined in the - * project makefile, these behave as if they were defined in every source file via a normal preprocessor define statement. + * \subsection SSec_OPTIMIZATION The OPTIMIZATION Parameter + * This parameter indicates the level of optimization to use when compiling the application. This will allow you to compile with an optimization level + * supported by GCC, from 0 (no optimization) to 3 (fastest runtime optimization) or s (smallest size). * - * Most applications will actually have multiple CDEF lines, which are concatenated together with the "+=" operator. This ensures that large - * numbers of configuration options remain readable by splitting up groups of options into separate lines. + * \subsection SSec_TARGET The TARGET Parameter + * This parameter indicates the application target name, which is used as the base filename for the build binary and debugging files. This will be the + * name of the output files once linked together into the final application, ready to load into the target. * - * \section Sec_LUFA_PATH The LUFA_PATH Parameter + * \subsection SSec_SRC The SRC Parameter + * This parameter indicates the source files used to compile the application, as a list of C (*.c), C++ (*.cpp) and Assembly (*.S) files. Note that + * all assembly files must end in a capital .S extension, as lowercase .s files are reserved for GCC intermediate files. + * + * \subsection SSec_LUFA_PATH The LUFA_PATH Parameter * As each LUFA program requires the LUFA library source code to compile correctly, the application must know where the LUFA library is located. This - * value specifies the path to the LUFA library base relative to the path of the project makefile. - * - * \section Sec_LUFA_OPTS The LUFA_OPTS Parameter - * This value is similar to the CDEFS parameter listed elsewhere -- indeed, it is simply a convenient place to group LUFA related tokens away from the - * application's compile time tokens. Normally, these options do not need to be altered to allow an application to compile and run correctly on a - * different board or microcontroller to the current configuration - if the options are incorrect, then the demo is most likely incompatible with the chosen - * microcontroller model and cannot be made to function through the altering of the makefile settings alone (or at all). Settings such as the USB mode - * (device, host or both), the USB interface speed and other LUFA configuration options can be set here - see \ref Page_TokenSummary documentation for details - * on the available LUFA compile time configuration options. + * value specifies the path to the LUFA library core. This path may be relative or absolute, however note than even under Windows based systems the + * forward-slash (/) path seperator must be used. + * + * \subsection SSec_CC_FLAGS The CC_FLAGS Parameter + * This parameter lists the compiler flags passed to the C/C++ compiler, the assembler and the linker. These are used as-is directly to GCC and thus + * must match GCC's command line options as given in the GCC manual. This variable may be used to define tokens directly on the command line, enable or + * disable warnings, adjust the target-specific tuning parameters or other options. + * + * \subsection SSec_LD_FLAGS The LD_FLAGS Parameter + * This parameter lists the linker flags passed exclusively to the linker. These are used as-is directly to GCC and thus must match GCC's command line + * linker options as given in the GCC manual. This variable may be used to create or relocate custom data sections, or enable linker specific behaviors. */ diff --git a/LUFA/DoxygenPages/DevelopingWithLUFA.txt b/LUFA/DoxygenPages/DevelopingWithLUFA.txt index 6dc851a2a..e669e284c 100644 --- a/LUFA/DoxygenPages/DevelopingWithLUFA.txt +++ b/LUFA/DoxygenPages/DevelopingWithLUFA.txt @@ -11,6 +11,7 @@ * information on compile-time tuning of the library and other developer-related sections. * * Subsections: + * \li \subpage Page_BuildSystem - The LUFA Buildsystem * \li \subpage Page_TokenSummary - Summary of Compile Time Tokens * \li \subpage Page_Migration - Migrating from an Older LUFA Version * \li \subpage Page_VIDPID - Allocated USB VID and PID Values diff --git a/LUFA/DoxygenPages/DeviceSupport.txt b/LUFA/DoxygenPages/DeviceSupport.txt index 37a920031..165f115db 100644 --- a/LUFA/DoxygenPages/DeviceSupport.txt +++ b/LUFA/DoxygenPages/DeviceSupport.txt @@ -129,7 +129,8 @@ /** * \page Page_UC3Support Atmel 32-Bit UC3 AVR (UC3) - * Note: The AVR32 UC3 device support is currently experimental, and is included for preview purposes only. + * + * \warning The AVR32 UC3 device support is currently experimental, and is included for preview purposes only. * * \section Sec_UC3Support_Devices Supported Microcontroller Models * @@ -298,7 +299,8 @@ /** * \page Page_XMEGASupport Atmel USB XMEGA AVR (XMEGA) - * Note: The XMEGA device support is currently experimental (incomplete and/or non-functional), and is included for preview purposes only. + * + * \warning The XMEGA device support is currently experimental (incomplete and/or non-functional), and is included for preview purposes only. * * \section Sec_XMEGASupport_Devices Supported Microcontroller Models * diff --git a/LUFA/DoxygenPages/ExportingLibrary.txt b/LUFA/DoxygenPages/ExportingLibrary.txt index 0f45c2324..d4c1cbe1c 100644 --- a/LUFA/DoxygenPages/ExportingLibrary.txt +++ b/LUFA/DoxygenPages/ExportingLibrary.txt @@ -1,106 +1,106 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_ExportingLibrary Exporting the Library for IDE Use - * - * While LUFA was designed to allow for easy compilation in a makefile driven environment, - * it is possible to export the library into a form suitable for drop-in use inside of an - * IDE. - * - * \section Sec_LibraryExport Exporting the Library - * An export of the library is at its most basic, a direct copy of the main "LUFA" source folder from the - * root download folder; this contains the library core which can be re-used within external projects. - * However, as many IDEs attempt to automatically compile all included source files, it is neccesary to - * exclude some directories and files from the library core export to allow for easier integration into - * an IDE project. - * - * \subsection SSec_ManualExport Manual Export - * To manually export the library core, copy over the main LUFA library folder from the LUFA root directory, - * renaming as desired. Within the library core folder, the following directories should be removed or - * excluded from your IDE import: - * - Documentation/ - * - DoxygenPages/ - * - CodeTemplates/ - * - * If required, files from the CodeTemplates/ subdirectory may be copied to your IDE project as needed. - * - * The resulting copy of the library may then be imported into your chosen IDE according to the instructions - * shown in \ref Sec_LibraryImport. - * - * \subsection SSec_AutomaticExport Automatic Export - * If desired, the steps indicated in \ref SSec_ManualExport may be automatically performed, by running the - * command make export_tar from the command line. This will generate two .tar files in the - * current directory, named LUFA_XXXXXX.tar and LUFA_XXXXXX_Code_Templates.tar (where "XXXXXX" is - * the version of the library being exported). The first archive contains the exported LUFA core with the - * non-required files removed, while the second contains an archived copy of the code template files for the - * current LUFA version. - * - * The resulting archived copy of the library may then be extracted to your chosen IDE project source directory - * and imported according to the instructions shown in \ref Sec_LibraryImport. - * - * \section Sec_LibraryImport Importing the Library - * An exported copy of the library may be imported wholesale into an IDE project, if the instructions detailed - * in \ref Sec_LibraryExport are followed. - * - * Specific instructions for importing an exported version of LUFA into various IDEs are listed below. - * - * \subsection SSec_AS56_Import Importing into AVRStudio 5/Atmel Studio 6 - * To import LUFA into a new or existing project, the following steps must be followed. - * - * \subsubsection SSSec_AS56_Import_Step1 Copy over the exported library - * Copy over the exported library archive created via the steps listed in \ref Sec_LibraryExport to your AS5/AS6 - * project directory. - * - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png - * - * \subsubsection SSSec_AS56_Import_Step2 Extract exported library - * Extract out the contents of the archive to a new folder. This may be any name you wish, however keep in mind - * that this name will need to be referenced within your user application under most circumstances. It is - * suggested that this folder be named "LUFA", or "LUFA" followed by the version string for easy reference. - * - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png - * - * \subsubsection SSSec_AS56_Import_Step3 Add the library files - * Open your AVRStudio 5/Atmel Studio 6 project. From the "Solution Explorer" pane, click the "Show All Files" - * button on the toolbar to display ghosted icons of files and folders located in the project source directory - * that are not currently added to the project. - * - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png - * - * Right-click the ghosted version of the extracted LUFA export folder in the Solution Explorer pane, and - * choose the "Add to Project" option from the context menu. This will add the entire LUFA source tree to the - * current project. - * - * \subsubsection SSSec_AS56_Import_Step4 Open Project Toolchain Properties - * In the Solution Explorer pane, click the project node, and press the "Properties" button in the toolbar to - * open the Project Properties window. This window allows you to configure the various project global compiler, - * assembler and linker options. - * - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png - * - * Click the "Toolchain" tab on the left side of the Project Properties window. - * - * \subsubsection SSSec_AS56_Import_Step5 Configure Project Toolchain Properties - * - * In the GNU C Compiler section, open the "Symbols" page. Click the "Add Item" button to the top-right of the - * "Defined Symbols" section to add new symbols. - * - * At a minimum, you will need to define the following symbols (for more information on these symbols, see - * \ref Page_ConfiguringApps): - * - ARCH - * - F_CPU - * - F_USB - * - BOARD - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png - * - * Next, open the GNU C Compiler section's "Optimization" page. Ensure that the option to prepare functions for - * garbage collection is enabled. - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png - * - * Finally, in the GNU C Linker section, open the "Optimization" page. Ensure that the option to garbage collect - * unused sections is selected. - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png - */ +/** \file + * + * This file contains special DoxyGen information for the generation of the main page and other special + * documentation pages. It is not a project source file. + */ + +/** \page Page_ExportingLibrary Exporting the Library for IDE Use + * + * While LUFA was designed to allow for easy compilation in a makefile driven environment, + * it is possible to export the library into a form suitable for drop-in use inside of an + * IDE. + * + * \section Sec_LibraryExport Exporting the Library + * An export of the library is at its most basic, a direct copy of the main "LUFA" source folder from the + * root download folder; this contains the library core which can be re-used within external projects. + * However, as many IDEs attempt to automatically compile all included source files, it is neccesary to + * exclude some directories and files from the library core export to allow for easier integration into + * an IDE project. + * + * \subsection SSec_ManualExport Manual Export + * To manually export the library core, copy over the main LUFA library folder from the LUFA root directory, + * renaming as desired. Within the library core folder, the following directories should be removed or + * excluded from your IDE import: + * - Documentation/ + * - DoxygenPages/ + * - CodeTemplates/ + * + * If required, files from the CodeTemplates/ subdirectory may be copied to your IDE project as needed. + * + * The resulting copy of the library may then be imported into your chosen IDE according to the instructions + * shown in \ref Sec_LibraryImport. + * + * \subsection SSec_AutomaticExport Automatic Export + * If desired, the steps indicated in \ref SSec_ManualExport may be automatically performed, by running the + * command make export_tar from the command line. This will generate two .tar files in the + * current directory, named LUFA_YYMMDD.tar and LUFA_YYMMDD_Code_Templates.tar (where + * "YYMMDD" is the version of the library being exported). The first archive contains the exported LUFA core + * with the non-required files removed, while the second contains an archived copy of the code template files + * for the current LUFA version. + * + * The resulting archived copy of the library may then be extracted to your chosen IDE project source directory + * and imported according to the instructions shown in \ref Sec_LibraryImport. + * + * \section Sec_LibraryImport Importing the Library + * An exported copy of the library may be imported wholesale into an IDE project, if the instructions detailed + * in \ref Sec_LibraryExport are followed. + * + * Specific instructions for importing an exported version of LUFA into various IDEs are listed below. + * + * \subsection SSec_AS56_Import Importing into AVRStudio 5/Atmel Studio 6 + * To import LUFA into a new or existing project, the following steps must be followed. + * + * \subsubsection SSSec_AS56_Import_Step1 Copy over the exported library + * Copy over the exported library archive created via the steps listed in \ref Sec_LibraryExport to your AS5/AS6 + * project directory. + * + * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png + * + * \subsubsection SSSec_AS56_Import_Step2 Extract exported library + * Extract out the contents of the archive to a new folder. This may be any name you wish, however keep in mind + * that this name will need to be referenced within your user application under most circumstances. It is + * suggested that this folder be named "LUFA", or "LUFA" followed by the version string for easy reference. + * + * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png + * + * \subsubsection SSSec_AS56_Import_Step3 Add the library files + * Open your AVRStudio 5/Atmel Studio 6 project. From the "Solution Explorer" pane, click the "Show All Files" + * button on the toolbar to display ghosted icons of files and folders located in the project source directory + * that are not currently added to the project. + * + * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png + * + * Right-click the ghosted version of the extracted LUFA export folder in the Solution Explorer pane, and + * choose the "Add to Project" option from the context menu. This will add the entire LUFA source tree to the + * current project. + * + * \subsubsection SSSec_AS56_Import_Step4 Open Project Toolchain Properties + * In the Solution Explorer pane, click the project node, and press the "Properties" button in the toolbar to + * open the Project Properties window. This window allows you to configure the various project global compiler, + * assembler and linker options. + * + * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png + * + * Click the "Toolchain" tab on the left side of the Project Properties window. + * + * \subsubsection SSSec_AS56_Import_Step5 Configure Project Toolchain Properties + * + * In the GNU C Compiler section, open the "Symbols" page. Click the "Add Item" button to the top-right of the + * "Defined Symbols" section to add new symbols. + * + * At a minimum, you will need to define the following symbols (for more information on these symbols, see + * \ref Page_ConfiguringApps): + * - ARCH + * - F_CPU + * - F_USB + * - BOARD + * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png + * + * Next, open the GNU C Compiler section's "Optimization" page. Ensure that the option to prepare functions for + * garbage collection is enabled. + * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png + * + * Finally, in the GNU C Linker section, open the "Optimization" page. Ensure that the option to garbage collect + * unused sections is selected. + * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png + */ diff --git a/LUFA/DoxygenPages/FutureChanges.txt b/LUFA/DoxygenPages/FutureChanges.txt index d0453a207..edc4f5399 100644 --- a/LUFA/DoxygenPages/FutureChanges.txt +++ b/LUFA/DoxygenPages/FutureChanges.txt @@ -15,9 +15,7 @@ * - Code Features * -# Add hub support when in Host mode for multiple devices * -# Investigate virtual hubs when in device mode instead of composite devices - * -# Change makefiles to allow for absolute LUFA location to be used * -# Re-add interrupt Pipe/Endpoint support - * -# Add makefile includes to reduce boilerplate in user makefiles * -# Update stream APIs to use DMA transfers on supported architectures * -# Pull out third party libraries into a separate folder and reference them as required * -# Add a LUFA_YIELD macro for integration into a third-party RTOS diff --git a/LUFA/DoxygenPages/Groups.txt b/LUFA/DoxygenPages/Groups.txt index 321779d74..e6ad884b6 100644 --- a/LUFA/DoxygenPages/Groups.txt +++ b/LUFA/DoxygenPages/Groups.txt @@ -19,11 +19,6 @@ * Miscellaneous driver Functions, macros, variables, enums and types. */ -/** \defgroup Group_PlatformDrivers System Platform Drivers - * - * Drivers relating to the general architecture platform, such as clock setup and interrupt management. - */ - /** \defgroup Group_PlatformDrivers_AVR8 AVR8 * \ingroup Group_PlatformDrivers * diff --git a/LUFA/DoxygenPages/KnownIssues.txt b/LUFA/DoxygenPages/KnownIssues.txt index 9b648144b..cbe761ecf 100644 --- a/LUFA/DoxygenPages/KnownIssues.txt +++ b/LUFA/DoxygenPages/KnownIssues.txt @@ -1,40 +1,44 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - - /** \page Page_KnownIssues Known Issues - * The following are known issues present in each official LUFA release. This list should contain all known - * issues in the library. Most of these issues should be corrected in the future release - see - * \ref Page_FutureChanges for a list of planned changes in future releases. - * - * \section Sec_KnownIssuesXXXXXX Version XXXXXX - * - AVR8 Architecture - * - No known issues. - * - XMEGA Architecture - * - No demos, bootloaders or projects have been ported for the XMEGA devices in the current release, - * although the architecture is supported in the LUFA core library. - * - Endpoints of more than 64 bytes are not currently supported in this release. - * - Isochronous endpoints are not currently supported in this release. As a result, the audio class - * cannot be used on XMEGA devices. - * - Multiple-bank endpoints are not currently supported in this release. - * - Early revisions of the ATXMEGA128A1U are incompatible with LUFA, due to their various errata - * relating to the USB controller. - * - UC3 Architecture - * - No demos, bootloaders or projects have been ported for the UC3 devices in the current release, - * although the architecture is supported in the LUFA core library. - * - DMA transfers to and from the USB controller are not yet implemented for this release. - * - The UC3C, UC3D and UC3L sub-families of UC3 are not currently supported by the library due to their - * altered USB controller design. - * - The various \c CreateStream() functions for creating standard \c compatible virtual file - * streams are not available on the UC3 architecture, due to a lack of suitable library support. - * - Architecture Independant - * - The HID parser fails for array type elements that have a MIN and MAX usage applied; each element - * in the array will receive a unique incrementing usage from the MIN value, up to MAX. - * - The current application makefiles do not work if the output directory is not the same directory - * as the makefile itself. - * - The LUFA library is not watchdog aware, and thus timeouts are possible if short periods are used - * and a lengthy USB operation is initiated. - */ - +/** \file + * + * This file contains special DoxyGen information for the generation of the main page and other special + * documentation pages. It is not a project source file. + */ + + /** \page Page_KnownIssues Known Issues + * The following are known issues present in each official LUFA release. This list should contain all known + * issues in the library. Most of these issues should be corrected in the future release - see + * \ref Page_FutureChanges for a list of planned changes in future releases. + * + * \section Sec_KnownIssues120730 Version 120730 (BETA) + * - AVR8 Architecture + * - No known issues. + * - UC3 Architecture + * \warning The UC3 device support is currently experimental (incomplete and/or non-functional), and is included for preview purposes only. \n + * + * - No demos, bootloaders or projects have been ported for the UC3 devices in the current release, + * although the architecture is supported in the LUFA core library. + * - DMA transfers to and from the USB controller are not yet implemented for this release. + * - The UC3C, UC3D and UC3L sub-families of UC3 are not currently supported by the library due to their + * altered USB controller design. + * - The various \c CreateStream() functions for creating standard \c compatible virtual file + * streams are not available on the UC3 architecture, due to a lack of suitable library support. + * - XMEGA Architecture + * \warning The XMEGA device support is currently experimental (incomplete and/or non-functional), and is included for preview purposes only. + * + * - No demos, bootloaders or projects have been ported for the XMEGA devices in the current release, + * although the architecture is supported in the LUFA core library. + * - Endpoints of more than 64 bytes are not currently supported in this release. + * - Isochronous endpoints are not currently supported in this release. As a result, the audio class + * cannot be used on XMEGA devices. + * - Multiple-bank endpoints are not currently supported in this release. + * - Early revisions of the ATXMEGA128A1U are incompatible with LUFA, due to their various errata + * relating to the USB controller. + * - Architecture Independent + * - The HID parser fails for array type elements that have a MIN and MAX usage applied; each element + * in the array will receive a unique incrementing usage from the MIN value, up to MAX. + * - The LUFA library is not watchdog aware, and thus timeouts are possible if short periods are used + * and a lengthy USB operation is initiated. + * - Build System + * - No known issues. + */ + diff --git a/LUFA/DoxygenPages/LUFAPoweredProjects.txt b/LUFA/DoxygenPages/LUFAPoweredProjects.txt index 841776bb6..7d514aa67 100644 --- a/LUFA/DoxygenPages/LUFAPoweredProjects.txt +++ b/LUFA/DoxygenPages/LUFAPoweredProjects.txt @@ -57,11 +57,13 @@ * \li Estick JTAG, an ARM JTAG debugger: http://code.google.com/p/estick-jtag/ * \li "Fingerlicking Wingdinger" (WARNING: Bad language if no Javascript), a MIDI controller: http://noisybox.net/electronics/wingdinger/ * \li Flyatar, a real-time fly tracking system: https://github.com/peterpolidoro/Flyatar + * \li FootJoy, a 22 button, 6-axis josystick with keyboard and mouse modes: https://bitbucket.org/sirbrialliance/foot-joy/ * \li Gamecube controller to USB adapter: https://www.facebook.com/media/set/?set=a.10150202447076304.310536.688776303&l=df53851c50 * \li Garmin GPS USB to NMEA standard serial sentence translator: http://github.com/nall/garmin-transmogrifier/tree/master * \li Generic HID Device Creator: http://generichid.sourceforge.net/ * \li Generic HID Open Source Framework: http://www.waitingforfriday.com/index.php/USB_Generic_HID_Open_Source_Framework_for_Atmel_AVR_and_Windows * \li Ghetto Drum, a MIDI drum controller: http://noisybox.net/art/gdrum/ + * \li GPS enabled lap timer for vehicles: http://www.assembla.com/code/ironlung/subversion/nodes/trunk/LapTimer * \li Hardware Volume Control: https://github.com/davidk/hw-volume-control * \li Hiduino, a USB-MIDI replacement firmware for the Arduino Uno: http://code.google.com/p/hiduino/ * \li Ikea RGB LED USB modification: http://slashhome.se/p/projects/id/ikea_dioder_usb/#project @@ -81,6 +83,7 @@ * \li Motherboard BIOS flasher: http://www.coreboot.org/InSystemFlasher * \li Multi-button Joystick (French): http://logicien-parfait.fr/dokuwiki/doku.php?id=projet:joystick * \li Music Playing Alarm Clock (Tutorial): http://www.instructables.com/id/Music-Playing-Alarm-Clock/ + * \li Nehebkau, Laptop Controlled Keyboard and Mouse: http://www.frank-zhao.com/cache/nehebkau.php * \li NeroJTAG, a JTAG dongle: https://github.com/makestuff/neroJtag * \li NES Controller USB modification: http://projects.peterpolidoro.net/video/NESUSB.htm * \li Nikon wireless camera remote control (Norwegian): http://hekta.org/~hpe1119/ @@ -99,6 +102,7 @@ * \li SDR1, a Software Defined Radio firmware: https://code.google.com/p/sdr-mk1/ * \li SEGA Megadrive/Genesis Development Cartridge: http://www.makestuff.eu/wordpress/?page_id=398 * \li Serial Line bus analyser: http://www.pjrc.com/teensy/projects/SerialAnalyzer.html + * \li SNES custom FLASH ROM: http://electrifiedfoolingmachine.co/?page_id=633 * \li Smartcard Detective: https://code.google.com/p/smartcarddetective/ * \li SmartportVHD Apple II Mass Storage adapter: http://pcedric3.free.fr/SmartportVHD/ * \li Single LED Matrix Display: http://guysoft.wordpress.com/2009/10/08/bumble-b/ @@ -129,6 +133,7 @@ * \li Arduino Uno, the official Arduino board: http://www.arduino.cc * \li ARPS Locator: http://la3t.hamradio.no/lab//?id=tracker_en * \li AsTeRICS assistive technologies project, HID actuator: http://www.asterics.eu + * \li Ceberus, a MadCatz Xbox 360 arcade stick modifier: http://www.phreakmods.com/products/cerberus * \li CFFA3000, a CompactFlash interface for the Apple II: http://www.dreher.net/CFforAppleII * \li Digital Survey Instruments Magnetometer and Pointer: http://www.digitalsurveyinstruments.com/ * \li FinchRobot, a robot designed for educational use: http://www.finchrobot.com/ @@ -144,6 +149,7 @@ * \li RFI21.1EU UHF RFID reader: http://www.metra.cz/rfid/uhf-rfid-ctecky/rfi21-1eu-uhf-rfid-ctecka.htm * \li SmartCardDetective, a Smart Card analysis tool: http://www.smartcarddetective.com/ * \li USBTINY-MKII, an AVRISP-MKII Clone AVR Programmer: http://tom-itx.dyndns.org:81/~webpage/boards/USBTiny_Mkii/USBTiny_Mkii_index.php + * \li UDS18B20 USB Temperature sensor: http://toughlog.org/uds18b20/ * \li VMeter, a USB MIDI touch strip controller: http://www.vmeter.net/ * \li XMEGA Development Board, using LUFA as an On-Board Programmer: http://xmega.mattair.net/ * \li Zeptoprog, a multifunction AVR programmer: http://www.mattairtech.com/index.php/featured/zeptoprog.html diff --git a/LUFA/DoxygenPages/MigrationInformation.txt b/LUFA/DoxygenPages/MigrationInformation.txt index f0fd9b210..f97e76829 100644 --- a/LUFA/DoxygenPages/MigrationInformation.txt +++ b/LUFA/DoxygenPages/MigrationInformation.txt @@ -10,7 +10,7 @@ * to the next version released. It does not indicate all new additions to the library in each version change, only * areas relevant to making older projects compatible with the API changes of each new release. * - * \section Sec_MigrationXXXXXX Migrating from 120219 to XXXXXX + * \section Sec_Migration120730 Migrating from 120219 to 120730 (BETA) * Device Mode * - The device mode Audio Class driver now requires an additional configuration parameter, the Audio Control interface index. Existing applications should * be adjusted to specify the additional configuration parameter. @@ -44,6 +44,9 @@ * - The MIDI class driver \ref MIDI_EventPacket_t event packet no longer contains seperate \c CableIndex and \c Command entries; these have been combined * into a single \c Event element which can be contructed using the new macro \ref MIDI_EVENT(). Existing applications should use the new macro and structure * element name. + * - The library "LUFA/Drivers/USB/Core/ConfigDescriptor.c" source file has been renamed "LUFA/Drivers/USB/Core/ConfigDescriptors.c" as this was clashing with + * files in some low level host mode demo applications, preventing parallel project builds. If you are referencing the project source files directly instead + * of using the makefile module names, you will need to adjust your project makefile. * * \section Sec_Migration120219 Migrating from 111009 to 120219 * USB Core diff --git a/LUFA/DoxygenPages/ProgrammingApps.txt b/LUFA/DoxygenPages/ProgrammingApps.txt index c1b2181c8..4759ac87a 100644 --- a/LUFA/DoxygenPages/ProgrammingApps.txt +++ b/LUFA/DoxygenPages/ProgrammingApps.txt @@ -9,8 +9,8 @@ * Once you have built an application, you will need a way to program in the resulting ".HEX" file (and, if your * application uses EEPROM variables with initial values, also a ".EEP" file) into your USB AVR. Normally, the * reprogramming of an AVR device must be performed using a special piece of programming hardware, through one of the - * supported AVR programming protocols - ISP, HVSP, HVPP, JTAG or dW. This can be done through a custom programmer, - * a third party programmer, or an official Atmel AVR tool - for more information, see the Atmel.com website. + * supported AVR programming protocols - ISP, HVSP, HVPP, JTAG, dW or PDI. This can be done through a custom programmer, + * a third party programmer, or an official Atmel AVR tool - for more information, see the atmel.com website. * * Alternatively, you can use the bootloader. From the Atmel factory, each USB AVR comes preloaded with the Atmel * DFU (Device Firmware Update) class bootloader, a small piece of AVR firmware which allows the remainder of the @@ -19,9 +19,12 @@ * or broken without an external programming device. They have disadvantages however; they cannot change the fuses of * the AVR (special configuration settings that control the operation of the chip itself) and a small portion of the * AVR's FLASH program memory must be reserved to contain the bootloader firmware, and thus cannot be used by the - * loaded application. Atmel's DFU bootloader is either 4KB (for the smaller USB AVRs) or 8KB (for the larger USB AVRs). + * loaded application. * * If you wish to use the DFU bootloader to program in your application, refer to your DFU programmer's documentation. * Atmel provides a free utility called FLIP which is USB AVR compatible, and an open source (Linux compatible) * alternative exists called "dfu-programmer". + * + * \see \ref Page_BuildModule_DFU for information on the LUFA build system DFU module, for automatic DFU bootloader + * programming makefile targets. */ diff --git a/LUFA/DoxygenPages/Style/Style.css b/LUFA/DoxygenPages/Style/Style.css index b64f9de83..b69cac7a5 100644 --- a/LUFA/DoxygenPages/Style/Style.css +++ b/LUFA/DoxygenPages/Style/Style.css @@ -1,1122 +1,1122 @@ -@media print - { - #top - { - display:none; - } - - #side-nav - { - display:none; - } - - #nav-path - { - display:none; - } - - body - { - overflow:visible; - } - - h1,h2,h3,h4,h5,h6 - { - page-break-after:avoid; - } - - .summary - { - display:none; - } - - .memitem - { - page-break-inside:avoid; - } - - #doc-content - { - display:inline; - height:auto !important; - margin-left:0 !important; - overflow:inherit; - width:auto !important; - } - - .fragment - { - background-color: #FFFFFF !important; - } -} - -body,table,div,p,dl -{ - font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; - font-size:13px; - line-height:1.3; -} - -div.contents p -{ - padding-left:12px; -} - -div.contents table.memberdecls,.paramname -{ - font-family:Consolas, Monaco, courier, sans-serif; - font-size:105%; - padding-right:20px; -} - -.title -{ - font-size:150%; - font-weight:bold; - margin:10px 2px; -} - -h1 -{ - font-size:25px; - margin-bottom:10px; -} - -h2 -{ - color:#42657B; - font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; - font-size:17px; -} - -h3 -{ - font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; - font-size:15px; -} - -h4 -{ - font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; - font-size:13px; -} - -dt -{ - font-weight:bold; -} - -div.multicol -{ - -moz-column-count:3px; - -moz-column-gap:1em; - -webkit-column-count:3px; - -webkit-column-gap:1em; -} - -p.startli,p.startdd,p.starttd -{ - margin-top:2px; -} - -p.endli -{ - margin-bottom:0; -} - -p.enddd -{ - margin-bottom:4px; -} - -p.endtd -{ - margin-bottom:2px; -} - -caption -{ - font-weight:bold; -} - -span.legend -{ - font-size:70%; - text-align:center; -} - -h3.version -{ - font-size:90%; - text-align:center; -} - -div.qindex,div.navtab -{ - background-color:#EAEFF7; - border:1px solid #9EB3DC; - text-align:center; -} - -div.qindex,div.navpath -{ - line-height:140%; - width:100%; -} - -div.navtab -{ - margin-right:15px; -} - -a -{ - color:#355594; - font-weight:normal; - text-decoration:none; -} - -.contents a:visited -{ - color:#3D62AB; -} - -a:hover -{ - text-decoration:underline; -} - -a.qindex -{ - font-weight:bold; -} - -a.qindexHL -{ - background-color:#97ADD9; - border:1px double #7F9BD1; - color:#ffffff; - font-weight:bold; -} - -.contents a.qindexHL:visited -{ - color:#ffffff; -} - -a.el -{ - font-weight:bold; -} - -a.code,a.code:visited -{ - color:#4665A2; -} - -a.codeRef,a.codeRef:visited -{ - color:#4665A2; -} - -dl.el -{ - margin-left:-1cm; -} - -pre.fragment { - border: 1px solid #C4CFE5; - background-color: #FBFCFD; - padding: 4px 6px; - margin: 4px 8px 4px 2px; - overflow: auto; - word-wrap: break-word; - font-size: 9pt; - line-height: 125%; - font-family: monospace, fixed; - font-size: 105%; -} - -div.fragment { - padding: 4px; - margin: 4px; - background-color: #FBFCFD; - border: 1px solid #C4CFE5; -} - -div.line { - font-family: monospace, fixed; - font-size: 13px; - line-height: 1.0; - text-wrap: unrestricted; - white-space: -moz-pre-wrap; /* Moz */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - white-space: pre-wrap; /* CSS3 */ - word-wrap: break-word; /* IE 5.5+ */ - text-indent: -53px; - padding-left: 53px; - padding-bottom: 0px; - margin: 0px; -} - -span.lineno { - padding-right: 4px; - text-align: right; - border-right: 2px solid #0F0; - background-color: #E8E8E8; - white-space: pre; -} -span.lineno a { - background-color: #D8D8D8; -} - -span.lineno a:hover { - background-color: #C8C8C8; -} - -div.ah -{ - -moz-border-radius:.5em; - -moz-box-shadow:rgba(0, 0, 0, 0.15) 2px 2px 2px; - -webkit-border-radius:.5em; - -webkit-box-shadow:2px 2px 3px #999; - background-color:black; - background-image:0; - border:solid thin #333; - border-radius:0.5em; - box-shadow:2px 2px 3px #999; - color:#ffffff; - font-weight:bold; - margin-bottom:3px; - margin-top:3px; - padding:0.2em; -} - -div.groupHeader -{ - font-weight:bold; - margin-left:16px; - margin-top:12px; -} - -div.groupText -{ - font-style:italic; - margin-left:16px; -} - -body -{ - background-color:white; - color:black; - margin:0; -} - -div.contents -{ - margin-left:8px; - margin-right:8px; - margin-top:10px; -} - -td.indexkey -{ - background-color:#EAEFF7; - border:1px solid #C1CEE8; - font-weight:bold; - margin:2px 0; - padding:2px 10px; - vertical-align:top; - white-space:nowrap; -} - -td.indexvalue -{ - background-color:#EAEFF7; - border:1px solid #C1CEE8; - margin:2px 0; - padding:2px 10px; -} - -tr.memlist -{ - background-color:#EDF1F8; -} - -p.formulaDsp -{ - text-align:center; -} - -img.formulaInl -{ - vertical-align:middle; -} - -div.center -{ - margin-bottom:0; - margin-top:0; - padding:0; - text-align:center; -} - -div.center img -{ - border:0; -} - -address.footer -{ - padding-right:12px; - text-align:right; -} - -img.footer -{ - border:0; - vertical-align:middle; -} - -span.keyword -{ - color:#008000; -} - -span.keywordtype -{ - color:#604020; -} - -span.keywordflow -{ - color:#e08000; -} - -span.comment -{ - color:#008000; -} - -span.preprocessor -{ - color:#806020; -} - -span.stringliteral -{ - color:#002080; -} - -span.charliteral -{ - color:#008080; -} - -span.vhdldigit -{ - color:#ff00ff; -} - -span.vhdlchar -{ - color:#000000; -} - -span.vhdlkeyword -{ - color:#700070; -} - -span.vhdllogic -{ - color:#ff0000; -} - -blockquote -{ - background-color:#F6F8FC; - border-left:2px solid #97ADD9; - margin:0 24px 0 4px; - padding:0 12px 0 16px; -} - -td.tiny -{ - font-size:75%; -} - -.dirtab -{ - border:1px solid #9EB3DC; - border-collapse:collapse; - padding:4px; -} - -th.dirtab -{ - background:#EAEFF7; - font-weight:bold; -} - -hr -{ - border:none; - border-top:1px solid #4067B4; - height:0; -} - -hr.footer -{ - height:1px; -} - -table.memberdecls -{ - border-spacing:0; - padding:0; -} - -.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,.memTemplItemLeft,.memTemplItemRight,.memTemplParams -{ - background-color:#F9FAFC; - border:none; - margin:4px; - padding:1px 0 0 8px; -} - -.mdescLeft,.mdescRight -{ - color:#555; - padding:0 8px 4px; -} - -.memItemLeft,.memItemRight,.memTemplParams -{ - border-top:1px solid #C1CEE8; -} - -.memItemLeft,.memTemplItemLeft -{ - white-space:nowrap; -} - -.memItemRight -{ - width:100%; -} - -.memTemplParams -{ - color:#3D62AB; - white-space:nowrap; -} - -.memtemplate -{ - color:#3D62AB; - font-size:80%; - font-weight:normal; - margin-left:9px; -} - -.memnav -{ - background-color:#EAEFF7; - border:1px solid #9EB3DC; - margin:2px 15px 2px 2px; - padding:2px; - text-align:center; -} - -.mempage -{ - width:100%; -} - -.memitem -{ - margin-bottom:10px; - margin-right:5px; - padding:0; -} - -.memname -{ - font-weight:bold; - margin-left:6px; - white-space:nowrap; -} - -.memproto,dl.reflist dt -{ - -moz-border-radius-topleft:8px; - -moz-border-radius-topright:8px; - -moz-box-shadow:rgba(0, 0, 0, 0.15) 5px 5px 5px; - -webkit-border-top-left-radius:8px; - -webkit-border-top-right-radius:8px; - -webkit-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); - background-color:#E1E7F4; - background-image:url('nav_f.png'); - background-repeat:repeat-x; - border-left:1px solid #A3B7DE; - border-right:1px solid #A3B7DE; - border-top:1px solid #A3B7DE; - border-top-left-radius:8px; - border-top-right-radius:8px; - box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); - color:#20335A; - font-weight:bold; - padding:6px 0; - text-shadow:0 1px 1px rgba(255, 255, 255, 0.9); -} - -.memdoc,dl.reflist dd -{ - -moz-border-radius-bottomleft:8px; - -moz-border-radius-bottomright:8px; - -moz-box-shadow:rgba(0, 0, 0, 0.15) 5px 5px 5px; - -webkit-border-bottom-left-radius:8px; - -webkit-border-bottom-right-radius:8px; - -webkit-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); - background-color:#FBFCFD; - background-image:0 color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F6F8FC), to(#EDF1F8)); - border-bottom:1px solid #A3B7DE; - border-bottom-left-radius:8px; - border-bottom-right-radius:8px; - border-left:1px solid #A3B7DE; - border-right:1px solid #A3B7DE; - border-top-width:0; - box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); - padding:2px 5px; -} - -dl.reflist dt -{ - padding:5px; -} - -dl.reflist dd -{ - margin:0 0 10px; - padding:5px; -} - -.paramkey -{ - text-align:right; -} - -.paramtype -{ - white-space:nowrap; -} - -.paramname -{ - color:#602020; - white-space:nowrap; -} - -.paramname em -{ - font-style:normal; -} - -.params,.retval,.exception,.tparams -{ - border-spacing:6px 2px; -} - -.params .paramname,.retval .paramname -{ - font-weight:bold; - vertical-align:top; -} - -.params .paramtype -{ - font-style:italic; - vertical-align:top; -} - -.params .paramdir -{ - font-family:"courier new",courier,monospace; - vertical-align:top; -} - -.ftvtree -{ - font-family:sans-serif; - margin:0; -} - -.directory -{ - font-size:9pt; - font-weight:bold; - margin:5px; -} - -.directory h3 -{ - font-size:11pt; - margin:1em 0 0; -} - -.directory > h3 -{ - margin-top:0; -} - -.directory p -{ - margin:0; - white-space:nowrap; -} - -.directory div -{ - display:none; - margin:0; -} - -.directory img -{ - vertical-align:-30%; -} - -.directory-alt -{ - font-size:100%; - font-weight:bold; -} - -.directory-alt h3 -{ - font-size:11pt; - margin:1em 0 0; -} - -.directory-alt > h3 -{ - margin-top:0; -} - -.directory-alt p -{ - margin:0; - white-space:nowrap; -} - -.directory-alt div -{ - display:none; - margin:0; -} - -.directory-alt img -{ - vertical-align:-30%; -} - -div.dynheader -{ - margin-top:8px; -} - -address -{ - color:#253B67; - font-style:normal; -} - -table.doxtable -{ - border-collapse:collapse; - margin-bottom:4px; - margin-top:4px; -} - -table.doxtable td,table.doxtable th -{ - border:1px solid #273F6D; - padding:3px 7px 2px; -} - -table.doxtable th -{ - background-color:#304D86; - color:#FFFFFF; - font-size:110%; - padding-bottom:4px; - padding-top:5px; -} - -table.fieldtable -{ - -moz-border-radius:4px; - -moz-box-shadow:rgba(0, 0, 0, 0.15) 2px 2px 2px; - -webkit-border-radius:4px; - -webkit-box-shadow:2px 2px 2px rgba(0, 0, 0, 0.15); - border:1px solid #A3B7DE; - border-radius:4px; - border-spacing:0; - box-shadow:2px 2px 2px rgba(0, 0, 0, 0.15); - margin-bottom:10px; - width:100%; -} - -.fieldtable td,.fieldtable th -{ - padding:3px 7px 2px; -} - -.fieldtable td.fieldtype,.fieldtable td.fieldname -{ - border-bottom:1px solid #A3B7DE; - border-right:1px solid #A3B7DE; - vertical-align:top; - white-space:nowrap; -} - -.fieldtable td.fielddoc -{ - border-bottom:1px solid #A3B7DE; - width:100%; -} - -.fieldtable tr:last-child td -{ - border-bottom:none; -} - -.fieldtable th -{ - -moz-border-radius-topleft:4px; - -moz-border-radius-topright:4px; - -webkit-border-top-left-radius:4px; - -webkit-border-top-right-radius:4px; - background-color:#E1E7F4; - background-image:url('nav_f.png'); - background-repeat:repeat-x; - border-bottom:1px solid #A3B7DE; - border-top-left-radius:4px; - border-top-right-radius:4px; - color:#20335A; - font-size:90%; - padding-bottom:4px; - padding-top:5px; - text-align:left; -} - -.tabsearch -{ - background-image:url('tab_b.png'); - font-size:13px; - height:36px; - left:10px; - overflow:hidden; - top:0; - z-index:101; -} - -.navpath ul -{ - background-image:url('tab_b.png'); - background-repeat:repeat-x; - border:solid 1px #BFCCE8; - color:#839ED2; - font-size:11px; - height:30px; - line-height:30px; - margin:0; - overflow:hidden; - padding:0; -} - -.navpath li -{ - background-image:url('bc_s.png'); - background-position:right; - background-repeat:no-repeat; - color:#2F4B83; - float:left; - list-style-type:none; - padding-left:10px; - padding-right:15px; -} - -.navpath li.navelem a -{ - display:block; - height:32px; - outline:none; - text-decoration:none; -} - -.navpath li.navelem a:hover -{ - color:#6081C5; -} - -.navpath li.footer -{ - background-image:none; - background-position:right; - background-repeat:no-repeat; - color:#2F4B83; - float:right; - font-size:8pt; - list-style-type:none; - padding-left:10px; - padding-right:15px; -} - -div.summary -{ - float:right; - font-size:8pt; - padding-right:5px; - text-align:right; - width:50%; -} - -div.summary a -{ - white-space:nowrap; -} - -div.ingroups -{ - font-size:8pt; - margin-left:5px; - padding-left:5px; - text-align:left; - width:50%; -} - -div.ingroups a -{ - white-space:nowrap; -} - -div.header -{ - background-color:#F9FAFC; - background-image:url('nav_h.png'); - background-repeat:repeat-x; - border-bottom:1px solid #C1CEE8; - margin:0; -} - -div.headertitle -{ - padding:5px 5px 5px 7px; -} - -dl -{ - padding:0 0 0 10px; -} - -dl.section -{ - border-left:4px solid; - padding:0 0 0 6px; -} - -dl.note -{ - border-color:#D0C000; -} - -dl.warning,dl.attention -{ - border-color:#FF0000; -} - -dl.pre,dl.post,dl.invariant -{ - border-color:#00D000; -} - -dl.deprecated -{ - border-color:#505050; -} - -dl.todo -{ - border-color:#00C0E0; -} - -dl.test -{ - border-color:#3030E0; -} - -dl.bug -{ - border-color:#C08050; -} - -dl.section dd -{ - margin-bottom:6px; -} - -#projectlogo -{ - border-collapse:separate; - text-align:center; - vertical-align:bottom; - padding-left: 20px; -} - -#projectlogo img -{ - border:0 none; -} - -#projectname -{ - font:280% Arial, sans-serif; - margin:0; - padding-left:20px; -} - -#projectbrief -{ - font:120% Tahoma, Arial, sans-serif; - margin:0; - padding:0; -} - -#projectnumber:before -{ - content:"Version "; -} - -#projectnumber -{ - font:50% Tahoma, Arial, sans-serif; - margin:0; - padding:0; -} - -#titlearea -{ - margin:0; - padding:0; - width:100%; - background-color:#E1E7F4; - background-image:url('nav_f.png'); - background-repeat:repeat-x; - color:#20335A; - font-weight:bold; - text-shadow:0 1px 1px rgba(255, 255, 255, 0.9); -} - -.image -{ - text-align:center; -} - -.dotgraph -{ - text-align:center; -} - -.mscgraph -{ - text-align:center; -} - -.caption -{ - font-weight:bold; -} - -div.zoom -{ - border:1px solid #8AA3D4; -} - -dl.citelist -{ - margin-bottom:50px; -} - -dl.citelist dt -{ - color:#2C477C; - float:left; - font-weight:bold; - margin-right:10px; - padding:5px; -} - -dl.citelist dd -{ - margin:2px 0; - padding:5px 0; -} - -div.toc -{ - background-color:#F4F6FB; - border:1px solid #D6DFF0; - border-radius:7px 7px 7px 7px; - float:right; - height:auto; - margin:0 20px 10px 10px; - padding:14px 25px; - width:200px; -} - -div.toc li -{ - background:url("bdwn.png") no-repeat scroll 0 5px transparent; - font:10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; - margin-top:5px; - padding-left:10px; - padding-top:2px; -} - -div.toc h3 -{ - border-bottom:0 none; - color:#3D62AB; - font:bold 12px/1.2 Arial,FreeSans,sans-serif; - margin:0; -} - -div.toc ul -{ - border:medium none; - list-style:none outside none; - padding:0; -} - -div.toc li.level1 -{ - margin-left:0; -} - -div.toc li.level2 -{ - margin-left:15px; -} - -div.toc li.level3 -{ - margin-left:30px; -} - -div.toc li.level4 -{ - margin-left:45px; -} +@media print + { + #top + { + display:none; + } + + #side-nav + { + display:none; + } + + #nav-path + { + display:none; + } + + body + { + overflow:visible; + } + + h1,h2,h3,h4,h5,h6 + { + page-break-after:avoid; + } + + .summary + { + display:none; + } + + .memitem + { + page-break-inside:avoid; + } + + #doc-content + { + display:inline; + height:auto !important; + margin-left:0 !important; + overflow:inherit; + width:auto !important; + } + + .fragment + { + background-color: #FFFFFF !important; + } +} + +body,table,div,p,dl +{ + font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size:13px; + line-height:1.3; +} + +div.contents p +{ + padding-left:12px; +} + +div.contents table.memberdecls,.paramname +{ + font-family:Consolas, Monaco, courier, sans-serif; + font-size:105%; + padding-right:20px; +} + +.title +{ + font-size:150%; + font-weight:bold; + margin:10px 2px; +} + +h1 +{ + font-size:25px; + margin-bottom:10px; +} + +h2 +{ + color:#42657B; + font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size:17px; +} + +h3 +{ + font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size:15px; +} + +h4 +{ + font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size:13px; +} + +dt +{ + font-weight:bold; +} + +div.multicol +{ + -moz-column-count:3px; + -moz-column-gap:1em; + -webkit-column-count:3px; + -webkit-column-gap:1em; +} + +p.startli,p.startdd,p.starttd +{ + margin-top:2px; +} + +p.endli +{ + margin-bottom:0; +} + +p.enddd +{ + margin-bottom:4px; +} + +p.endtd +{ + margin-bottom:2px; +} + +caption +{ + font-weight:bold; +} + +span.legend +{ + font-size:70%; + text-align:center; +} + +h3.version +{ + font-size:90%; + text-align:center; +} + +div.qindex,div.navtab +{ + background-color:#EAEFF7; + border:1px solid #9EB3DC; + text-align:center; +} + +div.qindex,div.navpath +{ + line-height:140%; + width:100%; +} + +div.navtab +{ + margin-right:15px; +} + +a +{ + color:#355594; + font-weight:normal; + text-decoration:none; +} + +.contents a:visited +{ + color:#3D62AB; +} + +a:hover +{ + text-decoration:underline; +} + +a.qindex +{ + font-weight:bold; +} + +a.qindexHL +{ + background-color:#97ADD9; + border:1px double #7F9BD1; + color:#ffffff; + font-weight:bold; +} + +.contents a.qindexHL:visited +{ + color:#ffffff; +} + +a.el +{ + font-weight:bold; +} + +a.code,a.code:visited +{ + color:#4665A2; +} + +a.codeRef,a.codeRef:visited +{ + color:#4665A2; +} + +dl.el +{ + margin-left:-1cm; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; + font-family: monospace, fixed; + font-size: 105%; +} + +div.fragment { + padding: 4px; + margin: 4px; + background-color: #FBFCFD; + border: 1px solid #C4CFE5; +} + +div.line { + font-family: monospace, fixed; + font-size: 13px; + line-height: 1.0; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + text-indent: -53px; + padding-left: 53px; + padding-bottom: 0px; + margin: 0px; +} + +span.lineno { + padding-right: 4px; + text-align: right; + border-right: 2px solid #0F0; + background-color: #E8E8E8; + white-space: pre; +} +span.lineno a { + background-color: #D8D8D8; +} + +span.lineno a:hover { + background-color: #C8C8C8; +} + +div.ah +{ + -moz-border-radius:.5em; + -moz-box-shadow:rgba(0, 0, 0, 0.15) 2px 2px 2px; + -webkit-border-radius:.5em; + -webkit-box-shadow:2px 2px 3px #999; + background-color:black; + background-image:0; + border:solid thin #333; + border-radius:0.5em; + box-shadow:2px 2px 3px #999; + color:#ffffff; + font-weight:bold; + margin-bottom:3px; + margin-top:3px; + padding:0.2em; +} + +div.groupHeader +{ + font-weight:bold; + margin-left:16px; + margin-top:12px; +} + +div.groupText +{ + font-style:italic; + margin-left:16px; +} + +body +{ + background-color:white; + color:black; + margin:0; +} + +div.contents +{ + margin-left:8px; + margin-right:8px; + margin-top:10px; +} + +td.indexkey +{ + background-color:#EAEFF7; + border:1px solid #C1CEE8; + font-weight:bold; + margin:2px 0; + padding:2px 10px; + vertical-align:top; + white-space:nowrap; +} + +td.indexvalue +{ + background-color:#EAEFF7; + border:1px solid #C1CEE8; + margin:2px 0; + padding:2px 10px; +} + +tr.memlist +{ + background-color:#EDF1F8; +} + +p.formulaDsp +{ + text-align:center; +} + +img.formulaInl +{ + vertical-align:middle; +} + +div.center +{ + margin-bottom:0; + margin-top:0; + padding:0; + text-align:center; +} + +div.center img +{ + border:0; +} + +address.footer +{ + padding-right:12px; + text-align:right; +} + +img.footer +{ + border:0; + vertical-align:middle; +} + +span.keyword +{ + color:#008000; +} + +span.keywordtype +{ + color:#604020; +} + +span.keywordflow +{ + color:#e08000; +} + +span.comment +{ + color:#008000; +} + +span.preprocessor +{ + color:#806020; +} + +span.stringliteral +{ + color:#002080; +} + +span.charliteral +{ + color:#008080; +} + +span.vhdldigit +{ + color:#ff00ff; +} + +span.vhdlchar +{ + color:#000000; +} + +span.vhdlkeyword +{ + color:#700070; +} + +span.vhdllogic +{ + color:#ff0000; +} + +blockquote +{ + background-color:#F6F8FC; + border-left:2px solid #97ADD9; + margin:0 24px 0 4px; + padding:0 12px 0 16px; +} + +td.tiny +{ + font-size:75%; +} + +.dirtab +{ + border:1px solid #9EB3DC; + border-collapse:collapse; + padding:4px; +} + +th.dirtab +{ + background:#EAEFF7; + font-weight:bold; +} + +hr +{ + border:none; + border-top:1px solid #4067B4; + height:0; +} + +hr.footer +{ + height:1px; +} + +table.memberdecls +{ + border-spacing:0; + padding:0; +} + +.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,.memTemplItemLeft,.memTemplItemRight,.memTemplParams +{ + background-color:#F9FAFC; + border:none; + margin:4px; + padding:1px 0 0 8px; +} + +.mdescLeft,.mdescRight +{ + color:#555; + padding:0 8px 4px; +} + +.memItemLeft,.memItemRight,.memTemplParams +{ + border-top:1px solid #C1CEE8; +} + +.memItemLeft,.memTemplItemLeft +{ + white-space:nowrap; +} + +.memItemRight +{ + width:100%; +} + +.memTemplParams +{ + color:#3D62AB; + white-space:nowrap; +} + +.memtemplate +{ + color:#3D62AB; + font-size:80%; + font-weight:normal; + margin-left:9px; +} + +.memnav +{ + background-color:#EAEFF7; + border:1px solid #9EB3DC; + margin:2px 15px 2px 2px; + padding:2px; + text-align:center; +} + +.mempage +{ + width:100%; +} + +.memitem +{ + margin-bottom:10px; + margin-right:5px; + padding:0; +} + +.memname +{ + font-weight:bold; + margin-left:6px; + white-space:nowrap; +} + +.memproto,dl.reflist dt +{ + -moz-border-radius-topleft:8px; + -moz-border-radius-topright:8px; + -moz-box-shadow:rgba(0, 0, 0, 0.15) 5px 5px 5px; + -webkit-border-top-left-radius:8px; + -webkit-border-top-right-radius:8px; + -webkit-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); + background-color:#E1E7F4; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + border-left:1px solid #A3B7DE; + border-right:1px solid #A3B7DE; + border-top:1px solid #A3B7DE; + border-top-left-radius:8px; + border-top-right-radius:8px; + box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); + color:#20335A; + font-weight:bold; + padding:6px 0; + text-shadow:0 1px 1px rgba(255, 255, 255, 0.9); +} + +.memdoc,dl.reflist dd +{ + -moz-border-radius-bottomleft:8px; + -moz-border-radius-bottomright:8px; + -moz-box-shadow:rgba(0, 0, 0, 0.15) 5px 5px 5px; + -webkit-border-bottom-left-radius:8px; + -webkit-border-bottom-right-radius:8px; + -webkit-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); + background-color:#FBFCFD; + background-image:0 color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F6F8FC), to(#EDF1F8)); + border-bottom:1px solid #A3B7DE; + border-bottom-left-radius:8px; + border-bottom-right-radius:8px; + border-left:1px solid #A3B7DE; + border-right:1px solid #A3B7DE; + border-top-width:0; + box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); + padding:2px 5px; +} + +dl.reflist dt +{ + padding:5px; +} + +dl.reflist dd +{ + margin:0 0 10px; + padding:5px; +} + +.paramkey +{ + text-align:right; +} + +.paramtype +{ + white-space:nowrap; +} + +.paramname +{ + color:#602020; + white-space:nowrap; +} + +.paramname em +{ + font-style:normal; +} + +.params,.retval,.exception,.tparams +{ + border-spacing:6px 2px; +} + +.params .paramname,.retval .paramname +{ + font-weight:bold; + vertical-align:top; +} + +.params .paramtype +{ + font-style:italic; + vertical-align:top; +} + +.params .paramdir +{ + font-family:"courier new",courier,monospace; + vertical-align:top; +} + +.ftvtree +{ + font-family:sans-serif; + margin:0; +} + +.directory +{ + font-size:9pt; + font-weight:bold; + margin:5px; +} + +.directory h3 +{ + font-size:11pt; + margin:1em 0 0; +} + +.directory > h3 +{ + margin-top:0; +} + +.directory p +{ + margin:0; + white-space:nowrap; +} + +.directory div +{ + display:none; + margin:0; +} + +.directory img +{ + vertical-align:-30%; +} + +.directory-alt +{ + font-size:100%; + font-weight:bold; +} + +.directory-alt h3 +{ + font-size:11pt; + margin:1em 0 0; +} + +.directory-alt > h3 +{ + margin-top:0; +} + +.directory-alt p +{ + margin:0; + white-space:nowrap; +} + +.directory-alt div +{ + display:none; + margin:0; +} + +.directory-alt img +{ + vertical-align:-30%; +} + +div.dynheader +{ + margin-top:8px; +} + +address +{ + color:#253B67; + font-style:normal; +} + +table.doxtable +{ + border-collapse:collapse; + margin-bottom:4px; + margin-top:4px; +} + +table.doxtable td,table.doxtable th +{ + border:1px solid #273F6D; + padding:3px 7px 2px; +} + +table.doxtable th +{ + background-color:#304D86; + color:#FFFFFF; + font-size:110%; + padding-bottom:4px; + padding-top:5px; +} + +table.fieldtable +{ + -moz-border-radius:4px; + -moz-box-shadow:rgba(0, 0, 0, 0.15) 2px 2px 2px; + -webkit-border-radius:4px; + -webkit-box-shadow:2px 2px 2px rgba(0, 0, 0, 0.15); + border:1px solid #A3B7DE; + border-radius:4px; + border-spacing:0; + box-shadow:2px 2px 2px rgba(0, 0, 0, 0.15); + margin-bottom:10px; + width:100%; +} + +.fieldtable td,.fieldtable th +{ + padding:3px 7px 2px; +} + +.fieldtable td.fieldtype,.fieldtable td.fieldname +{ + border-bottom:1px solid #A3B7DE; + border-right:1px solid #A3B7DE; + vertical-align:top; + white-space:nowrap; +} + +.fieldtable td.fielddoc +{ + border-bottom:1px solid #A3B7DE; + width:100%; +} + +.fieldtable tr:last-child td +{ + border-bottom:none; +} + +.fieldtable th +{ + -moz-border-radius-topleft:4px; + -moz-border-radius-topright:4px; + -webkit-border-top-left-radius:4px; + -webkit-border-top-right-radius:4px; + background-color:#E1E7F4; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + border-bottom:1px solid #A3B7DE; + border-top-left-radius:4px; + border-top-right-radius:4px; + color:#20335A; + font-size:90%; + padding-bottom:4px; + padding-top:5px; + text-align:left; +} + +.tabsearch +{ + background-image:url('tab_b.png'); + font-size:13px; + height:36px; + left:10px; + overflow:hidden; + top:0; + z-index:101; +} + +.navpath ul +{ + background-image:url('tab_b.png'); + background-repeat:repeat-x; + border:solid 1px #BFCCE8; + color:#839ED2; + font-size:11px; + height:30px; + line-height:30px; + margin:0; + overflow:hidden; + padding:0; +} + +.navpath li +{ + background-image:url('bc_s.png'); + background-position:right; + background-repeat:no-repeat; + color:#2F4B83; + float:left; + list-style-type:none; + padding-left:10px; + padding-right:15px; +} + +.navpath li.navelem a +{ + display:block; + height:32px; + outline:none; + text-decoration:none; +} + +.navpath li.navelem a:hover +{ + color:#6081C5; +} + +.navpath li.footer +{ + background-image:none; + background-position:right; + background-repeat:no-repeat; + color:#2F4B83; + float:right; + font-size:8pt; + list-style-type:none; + padding-left:10px; + padding-right:15px; +} + +div.summary +{ + float:right; + font-size:8pt; + padding-right:5px; + text-align:right; + width:50%; +} + +div.summary a +{ + white-space:nowrap; +} + +div.ingroups +{ + font-size:8pt; + margin-left:5px; + padding-left:5px; + text-align:left; + width:50%; +} + +div.ingroups a +{ + white-space:nowrap; +} + +div.header +{ + background-color:#F9FAFC; + background-image:url('nav_h.png'); + background-repeat:repeat-x; + border-bottom:1px solid #C1CEE8; + margin:0; +} + +div.headertitle +{ + padding:5px 5px 5px 7px; +} + +dl +{ + padding:0 0 0 10px; +} + +dl.section +{ + border-left:4px solid; + padding:0 0 0 6px; +} + +dl.note +{ + border-color:#D0C000; +} + +dl.warning,dl.attention +{ + border-color:#FF0000; +} + +dl.pre,dl.post,dl.invariant +{ + border-color:#00D000; +} + +dl.deprecated +{ + border-color:#505050; +} + +dl.todo +{ + border-color:#00C0E0; +} + +dl.test +{ + border-color:#3030E0; +} + +dl.bug +{ + border-color:#C08050; +} + +dl.section dd +{ + margin-bottom:6px; +} + +#projectlogo +{ + border-collapse:separate; + text-align:center; + vertical-align:bottom; + padding-left: 20px; +} + +#projectlogo img +{ + border:0 none; +} + +#projectname +{ + font:280% Arial, sans-serif; + margin:0; + padding-left:20px; +} + +#projectbrief +{ + font:120% Tahoma, Arial, sans-serif; + margin:0; + padding:0; +} + +#projectnumber:before +{ + content:"Version "; +} + +#projectnumber +{ + font:50% Tahoma, Arial, sans-serif; + margin:0; + padding:0; +} + +#titlearea +{ + margin:0; + padding:0; + width:100%; + background-color:#E1E7F4; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + color:#20335A; + font-weight:bold; + text-shadow:0 1px 1px rgba(255, 255, 255, 0.9); +} + +.image +{ + text-align:center; +} + +.dotgraph +{ + text-align:center; +} + +.mscgraph +{ + text-align:center; +} + +.caption +{ + font-weight:bold; +} + +div.zoom +{ + border:1px solid #8AA3D4; +} + +dl.citelist +{ + margin-bottom:50px; +} + +dl.citelist dt +{ + color:#2C477C; + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; +} + +dl.citelist dd +{ + margin:2px 0; + padding:5px 0; +} + +div.toc +{ + background-color:#F4F6FB; + border:1px solid #D6DFF0; + border-radius:7px 7px 7px 7px; + float:right; + height:auto; + margin:0 20px 10px 10px; + padding:14px 25px; + width:200px; +} + +div.toc li +{ + background:url("bdwn.png") no-repeat scroll 0 5px transparent; + font:10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; + margin-top:5px; + padding-left:10px; + padding-top:2px; +} + +div.toc h3 +{ + border-bottom:0 none; + color:#3D62AB; + font:bold 12px/1.2 Arial,FreeSans,sans-serif; + margin:0; +} + +div.toc ul +{ + border:medium none; + list-style:none outside none; + padding:0; +} + +div.toc li.level1 +{ + margin-left:0; +} + +div.toc li.level2 +{ + margin-left:15px; +} + +div.toc li.level3 +{ + margin-left:30px; +} + +div.toc li.level4 +{ + margin-left:45px; +} diff --git a/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h b/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h index 89516dca0..bafedcca3 100644 --- a/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h +++ b/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h @@ -1,161 +1,161 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Bitwizard Big-Multio. - * \copydetails Group_LEDs_BIGMULTIO - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_BIGMULTIO BIGMULTIO - * \brief Board specific LED driver header for the Bitwizard Big-Multio. - * - * Board specific LED driver header for the Bitwizard Big-Multio (http://www.bitwizard.nl/wiki/index.php/Usbbigmultio). - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1UnknownLED0HighPORTF.6
LEDS_LED2UnknownLED1HighPORTF.7
LEDS_LED3UnknownLED2HighPORTE.2
- * - * @{ - */ - -#ifndef __LEDS_BIGMULTIO_H__ -#define __LEDS_BIGMULTIO_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_PORTF_LEDS (LEDS_LED1 | LEDS_LED2) - #define LEDS_PORTE_LEDS LEDS_LED3 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 6) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 7) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED3 (1 << 2) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRF |= LEDS_PORTF_LEDS; - DDRE |= LEDS_PORTE_LEDS; - - PORTF &= ~LEDS_PORTF_LEDS; - PORTE &= ~LEDS_PORTE_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRF |= LEDS_PORTF_LEDS; - DDRE |= LEDS_PORTE_LEDS; - - PORTF &= ~LEDS_PORTF_LEDS; - PORTE &= ~LEDS_PORTE_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTF |= (LEDMask & LEDS_PORTF_LEDS); - PORTE |= (LEDMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTF &= ~(LEDMask & LEDS_PORTF_LEDS); - PORTE &= ~(LEDMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTF = (PORTF & ~LEDS_PORTF_LEDS) | (LEDMask & LEDS_PORTF_LEDS); - PORTE = (PORTE & ~LEDS_PORTE_LEDS) | (LEDMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTF = (PORTF & ~(LEDMask & LEDS_PORTF_LEDS)) | (ActiveMask & LEDS_PORTF_LEDS); - PORTE = (PORTE & ~(LEDMask & LEDS_PORTE_LEDS)) | (ActiveMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINF = (LEDMask & LEDS_PORTF_LEDS); - PINE = (LEDMask & LEDS_PORTE_LEDS); - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return ((PORTF & LEDS_PORTF_LEDS) | (PORTE & LEDS_PORTE_LEDS)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Board specific LED driver header for the Bitwizard Big-Multio. + * \copydetails Group_LEDs_BIGMULTIO + * + * \note This file should not be included directly. It is automatically included as needed by the LEDs driver + * dispatch header located in LUFA/Drivers/Board/LEDs.h. + */ + +/** \ingroup Group_LEDs + * \defgroup Group_LEDs_BIGMULTIO BIGMULTIO + * \brief Board specific LED driver header for the Bitwizard Big-Multio. + * + * Board specific LED driver header for the Bitwizard Big-Multio (http://www.bitwizard.nl/wiki/index.php/Usbbigmultio). + * + * + * + * + * + * + *
NameColorInfoActive LevelPort Pin
LEDS_LED1UnknownLED0HighPORTF.6
LEDS_LED2UnknownLED1HighPORTF.7
LEDS_LED3UnknownLED2HighPORTE.2
+ * + * @{ + */ + +#ifndef __LEDS_BIGMULTIO_H__ +#define __LEDS_BIGMULTIO_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_LEDS_H) + #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. + #endif + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Macros: */ + #define LEDS_PORTF_LEDS (LEDS_LED1 | LEDS_LED2) + #define LEDS_PORTE_LEDS LEDS_LED3 + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** LED mask for the first LED on the board. */ + #define LEDS_LED1 (1 << 6) + + /** LED mask for the second LED on the board. */ + #define LEDS_LED2 (1 << 7) + + /** LED mask for the second LED on the board. */ + #define LEDS_LED3 (1 << 2) + + /** LED mask for all the LEDs on the board. */ + #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) + + /** LED mask for none of the board LEDs. */ + #define LEDS_NO_LEDS 0 + + /* Inline Functions: */ + #if !defined(__DOXYGEN__) + static inline void LEDs_Init(void) + { + DDRF |= LEDS_PORTF_LEDS; + DDRE |= LEDS_PORTE_LEDS; + + PORTF &= ~LEDS_PORTF_LEDS; + PORTE &= ~LEDS_PORTE_LEDS; + } + + static inline void LEDs_Disable(void) + { + DDRF |= LEDS_PORTF_LEDS; + DDRE |= LEDS_PORTE_LEDS; + + PORTF &= ~LEDS_PORTF_LEDS; + PORTE &= ~LEDS_PORTE_LEDS; + } + + static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) + { + PORTF |= (LEDMask & LEDS_PORTF_LEDS); + PORTE |= (LEDMask & LEDS_PORTE_LEDS); + } + + static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) + { + PORTF &= ~(LEDMask & LEDS_PORTF_LEDS); + PORTE &= ~(LEDMask & LEDS_PORTE_LEDS); + } + + static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) + { + PORTF = (PORTF & ~LEDS_PORTF_LEDS) | (LEDMask & LEDS_PORTF_LEDS); + PORTE = (PORTE & ~LEDS_PORTE_LEDS) | (LEDMask & LEDS_PORTE_LEDS); + } + + static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, + const uint8_t ActiveMask) + { + PORTF = (PORTF & ~(LEDMask & LEDS_PORTF_LEDS)) | (ActiveMask & LEDS_PORTF_LEDS); + PORTE = (PORTE & ~(LEDMask & LEDS_PORTE_LEDS)) | (ActiveMask & LEDS_PORTE_LEDS); + } + + static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) + { + PINF = (LEDMask & LEDS_PORTF_LEDS); + PINE = (LEDMask & LEDS_PORTE_LEDS); + } + + static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t LEDs_GetLEDs(void) + { + return ((PORTF & LEDS_PORTF_LEDS) | (PORTE & LEDS_PORTE_LEDS)); + } + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h b/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h index 731d1b05b..60d81b782 100644 --- a/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h +++ b/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h @@ -1,208 +1,208 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Micropendous series boards. - * \copydetails Group_Buttons_MICROPENDOUS_32U2 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_A MICROPENDOUS_A - * \brief Board specific Button driver header for the Micropendous A (https://code.google.com/p/micropendous/wiki/MicropendousA). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_1 MICROPENDOUS_1 - * \brief Board specific Button driver header for the Micropendous 1 (https://code.google.com/p/micropendous/wiki/Micropendous1). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_2 MICROPENDOUS_2 - * \brief Board specific Button driver header for the Micropendous 2 (https://code.google.com/p/micropendous/wiki/Micropendous2). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_3 MICROPENDOUS_3 - * \brief Board specific Button driver header for the Micropendous 3 (https://code.google.com/p/micropendous/wiki/Micropendous3). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_4 MICROPENDOUS_4 - * \brief Board specific Button driver header for the Micropendous 4 (https://code.google.com/p/micropendous/wiki/Micropendous4). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_DIP MICROPENDOUS_DIP - * \brief Board specific Button driver header for the Micropendous DIP (https://code.google.com/p/micropendous/wiki/MicropendousDIP). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_REV1 MICROPENDOUS_REV1 - * \brief Board specific Button driver header for the Micropendous Arduino-like Revision 1 (https://code.google.com/p/micropendous/wiki/Micropendous). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_REV2 MICROPENDOUS_REV2 - * \brief Board specific Button driver header for the Micropendous Arduino-like Revision 2 (https://code.google.com/p/micropendous/wiki/Micropendous). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_32U2 MICROPENDOUS_32U2 - * \brief Board specific Buttons driver header for the Micropendous 32U2. - * - * \note There are multiple supported Micropendous boards, compile with BOARD = MICROPENDOUS_{VERSION}. - * - * Board specific Buttons driver header for the Micropendous 32U2 (https://code.google.com/p/micropendous/wiki/Micropendous_32U2). - * - * BOARD_MICROPENDOUS_1 and BOARD_MICROPENDOUS_32U2: - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * Other Revisions: - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTE.2
- * - * @{ - */ - -#ifndef __BUTTONS_MICROPENDOUS_H__ -#define __BUTTONS_MICROPENDOUS_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - #if (BOARD == BOARD_MICROPENDOUS_32U2) - #define _BOARD_BUTTON1_MASK (1 << 7) - #define _BOARD_BUTTON_PORTLETTER D - #elif (BOARD == BOARD_MICROPENDOUS_A) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_1) - #define _BOARD_BUTTON1_MASK (1 << 7) - #define _BOARD_BUTTON_PORTLETTER D - #elif (BOARD == BOARD_MICROPENDOUS_2) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_3) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_4) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_DIP) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_REV1) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_REV2) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #endif - - #define _BOARD_BUTTON_CONCAT2(Reg, Letter) Reg ## Letter - #define _BOARD_BUTTON_CONCAT(Reg, Letter) _BOARD_BUTTON_CONCAT2(Reg, Letter) - - #define _BOARD_BUTTON_PORT _BOARD_BUTTON_CONCAT(PORT, _BOARD_BUTTON_PORTLETTER) - #define _BOARD_BUTTON_PIN _BOARD_BUTTON_CONCAT(PIN, _BOARD_BUTTON_PORTLETTER) - #define _BOARD_BUTTON_DDR _BOARD_BUTTON_CONCAT(DDR, _BOARD_BUTTON_PORTLETTER) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 _BOARD_BUTTON1_MASK - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - _BOARD_BUTTON_DDR &= ~BUTTONS_BUTTON1; - _BOARD_BUTTON_PORT |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - _BOARD_BUTTON_DDR &= ~BUTTONS_BUTTON1; - _BOARD_BUTTON_PORT &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((_BOARD_BUTTON_PIN & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Board specific Buttons driver header for the Micropendous series boards. + * \copydetails Group_Buttons_MICROPENDOUS_32U2 + * + * \note This file should not be included directly. It is automatically included as needed by the Buttons driver + * dispatch header located in LUFA/Drivers/Board/Buttons.h. + */ + +/** \ingroup Group_Buttons + * \defgroup Group_Buttons_MICROPENDOUS_A MICROPENDOUS_A + * \brief Board specific Button driver header for the Micropendous A (https://code.google.com/p/micropendous/wiki/MicropendousA). + * + * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. + */ + +/** \ingroup Group_Buttons + * \defgroup Group_Buttons_MICROPENDOUS_1 MICROPENDOUS_1 + * \brief Board specific Button driver header for the Micropendous 1 (https://code.google.com/p/micropendous/wiki/Micropendous1). + * + * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. + */ + +/** \ingroup Group_Buttons + * \defgroup Group_Buttons_MICROPENDOUS_2 MICROPENDOUS_2 + * \brief Board specific Button driver header for the Micropendous 2 (https://code.google.com/p/micropendous/wiki/Micropendous2). + * + * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. + */ + +/** \ingroup Group_Buttons + * \defgroup Group_Buttons_MICROPENDOUS_3 MICROPENDOUS_3 + * \brief Board specific Button driver header for the Micropendous 3 (https://code.google.com/p/micropendous/wiki/Micropendous3). + * + * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. + */ + +/** \ingroup Group_Buttons + * \defgroup Group_Buttons_MICROPENDOUS_4 MICROPENDOUS_4 + * \brief Board specific Button driver header for the Micropendous 4 (https://code.google.com/p/micropendous/wiki/Micropendous4). + * + * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. + */ + +/** \ingroup Group_Buttons + * \defgroup Group_Buttons_MICROPENDOUS_DIP MICROPENDOUS_DIP + * \brief Board specific Button driver header for the Micropendous DIP (https://code.google.com/p/micropendous/wiki/MicropendousDIP). + * + * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. + */ + +/** \ingroup Group_Buttons + * \defgroup Group_Buttons_MICROPENDOUS_REV1 MICROPENDOUS_REV1 + * \brief Board specific Button driver header for the Micropendous Arduino-like Revision 1 (https://code.google.com/p/micropendous/wiki/Micropendous). + * + * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. + */ + +/** \ingroup Group_Buttons + * \defgroup Group_Buttons_MICROPENDOUS_REV2 MICROPENDOUS_REV2 + * \brief Board specific Button driver header for the Micropendous Arduino-like Revision 2 (https://code.google.com/p/micropendous/wiki/Micropendous). + * + * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. + */ + +/** \ingroup Group_Buttons + * \defgroup Group_Buttons_MICROPENDOUS_32U2 MICROPENDOUS_32U2 + * \brief Board specific Buttons driver header for the Micropendous 32U2. + * + * \note There are multiple supported Micropendous boards, compile with BOARD = MICROPENDOUS_{VERSION}. + * + * Board specific Buttons driver header for the Micropendous 32U2 (https://code.google.com/p/micropendous/wiki/Micropendous_32U2). + * + * BOARD_MICROPENDOUS_1 and BOARD_MICROPENDOUS_32U2: + * + * + * + *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
+ * + * Other Revisions: + * + * + * + *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTE.2
+ * + * @{ + */ + +#ifndef __BUTTONS_MICROPENDOUS_H__ +#define __BUTTONS_MICROPENDOUS_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_BUTTONS_H) + #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. + #endif + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + #if (BOARD == BOARD_MICROPENDOUS_32U2) + #define _BOARD_BUTTON1_MASK (1 << 7) + #define _BOARD_BUTTON_PORTLETTER D + #elif (BOARD == BOARD_MICROPENDOUS_A) + #define _BOARD_BUTTON1_MASK (1 << 2) + #define _BOARD_BUTTON_PORTLETTER E + #elif (BOARD == BOARD_MICROPENDOUS_1) + #define _BOARD_BUTTON1_MASK (1 << 7) + #define _BOARD_BUTTON_PORTLETTER D + #elif (BOARD == BOARD_MICROPENDOUS_2) + #define _BOARD_BUTTON1_MASK (1 << 2) + #define _BOARD_BUTTON_PORTLETTER E + #elif (BOARD == BOARD_MICROPENDOUS_3) + #define _BOARD_BUTTON1_MASK (1 << 2) + #define _BOARD_BUTTON_PORTLETTER E + #elif (BOARD == BOARD_MICROPENDOUS_4) + #define _BOARD_BUTTON1_MASK (1 << 2) + #define _BOARD_BUTTON_PORTLETTER E + #elif (BOARD == BOARD_MICROPENDOUS_DIP) + #define _BOARD_BUTTON1_MASK (1 << 2) + #define _BOARD_BUTTON_PORTLETTER E + #elif (BOARD == BOARD_MICROPENDOUS_REV1) + #define _BOARD_BUTTON1_MASK (1 << 2) + #define _BOARD_BUTTON_PORTLETTER E + #elif (BOARD == BOARD_MICROPENDOUS_REV2) + #define _BOARD_BUTTON1_MASK (1 << 2) + #define _BOARD_BUTTON_PORTLETTER E + #endif + + #define _BOARD_BUTTON_CONCAT2(Reg, Letter) Reg ## Letter + #define _BOARD_BUTTON_CONCAT(Reg, Letter) _BOARD_BUTTON_CONCAT2(Reg, Letter) + + #define _BOARD_BUTTON_PORT _BOARD_BUTTON_CONCAT(PORT, _BOARD_BUTTON_PORTLETTER) + #define _BOARD_BUTTON_PIN _BOARD_BUTTON_CONCAT(PIN, _BOARD_BUTTON_PORTLETTER) + #define _BOARD_BUTTON_DDR _BOARD_BUTTON_CONCAT(DDR, _BOARD_BUTTON_PORTLETTER) + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** Button mask for the first button on the board. */ + #define BUTTONS_BUTTON1 _BOARD_BUTTON1_MASK + + /* Inline Functions: */ + #if !defined(__DOXYGEN__) + static inline void Buttons_Init(void) + { + _BOARD_BUTTON_DDR &= ~BUTTONS_BUTTON1; + _BOARD_BUTTON_PORT |= BUTTONS_BUTTON1; + } + + static inline void Buttons_Disable(void) + { + _BOARD_BUTTON_DDR &= ~BUTTONS_BUTTON1; + _BOARD_BUTTON_PORT &= ~BUTTONS_BUTTON1; + } + + static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t Buttons_GetStatus(void) + { + return ((_BOARD_BUTTON_PIN & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); + } + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h b/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h index 60a49935d..2d5bad42e 100644 --- a/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h +++ b/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h @@ -145,13 +145,13 @@ static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) { - _BOARD_LED_PORT = ((PORTF & ~LEDS_ALL_LEDS) | LEDMask); + _BOARD_LED_PORT = ((_BOARD_LED_PORT & ~LEDS_ALL_LEDS) | LEDMask); } static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) { - _BOARD_LED_PORT = ((PORTF & ~LEDMask) | ActiveMask); + _BOARD_LED_PORT = ((_BOARD_LED_PORT & ~LEDMask) | ActiveMask); } static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) diff --git a/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h b/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h index 64f68a53d..14809df28 100644 --- a/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h +++ b/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h @@ -1,161 +1,161 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Bitwizard Multio. - * \copydetails Group_LEDs_MULTIO - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_MULTIO MULTIO - * \brief Board specific LED driver header for the Bitwizard Multio. - * - * Board specific LED driver header for the Bitwizard Multio (http://www.bitwizard.nl/wiki/index.php/USB-multio). - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.0
LEDS_LED2GreenGeneral IndicatorHighPORTC.2
LEDS_LED3GreenGeneral IndicatorHighPORTD.7
- * - * @{ - */ - -#ifndef __LEDS_MULTIO_H__ -#define __LEDS_MULTIO_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_PORTD_LEDS (LEDS_LED1 | LEDS_LED3) - #define LEDS_PORTC_LEDS LEDS_LED2 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 0) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 2) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED3 (1 << 7) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_PORTD_LEDS; - DDRC |= LEDS_PORTC_LEDS; - - PORTD &= ~LEDS_PORTD_LEDS; - PORTC &= ~LEDS_PORTC_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD |= LEDS_PORTD_LEDS; - DDRC |= LEDS_PORTC_LEDS; - - PORTD &= ~LEDS_PORTD_LEDS; - PORTC &= ~LEDS_PORTC_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD |= (LEDMask & LEDS_PORTD_LEDS); - PORTC |= (LEDMask & LEDS_PORTC_LEDS); - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD &= ~(LEDMask & LEDS_PORTD_LEDS); - PORTC &= ~(LEDMask & LEDS_PORTC_LEDS); - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = (PORTD & ~LEDS_PORTD_LEDS) | (LEDMask & LEDS_PORTD_LEDS); - PORTC = (PORTC & ~LEDS_PORTC_LEDS) | (LEDMask & LEDS_PORTC_LEDS); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = (PORTD & ~(LEDMask & LEDS_PORTD_LEDS)) | (ActiveMask & LEDS_PORTD_LEDS); - PORTC = (PORTC & ~(LEDMask & LEDS_PORTC_LEDS)) | (ActiveMask & LEDS_PORTC_LEDS); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = (LEDMask & LEDS_PORTD_LEDS); - PINC = (LEDMask & LEDS_PORTC_LEDS); - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return ((PORTD & LEDS_PORTD_LEDS) | (PORTC & LEDS_PORTC_LEDS)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Board specific LED driver header for the Bitwizard Multio. + * \copydetails Group_LEDs_MULTIO + * + * \note This file should not be included directly. It is automatically included as needed by the LEDs driver + * dispatch header located in LUFA/Drivers/Board/LEDs.h. + */ + +/** \ingroup Group_LEDs + * \defgroup Group_LEDs_MULTIO MULTIO + * \brief Board specific LED driver header for the Bitwizard Multio. + * + * Board specific LED driver header for the Bitwizard Multio (http://www.bitwizard.nl/wiki/index.php/USB-multio). + * + * + * + * + * + * + *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.0
LEDS_LED2GreenGeneral IndicatorHighPORTC.2
LEDS_LED3GreenGeneral IndicatorHighPORTD.7
+ * + * @{ + */ + +#ifndef __LEDS_MULTIO_H__ +#define __LEDS_MULTIO_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_LEDS_H) + #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. + #endif + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Macros: */ + #define LEDS_PORTD_LEDS (LEDS_LED1 | LEDS_LED3) + #define LEDS_PORTC_LEDS LEDS_LED2 + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** LED mask for the first LED on the board. */ + #define LEDS_LED1 (1 << 0) + + /** LED mask for the second LED on the board. */ + #define LEDS_LED2 (1 << 2) + + /** LED mask for the second LED on the board. */ + #define LEDS_LED3 (1 << 7) + + /** LED mask for all the LEDs on the board. */ + #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) + + /** LED mask for none of the board LEDs. */ + #define LEDS_NO_LEDS 0 + + /* Inline Functions: */ + #if !defined(__DOXYGEN__) + static inline void LEDs_Init(void) + { + DDRD |= LEDS_PORTD_LEDS; + DDRC |= LEDS_PORTC_LEDS; + + PORTD &= ~LEDS_PORTD_LEDS; + PORTC &= ~LEDS_PORTC_LEDS; + } + + static inline void LEDs_Disable(void) + { + DDRD |= LEDS_PORTD_LEDS; + DDRC |= LEDS_PORTC_LEDS; + + PORTD &= ~LEDS_PORTD_LEDS; + PORTC &= ~LEDS_PORTC_LEDS; + } + + static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) + { + PORTD |= (LEDMask & LEDS_PORTD_LEDS); + PORTC |= (LEDMask & LEDS_PORTC_LEDS); + } + + static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) + { + PORTD &= ~(LEDMask & LEDS_PORTD_LEDS); + PORTC &= ~(LEDMask & LEDS_PORTC_LEDS); + } + + static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) + { + PORTD = (PORTD & ~LEDS_PORTD_LEDS) | (LEDMask & LEDS_PORTD_LEDS); + PORTC = (PORTC & ~LEDS_PORTC_LEDS) | (LEDMask & LEDS_PORTC_LEDS); + } + + static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, + const uint8_t ActiveMask) + { + PORTD = (PORTD & ~(LEDMask & LEDS_PORTD_LEDS)) | (ActiveMask & LEDS_PORTD_LEDS); + PORTC = (PORTC & ~(LEDMask & LEDS_PORTC_LEDS)) | (ActiveMask & LEDS_PORTC_LEDS); + } + + static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) + { + PIND = (LEDMask & LEDS_PORTD_LEDS); + PINC = (LEDMask & LEDS_PORTC_LEDS); + } + + static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t LEDs_GetLEDs(void) + { + return ((PORTD & LEDS_PORTD_LEDS) | (PORTC & LEDS_PORTC_LEDS)); + } + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h b/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h index 73d05a5b3..cb0eecdf6 100644 --- a/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h +++ b/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h @@ -1,113 +1,113 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Paranoid Studio USB2AX. - * \copydetails Group_Buttons_USB2AX - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_USB2AX_V3 USB2AX_V3 - * \brief Board specific Button driver header for the Paranoid Studio USB2AX revision 3. - * - * See \ref Group_Buttons_USB2AX for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_USB2AX USB2AX - * \brief Board specific Buttons driver header for the Paranoid Studio USB2AX. - * - * \note For version 3 USB2AX boards, compile with BOARD = USB2AX_V3. - * - * Board specific Buttons driver header for the Paranoid Studio USB2AX (http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_USB2AX_H__ -#define __BUTTONS_USB2AX_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Board specific Buttons driver header for the Paranoid Studio USB2AX. + * \copydetails Group_Buttons_USB2AX + * + * \note This file should not be included directly. It is automatically included as needed by the Buttons driver + * dispatch header located in LUFA/Drivers/Board/Buttons.h. + */ + +/** \ingroup Group_Buttons + * \defgroup Group_Buttons_USB2AX_V3 USB2AX_V3 + * \brief Board specific Button driver header for the Paranoid Studio USB2AX revision 3. + * + * See \ref Group_Buttons_USB2AX for more details. + */ + +/** \ingroup Group_Buttons + * \defgroup Group_Buttons_USB2AX USB2AX + * \brief Board specific Buttons driver header for the Paranoid Studio USB2AX. + * + * \note For version 3 USB2AX boards, compile with BOARD = USB2AX_V3. + * + * Board specific Buttons driver header for the Paranoid Studio USB2AX (http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX). + * + * + * + * + *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
+ * + * @{ + */ + +#ifndef __BUTTONS_USB2AX_H__ +#define __BUTTONS_USB2AX_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_BUTTONS_H) + #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** Button mask for the first button on the board. */ + #define BUTTONS_BUTTON1 (1 << 7) + + /* Inline Functions: */ + #if !defined(__DOXYGEN__) + static inline void Buttons_Init(void) + { + DDRD &= ~BUTTONS_BUTTON1; + PORTD |= BUTTONS_BUTTON1; + } + + static inline void Buttons_Disable(void) + { + DDRD &= ~BUTTONS_BUTTON1; + PORTD &= ~BUTTONS_BUTTON1; + } + + static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t Buttons_GetStatus(void) + { + return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); + } + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h b/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h index 12fa73cd1..364c88de2 100644 --- a/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h +++ b/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h @@ -1,196 +1,196 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Paranoid Studio USB2AX. - * \copydetails Group_LEDs_USB2AX - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_USB2AX_V3 USB2AX_V3 - * \brief Board specific LED driver header for the Paranoid Studio USB2AX revision 3. - * - * See \ref Group_LEDs_USB2AX for more details. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_USB2AX USB2AX - * \brief Board specific LED driver header for the Paranoid Studio USB2AX. - * - * \note For version 3 USB2AX boards, compile with BOARD = USB2AX_V3. - * - * Board specific LED driver header for the Paranoid Studio USB2AX (http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX). - * - * USB2AX: - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTC.6
- * - * USB2AX_V3: - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.1
- * - * @{ - */ - -#ifndef __LEDS_USB2AX_H__ -#define __LEDS_USB2AX_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #if (BOARD == BOARD_USB2AX) - #define USB2AX_LEDS_LED1 (1 << 6) - #else - #define USB2AX_LEDS_LED1 (1 << 1) - #endif - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 USB2AX_LEDS_LED1 - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - #if (BOARD == BOARD_USB2AX) - DDRC |= LEDS_ALL_LEDS; - PORTC &= ~LEDS_ALL_LEDS; - #else - DDRD |= LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - #endif - } - - static inline void LEDs_Disable(void) - { - #if (BOARD == BOARD_USB2AX) - DDRC &= ~LEDS_ALL_LEDS; - PORTC &= ~LEDS_ALL_LEDS; - #else - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - #endif - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - #if (BOARD == BOARD_USB2AX) - PORTC |= LEDMask; - #else - PORTD |= LEDMask; - #endif - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - #if (BOARD == BOARD_USB2AX) - PORTC &= ~LEDMask; - #else - PORTD &= ~LEDMask; - #endif - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - #if (BOARD == BOARD_USB2AX) - PORTC = ((PORTC & ~LEDS_ALL_LEDS) | LEDMask); - #else - PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); - #endif - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - #if (BOARD == BOARD_USB2AX) - PORTC = ((PORTC & ~LEDMask) | ActiveMask); - #else - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - #endif - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - #if (BOARD == BOARD_USB2AX) - PINC = LEDMask; - #else - PIND = LEDMask; - #endif - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - #if (BOARD == BOARD_USB2AX) - return (PORTC & LEDS_ALL_LEDS); - #else - return (PORTD & LEDS_ALL_LEDS); - #endif - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Board specific LED driver header for the Paranoid Studio USB2AX. + * \copydetails Group_LEDs_USB2AX + * + * \note This file should not be included directly. It is automatically included as needed by the LEDs driver + * dispatch header located in LUFA/Drivers/Board/LEDs.h. + */ + +/** \ingroup Group_LEDs + * \defgroup Group_LEDs_USB2AX_V3 USB2AX_V3 + * \brief Board specific LED driver header for the Paranoid Studio USB2AX revision 3. + * + * See \ref Group_LEDs_USB2AX for more details. + */ + +/** \ingroup Group_LEDs + * \defgroup Group_LEDs_USB2AX USB2AX + * \brief Board specific LED driver header for the Paranoid Studio USB2AX. + * + * \note For version 3 USB2AX boards, compile with BOARD = USB2AX_V3. + * + * Board specific LED driver header for the Paranoid Studio USB2AX (http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX). + * + * USB2AX: + * + * + * + *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTC.6
+ * + * USB2AX_V3: + * + * + * + *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.1
+ * + * @{ + */ + +#ifndef __LEDS_USB2AX_H__ +#define __LEDS_USB2AX_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_LEDS_H) + #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. + #endif + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Macros: */ + #if (BOARD == BOARD_USB2AX) + #define USB2AX_LEDS_LED1 (1 << 6) + #else + #define USB2AX_LEDS_LED1 (1 << 1) + #endif + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** LED mask for the first LED on the board. */ + #define LEDS_LED1 USB2AX_LEDS_LED1 + + /** LED mask for all the LEDs on the board. */ + #define LEDS_ALL_LEDS LEDS_LED1 + + /** LED mask for none of the board LEDs. */ + #define LEDS_NO_LEDS 0 + + /* Inline Functions: */ + #if !defined(__DOXYGEN__) + static inline void LEDs_Init(void) + { + #if (BOARD == BOARD_USB2AX) + DDRC |= LEDS_ALL_LEDS; + PORTC &= ~LEDS_ALL_LEDS; + #else + DDRD |= LEDS_ALL_LEDS; + PORTD &= ~LEDS_ALL_LEDS; + #endif + } + + static inline void LEDs_Disable(void) + { + #if (BOARD == BOARD_USB2AX) + DDRC &= ~LEDS_ALL_LEDS; + PORTC &= ~LEDS_ALL_LEDS; + #else + DDRD &= ~LEDS_ALL_LEDS; + PORTD &= ~LEDS_ALL_LEDS; + #endif + } + + static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) + { + #if (BOARD == BOARD_USB2AX) + PORTC |= LEDMask; + #else + PORTD |= LEDMask; + #endif + } + + static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) + { + #if (BOARD == BOARD_USB2AX) + PORTC &= ~LEDMask; + #else + PORTD &= ~LEDMask; + #endif + } + + static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) + { + #if (BOARD == BOARD_USB2AX) + PORTC = ((PORTC & ~LEDS_ALL_LEDS) | LEDMask); + #else + PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); + #endif + } + + static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, + const uint8_t ActiveMask) + { + #if (BOARD == BOARD_USB2AX) + PORTC = ((PORTC & ~LEDMask) | ActiveMask); + #else + PORTD = ((PORTD & ~LEDMask) | ActiveMask); + #endif + } + + static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) + { + #if (BOARD == BOARD_USB2AX) + PINC = LEDMask; + #else + PIND = LEDMask; + #endif + } + + static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t LEDs_GetLEDs(void) + { + #if (BOARD == BOARD_USB2AX) + return (PORTC & LEDS_ALL_LEDS); + #else + return (PORTD & LEDS_ALL_LEDS); + #endif + } + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/LUFA/Drivers/Board/Buttons.h b/LUFA/Drivers/Board/Buttons.h index 1b70a6bd5..73ccb4194 100644 --- a/LUFA/Drivers/Board/Buttons.h +++ b/LUFA/Drivers/Board/Buttons.h @@ -160,7 +160,7 @@ */ static inline void Buttons_Init(void); - /** Disables the buttons driver, releasing the I/O pins back to their default high-impedence input mode. */ + /** Disables the buttons driver, releasing the I/O pins back to their default high-impedance input mode. */ static inline void Buttons_Disable(void); /** Returns a mask indicating which board buttons are currently pressed. diff --git a/LUFA/Drivers/Board/Joystick.h b/LUFA/Drivers/Board/Joystick.h index 63d28e837..2f90a9ca3 100644 --- a/LUFA/Drivers/Board/Joystick.h +++ b/LUFA/Drivers/Board/Joystick.h @@ -126,7 +126,7 @@ */ static inline void Joystick_Init(void); - /** Disables the joystick driver, releasing the I/O pins back to their default high-impedence input mode. */ + /** Disables the joystick driver, releasing the I/O pins back to their default high-impedance input mode. */ static inline void Joystick_Disable(void); /** Returns the current status of the joystick, as a mask indicating the direction the joystick is diff --git a/LUFA/Drivers/Board/LEDs.h b/LUFA/Drivers/Board/LEDs.h index 97cb81a50..21f89aa58 100644 --- a/LUFA/Drivers/Board/LEDs.h +++ b/LUFA/Drivers/Board/LEDs.h @@ -63,7 +63,7 @@ * * \note To make code as compatible as possible, it is assumed that all boards carry a minimum of four LEDs. If * a board contains less than four LEDs, the remaining LED masks are defined to 0 so as to have no effect. - * If other behaviour is desired, either alias the remaining LED masks to existing LED masks via the -D + * If other behavior is desired, either alias the remaining LED masks to existing LED masks via the -D * switch in the project makefile, or alias them to nothing in the makefile to cause compilation errors when * a non-existing LED is referenced in application code. Note that this means that it is possible to make * compatible code for a board with no LEDs by making a board LED driver (see \ref Page_WritingBoardDrivers) @@ -221,7 +221,7 @@ */ static inline void LEDs_Init(void); - /** Disables the board LED driver, releasing the I/O pins back to their default high-impedence input mode. */ + /** Disables the board LED driver, releasing the I/O pins back to their default high-impedance input mode. */ static inline void LEDs_Disable(void); /** Turns on the LEDs specified in the given LED mask. diff --git a/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h b/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h index 897147902..f1a9b9926 100644 --- a/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h +++ b/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h @@ -98,7 +98,7 @@ static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint32_t Buttons_GetStatus(void) { - return (~(AVR32_GPIO.port[JOY_MOVE_PORT].pvr & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2))); + return (~(AVR32_GPIO.port[BUTTONS_PORT].pvr & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2))); } #endif diff --git a/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h b/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h index c04d2ba8c..d85fddc28 100644 --- a/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h +++ b/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h @@ -248,7 +248,7 @@ #define ADC_INT_TEMP_SENS ((1 << 8) | (0x07 << MUX0)) #endif - /** MUX mask define for the internal 1.1V bandgap channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). */ + /** MUX mask define for the internal 1.1V band-gap channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). */ #define ADC_1100MV_BANDGAP (0x1E << MUX0) /** Retrieves the ADC MUX mask for the given ADC channel number. diff --git a/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h b/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h index 3cede6026..7b1fbfcc2 100644 --- a/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h +++ b/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h @@ -1,76 +1,76 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the library USB Android Open Accessory Class driver. - * - * Master include file for the library USB Android Open Accessory Class driver, for both host and device modes, where available. - * - * This file should be included in all user projects making use of this optional class driver, instead of - * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. - */ - -/** \ingroup Group_USBClassDrivers - * \defgroup Group_USBClassAOA Android Open Accessory Class Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Android Open Accessory Class Driver module. This module contains an internal implementation of the USB Android Open Accessory - * Class, for Host USB mode. User applications can use this class driver instead of implementing the Android Open Accessory Class - * manually via the low-level LUFA APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Host using the USB Android Open Accessory Class. - * - * @{ - */ - -#ifndef _AOA_CLASS_H_ -#define _AOA_CLASS_H_ - - /* Macros: */ - #define __INCLUDE_FROM_USB_DRIVER - #define __INCLUDE_FROM_AOA_DRIVER - - /* Includes: */ - #include "../Core/USBMode.h" - - #if defined(USB_CAN_BE_HOST) - #include "Host/AndroidAccessoryClassHost.h" - #endif - -#endif - -/** @} */ - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Master include file for the library USB Android Open Accessory Class driver. + * + * Master include file for the library USB Android Open Accessory Class driver, for both host and device modes, where available. + * + * This file should be included in all user projects making use of this optional class driver, instead of + * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. + */ + +/** \ingroup Group_USBClassDrivers + * \defgroup Group_USBClassAOA Android Open Accessory Class Driver + * + * \section Sec_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_ModDescription Module Description + * Android Open Accessory Class Driver module. This module contains an internal implementation of the USB Android Open Accessory + * Class, for Host USB mode. User applications can use this class driver instead of implementing the Android Open Accessory Class + * manually via the low-level LUFA APIs. + * + * This module is designed to simplify the user code by exposing only the required interface needed to interface with + * Host using the USB Android Open Accessory Class. + * + * @{ + */ + +#ifndef _AOA_CLASS_H_ +#define _AOA_CLASS_H_ + + /* Macros: */ + #define __INCLUDE_FROM_USB_DRIVER + #define __INCLUDE_FROM_AOA_DRIVER + + /* Includes: */ + #include "../Core/USBMode.h" + + #if defined(USB_CAN_BE_HOST) + #include "Host/AndroidAccessoryClassHost.h" + #endif + +#endif + +/** @} */ + diff --git a/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h b/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h index c1c0e8df0..dc1289da6 100644 --- a/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h +++ b/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h @@ -1,128 +1,128 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common definitions and declarations for the library USB Android Open Accessory Class driver. - * - * Common definitions and declarations for the library USB Android Open Accessory Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassAOA - * \defgroup Group_USBClassAOACommon Common Class Definitions - * - * \section Sec_ModDescription Module Description - * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB - * Android Open Accessory Class. - * - * @{ - */ - -#ifndef _AOA_CLASS_COMMON_H_ -#define _AOA_CLASS_COMMON_H_ - - /* Includes: */ - #include "../../Core/StdDescriptors.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_AOA_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Macros: */ - /** Product ID value in a Device Descriptor to indicate an Android device in Open Accessory mode. */ - #define ANDROID_ACCESSORY_PRODUCT_ID 0x2D00 - - /** Product ID value in a Device Descriptor to indicate an Android device in Open Accessory and Android Debug mode. */ - #define ANDROID_ACCESSORY_ADB_PRODUCT_ID 0x2D01 - - /* Enums: */ - /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the - * Android Open Accessory class. - */ - enum AOA_Descriptor_ClassSubclassProtocol_t - { - AOA_CSCP_AOADataClass = 0xFF, /**< Descriptor Class value indicating that the device or interface - * belongs to the AOA data class. - */ - AOA_CSCP_AOADataSubclass = 0xFF, /**< Descriptor Subclass value indicating that the device or interface - * belongs to AOA data subclass. - */ - AOA_CSCP_AOADataProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface - * belongs to the AOA data class protocol. - */ - }; - - /** Enum for the Android Open Accessory class specific control requests that can be issued by the USB bus host. */ - enum AOA_ClassRequests_t - { - AOA_REQ_GetAccessoryProtocol = 0x33, /**< Android Open Accessory control request to retrieve the device's supported Accessory Protocol version. */ - AOA_REQ_SendString = 0x34, /**< Android Open Accessory control request to set an accessory property string in the device. */ - AOA_REQ_StartAccessoryMode = 0x35, /**< Android Open Accessory control request to switch the device into Accessory mode. */ - }; - - /** Enum for the possible Android Open Accessory property string indexes. */ - enum AOA_Strings_t - { - AOA_STRING_Manufacturer = 0, /**< Index of the Manufacturer property string. */ - AOA_STRING_Model = 1, /**< Index of the Model Name property string. */ - AOA_STRING_Description = 2, /**< Index of the Description property string. */ - AOA_STRING_Version = 3, /**< Index of the Version Number property string. */ - AOA_STRING_URI = 4, /**< Index of the URI Information property string. */ - AOA_STRING_Serial = 5, /**< Index of the Serial Number property string. */ - - #if !defined(__DOXYGEN__) - AOA_STRING_TOTAL_STRINGS - #endif - }; - - /** Enum for the possible Android Open Accessory protocol versions. */ - enum AOA_Protocols_t - { - AOA_PROTOCOL_AccessoryV1 = 0x0001, /**< Android Open Accessory version 1. */ - }; - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Common definitions and declarations for the library USB Android Open Accessory Class driver. + * + * Common definitions and declarations for the library USB Android Open Accessory Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassAOA + * \defgroup Group_USBClassAOACommon Common Class Definitions + * + * \section Sec_ModDescription Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * Android Open Accessory Class. + * + * @{ + */ + +#ifndef _AOA_CLASS_COMMON_H_ +#define _AOA_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../Core/StdDescriptors.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_AOA_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Macros: */ + /** Product ID value in a Device Descriptor to indicate an Android device in Open Accessory mode. */ + #define ANDROID_ACCESSORY_PRODUCT_ID 0x2D00 + + /** Product ID value in a Device Descriptor to indicate an Android device in Open Accessory and Android Debug mode. */ + #define ANDROID_ACCESSORY_ADB_PRODUCT_ID 0x2D01 + + /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the + * Android Open Accessory class. + */ + enum AOA_Descriptor_ClassSubclassProtocol_t + { + AOA_CSCP_AOADataClass = 0xFF, /**< Descriptor Class value indicating that the device or interface + * belongs to the AOA data class. + */ + AOA_CSCP_AOADataSubclass = 0xFF, /**< Descriptor Subclass value indicating that the device or interface + * belongs to AOA data subclass. + */ + AOA_CSCP_AOADataProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the AOA data class protocol. + */ + }; + + /** Enum for the Android Open Accessory class specific control requests that can be issued by the USB bus host. */ + enum AOA_ClassRequests_t + { + AOA_REQ_GetAccessoryProtocol = 0x33, /**< Android Open Accessory control request to retrieve the device's supported Accessory Protocol version. */ + AOA_REQ_SendString = 0x34, /**< Android Open Accessory control request to set an accessory property string in the device. */ + AOA_REQ_StartAccessoryMode = 0x35, /**< Android Open Accessory control request to switch the device into Accessory mode. */ + }; + + /** Enum for the possible Android Open Accessory property string indexes. */ + enum AOA_Strings_t + { + AOA_STRING_Manufacturer = 0, /**< Index of the Manufacturer property string. */ + AOA_STRING_Model = 1, /**< Index of the Model Name property string. */ + AOA_STRING_Description = 2, /**< Index of the Description property string. */ + AOA_STRING_Version = 3, /**< Index of the Version Number property string. */ + AOA_STRING_URI = 4, /**< Index of the URI Information property string. */ + AOA_STRING_Serial = 5, /**< Index of the Serial Number property string. */ + + #if !defined(__DOXYGEN__) + AOA_STRING_TOTAL_STRINGS + #endif + }; + + /** Enum for the possible Android Open Accessory protocol versions. */ + enum AOA_Protocols_t + { + AOA_PROTOCOL_AccessoryV1 = 0x0001, /**< Android Open Accessory version 1. */ + }; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h b/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h index a8bfc7833..52c5a1aa1 100644 --- a/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h @@ -124,7 +124,7 @@ * * When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for * the given endpoint index, and should return as fast as possible. When non-NULL, this value may be altered for GET operations - * to indicate the size of the retreived data. + * to indicate the size of the retrieved data. * * \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value * of the \c DataLength parameter. @@ -153,7 +153,7 @@ * * When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for * the given entity and should return as fast as possible. When non-NULL, this value may be altered for GET operations - * to indicate the size of the retreived data. + * to indicate the size of the retrieved data. * * \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value * of the \c DataLength parameter. diff --git a/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h b/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h index 508c234d7..3304775e7 100644 --- a/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h @@ -283,6 +283,7 @@ */ void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + #if defined(FDEV_SETUP_STREAM) || defined(__DOXYGEN__) /** Creates a standard character stream for the given CDC Device instance so that it can be used with all the regular * functions in the standard library that accept a \c FILE stream as a destination (e.g. \c fprintf()). The created * stream is bidirectional and can be used for both input and output functions. @@ -314,7 +315,8 @@ */ void CDC_Device_CreateBlockingStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - + #endif + /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Function Prototypes: */ diff --git a/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h b/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h index 2703600ea..52aa9a15d 100644 --- a/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h @@ -130,7 +130,7 @@ /** Flushes the MIDI send buffer, sending any queued MIDI events to the host. This should be called to override the - * \ref MIDI_Device_SendEventPacket() function's packing behaviour, to flush queued events. + * \ref MIDI_Device_SendEventPacket() function's packing behavior, to flush queued events. * * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. * diff --git a/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c b/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c index 7c564e012..f71fa2b95 100644 --- a/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c +++ b/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c @@ -1,422 +1,422 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_AOA_DRIVER -#define __INCLUDE_FROM_ANDROIDACCESSORY_HOST_C -#include "AndroidAccessoryClassHost.h" - -bool AOA_Host_ValidateAccessoryDevice(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const USB_Descriptor_Device_t* const DeviceDescriptor, - bool* const NeedModeSwitch) -{ - (void)AOAInterfaceInfo; - - if (DeviceDescriptor->Header.Type != DTYPE_Device) - return false; - - *NeedModeSwitch = ((DeviceDescriptor->ProductID != ANDROID_ACCESSORY_PRODUCT_ID) && - (DeviceDescriptor->ProductID != ANDROID_ACCESSORY_ADB_PRODUCT_ID)); - - return true; -} - -uint8_t AOA_Host_ConfigurePipes(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) -{ - USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; - USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; - USB_Descriptor_Interface_t* AOAInterface = NULL; - - memset(&AOAInterfaceInfo->State, 0x00, sizeof(AOAInterfaceInfo->State)); - - if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) - return AOA_ENUMERROR_InvalidConfigDescriptor; - - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_AOA_Host_NextAndroidAccessoryInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return AOA_ENUMERROR_NoCompatibleInterfaceFound; - } - - AOAInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - - while (!(DataINEndpoint) || !(DataOUTEndpoint)) - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_AOA_Host_NextInterfaceBulkEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) - { - return AOA_ENUMERROR_NoCompatibleInterfaceFound; - } - - USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t); - - if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) - DataINEndpoint = EndpointData; - else - DataOUTEndpoint = EndpointData; - } - - AOAInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize); - AOAInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; - AOAInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK; - - AOAInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); - AOAInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; - AOAInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; - - if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataINPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataOUTPipe, 1))) - return false; - - AOAInterfaceInfo->State.IsActive = true; - AOAInterfaceInfo->State.InterfaceNumber = AOAInterface->InterfaceNumber; - - return AOA_ENUMERROR_NoError; -} - -static uint8_t DCOMP_AOA_Host_NextAndroidAccessoryInterface(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if ((Interface->Class == AOA_CSCP_AOADataClass) && - (Interface->SubClass == AOA_CSCP_AOADataSubclass) && - (Interface->Protocol == AOA_CSCP_AOADataProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_AOA_Host_NextInterfaceBulkEndpoint(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Endpoint) - { - USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); - - uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK); - - if ((EndpointType == EP_TYPE_BULK) && (!(Pipe_IsEndpointBound(Endpoint->EndpointAddress)))) - return DESCRIPTOR_SEARCH_Found; - } - else if (Header->Type == DTYPE_Interface) - { - return DESCRIPTOR_SEARCH_Fail; - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -void AOA_Host_USBTask(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return; - - #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) - AOA_Host_Flush(AOAInterfaceInfo); - #endif -} - -uint8_t AOA_Host_StartAccessoryMode(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) -{ - uint8_t ErrorCode; - - uint16_t AccessoryProtocol; - if ((ErrorCode = AOA_Host_GetAccessoryProtocol(&AccessoryProtocol)) != HOST_WAITERROR_Successful) - return ErrorCode; - - if (AccessoryProtocol != CPU_TO_LE16(AOA_PROTOCOL_AccessoryV1)) - return AOA_ERROR_LOGICAL_CMD_FAILED; - - for (uint8_t PropertyIndex = 0; PropertyIndex < AOA_STRING_TOTAL_STRINGS; PropertyIndex++) - { - if ((ErrorCode = AOA_Host_SendPropertyString(AOAInterfaceInfo, PropertyIndex)) != HOST_WAITERROR_Successful) - return ErrorCode; - } - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR | REQREC_DEVICE), - .bRequest = AOA_REQ_StartAccessoryMode, - .wValue = 0, - .wIndex = 0, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - return USB_Host_SendControlRequest(NULL); -} - -static uint8_t AOA_Host_GetAccessoryProtocol(uint16_t* const Protocol) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_VENDOR | REQREC_DEVICE), - .bRequest = AOA_REQ_GetAccessoryProtocol, - .wValue = 0, - .wIndex = 0, - .wLength = sizeof(uint16_t), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - return USB_Host_SendControlRequest(Protocol); -} - -static uint8_t AOA_Host_SendPropertyString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t StringIndex) -{ - const char* String = AOAInterfaceInfo->Config.PropertyStrings[StringIndex]; - - if (String == NULL) - String = ""; - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR | REQREC_DEVICE), - .bRequest = AOA_REQ_SendString, - .wValue = 0, - .wIndex = StringIndex, - .wLength = (strlen(String) + 1), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - return USB_Host_SendControlRequest((char*)String); -} - -uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t* const Buffer, - const uint16_t Length) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); - - Pipe_Unfreeze(); - ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL); - Pipe_Freeze(); - - return ErrorCode; -} - -uint8_t AOA_Host_SendString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const char* const String) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); - - Pipe_Unfreeze(); - ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL); - Pipe_Freeze(); - - return ErrorCode; -} - -uint8_t AOA_Host_SendByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t Data) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearOUT(); - - if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError) - return ErrorCode; - } - - Pipe_Write_8(Data); - Pipe_Freeze(); - - return PIPE_READYWAIT_NoError; -} - -uint16_t AOA_Host_BytesReceived(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return 0; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsINReceived()) - { - if (!(Pipe_BytesInPipe())) - { - Pipe_ClearIN(); - Pipe_Freeze(); - return 0; - } - else - { - Pipe_Freeze(); - return Pipe_BytesInPipe(); - } - } - else - { - Pipe_Freeze(); - - return 0; - } -} - -int16_t AOA_Host_ReceiveByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return -1; - - int16_t ReceivedByte = -1; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsINReceived()) - { - if (Pipe_BytesInPipe()) - ReceivedByte = Pipe_Read_8(); - - if (!(Pipe_BytesInPipe())) - Pipe_ClearIN(); - } - - Pipe_Freeze(); - - return ReceivedByte; -} - -uint8_t AOA_Host_Flush(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (!(Pipe_BytesInPipe())) - return PIPE_READYWAIT_NoError; - - bool BankFull = !(Pipe_IsReadWriteAllowed()); - - Pipe_ClearOUT(); - - if (BankFull) - { - if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError) - return ErrorCode; - - Pipe_ClearOUT(); - } - - Pipe_Freeze(); - - return PIPE_READYWAIT_NoError; -} - -#if defined(FDEV_SETUP_STREAM) -void AOA_Host_CreateStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - FILE* const Stream) -{ - *Stream = (FILE)FDEV_SETUP_STREAM(AOA_Host_putchar, AOA_Host_getchar, _FDEV_SETUP_RW); - fdev_set_udata(Stream, AOAInterfaceInfo); -} - -void AOA_Host_CreateBlockingStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - FILE* const Stream) -{ - *Stream = (FILE)FDEV_SETUP_STREAM(AOA_Host_putchar, AOA_Host_getchar_Blocking, _FDEV_SETUP_RW); - fdev_set_udata(Stream, AOAInterfaceInfo); -} - -static int AOA_Host_putchar(char c, - FILE* Stream) -{ - return AOA_Host_SendByte((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0; -} - -static int AOA_Host_getchar(FILE* Stream) -{ - int16_t ReceivedByte = AOA_Host_ReceiveByte((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream)); - - if (ReceivedByte < 0) - return _FDEV_EOF; - - return ReceivedByte; -} - -static int AOA_Host_getchar_Blocking(FILE* Stream) -{ - int16_t ReceivedByte; - - while ((ReceivedByte = AOA_Host_ReceiveByte((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream))) < 0) - { - if (USB_HostState == HOST_STATE_Unattached) - return _FDEV_EOF; - - AOA_Host_USBTask((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream)); - USB_USBTask(); - } - - return ReceivedByte; -} -#endif - -#endif - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "../../Core/USBMode.h" + +#if defined(USB_CAN_BE_HOST) + +#define __INCLUDE_FROM_AOA_DRIVER +#define __INCLUDE_FROM_ANDROIDACCESSORY_HOST_C +#include "AndroidAccessoryClassHost.h" + +bool AOA_Host_ValidateAccessoryDevice(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + const USB_Descriptor_Device_t* const DeviceDescriptor, + bool* const NeedModeSwitch) +{ + (void)AOAInterfaceInfo; + + if (DeviceDescriptor->Header.Type != DTYPE_Device) + return false; + + *NeedModeSwitch = ((DeviceDescriptor->ProductID != ANDROID_ACCESSORY_PRODUCT_ID) && + (DeviceDescriptor->ProductID != ANDROID_ACCESSORY_ADB_PRODUCT_ID)); + + return true; +} + +uint8_t AOA_Host_ConfigurePipes(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + uint16_t ConfigDescriptorSize, + void* ConfigDescriptorData) +{ + USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; + USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; + USB_Descriptor_Interface_t* AOAInterface = NULL; + + memset(&AOAInterfaceInfo->State, 0x00, sizeof(AOAInterfaceInfo->State)); + + if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) + return AOA_ENUMERROR_InvalidConfigDescriptor; + + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + DCOMP_AOA_Host_NextAndroidAccessoryInterface) != DESCRIPTOR_SEARCH_COMP_Found) + { + return AOA_ENUMERROR_NoCompatibleInterfaceFound; + } + + AOAInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); + + while (!(DataINEndpoint) || !(DataOUTEndpoint)) + { + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + DCOMP_AOA_Host_NextInterfaceBulkEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + { + return AOA_ENUMERROR_NoCompatibleInterfaceFound; + } + + USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t); + + if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) + DataINEndpoint = EndpointData; + else + DataOUTEndpoint = EndpointData; + } + + AOAInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize); + AOAInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; + AOAInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK; + + AOAInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); + AOAInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; + AOAInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; + + if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataINPipe, 1))) + return false; + + if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataOUTPipe, 1))) + return false; + + AOAInterfaceInfo->State.IsActive = true; + AOAInterfaceInfo->State.InterfaceNumber = AOAInterface->InterfaceNumber; + + return AOA_ENUMERROR_NoError; +} + +static uint8_t DCOMP_AOA_Host_NextAndroidAccessoryInterface(void* const CurrentDescriptor) +{ + USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); + + if (Header->Type == DTYPE_Interface) + { + USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); + + if ((Interface->Class == AOA_CSCP_AOADataClass) && + (Interface->SubClass == AOA_CSCP_AOADataSubclass) && + (Interface->Protocol == AOA_CSCP_AOADataProtocol)) + { + return DESCRIPTOR_SEARCH_Found; + } + } + + return DESCRIPTOR_SEARCH_NotFound; +} + +static uint8_t DCOMP_AOA_Host_NextInterfaceBulkEndpoint(void* const CurrentDescriptor) +{ + USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); + + if (Header->Type == DTYPE_Endpoint) + { + USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); + + uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK); + + if ((EndpointType == EP_TYPE_BULK) && (!(Pipe_IsEndpointBound(Endpoint->EndpointAddress)))) + return DESCRIPTOR_SEARCH_Found; + } + else if (Header->Type == DTYPE_Interface) + { + return DESCRIPTOR_SEARCH_Fail; + } + + return DESCRIPTOR_SEARCH_NotFound; +} + +void AOA_Host_USBTask(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) +{ + if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) + return; + + #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) + AOA_Host_Flush(AOAInterfaceInfo); + #endif +} + +uint8_t AOA_Host_StartAccessoryMode(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) +{ + uint8_t ErrorCode; + + uint16_t AccessoryProtocol; + if ((ErrorCode = AOA_Host_GetAccessoryProtocol(&AccessoryProtocol)) != HOST_WAITERROR_Successful) + return ErrorCode; + + if (AccessoryProtocol != CPU_TO_LE16(AOA_PROTOCOL_AccessoryV1)) + return AOA_ERROR_LOGICAL_CMD_FAILED; + + for (uint8_t PropertyIndex = 0; PropertyIndex < AOA_STRING_TOTAL_STRINGS; PropertyIndex++) + { + if ((ErrorCode = AOA_Host_SendPropertyString(AOAInterfaceInfo, PropertyIndex)) != HOST_WAITERROR_Successful) + return ErrorCode; + } + + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR | REQREC_DEVICE), + .bRequest = AOA_REQ_StartAccessoryMode, + .wValue = 0, + .wIndex = 0, + .wLength = 0, + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + return USB_Host_SendControlRequest(NULL); +} + +static uint8_t AOA_Host_GetAccessoryProtocol(uint16_t* const Protocol) +{ + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_VENDOR | REQREC_DEVICE), + .bRequest = AOA_REQ_GetAccessoryProtocol, + .wValue = 0, + .wIndex = 0, + .wLength = sizeof(uint16_t), + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + return USB_Host_SendControlRequest(Protocol); +} + +static uint8_t AOA_Host_SendPropertyString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + const uint8_t StringIndex) +{ + const char* String = AOAInterfaceInfo->Config.PropertyStrings[StringIndex]; + + if (String == NULL) + String = ""; + + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR | REQREC_DEVICE), + .bRequest = AOA_REQ_SendString, + .wValue = 0, + .wIndex = StringIndex, + .wLength = (strlen(String) + 1), + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + return USB_Host_SendControlRequest((char*)String); +} + +uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + const uint8_t* const Buffer, + const uint16_t Length) +{ + if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) + return PIPE_READYWAIT_DeviceDisconnected; + + uint8_t ErrorCode; + + Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); + + Pipe_Unfreeze(); + ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL); + Pipe_Freeze(); + + return ErrorCode; +} + +uint8_t AOA_Host_SendString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + const char* const String) +{ + if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) + return PIPE_READYWAIT_DeviceDisconnected; + + uint8_t ErrorCode; + + Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); + + Pipe_Unfreeze(); + ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL); + Pipe_Freeze(); + + return ErrorCode; +} + +uint8_t AOA_Host_SendByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + const uint8_t Data) +{ + if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) + return PIPE_READYWAIT_DeviceDisconnected; + + uint8_t ErrorCode; + + Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); + Pipe_Unfreeze(); + + if (!(Pipe_IsReadWriteAllowed())) + { + Pipe_ClearOUT(); + + if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError) + return ErrorCode; + } + + Pipe_Write_8(Data); + Pipe_Freeze(); + + return PIPE_READYWAIT_NoError; +} + +uint16_t AOA_Host_BytesReceived(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) +{ + if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) + return 0; + + Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address); + Pipe_Unfreeze(); + + if (Pipe_IsINReceived()) + { + if (!(Pipe_BytesInPipe())) + { + Pipe_ClearIN(); + Pipe_Freeze(); + return 0; + } + else + { + Pipe_Freeze(); + return Pipe_BytesInPipe(); + } + } + else + { + Pipe_Freeze(); + + return 0; + } +} + +int16_t AOA_Host_ReceiveByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) +{ + if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) + return -1; + + int16_t ReceivedByte = -1; + + Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address); + Pipe_Unfreeze(); + + if (Pipe_IsINReceived()) + { + if (Pipe_BytesInPipe()) + ReceivedByte = Pipe_Read_8(); + + if (!(Pipe_BytesInPipe())) + Pipe_ClearIN(); + } + + Pipe_Freeze(); + + return ReceivedByte; +} + +uint8_t AOA_Host_Flush(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) +{ + if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) + return PIPE_READYWAIT_DeviceDisconnected; + + uint8_t ErrorCode; + + Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); + Pipe_Unfreeze(); + + if (!(Pipe_BytesInPipe())) + return PIPE_READYWAIT_NoError; + + bool BankFull = !(Pipe_IsReadWriteAllowed()); + + Pipe_ClearOUT(); + + if (BankFull) + { + if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError) + return ErrorCode; + + Pipe_ClearOUT(); + } + + Pipe_Freeze(); + + return PIPE_READYWAIT_NoError; +} + +#if defined(FDEV_SETUP_STREAM) +void AOA_Host_CreateStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + FILE* const Stream) +{ + *Stream = (FILE)FDEV_SETUP_STREAM(AOA_Host_putchar, AOA_Host_getchar, _FDEV_SETUP_RW); + fdev_set_udata(Stream, AOAInterfaceInfo); +} + +void AOA_Host_CreateBlockingStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + FILE* const Stream) +{ + *Stream = (FILE)FDEV_SETUP_STREAM(AOA_Host_putchar, AOA_Host_getchar_Blocking, _FDEV_SETUP_RW); + fdev_set_udata(Stream, AOAInterfaceInfo); +} + +static int AOA_Host_putchar(char c, + FILE* Stream) +{ + return AOA_Host_SendByte((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0; +} + +static int AOA_Host_getchar(FILE* Stream) +{ + int16_t ReceivedByte = AOA_Host_ReceiveByte((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream)); + + if (ReceivedByte < 0) + return _FDEV_EOF; + + return ReceivedByte; +} + +static int AOA_Host_getchar_Blocking(FILE* Stream) +{ + int16_t ReceivedByte; + + while ((ReceivedByte = AOA_Host_ReceiveByte((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream))) < 0) + { + if (USB_HostState == HOST_STATE_Unattached) + return _FDEV_EOF; + + AOA_Host_USBTask((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream)); + USB_USBTask(); + } + + return ReceivedByte; +} +#endif + +#endif + diff --git a/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h b/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h index 678feda45..c437a4b61 100644 --- a/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h +++ b/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h @@ -1,314 +1,314 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Host mode driver for the library USB Android Open Accessory Class driver. - * - * Host mode driver for the library USB Android Open Accessory Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassAOA - * \defgroup Group_USBClassAndroidAccessoryHost Android Open Accessory Class Host Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Host Mode USB Class driver framework interface, for the Android Open Accessory USB Class driver. - * - * @{ - */ - -#ifndef __AOA_CLASS_HOST_H__ -#define __AOA_CLASS_HOST_H__ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/AndroidAccessoryClassCommon.h" - - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_AOA_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Error code for some Android Open Accessory Host functions, indicating a logical (and not hardware) error. */ - #define AOA_ERROR_LOGICAL_CMD_FAILED 0x80 - - /* Type Defines: */ - /** \brief Android Open Accessory Class Host Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made within the user application, - * and passed to each of the Android Open Accessory class driver functions as the \c AOAInterfaceInfo - * parameter. This stores each Android Open Accessory interface's configuration and state information. - */ - typedef struct - { - struct - { - USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ - USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ - - char* PropertyStrings[AOA_STRING_TOTAL_STRINGS]; /**< Android Accessory property strings, sent to identify the accessory when the - * Android device is switched into Open Accessory mode. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid - * after \ref AOA_Host_ConfigurePipes() is called and the Host state machine is in the - * Configured state. - */ - uint8_t InterfaceNumber; /**< Interface index of the AOA interface within the attached device. */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * may be set to initial values, but may also be ignored to default to sane values when - * the interface is enumerated. - */ - } USB_ClassInfo_AOA_Host_t; - - /* Enums: */ - /** Enum for the possible error codes returned by the \ref AOA_Host_ConfigurePipes() function. */ - enum AOA_Host_EnumerationFailure_ErrorCodes_t - { - AOA_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ - AOA_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ - AOA_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Android Open Accessory interface was not found in the device's Configuration Descriptor. */ - AOA_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */ - }; - - /* Function Prototypes: */ - /** General management task for a given Android Open Accessory host class interface, required for the correct operation of the interface. - * This should be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an Android Open Accessory Class host configuration and state. - */ - void AOA_Host_USBTask(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Validates a device descriptor, to check if the device is a valid Android device, and if it is currently in Android Open Accessory mode. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an AOA Class host configuration and state. - * \param[in] DeviceDescriptor Pointer a buffer containing the attached device's Device Descriptor. - * \param[out] NeedModeSwitch Pointer to a boolean where the mode switch requirement of the attached device is to be stored. - * - * \return Boolean \c true if the attached device is a valid Android device, \c false otherwise. - */ - bool AOA_Host_ValidateAccessoryDevice(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const USB_Descriptor_Device_t* const DeviceDescriptor, - bool* const NeedModeSwitch) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3); - - /** Host interface configuration routine, to configure a given Android Open Accessory host interface instance using the Configuration - * Descriptor read from an attached USB device. This function automatically updates the given Android Open Accessory Host instance's - * state values and configures the pipes required to communicate with the interface if it is found within the device. This should be - * called once after the stack has enumerated the attached device, while the host state machine is in the Addressed state. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an AOA Class host configuration and state. - * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. - * \param[in] ConfigDescriptorData Pointer to a buffer containing the attached device's Configuration Descriptor. - * - * \return A value from the \ref AOA_Host_EnumerationFailure_ErrorCodes_t enum. - */ - uint8_t AOA_Host_ConfigurePipes(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** Starts Accessory Mode in the attached Android device. This function will validate the device's Android Open Accessory protocol - * version, send the configured property strings, and request a switch to Android Open Accessory mode. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an AOA Class host configuration and state. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum, or \ref AOA_ERROR_LOGICAL_CMD_FAILED if a logical error occured.. - */ - uint8_t AOA_Host_StartAccessoryMode(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a given data buffer to the attached USB device, if connected. If a device is not connected when the function is - * called, the data will be discarded. Bytes will be queued for transmission to the device until either the pipe bank - * becomes full, or the \ref AOA_Host_Flush() function is called to flush the pending data to the device. This allows for - * multiple bytes to be packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * \param[in] Buffer Pointer to a buffer containing the data to send to the device. - * \param[in] Length Length of the data to send to the device. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t* const Buffer, - const uint16_t Length); - - /** Sends a given null-terminated string to the attached USB device, if connected. If a device is not connected when the - * function is called, the string is discarded. Bytes will be queued for transmission to the device until either the pipe - * bank becomes full, or the \ref AOA_Host_Flush() function is called to flush the pending data to the device. This allows - * for multiple bytes to be packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * \param[in] String Pointer to the null terminated string to send to the device. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t AOA_Host_SendString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const char* const String) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Sends a given byte to the attached USB device, if connected. If a device is not connected when the function is called, the - * byte is discarded. Bytes will be queued for transmission to the device until either the pipe bank becomes full, or the - * \ref AOA_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be - * packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * \param[in] Data Byte of data to send to the device. - * - * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t AOA_Host_SendByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1); - - /** Determines the number of bytes received by the AOA interface from the device, waiting to be read. This indicates the number - * of bytes in the IN pipe bank only, and thus the number of calls to \ref AOA_Host_ReceiveByte() which are guaranteed to succeed - * immediately. If multiple bytes are to be received, they should be buffered by the user application, as the pipe bank will not be - * released back to the USB controller until all bytes are read. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * - * \return Total number of buffered bytes received from the device. - */ - uint16_t AOA_Host_BytesReceived(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads a byte of data from the device. If no data is waiting to be read of if a USB device is not connected, the function - * returns a negative value. The \ref AOA_Host_BytesReceived() function may be queried in advance to determine how many bytes - * are currently buffered in the AOA interface's data receive pipe. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * - * \return Next received byte from the device, or a negative value if no data received. - */ - int16_t AOA_Host_ReceiveByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Flushes any data waiting to be sent, ensuring that the send buffer is cleared. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * - * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t AOA_Host_Flush(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Creates a standard character stream for the given AOA Device instance so that it can be used with all the regular - * functions in the standard \c library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created - * stream is bidirectional and can be used for both input and output functions. - * - * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single - * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may - * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own - * line buffering. - * - * \note The created stream can be given as \c stdout if desired to direct the standard output from all \c functions - * to the given AOA interface. - * \n\n - * - * \note This function is not available on all microcontroller architectures. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class configuration and state. - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. - */ - void AOA_Host_CreateStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - FILE* const Stream); - - /** Identical to \ref AOA_Host_CreateStream(), except that reads are blocking until the calling stream function terminates - * the transfer. While blocking, the USB and AOA service tasks are called repeatedly to maintain USB communications. - * - * \note This function is not available on all microcontroller architectures. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class configuration and state. - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. - */ - void AOA_Host_CreateBlockingStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - FILE* const Stream); - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_ANDROIDACCESSORY_HOST_C) - #if defined(FDEV_SETUP_STREAM) - static int AOA_Host_putchar(char c, - FILE* Stream) ATTR_NON_NULL_PTR_ARG(2); - static int AOA_Host_getchar(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); - static int AOA_Host_getchar_Blocking(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); - #endif - - static uint8_t AOA_Host_GetAccessoryProtocol(uint16_t* const Protocol) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t AOA_Host_SendPropertyString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t StringIndex) ATTR_NON_NULL_PTR_ARG(1); - - static uint8_t DCOMP_AOA_Host_NextAndroidAccessoryInterface(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_AOA_Host_NextInterfaceBulkEndpoint(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Host mode driver for the library USB Android Open Accessory Class driver. + * + * Host mode driver for the library USB Android Open Accessory Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassAOA + * \defgroup Group_USBClassAndroidAccessoryHost Android Open Accessory Class Host Mode Driver + * + * \section Sec_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_ModDescription Module Description + * Host Mode USB Class driver framework interface, for the Android Open Accessory USB Class driver. + * + * @{ + */ + +#ifndef __AOA_CLASS_HOST_H__ +#define __AOA_CLASS_HOST_H__ + + /* Includes: */ + #include "../../USB.h" + #include "../Common/AndroidAccessoryClassCommon.h" + + #include + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_AOA_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** Error code for some Android Open Accessory Host functions, indicating a logical (and not hardware) error. */ + #define AOA_ERROR_LOGICAL_CMD_FAILED 0x80 + + /* Type Defines: */ + /** \brief Android Open Accessory Class Host Mode Configuration and State Structure. + * + * Class state structure. An instance of this structure should be made within the user application, + * and passed to each of the Android Open Accessory class driver functions as the \c AOAInterfaceInfo + * parameter. This stores each Android Open Accessory interface's configuration and state information. + */ + typedef struct + { + struct + { + USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ + USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ + + char* PropertyStrings[AOA_STRING_TOTAL_STRINGS]; /**< Android Accessory property strings, sent to identify the accessory when the + * Android device is switched into Open Accessory mode. */ + } Config; /**< Config data for the USB class interface within the device. All elements in this section + * must be set or the interface will fail to enumerate and operate correctly. + */ + struct + { + bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid + * after \ref AOA_Host_ConfigurePipes() is called and the Host state machine is in the + * Configured state. + */ + uint8_t InterfaceNumber; /**< Interface index of the AOA interface within the attached device. */ + } State; /**< State data for the USB class interface within the device. All elements in this section + * may be set to initial values, but may also be ignored to default to sane values when + * the interface is enumerated. + */ + } USB_ClassInfo_AOA_Host_t; + + /* Enums: */ + /** Enum for the possible error codes returned by the \ref AOA_Host_ConfigurePipes() function. */ + enum AOA_Host_EnumerationFailure_ErrorCodes_t + { + AOA_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ + AOA_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ + AOA_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Android Open Accessory interface was not found in the device's Configuration Descriptor. */ + AOA_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */ + }; + + /* Function Prototypes: */ + /** General management task for a given Android Open Accessory host class interface, required for the correct operation of the interface. + * This should be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an Android Open Accessory Class host configuration and state. + */ + void AOA_Host_USBTask(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Validates a device descriptor, to check if the device is a valid Android device, and if it is currently in Android Open Accessory mode. + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an AOA Class host configuration and state. + * \param[in] DeviceDescriptor Pointer a buffer containing the attached device's Device Descriptor. + * \param[out] NeedModeSwitch Pointer to a boolean where the mode switch requirement of the attached device is to be stored. + * + * \return Boolean \c true if the attached device is a valid Android device, \c false otherwise. + */ + bool AOA_Host_ValidateAccessoryDevice(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + const USB_Descriptor_Device_t* const DeviceDescriptor, + bool* const NeedModeSwitch) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3); + + /** Host interface configuration routine, to configure a given Android Open Accessory host interface instance using the Configuration + * Descriptor read from an attached USB device. This function automatically updates the given Android Open Accessory Host instance's + * state values and configures the pipes required to communicate with the interface if it is found within the device. This should be + * called once after the stack has enumerated the attached device, while the host state machine is in the Addressed state. + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an AOA Class host configuration and state. + * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. + * \param[in] ConfigDescriptorData Pointer to a buffer containing the attached device's Configuration Descriptor. + * + * \return A value from the \ref AOA_Host_EnumerationFailure_ErrorCodes_t enum. + */ + uint8_t AOA_Host_ConfigurePipes(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + uint16_t ConfigDescriptorSize, + void* ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); + + /** Starts Accessory Mode in the attached Android device. This function will validate the device's Android Open Accessory protocol + * version, send the configured property strings, and request a switch to Android Open Accessory mode. + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an AOA Class host configuration and state. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum, or \ref AOA_ERROR_LOGICAL_CMD_FAILED if a logical error occurred.. + */ + uint8_t AOA_Host_StartAccessoryMode(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Sends a given data buffer to the attached USB device, if connected. If a device is not connected when the function is + * called, the data will be discarded. Bytes will be queued for transmission to the device until either the pipe bank + * becomes full, or the \ref AOA_Host_Flush() function is called to flush the pending data to the device. This allows for + * multiple bytes to be packed into a single pipe packet, increasing data throughput. + * + * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the + * call will fail. + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. + * \param[in] Buffer Pointer to a buffer containing the data to send to the device. + * \param[in] Length Length of the data to send to the device. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + const uint8_t* const Buffer, + const uint16_t Length); + + /** Sends a given null-terminated string to the attached USB device, if connected. If a device is not connected when the + * function is called, the string is discarded. Bytes will be queued for transmission to the device until either the pipe + * bank becomes full, or the \ref AOA_Host_Flush() function is called to flush the pending data to the device. This allows + * for multiple bytes to be packed into a single pipe packet, increasing data throughput. + * + * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the + * call will fail. + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. + * \param[in] String Pointer to the null terminated string to send to the device. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t AOA_Host_SendString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + const char* const String) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + + /** Sends a given byte to the attached USB device, if connected. If a device is not connected when the function is called, the + * byte is discarded. Bytes will be queued for transmission to the device until either the pipe bank becomes full, or the + * \ref AOA_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be + * packed into a single pipe packet, increasing data throughput. + * + * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the + * call will fail. + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. + * \param[in] Data Byte of data to send to the device. + * + * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. + */ + uint8_t AOA_Host_SendByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1); + + /** Determines the number of bytes received by the AOA interface from the device, waiting to be read. This indicates the number + * of bytes in the IN pipe bank only, and thus the number of calls to \ref AOA_Host_ReceiveByte() which are guaranteed to succeed + * immediately. If multiple bytes are to be received, they should be buffered by the user application, as the pipe bank will not be + * released back to the USB controller until all bytes are read. + * + * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the + * call will fail. + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. + * + * \return Total number of buffered bytes received from the device. + */ + uint16_t AOA_Host_BytesReceived(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads a byte of data from the device. If no data is waiting to be read of if a USB device is not connected, the function + * returns a negative value. The \ref AOA_Host_BytesReceived() function may be queried in advance to determine how many bytes + * are currently buffered in the AOA interface's data receive pipe. + * + * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the + * call will fail. + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. + * + * \return Next received byte from the device, or a negative value if no data received. + */ + int16_t AOA_Host_ReceiveByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Flushes any data waiting to be sent, ensuring that the send buffer is cleared. + * + * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the + * call will fail. + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. + * + * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. + */ + uint8_t AOA_Host_Flush(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Creates a standard character stream for the given AOA Device instance so that it can be used with all the regular + * functions in the standard \c library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created + * stream is bidirectional and can be used for both input and output functions. + * + * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single + * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may + * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own + * line buffering. + * + * \note The created stream can be given as \c stdout if desired to direct the standard output from all \c functions + * to the given AOA interface. + * \n\n + * + * \note This function is not available on all microcontroller architectures. + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class configuration and state. + * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. + */ + void AOA_Host_CreateStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + FILE* const Stream); + + /** Identical to \ref AOA_Host_CreateStream(), except that reads are blocking until the calling stream function terminates + * the transfer. While blocking, the USB and AOA service tasks are called repeatedly to maintain USB communications. + * + * \note This function is not available on all microcontroller architectures. + * + * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class configuration and state. + * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. + */ + void AOA_Host_CreateBlockingStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + FILE* const Stream); + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Function Prototypes: */ + #if defined(__INCLUDE_FROM_ANDROIDACCESSORY_HOST_C) + #if defined(FDEV_SETUP_STREAM) + static int AOA_Host_putchar(char c, + FILE* Stream) ATTR_NON_NULL_PTR_ARG(2); + static int AOA_Host_getchar(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); + static int AOA_Host_getchar_Blocking(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); + #endif + + static uint8_t AOA_Host_GetAccessoryProtocol(uint16_t* const Protocol) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t AOA_Host_SendPropertyString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, + const uint8_t StringIndex) ATTR_NON_NULL_PTR_ARG(1); + + static uint8_t DCOMP_AOA_Host_NextAndroidAccessoryInterface(void* const CurrentDescriptor) + ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_AOA_Host_NextInterfaceBulkEndpoint(void* const CurrentDescriptor) + ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); + #endif + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/LUFA/Drivers/USB/Class/Host/CDCClassHost.h b/LUFA/Drivers/USB/Class/Host/CDCClassHost.h index 4d79ed951..b70a5023b 100644 --- a/LUFA/Drivers/USB/Class/Host/CDCClassHost.h +++ b/LUFA/Drivers/USB/Class/Host/CDCClassHost.h @@ -271,6 +271,7 @@ */ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + #if defined(FDEV_SETUP_STREAM) || defined(__DOXYGEN__) /** Creates a standard character stream for the given CDC Device instance so that it can be used with all the regular * functions in the standard \c library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created * stream is bidirectional and can be used for both input and output functions. @@ -302,7 +303,8 @@ */ void CDC_Host_CreateBlockingStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, FILE* const Stream); - + #endif + /** CDC class driver event for a control line state change on a CDC host interface. This event fires each time the device notifies * the host of a control line state change (containing the virtual serial control line states, such as DCD) and may be hooked in the * user program by declaring a handler function with the same name and parameters listed here. The new control line states diff --git a/LUFA/Drivers/USB/Class/Host/HIDClassHost.h b/LUFA/Drivers/USB/Class/Host/HIDClassHost.h index 882cc31df..21868d9cf 100644 --- a/LUFA/Drivers/USB/Class/Host/HIDClassHost.h +++ b/LUFA/Drivers/USB/Class/Host/HIDClassHost.h @@ -246,7 +246,7 @@ uint8_t HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** Sets the idle period for the attached HID device to the specified interval. The HID idle period determines the rate - * at which the device should send a report, when no state changes have ocurred; i.e. on HID keyboards, this sets the + * at which the device should send a report, when no state changes have occurred; i.e. on HID keyboards, this sets the * hardware key repeat interval. * * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state. diff --git a/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h b/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h index b9e861143..06ede7f22 100644 --- a/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h +++ b/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h @@ -145,7 +145,7 @@ MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); /** Flushes the MIDI send buffer, sending any queued MIDI events to the device. This should be called to override the - * \ref MIDI_Host_SendEventPacket() function's packing behaviour, to flush queued events. Events are queued into the + * \ref MIDI_Host_SendEventPacket() function's packing behavior, to flush queued events. Events are queued into the * pipe bank until either the pipe bank is full, or \ref MIDI_Host_Flush() is called. This allows for multiple MIDI * events to be packed into a single pipe packet, increasing data throughput. * diff --git a/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c index 0117a1d66..a267be1ee 100644 --- a/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c @@ -1,275 +1,275 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "EndpointStream_AVR8.h" - -#if !defined(CONTROL_ONLY_DEVICE) -uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearOUT(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Discard_8(); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearIN(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Write_8(0); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, - * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" -#endif - -#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" -#endif - -#endif - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - -#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" -#endif - -#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_Control_R.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_Control_R.c" -#endif - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#include "EndpointStream_AVR8.h" + +#if !defined(CONTROL_ONLY_DEVICE) +uint8_t Endpoint_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Endpoint_IsReadWriteAllowed())) + { + Endpoint_ClearOUT(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return ENDPOINT_RWSTREAM_IncompleteTransfer; + } + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + } + else + { + Endpoint_Discard_8(); + + Length--; + BytesInTransfer++; + } + } + + return ENDPOINT_RWSTREAM_NoError; +} + +uint8_t Endpoint_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Endpoint_IsReadWriteAllowed())) + { + Endpoint_ClearIN(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return ENDPOINT_RWSTREAM_IncompleteTransfer; + } + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + } + else + { + Endpoint_Write_8(0); + + Length--; + BytesInTransfer++; + } + } + + return ENDPOINT_RWSTREAM_NoError; +} + +/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, + * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_RW.c" + +#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" +#endif + +#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE + #define TEMPLATE_BUFFER_TYPE void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE + #define TEMPLATE_BUFFER_TYPE void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_RW.c" #endif -#endif +#endif + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_Control_W.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_Control_W.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_Control_R.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_Control_R.c" + +#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_LE + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_BE + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" +#endif + +#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_Control_R.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_Control_R.c" +#endif + +#endif + +#endif diff --git a/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h index 072d85932..eb1f928ff 100644 --- a/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h @@ -1,648 +1,648 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Endpoint data stream transmission and reception management for the AVR8 microcontrollers. - * \copydetails Group_EndpointStreamRW_AVR8 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_EndpointStreamRW - * \defgroup Group_EndpointStreamRW_AVR8 Read/Write of Multi-Byte Streams (AVR8) - * \brief Endpoint data stream transmission and reception management for the Atmel AVR8 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to endpoints. - * - * @{ - */ - -#ifndef __ENDPOINT_STREAM_AVR8_H__ -#define __ENDPOINT_STREAM_AVR8_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Function Prototypes: */ - /** \name Stream functions for null data */ - //@{ - - /** Reads and discards the given number of bytes from the currently selected endpoint's bank, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of bytes to discard via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending - * full packets to the host as needed. The last packet is not automatically sent once the - * remaining bytes have been written; the user is responsible for manually sending the last - * packet to the host via the \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of zero bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - //@} - - /** \name Stream functions for RAM source/destination data */ - //@{ - - /** Writes the given number of bytes to the endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the setup OUT to - * finalize the transfer via the \ref Endpoint_ClearOUT() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the setup OUT to - * finalize the transfer via the \ref Endpoint_ClearOUT() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for EEPROM source/destination data */ - //@{ - - /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_EStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_EStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_LE(). - * - * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_EStream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_BE(). - * - * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_EStream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE. - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE(). - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE(). - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE(). - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_EStream_BE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for PROGMEM source/destination data */ - //@{ - - /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_PStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_PStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Endpoint data stream transmission and reception management for the AVR8 microcontrollers. + * \copydetails Group_EndpointStreamRW_AVR8 + * + * \note This file should not be included directly. It is automatically included as needed by the USB driver + * dispatch header located in LUFA/Drivers/USB/USB.h. + */ + +/** \ingroup Group_EndpointStreamRW + * \defgroup Group_EndpointStreamRW_AVR8 Read/Write of Multi-Byte Streams (AVR8) + * \brief Endpoint data stream transmission and reception management for the Atmel AVR8 architecture. + * + * Functions, macros, variables, enums and types related to data reading and writing of data streams from + * and to endpoints. + * + * @{ + */ + +#ifndef __ENDPOINT_STREAM_AVR8_H__ +#define __ENDPOINT_STREAM_AVR8_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + #include "../USBMode.h" + #include "../USBTask.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_USB_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Function Prototypes: */ + /** \name Stream functions for null data */ + //@{ + + /** Reads and discards the given number of bytes from the currently selected endpoint's bank, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes empty while there is still data to process (and after the current + * packet has been acknowledged) the BytesProcessed location will be updated with the total number + * of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Length Number of bytes to discard via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending + * full packets to the host as needed. The last packet is not automatically sent once the + * remaining bytes have been written; the user is responsible for manually sending the last + * packet to the host via the \ref Endpoint_ClearIN() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes full while there is still data to process (and after the current + * packet transmission has been initiated) the BytesProcessed location will be updated with the + * total number of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Length Number of zero bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + //@} + + /** \name Stream functions for RAM source/destination data */ + //@{ + + /** Writes the given number of bytes to the endpoint from the given buffer in little endian, + * sending full packets to the host as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Endpoint_ClearIN() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes full while there is still data to process (and after the current + * packet transmission has been initiated) the BytesProcessed location will be updated with the + * total number of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Stream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the endpoint from the given buffer in big endian, + * sending full packets to the host as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Endpoint_ClearIN() macro. + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Stream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the endpoint from the given buffer in little endian, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes empty while there is still data to process (and after the current + * packet has been acknowledged) the BytesProcessed location will be updated with the total number + * of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Stream_LE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the endpoint from the given buffer in big endian, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Stream_BE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, + * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared + * in both failure and success states; the user is responsible for manually clearing the status OUT packet + * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, + * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared + * in both failure and success states; the user is responsible for manually clearing the status OUT packet + * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, + * discarding fully read packets from the host as needed. The device IN acknowledgement is not + * automatically sent after success or failure states; the user is responsible for manually sending the + * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, + * discarding fully read packets from the host as needed. The device IN acknowledgement is not + * automatically sent after success or failure states; the user is responsible for manually sending the + * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /** \name Stream functions for EEPROM source/destination data */ + //@{ + + /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_EStream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_EStream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_LE(). + * + * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_EStream_LE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_BE(). + * + * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_EStream_BE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE. + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE(). + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE(). + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE(). + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_EStream_BE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /** \name Stream functions for PROGMEM source/destination data */ + //@{ + + /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_PStream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_PStream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h index 056981a27..57d9b0d43 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h @@ -202,7 +202,12 @@ const uint16_t Size, const uint8_t Banks) { - return Endpoint_ConfigureEndpoint_Prv((Address & ENDPOINT_EPNUM_MASK), + uint8_t Number = (Address & ENDPOINT_EPNUM_MASK); + + if (Number >= ENDPOINT_TOTAL_ENDPOINTS) + return false; + + return Endpoint_ConfigureEndpoint_Prv(Number, ((Type << EPTYPE0) | ((Address & ENDPOINT_DIR_IN) ? (1 << EPDIR) : 0)), ((1 << ALLOC) | ((Banks > 1) ? (1 << EPBK0) : 0) | Endpoint_BytesToEPSizeMask(Size))); } diff --git a/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c index e71a7bd32..3d80a33f9 100644 --- a/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c @@ -1,221 +1,221 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#include "PipeStream_AVR8.h" - -uint8_t Pipe_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - Pipe_SetPipeToken(PIPE_TOKEN_IN); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearIN(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return PIPE_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - } - else - { - Pipe_Discard_8(); - - Length--; - BytesInTransfer++; - } - } - - return PIPE_RWSTREAM_NoError; -} - -uint8_t Pipe_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - Pipe_SetPipeToken(PIPE_TOKEN_OUT); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearOUT(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return PIPE_RWSTREAM_IncompleteTransfer; - } - - USB_USBTask(); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - } - else - { - Pipe_Write_8(0); - - Length--; - BytesInTransfer++; - } - } - - return PIPE_RWSTREAM_NoError; -} - -/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, - * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ - -#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(pgm_read_byte(BufferPtr)) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(pgm_read_byte(BufferPtr)) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(eeprom_read_byte(BufferPtr)) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(eeprom_read_byte(BufferPtr)) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Pipe_Read_8()) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Pipe_Read_8()) -#include "Template/Template_Pipe_RW.c" - -#endif - -#endif - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_AVR8) + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBMode.h" + +#if defined(USB_CAN_BE_HOST) + +#include "PipeStream_AVR8.h" + +uint8_t Pipe_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + Pipe_SetPipeToken(PIPE_TOKEN_IN); + + if ((ErrorCode = Pipe_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Pipe_IsReadWriteAllowed())) + { + Pipe_ClearIN(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return PIPE_RWSTREAM_IncompleteTransfer; + } + + if ((ErrorCode = Pipe_WaitUntilReady())) + return ErrorCode; + } + else + { + Pipe_Discard_8(); + + Length--; + BytesInTransfer++; + } + } + + return PIPE_RWSTREAM_NoError; +} + +uint8_t Pipe_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + Pipe_SetPipeToken(PIPE_TOKEN_OUT); + + if ((ErrorCode = Pipe_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Pipe_IsReadWriteAllowed())) + { + Pipe_ClearOUT(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return PIPE_RWSTREAM_IncompleteTransfer; + } + + USB_USBTask(); + + if ((ErrorCode = Pipe_WaitUntilReady())) + return ErrorCode; + } + else + { + Pipe_Write_8(0); + + Length--; + BytesInTransfer++; + } + } + + return PIPE_RWSTREAM_NoError; +} + +/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, + * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ + +#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_LE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_TOKEN PIPE_TOKEN_OUT +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_BE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_TOKEN PIPE_TOKEN_OUT +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_LE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_TOKEN PIPE_TOKEN_IN +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_BE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_TOKEN PIPE_TOKEN_IN +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_LE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_TOKEN PIPE_TOKEN_OUT +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(pgm_read_byte(BufferPtr)) +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_BE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_TOKEN PIPE_TOKEN_OUT +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(pgm_read_byte(BufferPtr)) +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_LE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_TOKEN PIPE_TOKEN_OUT +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(eeprom_read_byte(BufferPtr)) +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_BE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_TOKEN PIPE_TOKEN_OUT +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(eeprom_read_byte(BufferPtr)) +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_LE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_TOKEN PIPE_TOKEN_IN +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Pipe_Read_8()) +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_BE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_TOKEN PIPE_TOKEN_IN +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Pipe_Read_8()) +#include "Template/Template_Pipe_RW.c" + +#endif + +#endif + diff --git a/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h index 53316f2f9..f69469f28 100644 --- a/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h @@ -1,442 +1,442 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Pipe data stream transmission and reception management for the AVR8 microcontrollers - * \copydetails Group_PipeStreamRW_AVR8 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_PipeStreamRW - * \defgroup Group_PipeStreamRW_AVR8 Read/Write of Multi-Byte Streams (AVR8) - * \brief Pipe data stream transmission and reception management for the Atmel AVR8 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to pipes. - * - * @{ - */ - -#ifndef __PIPE_STREAM_AVR8_H__ -#define __PIPE_STREAM_AVR8_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Function Prototypes: */ - /** \name Stream functions for null data */ - //@{ - - /** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host - * as needed. The last packet is not automatically discarded once the remaining bytes has been read; the - * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or - * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer - * will instead be performed as a series of chunks. Each time the pipe bank becomes empty while there is still data - * to process (and after the current packet has been acknowledged) the BytesProcessed location will be updated with - * the total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to - * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed - * value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Discard_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Discard_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Length Number of bytes to discard via the currently selected pipe. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be processed at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - /** Writes a given number of zeroed bytes to the pipe, sending full pipe packets from the host to the device - * as needed. The last packet is not automatically sent once the remaining bytes has been written; the - * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or - * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer - * will instead be performed as a series of chunks. Each time the pipe bank becomes full while there is still data - * to process (and after the current packet transmission has been initiated) the BytesProcessed location will be - * updated with the total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to - * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed - * value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Null_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Null_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Length Number of zero bytes to write via the currently selected pipe. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be processed at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - //@} - - /** \name Stream functions for RAM source/destination data */ - //@{ - - /** Writes the given number of bytes to the pipe from the given buffer in little endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the pipe bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_Stream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the pipe from the given buffer in big endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_Stream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the pipe into the given buffer in little endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the pipe bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_Stream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the pipe into the given buffer in big endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_Stream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for EEPROM source/destination data */ - //@{ - - /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_EStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_EStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_EStream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_EStream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for PROGMEM source/destination data */ - //@{ - - /** FLASH buffer source version of \ref Pipe_Write_Stream_LE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_PStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Pipe_Write_Stream_BE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_PStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Pipe data stream transmission and reception management for the AVR8 microcontrollers + * \copydetails Group_PipeStreamRW_AVR8 + * + * \note This file should not be included directly. It is automatically included as needed by the USB driver + * dispatch header located in LUFA/Drivers/USB/USB.h. + */ + +/** \ingroup Group_PipeStreamRW + * \defgroup Group_PipeStreamRW_AVR8 Read/Write of Multi-Byte Streams (AVR8) + * \brief Pipe data stream transmission and reception management for the Atmel AVR8 architecture. + * + * Functions, macros, variables, enums and types related to data reading and writing of data streams from + * and to pipes. + * + * @{ + */ + +#ifndef __PIPE_STREAM_AVR8_H__ +#define __PIPE_STREAM_AVR8_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + #include "../USBMode.h" + #include "../USBTask.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_USB_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Function Prototypes: */ + /** \name Stream functions for null data */ + //@{ + + /** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host + * as needed. The last packet is not automatically discarded once the remaining bytes has been read; the + * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearIN() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or + * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer + * will instead be performed as a series of chunks. Each time the pipe bank becomes empty while there is still data + * to process (and after the current packet has been acknowledged) the BytesProcessed location will be updated with + * the total number of bytes processed in the stream, and the function will exit with an error code of + * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to + * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed + * value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Pipe_Discard_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Pipe_Discard_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[in] Length Number of bytes to discard via the currently selected pipe. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be processed at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + /** Writes a given number of zeroed bytes to the pipe, sending full pipe packets from the host to the device + * as needed. The last packet is not automatically sent once the remaining bytes has been written; the + * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearOUT() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or + * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer + * will instead be performed as a series of chunks. Each time the pipe bank becomes full while there is still data + * to process (and after the current packet transmission has been initiated) the BytesProcessed location will be + * updated with the total number of bytes processed in the stream, and the function will exit with an error code of + * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to + * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed + * value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Pipe_Null_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Pipe_Null_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[in] Length Number of zero bytes to write via the currently selected pipe. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be processed at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + //@} + + /** \name Stream functions for RAM source/destination data */ + //@{ + + /** Writes the given number of bytes to the pipe from the given buffer in little endian, + * sending full packets to the device as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is + * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the pipe bank becomes full while there is still data to process (and after the current + * packet transmission has been initiated) the BytesProcessed location will be updated with the + * total number of bytes processed in the stream, and the function will exit with an error code of + * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Write_Stream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the pipe from the given buffer in big endian, + * sending full packets to the device as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is + * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Write_Stream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the pipe into the given buffer in little endian, + * sending full packets to the device as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is + * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the pipe bank becomes empty while there is still data to process (and after the current + * packet has been acknowledged) the BytesProcessed location will be updated with the total number + * of bytes processed in the stream, and the function will exit with an error code of + * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[out] Buffer Pointer to the source data buffer to write to. + * \param[in] Length Number of bytes to read for the currently selected pipe to read from. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Read_Stream_LE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the pipe into the given buffer in big endian, + * sending full packets to the device as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is + * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[out] Buffer Pointer to the source data buffer to write to. + * \param[in] Length Number of bytes to read for the currently selected pipe to read from. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Read_Stream_BE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /** \name Stream functions for EEPROM source/destination data */ + //@{ + + /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Write_EStream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Write_EStream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE(). + * + * \param[out] Buffer Pointer to the source data buffer to write to. + * \param[in] Length Number of bytes to read for the currently selected pipe to read from. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Read_EStream_LE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE(). + * + * \param[out] Buffer Pointer to the source data buffer to write to. + * \param[in] Length Number of bytes to read for the currently selected pipe to read from. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Read_EStream_BE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /** \name Stream functions for PROGMEM source/destination data */ + //@{ + + /** FLASH buffer source version of \ref Pipe_Write_Stream_LE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Write_PStream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** FLASH buffer source version of \ref Pipe_Write_Stream_BE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Write_PStream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c index 1ddffb51e..b64370835 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c @@ -66,6 +66,9 @@ bool Pipe_ConfigurePipe(const uint8_t Address, uint8_t Number = (Address & PIPE_EPNUM_MASK); uint8_t Token = (Address & PIPE_DIR_IN) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT; + if (Number >= PIPE_TOTAL_PIPES) + return false; + if (Type == EP_TYPE_CONTROL) Token = PIPE_TOKEN_SETUP; diff --git a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h index 330dd9814..8106988d2 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h @@ -215,7 +215,7 @@ * from the \ref USB_Modes_t enum. * * \param[in] Options Mask indicating the options which should be used when initializing the USB - * interface to control the USB interface's behaviour. This should be comprised of + * interface to control the USB interface's behavior. This should be comprised of * a \c USB_OPT_REG_* mask to control the regulator, a \c USB_OPT_*_PLL mask to control the * PLL, and a \c USB_DEVICE_OPT_* mask (when the device mode is enabled) to set the device * mode speed. diff --git a/LUFA/Drivers/USB/Core/ConfigDescriptor.c b/LUFA/Drivers/USB/Core/ConfigDescriptors.c similarity index 99% rename from LUFA/Drivers/USB/Core/ConfigDescriptor.c rename to LUFA/Drivers/USB/Core/ConfigDescriptors.c index 5bdcdc663..47332d854 100644 --- a/LUFA/Drivers/USB/Core/ConfigDescriptor.c +++ b/LUFA/Drivers/USB/Core/ConfigDescriptors.c @@ -29,7 +29,7 @@ */ #define __INCLUDE_FROM_USB_DRIVER -#include "ConfigDescriptor.h" +#include "ConfigDescriptors.h" #if defined(USB_CAN_BE_HOST) uint8_t USB_Host_GetDeviceConfigDescriptor(const uint8_t ConfigNumber, diff --git a/LUFA/Drivers/USB/Core/ConfigDescriptor.h b/LUFA/Drivers/USB/Core/ConfigDescriptors.h similarity index 99% rename from LUFA/Drivers/USB/Core/ConfigDescriptor.h rename to LUFA/Drivers/USB/Core/ConfigDescriptors.h index 22e76cba9..97fb39b57 100644 --- a/LUFA/Drivers/USB/Core/ConfigDescriptor.h +++ b/LUFA/Drivers/USB/Core/ConfigDescriptors.h @@ -213,7 +213,7 @@ * function. The routine updates the position and remaining configuration descriptor bytes values * automatically. If a comparator routine fails a search, the descriptor pointer is retreated back * so that the next descriptor search invocation will start from the descriptor which first caused the - * original search to fail. This behaviour allows for one comparator to be used immediately after another + * original search to fail. This behavior allows for one comparator to be used immediately after another * has failed, starting the second search from the descriptor which failed the first. * * Comparator functions should be standard functions which accept a pointer to the header of the current diff --git a/LUFA/Drivers/USB/Core/Events.h b/LUFA/Drivers/USB/Core/Events.h index 8d627d4f2..f468b7e65 100644 --- a/LUFA/Drivers/USB/Core/Events.h +++ b/LUFA/Drivers/USB/Core/Events.h @@ -189,7 +189,7 @@ * \note For the microcontrollers with limited USB controller functionality, VBUS sensing is not available. * this means that the current connection state is derived from the bus suspension and wake up events by default, * which is not always accurate (host may suspend the bus while still connected). If the actual connection state - * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by + * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behavior turned off by * passing the \c NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. * \n\n @@ -207,7 +207,7 @@ * \note For the microcontrollers with limited USB controllers, VBUS sense is not available to the USB controller. * this means that the current connection state is derived from the bus suspension and wake up events by default, * which is not always accurate (host may suspend the bus while still connected). If the actual connection state - * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by + * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behavior turned off by * passing the \c NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. * \n\n diff --git a/LUFA/Drivers/USB/Core/HostStandardReq.h b/LUFA/Drivers/USB/Core/HostStandardReq.h index 5bdfe45ef..6ad0d2e58 100644 --- a/LUFA/Drivers/USB/Core/HostStandardReq.h +++ b/LUFA/Drivers/USB/Core/HostStandardReq.h @@ -91,7 +91,7 @@ /* Global Variables: */ /** Indicates the currently set configuration number of the attached device. This indicates the currently - * selected configuration value if one has been set sucessfully, or 0 if no configuration has been selected. + * selected configuration value if one has been set successfully, or 0 if no configuration has been selected. * * To set a device configuration, call the \ref USB_Host_SetDeviceConfiguration() function. * diff --git a/LUFA/Drivers/USB/Core/StdDescriptors.h b/LUFA/Drivers/USB/Core/StdDescriptors.h index c46129c48..031e01d28 100644 --- a/LUFA/Drivers/USB/Core/StdDescriptors.h +++ b/LUFA/Drivers/USB/Core/StdDescriptors.h @@ -105,7 +105,7 @@ /** \name USB Configuration Descriptor Attribute Masks */ //@{ /** Mask for the reserved bit in the Configuration Descriptor's \c ConfigAttributes field, which must be set on all - * devices for historial purposes. + * devices for historical purposes. */ #define USB_CONFIG_ATTR_RESERVED 0x80 diff --git a/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c b/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c index b4e130e74..515461065 100644 --- a/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c @@ -1,235 +1,235 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_UC3) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "EndpointStream_UC3.h" - -#if !defined(CONTROL_ONLY_DEVICE) -uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearOUT(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Discard_8(); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearIN(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Write_8(0); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, - * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" -#endif - -#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" -#endif - -#endif - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_UC3) + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#include "EndpointStream_UC3.h" + +#if !defined(CONTROL_ONLY_DEVICE) +uint8_t Endpoint_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Endpoint_IsReadWriteAllowed())) + { + Endpoint_ClearOUT(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return ENDPOINT_RWSTREAM_IncompleteTransfer; + } + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + } + else + { + Endpoint_Discard_8(); + + Length--; + BytesInTransfer++; + } + } + + return ENDPOINT_RWSTREAM_NoError; +} + +uint8_t Endpoint_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Endpoint_IsReadWriteAllowed())) + { + Endpoint_ClearIN(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return ENDPOINT_RWSTREAM_IncompleteTransfer; + } + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + } + else + { + Endpoint_Write_8(0); + + Length--; + BytesInTransfer++; + } + } + + return ENDPOINT_RWSTREAM_NoError; +} + +/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, + * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_RW.c" + +#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" +#endif + +#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE + #define TEMPLATE_BUFFER_TYPE void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE + #define TEMPLATE_BUFFER_TYPE void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_RW.c" #endif -#endif +#endif + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_Control_W.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_Control_W.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_Control_R.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_Control_R.c" + +#endif + +#endif diff --git a/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h b/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h index 40a54ee17..551cf4b18 100644 --- a/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h @@ -1,434 +1,434 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Endpoint data stream transmission and reception management for the AVR32 UC3 microcontrollers. - * \copydetails Group_EndpointStreamRW_UC3 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_EndpointStreamRW - * \defgroup Group_EndpointStreamRW_UC3 Read/Write of Multi-Byte Streams (UC3) - * \brief Endpoint data stream transmission and reception management for the Atmel AVR32 UC3 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to endpoints. - * - * @{ - */ - -#ifndef __ENDPOINT_STREAM_UC3_H__ -#define __ENDPOINT_STREAM_UC3_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Function Prototypes: */ - /** \name Stream functions for null data */ - //@{ - - /** Reads and discards the given number of bytes from the currently selected endpoint's bank, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of bytes to discard via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending - * full packets to the host as needed. The last packet is not automatically sent once the - * remaining bytes have been written; the user is responsible for manually sending the last - * packet to the host via the \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of zero bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - //@} - - /** \name Stream functions for RAM source/destination data */ - //@{ - - /** Writes the given number of bytes to the endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the setup OUT to - * finalize the transfer via the \ref Endpoint_ClearOUT() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the setup OUT to - * finalize the transfer via the \ref Endpoint_ClearOUT() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Endpoint data stream transmission and reception management for the AVR32 UC3 microcontrollers. + * \copydetails Group_EndpointStreamRW_UC3 + * + * \note This file should not be included directly. It is automatically included as needed by the USB driver + * dispatch header located in LUFA/Drivers/USB/USB.h. + */ + +/** \ingroup Group_EndpointStreamRW + * \defgroup Group_EndpointStreamRW_UC3 Read/Write of Multi-Byte Streams (UC3) + * \brief Endpoint data stream transmission and reception management for the Atmel AVR32 UC3 architecture. + * + * Functions, macros, variables, enums and types related to data reading and writing of data streams from + * and to endpoints. + * + * @{ + */ + +#ifndef __ENDPOINT_STREAM_UC3_H__ +#define __ENDPOINT_STREAM_UC3_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + #include "../USBMode.h" + #include "../USBTask.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_USB_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Function Prototypes: */ + /** \name Stream functions for null data */ + //@{ + + /** Reads and discards the given number of bytes from the currently selected endpoint's bank, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes empty while there is still data to process (and after the current + * packet has been acknowledged) the BytesProcessed location will be updated with the total number + * of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Length Number of bytes to discard via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending + * full packets to the host as needed. The last packet is not automatically sent once the + * remaining bytes have been written; the user is responsible for manually sending the last + * packet to the host via the \ref Endpoint_ClearIN() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes full while there is still data to process (and after the current + * packet transmission has been initiated) the BytesProcessed location will be updated with the + * total number of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Length Number of zero bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + //@} + + /** \name Stream functions for RAM source/destination data */ + //@{ + + /** Writes the given number of bytes to the endpoint from the given buffer in little endian, + * sending full packets to the host as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Endpoint_ClearIN() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes full while there is still data to process (and after the current + * packet transmission has been initiated) the BytesProcessed location will be updated with the + * total number of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Stream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the endpoint from the given buffer in big endian, + * sending full packets to the host as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Endpoint_ClearIN() macro. + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Stream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the endpoint from the given buffer in little endian, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes empty while there is still data to process (and after the current + * packet has been acknowledged) the BytesProcessed location will be updated with the total number + * of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Stream_LE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the endpoint from the given buffer in big endian, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Stream_BE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, + * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared + * in both failure and success states; the user is responsible for manually clearing the status OUT packet + * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, + * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared + * in both failure and success states; the user is responsible for manually clearing the status OUT packet + * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, + * discarding fully read packets from the host as needed. The device IN acknowledgement is not + * automatically sent after success or failure states; the user is responsible for manually sending the + * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, + * discarding fully read packets from the host as needed. The device IN acknowledgement is not + * automatically sent after success or failure states; the user is responsible for manually sending the + * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c index c027585a6..f0f319db3 100644 --- a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c @@ -65,7 +65,7 @@ bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table, bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, const uint32_t UECFG0Data) { - USB_Endpoint_FIFOPos[Number] = &AVR32_USBB_SLAVE[Number * 0x10000]; + USB_Endpoint_FIFOPos[Number] = &AVR32_USBB_SLAVE[Number * ENDPOINT_HSB_ADDRESS_SPACE_SIZE]; #if defined(CONTROL_ONLY_DEVICE) || defined(ORDERED_EP_CONFIG) Endpoint_SelectEndpoint(Number); diff --git a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h index a1b2a16f2..1356952b3 100644 --- a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h @@ -208,11 +208,16 @@ const uint16_t Size, const uint8_t Banks) { - return Endpoint_ConfigureEndpoint_Prv((Address & ENDPOINT_EPNUM_MASK), + uint8_t Number = (Address & ENDPOINT_EPNUM_MASK); + + if (Number >= ENDPOINT_TOTAL_ENDPOINTS) + return false; + + return Endpoint_ConfigureEndpoint_Prv(Number, (AVR32_USBB_ALLOC_MASK | - ((uint32_t)Type << AVR32_USBB_EPTYPE_OFFSET) | - ((uint32_t)(Address & ENDPOINT_DIR_IN) ? AVR32_USBB_UECFG0_EPDIR_MASK : 0) | - ((uint32_t)Banks << AVR32_USBB_EPBK_OFFSET) | + ((uint32_t)Type << AVR32_USBB_EPTYPE_OFFSET) | + ((Address & ENDPOINT_DIR_IN) ? AVR32_USBB_UECFG0_EPDIR_MASK : 0) | + ((Banks > 1) ? AVR32_USBB_UECFG0_EPBK_SINGLE : AVR32_USBB_UECFG0_EPBK_DOUBLE) | Endpoint_BytesToEPSizeMask(Size))); } diff --git a/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c b/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c index bb4cbc659..76fbfd8f5 100644 --- a/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c @@ -1,166 +1,166 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_UC3) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#include "PipeStream_UC3.h" - -uint8_t Pipe_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - Pipe_SetPipeToken(PIPE_TOKEN_IN); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearIN(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return PIPE_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - } - else - { - Pipe_Discard_8(); - - Length--; - BytesInTransfer++; - } - } - - return PIPE_RWSTREAM_NoError; -} - -uint8_t Pipe_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - Pipe_SetPipeToken(PIPE_TOKEN_OUT); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearOUT(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return PIPE_RWSTREAM_IncompleteTransfer; - } - - USB_USBTask(); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - } - else - { - Pipe_Write_8(0); - - Length--; - BytesInTransfer++; - } - } - - return PIPE_RWSTREAM_NoError; -} - -/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, - * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ - -#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() -#include "Template/Template_Pipe_RW.c" - -#endif - -#endif +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_UC3) + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBMode.h" + +#if defined(USB_CAN_BE_HOST) + +#include "PipeStream_UC3.h" + +uint8_t Pipe_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + Pipe_SetPipeToken(PIPE_TOKEN_IN); + + if ((ErrorCode = Pipe_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Pipe_IsReadWriteAllowed())) + { + Pipe_ClearIN(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return PIPE_RWSTREAM_IncompleteTransfer; + } + + if ((ErrorCode = Pipe_WaitUntilReady())) + return ErrorCode; + } + else + { + Pipe_Discard_8(); + + Length--; + BytesInTransfer++; + } + } + + return PIPE_RWSTREAM_NoError; +} + +uint8_t Pipe_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + Pipe_SetPipeToken(PIPE_TOKEN_OUT); + + if ((ErrorCode = Pipe_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Pipe_IsReadWriteAllowed())) + { + Pipe_ClearOUT(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return PIPE_RWSTREAM_IncompleteTransfer; + } + + USB_USBTask(); + + if ((ErrorCode = Pipe_WaitUntilReady())) + return ErrorCode; + } + else + { + Pipe_Write_8(0); + + Length--; + BytesInTransfer++; + } + } + + return PIPE_RWSTREAM_NoError; +} + +/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, + * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ + +#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_LE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_TOKEN PIPE_TOKEN_OUT +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_BE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_TOKEN PIPE_TOKEN_OUT +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_LE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_TOKEN PIPE_TOKEN_IN +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() +#include "Template/Template_Pipe_RW.c" + +#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_BE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_TOKEN PIPE_TOKEN_IN +#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() +#include "Template/Template_Pipe_RW.c" + +#endif + +#endif diff --git a/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h b/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h index cb8a28c86..72bf83c6c 100644 --- a/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h @@ -1,352 +1,352 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Pipe data stream transmission and reception management for the AVR32 UC3 microcontrollers. - * \copydetails Group_PipeStreamRW_UC3 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_PipeStreamRW - * \defgroup Group_PipeStreamRW_UC3 Read/Write of Multi-Byte Streams (UC3) - * \brief Pipe data stream transmission and reception management for the Atmel AVR32 UC3 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to pipes. - * - * @{ - */ - -#ifndef __PIPE_STREAM_UC3_H__ -#define __PIPE_STREAM_UC3_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Function Prototypes: */ - /** \name Stream functions for null data */ - //@{ - - /** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host - * as needed. The last packet is not automatically discarded once the remaining bytes has been read; the - * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or - * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer - * will instead be performed as a series of chunks. Each time the pipe bank becomes empty while there is still data - * to process (and after the current packet has been acknowledged) the BytesProcessed location will be updated with - * the total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to - * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed - * value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Discard_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Discard_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Length Number of bytes to discard via the currently selected pipe. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be processed at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - /** Writes a given number of zeroed bytes to the pipe, sending full pipe packets from the host to the device - * as needed. The last packet is not automatically sent once the remaining bytes has been written; the - * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or - * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer - * will instead be performed as a series of chunks. Each time the pipe bank becomes full while there is still data - * to process (and after the current packet transmission has been initiated) the BytesProcessed location will be - * updated with the total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to - * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed - * value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Null_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Null_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Length Number of zero bytes to write via the currently selected pipe. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be processed at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - //@} - - /** \name Stream functions for RAM source/destination data */ - //@{ - - /** Writes the given number of bytes to the pipe from the given buffer in little endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the pipe bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_Stream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the pipe from the given buffer in big endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_Stream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the pipe into the given buffer in little endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the pipe bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_Stream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the pipe into the given buffer in big endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_Stream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Pipe data stream transmission and reception management for the AVR32 UC3 microcontrollers. + * \copydetails Group_PipeStreamRW_UC3 + * + * \note This file should not be included directly. It is automatically included as needed by the USB driver + * dispatch header located in LUFA/Drivers/USB/USB.h. + */ + +/** \ingroup Group_PipeStreamRW + * \defgroup Group_PipeStreamRW_UC3 Read/Write of Multi-Byte Streams (UC3) + * \brief Pipe data stream transmission and reception management for the Atmel AVR32 UC3 architecture. + * + * Functions, macros, variables, enums and types related to data reading and writing of data streams from + * and to pipes. + * + * @{ + */ + +#ifndef __PIPE_STREAM_UC3_H__ +#define __PIPE_STREAM_UC3_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + #include "../USBMode.h" + #include "../USBTask.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_USB_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Function Prototypes: */ + /** \name Stream functions for null data */ + //@{ + + /** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host + * as needed. The last packet is not automatically discarded once the remaining bytes has been read; the + * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearIN() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or + * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer + * will instead be performed as a series of chunks. Each time the pipe bank becomes empty while there is still data + * to process (and after the current packet has been acknowledged) the BytesProcessed location will be updated with + * the total number of bytes processed in the stream, and the function will exit with an error code of + * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to + * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed + * value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Pipe_Discard_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Pipe_Discard_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[in] Length Number of bytes to discard via the currently selected pipe. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be processed at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + /** Writes a given number of zeroed bytes to the pipe, sending full pipe packets from the host to the device + * as needed. The last packet is not automatically sent once the remaining bytes has been written; the + * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearOUT() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or + * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer + * will instead be performed as a series of chunks. Each time the pipe bank becomes full while there is still data + * to process (and after the current packet transmission has been initiated) the BytesProcessed location will be + * updated with the total number of bytes processed in the stream, and the function will exit with an error code of + * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to + * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed + * value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Pipe_Null_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Pipe_Null_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[in] Length Number of zero bytes to write via the currently selected pipe. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be processed at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + //@} + + /** \name Stream functions for RAM source/destination data */ + //@{ + + /** Writes the given number of bytes to the pipe from the given buffer in little endian, + * sending full packets to the device as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is + * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the pipe bank becomes full while there is still data to process (and after the current + * packet transmission has been initiated) the BytesProcessed location will be updated with the + * total number of bytes processed in the stream, and the function will exit with an error code of + * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Write_Stream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the pipe from the given buffer in big endian, + * sending full packets to the device as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is + * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Write_Stream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the pipe into the given buffer in little endian, + * sending full packets to the device as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is + * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the pipe bank becomes empty while there is still data to process (and after the current + * packet has been acknowledged) the BytesProcessed location will be updated with the total number + * of bytes processed in the stream, and the function will exit with an error code of + * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != PIPE_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[out] Buffer Pointer to the source data buffer to write to. + * \param[in] Length Number of bytes to read for the currently selected pipe to read from. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Read_Stream_LE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the pipe into the given buffer in big endian, + * sending full packets to the device as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is + * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. + * + * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * + * \param[out] Buffer Pointer to the source data buffer to write to. + * \param[in] Length Number of bytes to read for the currently selected pipe to read from. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should + * updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Pipe_Read_Stream_BE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c index 787244b97..23c004db3 100644 --- a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c @@ -69,10 +69,13 @@ bool Pipe_ConfigurePipe(const uint8_t Address, uint8_t Number = (Address & PIPE_EPNUM_MASK); uint8_t Token = (Address & PIPE_DIR_IN) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT; + if (Number >= PIPE_TOTAL_PIPES) + return false; + if (Type == EP_TYPE_CONTROL) Token = PIPE_TOKEN_SETUP; - USB_Pipe_FIFOPos[Number] = &AVR32_USBB_SLAVE[Number * 0x10000]; + USB_Pipe_FIFOPos[Number] = &AVR32_USBB_SLAVE[Number * PIPE_HSB_ADDRESS_SPACE_SIZE]; #if defined(ORDERED_EP_CONFIG) Pipe_SelectPipe(Number); diff --git a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h index 0c3136e15..0d313fed6 100644 --- a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h @@ -204,7 +204,7 @@ static inline uint8_t Pipe_GetPipeDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint8_t Pipe_GetPipeDirection(void) { - return (((&AVR32_USBB.UPCFG0)[USB_Endpoint_SelectedEndpoint].ptoken == PIPE_TOKEN_OUT) ? PIPE_DIR_OUT : PIPE_DIR_IN); + return (((&AVR32_USBB.UPCFG0)[USB_Pipe_SelectedPipe].ptoken == PIPE_TOKEN_OUT) ? PIPE_DIR_OUT : PIPE_DIR_IN); } /** Returns the pipe address of the currently selected pipe. This is typically used to save the diff --git a/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c b/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c index 9e4e4a211..6a3df6e7c 100644 --- a/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c @@ -112,7 +112,7 @@ void USB_ResetInterface(void) AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].pllsel = !(USB_Options & USB_OPT_GCLK_SRC_OSC); AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].oscsel = !(USB_Options & USB_OPT_GCLK_CHANNEL_0); AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].diven = (F_USB != USB_CLOCK_REQUIRED_FREQ); - AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].div = (F_USB == USB_CLOCK_REQUIRED_FREQ) ? 0 : (uint32_t)(((F_USB / USB_CLOCK_REQUIRED_FREQ) - 1) / 2); + AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].div = (F_USB == USB_CLOCK_REQUIRED_FREQ) ? 0 : (uint32_t)((F_USB / USB_CLOCK_REQUIRED_FREQ / 2) - 1); AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].cen = true; USB_INT_DisableAllInterrupts(); diff --git a/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h b/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h index 92e245ca2..4a5d267c8 100644 --- a/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h @@ -172,7 +172,7 @@ * from the \ref USB_Modes_t enum. * * \param[in] Options Mask indicating the options which should be used when initializing the USB - * interface to control the USB interface's behaviour. This should be comprised of + * interface to control the USB interface's behavior. This should be comprised of * a \c USB_OPT_REG_* mask to control the regulator, a \c USB_OPT_*_PLL mask to control the * PLL, and a \c USB_DEVICE_OPT_* mask (when the device mode is enabled) to set the device * mode speed. diff --git a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c index 774a574f3..db804506e 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c @@ -1,275 +1,275 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_XMEGA) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "EndpointStream_XMEGA.h" - -#if !defined(CONTROL_ONLY_DEVICE) -uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearOUT(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Discard_8(); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearIN(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Write_8(0); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, - * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" -#endif - -#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" -#endif - -#endif - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - -#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" -#endif - -#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_Control_R.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_Control_R.c" -#endif - +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#include "EndpointStream_XMEGA.h" + +#if !defined(CONTROL_ONLY_DEVICE) +uint8_t Endpoint_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Endpoint_IsReadWriteAllowed())) + { + Endpoint_ClearOUT(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return ENDPOINT_RWSTREAM_IncompleteTransfer; + } + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + } + else + { + Endpoint_Discard_8(); + + Length--; + BytesInTransfer++; + } + } + + return ENDPOINT_RWSTREAM_NoError; +} + +uint8_t Endpoint_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Endpoint_IsReadWriteAllowed())) + { + Endpoint_ClearIN(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return ENDPOINT_RWSTREAM_IncompleteTransfer; + } + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + } + else + { + Endpoint_Write_8(0); + + Length--; + BytesInTransfer++; + } + } + + return ENDPOINT_RWSTREAM_NoError; +} + +/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, + * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_RW.c" + +#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" +#endif + +#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE + #define TEMPLATE_BUFFER_TYPE void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE + #define TEMPLATE_BUFFER_TYPE void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_RW.c" #endif -#endif +#endif + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_Control_W.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_Control_W.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_Control_R.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_Control_R.c" + +#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_LE + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_BE + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" +#endif + +#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_Control_R.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_Control_R.c" +#endif + +#endif + +#endif diff --git a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h index 3269d2b1d..f2fe28991 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h +++ b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h @@ -1,648 +1,648 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Endpoint data stream transmission and reception management for the AVR XMEGA microcontrollers. - * \copydetails Group_EndpointStreamRW_XMEGA - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_EndpointStreamRW - * \defgroup Group_EndpointStreamRW_XMEGA Read/Write of Multi-Byte Streams (XMEGA) - * \brief Endpoint data stream transmission and reception management for the Atmel AVR XMEGA architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to endpoints. - * - * @{ - */ - -#ifndef __ENDPOINT_STREAM_XMEGA_H__ -#define __ENDPOINT_STREAM_XMEGA_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Function Prototypes: */ - /** \name Stream functions for null data */ - //@{ - - /** Reads and discards the given number of bytes from the currently selected endpoint's bank, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of bytes to discard via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending - * full packets to the host as needed. The last packet is not automatically sent once the - * remaining bytes have been written; the user is responsible for manually sending the last - * packet to the host via the \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of zero bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - //@} - - /** \name Stream functions for RAM source/destination data */ - //@{ - - /** Writes the given number of bytes to the endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the setup OUT to - * finalize the transfer via the \ref Endpoint_ClearOUT() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the setup OUT to - * finalize the transfer via the \ref Endpoint_ClearOUT() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro. - * - * \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. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for EEPROM source/destination data */ - //@{ - - /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_EStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_EStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_LE(). - * - * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_EStream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_BE(). - * - * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_EStream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE. - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE(). - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE(). - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE(). - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_EStream_BE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for PROGMEM source/destination data */ - //@{ - - /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_PStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_PStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \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. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Endpoint data stream transmission and reception management for the AVR XMEGA microcontrollers. + * \copydetails Group_EndpointStreamRW_XMEGA + * + * \note This file should not be included directly. It is automatically included as needed by the USB driver + * dispatch header located in LUFA/Drivers/USB/USB.h. + */ + +/** \ingroup Group_EndpointStreamRW + * \defgroup Group_EndpointStreamRW_XMEGA Read/Write of Multi-Byte Streams (XMEGA) + * \brief Endpoint data stream transmission and reception management for the Atmel AVR XMEGA architecture. + * + * Functions, macros, variables, enums and types related to data reading and writing of data streams from + * and to endpoints. + * + * @{ + */ + +#ifndef __ENDPOINT_STREAM_XMEGA_H__ +#define __ENDPOINT_STREAM_XMEGA_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + #include "../USBMode.h" + #include "../USBTask.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_USB_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Function Prototypes: */ + /** \name Stream functions for null data */ + //@{ + + /** Reads and discards the given number of bytes from the currently selected endpoint's bank, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes empty while there is still data to process (and after the current + * packet has been acknowledged) the BytesProcessed location will be updated with the total number + * of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Length Number of bytes to discard via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending + * full packets to the host as needed. The last packet is not automatically sent once the + * remaining bytes have been written; the user is responsible for manually sending the last + * packet to the host via the \ref Endpoint_ClearIN() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes full while there is still data to process (and after the current + * packet transmission has been initiated) the BytesProcessed location will be updated with the + * total number of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Length Number of zero bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + //@} + + /** \name Stream functions for RAM source/destination data */ + //@{ + + /** Writes the given number of bytes to the endpoint from the given buffer in little endian, + * sending full packets to the host as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Endpoint_ClearIN() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes full while there is still data to process (and after the current + * packet transmission has been initiated) the BytesProcessed location will be updated with the + * total number of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Stream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the endpoint from the given buffer in big endian, + * sending full packets to the host as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Endpoint_ClearIN() macro. + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Stream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the endpoint from the given buffer in little endian, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes empty while there is still data to process (and after the current + * packet has been acknowledged) the BytesProcessed location will be updated with the total number + * of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Stream_LE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the endpoint from the given buffer in big endian, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Stream_BE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, + * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared + * in both failure and success states; the user is responsible for manually clearing the status OUT packet + * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, + * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared + * in both failure and success states; the user is responsible for manually clearing the status OUT packet + * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, + * discarding fully read packets from the host as needed. The device IN acknowledgement is not + * automatically sent after success or failure states; the user is responsible for manually sending the + * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, + * discarding fully read packets from the host as needed. The device IN acknowledgement is not + * automatically sent after success or failure states; the user is responsible for manually sending the + * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. + * + * \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. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /** \name Stream functions for EEPROM source/destination data */ + //@{ + + /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_EStream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_EStream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_LE(). + * + * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_EStream_LE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_BE(). + * + * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_EStream_BE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE. + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE(). + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE(). + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE(). + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_EStream_BE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /** \name Stream functions for PROGMEM source/destination data */ + //@{ + + /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_PStream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_PStream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \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. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h index 23de8fc09..3d2926c30 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h +++ b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h @@ -90,14 +90,18 @@ /* Public Interface - May be used in end-application: */ /* Macros: */ - #if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__) + #if (!defined(MAX_ENDPOINT_INDEX) && !defined(CONTROL_ONLY_DEVICE)) || defined(__DOXYGEN__) /** Total number of endpoints (including the default control endpoint at address 0) which may * be used in the device. Different USB AVR models support different amounts of endpoints, * this value reflects the maximum number of endpoints for the currently selected AVR model. */ #define ENDPOINT_TOTAL_ENDPOINTS 16 #else - #define ENDPOINT_TOTAL_ENDPOINTS 1 + #if defined(CONTROL_ONLY_DEVICE) + #define ENDPOINT_TOTAL_ENDPOINTS 1 + #else + #define ENDPOINT_TOTAL_ENDPOINTS (MAX_ENDPOINT_INDEX + 1) + #endif #endif /* Private Interface - For use in library only: */ @@ -242,8 +246,12 @@ { uint8_t EPConfigMask = (USB_EP_INTDSBL_bm | ((Banks > 1) ? USB_EP_PINGPONG_bm : 0) | Endpoint_BytesToEPSizeMask(Size)); + if ((Address & ENDPOINT_EPNUM_MASK) >= ENDPOINT_TOTAL_ENDPOINTS) + return false; + // TODO - Fix once limitations are lifted - if ((Banks > 1) || (Size > 64)) + EPConfigMask &= ~USB_EP_PINGPONG_bm; + if (Size > 64) return false; switch (Type) diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c index 844ef650f..09d4ab620 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c @@ -76,7 +76,7 @@ void USB_Init( USB.CAL1 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL1)); NVM.CMD = 0; - /* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for 8-bit AVR-GCC */ + /* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for the 8-bit AVR-GCC toochain */ USB.EPPTR = ((intptr_t)&USB_EndpointTable[1] & ~(1 << 0)); USB.CTRLA = (USB_STFRNUM_bm | ((ENDPOINT_TOTAL_ENDPOINTS - 1) << USB_MAXEP_gp)); diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h index 25402e855..e1c782db6 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h +++ b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h @@ -180,7 +180,7 @@ * from the \ref USB_Modes_t enum. * * \param[in] Options Mask indicating the options which should be used when initializing the USB - * interface to control the USB interface's behaviour. This should be comprised of + * interface to control the USB interface's behavior. This should be comprised of * a \c USB_OPT_REG_* mask to control the regulator, a \c USB_OPT_*_PLL mask to control the * PLL, and a \c USB_DEVICE_OPT_* mask (when the device mode is enabled) to set the device * mode speed. diff --git a/LUFA/Drivers/USB/USB.h b/LUFA/Drivers/USB/USB.h index 626635c8d..512f7029f 100644 --- a/LUFA/Drivers/USB/USB.h +++ b/LUFA/Drivers/USB/USB.h @@ -41,7 +41,7 @@ * * \section Sec_Dependencies Module Source Dependencies * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Core/ConfigDescriptor.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/ConfigDescriptors.c (Makefile source module name: LUFA_SRC_USB) * - LUFA/Drivers/USB/Core/DeviceStandardReq.c (Makefile source module name: LUFA_SRC_USB) * - LUFA/Drivers/USB/Core/Events.c (Makefile source module name: LUFA_SRC_USB) * - LUFA/Drivers/USB/Core/HostStandardReq.c (Makefile source module name: LUFA_SRC_USB) @@ -382,7 +382,7 @@ #include "Core/USBTask.h" #include "Core/Events.h" #include "Core/StdDescriptors.h" - #include "Core/ConfigDescriptor.h" + #include "Core/ConfigDescriptors.h" #include "Core/USBController.h" #include "Core/USBInterrupt.h" diff --git a/LUFA/Platform/Platform.h b/LUFA/Platform/Platform.h new file mode 100644 index 000000000..252436329 --- /dev/null +++ b/LUFA/Platform/Platform.h @@ -0,0 +1,80 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Architecture Specific Hardware Platform Drivers. + * + * This file is the master dispatch header file for the device-specific hardware platform drivers, for low level + * hardware configuration and management. The platform drivers are a set of drivers which are designed to provide + * a high level management layer for the various low level system functions such as clock control and interrupt + * management. + * + * User code may choose to either include this master dispatch header file to include all available platform + * driver header files for the current architecture, or may choose to only include the specific platform driver + * modules required for a particular application. + */ + +/** \defgroup Group_PlatformDrivers System Platform Drivers - LUFA/Platform/Platform.h + * \brief Hardware platform drivers. + * + * \section Sec_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - UC3 Architecture Only: LUFA/Platform/UC3/InterruptManagement.c (Makefile source module name: LUFA_SRC_PLATFORM) + * - UC3 Architecture Only: LUFA/Platform/UC3/Exception.S (Makefile source module name: LUFA_SRC_PLATFORM) + * + * \section Sec_ModDescription Module Description + * Device-specific hardware platform drivers, for low level hardware configuration and management. The platform + * drivers are a set of drivers which are designed to provide a high level management layer for the various low level + * system functions such as clock control and interrupt management. + * + * User code may choose to either include this master dispatch header file to include all available platform + * driver header files for the current architecture, or may choose to only include the specific platform driver + * modules required for a particular application. + * + * \note The exact APIs and availability of sub-modules within the platform driver group may vary depending on the + * target used - see individual target module documentation for the API specific to your target processor. + */ + +#ifndef __LUFA_PLATFORM_H__ +#define __LUFA_PLATFORM_H__ + + /* Includes: */ + #include "../Common/Common.h" + + /* Includes: */ + #if (ARCH == ARCH_UC3) + #include "UC3/ClockManagement.h" + #include "UC3/InterruptManagement.h" + #elif (ARCH == ARCH_XMEGA) + #include "XMEGA/ClockManagement.h" + #endif + +#endif + diff --git a/LUFA/Platform/UC3/ClockManagement.h b/LUFA/Platform/UC3/ClockManagement.h index 2cd96d2ec..b6b6ece27 100644 --- a/LUFA/Platform/UC3/ClockManagement.h +++ b/LUFA/Platform/UC3/ClockManagement.h @@ -72,7 +72,7 @@ #define _UC3_CLOCK_MANAGEMENT_H_ /* Includes: */ - #include + #include "../../Common/Common.h" /* Enable C linkage for C++ Compilers: */ #if defined(__cplusplus) @@ -91,16 +91,16 @@ EXOSC_MODE_8MHZ_OR_MORE = AVR32_PM_OSCCTRL0_MODE_CRYSTAL_G3, /**< External crystal oscillator equal to or faster than 8MHz. */ }; - /** Enum for the possible external oscillator statup times. */ + /** Enum for the possible external oscillator startup times. */ enum UC3_Extern_OSC_ClockStartup_t { EXOSC_START_0CLK = AVR32_PM_OSCCTRL0_STARTUP_0_RCOSC, /**< Immediate startup, no delay. */ - EXOSC_START_64CLK = AVR32_PM_OSCCTRL0_STARTUP_64_RCOSC, /**< Wait 64 clock cyles before startup for stability. */ - EXOSC_START_128CLK = AVR32_PM_OSCCTRL0_STARTUP_128_RCOSC, /**< Wait 128 clock cyles before startup for stability. */ - EXOSC_START_2048CLK = AVR32_PM_OSCCTRL0_STARTUP_2048_RCOSC, /**< Wait 2048 clock cyles before startup for stability. */ - EXOSC_START_4096CLK = AVR32_PM_OSCCTRL0_STARTUP_4096_RCOSC, /**< Wait 4096 clock cyles before startup for stability. */ - EXOSC_START_8192CLK = AVR32_PM_OSCCTRL0_STARTUP_8192_RCOSC, /**< Wait 8192 clock cyles before startup for stability. */ - EXOSC_START_16384CLK = AVR32_PM_OSCCTRL0_STARTUP_16384_RCOSC, /**< Wait 16384 clock cyles before startup for stability. */ + EXOSC_START_64CLK = AVR32_PM_OSCCTRL0_STARTUP_64_RCOSC, /**< Wait 64 clock cycles before startup for stability. */ + EXOSC_START_128CLK = AVR32_PM_OSCCTRL0_STARTUP_128_RCOSC, /**< Wait 128 clock cycles before startup for stability. */ + EXOSC_START_2048CLK = AVR32_PM_OSCCTRL0_STARTUP_2048_RCOSC, /**< Wait 2048 clock cycles before startup for stability. */ + EXOSC_START_4096CLK = AVR32_PM_OSCCTRL0_STARTUP_4096_RCOSC, /**< Wait 4096 clock cycles before startup for stability. */ + EXOSC_START_8192CLK = AVR32_PM_OSCCTRL0_STARTUP_8192_RCOSC, /**< Wait 8192 clock cycles before startup for stability. */ + EXOSC_START_16384CLK = AVR32_PM_OSCCTRL0_STARTUP_16384_RCOSC, /**< Wait 16384 clock cycles before startup for stability. */ }; /** Enum for the possible module clock sources. */ @@ -231,6 +231,12 @@ const uint32_t SourceFreq, const uint32_t Frequency) { + if (Channel >= AVR32_PM_GCLK_NUM) + return false; + + if (SourceFreq < Frequency) + return false; + switch (Source) { case CLOCK_SRC_OSC0: @@ -253,9 +259,6 @@ return false; } - if (SourceFreq < Frequency) - return false; - AVR32_PM.GCCTRL[Channel].diven = (SourceFreq > Frequency) ? true : false; AVR32_PM.GCCTRL[Channel].div = (((SourceFreq / Frequency) - 1) / 2); AVR32_PM.GCCTRL[Channel].cen = true; @@ -266,11 +269,18 @@ /** Stops the given generic clock of the UC3 microcontroller. * * \param[in] Channel Index of the generic clock to stop. + * + * \return Boolean \c true if the generic clock was sucessfully stopped, \c false if invalid parameters specified. */ - static inline void AVR32CLK_StopGenericClock(const uint8_t Channel) ATTR_ALWAYS_INLINE; - static inline void AVR32CLK_StopGenericClock(const uint8_t Channel) + static inline bool AVR32CLK_StopGenericClock(const uint8_t Channel) ATTR_ALWAYS_INLINE; + static inline bool AVR32CLK_StopGenericClock(const uint8_t Channel) { + if (Channel >= AVR32_PM_GCLK_NUM) + return false; + AVR32_PM.GCCTRL[Channel].cen = false; + + return true; } /** Sets the clock source for the main microcontroller core. The given clock source should be configured @@ -288,8 +298,11 @@ static inline bool AVR32CLK_SetCPUClockSource(const uint8_t Source, const uint32_t SourceFreq) { - AVR32_FLASHC.FCR.fws = (SourceFreq > 30000000) ? true : false; + if (SourceFreq > AVR32_PM_CPU_MAX_FREQ) + return false; + AVR32_FLASHC.FCR.fws = (SourceFreq > AVR32_FLASHC_FWS_0_MAX_FREQ) ? true : false; + switch (Source) { #if defined(AVR32_PM_MCCTRL_MCSEL_SLOW) diff --git a/LUFA/Platform/UC3/InterruptManagement.h b/LUFA/Platform/UC3/InterruptManagement.h index af99f0875..2f9ec2304 100644 --- a/LUFA/Platform/UC3/InterruptManagement.h +++ b/LUFA/Platform/UC3/InterruptManagement.h @@ -41,8 +41,8 @@ * * \section Sec_Dependencies Module Source Dependencies * The following files must be built with any user project that uses this module: - * - LUFA/Platform/UC3/InterruptManagement.c - * - LUFA/Platform/UC3/Exception.S + * - LUFA/Platform/UC3/InterruptManagement.c (Makefile source module name: LUFA_SRC_PLATFORM) + * - LUFA/Platform/UC3/Exception.S (Makefile source module name: LUFA_SRC_PLATFORM) * * \section Sec_ModDescription Module Description * Interrupt controller driver for the AVR32 UC3 microcontrollers, for the configuration of interrupt @@ -71,7 +71,7 @@ #define _UC3_INTERRUPT_MANAGEMENT_H_ /* Includes: */ - #include + #include "../../Common/Common.h" /* Enable C linkage for C++ Compilers: */ #if defined(__cplusplus) @@ -93,7 +93,7 @@ /* Public Interface - May be used in end-application: */ /* Macros: */ - /** Converts a given interrupt index into its assocated interrupt group. + /** Converts a given interrupt index into its associated interrupt group. * * \param[in] IRQIndex Index of the interrupt request to convert. * @@ -101,7 +101,7 @@ */ #define INTC_IRQ_GROUP(IRQIndex) (IRQIndex / 32) - /** Converts a given interrupt index into its assocated interrupt line. + /** Converts a given interrupt index into its associated interrupt line. * * \param[in] IRQIndex Index of the interrupt request to convert. * diff --git a/LUFA/Platform/XMEGA/ClockManagement.h b/LUFA/Platform/XMEGA/ClockManagement.h index feef8898e..c824c89fb 100644 --- a/LUFA/Platform/XMEGA/ClockManagement.h +++ b/LUFA/Platform/XMEGA/ClockManagement.h @@ -70,7 +70,7 @@ #define _XMEGA_CLOCK_MANAGEMENT_H_ /* Includes: */ - #include + #include "../../Common/Common.h" /* Enable C linkage for C++ Compilers: */ #if defined(__cplusplus) @@ -88,7 +88,7 @@ EXOSC_FREQ_16MHZ_MAX = OSC_FRQRANGE_12TO16_gc, /**< External crystal oscillator equal to or slower than 16MHz. */ }; - /** Enum for the possible external oscillator statup times. */ + /** Enum for the possible external oscillator startup times. */ enum XMEGA_Extern_OSC_ClockStartup_t { EXOSC_START_6CLK = OSC_XOSCSEL_EXTCLK_gc, /**< Wait 6 clock cycles before startup (external clock). */ @@ -141,7 +141,7 @@ * the oscillator is ready for use. * * \param[in] FreqRange Frequency range of the external oscillator, a value from \ref XMEGA_Extern_OSC_ClockFrequency_t. - * \param[in] Startup Statup time of the external oscillator, a value from \ref XMEGA_Extern_OSC_ClockStartup_t. + * \param[in] Startup Startup time of the external oscillator, a value from \ref XMEGA_Extern_OSC_ClockStartup_t. * * \return Boolean \c true if the external oscillator was successfully started, \c false if invalid parameters specified. */ @@ -347,7 +347,7 @@ * * \param[in] Source Clock source for the CPU core, a value from \ref XMEGA_System_ClockSource_t. * - * \return Boolean \c true if the CPU core clock was sucessfully altered, \c false if invalid parameters specified. + * \return Boolean \c true if the CPU core clock was successfully altered, \c false if invalid parameters specified. */ static inline bool XMEGACLK_SetCPUClockSource(const uint8_t Source) ATTR_ALWAYS_INLINE; static inline bool XMEGACLK_SetCPUClockSource(const uint8_t Source) diff --git a/LUFA/Version.h b/LUFA/Version.h index a53c3835d..78b8a69bb 100644 --- a/LUFA/Version.h +++ b/LUFA/Version.h @@ -43,10 +43,10 @@ /* Public Interface - May be used in end-application: */ /* Macros: */ /** Indicates the version number of the library, as an integer. */ - #define LUFA_VERSION_INTEGER 0x000000 + #define LUFA_VERSION_INTEGER 0x120730 /** Indicates the version number of the library, as a string. */ - #define LUFA_VERSION_STRING "000000" + #define LUFA_VERSION_STRING "120730" #endif diff --git a/LUFA/makefile b/LUFA/makefile index 3fbf7ac36..73e760b90 100644 --- a/LUFA/makefile +++ b/LUFA/makefile @@ -9,9 +9,10 @@ # Makefile for the LUFA library itself. # --------------------------------------- -LUFA_VERSION_NUM = $(shell grep LUFA_VERSION_STRING Version.h | cut -d'"' -f2) -EXCLUDE_FROM_EXPORT = Documentation DoxygenPages CodeTemplates Build *.conf *.tar *.o *.lss *.lst *.hex *.elf *.bin -DOXYGEN_OVERRIDE_PARAMS = PROJECT_NUMBER=$(LUFA_VERSION_NUM) +LUFA_VERSION_NUM := $(shell grep LUFA_VERSION_STRING Version.h | cut -d'"' -f2) +EXCLUDE_FROM_EXPORT := Documentation DoxygenPages CodeTemplates Build *.conf *.tar *.o *.d *.lss *.lst *.hex *.elf *.hex *.eep *.map *.bin + +all: export_tar: @echo Exporting LUFA library to a TAR archive... @@ -24,19 +25,26 @@ version: # Check if this is being included from a legacy or non LUFA build system makefile ifneq ($(LUFA_PATH),) - LUFA_ROOT_PATH = $(LUFA_PATH)/LUFA/ - include $(LUFA_PATH)/LUFA/Build/lufa.sources.in -else - LUFA_PATH = . - ARCH = {AVR8,UC3,XMEGA} + LUFA_ROOT_PATH = $(patsubst %/,%,$(LUFA_PATH))/LUFA/ - all: + include $(patsubst %/,%,$(LUFA_PATH))/LUFA/Build/lufa.sources.in +else + LUFA_BUILD_MODULES += MASTER + LUFA_BUILD_TARGETS += export_tar version + LUFA_PATH = . + ARCH = {AVR8,UC3,XMEGA} + DOXYGEN_OVERRIDE_PARAMS = QUIET=YES PROJECT_NUMBER=$(LUFA_VERSION_NUM) + clean: rm -f $(LUFA_SRC_ALL_FILES:%.c=%.o) + rm -f $(LUFA_SRC_ALL_FILES:%.c=%.d) rm -f $(LUFA_SRC_ALL_FILES:%.c=%.lst) - # Include LUFA build script makefiles - include Build/lufa.sources.in - include Build/lufa.doxygen.in + include Build/lufa_core.mk + include Build/lufa_sources.mk + include Build/lufa_doxygen.mk endif + + +.PHONY: all export_tar version clean \ No newline at end of file diff --git a/Maintenance/AS4Template.aps b/Maintenance/AS4Template.aps index 414a0d5f8..d18aac75d 100644 --- a/Maintenance/AS4Template.aps +++ b/Maintenance/AS4Template.aps @@ -1 +1 @@ -%TARGET%%CREATED%%CREATED%2410%CREATED%44, 18, 0, 685AVR GCC%TARGET%.elffalseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31000%FILE_LIST%defaultYESmakefileatmega128111BootloaderCDC.elfdefault\1-Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enumsdefault1C:\WinAVR-20100110\bin\avr-gcc.exeC:\WinAVR-20100110\utils\bin\make.exe%GCC_FILE_LIST% +%TARGET%%CREATED%%CREATED%2410%CREATED%44, 18, 0, 685AVR GCC%TARGET%.elffalseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31000%FILE_LIST%defaultYESmakefileatmega128111BootloaderCDC.elfdefault\1-Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enumsdefault1C:\WinAVR-20100110\bin\avr-gcc.exeC:\WinAVR-20100110\utils\bin\make.exe%GCC_FILE_LIST% diff --git a/Maintenance/makefile b/Maintenance/makefile index 41fb99107..ca3059996 100644 --- a/Maintenance/makefile +++ b/Maintenance/makefile @@ -1,91 +1,94 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -# Maintenance scripts not required by general LUFA users, used for project development purposes. - - -# Path to the root of the LUFA tree -LUFA_ROOT = ../ - -all: - -# Update all Doxygen configuration files to the latest Doxygen version - force Markdown support to be disabled -upgrade-doxygen: - @echo Upgrading Doxygen.conf files... - @for doxygen_conf in `find $(LUFA_ROOT) -name Doxygen.conf`; do \ - doxygen -u $$doxygen_conf; \ - sed "s/MARKDOWN_SUPPORT *= *YES/MARKDOWN_SUPPORT = NO/1" $$doxygen_conf > $$doxygen_conf.new; \ - sed "s/DISABLE_INDEX *= *NO/DISABLE_INDEX = YES/1" $$doxygen_conf.new > $$doxygen_conf.new2; \ - mv -u $$doxygen_conf.new2 $$doxygen_conf; \ - rm $$doxygen_conf.new; \ - done; - @echo Doxygen configuration update complete. - -# Generate AVR Studio 4 project files for each project from a template -make-as4-projects: - @echo Creating AVR Studio 4 project files for Demos... - @for project_makefile in `find $(LUFA_ROOT)/Demos $(LUFA_ROOT)/Projects $(LUFA_ROOT)/Bootloaders -name makefile*`; do \ - target_name=`grep "TARGET *=" $$project_makefile | cut -d'=' -f2 | sed 's/ //g'`; \ - target_folder=`dirname $$project_makefile`; \ - as4_date=`date "+%e-%b-%Y %H:%M:%S"`; \ - \ - if ( test -n "$$target_name" ); then \ - echo Creating AS4 project for project $$target_name; \ - \ - source_files="`basename $$project_makefile`<\/OTHERFILE>"; \ - gcc_source_files=""; \ - for c_source_file in `find $$target_folder -name *.c`; do \ - source_filename=`basename $$c_source_file`; \ - \ - source_files="$$source_files$$source_filename<\/SOURCEFILE>"; \ - gcc_source_files="$$gcc_source_files$$source_filename<\/Name>"; \ - done; \ - for c_header_file in `find $$target_folder -name *.h`; do \ - source_filename=`basename $$c_header_file`; \ - \ - source_files="$$source_files$$source_filename<\/HEADERFILE>"; \ - gcc_source_files="$$gcc_source_files$$source_filename<\/Name>"; \ - done; \ - for assembly_file in `find $$target_folder -name *.S`; do \ - source_filename=`basename $$assembly_file`; \ - \ - source_files="$$source_files$$source_filename<\/OTHERFILE>"; \ - gcc_source_files="$$gcc_source_files$$source_filename<\/Name>"; \ - done; \ - \ - sed "s/%TARGET%/$$target_name/g" AS4Template.aps > $$target_folder/$$target_name.aps.new; \ - sed "s/%CREATED%/$$as4_date/g" $$target_folder/$$target_name.aps.new > $$target_folder/$$target_name.aps.new2; \ - sed "s/%FILE_LIST%/$$source_files/g" $$target_folder/$$target_name.aps.new2 > $$target_folder/$$target_name.aps.new3; \ - sed "s/%GCC_FILE_LIST%/$$gcc_source_files/g" $$target_folder/$$target_name.aps.new3 > $$target_folder/$$target_name.aps.new4; \ - mv $$target_folder/$$target_name.aps.new4 $$target_folder/$$target_name.aps; \ - rm $$target_folder/$$target_name.aps.new $$target_folder/$$target_name.aps.new2 $$target_folder/$$target_name.aps.new3; \ - fi; \ - done; - @echo AVR Studio 4 project generation complete. - -# Check the working branch documentation, ensure no placeholder values -check-documentation-placeholders: - @echo Checking for release suitability... - @if ( grep "XXXXXX" $(LUFA_ROOT)/LUFA/DoxygenPages/*.txt > /dev/null ;); then \ - echo " ERROR: Doxygen documentation has not been updated for release!"; \ - exit 1; \ - fi; - @if ( grep "000000" $(LUFA_ROOT)/LUFA/Version.h > /dev/null ;); then \ - echo " ERROR: Version header has not been updated for release!"; \ - exit 1; \ - fi; - @echo Done. - -# Validate the working branch - compile all documentation, demos/projects/examples and run build tests -validate-branch: - make -C $(LUFA_ROOT) doxygen - make -C $(LUFA_ROOT) all - make -C $(LUFA_ROOT)/BuildTests all - -# Validate the working branch for general release, check for placeholder documentation then build and test everything -validate-release: check-documentation-placeholders validate-branch +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# + +# Maintenance scripts not required by general LUFA users, used for project development purposes. + + +# Path to the root of the LUFA tree +LUFA_ROOT := ../ + +all: + +# Update all Doxygen configuration files to the latest Doxygen version - force Markdown support to be disabled +upgrade-doxygen: + @echo Upgrading Doxygen.conf files... + @for doxygen_conf in `find $(LUFA_ROOT) -name Doxygen.conf`; do \ + doxygen -u $$doxygen_conf; \ + sed "s/MARKDOWN_SUPPORT *= *YES/MARKDOWN_SUPPORT = NO/1" $$doxygen_conf > $$doxygen_conf.new; \ + sed "s/DISABLE_INDEX *= *NO/DISABLE_INDEX = YES/1" $$doxygen_conf.new > $$doxygen_conf.new2; \ + mv -u $$doxygen_conf.new2 $$doxygen_conf; \ + rm $$doxygen_conf.new; \ + done; + @echo Doxygen configuration update complete. + +# Generate AVR Studio 4 project files for each project from a template +make-as4-projects: + @echo Creating AVR Studio 4 project files for Demos... + @for project_makefile in `find $(LUFA_ROOT)/Demos $(LUFA_ROOT)/Projects $(LUFA_ROOT)/Bootloaders -name makefile*`; do \ + target_name=`grep "TARGET *=" $$project_makefile | cut -d'=' -f2 | sed 's/ //g'`; \ + target_folder=`dirname $$project_makefile`; \ + as4_date=`date "+%-e-%b-%Y %-H:%-M:%-S"`; \ + \ + if ( test -n "$$target_name" ); then \ + echo Creating AS4 project for project $$target_name; \ + \ + source_files="`basename $$project_makefile`<\/OTHERFILE>"; \ + gcc_source_files=""; \ + for c_source_file in `find $$target_folder -name *.c`; do \ + source_filename=`basename $$c_source_file`; \ + \ + source_files="$$source_files$$source_filename<\/SOURCEFILE>"; \ + gcc_source_files="$$gcc_source_files$$source_filename<\/Name>"; \ + done; \ + for c_header_file in `find $$target_folder -name *.h`; do \ + source_filename=`basename $$c_header_file`; \ + \ + source_files="$$source_files$$source_filename<\/HEADERFILE>"; \ + gcc_source_files="$$gcc_source_files$$source_filename<\/Name>"; \ + done; \ + for assembly_file in `find $$target_folder -name *.S`; do \ + source_filename=`basename $$assembly_file`; \ + \ + source_files="$$source_files$$source_filename<\/OTHERFILE>"; \ + gcc_source_files="$$gcc_source_files$$source_filename<\/Name>"; \ + done; \ + \ + sed "s/%TARGET%/$$target_name/g" AS4Template.aps > $$target_folder/$$target_name.aps.new; \ + sed "s/%CREATED%/$$as4_date/g" $$target_folder/$$target_name.aps.new > $$target_folder/$$target_name.aps.new2; \ + sed "s/%FILE_LIST%/$$source_files/g" $$target_folder/$$target_name.aps.new2 > $$target_folder/$$target_name.aps.new3; \ + sed "s/%GCC_FILE_LIST%/$$gcc_source_files/g" $$target_folder/$$target_name.aps.new3 > $$target_folder/$$target_name.aps.new4; \ + mv $$target_folder/$$target_name.aps.new4 $$target_folder/$$target_name.aps; \ + rm $$target_folder/$$target_name.aps.new $$target_folder/$$target_name.aps.new2 $$target_folder/$$target_name.aps.new3; \ + fi; \ + done; + @echo AVR Studio 4 project generation complete. + +# Check the working branch documentation, ensure no placeholder values +check-documentation-placeholders: + @echo Checking for release suitability... + @if ( grep "XXXXXX" $(LUFA_ROOT)/LUFA/DoxygenPages/*.txt > /dev/null ;); then \ + echo " ERROR: Doxygen documentation has not been updated for release!"; \ + exit 1; \ + fi; + @if ( grep "000000" $(LUFA_ROOT)/LUFA/Version.h > /dev/null ;); then \ + echo " ERROR: Version header has not been updated for release!"; \ + exit 1; \ + fi; + @echo Done. + +# Validate the working branch - compile all documentation, demos/projects/examples and run build tests +validate-branch: + $(MAKE) -C $(LUFA_ROOT) doxygen + $(MAKE) -C $(LUFA_ROOT) all DEBUG_LEVEL=0 + $(MAKE) -C $(LUFA_ROOT)/BuildTests all + +# Validate the working branch for general release, check for placeholder documentation then build and test everything +validate-release: check-documentation-placeholders validate-branch + + +.PHONY: all upgrade-doxygen make-as4-projects check-documentation-placeholders validate-branch \ No newline at end of file diff --git a/Projects/AVRISP-MKII/AVRISPDescriptors.c b/Projects/AVRISP-MKII/AVRISPDescriptors.c index f3381e121..9ad7c1545 100644 --- a/Projects/AVRISP-MKII/AVRISPDescriptors.c +++ b/Projects/AVRISP-MKII/AVRISPDescriptors.c @@ -38,6 +38,7 @@ #include "AVRISPDescriptors.h" #if defined(RESET_TOGGLES_LIBUSB_COMPAT) || defined(__DOXYGEN__) + /** Indicates if an external reset has occurred and the compatibility mode needs to be altered */ static bool AVRISP_NeedCompatibilitySwitch ATTR_NO_INIT; /** Current AVRISP data IN endpoint address. */ @@ -207,7 +208,8 @@ uint16_t AVRISP_GetDescriptor(const uint16_t wValue, break; case DTYPE_Configuration: *DescriptorMemorySpace = MEMSPACE_RAM; - #if defined(RESET_TOGGLES_LIBUSB_COMPAT) + #if defined(RESET_TOGGLES_LIBUSB_COMPAT) + /* Update the configuration descriptor with the current endpoint address */ AVRISP_ConfigurationDescriptor.AVRISP_DataInEndpoint.EndpointAddress = AVRISP_CurrDataINEndpointAddress; #endif @@ -253,7 +255,7 @@ uint16_t AVRISP_GetDescriptor(const uint16_t wValue, */ void CheckExternalReset(void) { - /* If an external reset occured, we need to change compatibility mode */ + /* If an external reset occurred, we need to change compatibility mode */ AVRISP_NeedCompatibilitySwitch = (MCUSR == (1 << EXTRF)); MCUSR = 0; @@ -307,5 +309,7 @@ void UpdateCurrentCompatibilityMode(void) } break; } + + Delay_MS(500); } #endif diff --git a/Projects/AVRISP-MKII/AVRISPDescriptors.h b/Projects/AVRISP-MKII/AVRISPDescriptors.h index 2779e0839..a14515d5e 100644 --- a/Projects/AVRISP-MKII/AVRISPDescriptors.h +++ b/Projects/AVRISP-MKII/AVRISPDescriptors.h @@ -41,6 +41,8 @@ #include #include + + #include "Config/AppConfig.h" /* Preprocessor Checks: */ #if defined(LIBUSB_DRIVER_COMPAT) && defined(RESET_TOGGLES_LIBUSB_COMPAT) diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c index b77c18058..6bf74c872 100644 --- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c +++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c @@ -361,7 +361,7 @@ uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode, } /* Program complete - reset timeout */ - wdt_reset(); + TimeoutTicksRemaining = COMMAND_TIMEOUT_TICKS; return ProgrammingStatus; } diff --git a/Projects/AVRISP-MKII/makefile b/Projects/AVRISP-MKII/makefile index fd829964f..ffc00b919 100644 --- a/Projects/AVRISP-MKII/makefile +++ b/Projects/AVRISP-MKII/makefile @@ -18,7 +18,7 @@ OPTIMIZATION = s TARGET = AVRISP-MKII SRC = $(TARGET).c AVRISPDescriptors.c Lib/V2Protocol.c Lib/V2ProtocolParams.c Lib/ISP/ISPProtocol.c Lib/ISP/ISPTarget.c Lib/XPROG/XPROGProtocol.c \ Lib/XPROG/XPROGTarget.c Lib/XPROG/XMEGANVM.c Lib/XPROG/TINYNVM.c $(LUFA_SRC_USB) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -26,9 +26,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/Benito/Benito Programmer.inf b/Projects/Benito/Benito Programmer.inf index f7caaa7af..81cd6808c 100644 --- a/Projects/Benito/Benito Programmer.inf +++ b/Projects/Benito/Benito Programmer.inf @@ -1,78 +1,36 @@ ;************************************************************ ; Windows USB CDC ACM Setup File ; Copyright (c) 2000 Microsoft Corporation - +;************************************************************ [Version] Signature="$Windows NT$" Class=Ports ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} Provider=%MFGNAME% -LayoutFile=layout.inf -CatalogFile=%MFGFILENAME%.cat -DriverVer=11/15/2007,5.1.2600.0 +DriverVer=7/1/2012,10.0.0.0 [Manufacturer] -%MFGNAME%=DeviceList, NTamd64 - -[DestinationDirs] -DefaultDestDir=12 - - -;------------------------------------------------------------------------------ -; Windows 2000/XP/Vista-32bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.nt] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.nt -AddReg=DriverInstall.nt.AddReg - -[DriverCopyFiles.nt] -usbser.sys,,,0x20 - -[DriverInstall.nt.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 -[DriverInstall.nt.Services] -AddService=usbser, 0x00000002, DriverService.nt - -[DriverService.nt] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys - -;------------------------------------------------------------------------------ -; Vista-64bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.NTamd64] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.NTamd64 -AddReg=DriverInstall.NTamd64.AddReg +[SourceDisksNames] -[DriverCopyFiles.NTamd64] -%DRIVERFILENAME%.sys,,,0x20 +[SourceDisksFiles] -[DriverInstall.NTamd64.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +[DestinationDirs] +DefaultDestDir=12 -[DriverInstall.NTamd64.Services] -AddService=usbser, 0x00000002, DriverService.NTamd64 +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg -[DriverService.NTamd64] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" ;------------------------------------------------------------------------------ ; Vendor and Product ID Definitions @@ -83,14 +41,14 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ; Note: One INF file can be used for multiple devices with different VID and PIDs. ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. ;------------------------------------------------------------------------------ -[SourceDisksFiles] -[SourceDisksNames] [DeviceList] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2060 [DeviceList.NTamd64] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2060 +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2060 ;------------------------------------------------------------------------------ ; String Definitions @@ -98,9 +56,5 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ;Modify these strings to customize your device ;------------------------------------------------------------------------------ [Strings] -MFGFILENAME="CDC_vista" -DRIVERFILENAME ="usbser" MFGNAME="http://www.lufa-lib.org" -INSTDISK="LUFA Benito Programmer Driver Installer" -DESCRIPTION="Communications Port" -SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file +DESCRIPTION="LUFA Benito Programmer" \ No newline at end of file diff --git a/Projects/Benito/makefile b/Projects/Benito/makefile index 174b23dc7..03419e559 100644 --- a/Projects/Benito/makefile +++ b/Projects/Benito/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = Benito SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/HIDReportViewer/makefile b/Projects/HIDReportViewer/makefile index 2ec6e8d23..e1d2fabce 100644 --- a/Projects/HIDReportViewer/makefile +++ b/Projects/HIDReportViewer/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = HIDReportViewer SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/LEDNotifier/LUFA LED Notifier.inf b/Projects/LEDNotifier/LUFA LED Notifier.inf index 3951c22d9..8890ba1ad 100644 --- a/Projects/LEDNotifier/LUFA LED Notifier.inf +++ b/Projects/LEDNotifier/LUFA LED Notifier.inf @@ -1,78 +1,36 @@ ;************************************************************ ; Windows USB CDC ACM Setup File ; Copyright (c) 2000 Microsoft Corporation - +;************************************************************ [Version] Signature="$Windows NT$" Class=Ports ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} Provider=%MFGNAME% -LayoutFile=layout.inf -CatalogFile=%MFGFILENAME%.cat -DriverVer=11/15/2007,5.1.2600.0 +DriverVer=7/1/2012,10.0.0.0 [Manufacturer] -%MFGNAME%=DeviceList, NTamd64 - -[DestinationDirs] -DefaultDestDir=12 - - -;------------------------------------------------------------------------------ -; Windows 2000/XP/Vista-32bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.nt] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.nt -AddReg=DriverInstall.nt.AddReg - -[DriverCopyFiles.nt] -usbser.sys,,,0x20 - -[DriverInstall.nt.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 -[DriverInstall.nt.Services] -AddService=usbser, 0x00000002, DriverService.nt - -[DriverService.nt] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys - -;------------------------------------------------------------------------------ -; Vista-64bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.NTamd64] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.NTamd64 -AddReg=DriverInstall.NTamd64.AddReg +[SourceDisksNames] -[DriverCopyFiles.NTamd64] -%DRIVERFILENAME%.sys,,,0x20 +[SourceDisksFiles] -[DriverInstall.NTamd64.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +[DestinationDirs] +DefaultDestDir=12 -[DriverInstall.NTamd64.Services] -AddService=usbser, 0x00000002, DriverService.NTamd64 +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg -[DriverService.NTamd64] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" ;------------------------------------------------------------------------------ ; Vendor and Product ID Definitions @@ -83,14 +41,14 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ; Note: One INF file can be used for multiple devices with different VID and PIDs. ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. ;------------------------------------------------------------------------------ -[SourceDisksFiles] -[SourceDisksNames] [DeviceList] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044 [DeviceList.NTamd64] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044 +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2044 ;------------------------------------------------------------------------------ ; String Definitions @@ -98,9 +56,5 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ;Modify these strings to customize your device ;------------------------------------------------------------------------------ [Strings] -MFGFILENAME="CDC_vista" -DRIVERFILENAME ="usbser" MFGNAME="http://www.lufa-lib.org" -INSTDISK="LUFA CDC Driver Installer" -DESCRIPTION="Communications Port" -SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file +DESCRIPTION="LUFA CDC-ACM Virtual Serial Port" \ No newline at end of file diff --git a/Projects/LEDNotifier/makefile b/Projects/LEDNotifier/makefile index 5839d6fc8..80836fff1 100644 --- a/Projects/LEDNotifier/makefile +++ b/Projects/LEDNotifier/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = LEDNotifier SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/MIDIToneGenerator/makefile b/Projects/MIDIToneGenerator/makefile index d3b52273d..2bd8bb520 100644 --- a/Projects/MIDIToneGenerator/makefile +++ b/Projects/MIDIToneGenerator/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MIDIToneGenerator SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/Magstripe/Lib/CircularBitBuffer.h b/Projects/Magstripe/Lib/CircularBitBuffer.h index 6a0dcd53c..d037a66de 100644 --- a/Projects/Magstripe/Lib/CircularBitBuffer.h +++ b/Projects/Magstripe/Lib/CircularBitBuffer.h @@ -71,7 +71,7 @@ } BitBuffer_t; /* Function Prototypes: */ - /** Initialises or resets a given bit buffer, ready to store new bits. + /** Initializes or resets a given bit buffer, ready to store new bits. * * \param[in,out] Buffer Bit buffer to initialize */ diff --git a/Projects/Magstripe/Lib/MagstripeHW.h b/Projects/Magstripe/Lib/MagstripeHW.h index 177e26b01..43e34443c 100644 --- a/Projects/Magstripe/Lib/MagstripeHW.h +++ b/Projects/Magstripe/Lib/MagstripeHW.h @@ -77,7 +77,7 @@ /* Public Interface - May be used in end-application: */ /* Inline Functions: */ - /** Initialises the magnetic stripe card reader ports and pins so that the card reader + /** Initializes the magnetic stripe card reader ports and pins so that the card reader * device can be controlled and read by the card reader driver. This must be called before * trying to read any of the card reader's status lines. */ diff --git a/Projects/Magstripe/makefile b/Projects/Magstripe/makefile index ae16e7175..246deaf91 100644 --- a/Projects/Magstripe/makefile +++ b/Projects/Magstripe/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = Magstripe SRC = $(TARGET).c Descriptors.c Lib/CircularBitBuffer.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/MediaController/makefile b/Projects/MediaController/makefile index a87a75760..e7507847c 100644 --- a/Projects/MediaController/makefile +++ b/Projects/MediaController/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MediaController SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/MissileLauncher/makefile b/Projects/MissileLauncher/makefile index aac925450..58bb8f313 100644 --- a/Projects/MissileLauncher/makefile +++ b/Projects/MissileLauncher/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = MissileLauncher SRC = $(TARGET).c ConfigDescriptor.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/RelayBoard/makefile b/Projects/RelayBoard/makefile index d4b40b777..02767fff2 100644 --- a/Projects/RelayBoard/makefile +++ b/Projects/RelayBoard/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = RelayBoard SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/SerialToLCD/Lib/HD44780.c b/Projects/SerialToLCD/Lib/HD44780.c index 7bf989d2c..0ffe7c475 100644 --- a/Projects/SerialToLCD/Lib/HD44780.c +++ b/Projects/SerialToLCD/Lib/HD44780.c @@ -104,7 +104,7 @@ static void HD44780_PowerUp4Bit(void) _delay_us(50); } -void HD44780_Initialise(void) +void HD44780_Initialize(void) { PORTD &= ~ALL_BITS; DDRD |= ALL_BITS; diff --git a/Projects/SerialToLCD/Lib/HD44780.h b/Projects/SerialToLCD/Lib/HD44780.h index 680e69bcf..165e32aab 100644 --- a/Projects/SerialToLCD/Lib/HD44780.h +++ b/Projects/SerialToLCD/Lib/HD44780.h @@ -57,7 +57,7 @@ #define CMD_DISPLAY_ON 0x0C /* Function Prototypes: */ - void HD44780_Initialise(void); + void HD44780_Initialize(void); void HD44780_WriteData(const uint8_t c); void HD44780_WriteCommand(const uint8_t c); diff --git a/Projects/SerialToLCD/SerialToLCD.c b/Projects/SerialToLCD/SerialToLCD.c index 952e2d4f2..b94c5a4a2 100644 --- a/Projects/SerialToLCD/SerialToLCD.c +++ b/Projects/SerialToLCD/SerialToLCD.c @@ -148,7 +148,7 @@ void SetupHardware(void) USB_Init(); /* Power up the HD44780 Interface */ - HD44780_Initialise(); + HD44780_Initialize(); HD44780_WriteCommand(CMD_DISPLAY_ON); /* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */ diff --git a/Projects/SerialToLCD/SerialToLCD.txt b/Projects/SerialToLCD/SerialToLCD.txt index 8058ee52d..cb30b6bc2 100644 --- a/Projects/SerialToLCD/SerialToLCD.txt +++ b/Projects/SerialToLCD/SerialToLCD.txt @@ -1,97 +1,97 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \mainpage Simon Foster's USB Serial to HD44780 LCD Project - * - * \section Sec_Compat Project Compatibility: - * - * The following list indicates what microcontrollers are compatible with this project. - * - * \li AT90USB162 - * - * \section Sec_Info USB Information: - * - * The following table gives a rundown of the USB utilization of this project. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
USB Mode:Device
USB Class:Communications Device Class (CDC)
USB Subclass:Abstract Control Model (ACM)
Relevant Standards:USBIF CDC Class Standard
Supported USB Speeds:Full Speed Mode
- * - * \section Sec_Description Project Description: - * - * Firmware for a USB Virtual Serial to HD44780 LCD controller project, by Simon Foster. This - * project connects a standard HD7780 compatible LCD controller to a PC via a virtual serial - * link, so that data supplied by the host can be written to the display. This project is - * designed to use the Minimum USB AVR board, however it can be modified to suit other hardware - * if desired. - * - * LCD Datasheet: http://www.sparkfun.com/datasheets/LCD/HD44780.pdf \n - * More Information: http://en.wikipedia.org/wiki/HD44780_Character_LCD \n - * - * Below are the connections between the AVR Minimus board and LCD. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
AVR Pin:HD44780 LCD Pin:
VCCVCC
GNDGND
PD0DB4
PD1DB5
PD2DB6
PD3DB7
PD4/RS
GND/RW
PD7/E
- */ +/** \file + * + * This file contains special DoxyGen information for the generation of the main page and other special + * documentation pages. It is not a project source file. + */ + +/** \mainpage Simon Foster's USB Serial to HD44780 LCD Project + * + * \section Sec_Compat Project Compatibility: + * + * The following list indicates what microcontrollers are compatible with this project. + * + * \li AT90USB162 + * + * \section Sec_Info USB Information: + * + * The following table gives a rundown of the USB utilization of this project. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
USB Mode:Device
USB Class:Communications Device Class (CDC)
USB Subclass:Abstract Control Model (ACM)
Relevant Standards:USBIF CDC Class Standard
Supported USB Speeds:Full Speed Mode
+ * + * \section Sec_Description Project Description: + * + * Firmware for a USB Virtual Serial to HD44780 LCD controller project, by Simon Foster. This + * project connects a standard HD7780 compatible LCD controller to a PC via a virtual serial + * link, so that data supplied by the host can be written to the display. This project is + * designed to use the Minimum USB AVR board, however it can be modified to suit other hardware + * if desired. + * + * LCD Datasheet: http://www.sparkfun.com/datasheets/LCD/HD44780.pdf \n + * More Information: http://en.wikipedia.org/wiki/HD44780_Character_LCD \n + * + * Below are the connections between the AVR Minimus board and LCD. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
AVR Pin:HD44780 LCD Pin:
VCCVCC
GNDGND
PD0DB4
PD1DB5
PD2DB6
PD3DB7
PD4/RS
GND/RW
PD7/E
+ */ diff --git a/Projects/SerialToLCD/makefile b/Projects/SerialToLCD/makefile index dd48194be..02f43dafa 100644 --- a/Projects/SerialToLCD/makefile +++ b/Projects/SerialToLCD/makefile @@ -1,34 +1,36 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# -# -------------------------------------- -# LUFA Project Makefile. -# -------------------------------------- - -MCU = at90usb162 -ARCH = AVR8 -BOARD = MINIMUS -F_CPU = 16000000 -F_USB = $(F_CPU) -OPTIMIZATION = s -TARGET = SerialToLCD -SRC = $(TARGET).c Descriptors.c Lib/HD44780.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../LUFA/ -C_STANDARD = gnu99 -CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -LD_FLAGS = - -# Default target -all: - -# Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# +# -------------------------------------- +# LUFA Project Makefile. +# -------------------------------------- + +MCU = at90usb162 +ARCH = AVR8 +BOARD = MINIMUS +F_CPU = 16000000 +F_USB = $(F_CPU) +OPTIMIZATION = s +TARGET = SerialToLCD +SRC = $(TARGET).c Descriptors.c Lib/HD44780.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) +LUFA_PATH = ../../LUFA +CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ +LD_FLAGS = + +# Default target +all: + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/TempDataLogger/Lib/DataflashManager.h b/Projects/TempDataLogger/Lib/DataflashManager.h index 90236260c..784ede47b 100644 --- a/Projects/TempDataLogger/Lib/DataflashManager.h +++ b/Projects/TempDataLogger/Lib/DataflashManager.h @@ -53,7 +53,7 @@ #endif /* Defines: */ - /** Total number of bytes of the storage medium, comprised of one or more dataflash ICs. */ + /** Total number of bytes of the storage medium, comprised of one or more Dataflash ICs. */ #define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS) /** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying diff --git a/Projects/TempDataLogger/TempDataLogger.c b/Projects/TempDataLogger/TempDataLogger.c index 9ead42ed3..eb63bc6a9 100644 --- a/Projects/TempDataLogger/TempDataLogger.c +++ b/Projects/TempDataLogger/TempDataLogger.c @@ -227,7 +227,7 @@ void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); - /* Close the log file so that the host has exclusive filesystem access */ + /* Close the log file so that the host has exclusive file system access */ CloseLogFile(); } diff --git a/Projects/TempDataLogger/TempLogHostApp/DataLoggerSettings.Designer.cs b/Projects/TempDataLogger/TempLogHostApp/DataLoggerSettings.Designer.cs index 7b4249c42..58fac5144 100644 --- a/Projects/TempDataLogger/TempLogHostApp/DataLoggerSettings.Designer.cs +++ b/Projects/TempDataLogger/TempLogHostApp/DataLoggerSettings.Designer.cs @@ -157,7 +157,7 @@ private void InitializeComponent() this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "frmDataloggerSettings"; - this.Text = "DataLogger"; + this.Text = "Datalogger"; this.Load += new System.EventHandler(this.frmDataloggerSettings_Load); ((System.ComponentModel.ISupportInitialize)(this.nudLogInterval)).EndInit(); this.ResumeLayout(false); diff --git a/Projects/TempDataLogger/TempLogHostApp/DataLoggerSettings.cs b/Projects/TempDataLogger/TempLogHostApp/DataLoggerSettings.cs index 98e6006ff..01e9fb6e7 100644 --- a/Projects/TempDataLogger/TempLogHostApp/DataLoggerSettings.cs +++ b/Projects/TempDataLogger/TempLogHostApp/DataLoggerSettings.cs @@ -85,7 +85,7 @@ private void btnSetValues_Click(object sender, EventArgs e) if (ConnectionHandle == null) { - MessageBox.Show("Error: Cannot connect to DataLogger device."); + MessageBox.Show("Error: Cannot connect to Datalogger device."); return; } @@ -115,7 +115,7 @@ private void btnGetValues_Click(object sender, EventArgs e) if (ConnectionHandle == null) { - MessageBox.Show("Error: Cannot connect to DataLogger device."); + MessageBox.Show("Error: Cannot connect to Datalogger device."); return; } diff --git a/Projects/TempDataLogger/TempLogHostApp/Properties/AssemblyInfo.cs b/Projects/TempDataLogger/TempLogHostApp/Properties/AssemblyInfo.cs index c6fd450c4..a4d0ab1d5 100644 --- a/Projects/TempDataLogger/TempLogHostApp/Properties/AssemblyInfo.cs +++ b/Projects/TempDataLogger/TempLogHostApp/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Dean Camera")] -[assembly: AssemblyProduct("Temp DataLogger HostApp")] +[assembly: AssemblyProduct("Temp Datalogger HostApp")] [assembly: AssemblyCopyright("Copyright © Dean Camera 2011")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Projects/TempDataLogger/makefile b/Projects/TempDataLogger/makefile index 860ff2377..40a754a85 100644 --- a/Projects/TempDataLogger/makefile +++ b/Projects/TempDataLogger/makefile @@ -18,7 +18,7 @@ OPTIMIZATION = s TARGET = TempDataLogger SRC = $(TARGET).c Descriptors.c Lib/DataflashManager.c Lib/DS1307.c Lib/SCSI.c Lib/FATFs/diskio.c Lib/FATFs/ff.c \ $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_SERIAL) $(LUFA_SRC_TWI) $(LUFA_SRC_TEMPERATURE) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -26,9 +26,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/USBtoSerial/LUFA USBtoSerial.inf b/Projects/USBtoSerial/LUFA USBtoSerial.inf index 990778367..e03ccc7a9 100644 --- a/Projects/USBtoSerial/LUFA USBtoSerial.inf +++ b/Projects/USBtoSerial/LUFA USBtoSerial.inf @@ -1,78 +1,36 @@ ;************************************************************ ; Windows USB CDC ACM Setup File ; Copyright (c) 2000 Microsoft Corporation - +;************************************************************ [Version] Signature="$Windows NT$" Class=Ports ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} Provider=%MFGNAME% -LayoutFile=layout.inf -CatalogFile=%MFGFILENAME%.cat -DriverVer=11/15/2007,5.1.2600.0 +DriverVer=7/1/2012,10.0.0.0 [Manufacturer] -%MFGNAME%=DeviceList, NTamd64 - -[DestinationDirs] -DefaultDestDir=12 - - -;------------------------------------------------------------------------------ -; Windows 2000/XP/Vista-32bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.nt] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.nt -AddReg=DriverInstall.nt.AddReg - -[DriverCopyFiles.nt] -usbser.sys,,,0x20 - -[DriverInstall.nt.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 -[DriverInstall.nt.Services] -AddService=usbser, 0x00000002, DriverService.nt - -[DriverService.nt] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys - -;------------------------------------------------------------------------------ -; Vista-64bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.NTamd64] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.NTamd64 -AddReg=DriverInstall.NTamd64.AddReg +[SourceDisksNames] -[DriverCopyFiles.NTamd64] -%DRIVERFILENAME%.sys,,,0x20 +[SourceDisksFiles] -[DriverInstall.NTamd64.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +[DestinationDirs] +DefaultDestDir=12 -[DriverInstall.NTamd64.Services] -AddService=usbser, 0x00000002, DriverService.NTamd64 +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg -[DriverService.NTamd64] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" ;------------------------------------------------------------------------------ ; Vendor and Product ID Definitions @@ -83,14 +41,14 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ; Note: One INF file can be used for multiple devices with different VID and PIDs. ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. ;------------------------------------------------------------------------------ -[SourceDisksFiles] -[SourceDisksNames] [DeviceList] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B [DeviceList.NTamd64] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B ;------------------------------------------------------------------------------ ; String Definitions @@ -98,9 +56,5 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ;Modify these strings to customize your device ;------------------------------------------------------------------------------ [Strings] -MFGFILENAME="CDC_vista" -DRIVERFILENAME ="usbser" MFGNAME="http://www.lufa-lib.org" -INSTDISK="LUFA USB-RS232 CDC Driver Installer" -DESCRIPTION="Communications Port" -SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file +DESCRIPTION="LUFA USB to Serial" \ No newline at end of file diff --git a/Projects/USBtoSerial/makefile b/Projects/USBtoSerial/makefile index 4f8cb3712..37cb2353d 100644 --- a/Projects/USBtoSerial/makefile +++ b/Projects/USBtoSerial/makefile @@ -17,7 +17,7 @@ F_USB = $(F_CPU) OPTIMIZATION = s TARGET = USBtoSerial SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ LD_FLAGS = @@ -25,9 +25,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/Webserver/Lib/DataflashManager.h b/Projects/Webserver/Lib/DataflashManager.h index af76f7f62..95a011948 100644 --- a/Projects/Webserver/Lib/DataflashManager.h +++ b/Projects/Webserver/Lib/DataflashManager.h @@ -51,7 +51,7 @@ #endif /* Defines: */ - /** Total number of bytes of the storage medium, comprised of one or more dataflash ICs. */ + /** Total number of bytes of the storage medium, comprised of one or more Dataflash ICs. */ #define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS) /** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying diff --git a/Projects/Webserver/Lib/uip/uip.c b/Projects/Webserver/Lib/uip/uip.c index 94171adad..dccefdd1c 100644 --- a/Projects/Webserver/Lib/uip/uip.c +++ b/Projects/Webserver/Lib/uip/uip.c @@ -53,7 +53,7 @@ * statement. While it would be possible to break the uip_process() * function into many smaller functions, this would increase the code * size because of the overhead of parameter passing and the fact that - * the optimiser would not be as efficient. + * the optimizer would not be as efficient. * * The principle is that we have a small buffer, called the uip_buf, * in which the device driver puts an incoming packet. The TCP/IP @@ -330,7 +330,7 @@ upper_layer_chksum(u8_t proto) upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN; #endif /* UIP_CONF_IPV6 */ - /* First sum pseudoheader. */ + /* First sum pseudo-header. */ /* IP protocol and length fields. This addition cannot carry. */ sum = upper_layer_len + proto; diff --git a/Projects/Webserver/makefile b/Projects/Webserver/makefile index 6ab89b577..28c66065a 100644 --- a/Projects/Webserver/makefile +++ b/Projects/Webserver/makefile @@ -20,7 +20,7 @@ SRC = $(TARGET).c Descriptors.c USBDeviceMode.c USBHostMode.c Lib/SCSI. Lib/uIPManagement.c Lib/DHCPCommon.c Lib/DHCPClientApp.c Lib/DHCPServerApp.c Lib/HTTPServerApp.c \ Lib/TELNETServerApp.c Lib/uip/uip.c Lib/uip/uip_arp.c Lib/uip/timer.c Lib/uip/clock.c \ Lib/uip/uip-split.c Lib/FATFs/diskio.c Lib/FATFs/ff.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -ILib/uip/ -ILib/FATFs/ LD_FLAGS = @@ -28,9 +28,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf b/Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf index 990778367..0e3e7d9c1 100644 --- a/Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf +++ b/Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf @@ -1,78 +1,36 @@ ;************************************************************ ; Windows USB CDC ACM Setup File ; Copyright (c) 2000 Microsoft Corporation - +;************************************************************ [Version] Signature="$Windows NT$" Class=Ports ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} Provider=%MFGNAME% -LayoutFile=layout.inf -CatalogFile=%MFGFILENAME%.cat -DriverVer=11/15/2007,5.1.2600.0 +DriverVer=7/1/2012,10.0.0.0 [Manufacturer] -%MFGNAME%=DeviceList, NTamd64 - -[DestinationDirs] -DefaultDestDir=12 - - -;------------------------------------------------------------------------------ -; Windows 2000/XP/Vista-32bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.nt] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.nt -AddReg=DriverInstall.nt.AddReg - -[DriverCopyFiles.nt] -usbser.sys,,,0x20 - -[DriverInstall.nt.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 -[DriverInstall.nt.Services] -AddService=usbser, 0x00000002, DriverService.nt - -[DriverService.nt] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys - -;------------------------------------------------------------------------------ -; Vista-64bit Sections -;------------------------------------------------------------------------------ - -[DriverInstall.NTamd64] -include=mdmcpq.inf -CopyFiles=DriverCopyFiles.NTamd64 -AddReg=DriverInstall.NTamd64.AddReg +[SourceDisksNames] -[DriverCopyFiles.NTamd64] -%DRIVERFILENAME%.sys,,,0x20 +[SourceDisksFiles] -[DriverInstall.NTamd64.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,%DRIVERFILENAME%.sys -HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" +[DestinationDirs] +DefaultDestDir=12 -[DriverInstall.NTamd64.Services] -AddService=usbser, 0x00000002, DriverService.NTamd64 +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg -[DriverService.NTamd64] -DisplayName=%SERVICE% -ServiceType=1 -StartType=3 -ErrorControl=1 -ServiceBinary=%12%\%DRIVERFILENAME%.sys +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" ;------------------------------------------------------------------------------ ; Vendor and Product ID Definitions @@ -83,14 +41,14 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ; Note: One INF file can be used for multiple devices with different VID and PIDs. ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. ;------------------------------------------------------------------------------ -[SourceDisksFiles] -[SourceDisksNames] [DeviceList] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B [DeviceList.NTamd64] %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B ;------------------------------------------------------------------------------ ; String Definitions @@ -98,9 +56,5 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys ;Modify these strings to customize your device ;------------------------------------------------------------------------------ [Strings] -MFGFILENAME="CDC_vista" -DRIVERFILENAME ="usbser" MFGNAME="http://www.lufa-lib.org" -INSTDISK="LUFA USB-RS232 CDC Driver Installer" -DESCRIPTION="Communications Port" -SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file +DESCRIPTION="LUFA XPLAIN Bridge" \ No newline at end of file diff --git a/Projects/XPLAINBridge/makefile b/Projects/XPLAINBridge/makefile index 76070544b..f51ada5dc 100644 --- a/Projects/XPLAINBridge/makefile +++ b/Projects/XPLAINBridge/makefile @@ -9,7 +9,7 @@ # LUFA Project Makefile. # -------------------------------------- -AVRISP_PATH = ../AVRISP-MKII/ +AVRISP_PATH = ../AVRISP-MKII MCU = at90usb1287 ARCH = AVR8 @@ -22,8 +22,7 @@ SRC = $(TARGET).c Lib/SoftUART.c USARTDescriptors.c $(AVRISP_PATH)/AVRI $(AVRISP_PATH)/Lib/V2ProtocolParams.c $(AVRISP_PATH)/Lib/ISP/ISPProtocol.c $(AVRISP_PATH)/Lib/ISP/ISPTarget.c \ $(AVRISP_PATH)/Lib/XPROG/XPROGProtocol.c $(AVRISP_PATH)/Lib/XPROG/XPROGTarget.c $(AVRISP_PATH)/Lib/XPROG/XMEGANVM.c \ $(AVRISP_PATH)/Lib/XPROG/TINYNVM.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) - -LUFA_PATH = ../../LUFA/ +LUFA_PATH = ../../LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -I$(AVRISP_PATH) LD_FLAGS = @@ -31,9 +30,12 @@ LD_FLAGS = all: # Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa.core.in -include $(LUFA_PATH)/Build/lufa.sources.in -include $(LUFA_PATH)/Build/lufa.build.in -include $(LUFA_PATH)/Build/lufa.doxygen.in -include $(LUFA_PATH)/Build/lufa.dfu.in -include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/Projects/makefile b/Projects/makefile index d507e76ee..dd0ea2e8f 100644 --- a/Projects/makefile +++ b/Projects/makefile @@ -13,35 +13,35 @@ # custom LUFA library build options are reflected in the compiled # code. -all: - $(MAKE) -s -C AVRISP-MKII clean all - $(MAKE) -s -C Benito clean all - $(MAKE) -s -C HIDReportViewer clean all - $(MAKE) -s -C LEDNotifier clean all - $(MAKE) -s -C Magstripe clean all - $(MAKE) -s -C MediaController clean all - $(MAKE) -s -C MIDIToneGenerator clean all - $(MAKE) -s -C MissileLauncher clean all - $(MAKE) -s -C RelayBoard clean all - $(MAKE) -s -C SerialToLCD clean all - $(MAKE) -s -C TempDataLogger clean all - $(MAKE) -s -C USBtoSerial clean all - $(MAKE) -s -C Webserver clean all - $(MAKE) -s -C XPLAINBridge clean all - -%: - $(MAKE) -s -C AVRISP-MKII $@ - $(MAKE) -s -C Benito $@ - $(MAKE) -s -C HIDReportViewer $@ - $(MAKE) -s -C LEDNotifier $@ - $(MAKE) -s -C Magstripe $@ - $(MAKE) -s -C MediaController $@ - $(MAKE) -s -C MIDIToneGenerator $@ - $(MAKE) -s -C MissileLauncher $@ - $(MAKE) -s -C RelayBoard $@ - $(MAKE) -s -C SerialToLCD $@ - $(MAKE) -s -C TempDataLogger $@ - $(MAKE) -s -C USBtoSerial $@ - $(MAKE) -s -C Webserver $@ - $(MAKE) -s -C XPLAINBridge $@ +PROJECT_DIRECTORIES := $(shell ls -d */) + +# This makefile is potentially infinitely recursive if something really bad +# happens when determining the set of project directories - hard-abort if +# more than 10 levels deep to avoid angry emails. +ifeq ($(MAKELEVEL), 10) + $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) +endif + +# Need to special-case building without a per-project object directory +ifeq ($(OBJDIR),) + # If no target specified, force "clean all" and disallow parallel build + ifeq ($(MAKECMDGOALS),) + MAKECMDGOALS := clean all + .NOTPARALLEL: + endif + + # If one of the targets is to build, force "clean" beforehand and disallow parallel build + ifneq ($(findstring all, $(MAKECMDGOALS)),) + MAKECMDGOALS := clean $(MAKECMDGOALS) + .NOTPARALLEL: + endif +endif + +%: $(PROJECT_DIRECTORIES) + @echo . > /dev/null + +$(PROJECT_DIRECTORIES): + @$(MAKE) -C $@ $(MAKECMDGOALS) + +.PHONY: $(PROJECT_DIRECTORIES) diff --git a/README.txt b/README.txt index 9eb14a294..80a5c81d8 100644 --- a/README.txt +++ b/README.txt @@ -13,6 +13,9 @@ LUFA is donation supported. To support LUFA, please donate at http://www.lufa-lib.org/donate + Released under a modified MIT license - see + LUFA/License.txt for license details. + For Commercial Licensing information, see http://www.lufa-lib.org/license diff --git a/makefile b/makefile index d533f25ac..a134dc0ab 100644 --- a/makefile +++ b/makefile @@ -9,17 +9,18 @@ # Makefile to build the LUFA library, projects and demos. # Call with "make all" to rebuild everything, "make clean" to clean everything, -# "make clean_list" to remove all intermediatary files but preserve any binaries, -# "make doxygen" to document everything with Doxygen (if installed) and -# "make clean_doxygen" to remove generated Doxygen documentation from everything. +# "make mostlyclean" to remove all intermediatary files but preserve any binaries, +# "make doxygen" to document everything with Doxygen (if installed). Call +# "make help" for additional target build information within a specific project. all: + %: @echo Executing \"make $@\" on all LUFA library elements. @echo - $(MAKE) -C LUFA $@ -s - $(MAKE) -C Demos $@ -s - $(MAKE) -C Projects $@ -s - $(MAKE) -C Bootloaders $@ -s + $(MAKE) -C LUFA $@ + $(MAKE) -C Demos $@ + $(MAKE) -C Projects $@ + $(MAKE) -C Bootloaders $@ @echo @echo LUFA \"make $@\" operation complete.