aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Common
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-12-26 13:01:37 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-12-26 13:01:37 +0000
commit39ac72f2d12a9c62b2e876de4eee6c34a864ff74 (patch)
tree1a33de5ae88b184555af86173669730c55dfa4b3 /LUFA/Common
parent12418e6eaffcf81dc160ab760df9682e7e34c3fa (diff)
downloadlufa-39ac72f2d12a9c62b2e876de4eee6c34a864ff74.tar.gz
lufa-39ac72f2d12a9c62b2e876de4eee6c34a864ff74.tar.bz2
lufa-39ac72f2d12a9c62b2e876de4eee6c34a864ff74.zip
Make a new general RingBuffer.h misc library driver, instead of the per-application LightweightRingBuff.h ring buffers. Change over projects to use the new driver.
Add ORDERED_EP_CONFIG to the device Projects (only) that use only a single class driver, or where the endpoint ordering is fixed, to save on compiled binary size. Added new GCC_FORCE_POINTER_ACCESS() macro to correct GCC's mishandling of struct pointers.
Diffstat (limited to 'LUFA/Common')
-rw-r--r--LUFA/Common/Common.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h
index 3860eff67..f2e5e313d 100644
--- a/LUFA/Common/Common.h
+++ b/LUFA/Common/Common.h
@@ -85,14 +85,14 @@
*
* \ingroup Group_Debugging
*/
- #define JTAG_DEBUG_POINT() __asm__ volatile ("NOP" ::)
+ #define JTAG_DEBUG_POINT() __asm__ __volatile__ ("NOP" ::)
/** Defines an explicit JTAG break point in the resulting binary via the ASM BREAK statement. When
* a JTAG is used, this causes the program execution to halt when reached until manually resumed.
*
* \ingroup Group_Debugging
*/
- #define JTAG_DEBUG_BREAK() __asm__ volatile ("BREAK" ::)
+ #define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("BREAK" ::)
/** Macro for testing condition "x" and breaking via JTAG_DEBUG_BREAK() if the condition is false.
*
@@ -111,6 +111,16 @@
#define STDOUT_ASSERT(x) MACROS{ if (!(x)) { printf_P(PSTR("%s: Function \"%s\", Line %d: " \
"Assertion \"%s\" failed.\r\n"), \
__FILE__, __func__, __LINE__, #x); } }MACROE
+
+ /** Forces GCC to use pointer indirection (via the AVR's pointer register pairs) when accessing the given
+ * struct pointer. In some cases GCC will emit non-optimal assembly code when accessing a structure through
+ * a pointer, resulting in a larger binary. When this macro is used on a (non-const) structure pointer before
+ * use, it will force GCC to use pointer indirection on the elements rather than direct store and load
+ * instructions.
+ *
+ * \param[in, out] StructPtr Pointer to a structure which is to be forced into indirect access mode.
+ */
+ #define GCC_FORCE_POINTER_ACCESS(StructPtr) __asm__ __volatile__("" : "=b" (StructPtr) : "0" (StructPtr))
#if !defined(pgm_read_ptr) || defined(__DOXYGEN__)
/** Reads a pointer out of PROGMEM space. This is currently a wrapper for the avr-libc pgm_read_ptr()