123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- #ifndef __LUFA_ARCHSPEC_H__
- #define __LUFA_ARCHSPEC_H__
-
- #if !defined(__INCLUDE_FROM_COMMON_H)
- #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
- #endif
-
- #if defined(__cplusplus)
- extern "C" {
- #endif
-
-
- #if (ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA) || defined(__DOXYGEN__)
- #if (ARCH == ARCH_AVR8) || defined(__DOXYGEN__)
-
- #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)
-
- #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
-
- #define JTAG_DEBUG_POINT() __asm__ __volatile__ ("nop" ::)
-
- #define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("break" ::)
-
- #define JTAG_ASSERT(Condition) do { \
- if (!(Condition)) \
- JTAG_DEBUG_BREAK()
- } while (0)
-
- #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__)
-
- #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
-
- #if defined(__cplusplus)
- }
- #endif
- #endif
|