diff options
Diffstat (limited to 'lib/lufa/LUFA/Common')
-rw-r--r-- | lib/lufa/LUFA/Common/ArchitectureSpecific.h | 185 | ||||
-rw-r--r-- | lib/lufa/LUFA/Common/Architectures.h | 84 | ||||
-rw-r--r-- | lib/lufa/LUFA/Common/Attributes.h | 150 | ||||
-rw-r--r-- | lib/lufa/LUFA/Common/BoardTypes.h | 263 | ||||
-rw-r--r-- | lib/lufa/LUFA/Common/Common.h | 393 | ||||
-rw-r--r-- | lib/lufa/LUFA/Common/CompilerSpecific.h | 97 | ||||
-rw-r--r-- | lib/lufa/LUFA/Common/Endianness.h | 493 |
7 files changed, 1665 insertions, 0 deletions
diff --git a/lib/lufa/LUFA/Common/ArchitectureSpecific.h b/lib/lufa/LUFA/Common/ArchitectureSpecific.h new file mode 100644 index 0000000000..28f2900b96 --- /dev/null +++ b/lib/lufa/LUFA/Common/ArchitectureSpecific.h @@ -0,0 +1,185 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 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 disclaims 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 definitions relating to specific processor architectures. + * + * \copydetails Group_ArchitectureSpecific + * + * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's + * functionality. + */ + +/** \ingroup Group_Common + * \defgroup Group_ArchitectureSpecific Architecture Specific Definitions + * \brief Architecture specific definitions relating to specific processor architectures. + * + * Architecture specific macros, functions and other definitions, which relate to specific architectures. This + * definitions may or may not be available in some form on other architectures, and thus should be protected by + * preprocessor checks in portable code to prevent compile errors. + * + * @{ + */ + +#ifndef __LUFA_ARCHSPEC_H__ +#define __LUFA_ARCHSPEC_H__ + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_COMMON_H) + #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. + #endif + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Public Interface - May be used in end-application: */ + /* 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() do { \ + __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"); \ + } while (0) + + /** 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. + * + * \note This macro is not available for all architectures. + */ + #define JTAG_DISABLE() do { \ + __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"); \ + } while (0) + #endif + + /** Defines a volatile \c NOP statement which cannot be optimized out by the compiler, and thus can always + * be set as a breakpoint in the resulting code. Useful for debugging purposes, where the optimizer + * removes/reorders code to the point where break points cannot reliably be set. + * + * \note This macro is not available for all architectures. + */ + #define JTAG_DEBUG_POINT() __asm__ __volatile__ ("nop" ::) + + /** Defines an explicit JTAG break point in the resulting binary via the assembly \c BREAK statement. When + * a JTAG is used, this causes the program execution to halt when reached until manually resumed. + * + * \note This macro is not available for all architectures. + */ + #define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("break" ::) + + /** Macro for testing condition "x" and breaking via \ref JTAG_DEBUG_BREAK() if the condition is false. + * + * \note This macro is not available for all architectures. + * + * \param[in] Condition Condition that will be evaluated. + */ + #define JTAG_ASSERT(Condition) do { \ + if (!(Condition)) \ + JTAG_DEBUG_BREAK(); \ + } while (0) + + /** Macro for testing condition \c "x" and writing debug data to the stdout stream if \c false. The stdout stream + * must be pre-initialized before this macro is run and linked to an output device, such as the microcontroller's + * USART peripheral. + * + * The output takes the form "{FILENAME}: Function {FUNCTION NAME}, Line {LINE NUMBER}: Assertion {Condition} failed." + * + * \note This macro is not available for all architectures. + * + * \param[in] Condition Condition that will be evaluated, + */ + #define STDOUT_ASSERT(Condition) do { \ + if (!(Condition)) \ + printf_P(PSTR("%s: Function \"%s\", Line %d: " \ + "Assertion \"%s\" failed.\r\n"), \ + __FILE__, __func__, __LINE__, #Condition); \ + } while (0) + + #if !defined(pgm_read_ptr) || defined(__DOXYGEN__) + /** Reads a pointer out of PROGMEM space on the AVR8 architecture. This is a wrapper for the avr-libc + * \c pgm_read_word() macro with a \c void* cast, so that its value can be assigned directly to a + * pointer variable or used in pointer arithmetic without further casting in C. + * + * \note This macro is not available for all architectures. + * + * \param[in] Address Address of the pointer to read. + * + * \return Pointer retrieved from PROGMEM space. + */ + #define pgm_read_ptr(Address) (void*)pgm_read_word(Address) + #endif + #elif (ARCH == ARCH_UC3) + #define JTAG_DEBUG_POINT() __asm__ __volatile__ ("nop" ::) + #define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("breakpoint" ::) + #define JTAG_ASSERT(Condition) do { \ + if (!(Condition)) \ + JTAG_DEBUG_BREAK(); \ + } while (0) + #define STDOUT_ASSERT(Condition) do { \ + if (!(Condition)) \ + printf("%s: Function \"%s\", Line %d: " \ + "Assertion \"%s\" failed.\r\n", \ + __FILE__, __func__, __LINE__, #Condition); \ + } while (0) + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/lib/lufa/LUFA/Common/Architectures.h b/lib/lufa/LUFA/Common/Architectures.h new file mode 100644 index 0000000000..587367413e --- /dev/null +++ b/lib/lufa/LUFA/Common/Architectures.h @@ -0,0 +1,84 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 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 disclaims 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 Supported library architecture defines. + * + * \copydetails Group_Architectures + * + * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's + * functionality. + */ + +/** \ingroup Group_Common + * \defgroup Group_Architectures Hardware Architectures + * \brief Supported library architecture defines. + * + * Architecture macros for selecting the desired target microcontroller architecture. One of these values should be + * defined as the value of \c ARCH in the user project makefile via the \c -D compiler switch to GCC, to select the + * target architecture. + * + * The selected architecture should remain consistent with the makefile \c ARCH value, which is used to select the + * underlying driver source files for each architecture. + * + * @{ + */ + +#ifndef __LUFA_ARCHITECTURES_H__ +#define __LUFA_ARCHITECTURES_H__ + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_COMMON_H) + #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** Selects the Atmel 8-bit AVR (AT90USB* and ATMEGA*U* chips) architecture. */ + #define ARCH_AVR8 0 + + /** Selects the Atmel 32-bit UC3 AVR (AT32UC3* chips) architecture. */ + #define ARCH_UC3 1 + + /** Selects the Atmel XMEGA AVR (ATXMEGA* chips) architecture. */ + #define ARCH_XMEGA 2 + + #if !defined(__DOXYGEN__) + #define ARCH_ ARCH_AVR8 + + #if !defined(ARCH) + #define ARCH ARCH_AVR8 + #endif + #endif + +#endif + +/** @} */ + diff --git a/lib/lufa/LUFA/Common/Attributes.h b/lib/lufa/LUFA/Common/Attributes.h new file mode 100644 index 0000000000..c8e4104d72 --- /dev/null +++ b/lib/lufa/LUFA/Common/Attributes.h @@ -0,0 +1,150 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 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 disclaims 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 Special function/variable attribute macros. + * + * \copydetails Group_FuncVarAttributes + * + * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's + * functionality. + */ + +/** \ingroup Group_Common + * \defgroup Group_FuncVarAttributes Function/Variable Attributes + * \brief Special function/variable attribute macros. + * + * This module contains macros for applying specific attributes to functions and variables to control various + * optimizer and code generation features of the compiler. Attributes may be placed in the function prototype + * or variable declaration in any order, and multiple attributes can be specified for a single item via a space + * separated list. + * + * On incompatible versions of GCC or on other compilers, these macros evaluate to nothing unless they are + * critical to the code's function and thus must throw a compile error when used. + * + * @{ + */ + +#ifndef __LUFA_ATTR_H__ +#define __LUFA_ATTR_H__ + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_COMMON_H) + #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + #if (__GNUC__ >= 3) || defined(__DOXYGEN__) + /** Indicates to the compiler that the function can not ever return, so that any stack restoring or + * return code may be omitted by the compiler in the resulting binary. + */ + #define ATTR_NO_RETURN __attribute__ ((noreturn)) + + /** Indicates that the function returns a value which should not be ignored by the user code. When + * applied, any ignored return value from calling the function will produce a compiler warning. + */ + #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) + + /** Indicates that the specified parameters of the function are pointers which should never be \c NULL. + * When applied as a 1-based comma separated list the compiler will emit a warning if the specified + * parameters are known at compiler time to be \c NULL at the point of calling the function. + */ + #define ATTR_NON_NULL_PTR_ARG(...) __attribute__ ((nonnull (__VA_ARGS__))) + + /** Removes any preamble or postamble from the function. When used, the function will not have any + * register or stack saving code. This should be used with caution, and when used the programmer + * is responsible for maintaining stack and register integrity. + */ + #define ATTR_NAKED __attribute__ ((naked)) + + /** Prevents the compiler from considering a specified function for in-lining. When applied, the given + * function will not be in-lined under any circumstances. + */ + #define ATTR_NO_INLINE __attribute__ ((noinline)) + + /** Forces the compiler to inline the specified function. When applied, the given function will be + * in-lined under all circumstances. + */ + #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline)) + + /** Indicates that the specified function is pure, in that it has no side-effects other than global + * or parameter variable access. + */ + #define ATTR_PURE __attribute__ ((pure)) + + /** Indicates that the specified function is constant, in that it has no side effects other than + * parameter access. + */ + #define ATTR_CONST __attribute__ ((const)) + + /** Marks a given function as deprecated, which produces a warning if the function is called. */ + #define ATTR_DEPRECATED __attribute__ ((deprecated)) + + /** Marks a function as a weak reference, which can be overridden by other functions with an + * identical name (in which case the weak reference is discarded at link time). + */ + #define ATTR_WEAK __attribute__ ((weak)) + #endif + + /** 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 + * 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"))) + + /** Places the function in one of the initialization sections, which execute before the main function + * of the application. Refer to the avr-libc manual for more information on the initialization sections. + * + * \param[in] SectionIndex Initialization section number where the function should be placed. + */ + #define ATTR_INIT_SECTION(SectionIndex) __attribute__ ((used, naked, section (".init" #SectionIndex ))) + + /** Marks a function as an alias for another function. + * + * \param[in] Func Name of the function which the given function name should alias. + */ + #define ATTR_ALIAS(Func) __attribute__ ((alias( #Func ))) + + /** Marks a variable or struct element for packing into the smallest space available, omitting any + * alignment bytes usually added between fields to optimize field accesses. + */ + #define ATTR_PACKED __attribute__ ((packed)) + + /** Indicates the minimum alignment in bytes for a variable or struct element. + * + * \param[in] Bytes Minimum number of bytes the item should be aligned to. + */ + #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) +#endif + +/** @} */ + diff --git a/lib/lufa/LUFA/Common/BoardTypes.h b/lib/lufa/LUFA/Common/BoardTypes.h new file mode 100644 index 0000000000..e945523427 --- /dev/null +++ b/lib/lufa/LUFA/Common/BoardTypes.h @@ -0,0 +1,263 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 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 disclaims 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 Supported pre-made board hardware defines. + * + * \copydetails Group_BoardTypes + * + * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's + * functionality. + */ + +/** \ingroup Group_Common + * \defgroup Group_BoardTypes Board Types + * \brief Supported pre-made board hardware defines. + * + * Board macros for indicating the chosen physical board hardware to the library. These macros should be used when + * defining the \c BOARD token to the chosen hardware via the \c -D switch in the project makefile. If a custom + * board is used, the \ref BOARD_NONE or \ref BOARD_USER values should be selected. + * + * @{ + */ + +#ifndef __LUFA_BOARDTYPES_H__ +#define __LUFA_BOARDTYPES_H__ + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_COMMON_H) + #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** Selects the user-defined board drivers, which should be placed in the user project's folder + * under a directory named \c /Board/. Each board driver should be named identically to the LUFA + * master board driver (i.e., driver in the \c LUFA/Drivers/Board directory) so that the library + * can correctly identify it. + */ + #define BOARD_USER 0 + + /** Disables board drivers when operation will not be adversely affected (e.g. LEDs) - use of board drivers + * such as the Joystick driver, where the removal would adversely affect the code's operation is still disallowed. */ + #define BOARD_NONE 1 + + /** Selects the USBKEY specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ + #define BOARD_USBKEY 2 + + /** Selects the STK525 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ + #define BOARD_STK525 3 + + /** Selects the STK526 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ + #define BOARD_STK526 4 + + /** Selects the RZUSBSTICK specific board drivers, including the driver for the boards LEDs. */ + #define BOARD_RZUSBSTICK 5 + + /** Selects the ATAVRUSBRF01 specific board drivers, including the driver for the board LEDs. */ + #define BOARD_ATAVRUSBRF01 6 + + /** Selects the BUMBLEB specific board drivers, using the officially recommended peripheral layout. */ + #define BOARD_BUMBLEB 7 + + /** Selects the XPLAIN (Revision 2 or newer) specific board drivers, including LED and Dataflash drivers. */ + #define BOARD_XPLAIN 8 + + /** Selects the XPLAIN (Revision 1) specific board drivers, including LED and Dataflash drivers. */ + #define BOARD_XPLAIN_REV1 9 + + /** Selects the EVK527 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ + #define BOARD_EVK527 10 + + /** Selects the Teensy version 1.x specific board drivers, including the driver for the board LEDs. */ + #define BOARD_TEENSY 11 + + /** Selects the USBTINY MKII specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_USBTINYMKII 12 + + /** Selects the Benito specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_BENITO 13 + + /** Selects the JM-DB-U2 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_JMDBU2 14 + + /** Selects the Olimex AVR-USB-162 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_OLIMEX162 15 + + /** Selects the UDIP specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_UDIP 16 + + /** Selects the BUI specific board drivers, including the driver for the board LEDs. */ + #define BOARD_BUI 17 + + /** Selects the Arduino Uno specific board drivers, including the driver for the board LEDs. */ + #define BOARD_UNO 18 + + /** Selects the Busware CUL V3 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_CULV3 19 + + /** Selects the Blackcat USB JTAG specific board drivers, including the driver for the board LEDs. */ + #define BOARD_BLACKCAT 20 + + /** Selects the Maximus specific board drivers, including the driver for the board LEDs. */ + #define BOARD_MAXIMUS 21 + + /** Selects the Minimus specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_MINIMUS 22 + + /** Selects the Adafruit U4 specific board drivers, including the Button driver. */ + #define BOARD_ADAFRUITU4 23 + + /** Selects the Microsin AVR-USB162 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_MICROSIN162 24 + + /** Selects the Kernel Concepts USBFOO specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_USBFOO 25 + + /** Selects the Sparkfun ATMEGA8U2 specific board drivers, including the driver for the board LEDs. */ + #define BOARD_SPARKFUN8U2 26 + + /** Selects the Atmel EVK1101 specific board drivers, including the Button, Joystick and LED drivers. */ + #define BOARD_EVK1101 27 + + /** Selects the Busware TUL specific board drivers, including the Button and LED drivers. */ + #define BOARD_TUL 28 + + /** Selects the Atmel EVK1100 specific board drivers, including the Button, Joystick and LED drivers. */ + #define BOARD_EVK1100 29 + + /** Selects the Atmel EVK1104 specific board drivers, including the Button and LED drivers. */ + #define BOARD_EVK1104 30 + + /** Selects the Atmel XMEGA A3BU Xplained specific board drivers, including Dataflash, Button and LED drivers. */ + #define BOARD_A3BU_XPLAINED 31 + + /** Selects the Teensy version 2.x specific board drivers, including the driver for the board LEDs. */ + #define BOARD_TEENSY2 32 + + /** Selects the USB2AX version 1 and 2 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_USB2AX 33 + + /** Selects the USB2AX version 3 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_USB2AX_V3 34 + + /** Selects the Micropendous 32U2 specific board drivers, including the Button and LED drivers. */ + #define BOARD_MICROPENDOUS_32U2 35 + + /** Selects the Micropendous A specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_A 36 + + /** Selects the Micropendous 1 specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_1 37 + + /** Selects the Micropendous 2 specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_2 38 + + /** Selects the Micropendous 3 specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_3 39 + + /** Selects the Micropendous 4 specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_4 40 + + /** Selects the Micropendous DIP specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_DIP 41 + + /** Selects the Micropendous (Arduino-like) revision 1 specific board drivers, including the Button and LED drivers. */ + #define BOARD_MICROPENDOUS_REV1 42 + + /** Selects the Micropendous (Arduino-like) revision 2 specific board drivers, including the Button and LED drivers. */ + #define BOARD_MICROPENDOUS_REV2 43 + + /** Selects the XMEGA B1 Xplained specific board drivers, including the Button and LED drivers. */ + #define BOARD_B1_XPLAINED 44 + + /** Selects the Bitwizard Multio specific board drivers, including the driver for the board LEDs. */ + #define BOARD_MULTIO 45 + + /** Selects the Bitwizard Big-Multio specific board drivers, including the driver for the board LEDs. */ + #define BOARD_BIGMULTIO 46 + + /** Selects the DorkbotPDX Duce specific board drivers, including the driver for the board LEDs. */ + #define BOARD_DUCE 47 + + /** Selects the Olimex AVR-USB-32U4 specific board drivers, including the Button and LED drivers. */ + #define BOARD_OLIMEX32U4 48 + + /** Selects the Olimex AVR-USB-T32U4 specific board drivers, including the Button and LED drivers. */ + #define BOARD_OLIMEXT32U4 49 + + /** Selects the Olimex AVR-ISP-MK2 specific board drivers, including the Button and LED drivers. */ + #define BOARD_OLIMEXISPMK2 50 + + /** Selects the Arduino Leonardo specific board drivers, including the driver for the board LEDs. */ + #define BOARD_LEONARDO 51 + + /** Selects the UC3-A3 Xplained specific board drivers, including the Button and LED drivers. */ + #define BOARD_UC3A3_XPLAINED 52 + + /** Selects the USB2AX version 3.1 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_USB2AX_V31 53 + + /** Selects the Stange-ISP specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_STANGE_ISP 54 + + /** Selects the XMEGA C3 XPLAINED specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_C3_XPLAINED 55 + + /** Selects the U2S specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_U2S 56 + + /** Selects the Arduino YUN specific board drivers, including the driver for the board LEDs. */ + #define BOARD_YUN 57 + + /** Selects the Arduino Micro specific board drivers, including the driver for the board LEDs. */ + #define BOARD_MICRO 58 + + /** Selects the Pololu A-Star Micro specific board drivers, including the driver for the board LEDs. */ + #define BOARD_POLOLUMICRO 59 + + /** Selects the Atmel Xplained-MINI specific board drivers, including the driver for the board LEDs. */ + #define BOARD_XPLAINED_MINI 60 + + /** Selects the QMK specific board drivres, including the driver for the board LEDs. */ + #define BOARD_QMK 61 + + #if !defined(__DOXYGEN__) + #define BOARD_ BOARD_NONE + + #if !defined(BOARD) + #define BOARD BOARD_NONE + #endif + #endif + +#endif + +/** @} */ + diff --git a/lib/lufa/LUFA/Common/Common.h b/lib/lufa/LUFA/Common/Common.h new file mode 100644 index 0000000000..6864eb64ca --- /dev/null +++ b/lib/lufa/LUFA/Common/Common.h @@ -0,0 +1,393 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 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 disclaims 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. +*/ + +/** \dir + * \brief Common library header files. + * + * This folder contains header files which are common to all parts of the LUFA library. They may be used freely in + * user applications. + */ + +/** \file + * \brief Common library convenience headers, macros and functions. + * + * \copydetails Group_Common + */ + +/** \defgroup Group_Common Common Utility Headers - LUFA/Drivers/Common/Common.h + * \brief Common library convenience headers, macros and functions. + * + * Common utility headers containing macros, functions, enums and types which are common to all + * aspects of the library. + * + * @{ + */ + +/** \defgroup Group_GlobalInt Global Interrupt Macros + * \brief Convenience macros for the management of interrupts globally within the device. + * + * Macros and functions to create and control global interrupts within the device. + */ + +#ifndef __LUFA_COMMON_H__ +#define __LUFA_COMMON_H__ + + /* Macros: */ + #define __INCLUDE_FROM_COMMON_H + + /* Includes: */ + #include <stdint.h> + #include <stdbool.h> + #include <string.h> + #include <stddef.h> + + #include "Architectures.h" + #include "BoardTypes.h" + #include "ArchitectureSpecific.h" + #include "CompilerSpecific.h" + #include "Attributes.h" + + #if defined(USE_LUFA_CONFIG_HEADER) + #include "LUFAConfig.h" + #endif + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Architecture specific utility includes: */ + #if defined(__DOXYGEN__) + /** Type define for an unsigned integer the same width as the selected architecture's machine register. + * This is distinct from the non-specific standard int data type, whose width is machine dependant but + * which may not reflect the actual machine register width on some targets (e.g. AVR8). + */ + typedef MACHINE_REG_t uint_reg_t; + #elif (ARCH == ARCH_AVR8) + #include <avr/io.h> + #include <avr/interrupt.h> + #include <avr/pgmspace.h> + #include <avr/eeprom.h> + #include <avr/boot.h> + #include <math.h> + #include <util/delay.h> + + typedef uint8_t uint_reg_t; + + #define ARCH_HAS_EEPROM_ADDRESS_SPACE + #define ARCH_HAS_FLASH_ADDRESS_SPACE + #define ARCH_HAS_MULTI_ADDRESS_SPACE + #define ARCH_LITTLE_ENDIAN + + #include "Endianness.h" + #elif (ARCH == ARCH_UC3) + #include <avr32/io.h> + #include <math.h> + + // === TODO: Find abstracted way to handle these === + #define PROGMEM + #define pgm_read_byte(x) *x + #define memcmp_P(...) memcmp(__VA_ARGS__) + #define memcpy_P(...) memcpy(__VA_ARGS__) + // ================================================= + + typedef uint32_t uint_reg_t; + + #define ARCH_BIG_ENDIAN + + #include "Endianness.h" + #elif (ARCH == ARCH_XMEGA) + #include <avr/io.h> + #include <avr/interrupt.h> + #include <avr/pgmspace.h> + #include <avr/eeprom.h> + #include <math.h> + #include <util/delay.h> + + typedef uint8_t uint_reg_t; + + #define ARCH_HAS_EEPROM_ADDRESS_SPACE + #define ARCH_HAS_FLASH_ADDRESS_SPACE + #define ARCH_HAS_MULTI_ADDRESS_SPACE + #define ARCH_LITTLE_ENDIAN + + #include "Endianness.h" + #else + #error Unknown device architecture specified. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + #if !defined(__DOXYGEN__) + // Obsolete, retained for compatibility with user code + #define MACROS do + #define MACROE while (0) + #endif + + /** Convenience macro to determine the larger of two values. + * + * \attention This macro should only be used with operands that do not have side effects from being evaluated + * multiple times. + * + * \param[in] x First value to compare + * \param[in] y First value to compare + * + * \return The larger of the two input parameters + */ + #if !defined(MAX) || defined(__DOXYGEN__) + #define MAX(x, y) (((x) > (y)) ? (x) : (y)) + #endif + + /** Convenience macro to determine the smaller of two values. + * + * \attention This macro should only be used with operands that do not have side effects from being evaluated + * multiple times. + * |